wxWidgets/wxPython/SWIG/swig-1.3.29.patch
Robin Dunn d9f09ac42c Added SWIG patch that enables the wx-dropping renames to be done
internally instead of needing to be generated in a second pass after
processing the XML output.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39175 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-05-17 04:14:20 +00:00

170 lines
5.9 KiB
Diff

Index: Makefile.in
===================================================================
RCS file: /cvsroot/swig/SWIG/Makefile.in,v
retrieving revision 1.103
diff -u -4 -r1.103 Makefile.in
--- Makefile.in 10 Mar 2006 22:54:02 -0000 1.103
+++ Makefile.in 14 May 2006 18:29:39 -0000
@@ -21,9 +21,9 @@
source:
@cd $(SOURCE) && $(MAKE)
-libfiles: Lib/swigwarn.swg
+libfiles: $(srcdir)/Lib/swigwarn.swg
.PHONY: source libfiles
#####################################################################
@@ -339,9 +339,9 @@
#####################################################################
# Update the Lib/swigwarn.swg file
#####################################################################
-Lib/swigwarn.swg: Source/Include/swigwarn.h
+$(srcdir)/Lib/swigwarn.swg: $(srcdir)/Source/Include/swigwarn.h
echo "/* Automatically generated file containing all the swig warning codes. */" > $@
echo "/* Do not modify this file by hand, change 'Source/Include/swigwarn.h' */" >> $@
echo "/* and use the command 'make Lib/swigwarn.swg' instead. */" >> $@
echo >> $@; echo >> $@
Index: Lib/typemaps/exception.swg
===================================================================
RCS file: /cvsroot/swig/SWIG/Lib/typemaps/exception.swg,v
retrieving revision 1.8
diff -u -4 -r1.8 exception.swg
--- Lib/typemaps/exception.swg 7 Mar 2006 00:14:10 -0000 1.8
+++ Lib/typemaps/exception.swg 14 May 2006 18:29:39 -0000
@@ -12,9 +12,9 @@
/* macros for error manipulation */
#define %nullref_fmt() "invalid null reference "
#define %varfail_fmt(_type,_name) "in variable '"`_name`"' of type '"`_type`"'"
-#define %argfail_fmt(_type,_name,_argn) "in method '" `_name` "', argument " `_argn`" of type '" `_type`"'"
+#define %argfail_fmt(_type,_name,_argn) "in method '" `_name` "', expected argument " `_argn`" of type '" `_type`"'"
#define %outfail_fmt(_type) "in output value of type '"_type"'"
#define %argnullref_fmt(_type,_name,_argn) %nullref_fmt() %argfail_fmt(_type, _name, _argn)
#define %varnullref_fmt(_type,_name) %nullref_fmt() %varfail_fmt(_type, _name)
#define %outnullref_fmt(_type) %nullref_fmt() %outfail_fmt(_type)
Index: Source/Modules/python.cxx
===================================================================
RCS file: /cvsroot/swig/SWIG/Source/Modules/python.cxx,v
retrieving revision 1.203
diff -u -4 -r1.203 python.cxx
--- Source/Modules/python.cxx 16 Mar 2006 01:46:50 -0000 1.203
+++ Source/Modules/python.cxx 14 May 2006 18:29:39 -0000
@@ -39,9 +39,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;
@@ -669,9 +668,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);
@@ -817,12 +815,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);
@@ -882,14 +876,11 @@
}
// finally, output the name of the imported module
if (shadowimport) {
- if (!options || (!Getattr(options, "noshadow") && !Getattr(options, "noproxy"))) {
- Printf(import, "_%s\n", modname);
- if (!Strstr(f_shadow_imports, import)) {
- Printf(f_shadow, "import %s\n", modname);
- Printv(f_shadow_imports, import, NULL);
- }
+ if (!options || (!Getattr(options, "noshadow") && !Getattr(options, "noproxy"))) {
+ Printf(import, "%s\n", modname);
+ Printf(f_shadow, "%s", import);
}
}
Delete(import);
@@ -1154,10 +1145,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: Source/Swig/misc.c
===================================================================
RCS file: /cvsroot/swig/SWIG/Source/Swig/misc.c,v
retrieving revision 1.57
diff -u -4 -r1.57 misc.c
--- Source/Swig/misc.c 6 Mar 2006 22:51:00 -0000 1.57
+++ Source/Swig/misc.c 14 May 2006 18:29:39 -0000
@@ -899,8 +899,26 @@
}
#endif
+
+/* -----------------------------------------------------------------------------
+ * Swig_string_wxpy()
+ *
+ * Drop a leading 'wx' for all wxNames, except for wxEVT*
+ * ----------------------------------------------------------------------------- */
+String *Swig_string_wxpy(String *s) {
+ String* ns = NewStringEmpty();
+ char* cptr = Char(s);
+ if (cptr[0] == 'w' && cptr[1] == 'x') {
+ if ( ! (cptr[2] == 'E' && cptr[3] == 'V' && cptr[4] == 'T')) {
+ ns = NewString(&cptr[2]);
+ }
+ }
+ return ns;
+}
+
+
/* -----------------------------------------------------------------------------
* Swig_init()
*
* Initialize the SWIG core
@@ -928,8 +946,11 @@
DohEncoding("undercase", Swig_string_ucase);
DohEncoding("firstuppercase", Swig_string_first_upper);
DohEncoding("firstlowercase", Swig_string_first_lower);
+ /* wxPython's rename encoder */
+ DohEncoding("wxpy", Swig_string_wxpy);
+
/* Initialize the swig keys */
Swig_keys_init();
/* Initialize typemaps */