Change location of Python -fastproxy methods in proxy class
Output methods in the same place that they would be generated in the proxy class when not using -fastproxy. When using autodoc, the two definitions of the method are then right after each other.
This commit is contained in:
parent
eb81355196
commit
c2805e5a44
1 changed files with 14 additions and 31 deletions
|
|
@ -4676,36 +4676,24 @@ public:
|
||||||
builtin_tp_init = 0;
|
builtin_tp_init = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now emit methods */
|
|
||||||
if (!builtin) {
|
if (!builtin) {
|
||||||
|
/* Now emit methods */
|
||||||
Printv(f_shadow_file, f_shadow, NIL);
|
Printv(f_shadow_file, f_shadow, NIL);
|
||||||
|
|
||||||
if (fastproxy) {
|
/* Now the Ptr class */
|
||||||
Printf(f_shadow_file, "\n");
|
if (classptr) {
|
||||||
List *shadow_list = Getattr(n, "shadow_methods");
|
Printv(f_shadow_file, "\nclass ", class_name, "Ptr(", class_name, "):\n", tab4, "def __init__(self, this):\n", NIL);
|
||||||
for (int i = 0; i < Len(shadow_list); ++i) {
|
if (!modern) {
|
||||||
String *symname = Getitem(shadow_list, i);
|
Printv(f_shadow_file,
|
||||||
Printf(f_shadow_file, tab4);
|
tab8, "try:\n", tab8, tab4, "self.this.append(this)\n",
|
||||||
Printf(f_shadow_file, "%s = _swig_new_instance_method(%s.%s)\n", symname, module, Swig_name_member(NSPACE_TODO, class_name, symname));
|
tab8, "except __builtin__.Exception:\n", tab8, tab4, "self.this = this\n", tab8, "self.this.own(0)\n", tab8, "self.__class__ = ", class_name, "\n", NIL);
|
||||||
|
} else {
|
||||||
|
Printv(f_shadow_file,
|
||||||
|
tab8, "try:\n", tab8, tab4, "self.this.append(this)\n",
|
||||||
|
tab8, "except __builtin__.Exception:\n", tab8, tab4, "self.this = this\n", tab8, "self.this.own(0)\n", tab8, "self.__class__ = ", class_name, "\n", NIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Now the Ptr class */
|
|
||||||
if (classptr && !builtin) {
|
|
||||||
Printv(f_shadow_file, "\nclass ", class_name, "Ptr(", class_name, "):\n", tab4, "def __init__(self, this):\n", NIL);
|
|
||||||
if (!modern) {
|
|
||||||
Printv(f_shadow_file,
|
|
||||||
tab8, "try:\n", tab8, tab4, "self.this.append(this)\n",
|
|
||||||
tab8, "except __builtin__.Exception:\n", tab8, tab4, "self.this = this\n", tab8, "self.this.own(0)\n", tab8, "self.__class__ = ", class_name, "\n", NIL);
|
|
||||||
} else {
|
|
||||||
Printv(f_shadow_file,
|
|
||||||
tab8, "try:\n", tab8, tab4, "self.this.append(this)\n",
|
|
||||||
tab8, "except __builtin__.Exception:\n", tab8, tab4, "self.this = this\n", tab8, "self.this.own(0)\n", tab8, "self.__class__ = ", class_name, "\n", NIL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!builtin) {
|
|
||||||
Printf(f_shadow_file, "\n");
|
Printf(f_shadow_file, "\n");
|
||||||
Printf(f_shadow_file, "# Register %s in %s:\n", class_name, module);
|
Printf(f_shadow_file, "# Register %s in %s:\n", class_name, module);
|
||||||
Printf(f_shadow_file, "%s.%s_swigregister(%s)\n", module, class_name, class_name);
|
Printf(f_shadow_file, "%s.%s_swigregister(%s)\n", module, class_name, class_name);
|
||||||
|
|
@ -4840,13 +4828,8 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fproxy) {
|
if (fproxy) {
|
||||||
List *shadow_list = Getattr(getCurrentClass(), "shadow_methods");
|
Printf(f_shadow, tab4);
|
||||||
if (!shadow_list) {
|
Printf(f_shadow, "%s = _swig_new_instance_method(%s.%s)\n", symname, module, Swig_name_member(NSPACE_TODO, class_name, symname));
|
||||||
shadow_list = NewList();
|
|
||||||
Setattr(getCurrentClass(), "shadow_methods", shadow_list);
|
|
||||||
Delete(shadow_list);
|
|
||||||
}
|
|
||||||
Append(shadow_list, symname);
|
|
||||||
}
|
}
|
||||||
Delete(fullname);
|
Delete(fullname);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue