Chromium Code Reviews| 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 systems to generate | 6 """This module provides shared functionality for systems to generate |
| 7 Dart APIs from the IDL database.""" | 7 Dart APIs from the IDL database.""" |
| 8 | 8 |
| 9 import re | 9 import re |
| 10 import string | 10 import string |
| 11 | 11 |
| 12 _pure_interfaces = set([ | 12 _pure_interfaces = set([ |
| 13 'DOMStringList', | |
| 14 'DOMStringMap', | 13 'DOMStringMap', |
| 15 'ElementTimeControl', | 14 'ElementTimeControl', |
| 16 'ElementTraversal', | 15 'ElementTraversal', |
| 17 'MediaQueryListListener', | 16 'MediaQueryListListener', |
| 18 'NodeSelector', | 17 'NodeSelector', |
| 19 'SVGExternalResourcesRequired', | 18 'SVGExternalResourcesRequired', |
| 20 'SVGFilterPrimitiveStandardAttributes', | 19 'SVGFilterPrimitiveStandardAttributes', |
| 21 'SVGFitToViewBox', | 20 'SVGFitToViewBox', |
| 22 'SVGLangSpace', | 21 'SVGLangSpace', |
| 23 'SVGLocatable', | 22 'SVGLocatable', |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 631 'DOMTimeStamp': PrimitiveIDLTypeInfo('DOMTimeStamp', dart_type='int', native _type='unsigned long long'), | 630 'DOMTimeStamp': PrimitiveIDLTypeInfo('DOMTimeStamp', dart_type='int', native _type='unsigned long long'), |
| 632 'object': PrimitiveIDLTypeInfo('object', dart_type='Object', native_type='Sc riptValue'), | 631 'object': PrimitiveIDLTypeInfo('object', dart_type='Object', native_type='Sc riptValue'), |
| 633 # TODO(sra): Come up with some meaningful name so that where this appears in | 632 # TODO(sra): Come up with some meaningful name so that where this appears in |
| 634 # the documentation, the user is made aware that only a limited subset of | 633 # the documentation, the user is made aware that only a limited subset of |
| 635 # serializable types are actually permitted. | 634 # serializable types are actually permitted. |
| 636 'SerializedScriptValue': PrimitiveIDLTypeInfo('SerializedScriptValue', dart_ type='Dynamic', ref_counted=True), | 635 'SerializedScriptValue': PrimitiveIDLTypeInfo('SerializedScriptValue', dart_ type='Dynamic', ref_counted=True), |
| 637 # TODO(sra): Flags is really a dictionary: {create:bool, exclusive:bool} | 636 # TODO(sra): Flags is really a dictionary: {create:bool, exclusive:bool} |
| 638 # http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#the-flags-interfa ce | 637 # http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#the-flags-interfa ce |
| 639 'WebKitFlags': PrimitiveIDLTypeInfo('WebKitFlags', dart_type='Object'), | 638 'WebKitFlags': PrimitiveIDLTypeInfo('WebKitFlags', dart_type='Object'), |
| 640 | 639 |
| 641 'DOMStringList': PrimitiveIDLTypeInfo('DOMStringList', dart_type='List<Strin g>'), | |
| 642 'sequence': PrimitiveIDLTypeInfo('sequence', dart_type='List'), | 640 'sequence': PrimitiveIDLTypeInfo('sequence', dart_type='List'), |
| 643 'void': PrimitiveIDLTypeInfo('void', dart_type='void'), | 641 'void': PrimitiveIDLTypeInfo('void', dart_type='void'), |
| 644 | 642 |
| 645 'CSSRule': IDLTypeInfo('CSSRule', conversion_includes=['CSSImportRule']), | 643 'CSSRule': IDLTypeInfo('CSSRule', conversion_includes=['CSSImportRule']), |
| 646 'DOMException': IDLTypeInfo('DOMException', native_type='DOMCoreException'), | 644 'DOMException': IDLTypeInfo('DOMException', native_type='DOMCoreException'), |
| 645 'DOMStringList': IDLTypeInfo('DOMStringList', dart_type='List<String>', cust om_to_native=True), | |
|
Anton Muhin
2012/04/24 18:28:03
I don't know if we ready to implement something li
podivilov
2012/04/24 18:47:31
I'm piggybacking on sequences support that we have
| |
| 647 'DOMStringMap': IDLTypeInfo('DOMStringMap', dart_type='Map<String, String>') , | 646 'DOMStringMap': IDLTypeInfo('DOMStringMap', dart_type='Map<String, String>') , |
| 648 'DOMWindow': IDLTypeInfo('DOMWindow', custom_to_dart=True), | 647 'DOMWindow': IDLTypeInfo('DOMWindow', custom_to_dart=True), |
| 649 'Element': IDLTypeInfo('Element', custom_to_dart=True), | 648 'Element': IDLTypeInfo('Element', custom_to_dart=True), |
| 650 'EventListener': IDLTypeInfo('EventListener', custom_to_native=True), | 649 'EventListener': IDLTypeInfo('EventListener', custom_to_native=True), |
| 651 'EventTarget': IDLTypeInfo('EventTarget', custom_to_native=True), | 650 'EventTarget': IDLTypeInfo('EventTarget', custom_to_native=True), |
| 652 'HTMLElement': IDLTypeInfo('HTMLElement', custom_to_dart=True), | 651 'HTMLElement': IDLTypeInfo('HTMLElement', custom_to_dart=True), |
| 653 'IDBAny': IDLTypeInfo('IDBAny', dart_type='Dynamic', custom_to_native=True), | 652 'IDBAny': IDLTypeInfo('IDBAny', dart_type='Dynamic', custom_to_native=True), |
| 654 'IDBKey': IDLTypeInfo('IDBKey', dart_type='Dynamic', custom_to_native=True), | 653 'IDBKey': IDLTypeInfo('IDBKey', dart_type='Dynamic', custom_to_native=True), |
| 655 'MediaQueryListListener': IDLTypeInfo('MediaQueryListListener', custom_to_na tive=True), | 654 'MediaQueryListListener': IDLTypeInfo('MediaQueryListListener', custom_to_na tive=True), |
| 656 'StyleSheet': IDLTypeInfo('StyleSheet', conversion_includes=['CSSStyleSheet' ]), | 655 'StyleSheet': IDLTypeInfo('StyleSheet', conversion_includes=['CSSStyleSheet' ]), |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 679 '"SVGAnimatedListPropertyTearOff.h"', | 678 '"SVGAnimatedListPropertyTearOff.h"', |
| 680 '"SVGTransformListPropertyTearOff.h"', | 679 '"SVGTransformListPropertyTearOff.h"', |
| 681 '"SVGPathSegListPropertyTearOff.h"', | 680 '"SVGPathSegListPropertyTearOff.h"', |
| 682 ] | 681 ] |
| 683 | 682 |
| 684 def GetIDLTypeInfo(idl_type_name): | 683 def GetIDLTypeInfo(idl_type_name): |
| 685 match = re.match(r'sequence<(\w+)>$', idl_type_name) | 684 match = re.match(r'sequence<(\w+)>$', idl_type_name) |
| 686 if match: | 685 if match: |
| 687 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1))) | 686 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1))) |
| 688 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name)) | 687 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name)) |
| OLD | NEW |