aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/bindings/codegen/GlobalGen.py
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2013-07-11 01:22:00 -0400
committerJosh Matthews <josh@joshmatthews.net>2013-07-12 14:06:23 -0400
commit4f24ef161973419cf32256ae1aee627cddb9c2c6 (patch)
treec92e54beddc7ad54e318be2f1f02d94e0a1be0ed /src/components/script/dom/bindings/codegen/GlobalGen.py
parent65f9aefb78791467fcd54971e0296c520e23d641 (diff)
downloadservo-4f24ef161973419cf32256ae1aee627cddb9c2c6.tar.gz
servo-4f24ef161973419cf32256ae1aee627cddb9c2c6.zip
DOM bindings: Autogenerate list of prototypes and binding registration goop.
Diffstat (limited to 'src/components/script/dom/bindings/codegen/GlobalGen.py')
-rw-r--r--src/components/script/dom/bindings/codegen/GlobalGen.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/components/script/dom/bindings/codegen/GlobalGen.py b/src/components/script/dom/bindings/codegen/GlobalGen.py
index dbfc4f86e14..ab6427a638c 100644
--- a/src/components/script/dom/bindings/codegen/GlobalGen.py
+++ b/src/components/script/dom/bindings/codegen/GlobalGen.py
@@ -13,7 +13,7 @@ import cStringIO
import WebIDL
import cPickle
from Configuration import *
-from Codegen import GlobalGenRoots, replaceFileIfChanged
+from CodegenRust import GlobalGenRoots, replaceFileIfChanged
# import Codegen in general, so we can set a variable on it
import Codegen
@@ -21,11 +21,16 @@ def generate_file(config, name, action):
root = getattr(GlobalGenRoots, name)(config)
if action is 'declare':
- filename = name + '.h'
+ filename = name + '.rs'
code = root.declare()
+ elif action == 'declare+define':
+ filename = name + '.rs'
+ code = root.declare()
+ root2 = getattr(GlobalGenRoots, name)(config)
+ code += root2.define()
else:
assert action is 'define'
- filename = name + '.cpp'
+ filename = name + '.rs'
code = root.define()
if replaceFileIfChanged(filename, code):
@@ -70,14 +75,14 @@ def main():
config = Configuration(configFile, parserResults)
# Generate the prototype list.
- generate_file(config, 'PrototypeList', 'declare')
+ generate_file(config, 'PrototypeList', 'declare+define')
# Generate the common code.
- generate_file(config, 'RegisterBindings', 'declare')
- generate_file(config, 'RegisterBindings', 'define')
+ generate_file(config, 'RegisterBindings', 'declare+define')
- generate_file(config, 'UnionTypes', 'declare')
- generate_file(config, 'UnionConversions', 'declare')
+ #XXXjdm No union support yet
+ #generate_file(config, 'UnionTypes', 'declare')
+ #generate_file(config, 'UnionConversions', 'declare')
if __name__ == '__main__':
main()