summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2010-01-14 16:18:42 +0000
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2010-01-14 16:18:42 +0000
commit9f57d30ebc834e3f45008283349387303d9d29d5 (patch)
treeb1a1694120c0ac36906b43ab017bdab27093789c /tools
parent0d1b1a624a43add1fb2c892da528ab196acd4878 (diff)
downloadlasso-9f57d30ebc834e3f45008283349387303d9d29d5.tar.gz
lasso-9f57d30ebc834e3f45008283349387303d9d29d5.tar.xz
lasso-9f57d30ebc834e3f45008283349387303d9d29d5.zip
Tools: add script to generate a listing of Lasso ABI
* tools/api.py: use parser from the binding generator to output a list of symbols * bindings/bindings.py; add private flags to not clobber 'private' fields of structures or methods not exported in bindings like _get_type.
Diffstat (limited to 'tools')
-rw-r--r--tools/api.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/tools/api.py b/tools/api.py
new file mode 100644
index 00000000..d1593b32
--- /dev/null
+++ b/tools/api.py
@@ -0,0 +1,46 @@
+import sys
+import os.path
+sys.path.append(os.path.join(os.path.dirname(__file__),'../bindings'))
+import bindings
+
+
+
+def main(args):
+ class opt():
+ pass
+ options = opt()
+ srcdir = args[1]
+ options.srcdir = srcdir
+ options.idwsf = None
+ options.language = None
+ options.exception_doc = None
+ bindings.binding = bindings.BindingData(options)
+ bindings.exclude_private = False
+ bindings.parse_headers(srcdir)
+ binding = bindings.binding
+ d = {}
+ for x in binding.constants:
+ d[x[1]] = x
+ for x in binding.enums:
+ d[x] = None
+ for x in binding.functions:
+ d[x.name] = x
+ for x in binding.structs:
+ d[x.name] = x
+ l = d.keys()
+ l.sort()
+ for x in l:
+ if isinstance(d[x], bindings.Function):
+ print d[x].return_type, " ",
+ print x,
+ print '(', ', '.join(map(lambda x: x[0] + ' ' + x[1], d[x].args)), ')'
+ elif isinstance(d[x], bindings.Struct):
+ print 'struct', x, '{ ',
+ print ', '.join(map(lambda x: x[0] + ' ' + x[1], d[x].members)),
+ print ' }'
+ else:
+ print x
+
+if __name__ == "__main__":
+ main(sys.argv)
+