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

Side by Side Diff: lib/dom/scripts/systemhtml.py

Issue 10126002: Enable html_dartium to be built as part of dartium build (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 system to generate 6 """This module provides shared functionality for the system to generate
7 Dart:html APIs from the IDL database.""" 7 Dart:html APIs from the IDL database."""
8 8
9 from systemfrog import * 9 from systemfrog import *
10 from systeminterface import * 10 from systeminterface import *
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 """Returns the file emitter of the Frog implementation file.""" 1133 """Returns the file emitter of the Frog implementation file."""
1134 # TODO(jmesserly): is this the right path 1134 # TODO(jmesserly): is this the right path
1135 path = os.path.join(self._output_dir, 'html', 'frog', '%s.dart' % name) 1135 path = os.path.join(self._output_dir, 'html', 'frog', '%s.dart' % name)
1136 self._dart_frog_file_paths.append(path) 1136 self._dart_frog_file_paths.append(path)
1137 return self._emitters.FileEmitter(path) 1137 return self._emitters.FileEmitter(path)
1138 1138
1139 # ----------------------------------------------------------------------------- 1139 # -----------------------------------------------------------------------------
1140 1140
1141 class HtmlDartiumSystem(HtmlSystem): 1141 class HtmlDartiumSystem(HtmlSystem):
1142 1142
1143 def __init__(self, templates, database, emitters, output_dir, generator): 1143 def __init__(self, templates, database, emitters, auxiliary_dir, output_dir,
1144 generator):
1144 """Prepared for generating wrapping implementation. 1145 """Prepared for generating wrapping implementation.
1145 1146
1146 - Creates emitter for Dart code. 1147 - Creates emitter for Dart code.
1147 """ 1148 """
1148 super(HtmlDartiumSystem, self).__init__( 1149 super(HtmlDartiumSystem, self).__init__(
1149 templates, database, emitters, output_dir, generator) 1150 templates, database, emitters, output_dir, generator)
1151 self._auxiliary_dir = auxiliary_dir
1150 self._shared = HtmlSystemShared(database, generator) 1152 self._shared = HtmlSystemShared(database, generator)
1151 self._dart_dartium_file_paths = [] 1153 self._dart_dartium_file_paths = []
1152 self._wrap_cases = [] 1154 self._wrap_cases = []
1153 1155
1154 def InterfaceGenerator(self, 1156 def InterfaceGenerator(self,
1155 interface, 1157 interface,
1156 common_prefix, 1158 common_prefix,
1157 super_interface_name, 1159 super_interface_name,
1158 source_filter): 1160 source_filter):
1159 """.""" 1161 """."""
(...skipping 12 matching lines...) Expand all
1172 """Returns the file emitter of the Dartium implementation file.""" 1174 """Returns the file emitter of the Dartium implementation file."""
1173 path = os.path.join(self._output_dir, 'html', 'dartium', '%s.dart' % name) 1175 path = os.path.join(self._output_dir, 'html', 'dartium', '%s.dart' % name)
1174 self._dart_dartium_file_paths.append(path) 1176 self._dart_dartium_file_paths.append(path)
1175 return self._emitters.FileEmitter(path); 1177 return self._emitters.FileEmitter(path);
1176 1178
1177 def ProcessCallback(self, interface, info): 1179 def ProcessCallback(self, interface, info):
1178 pass 1180 pass
1179 1181
1180 def GenerateLibraries(self, lib_dir): 1182 def GenerateLibraries(self, lib_dir):
1181 # Library generated for implementation. 1183 # Library generated for implementation.
1184 auxiliary_dir = os.path.relpath(self._auxiliary_dir, self._output_dir)
1185
1182 self._GenerateLibFile( 1186 self._GenerateLibFile(
1183 'html_dartium.darttemplate', 1187 'html_dartium.darttemplate',
1184 os.path.join(lib_dir, 'html_dartium.dart'), 1188 os.path.join(lib_dir, 'html_dartium.dart'),
1185 (self._interface_system._dart_interface_file_paths + 1189 (self._interface_system._dart_interface_file_paths +
1186 self._interface_system._dart_callback_file_paths + 1190 self._interface_system._dart_callback_file_paths +
1187 self._dart_dartium_file_paths 1191 self._dart_dartium_file_paths
1188 ), 1192 ),
1193 AUXILIARY_DIR=MassagePath(auxiliary_dir),
1189 WRAPCASES='\n'.join(self._wrap_cases)) 1194 WRAPCASES='\n'.join(self._wrap_cases))
1190 1195
1191 def Finish(self): 1196 def Finish(self):
1192 pass 1197 pass
1193 1198
1194 # ------------------------------------------------------------------------------ 1199 # ------------------------------------------------------------------------------
1195 1200
1196 # TODO(jacobr): there is far too much duplicated code between these bindings 1201 # TODO(jacobr): there is far too much duplicated code between these bindings
1197 # and the Frog bindings. A larger scale refactoring needs to be performed to 1202 # and the Frog bindings. A larger scale refactoring needs to be performed to
1198 # reduce the duplicated logic. 1203 # reduce the duplicated logic.
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee 1696 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee
1692 # that Y = Z-X, so we need to check for Y. 1697 # that Y = Z-X, so we need to check for Y.
1693 true_code = emitter.Emit( 1698 true_code = emitter.Emit(
1694 '$(INDENT)if ($COND) {\n' 1699 '$(INDENT)if ($COND) {\n'
1695 '$!TRUE' 1700 '$!TRUE'
1696 '$(INDENT)}\n', 1701 '$(INDENT)}\n',
1697 COND=test, INDENT=indent) 1702 COND=test, INDENT=indent)
1698 self.GenerateDispatch( 1703 self.GenerateDispatch(
1699 true_code, info, indent + ' ', position + 1, positive) 1704 true_code, info, indent + ' ', position + 1, positive)
1700 return True 1705 return True
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698