summaryrefslogtreecommitdiffstats
path: root/tools/api.py
blob: d1593b3258d4e5631d162d7837e673144b8bd429 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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)