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 native binding from the IDL database.""" | 7 native binding from the IDL database.""" |
8 | 8 |
9 import emitter | 9 import emitter |
10 import os | 10 import os |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 cpp_impl_emitter = self._cpp_library_emitter.CreateSourceEmitter(self._inter
face.id) | 92 cpp_impl_emitter = self._cpp_library_emitter.CreateSourceEmitter(self._inter
face.id) |
93 cpp_impl_emitter.Emit( | 93 cpp_impl_emitter.Emit( |
94 self._template_loader.Load('cpp_callback_implementation.template'), | 94 self._template_loader.Load('cpp_callback_implementation.template'), |
95 INCLUDES=self._GenerateCPPIncludes(cpp_impl_includes), | 95 INCLUDES=self._GenerateCPPIncludes(cpp_impl_includes), |
96 INTERFACE=self._interface.id, | 96 INTERFACE=self._interface.id, |
97 HANDLERS=cpp_impl_handlers_emitter.Fragments()) | 97 HANDLERS=cpp_impl_handlers_emitter.Fragments()) |
98 | 98 |
99 def ImplementationTemplate(self): | 99 def ImplementationTemplate(self): |
100 template = None | 100 template = None |
101 interface_name = self._interface_type_info.interface_name() | 101 interface_name = self._interface.doc_js_name |
102 if interface_name == self._interface.id or not self._database.HasInterface(i
nterface_name): | 102 if interface_name == self._interface.id or not self._database.HasInterface(i
nterface_name): |
103 template_file = 'impl_%s.darttemplate' % interface_name | 103 template_file = 'impl_%s.darttemplate' % interface_name |
104 template = self._template_loader.TryLoad(template_file) | 104 template = self._template_loader.TryLoad(template_file) |
105 if not template: | 105 if not template: |
106 template = self._template_loader.Load('dart_implementation.darttemplate') | 106 template = self._template_loader.Load('dart_implementation.darttemplate') |
107 return template | 107 return template |
108 | 108 |
109 def RootClassName(self): | 109 def RootClassName(self): |
110 return 'NativeFieldWrapperClass1' | 110 return 'NativeFieldWrapperClass1' |
111 | 111 |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 LIBRARY_NAME=library_name) | 893 LIBRARY_NAME=library_name) |
894 | 894 |
895 headers = self._library_headers[library_name] | 895 headers = self._library_headers[library_name] |
896 for header_file in headers: | 896 for header_file in headers: |
897 path = os.path.relpath(header_file, output_dir) | 897 path = os.path.relpath(header_file, output_dir) |
898 includes_emitter.Emit('#include "$PATH"\n', PATH=path) | 898 includes_emitter.Emit('#include "$PATH"\n', PATH=path) |
899 body_emitter.Emit( | 899 body_emitter.Emit( |
900 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' | 900 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' |
901 ' return func;\n', | 901 ' return func;\n', |
902 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) | 902 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) |
OLD | NEW |