Chromium Code Reviews| 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 re | 10 import re |
| 11 import sys | 11 import sys |
| 12 | 12 |
| 13 from idl_log import ErrOut, InfoOut, WarnOut | 13 from idl_log import ErrOut, InfoOut, WarnOut |
| 14 from idl_node import IDLAttribute, IDLNode | 14 from idl_node import IDLAttribute, IDLNode |
| 15 from idl_ast import IDLAst | 15 from idl_ast import IDLAst |
| 16 from idl_option import GetOption, Option, ParseOptions | 16 from idl_option import GetOption, Option, ParseOptions |
| 17 from idl_outfile import IDLOutFile | 17 from idl_outfile import IDLOutFile |
| 18 from idl_parser import ParseFiles | 18 from idl_parser import ParseFiles |
| 19 from idl_c_proto import CGen, GetNodeComments, CommentLines, Comment | 19 from idl_c_proto import CGen, GetNodeComments, CommentLines, Comment |
| 20 from idl_generator import Generator, GeneratorByFile | 20 from idl_generator import Generator, GeneratorByFile |
| 21 | 21 |
| 22 Option('dstroot', 'Base directory of output', default=os.path.join('..', 'c')) | 22 Option('dstroot', 'Base directory of output', default=os.path.join('..', 'c')) |
| 23 Option('guard', 'Include guard prefix', default=os.path.join('ppapi', 'c')) | 23 Option('guard', 'Include guard prefix', default=os.path.join('ppapi', 'c')) |
| 24 Option('out', 'List of output files', default='') | |
|
noelallen1
2012/11/15 22:03:18
Thanks, I've been meaning to do this.
| |
| 25 | 24 |
| 26 | 25 |
| 27 def GetOutFileName(filenode, relpath=None, prefix=None): | 26 def GetOutFileName(filenode, relpath=None, prefix=None): |
| 28 path, name = os.path.split(filenode.GetProperty('NAME')) | 27 path, name = os.path.split(filenode.GetProperty('NAME')) |
| 29 name = os.path.splitext(name)[0] + '.h' | 28 name = os.path.splitext(name)[0] + '.h' |
| 30 if prefix: name = '%s%s' % (prefix, name) | 29 if prefix: name = '%s%s' % (prefix, name) |
| 31 if path: name = os.path.join(path, name) | 30 if path: name = os.path.join(path, name) |
| 32 if relpath: name = os.path.join(relpath, name) | 31 if relpath: name = os.path.join(relpath, name) |
| 33 return name | 32 return name |
| 34 | 33 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 if hgen.GenerateRange(ast, ['M13', 'M14', 'M15'], {}): | 243 if hgen.GenerateRange(ast, ['M13', 'M14', 'M15'], {}): |
| 245 print "Golden file for M13-M15 failed." | 244 print "Golden file for M13-M15 failed." |
| 246 failed =1 | 245 failed =1 |
| 247 else: | 246 else: |
| 248 print "Golden file for M13-M15 passed." | 247 print "Golden file for M13-M15 passed." |
| 249 | 248 |
| 250 return failed | 249 return failed |
| 251 | 250 |
| 252 if __name__ == '__main__': | 251 if __name__ == '__main__': |
| 253 sys.exit(Main(sys.argv[1:])) | 252 sys.exit(Main(sys.argv[1:])) |
| 254 | |
|
noelallen1
2012/11/15 22:03:18
Make sure to leave blank EoF. I've been having wi
teravest
2012/11/16 17:33:36
Done.
| |
| OLD | NEW |