OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """ Generator for C style prototypes and definitions """ | 6 """ Generator for C style prototypes and definitions """ |
7 | 7 |
8 import glob | 8 import glob |
9 import os | 9 import os |
10 import sys | 10 import sys |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 class CGen(object): | 69 class CGen(object): |
70 # TypeMap | 70 # TypeMap |
71 # | 71 # |
72 # TypeMap modifies how an object is stored or passed, for example pointers | 72 # TypeMap modifies how an object is stored or passed, for example pointers |
73 # are passed as 'const' if they are 'in' parameters, and structures are | 73 # are passed as 'const' if they are 'in' parameters, and structures are |
74 # preceeded by the keyword 'struct' as well as using a pointer. | 74 # preceeded by the keyword 'struct' as well as using a pointer. |
75 # | 75 # |
76 TypeMap = { | 76 TypeMap = { |
77 'Array': { | 77 'Array': { |
78 'in': 'const %s', | 78 'in': 'const %s', |
79 'inout': '%s*', | 79 'inout': '%s', |
80 'out': '%s*', | 80 'out': '%s*', |
81 'store': '%s', | 81 'store': '%s', |
82 'return': '%s' | 82 'return': '%s' |
83 }, | 83 }, |
84 'Callspec': { | 84 'Callspec': { |
85 'in': '%s', | 85 'in': '%s', |
86 'inout': '%s', | 86 'inout': '%s', |
87 'out': '%s', | 87 'out': '%s', |
88 'store': '%s', | 88 'store': '%s', |
89 'return': '%s' | 89 'return': '%s' |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 print 'Skipping %s' % f.GetName() | 651 print 'Skipping %s' % f.GetName() |
652 continue | 652 continue |
653 print DefineDepends(node) | 653 print DefineDepends(node) |
654 for node in f.GetChildren()[2:]: | 654 for node in f.GetChildren()[2:]: |
655 print Define(node, comment=True, prefix='tst_') | 655 print Define(node, comment=True, prefix='tst_') |
656 | 656 |
657 | 657 |
658 if __name__ == '__main__': | 658 if __name__ == '__main__': |
659 sys.exit(Main(sys.argv[1:])) | 659 sys.exit(Main(sys.argv[1:])) |
660 | 660 |
OLD | NEW |