| OLD | NEW |
| 1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 FIXME: Not currently used in build. | 31 FIXME: Not currently used in build. |
| 32 This is a rewrite of the Perl IDL compiler in Python, but is not complete. | 32 This is a rewrite of the Perl IDL compiler in Python, but is not complete. |
| 33 Once it is complete, we will switch all IDL files over to Python at once. | 33 Once it is complete, we will switch all IDL files over to Python at once. |
| 34 Until then, please work on the Perl IDL compiler. | 34 Until then, please work on the Perl IDL compiler. |
| 35 For details, see bug http://crbug.com/239771 | 35 For details, see bug http://crbug.com/239771 |
| 36 """ | 36 """ |
| 37 | 37 |
| 38 import v8_attributes | 38 import v8_attributes |
| 39 from v8_globals import includes | 39 from v8_globals import includes |
| 40 import v8_methods |
| 40 from v8_utilities import cpp_name, runtime_enabled_function_name, v8_class_name | 41 from v8_utilities import cpp_name, runtime_enabled_function_name, v8_class_name |
| 41 | 42 |
| 42 | 43 |
| 43 INTERFACE_H_INCLUDES = set([ | 44 INTERFACE_H_INCLUDES = set([ |
| 44 'bindings/v8/V8Binding.h', | 45 'bindings/v8/V8Binding.h', |
| 45 'bindings/v8/V8DOMWrapper.h', # FIXME: necessary? | 46 'bindings/v8/V8DOMWrapper.h', # FIXME: necessary? |
| 46 'bindings/v8/WrapperTypeInfo.h', # FIXME: necessary? | 47 'bindings/v8/WrapperTypeInfo.h', # FIXME: necessary? |
| 47 ]) | 48 ]) |
| 48 INTERFACE_CPP_INCLUDES = set([ | 49 INTERFACE_CPP_INCLUDES = set([ |
| 49 'RuntimeEnabledFeatures.h', | 50 'RuntimeEnabledFeatures.h', |
| (...skipping 14 matching lines...) Expand all Loading... |
| 64 | 65 |
| 65 template_contents = { | 66 template_contents = { |
| 66 'interface_name': interface.name, | 67 'interface_name': interface.name, |
| 67 'cpp_class_name': cpp_name(interface), | 68 'cpp_class_name': cpp_name(interface), |
| 68 'v8_class_name': v8_class_name(interface), | 69 'v8_class_name': v8_class_name(interface), |
| 69 'constants': [generate_constant(constant) for constant in interface.cons
tants], | 70 'constants': [generate_constant(constant) for constant in interface.cons
tants], |
| 70 'do_not_check_constants': 'DoNotCheckConstants' in interface.extended_at
tributes, | 71 'do_not_check_constants': 'DoNotCheckConstants' in interface.extended_at
tributes, |
| 71 'header_includes': INTERFACE_H_INCLUDES, | 72 'header_includes': INTERFACE_H_INCLUDES, |
| 72 } | 73 } |
| 73 template_contents.update(v8_attributes.generate_attributes(interface)) | 74 template_contents.update(v8_attributes.generate_attributes(interface)) |
| 75 template_contents.update(v8_methods.generate_methods(interface)) |
| 74 return template_contents | 76 return template_contents |
| 75 | 77 |
| 76 | 78 |
| 77 def generate_constant(constant): | 79 def generate_constant(constant): |
| 78 # Extended Attributes: DeprecateAs, RuntimeEnabled, Reflect | 80 # Extended Attributes: DeprecateAs, RuntimeEnabled, Reflect |
| 79 # (Blink-only) string literals are unquoted in tokenizer, must be re-quoted | 81 # (Blink-only) string literals are unquoted in tokenizer, must be re-quoted |
| 80 # in C++. | 82 # in C++. |
| 81 if constant.data_type == 'DOMString': | 83 if constant.data_type == 'DOMString': |
| 82 value = '"%s"' % constant.value | 84 value = '"%s"' % constant.value |
| 83 else: | 85 else: |
| 84 value = constant.value | 86 value = constant.value |
| 85 reflected_name = constant.extended_attributes.get('Reflect', constant.name) | 87 reflected_name = constant.extended_attributes.get('Reflect', constant.name) |
| 86 | 88 |
| 87 constant_parameter = { | 89 constant_parameter = { |
| 88 'name': constant.name, | 90 'name': constant.name, |
| 89 # FIXME: use 'reflected_name' as correct 'name' | 91 # FIXME: use 'reflected_name' as correct 'name' |
| 90 'reflected_name': reflected_name, | 92 'reflected_name': reflected_name, |
| 91 'value': value, | 93 'value': value, |
| 92 'runtime_enabled_function_name': runtime_enabled_function_name(constant)
, | 94 'runtime_enabled_function_name': runtime_enabled_function_name(constant)
, |
| 93 } | 95 } |
| 94 return constant_parameter | 96 return constant_parameter |
| OLD | NEW |