additional fixes to %constant directive
This commit is contained in:
parent
c21e2423a0
commit
cfaf2f97fd
2 changed files with 17 additions and 25 deletions
|
|
@ -3171,25 +3171,25 @@ public:
|
|||
Replaceall(tm, "$value", value);
|
||||
if (!builtin && (shadow) && (!(shadow & PYSHADOW_MEMBER)) && (!in_class || !Getattr(n, "feature:python:callback"))) {
|
||||
// Generate method which registers the new constant
|
||||
Printf(f_wrappers, "SWIGINTERN PyObject* %s_swigregister(PyObject* SWIGUNUSEDPARM(self), PyObject* args) {\n", iname);
|
||||
Printf(f_wrappers, tab2 "PyObject *m;\n", tm);
|
||||
Printf(f_wrappers, "SWIGINTERN PyObject *%s_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {\n", iname);
|
||||
Printf(f_wrappers, tab2 "PyObject *module;\n", tm);
|
||||
if (modernargs) {
|
||||
if (fastunpack) {
|
||||
Printf(f_wrappers, tab2 "if (!SWIG_Python_UnpackTuple(args,(char*)\"swigregister\", 1, 1,&m)) return NULL;\n");
|
||||
Printf(f_wrappers, tab2 "if (!SWIG_Python_UnpackTuple(args,(char*)\"swigconstant\", 1, 1,&module)) return NULL;\n");
|
||||
} else {
|
||||
Printf(f_wrappers, tab2 "if (!PyArg_UnpackTuple(args,(char*)\"swigregister\", 1, 1,&m)) return NULL;\n");
|
||||
Printf(f_wrappers, tab2 "if (!PyArg_UnpackTuple(args,(char*)\"swigconstant\", 1, 1,&module)) return NULL;\n");
|
||||
}
|
||||
} else {
|
||||
Printf(f_wrappers, tab2 "if (!PyArg_ParseTuple(args,(char*)\"O:swigregister\", &m)) return NULL;\n");
|
||||
Printf(f_wrappers, tab2 "if (!PyArg_ParseTuple(args,(char*)\"O:swigconstant\", &module)) return NULL;\n");
|
||||
}
|
||||
Printf(f_wrappers, tab2 "PyObject* d = PyModule_GetDict(m);\n");
|
||||
Printf(f_wrappers, tab2 "if(!d) return NULL;\n");
|
||||
Printf(f_wrappers, tab2 "PyObject *d = PyModule_GetDict(module);\n");
|
||||
Printf(f_wrappers, tab2 "if (!d) return NULL;\n");
|
||||
Printf(f_wrappers, tab2 "%s\n", tm);
|
||||
Printf(f_wrappers, tab2 "return SWIG_Py_Void();\n");
|
||||
Printf(f_wrappers, "}\n\n\n");
|
||||
|
||||
// Register the method in SwigMethods array
|
||||
String *cname = NewStringf("%s_swigregister", iname);
|
||||
String *cname = NewStringf("%s_swigconstant", iname);
|
||||
add_method(cname, cname, 0);
|
||||
Delete(cname);
|
||||
} else {
|
||||
|
|
@ -3210,14 +3210,12 @@ public:
|
|||
if (!builtin && (shadow) && (!(shadow & PYSHADOW_MEMBER))) {
|
||||
if (!in_class) {
|
||||
Printv(f_shadow, "\n",NIL);
|
||||
Printv(f_shadow, module, ".", iname, "_swigregister(",module,")\n", NIL);
|
||||
Printv(f_shadow, iname, "_swigregister = ", module, ".", iname, "_swigregister\n", NIL);
|
||||
Printv(f_shadow, module, ".", iname, "_swigconstant(",module,")\n", NIL);
|
||||
Printv(f_shadow, iname, " = ", module, ".", iname, "\n", NIL);
|
||||
} else {
|
||||
if (!(Getattr(n, "feature:python:callback"))) {
|
||||
Printv(f_shadow_stubs, "\n",NIL);
|
||||
Printv(f_shadow_stubs, module, ".", iname, "_swigregister(", module, ")\n", NIL);
|
||||
Printv(f_shadow_stubs, iname, "_swigregister = ", module, ".", iname, "_swigregister\n", NIL);
|
||||
Printv(f_shadow_stubs, module, ".", iname, "_swigconstant(", module, ")\n", NIL);
|
||||
Printv(f_shadow_stubs, iname, " = ", module, ".", iname, "\n", NIL);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue