Remove some C++-related code in BindingGen.py.

This commit is contained in:
Ms2ger 2014-03-11 13:16:00 +01:00
parent b32c157904
commit 6c3f67d719
2 changed files with 7 additions and 41 deletions

View file

@ -301,7 +301,7 @@ $(AUTOGEN_SRC_script): $(BINDINGS_SRC)/%Binding.rs: $(bindinggen_dependencies) \
$(Q) $(CFG_PYTHON2) $(BINDINGS_SRC)/pythonpath.py \ $(Q) $(CFG_PYTHON2) $(BINDINGS_SRC)/pythonpath.py \
-I$(BINDINGS_SRC)/parser -I$(BINDINGS_SRC)/ply \ -I$(BINDINGS_SRC)/parser -I$(BINDINGS_SRC)/ply \
-D$(BINDINGS_SRC) \ -D$(BINDINGS_SRC) \
$(BINDINGS_SRC)/BindingGen.py rs \ $(BINDINGS_SRC)/BindingGen.py \
$(BINDINGS_SRC)/Bindings.conf $*Binding $(addprefix $(WEBIDLS_SRC)/, $*.webidl) $(BINDINGS_SRC)/Bindings.conf $*Binding $(addprefix $(WEBIDLS_SRC)/, $*.webidl)
$(Q)touch $@ $(Q)touch $@

View file

@ -10,30 +10,6 @@ import cPickle
import WebIDL import WebIDL
from Configuration import * from Configuration import *
from CodegenRust import CGBindingRoot, replaceFileIfChanged from CodegenRust import CGBindingRoot, replaceFileIfChanged
# import Codegen in general, so we can set a variable on it
import Codegen
def generate_binding_header(config, outputprefix, webidlfile):
"""
|config| Is the configuration object.
|outputprefix| is a prefix to use for the header guards and filename.
"""
filename = outputprefix + ".h"
root = CGBindingRoot(config, outputprefix, webidlfile)
if replaceFileIfChanged(filename, root.declare()):
print "Generating binding header: %s" % (filename)
def generate_binding_cpp(config, outputprefix, webidlfile):
"""
|config| Is the configuration object.
|outputprefix| is a prefix to use for the header guards and filename.
"""
filename = outputprefix + ".cpp"
root = CGBindingRoot(config, outputprefix, webidlfile)
if replaceFileIfChanged(filename, root.define()):
print "Generating binding implementation: %s" % (filename)
def generate_binding_rs(config, outputprefix, webidlfile): def generate_binding_rs(config, outputprefix, webidlfile):
""" """
@ -45,25 +21,22 @@ def generate_binding_rs(config, outputprefix, webidlfile):
root = CGBindingRoot(config, outputprefix, webidlfile) root = CGBindingRoot(config, outputprefix, webidlfile)
root2 = CGBindingRoot(config, outputprefix, webidlfile) root2 = CGBindingRoot(config, outputprefix, webidlfile)
if replaceFileIfChanged(filename, root.declare() + root2.define()): if replaceFileIfChanged(filename, root.declare() + root2.define()):
#if replaceFileIfChanged(filename, root.declare()):
print "Generating binding implementation: %s" % (filename) print "Generating binding implementation: %s" % (filename)
def main(): def main():
# Parse arguments. # Parse arguments.
from optparse import OptionParser from optparse import OptionParser
usagestring = "usage: %prog [header|cpp] configFile outputPrefix webIDLFile" usagestring = "usage: %prog configFile outputPrefix webIDLFile"
o = OptionParser(usage=usagestring) o = OptionParser(usage=usagestring)
o.add_option("--verbose-errors", action='store_true', default=False, o.add_option("--verbose-errors", action='store_true', default=False,
help="When an error happens, display the Python traceback.") help="When an error happens, display the Python traceback.")
(options, args) = o.parse_args() (options, args) = o.parse_args()
if len(args) != 4 or (args[0] != "header" and args[0] != "cpp" and args[0] != "rs"): if len(args) != 3:
o.error(usagestring) o.error(usagestring)
buildTarget = args[0] configFile = os.path.normpath(args[0])
configFile = os.path.normpath(args[1]) outputPrefix = args[1]
outputPrefix = args[2] webIDLFile = os.path.normpath(args[2])
webIDLFile = os.path.normpath(args[3])
# Load the parsing results # Load the parsing results
f = open('ParserResults.pkl', 'rb') f = open('ParserResults.pkl', 'rb')
@ -74,14 +47,7 @@ def main():
config = Configuration(configFile, parserData) config = Configuration(configFile, parserData)
# Generate the prototype classes. # Generate the prototype classes.
if buildTarget == "header": generate_binding_rs(config, outputPrefix, webIDLFile);
generate_binding_header(config, outputPrefix, webIDLFile);
elif buildTarget == "cpp":
generate_binding_cpp(config, outputPrefix, webIDLFile);
elif buildTarget == "rs":
generate_binding_rs(config, outputPrefix, webIDLFile);
else:
assert False # not reached
if __name__ == '__main__': if __name__ == '__main__':
main() main()