Minor cleanup
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@207 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
e9cd55b7b8
commit
38c2518d77
2 changed files with 17 additions and 17 deletions
|
|
@ -144,18 +144,18 @@ void PYTHON::cpp_member_func(char *name, char *iname, DataType *t, ParmList *l)
|
||||||
// Now add it to the class
|
// Now add it to the class
|
||||||
|
|
||||||
if (use_kw)
|
if (use_kw)
|
||||||
*pyclass << tab4 << "def " << realname << "(*_args, **_kwargs):\n";
|
*pyclass << tab4 << "def " << realname << "(*args, **kwargs):\n";
|
||||||
else
|
else
|
||||||
*pyclass << tab4 << "def " << realname << "(*_args):\n";
|
*pyclass << tab4 << "def " << realname << "(*args):\n";
|
||||||
|
|
||||||
// Create a doc string
|
// Create a doc string
|
||||||
if (docstring && doc_entry) {
|
if (docstring && doc_entry) {
|
||||||
*pyclass << tab8 << "\"\"\"" << add_docstring(doc_entry) << "\"\"\"\n";
|
*pyclass << tab8 << "\"\"\"" << add_docstring(doc_entry) << "\"\"\"\n";
|
||||||
}
|
}
|
||||||
if (use_kw)
|
if (use_kw)
|
||||||
*pyclass << tab8 << "val = apply(" << module << "." << name_member(realname,class_name) << ",_args, _kwargs)\n";
|
*pyclass << tab8 << "val = apply(" << module << "." << name_member(realname,class_name) << ",args, kwargs)\n";
|
||||||
else
|
else
|
||||||
*pyclass << tab8 << "val = apply(" << module << "." << name_member(realname,class_name) << ",_args)\n";
|
*pyclass << tab8 << "val = apply(" << module << "." << name_member(realname,class_name) << ",args)\n";
|
||||||
|
|
||||||
// Check to see if the return type is an object
|
// Check to see if the return type is an object
|
||||||
if ((hash.lookup(t->name)) && (t->is_pointer <= 1)) {
|
if ((hash.lookup(t->name)) && (t->is_pointer <= 1)) {
|
||||||
|
|
@ -222,17 +222,17 @@ void PYTHON::cpp_constructor(char *name, char *iname, ParmList *l) {
|
||||||
// Create a new constructor
|
// Create a new constructor
|
||||||
|
|
||||||
if (use_kw)
|
if (use_kw)
|
||||||
*construct << tab4 << "def __init__(self,*_args,**_kwargs):\n";
|
*construct << tab4 << "def __init__(self,*args,**kwargs):\n";
|
||||||
else
|
else
|
||||||
*construct << tab4 << "def __init__(self,*_args):\n";
|
*construct << tab4 << "def __init__(self,*args):\n";
|
||||||
|
|
||||||
if (docstring && doc_entry)
|
if (docstring && doc_entry)
|
||||||
*construct << tab8 << "\"\"\"" << add_docstring(doc_entry) << "\"\"\"\n";
|
*construct << tab8 << "\"\"\"" << add_docstring(doc_entry) << "\"\"\"\n";
|
||||||
|
|
||||||
if (use_kw)
|
if (use_kw)
|
||||||
*construct << tab8 << "self.this = apply(" << module << "." << name_construct(realname) << ",_args,_kwargs)\n";
|
*construct << tab8 << "self.this = apply(" << module << "." << name_construct(realname) << ",args,kwargs)\n";
|
||||||
else
|
else
|
||||||
*construct << tab8 << "self.this = apply(" << module << "." << name_construct(realname) << ",_args)\n";
|
*construct << tab8 << "self.this = apply(" << module << "." << name_construct(realname) << ",args)\n";
|
||||||
*construct << tab8 << "self.thisown = 1\n";
|
*construct << tab8 << "self.thisown = 1\n";
|
||||||
emitAddPragmas(*construct,"__init__",tab8);
|
emitAddPragmas(*construct,"__init__",tab8);
|
||||||
have_constructor = 1;
|
have_constructor = 1;
|
||||||
|
|
@ -242,15 +242,15 @@ void PYTHON::cpp_constructor(char *name, char *iname, ParmList *l) {
|
||||||
// function for it.
|
// function for it.
|
||||||
|
|
||||||
if (use_kw)
|
if (use_kw)
|
||||||
*additional << "def " << realname << "(*_args,**_kwargs):\n";
|
*additional << "def " << realname << "(*args,**kwargs):\n";
|
||||||
else
|
else
|
||||||
*additional << "def " << realname << "(*_args):\n";
|
*additional << "def " << realname << "(*args):\n";
|
||||||
|
|
||||||
*additional << tab4 << "val = " << class_name << "Ptr(apply(";
|
*additional << tab4 << "val = " << class_name << "Ptr(apply(";
|
||||||
if (use_kw)
|
if (use_kw)
|
||||||
*additional << module << "." << name_construct(realname) << ",_args,_kwargs))\n";
|
*additional << module << "." << name_construct(realname) << ",args,kwargs))\n";
|
||||||
else
|
else
|
||||||
*additional << module << "." << name_construct(realname) << ",_args))\n";
|
*additional << module << "." << name_construct(realname) << ",args))\n";
|
||||||
*additional << tab4 << "val.thisown = 1\n"
|
*additional << tab4 << "val.thisown = 1\n"
|
||||||
<< tab4 << "return val\n\n";
|
<< tab4 << "return val\n\n";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -355,7 +355,7 @@ void PYTHON::initialize(void)
|
||||||
<< tab4 << "long lvalue;\n"
|
<< tab4 << "long lvalue;\n"
|
||||||
<< tab4 << "double dvalue;\n"
|
<< tab4 << "double dvalue;\n"
|
||||||
<< tab4 << "void *pvalue;\n"
|
<< tab4 << "void *pvalue;\n"
|
||||||
<< tab4 << "_swig_type_info *ptype;\n"
|
<< tab4 << "_swig_type_info **ptype;\n"
|
||||||
<< "} _swig_const_info;\n";
|
<< "} _swig_const_info;\n";
|
||||||
|
|
||||||
const_code << "#define SWIG_PY_INT 1\n"
|
const_code << "#define SWIG_PY_INT 1\n"
|
||||||
|
|
@ -490,7 +490,7 @@ void PYTHON::close_cmodule(void)
|
||||||
<< tab8 << tab8 << "PyDict_SetItemString(d,_swig_const_table[i].name, PyString_FromString((char *) _swig_const_table[i].pvalue));\n"
|
<< tab8 << tab8 << "PyDict_SetItemString(d,_swig_const_table[i].name, PyString_FromString((char *) _swig_const_table[i].pvalue));\n"
|
||||||
<< tab8 << tab8 << "break;\n"
|
<< tab8 << tab8 << "break;\n"
|
||||||
<< tab8 << tab4 << "case SWIG_PY_POINTER:\n"
|
<< tab8 << tab4 << "case SWIG_PY_POINTER:\n"
|
||||||
<< tab8 << tab8 << "PyDict_SetItemString(d,_swig_const_table[i].name, SWIG_NewPointerObj(_swig_const_table[i].pvalue, _swig_const_table[i].ptype));\n"
|
<< tab8 << tab8 << "PyDict_SetItemString(d,_swig_const_table[i].name, SWIG_NewPointerObj(_swig_const_table[i].pvalue, *(_swig_const_table[i].ptype)));\n"
|
||||||
<< tab8 << tab8 << "break;\n"
|
<< tab8 << tab8 << "break;\n"
|
||||||
<< tab8 << tab4 << "default:\n"
|
<< tab8 << tab4 << "default:\n"
|
||||||
<< tab8 << tab8 << "break;\n"
|
<< tab8 << tab8 << "break;\n"
|
||||||
|
|
@ -1049,14 +1049,14 @@ void PYTHON::create_function(char *name, char *iname, DataType *d, ParmList *l)
|
||||||
if (!need_wrapper) {
|
if (!need_wrapper) {
|
||||||
func << iname << " = " << module << "." << iname << "\n\n";
|
func << iname << " = " << module << "." << iname << "\n\n";
|
||||||
} else {
|
} else {
|
||||||
func << "def " << iname << "(*_args, **_kwargs):\n";
|
func << "def " << iname << "(*args, **kwargs):\n";
|
||||||
|
|
||||||
// Create a docstring for this
|
// Create a docstring for this
|
||||||
if (docstring && doc_entry) {
|
if (docstring && doc_entry) {
|
||||||
func << tab4 << "\"\"\"" << add_docstring(doc_entry) << "\"\"\"\n";
|
func << tab4 << "\"\"\"" << add_docstring(doc_entry) << "\"\"\"\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
func << tab4 << "val = apply(" << module << "." << iname << ",_args,_kwargs)\n";
|
func << tab4 << "val = apply(" << module << "." << iname << ",args,kwargs)\n";
|
||||||
|
|
||||||
if (munge_return) {
|
if (munge_return) {
|
||||||
// If the output of this object has been remapped in any way, we're
|
// If the output of this object has been remapped in any way, we're
|
||||||
|
|
@ -1370,7 +1370,7 @@ void PYTHON::declare_const(char *name, char *, DataType *type, char *value) {
|
||||||
} else {
|
} else {
|
||||||
// A funky user-defined type. We're going to munge it into a string pointer value
|
// A funky user-defined type. We're going to munge it into a string pointer value
|
||||||
type->remember();
|
type->remember();
|
||||||
const_code << tab4 << "{ SWIG_PY_POINTER, \"" << name << "\", 0, 0, (void *) " << value << ", SWIGTYPE" << type->print_mangle() << ")); \n";
|
const_code << tab4 << "{ SWIG_PY_POINTER, \"" << name << "\", 0, 0, (void *) " << value << ", &SWIGTYPE" << type->print_mangle() << "}, \n";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue