| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """ Generator for C style prototypes and definitions """ | 7 """ Generator for C style prototypes and definitions """ |
| 8 | 8 |
| 9 import glob | 9 import glob |
| 10 import os | 10 import os |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 # Otherwise we are defining a file level object, so generate the | 83 # Otherwise we are defining a file level object, so generate the |
| 84 # correct document notation. | 84 # correct document notation. |
| 85 # | 85 # |
| 86 item = cgen.Define(node, releases, prefix=pref, comment=True) | 86 item = cgen.Define(node, releases, prefix=pref, comment=True) |
| 87 if not item: continue | 87 if not item: continue |
| 88 asize = node.GetProperty('assert_size()') | 88 asize = node.GetProperty('assert_size()') |
| 89 if asize: | 89 if asize: |
| 90 name = '%s%s' % (pref, node.GetName()) | 90 name = '%s%s' % (pref, node.GetName()) |
| 91 if node.IsA('Struct'): | 91 if node.IsA('Struct'): |
| 92 form = 'PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(%s, %s);\n' | 92 form = 'PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(%s, %s);\n' |
| 93 elif node.IsA('Enum'): |
| 94 if node.GetProperty('notypedef'): |
| 95 form = 'PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(%s, %s);\n' |
| 96 else: |
| 97 form = 'PP_COMPILE_ASSERT_SIZE_IN_BYTES(%s, %s);\n' |
| 93 else: | 98 else: |
| 94 form = 'PP_COMPILE_ASSERT_SIZE_IN_BYTES(%s, %s);\n' | 99 form = 'PP_COMPILE_ASSERT_SIZE_IN_BYTES(%s, %s);\n' |
| 95 item += form % (name, asize[0]) | 100 item += form % (name, asize[0]) |
| 96 | 101 |
| 97 if item: out.Write(item) | 102 if item: out.Write(item) |
| 98 if last_group: | 103 if last_group: |
| 99 out.Write(CommentLines(['*',' @}', '']) + '\n') | 104 out.Write(CommentLines(['*',' @}', '']) + '\n') |
| 100 | 105 |
| 101 | 106 |
| 102 class HGen(GeneratorByFile): | 107 class HGen(GeneratorByFile): |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 print "Golden file for M13-M15 failed." | 217 print "Golden file for M13-M15 failed." |
| 213 failed =1 | 218 failed =1 |
| 214 else: | 219 else: |
| 215 print "Golden file for M13-M15 passed." | 220 print "Golden file for M13-M15 passed." |
| 216 | 221 |
| 217 return failed | 222 return failed |
| 218 | 223 |
| 219 if __name__ == '__main__': | 224 if __name__ == '__main__': |
| 220 retval = Main(sys.argv[1:]) | 225 retval = Main(sys.argv[1:]) |
| 221 sys.exit(retval) | 226 sys.exit(retval) |
| 222 | |
| OLD | NEW |