| 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 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 def _GenerateNativeBinding(self, idl_name, argument_count, dart_declaration, | 752 def _GenerateNativeBinding(self, idl_name, argument_count, dart_declaration, |
| 753 native_suffix, is_custom): | 753 native_suffix, is_custom): |
| 754 annotations = FindCommonAnnotations(self._interface.id, idl_name) | 754 annotations = FindCommonAnnotations(self._interface.id, idl_name) |
| 755 if annotations: | 755 if annotations: |
| 756 annotation_str = '\n ' + '\n '.join(annotations) | 756 annotation_str = '\n ' + '\n '.join(annotations) |
| 757 else: | 757 else: |
| 758 annotation_str = '' | 758 annotation_str = '' |
| 759 | 759 |
| 760 native_binding = '%s_%s_%s' % (self._interface.id, idl_name, native_suffix) | 760 native_binding = '%s_%s_%s' % (self._interface.id, idl_name, native_suffix) |
| 761 self._members_emitter.Emit( | 761 self._members_emitter.Emit( |
| 762 '\n' | |
| 763 '\n /** @domName $DOMINTERFACE.$DOMNAME */' | |
| 764 '$ANNOTATIONS' | 762 '$ANNOTATIONS' |
| 765 '\n $DART_DECLARATION native "$NATIVE_BINDING";\n', | 763 '\n $DART_DECLARATION native "$NATIVE_BINDING";\n', |
| 766 DOMINTERFACE=self._interface.id, | 764 DOMINTERFACE=self._interface.id, |
| 767 DOMNAME=idl_name, | |
| 768 ANNOTATIONS=annotation_str, | 765 ANNOTATIONS=annotation_str, |
| 769 DART_DECLARATION=dart_declaration, | 766 DART_DECLARATION=dart_declaration, |
| 770 NATIVE_BINDING=native_binding) | 767 NATIVE_BINDING=native_binding) |
| 771 | 768 |
| 772 cpp_callback_name = '%s%s' % (idl_name, native_suffix) | 769 cpp_callback_name = '%s%s' % (idl_name, native_suffix) |
| 773 self._cpp_resolver_emitter.Emit( | 770 self._cpp_resolver_emitter.Emit( |
| 774 ' if (argumentCount == $ARGC && name == "$NATIVE_BINDING")\n' | 771 ' if (argumentCount == $ARGC && name == "$NATIVE_BINDING")\n' |
| 775 ' return Dart$(INTERFACE_NAME)Internal::$CPP_CALLBACK_NAME;\n', | 772 ' return Dart$(INTERFACE_NAME)Internal::$CPP_CALLBACK_NAME;\n', |
| 776 ARGC=argument_count, | 773 ARGC=argument_count, |
| 777 NATIVE_BINDING=native_binding, | 774 NATIVE_BINDING=native_binding, |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 LIBRARY_NAME=library_name) | 873 LIBRARY_NAME=library_name) |
| 877 | 874 |
| 878 headers = self._library_headers[library_name] | 875 headers = self._library_headers[library_name] |
| 879 for header_file in headers: | 876 for header_file in headers: |
| 880 path = os.path.relpath(header_file, output_dir) | 877 path = os.path.relpath(header_file, output_dir) |
| 881 includes_emitter.Emit('#include "$PATH"\n', PATH=path) | 878 includes_emitter.Emit('#include "$PATH"\n', PATH=path) |
| 882 body_emitter.Emit( | 879 body_emitter.Emit( |
| 883 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' | 880 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' |
| 884 ' return func;\n', | 881 ' return func;\n', |
| 885 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) | 882 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) |
| OLD | NEW |