gir-repository r14 - trunk/scripts



Author: johan
Date: Fri Jun 20 22:28:40 2008
New Revision: 14
URL: http://svn.gnome.org/viewvc/gir-repository?rev=14&view=rev

Log:
Add a script for extracting annotations from pygtk's defs files

Added:
   trunk/scripts/
   trunk/scripts/extract-annotations.py   (contents, props changed)

Added: trunk/scripts/extract-annotations.py
==============================================================================
--- (empty file)
+++ trunk/scripts/extract-annotations.py	Fri Jun 20 22:28:40 2008
@@ -0,0 +1,23 @@
+import operator
+import sys
+
+from codegen.defsparser import DefsParser
+
+p = DefsParser(sys.argv[1])
+p.startParsing(sys.argv[1])
+
+for method in sorted(p.functions, key=operator.attrgetter('c_name')):
+    nulls = []
+    for param in method.params:
+        null = getattr(param, 'pnull', 0)
+        if not null:
+            continue
+        nulls.append(param)
+    if not nulls:
+        continue
+    print '/**'
+    print ' * %s:' % (method.c_name,)
+    for param in nulls:
+        print ' * @%s: (allow-none):' % (param.pname,)
+    print ' */'
+    print



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]