6 ? Source/Modules/mystuff
7 Index: Doc/Manual/Python.html
8 ===================================================================
9 RCS file: /cvsroot/swig/SWIG/Doc/Manual/Python.html,v
10 retrieving revision 1.20
11 diff -u -4 -r1.20 Python.html
12 --- Doc/Manual/Python.html 25 Oct 2004 20:42:08 -0000 1.20
13 +++ Doc/Manual/Python.html 15 Apr 2005 23:11:25 -0000
14 @@ -3869,10 +3869,10 @@
16 <H2><a name="Python_nn65"></a>26.10 Docstring Features</H2>
19 -Usign docstrings in Python code is becoming more and more important
20 -ans more tools are coming on the scene that take advantage of them,
21 +Using docstrings in Python code is becoming more and more important
22 +and more tools are coming on the scene that take advantage of them,
23 everything from full-blown documentaiton generators to class browsers
24 and popup call-tips in Python-aware IDEs. Given the way that SWIG
25 generates the proxy code by default, your users will normally get
26 something like <tt>"function_name(*args)"</tt> in the popup calltip of
27 Index: Lib/python/pyrun.swg
28 ===================================================================
29 RCS file: /cvsroot/swig/SWIG/Lib/python/pyrun.swg,v
30 retrieving revision 1.53
31 diff -u -4 -r1.53 pyrun.swg
32 --- Lib/python/pyrun.swg 11 Dec 2004 23:38:44 -0000 1.53
33 +++ Lib/python/pyrun.swg 15 Apr 2005 23:11:25 -0000
36 PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
45 PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
46 Index: Source/Modules/python.cxx
47 ===================================================================
48 RCS file: /cvsroot/swig/SWIG/Source/Modules/python.cxx,v
49 retrieving revision 1.81
50 diff -u -4 -r1.81 python.cxx
51 --- Source/Modules/python.cxx 13 Dec 2004 22:12:47 -0000 1.81
52 +++ Source/Modules/python.cxx 15 Apr 2005 23:11:26 -0000
54 -modern - Use modern python features only, without compatibility code\n\
55 -apply - Use apply() in proxy classes\n\
56 -new_vwm - New value wrapper mode, use only when everything else fails \n\
57 -new_repr - Use more informative version of __repr__ in proxy classes\n\
58 - -old_repr - Use shorter ald old version of __repr__ in proxy classes\n\
59 + -old_repr - Use shorter and old version of __repr__ in proxy classes\n\
60 -noexcept - No automatic exception handling\n\
61 -noh - Don't generate the output header file\n\
62 -noproxy - Don't generate proxy classes \n\n";
66 // Do the param type too?
68 type = SwigType_base(type);
69 - lookup = Swig_symbol_clookup(type, 0);
70 - if (lookup) type = Getattr(lookup, "sym:name");
71 + SwigType* qt = SwigType_typedef_resolve_all(type);
72 + if (SwigType_isenum(qt))
73 + type = NewString("int");
75 + lookup = Swig_symbol_clookup(type, 0);
76 + if (lookup) type = Getattr(lookup, "sym:name");
78 Printf(doc, "%s ", type);
88 - Printf(doc, "Proxy of C++ %s class", class_name);
90 - Printf(doc, "Proxy of C %s struct", class_name);
93 + // Only do the autodoc if there isn't a docstring for the class
94 + String* str = Getattr(n, "feature:docstring");
95 + if (str == NULL || Len(str) == 0) {
97 + Printf(doc, "Proxy of C++ %s class", class_name);
99 + Printf(doc, "Proxy of C %s struct", class_name);
105 if ( Strcmp(class_name, symname) == 0) {
106 String* paramList = make_autodocParmList(n, showTypes);
107 @@ -1027,10 +1038,12 @@
108 Printf(methods,"\t { (char *)\"%s\", (PyCFunction) %s, METH_VARARGS | METH_KEYWORDS, ", name, function);
110 if (n && Getattr(n,"feature:callback")) {
111 if (have_docstring(n)) {
112 + String* ds = docstring(n, AUTODOC_FUNC, "", false);
113 + Replaceall(ds, "\n", "\\n");
114 Printf(methods,"(char *)\"%s\\nswig_ptr: %s\"",
115 - docstring(n, AUTODOC_FUNC, "", false),
117 Getattr(n,"feature:callback:name"));
119 Printf(methods,"(char *)\"swig_ptr: %s\"",Getattr(n,"feature:callback:name"));
121 @@ -1950,11 +1963,13 @@
122 Printf(f_shadow, modern ? "(object)" : "(_object)");
125 Printf(f_shadow,":\n");
126 - if ( have_docstring(n) )
127 - Printv(f_shadow, tab4, docstring(n, AUTODOC_CLASS, tab4), "\n", NIL);
129 + if ( have_docstring(n) ) {
130 + String* str = docstring(n, AUTODOC_CLASS, tab4);
131 + if (str != NULL && Len(str))
132 + Printv(f_shadow, tab4, str, "\n", NIL);
135 Printv(f_shadow,tab4,"__swig_setmethods__ = {}\n",NIL);
136 if (Len(base_class)) {
137 Printf(f_shadow,"%sfor _s in [%s]: __swig_setmethods__.update(_s.__swig_setmethods__)\n",tab4,base_class);
138 @@ -2139,11 +2154,11 @@
139 Replaceall(pycode,"$action", pyaction);
141 Printv(f_shadow,pycode,"\n",NIL);
143 - Printv(f_shadow, tab4, "def ", symname, "(*args", (allow_kwargs ? ", **kwargs" : ""), "): ", NIL);
144 + Printv(f_shadow, tab4, "def ", symname, "(*args", (allow_kwargs ? ", **kwargs" : ""), "):", NIL);
145 if (!have_addtofunc(n)) {
146 - Printv(f_shadow, "return ", funcCallHelper(Swig_name_member(class_name,symname), allow_kwargs), "\n", NIL);
147 + Printv(f_shadow, " return ", funcCallHelper(Swig_name_member(class_name,symname), allow_kwargs), "\n", NIL);
149 Printv(f_shadow, "\n", NIL);
150 if ( have_docstring(n) )
151 Printv(f_shadow, tab8, docstring(n, AUTODOC_METHOD, tab8), "\n", NIL);
152 @@ -2175,12 +2190,9 @@
158 - // static + autodoc/prepend/append + def args not working!!!, disable by now
160 - if (0 && !classic && !Getattr(n,"feature:python:callback") && have_addtofunc(n)) {
161 + if ( !classic && !Getattr(n,"feature:python:callback") && have_addtofunc(n)) {
162 int kw = (check_kwargs(n) && !Getattr(n,"sym:overloaded")) ? 1 : 0;
163 Printv(f_shadow, tab4, "def ", symname, "(*args", (kw ? ", **kwargs" : ""), "):\n", NIL);
164 if ( have_docstring(n) )
165 Printv(f_shadow, tab8, docstring(n, AUTODOC_STATICFUNC, tab8), "\n", NIL);
166 Index: Source/Swig/cwrap.c
167 ===================================================================
168 RCS file: /cvsroot/swig/SWIG/Source/Swig/cwrap.c,v
169 retrieving revision 1.51
170 diff -u -4 -r1.51 cwrap.c
171 --- Source/Swig/cwrap.c 4 Dec 2004 08:33:02 -0000 1.51
172 +++ Source/Swig/cwrap.c 15 Apr 2005 23:11:26 -0000
173 @@ -172,17 +172,26 @@
174 tycode = SwigType_type(type);
175 if (tycode == T_REFERENCE) {
178 - String *defname, *defvalue, *rvalue;
179 + String *defname, *defvalue, *rvalue, *qvalue;
180 rvalue = SwigType_typedef_resolve_all(pvalue);
181 + qvalue = SwigType_typedef_qualified(rvalue);
182 defname = NewStringf("%s_defvalue", lname);
184 SwigType_del_reference(tvalue);
185 - defvalue = NewStringf("%s = %s", SwigType_lstr(tvalue,defname), rvalue);
186 + tycode = SwigType_type(tvalue);
187 + if (tycode != T_USER) {
188 + /* plain primitive type, we copy the the def value */
189 + defvalue = NewStringf("%s = %s", SwigType_lstr(tvalue,defname),qvalue);
191 + /* user type, we copy the reference value */
192 + defvalue = NewStringf("%s = %s",SwigType_str(type,defname),qvalue);
194 Wrapper_add_localv(w,defname, defvalue, NIL);
201 } else if (!pvalue && ((tycode == T_POINTER) || (tycode == T_STRING))) {