Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Side by Side Diff: tools/dom/scripts/systemnative.py

Issue 12045076: Second half of HTML json docs. This reads the json file and inserts the docs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 if not template: 106 if not template:
107 template = self._template_loader.Load('dart_implementation.darttemplate') 107 template = self._template_loader.Load('dart_implementation.darttemplate')
108 return template 108 return template
109 109
110 def RootClassName(self): 110 def RootClassName(self):
111 return 'NativeFieldWrapperClass1' 111 return 'NativeFieldWrapperClass1'
112 112
113 def NativeSpec(self): 113 def NativeSpec(self):
114 return '' 114 return ''
115 115
116 def StartInterface(self, memebers_emitter): 116 def StartInterface(self, members_emitter):
117 # Create emitters for c++ implementation. 117 # Create emitters for c++ implementation.
118 if not IsPureInterface(self._interface.id): 118 if not IsPureInterface(self._interface.id):
119 self._cpp_header_emitter = self._cpp_library_emitter.CreateHeaderEmitter( 119 self._cpp_header_emitter = self._cpp_library_emitter.CreateHeaderEmitter(
120 self._interface.id, 120 self._interface.id,
121 self._renamer.GetLibraryName(self._interface)) 121 self._renamer.GetLibraryName(self._interface))
122 self._cpp_impl_emitter = self._cpp_library_emitter.CreateSourceEmitter(sel f._interface.id) 122 self._cpp_impl_emitter = self._cpp_library_emitter.CreateSourceEmitter(sel f._interface.id)
123 else: 123 else:
124 self._cpp_header_emitter = emitter.Emitter() 124 self._cpp_header_emitter = emitter.Emitter()
125 self._cpp_impl_emitter = emitter.Emitter() 125 self._cpp_impl_emitter = emitter.Emitter()
126 126
127 self._interface_type_info = self._TypeInfo(self._interface.id) 127 self._interface_type_info = self._TypeInfo(self._interface.id)
128 self._members_emitter = memebers_emitter 128 self._members_emitter = members_emitter
129 self._cpp_declarations_emitter = emitter.Emitter() 129 self._cpp_declarations_emitter = emitter.Emitter()
130 self._cpp_impl_includes = set() 130 self._cpp_impl_includes = set()
131 self._cpp_definitions_emitter = emitter.Emitter() 131 self._cpp_definitions_emitter = emitter.Emitter()
132 self._cpp_resolver_emitter = emitter.Emitter() 132 self._cpp_resolver_emitter = emitter.Emitter()
133 133
134 # We need to revisit our treatment of typed arrays, right now 134 # We need to revisit our treatment of typed arrays, right now
135 # it is full of hacks. 135 # it is full of hacks.
136 if self._interface.ext_attrs.get('ConstructorTemplate') == 'TypedArray': 136 if self._interface.ext_attrs.get('ConstructorTemplate') == 'TypedArray':
137 self._cpp_resolver_emitter.Emit( 137 self._cpp_resolver_emitter.Emit(
138 ' if (name == "$(INTERFACE_NAME)_constructor_Callback")\n' 138 ' if (name == "$(INTERFACE_NAME)_constructor_Callback")\n'
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 # Generate to Dart conversion of C++ value. 726 # Generate to Dart conversion of C++ value.
727 to_dart_conversion = return_type_info.to_dart_conversion(function_call, se lf._interface.id, ext_attrs) 727 to_dart_conversion = return_type_info.to_dart_conversion(function_call, se lf._interface.id, ext_attrs)
728 invocation_emitter.Emit( 728 invocation_emitter.Emit(
729 ' Dart_Handle returnValue = $TO_DART_CONVERSION;\n' 729 ' Dart_Handle returnValue = $TO_DART_CONVERSION;\n'
730 ' if (returnValue)\n' 730 ' if (returnValue)\n'
731 ' Dart_SetReturnValue(args, returnValue);\n', 731 ' Dart_SetReturnValue(args, returnValue);\n',
732 TO_DART_CONVERSION=to_dart_conversion) 732 TO_DART_CONVERSION=to_dart_conversion)
733 733
734 def _GenerateNativeBinding(self, idl_name, argument_count, dart_declaration, 734 def _GenerateNativeBinding(self, idl_name, argument_count, dart_declaration,
735 native_suffix, is_custom): 735 native_suffix, is_custom):
736 annotations = FormatAnnotations( 736 annotations = FormatAnnotationsAndComments(
737 FindCommonAnnotations(self._interface.id, idl_name), ' ') 737 GetAnnotationsAndComments(self._interface.id, idl_name), ' ')
738 738
739 native_binding = '%s_%s_%s' % (self._interface.id, idl_name, native_suffix) 739 native_binding = '%s_%s_%s' % (self._interface.id, idl_name, native_suffix)
740 self._members_emitter.Emit( 740 self._members_emitter.Emit(
741 '\n' 741 '\n'
742 ' $ANNOTATIONS$DART_DECLARATION native "$NATIVE_BINDING";\n', 742 ' $ANNOTATIONS$DART_DECLARATION native "$NATIVE_BINDING";\n',
743 DOMINTERFACE=self._interface.id, 743 DOMINTERFACE=self._interface.id,
744 ANNOTATIONS=annotations, 744 ANNOTATIONS=annotations,
745 DART_DECLARATION=dart_declaration, 745 DART_DECLARATION=dart_declaration,
746 NATIVE_BINDING=native_binding) 746 NATIVE_BINDING=native_binding)
747 747
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 LIBRARY_NAME=library_name) 852 LIBRARY_NAME=library_name)
853 853
854 headers = self._library_headers[library_name] 854 headers = self._library_headers[library_name]
855 for header_file in headers: 855 for header_file in headers:
856 path = os.path.relpath(header_file, output_dir) 856 path = os.path.relpath(header_file, output_dir)
857 includes_emitter.Emit('#include "$PATH"\n', PATH=path) 857 includes_emitter.Emit('#include "$PATH"\n', PATH=path)
858 body_emitter.Emit( 858 body_emitter.Emit(
859 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n' 859 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n'
860 ' return func;\n', 860 ' return func;\n',
861 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) 861 CLASS_NAME=os.path.splitext(os.path.basename(path))[0])
OLDNEW
« tools/dom/scripts/generator.py ('K') | « tools/dom/scripts/systemhtml.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698