OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 """This module provides shared functionality for the systems to generate | 6 """This module provides shared functionality for the systems to generate |
7 frog binding from the IDL database.""" | 7 frog binding from the IDL database.""" |
8 | 8 |
9 import os | 9 import os |
10 from generator import * | 10 from generator import * |
11 from systembase import * | 11 from systembase import * |
12 | 12 |
13 # Members (getters, setters, and methods) to suppress. These are | 13 # Members (getters, setters, and methods) to suppress. These are |
14 # either removed or custom implemented. | 14 # either removed or custom implemented. |
15 _dom_frog_omitted_members = set([ | 15 _dom_frog_omitted_members = set([ |
16 # Replace with custom. | 16 # Replace with custom. |
17 'DOMWindow.get:top', | 17 'DOMWindow.get:top', |
18 'HTMLIFrameElement.get:contentWindow', | 18 'HTMLIFrameElement.get:contentWindow', |
19 | 19 |
20 # Remove. | 20 # Remove. |
21 'DOMWindow.get:frameElement', | 21 'DOMWindow.get:frameElement', |
22 'HTMLIFrameElement.get:contentDocument', | 22 'HTMLIFrameElement.get:contentDocument', |
23 ]) | 23 ]) |
24 | 24 |
25 class FrogSystem(System): | 25 class FrogSystem(System): |
26 | 26 |
27 def __init__(self, templates, database, emitters, output_dir): | 27 def __init__(self, options): |
28 super(FrogSystem, self).__init__( | 28 super(FrogSystem, self).__init__(options) |
29 templates, database, emitters, output_dir) | |
30 self._impl_file_paths = [] | 29 self._impl_file_paths = [] |
31 | 30 |
32 def ProcessInterface(self, interface): | 31 def ProcessInterface(self, interface): |
33 """.""" | 32 """.""" |
34 if IsPureInterface(interface.id): | 33 if IsPureInterface(interface.id): |
35 return | 34 return |
36 template_file = 'impl_%s.darttemplate' % interface.id | 35 template_file = 'impl_%s.darttemplate' % interface.id |
37 template = self._templates.TryLoad(template_file) | 36 template = self._templates.TryLoad(template_file) |
38 if not template: | 37 if not template: |
39 template = self._templates.Load('frog_impl.darttemplate') | 38 template = self._templates.Load('frog_impl.darttemplate') |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 if native_body: | 387 if native_body: |
389 native_string = " '''" + native_body + "'''" | 388 native_string = " '''" + native_body + "'''" |
390 | 389 |
391 self._members_emitter.Emit( | 390 self._members_emitter.Emit( |
392 '\n' | 391 '\n' |
393 ' $TYPE $NAME($PARAMS) native$NATIVESTRING;\n', | 392 ' $TYPE $NAME($PARAMS) native$NATIVESTRING;\n', |
394 TYPE=self._NarrowOutputType(info.type_name), | 393 TYPE=self._NarrowOutputType(info.type_name), |
395 NAME=info.name, | 394 NAME=info.name, |
396 PARAMS=params, | 395 PARAMS=params, |
397 NATIVESTRING=native_string) | 396 NATIVESTRING=native_string) |
OLD | NEW |