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

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

Issue 27358002: Generate a class table of all the IDL classes in the database. This table is used (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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) 2011, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2011, 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 is the entry point to create Dart APIs from the IDL database.""" 6 """This is the entry point to create Dart APIs from the IDL database."""
7 7
8 import dartgenerator 8 import dartgenerator
9 import database 9 import database
10 import fremontcutbuilder 10 import fremontcutbuilder
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 dart_libraries = DartLibraries( 130 dart_libraries = DartLibraries(
131 HTML_LIBRARY_NAMES, template_loader, 'dartium', dartium_output_dir) 131 HTML_LIBRARY_NAMES, template_loader, 'dartium', dartium_output_dir)
132 132
133 RunGenerator(dart_libraries, dart_output_dir, 133 RunGenerator(dart_libraries, dart_output_dir,
134 template_loader, backend_factory) 134 template_loader, backend_factory)
135 cpp_library_emitter.EmitDerivedSources( 135 cpp_library_emitter.EmitDerivedSources(
136 template_loader.Load('cpp_derived_sources.template'), 136 template_loader.Load('cpp_derived_sources.template'),
137 dartium_output_dir) 137 dartium_output_dir)
138 cpp_library_emitter.EmitResolver( 138 cpp_library_emitter.EmitResolver(
139 template_loader.Load('cpp_resolver.template'), dartium_output_dir) 139 template_loader.Load('cpp_resolver.template'), dartium_output_dir)
140 140 cpp_library_emitter.EmitClassIdTable(
141 path = os.path.join(cpp_output_dir, 'DartWebkitClassIds.h') 141 webkit_database, dartium_output_dir, type_registry, renamer)
142 e = emitters.FileEmitter(path)
143 e.Emit("""
144 // WARNING: Do not edit - generated code.
145 // See dart/tools/dom/scripts/dartdomgenerator.py
146
147 #ifndef DartWebkitClassIds_h
148 #define DartWebkitClassIds_h
149
150 namespace WebCore {
151
152 enum {
153 _HistoryCrossFrameClassId = 0,
154 _LocationCrossFrameClassId,
155 _DOMWindowCrossFrameClassId,
156 _DateTimeClassId,
157 // New types that are not auto-generated should be added here.
158 """)
159 for interface in webkit_database.GetInterfaces():
160 interface_name = interface.id
161 e.Emit(' %sClassId,\n' % interface_name)
162 e.Emit("""
163 NumWebkitClassIds
164 };
165
166 } // namespace WebCore
167
168 #endif // DartWebkitClassIds_h
169 """)
170
171 _logger.info('Flush...')
172 emitters.Flush()
173 142
174 if update_dom_metadata: 143 if update_dom_metadata:
175 metadata.Flush() 144 metadata.Flush()
176 145
177 monitored.FinishMonitoring(dart2js_output_dir) 146 monitored.FinishMonitoring(dart2js_output_dir)
178 147
179 def GenerateSingleFile(library_path, output_dir, generated_output_dir=None): 148 def GenerateSingleFile(library_path, output_dir, generated_output_dir=None):
180 library_dir = os.path.dirname(library_path) 149 library_dir = os.path.dirname(library_path)
181 library_filename = os.path.basename(library_path) 150 library_filename = os.path.basename(library_path)
182 copy_dart_script = os.path.relpath('../../copy_dart.py', 151 copy_dart_script = os.path.relpath('../../copy_dart.py',
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dart2js')) 215 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dart2js'))
247 if 'htmldartium' in systems: 216 if 'htmldartium' in systems:
248 _logger.info('Generating dartium single files.') 217 _logger.info('Generating dartium single files.')
249 for library_name in HTML_LIBRARY_NAMES: 218 for library_name in HTML_LIBRARY_NAMES:
250 GenerateSingleFile( 219 GenerateSingleFile(
251 os.path.join(dartium_output_dir, '%s_dartium.dart' % library_name), 220 os.path.join(dartium_output_dir, '%s_dartium.dart' % library_name),
252 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dartium')) 221 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dartium'))
253 222
254 if __name__ == '__main__': 223 if __name__ == '__main__':
255 sys.exit(main()) 224 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698