OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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 """The frontend for the Mojo bindings system.""" | 6 """The frontend for the Mojo bindings system.""" |
7 | 7 |
8 | 8 |
9 import os | 9 import os |
10 import sys | 10 import sys |
11 from optparse import OptionParser | 11 from optparse import OptionParser |
12 from parse import mojo_parser | 12 from parse import mojo_parser |
13 from parse import mojo_translate | 13 from parse import mojo_translate |
14 from generators import mojom_data | 14 from generators import mojom_data |
15 from generators import mojom_jinja_generator | 15 from generators import mojom_jinja_generator |
16 from generators import mojom_jinja_generator | |
17 | 16 |
18 | 17 |
19 def Main(): | 18 def Main(): |
20 parser = OptionParser(usage="usage: %prog [options] filename1 [filename2...]") | 19 parser = OptionParser(usage="usage: %prog [options] filename1 [filename2...]") |
21 parser.add_option("-i", "--include_dir", dest="include_dir", default=".", | 20 parser.add_option("-i", "--include_dir", dest="include_dir", default=".", |
22 help="specify directory for #includes") | 21 help="specify directory for #includes") |
23 parser.add_option("-o", "--output_dir", dest="output_dir", default=".", | 22 parser.add_option("-o", "--output_dir", dest="output_dir", default=".", |
24 help="specify output directory") | 23 help="specify output directory") |
25 (options, args) = parser.parse_args() | 24 (options, args) = parser.parse_args() |
26 | 25 |
(...skipping 11 matching lines...) Expand all Loading... |
38 tree = mojo_parser.Parse(filename) | 37 tree = mojo_parser.Parse(filename) |
39 mojom = mojo_translate.Translate(tree, name) | 38 mojom = mojo_translate.Translate(tree, name) |
40 module = mojom_data.OrderedModuleFromData(mojom) | 39 module = mojom_data.OrderedModuleFromData(mojom) |
41 jinja = mojom_jinja_generator.JinjaGenerator( | 40 jinja = mojom_jinja_generator.JinjaGenerator( |
42 module, options.include_dir, options.output_dir) | 41 module, options.include_dir, options.output_dir) |
43 jinja.GenerateFiles() | 42 jinja.GenerateFiles() |
44 | 43 |
45 | 44 |
46 if __name__ == '__main__': | 45 if __name__ == '__main__': |
47 Main() | 46 Main() |
OLD | NEW |