]> git.saurik.com Git - wxWidgets.git/blame - wxPython/SWIG/swig-1.3.29.patch
Changes needed for building with Python 2.5
[wxWidgets.git] / wxPython / SWIG / swig-1.3.29.patch
CommitLineData
d9f09ac4
RD
1Index: Makefile.in
2===================================================================
3RCS file: /cvsroot/swig/SWIG/Makefile.in,v
4retrieving revision 1.103
5diff -u -4 -r1.103 Makefile.in
6--- Makefile.in 10 Mar 2006 22:54:02 -0000 1.103
d7ab65f8 7+++ Makefile.in 5 Jul 2006 00:38:47 -0000
d9f09ac4
RD
8@@ -21,9 +21,9 @@
9
10 source:
11 @cd $(SOURCE) && $(MAKE)
12
13-libfiles: Lib/swigwarn.swg
14+libfiles: $(srcdir)/Lib/swigwarn.swg
15
16 .PHONY: source libfiles
17
18 #####################################################################
19@@ -339,9 +339,9 @@
20 #####################################################################
21 # Update the Lib/swigwarn.swg file
22 #####################################################################
23
24-Lib/swigwarn.swg: Source/Include/swigwarn.h
25+$(srcdir)/Lib/swigwarn.swg: $(srcdir)/Source/Include/swigwarn.h
26 echo "/* Automatically generated file containing all the swig warning codes. */" > $@
27 echo "/* Do not modify this file by hand, change 'Source/Include/swigwarn.h' */" >> $@
28 echo "/* and use the command 'make Lib/swigwarn.swg' instead. */" >> $@
29 echo >> $@; echo >> $@
ace78e27
RD
30Index: Lib/typemaps/exception.swg
31===================================================================
32RCS file: /cvsroot/swig/SWIG/Lib/typemaps/exception.swg,v
33retrieving revision 1.8
34diff -u -4 -r1.8 exception.swg
35--- Lib/typemaps/exception.swg 7 Mar 2006 00:14:10 -0000 1.8
d7ab65f8 36+++ Lib/typemaps/exception.swg 5 Jul 2006 00:38:47 -0000
ace78e27
RD
37@@ -12,9 +12,9 @@
38
39 /* macros for error manipulation */
40 #define %nullref_fmt() "invalid null reference "
41 #define %varfail_fmt(_type,_name) "in variable '"`_name`"' of type '"`_type`"'"
42-#define %argfail_fmt(_type,_name,_argn) "in method '" `_name` "', argument " `_argn`" of type '" `_type`"'"
43+#define %argfail_fmt(_type,_name,_argn) "in method '" `_name` "', expected argument " `_argn`" of type '" `_type`"'"
44 #define %outfail_fmt(_type) "in output value of type '"_type"'"
45 #define %argnullref_fmt(_type,_name,_argn) %nullref_fmt() %argfail_fmt(_type, _name, _argn)
46 #define %varnullref_fmt(_type,_name) %nullref_fmt() %varfail_fmt(_type, _name)
47 #define %outnullref_fmt(_type) %nullref_fmt() %outfail_fmt(_type)
48Index: Source/Modules/python.cxx
49===================================================================
50RCS file: /cvsroot/swig/SWIG/Source/Modules/python.cxx,v
0ae3258d
RD
51retrieving revision 1.203
52diff -u -4 -r1.203 python.cxx
53--- Source/Modules/python.cxx 16 Mar 2006 01:46:50 -0000 1.203
d7ab65f8 54+++ Source/Modules/python.cxx 5 Jul 2006 00:38:47 -0000
ace78e27
RD
55@@ -39,9 +39,8 @@
56 static File *f_directors_h = 0;
57 static File *f_init = 0;
58 static File *f_shadow_py = 0;
59 static String *f_shadow = 0;
60-static String *f_shadow_imports = 0;
61 static String *f_shadow_stubs = 0;
62
63 static String *methods;
64 static String *class_name;
65@@ -669,9 +668,8 @@
66 }
67 Delete(filen); filen = NULL;
68
69 f_shadow = NewString("");
70- f_shadow_imports = NewString("");
71 f_shadow_stubs = NewString("");
72
73 Swig_register_filebyname("shadow",f_shadow);
74 Swig_register_filebyname("python",f_shadow);
75@@ -817,12 +815,8 @@
76 Printf(f_wrappers,"}\n");
77 Printf(f_wrappers,"#endif\n");
78
79 if (shadow) {
80- /*
81- Printf(f_shadow_imports,"\nimport %s\n", module);
82- Printv(f_shadow_py, f_shadow_imports, "\n",NIL);
83- */
84 Printv(f_shadow_py, f_shadow, "\n",NIL);
85 Printv(f_shadow_py, f_shadow_stubs, "\n",NIL);
86
87 Close(f_shadow_py);
88@@ -882,14 +876,11 @@
89 }
90
91 // finally, output the name of the imported module
92 if (shadowimport) {
93- if (!options || (!Getattr(options, "noshadow") && !Getattr(options, "noproxy"))) {
94- Printf(import, "_%s\n", modname);
95- if (!Strstr(f_shadow_imports, import)) {
96- Printf(f_shadow, "import %s\n", modname);
97- Printv(f_shadow_imports, import, NULL);
98- }
99+ if (!options || (!Getattr(options, "noshadow") && !Getattr(options, "noproxy"))) {
100+ Printf(import, "%s\n", modname);
101+ Printf(f_shadow, "%s", import);
102 }
103 }
104
105 Delete(import);
106@@ -1154,10 +1145,15 @@
107
108 // Do the param type too?
109 if (showTypes) {
110 type = SwigType_base(type);
111- lookup = Swig_symbol_clookup(type, 0);
112- if (lookup) type = Getattr(lookup, "sym:name");
113+ SwigType* qt = SwigType_typedef_resolve_all(type);
114+ if (SwigType_isenum(qt))
115+ type = NewString("int");
116+ else {
117+ lookup = Swig_symbol_clookup(type, 0);
118+ if (lookup) type = Getattr(lookup, "sym:name");
119+ }
120 Printf(doc, "%s ", type);
121 }
122
123 if (name) {
1767b394
RD
124@@ -2793,10 +2789,10 @@
125 Printf(f_shadow_file,"%s.%s = new_instancemethod(%s.%s,None,%s)\n",
126 class_name, symname, module, Swig_name_member(class_name,symname), class_name);
127 }
128 }
129- Printf(f_shadow_file,"%s_swigregister = %s.%s_swigregister\n", class_name, module, class_name);
130- Printf(f_shadow_file,"%s_swigregister(%s)\n", class_name, class_name,0);
131+
132+ Printf(f_shadow_file,"%s.%s_swigregister(%s)\n", module, class_name, class_name);
133
134 shadow_indent = 0;
135 Printf(f_shadow_file,"%s\n", f_shadow_stubs);
136 Clear(f_shadow_stubs);
d9f09ac4
RD
137Index: Source/Swig/misc.c
138===================================================================
139RCS file: /cvsroot/swig/SWIG/Source/Swig/misc.c,v
140retrieving revision 1.57
141diff -u -4 -r1.57 misc.c
142--- Source/Swig/misc.c 6 Mar 2006 22:51:00 -0000 1.57
d7ab65f8 143+++ Source/Swig/misc.c 5 Jul 2006 00:38:47 -0000
d9f09ac4
RD
144@@ -899,8 +899,26 @@
145 }
146 #endif
147
148
149+
150+/* -----------------------------------------------------------------------------
151+ * Swig_string_wxpy()
152+ *
153+ * Drop a leading 'wx' for all wxNames, except for wxEVT*
154+ * ----------------------------------------------------------------------------- */
155+String *Swig_string_wxpy(String *s) {
156+ String* ns = NewStringEmpty();
157+ char* cptr = Char(s);
158+ if (cptr[0] == 'w' && cptr[1] == 'x') {
159+ if ( ! (cptr[2] == 'E' && cptr[3] == 'V' && cptr[4] == 'T')) {
160+ ns = NewString(&cptr[2]);
161+ }
162+ }
163+ return ns;
164+}
165+
166+
167 /* -----------------------------------------------------------------------------
168 * Swig_init()
169 *
170 * Initialize the SWIG core
171@@ -928,8 +946,11 @@
172 DohEncoding("undercase", Swig_string_ucase);
173 DohEncoding("firstuppercase", Swig_string_first_upper);
174 DohEncoding("firstlowercase", Swig_string_first_lower);
175
176+ /* wxPython's rename encoder */
177+ DohEncoding("wxpy", Swig_string_wxpy);
178+
179 /* Initialize the swig keys */
180 Swig_keys_init();
181
182 /* Initialize typemaps */
ae200bfc
RD
183Index: Lib/python/pyinit.swg
184===================================================================
185RCS file: /cvsroot/swig/SWIG/Lib/python/pyinit.swg,v
186retrieving revision 1.32
187diff -u -4 -r1.32 pyinit.swg
188--- Lib/python/pyinit.swg 2 Feb 2006 23:48:56 -0000 1.32
d7ab65f8 189+++ Lib/python/pyinit.swg 5 Jul 2006 00:38:47 -0000
ae200bfc
RD
190@@ -225,13 +225,13 @@
191 swig_type_info **types,
192 swig_type_info **types_initial) {
193 size_t i;
194 for (i = 0; methods[i].ml_name; ++i) {
195- char *c = methods[i].ml_doc;
196+ const char *c = methods[i].ml_doc;
197 if (c && (c = strstr(c, "swig_ptr: "))) {
198 int j;
199 swig_const_info *ci = 0;
200- char *name = c + 10;
201+ const char *name = c + 10;
202 for (j = 0; const_table[j].type; ++j) {
203 if (strncmp(const_table[j].name, name,
204 strlen(const_table[j].name)) == 0) {
205 ci = &(const_table[j]);
d7ab65f8
RD
206Index: Lib/python/pyrun.swg
207===================================================================
208RCS file: /cvsroot/swig/SWIG/Lib/python/pyrun.swg,v
209retrieving revision 1.141
210diff -u -4 -r1.141 pyrun.swg
211--- Lib/python/pyrun.swg 7 Mar 2006 00:35:17 -0000 1.141
212+++ Lib/python/pyrun.swg 5 Jul 2006 00:38:47 -0000
213@@ -11,8 +11,12 @@
214 * ----------------------------------------------------------------------------- */
215
216 /* Common SWIG API */
217
218+#if PY_VERSION_HEX < 0x02050000
219+typedef int Py_ssize_t;
220+#endif
221+
222 /* for raw pointers */
223 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
224 #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
225 #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
226@@ -1074,9 +1078,9 @@
227 } else {
228 void *vptr = 0;
229
230 /* here we get the method pointer for callbacks */
231- char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
232+ const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
233 const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
234 if (desc) {
235 desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
236 if (!desc) return SWIG_ERROR;
237Index: Lib/python/pystrings.swg
238===================================================================
239RCS file: /cvsroot/swig/SWIG/Lib/python/pystrings.swg,v
240retrieving revision 1.27
241diff -u -4 -r1.27 pystrings.swg
242--- Lib/python/pystrings.swg 23 Feb 2006 21:43:33 -0000 1.27
243+++ Lib/python/pystrings.swg 5 Jul 2006 00:38:47 -0000
244@@ -5,9 +5,9 @@
245 SWIGINTERN int
246 SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
247 {
248 if (PyString_Check(obj)) {
249- char *cstr; int len;
250+ char *cstr; Py_size_t len;
251 PyString_AsStringAndSize(obj, &cstr, &len);
252 if (cptr) {
253 if (alloc) {
254 /*