OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (C) 2013 Google Inc. All rights reserved. | 2 # Copyright (C) 2013 Google Inc. All rights reserved. |
3 # | 3 # |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 from optparse import OptionParser | 39 from optparse import OptionParser |
40 import os | 40 import os |
41 import cPickle as pickle | 41 import cPickle as pickle |
42 import sys | 42 import sys |
43 | 43 |
44 from code_generator_v8 import CodeGeneratorV8 | 44 from code_generator_v8 import CodeGeneratorV8 |
45 from idl_reader import IdlReader | 45 from idl_reader import IdlReader |
46 # from utilities import write_file # FIXME: import once in same directory | 46 # from utilities import write_file # FIXME: import once in same directory |
47 | 47 |
| 48 |
48 def parse_options(): | 49 def parse_options(): |
49 parser = OptionParser() | 50 parser = OptionParser() |
50 parser.add_option('--idl-attributes-file') | 51 parser.add_option('--idl-attributes-file') |
51 parser.add_option('--output-directory') | 52 parser.add_option('--output-directory') |
52 parser.add_option('--interfaces-info-file') | 53 parser.add_option('--interfaces-info-file') |
53 parser.add_option('--write-file-only-if-changed', type='int') | 54 parser.add_option('--write-file-only-if-changed', type='int') |
54 # ensure output comes last, so command line easy to parse via regexes | 55 # ensure output comes last, so command line easy to parse via regexes |
55 parser.disable_interspersed_args() | 56 parser.disable_interspersed_args() |
56 | 57 |
57 options, args = parser.parse_args() | 58 options, args = parser.parse_args() |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 header_text, cpp_text = code_generator.generate_code(definitions, interface_
name) | 96 header_text, cpp_text = code_generator.generate_code(definitions, interface_
name) |
96 | 97 |
97 header_filename = os.path.join(output_directory, 'V8%s.h' % interface_name) | 98 header_filename = os.path.join(output_directory, 'V8%s.h' % interface_name) |
98 cpp_filename = os.path.join(output_directory, 'V8%s.cpp' % interface_name) | 99 cpp_filename = os.path.join(output_directory, 'V8%s.cpp' % interface_name) |
99 write_file(header_text, header_filename, only_if_changed) | 100 write_file(header_text, header_filename, only_if_changed) |
100 write_file(cpp_text, cpp_filename, only_if_changed) | 101 write_file(cpp_text, cpp_filename, only_if_changed) |
101 | 102 |
102 | 103 |
103 if __name__ == '__main__': | 104 if __name__ == '__main__': |
104 sys.exit(main()) | 105 sys.exit(main()) |
OLD | NEW |