summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--giscanner/__init__.py12
-rwxr-xr-xtools/g-ir-scanner26
3 files changed, 38 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 40457d96..7f4d417c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
2008-03-25 Johan Dahlin <johan@gnome.org>
+
+ * giscanner/__init__.py:
+ * tools/g-ir-scanner:
+ Fix a typo and add an example python test program.
+
+2008-03-25 Johan Dahlin <johan@gnome.org>
* giscanner/__init__.py:
* giscanner/giscannermodule.c:
diff --git a/giscanner/__init__.py b/giscanner/__init__.py
index 448577ee..55963624 100644
--- a/giscanner/__init__.py
+++ b/giscanner/__init__.py
@@ -35,9 +35,9 @@ TYPE_QUALIFIER_VOLATILE = 1 << 3
FUNCTION_NONE = 0
FUNCTION_INLINE = 1 << 1
-UNARY_ADDRESS_OF
-UNARY_POINTER_INDIRECTION
-UNARY_PLUS
-UNARY_MINUS
-UNARY_BITWISE_COMPLEMENT
-UNARY_LOGICAL_NEGATION
+(UNARY_ADDRESS_OF,
+ UNARY_POINTER_INDIRECTION,
+ UNARY_PLUS,
+ UNARY_MINUS,
+ UNARY_BITWISE_COMPLEMENT,
+ UNARY_LOGICAL_NEGATION) = range(6)
diff --git a/tools/g-ir-scanner b/tools/g-ir-scanner
new file mode 100755
index 00000000..421ac84b
--- /dev/null
+++ b/tools/g-ir-scanner
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+import os
+import sys
+
+sys.path.insert(0, '.')
+
+import giscanner
+
+def main(args):
+ if len(args) == 1:
+ print 'ERROR: Needs at least one filename.'
+ return 0
+
+ scan = giscanner.SourceScanner()
+ for arg in args[1:]:
+ filename = os.path.abspath(arg)
+ scan.parse_file(filename)
+
+ print '-'*30
+ for symbol in scan.get_symbols():
+ print symbol
+ print symbol.ident, symbol.type
+ print symbol.base_type.name
+ print '-'*30
+
+sys.exit(main(sys.argv))