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 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 e.Emit('// BSD-style license that can be found in the LICENSE file.\n'); | 1193 e.Emit('// BSD-style license that can be found in the LICENSE file.\n'); |
1194 e.Emit('// WARNING: Do not edit - generated code.\n'); | 1194 e.Emit('// WARNING: Do not edit - generated code.\n'); |
1195 e.Emit('// See dart/tools/dom/scripts/systemnative.py\n'); | 1195 e.Emit('// See dart/tools/dom/scripts/systemnative.py\n'); |
1196 e.Emit('\n'); | 1196 e.Emit('\n'); |
1197 e.Emit('#ifndef DartWebkitClassIds_h\n'); | 1197 e.Emit('#ifndef DartWebkitClassIds_h\n'); |
1198 e.Emit('#define DartWebkitClassIds_h\n'); | 1198 e.Emit('#define DartWebkitClassIds_h\n'); |
1199 e.Emit('\n'); | 1199 e.Emit('\n'); |
1200 e.Emit('namespace WebCore {\n'); | 1200 e.Emit('namespace WebCore {\n'); |
1201 e.Emit('\n'); | 1201 e.Emit('\n'); |
1202 e.Emit('enum {\n'); | 1202 e.Emit('enum {\n'); |
1203 e.Emit(' _HistoryCrossFrameClassId = 0,\n'); | 1203 e.Emit(' _InvalidClassId = 0,\n'); |
| 1204 e.Emit(' _HistoryCrossFrameClassId,\n'); |
1204 e.Emit(' _LocationCrossFrameClassId,\n'); | 1205 e.Emit(' _LocationCrossFrameClassId,\n'); |
1205 e.Emit(' _DOMWindowCrossFrameClassId,\n'); | 1206 e.Emit(' _DOMWindowCrossFrameClassId,\n'); |
1206 e.Emit(' _DateTimeClassId,\n'); | 1207 e.Emit(' _DateTimeClassId,\n'); |
1207 e.Emit(' // New types that are not auto-generated should be added here.\n
'); | 1208 e.Emit(' // New types that are not auto-generated should be added here.\n
'); |
1208 e.Emit('\n'); | 1209 e.Emit('\n'); |
1209 for interface in database.GetInterfaces(): | 1210 for interface in database.GetInterfaces(): |
1210 interface_name = interface.id | 1211 interface_name = interface.id |
1211 e.Emit(' %sClassId,\n' % interface_name) | 1212 e.Emit(' %sClassId,\n' % interface_name) |
1212 e.Emit(' NumWebkitClassIds\n'); | 1213 e.Emit(' NumWebkitClassIds\n'); |
1213 e.Emit('};\n'); | 1214 e.Emit('};\n'); |
(...skipping 22 matching lines...) Expand all Loading... |
1236 e.Emit('// WARNING: Do not edit - generated code.\n'); | 1237 e.Emit('// WARNING: Do not edit - generated code.\n'); |
1237 e.Emit('// See dart/tools/dom/scripts/systemnative.py\n'); | 1238 e.Emit('// See dart/tools/dom/scripts/systemnative.py\n'); |
1238 e.Emit('\n'); | 1239 e.Emit('\n'); |
1239 e.Emit('#include "DartWebkitClassIds.h"\n'); | 1240 e.Emit('#include "DartWebkitClassIds.h"\n'); |
1240 e.Emit('\n'); | 1241 e.Emit('\n'); |
1241 e.Emit('#include "bindings/dart/DartLibraryIds.h"\n'); | 1242 e.Emit('#include "bindings/dart/DartLibraryIds.h"\n'); |
1242 e.Emit('\n'); | 1243 e.Emit('\n'); |
1243 e.Emit('namespace WebCore {\n'); | 1244 e.Emit('namespace WebCore {\n'); |
1244 e.Emit('\n'); | 1245 e.Emit('\n'); |
1245 e.Emit("_DartWebkitClassInfo DartWebkitClassInfo = {\n"); | 1246 e.Emit("_DartWebkitClassInfo DartWebkitClassInfo = {\n"); |
| 1247 e.Emit(' { "_InvalidClassId", -1, -1, false, false, false },\n'); |
1246 e.Emit(' { "_HistoryCrossFrame", DartHtmlLibraryId, -1, false, false, fal
se },\n'); | 1248 e.Emit(' { "_HistoryCrossFrame", DartHtmlLibraryId, -1, false, false, fal
se },\n'); |
1247 e.Emit(' { "_LocationCrossFrame", DartHtmlLibraryId, -1, false, false, fa
lse },\n'); | 1249 e.Emit(' { "_LocationCrossFrame", DartHtmlLibraryId, -1, false, false, fa
lse },\n'); |
1248 e.Emit(' { "_DOMWindowCrossFrame", DartHtmlLibraryId, -1, false, false, t
rue },\n'); | 1250 e.Emit(' { "_DOMWindowCrossFrame", DartHtmlLibraryId, -1, false, false, t
rue },\n'); |
1249 e.Emit(' { "DateTime", DartCoreLibraryId, -1, false, false, false },\n'); | 1251 e.Emit(' { "DateTime", DartCoreLibraryId, -1, false, false, false },\n'); |
1250 e.Emit(' // New types that are not auto-generated should be added here.\n
'); | 1252 e.Emit(' // New types that are not auto-generated should be added here.\n
'); |
1251 e.Emit('\n'); | 1253 e.Emit('\n'); |
1252 is_node_test = lambda interface: interface.id == 'Node' | 1254 is_node_test = lambda interface: interface.id == 'Node' |
1253 is_active_test = lambda interface: 'ActiveDOMObject' in interface.ext_attrs | 1255 is_active_test = lambda interface: 'ActiveDOMObject' in interface.ext_attrs |
1254 is_event_target_test = lambda interface: 'EventTarget' in interface.ext_attr
s | 1256 is_event_target_test = lambda interface: 'EventTarget' in interface.ext_attr
s |
1255 def TypeCheckHelper(test): | 1257 def TypeCheckHelper(test): |
(...skipping 17 matching lines...) Expand all Loading... |
1273 e.Emit('\n'); | 1275 e.Emit('\n'); |
1274 e.Emit('} // namespace WebCore\n'); | 1276 e.Emit('} // namespace WebCore\n'); |
1275 self._emitters.Flush() | 1277 self._emitters.Flush() |
1276 | 1278 |
1277 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): | 1279 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): |
1278 return ( | 1280 return ( |
1279 interface.id.endswith('Event') and | 1281 interface.id.endswith('Event') and |
1280 operation.id.startswith('init') and | 1282 operation.id.startswith('init') and |
1281 argument.ext_attrs.get('Default') == 'Undefined' and | 1283 argument.ext_attrs.get('Default') == 'Undefined' and |
1282 argument.type.id == 'DOMString') | 1284 argument.type.id == 'DOMString') |
OLD | NEW |