]> git.saurik.com Git - wxWidgets.git/commitdiff
Updates for the autodoc/docstring patch, fixes overloaded functions
authorRobin Dunn <robin@alldunn.com>
Fri, 21 Nov 2003 17:05:30 +0000 (17:05 +0000)
committerRobin Dunn <robin@alldunn.com>
Fri, 21 Nov 2003 17:05:30 +0000 (17:05 +0000)
where one or more of them have a specific autodoc (not "0" or "1")

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24622 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/SWIG/swig.python-docstring.patch

index 1467b251acef1776ce52a26e258cebd1545e3a45..a25ab5ecd457dbdc55036f3469976e79263f3bd9 100644 (file)
@@ -4,7 +4,7 @@ RCS file: /cvsroot/SWIG/Source/Modules/python.cxx,v
 retrieving revision 1.28
 diff -u -r1.28 python.cxx
 --- Source/Modules/python.cxx  18 Nov 2003 20:19:15 -0000      1.28
-+++ Source/Modules/python.cxx  19 Nov 2003 17:34:55 -0000
++++ Source/Modules/python.cxx  21 Nov 2003 16:56:31 -0000
 @@ -68,6 +68,17 @@
       -noexcept       - No automatic exception handling\n\
       -noproxy        - Don't generate proxy classes \n\n";
@@ -49,7 +49,7 @@ diff -u -r1.28 python.cxx
      }
    }
  
-@@ -439,6 +456,193 @@
+@@ -439,6 +456,200 @@
  
  
    /* ------------------------------------------------------------
@@ -118,18 +118,8 @@ diff -u -r1.28 python.cxx
 +  String* make_autodoc(Node *n, autodoc_t ad_type) {
 +
 +    if (ad_type == AUTODOC_CLASS)
-+      return NULL;  // No function call do document in this case
++      return NULL;  // No function call to document in this case
 +
-+    // check how should the parameters be rendered?
-+    String* autodoc = Getattr(n, "feature:autodoc");
-+    bool showTypes;
-+    if (Strcmp(autodoc, "0") == 0)
-+      showTypes = false;
-+    else if (Strcmp(autodoc, "1") == 0)
-+      showTypes = true;
-+    else
-+      return autodoc;
-+    
 +    // If the function is overloaded then this funciton is called
 +    // for the last one.  Rewind to the first so the docstrings are
 +    // in order.
@@ -138,6 +128,22 @@ diff -u -r1.28 python.cxx
 +    
 +    String* doc  = NewString("");
 +    while (n) {
++      bool showTypes = false;
++      bool skipAuto = false;
++      
++      // check how should the parameters be rendered?
++      String* autodoc = Getattr(n, "feature:autodoc");
++      if (Strcmp(autodoc, "0") == 0)
++        showTypes = false;
++      else if (Strcmp(autodoc, "1") == 0)
++        showTypes = true;
++      else {
++        // if not "0" or "1" then autodoc is already the string that should be used
++        Printf(doc, "%s", autodoc);
++        skipAuto = true;
++      }
++
++      if (!skipAuto) {
 +        String*   symname = Getattr(n, "sym:name");
 +        SwigType* type    = Getattr(n, "type");
 +      
@@ -149,7 +155,7 @@ diff -u -r1.28 python.cxx
 +            Node* lookup = Swig_symbol_clookup(type, 0);
 +            if (lookup)
 +              type = Getattr(lookup, "sym:name");
-+          }
++          }     
 +        }
 +        
 +        switch ( ad_type ) {
@@ -163,7 +169,7 @@ diff -u -r1.28 python.cxx
 +        case AUTODOC_DTOR:
 +          Printf(doc, "__del__()");
 +          break;
-+            
++        
 +        case AUTODOC_STATICFUNC:
 +          Printf(doc, "%s.%s(%s)", class_name, symname, make_autodocParmList(n, showTypes));
 +          if (type) Printf(doc, " -> %s", type);
@@ -174,11 +180,12 @@ diff -u -r1.28 python.cxx
 +          if (type) Printf(doc, " -> %s", type);
 +          break;            
 +        }
-+
-+        // if it's overloaded then get the next decl and loop around again
-+        n = Getattr(n, "sym:nextSibling");
-+        if (n)
-+          Printf(doc, "\n");
++      }
++      
++      // if it's overloaded then get the next decl and loop around again
++      n = Getattr(n, "sym:nextSibling");
++      if (n)
++        Printf(doc, "\n");
 +    }
 +          
 +    return doc;
@@ -243,7 +250,7 @@ diff -u -r1.28 python.cxx
     * have_addtofunc()
     *    Check if there is a %addtofunc directive and it has text
     * ------------------------------------------------------------ */
-@@ -1661,7 +1865,9 @@
+@@ -1661,7 +1872,9 @@
        }
        }
        Printf(f_shadow,":\n");
@@ -254,7 +261,7 @@ diff -u -r1.28 python.cxx
        if (!modern) {
          Printv(f_shadow,tab4,"__swig_setmethods__ = {}\n",NIL);
          if (Len(base_class)) {
-@@ -1796,14 +2002,20 @@
+@@ -1796,14 +2009,20 @@
          Printv(f_shadow,pycode,"\n",NIL);
        } else {
  
@@ -282,7 +289,7 @@ diff -u -r1.28 python.cxx
            }
          }
  
-@@ -1820,12 +2032,18 @@
+@@ -1820,12 +2039,18 @@
      String *symname = Getattr(n,"sym:name");
      Language::staticmemberfunctionHandler(n);
      if (shadow) {
@@ -305,7 +312,7 @@ diff -u -r1.28 python.cxx
          Printv(f_shadow, tab4, modern ? "" : "if _newclass:",  symname,
                 " = staticmethod(", symname, ")\n", NIL);
  
-@@ -1912,6 +2130,8 @@
+@@ -1912,6 +2137,8 @@
  
              Printv(f_shadow, tab4, "def __init__(self, *args",
                     (allow_kwargs ? ", **kwargs" : ""), "):\n", NIL);
@@ -314,7 +321,7 @@ diff -u -r1.28 python.cxx
              Printv(f_shadow, pass_self, NIL);
              if (!modern) {
                Printv(f_shadow, tab8, "_swig_setattr(self, ", rclassname, ", 'this', ", 
-@@ -1927,7 +2147,7 @@
+@@ -1927,7 +2154,7 @@
                Printv(f_shadow, tab8, "del newobj.thisown\n", NIL);
              }
              if ( have_addtofunc(n) )
@@ -323,7 +330,7 @@ diff -u -r1.28 python.cxx
            Delete(pass_self);
          }
          have_constructor = 1;
-@@ -1945,6 +2165,8 @@
+@@ -1945,6 +2172,8 @@
  
              Printv(f_shadow_stubs, "\ndef ", symname, "(*args",
                     (allow_kwargs ? ", **kwargs" : ""), "):\n", NIL);
@@ -332,7 +339,7 @@ diff -u -r1.28 python.cxx
              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);
-@@ -1978,11 +2200,13 @@
+@@ -1978,11 +2207,13 @@
        Printv(f_shadow,pycode,"\n", NIL);
        } else {
        Printv(f_shadow, tab4, "def __del__(self, destroy=", module, ".", Swig_name_destroy(symname), "):\n", NIL);