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, | 765 DOMNAME=idl_name, |
768 ANNOTATIONS=annotation_str, | 766 ANNOTATIONS=annotation_str, |
769 DART_DECLARATION=dart_declaration, | 767 DART_DECLARATION=dart_declaration, |
770 NATIVE_BINDING=native_binding) | 768 NATIVE_BINDING=native_binding) |
771 | 769 |
772 cpp_callback_name = '%s%s' % (idl_name, native_suffix) | 770 cpp_callback_name = '%s%s' % (idl_name, native_suffix) |
773 self._cpp_resolver_emitter.Emit( | 771 self._cpp_resolver_emitter.Emit( |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 LIBRARY_NAME=library_name) | 874 LIBRARY_NAME=library_name) |
877 | 875 |
878 headers = self._library_headers[library_name] | 876 headers = self._library_headers[library_name] |
879 for header_file in headers: | 877 for header_file in headers: |
880 path = os.path.relpath(header_file, output_dir) | 878 path = os.path.relpath(header_file, output_dir) |
881 includes_emitter.Emit('#include "$PATH"\n', PATH=path) | 879 includes_emitter.Emit('#include "$PATH"\n', PATH=path) |
882 body_emitter.Emit( | 880 body_emitter.Emit( |
883 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' | 881 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' |
884 ' return func;\n', | 882 ' return func;\n', |
885 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) | 883 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) |
OLD | NEW |