Index: Source/bindings/scripts/unstable/v8_methods.py |
diff --git a/Source/build/scripts/name_utilities.py b/Source/bindings/scripts/unstable/v8_methods.py |
similarity index 60% |
copy from Source/build/scripts/name_utilities.py |
copy to Source/bindings/scripts/unstable/v8_methods.py |
index 62b4da0864ba635f84a7126dfa0509aa1669a5c7..930e223a3e550e7c26b8c411c1ef7210229d638f 100644 |
--- a/Source/build/scripts/name_utilities.py |
+++ b/Source/bindings/scripts/unstable/v8_methods.py |
@@ -26,41 +26,33 @@ |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-import os.path |
-import re |
+"""Generate template values for methods. |
+FIXME: Not currently used in build. |
+This is a rewrite of the Perl IDL compiler in Python, but is not complete. |
+Once it is complete, we will switch all IDL files over to Python at once. |
+Until then, please work on the Perl IDL compiler. |
+For details, see bug http://crbug.com/239771 |
+""" |
-ACRONYMS = ['CSS', 'FE', 'FTP', 'HTML', 'IME', 'JS', 'SVG', 'URL', 'WOFF', 'XML', 'XSLT', 'XSS'] |
+import v8_utilities |
-def lower_first(name): |
- """Return name with first letter or initial acronym lowercased. |
+def generate_methods(interface): |
+ methods = [generate_method(method) for method in interface.operations] |
+ contents = {'methods': methods} |
+ contents.update(generate_methods_common(interface, methods)) |
+ return contents |
- E.g., 'SetURL' becomes 'setURL', but 'URLFoo' becomes 'urlFoo'. |
- """ |
- for acronym in ACRONYMS: |
- if name.startswith(acronym): |
- return name.replace(acronym, acronym.lower(), 1) |
- return name[0].lower() + name[1:] |
+def generate_method(method): |
+ return {'name': method.name} |
-def upper_first(name): |
- for acronym in ACRONYMS: |
- if name.startswith(acronym.lower()): |
- return name.replace(acronym.lower(), acronym, 1) |
- return name[0].upper() + name[1:] |
- |
-def to_macro_style(name): |
- s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) |
- return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).upper() |
- |
- |
-def script_name(entry): |
- return os.path.basename(entry["name"]) |
- |
- |
-def cpp_name(entry): |
- if entry['ImplementedAs']: |
- return entry['ImplementedAs'] |
- return script_name(entry) |
+def generate_methods_common(interface, methods): |
+ v8_class_name = v8_utilities.v8_class_name(interface) |
+ return { |
+ 'installed_methods': '%sMethods' % v8_class_name if methods else '0', |
+ # Size 0 constant array is not allowed in VC++ |
+ 'number_of_methods': 'WTF_ARRAY_LENGTH(%sMethods)' % v8_class_name if methods else '0', |
+ } |