Changes needed for SWIG 1.3.27
authorRobin Dunn <robin@alldunn.com>
Sat, 21 Jan 2006 06:45:34 +0000 (06:45 +0000)
committerRobin Dunn <robin@alldunn.com>
Sat, 21 Jan 2006 06:45:34 +0000 (06:45 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37021 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/SWIG/README.txt
wxPython/SWIG/swig-1.3.27.patch [new file with mode: 0644]
wxPython/config.py
wxPython/src/_defs.i

index ade6b98f8b8224412713a977df2c8780594948d2..999b45fe1275823a87215c2f10baf716e6261542 100644 (file)
@@ -19,6 +19,25 @@ running setup.py, like this:
        python setup.py SWIG=/path/to/my/swig [other params]
 
 
+------------------------------------------------------------------------
+
+swig-1.3.27.patch
+
+    SWIG changed slightly how the runtime type_info data is structured
+    in order to optimize load time and runtime access.  wxPython
+    uncovered a bug in the implementation, so this patch includes the
+    fix that was checked in to CVS for 1.3.28.
+
+    SWIG changed how the import statments are output to the proxy
+    file, but this also caused the order to change (they all moved to
+    the very top of the file) so this broke the module docstring, as
+    well as some behavior that Chandler development is depending upon,
+    so this patch changes back to how it was done in prior releases.
+
+    Bug fix for SWIG's definition of the %makedefault macro.
+
+
+
 ------------------------------------------------------------------------
 
 swig-1.3.24.patch
diff --git a/wxPython/SWIG/swig-1.3.27.patch b/wxPython/SWIG/swig-1.3.27.patch
new file mode 100644 (file)
index 0000000..fb40f86
--- /dev/null
@@ -0,0 +1,269 @@
+Index: Doc/Manual/Python.html
+===================================================================
+RCS file: /cvsroot/swig/SWIG/Doc/Manual/Python.html,v
+retrieving revision 1.31
+diff -u -4 -r1.31 Python.html
+--- Doc/Manual/Python.html     6 Oct 2005 21:49:58 -0000       1.31
++++ Doc/Manual/Python.html     21 Jan 2006 00:44:17 -0000
+@@ -4461,10 +4461,10 @@
+ <H2><a name="Python_nn65"></a>26.10 Docstring Features</H2>
+ <p>
+-Usign docstrings in Python code is becoming more and more important
+-ans more tools are coming on the scene that take advantage of them,
++Using docstrings in Python code is becoming more and more important
++and more tools are coming on the scene that take advantage of them,
+ everything from full-blown documentaiton generators to class browsers
+ and popup call-tips in Python-aware IDEs.  Given the way that SWIG
+ generates the proxy code by default, your users will normally get
+ something like <tt>"function_name(*args)"</tt> in the popup calltip of
+Index: Lib/swig.swg
+===================================================================
+RCS file: /cvsroot/swig/SWIG/Lib/swig.swg,v
+retrieving revision 1.49
+diff -u -4 -r1.49 swig.swg
+--- Lib/swig.swg       15 Oct 2005 00:15:30 -0000      1.49
++++ Lib/swig.swg       21 Jan 2006 00:44:17 -0000
+@@ -51,9 +51,9 @@
+ #define %nodefault       %feature("nodefault","1")
+ #define %default         %feature("nodefault","0")
+ #define %clearnodefault  %feature("nodefault","")
+-#define %makedefault     %cleardefault
++#define %makedefault     %clearnodefault
+ /* the %exception directive */
+ #ifdef SWIGCSHARP
+Index: Lib/swiginit.swg
+===================================================================
+RCS file: /cvsroot/swig/SWIG/Lib/swiginit.swg,v
+retrieving revision 1.5
+diff -u -4 -r1.5 swiginit.swg
+--- Lib/swiginit.swg   12 Sep 2005 23:25:03 -0000      1.5
++++ Lib/swiginit.swg   21 Jan 2006 00:44:17 -0000
+@@ -40,14 +40,19 @@
+ **/
+ #ifdef __cplusplus
+ extern "C" {
++#if 0
++} /* c-mode */
++#endif
++#endif
++
++#if 0
++#define SWIGRUNTIME_DEBUG
+ #endif
+ SWIGRUNTIME void
+ SWIG_InitializeModule(void *clientdata) {
+-  swig_type_info *type, *ret;
+-  swig_cast_info *cast;
+   size_t i;
+   swig_module_info *module_head;
+   static int init_run = 0;
+@@ -71,18 +76,35 @@
+     SWIG_SetModule(clientdata, &swig_module);
+   }
+                
+   /* Now work on filling in swig_module.types */
++#ifdef SWIGRUNTIME_DEBUG
++  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
++#endif
+   for (i = 0; i < swig_module.size; ++i) {
+-    type = 0;
++    swig_type_info *type = 0;
++    swig_type_info *ret;
++    swig_cast_info *cast;
++  
++#ifdef SWIGRUNTIME_DEBUG
++    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
++#endif
+     /* if there is another module already loaded */
+     if (swig_module.next != &swig_module) {
+       type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+     }
+     if (type) {
+       /* Overwrite clientdata field */
+-      if (swig_module.type_initial[i]->clientdata) type->clientdata = swig_module.type_initial[i]->clientdata;
++#ifdef SWIGRUNTIME_DEBUG
++      printf("SWIG_InitializeModule: found type %s\n", type->name);
++#endif
++      if (swig_module.type_initial[i]->clientdata) {
++      type->clientdata = swig_module.type_initial[i]->clientdata;
++#ifdef SWIGRUNTIME_DEBUG
++      printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
++#endif
++      }
+     } else {
+       type = swig_module.type_initial[i];
+     }
+@@ -91,31 +113,66 @@
+     while (cast->type) {
+     
+       /* Don't need to add information already in the list */
+       ret = 0;
++#ifdef SWIGRUNTIME_DEBUG
++      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
++#endif
+       if (swig_module.next != &swig_module) {
+         ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
++#ifdef SWIGRUNTIME_DEBUG
++      if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
++#endif
+       }
+-      if (ret && type == swig_module.type_initial[i]) {
+-        cast->type = ret;
+-        ret = 0;
++      if (ret) {
++      if (type == swig_module.type_initial[i]) {
++#ifdef SWIGRUNTIME_DEBUG
++        printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
++#endif
++        cast->type = ret;
++        ret = 0;
++      } else {
++        /* Check for casting already in the list */
++        swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
++#ifdef SWIGRUNTIME_DEBUG
++        if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
++#endif
++        if (!ocast) ret = 0;
++      }
+       }
+-      
++
+       if (!ret) {
++#ifdef SWIGRUNTIME_DEBUG
++      printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
++#endif
+         if (type->cast) {
+           type->cast->prev = cast;
+           cast->next = type->cast;
+         }
+         type->cast = cast;
+       }
+-
+       cast++;
+     }
+-
+     /* Set entry in modules->types array equal to the type */
+     swig_module.types[i] = type;
+   }
+   swig_module.types[i] = 0;
++
++#ifdef SWIGRUNTIME_DEBUG
++  printf("**** SWIG_InitializeModule: Cast List ******\n");
++  for (i = 0; i < swig_module.size; ++i) {
++    int j = 0;
++    swig_cast_info *cast = swig_module.cast_initial[i];
++    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
++    while (cast->type) {
++      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
++      cast++;
++      ++j;
++    }
++  printf("---- Total casts: %d\n",j);
++  }
++  printf("**** SWIG_InitializeModule: Cast List ******\n");
++#endif
+ }
+ /* This function will propagate the clientdata field of type to
+ * any new swig_type_info structures that have been added into the list
+@@ -145,6 +202,9 @@
+   }
+ }
+ #ifdef __cplusplus
++#if 0
++{ /* c-mode */
++#endif
+ }
+ #endif
+Index: Source/Modules/python.cxx
+===================================================================
+RCS file: /cvsroot/swig/SWIG/Source/Modules/python.cxx,v
+retrieving revision 1.107
+diff -u -4 -r1.107 python.cxx
+--- Source/Modules/python.cxx  7 Oct 2005 13:17:41 -0000       1.107
++++ Source/Modules/python.cxx  21 Jan 2006 00:44:17 -0000
+@@ -36,9 +36,8 @@
+ static  File         *f_directors_h = 0;
+ static  File         *f_init = 0;
+ static  File         *f_shadow_py = 0;
+ static  String       *f_shadow = 0;
+-static  String       *f_shadow_imports = 0;
+ static  String       *f_shadow_stubs = 0;
+ static  String       *methods;
+ static  String       *class_name;
+@@ -322,9 +321,8 @@
+       }
+       Delete(filen); filen = NULL;
+       f_shadow = NewString("");
+-      f_shadow_imports = NewString("");
+       f_shadow_stubs = NewString("");
+       Swig_register_filebyname("shadow",f_shadow);
+       Swig_register_filebyname("python",f_shadow);
+@@ -343,8 +341,10 @@
+       if (mod_docstring && Len(mod_docstring)) {
+         Printv(f_shadow, "\n\"\"\"\n", mod_docstring, "\n\"\"\"\n", NIL);
+         Delete(mod_docstring); mod_docstring = NULL;
+       }
++
++      Printf(f_shadow,"\nimport %s\n\n", module);
+       
+       /* if (!modern) */
+       /* always needed, a class can be forced to be no-modern, such as an exception */
+       { 
+@@ -445,10 +445,8 @@
+     Printf(f_wrappers,"}\n");
+     Printf(f_wrappers,"#endif\n");
+     if (shadow) {
+-      Printf(f_shadow_imports,"\nimport %s\n", module);
+-      Printv(f_shadow_py, f_shadow_imports, "\n",NIL);
+       Printv(f_shadow_py, f_shadow, "\n",NIL);
+       Printv(f_shadow_py, f_shadow_stubs, "\n",NIL);
+       Close(f_shadow_py);
+@@ -507,12 +505,9 @@
+         }
+         // finally, output the name of the imported module
+       Printf(import, "%s\n", modname);
+-
+-      if (!Strstr(f_shadow_imports, import)) {
+-        Printf(f_shadow_imports, "%s", import);
+-      }
++      Printf(f_shadow, "%s", import);
+       Delete(import);
+       }
+     }
+     return Language::importDirective(n);
+@@ -774,10 +769,15 @@
+         
+       // Do the param type too?
+       if (showTypes) {
+         type =  SwigType_base(type);
+-      lookup = Swig_symbol_clookup(type, 0);
+-      if (lookup) type = Getattr(lookup, "sym:name");
++        SwigType* qt = SwigType_typedef_resolve_all(type);
++        if (SwigType_isenum(qt))
++          type = NewString("int");
++        else {
++          lookup = Swig_symbol_clookup(type, 0);
++          if (lookup) type = Getattr(lookup, "sym:name");
++        }
+         Printf(doc, "%s ", type);
+       }
+       if (name) {
index ebff62958b8632c70ea4bb53946016332dae4307..0746e7f2fe3b81d319580b3ae08446f46a204980 100644 (file)
@@ -875,9 +875,7 @@ swig_force = force
 swig_args = ['-c++',
              '-Wall',
              '-nodefault',
-
              '-python',
-             '-keyword',
              '-new_repr',
              '-modern',
              '-D'+WXPLAT,
index 8585089903327fafd24f1f9943b6db74143d1b9b..95a0010bb2968dc0d11fa200cec908e724b5fdfd 100644 (file)
@@ -16,6 +16,9 @@
 
 %feature("autodoc", "1");  // 0 == no param types, 1 == show param types
 
+// Turn on kwargs by default
+%feature("kwargs", "1");
+
 //---------------------------------------------------------------------------
 // Tell SWIG to wrap all the wrappers with our thread protection by default
 
@@ -62,13 +65,10 @@ typedef unsigned long   wxUIntPtr;
 #define %pythonAppend   %feature("pythonappend")
 #define %pythonPrepend  %feature("pythonprepend")
 #define %kwargs         %feature("kwargs")
-#define %nokwargs       %feature("nokwargs")
-#define %noautodoc %feature("noautodoc")
+#define %nokwargs       %feature("kwargs", "0")
+#define %noautodoc      %feature("noautodoc")
 
 
-//#ifndef %shadow
-//#define %shadow         %insert("shadow")
-//#endif
 
 #ifndef %pythoncode
 #define %pythoncode     %insert("python")