---- Source/Modules/mystuff/python.cxx.18 2004-01-30 15:22:49.000000000 -0800
-+++ Source/Modules/python.cxx 2004-01-30 16:27:22.000000000 -0800
-@@ -426,19 +426,21 @@
- * functions.
- * ------------------------------------------------------------ */
-
- void emitFunctionShadowHelper(Node *n, File *f_dest, String *name, int kw) {
-- if ( ! have_addtofunc(n) && ! have_docstring(n) ) {
-- /* If there is no addtofunc or docstring directive then just assign from the extension module */
-+ if ( !have_pythonprepend(n) && !have_pythonappend(n) && !have_docstring(n) ) {
-+ /* If there is no pythonappend or docstring directive then just assign from the extension module */
- Printv(f_dest, "\n", name, " = ", module, ".", name, "\n", NIL);
- } else {
- /* Otherwise make a wrapper function to insert the code into */
- Printv(f_dest, "\ndef ", name, "(*args", (kw ? ", **kwargs" : ""), "):\n", NIL);
- if ( have_docstring(n) )
- Printv(f_dest, tab4, docstring(n, AUTODOC_FUNC, tab4), "\n", NIL);
-- if ( have_addtofunc(n) ) {
-+ if ( have_pythonprepend(n) )
-+ Printv(f_dest, tab4, pythonprepend(n), "\n", NIL);
-+ if ( have_pythonappend(n) ) {
- Printv(f_dest, tab4, "val = ", funcCallHelper(name, kw), "\n", NIL);
-- Printv(f_dest, tab4, addtofunc(n), "\n", NIL);
-+ Printv(f_dest, tab4, pythonappend(n), "\n", NIL);
- Printv(f_dest, tab4, "return val\n", NIL);
- } else {
- Printv(f_dest, tab4, "return ", funcCallHelper(name, kw), "\n", NIL);
- }
-@@ -696,24 +698,49 @@
- }
-
-
- /* ------------------------------------------------------------
-- * have_addtofunc()
-- * Check if there is a %addtofunc directive and it has text
-+ * have_pythonprepend()
-+ * Check if there is a %pythonprepend directive and it has text
- * ------------------------------------------------------------ */
-
-- bool have_addtofunc(Node *n) {
-- String* str = Getattr(n, "feature:addtofunc");
-+ bool have_pythonprepend(Node *n) {
-+ String* str = Getattr(n, "feature:pythonprepend");
- return (str != NULL && Len(str) > 0);
- }
-
- /* ------------------------------------------------------------
-- * addtofunc()
-- * Get the %addtofunc code, stripping off {} if neccessary
-+ * pythonprepend()
-+ * Get the %pythonprepend code, stripping off {} if neccessary
- * ------------------------------------------------------------ */
-
-- String *addtofunc(Node *n) {
-- String* str = Getattr(n, "feature:addtofunc");
-+ String *pythonprepend(Node *n) {
-+ String* str = Getattr(n, "feature:pythonprepend");
-+ char* t = Char(str);
-+ if (*t == '{') {
-+ Delitem(str ,0);
-+ Delitem(str,DOH_END);
-+ }
-+ return str;
-+ }
-+
-+ /* ------------------------------------------------------------
-+ * have_pythonappend()
-+ * Check if there is a %pythonappend directive and it has text
-+ * ------------------------------------------------------------ */
-+
-+ bool have_pythonappend(Node *n) {
-+ String* str = Getattr(n, "feature:pythonappend");
-+ return (str != NULL && Len(str) > 0);
-+ }
-+
-+ /* ------------------------------------------------------------
-+ * pythonappend()
-+ * Get the %pythonappend code, stripping off {} if neccessary
-+ * ------------------------------------------------------------ */
-+
-+ String *pythonappend(Node *n) {
-+ String* str = Getattr(n, "feature:pythonappend");
- char* t = Char(str);
- if (*t == '{') {
- Delitem(str ,0);
- Delitem(str,DOH_END);
-@@ -2124,17 +2151,19 @@
- Printv(f_shadow,pycode,"\n",NIL);
- } else {
-
- Printv(f_shadow, tab4, "def ", symname, "(*args", (allow_kwargs ? ", **kwargs" : ""), "):", NIL);
-- if ( ! have_addtofunc(n) && ! have_docstring(n)) {
-+ if ( !have_pythonprepend(n) && !have_pythonappend(n) && !have_docstring(n)) {
- Printv(f_shadow, " return ", funcCallHelper(Swig_name_member(class_name,symname), allow_kwargs), "\n", NIL);
- } else {
- Printv(f_shadow, "\n", NIL);
- if ( have_docstring(n) )
- Printv(f_shadow, tab8, docstring(n, AUTODOC_FUNC, tab8), "\n", NIL);
-- if ( have_addtofunc(n) ) {
-+ if ( have_pythonprepend(n) )
-+ Printv(f_shadow, tab8, pythonprepend(n), "\n", NIL);
-+ if ( have_pythonappend(n) ) {
- Printv(f_shadow, tab8, "val = ", funcCallHelper(Swig_name_member(class_name,symname), allow_kwargs), "\n", NIL);
-- Printv(f_shadow, tab8, addtofunc(n), "\n", NIL);
-+ Printv(f_shadow, tab8, pythonappend(n), "\n", NIL);
- Printv(f_shadow, tab8, "return val\n\n", NIL);
- } else {
- Printv(f_shadow, tab8, "return ", funcCallHelper(Swig_name_member(class_name,symname), allow_kwargs), "\n\n", NIL);
- }
-@@ -2153,16 +2182,18 @@
- virtual int staticmemberfunctionHandler(Node *n) {
- String *symname = Getattr(n,"sym:name");
- Language::staticmemberfunctionHandler(n);
- if (shadow) {
-- if ( !classic && (have_addtofunc(n) || have_docstring(n)) ) {
-+ if ( !classic && (have_pythonprepend(n) || have_pythonappend(n) || have_docstring(n)) ) {
- int kw = (check_kwargs(n) && !Getattr(n,"sym:overloaded")) ? 1 : 0;
- Printv(f_shadow, tab4, "def ", symname, "(*args", (kw ? ", **kwargs" : ""), "):\n", NIL);
- if ( have_docstring(n) )
- Printv(f_shadow, tab8, docstring(n, AUTODOC_STATICFUNC, tab8), "\n", NIL);
-- if ( have_addtofunc(n) ) {
-+ if ( have_pythonprepend(n) )
-+ Printv(f_shadow, tab8, pythonprepend(n), "\n", NIL);
-+ if ( have_pythonappend(n) ) {
- Printv(f_shadow, tab8, "val = ", funcCallHelper(Swig_name_member(class_name, symname), kw), "\n", NIL);
-- Printv(f_shadow, tab8, addtofunc(n), "\n", NIL);
-+ Printv(f_shadow, tab8, pythonappend(n), "\n", NIL);
- Printv(f_shadow, tab8, "return val\n\n", NIL);
- } else {
- Printv(f_shadow, tab8, "return ", funcCallHelper(Swig_name_member(class_name, symname), kw), "\n\n", NIL);
- }
-@@ -2253,8 +2284,10 @@
- Printv(f_shadow, tab4, "def __init__(self, *args",
- (allow_kwargs ? ", **kwargs" : ""), "):\n", NIL);
- if ( have_docstring(n) )
- Printv(f_shadow, tab8, docstring(n, AUTODOC_CTOR, tab8), "\n", NIL);
-+ if ( have_pythonprepend(n) )
-+ Printv(f_shadow, tab8, pythonprepend(n), "\n", NIL);
- Printv(f_shadow, pass_self, NIL);
- if (!modern) {
- Printv(f_shadow, tab8, "_swig_setattr(self, ", rclassname, ", 'this', ",
- funcCallHelper(Swig_name_construct(symname), allow_kwargs), ")\n", NIL);
-@@ -2267,10 +2300,10 @@
- Printv(f_shadow, tab8, "self.this = newobj.this\n", NIL);
- Printv(f_shadow, tab8, "self.thisown = 1\n", NIL);
- Printv(f_shadow, tab8, "del newobj.thisown\n", NIL);
- }
-- if ( have_addtofunc(n) )
-- Printv(f_shadow, tab8, addtofunc(n), "\n\n", NIL);
-+ if ( have_pythonappend(n) )
-+ Printv(f_shadow, tab8, pythonappend(n), "\n\n", NIL);
- Delete(pass_self);
- }
- have_constructor = 1;
- } else {
-@@ -2288,13 +2321,15 @@
- Printv(f_shadow_stubs, "\ndef ", symname, "(*args",
- (allow_kwargs ? ", **kwargs" : ""), "):\n", NIL);
- if ( have_docstring(n) )
- Printv(f_shadow_stubs, tab4, docstring(n, AUTODOC_CTOR, tab4), "\n", NIL);
-+ if ( have_pythonprepend(n) )
-+ Printv(f_shadow_stubs, tab4, pythonprepend(n), "\n", NIL);
- Printv(f_shadow_stubs, tab4, "val = ",
- funcCallHelper(Swig_name_construct(symname), allow_kwargs), "\n", NIL);
- Printv(f_shadow_stubs, tab4, "val.thisown = 1\n", NIL);
-- if ( have_addtofunc(n) )
-- Printv(f_shadow_stubs, tab4, addtofunc(n), "\n", NIL);
-+ if ( have_pythonappend(n) )
-+ Printv(f_shadow_stubs, tab4, pythonappend(n), "\n", NIL);
- Printv(f_shadow_stubs, tab4, "return val\n", NIL);
- }
- }
- }
-@@ -2323,13 +2358,16 @@
- } else {
- Printv(f_shadow, tab4, "def __del__(self, destroy=", module, ".", Swig_name_destroy(symname), "):\n", NIL);
- if ( have_docstring(n) )
- Printv(f_shadow, tab8, docstring(n, AUTODOC_DTOR, tab8), "\n", NIL);
-- if ( have_addtofunc(n) )
-- Printv(f_shadow, tab8, addtofunc(n), "\n", NIL);
-+ if ( have_pythonprepend(n) )
-+ Printv(f_shadow, tab8, pythonprepend(n), "\n", NIL);
- Printv(f_shadow, tab8, "try:\n", NIL);
- Printv(f_shadow, tab8, tab4, "if self.thisown: destroy(self)\n", NIL);
-- Printv(f_shadow, tab8, "except: pass\n\n", NIL);
-+ Printv(f_shadow, tab8, "except: pass\n", NIL);
-+ if ( have_pythonappend(n) )
-+ Printv(f_shadow, tab8, pythonappend(n), "\n", NIL);
-+ Printv(f_shadow, "\n", NIL);
- }
- }
- return SWIG_OK;
- }