diff options
author | nyamatongwe <devnull@localhost> | 2000-08-30 07:55:48 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2000-08-30 07:55:48 +0000 |
commit | a03d571dbd26035e86d7ab3b4236451754128b56 (patch) | |
tree | 990e882e0467e34c04f8e161bef12e43cd280f8d /include/HFacer.py | |
parent | 0172574b6490efb6dfa0983047f63ba0400fc897 (diff) | |
download | scintilla-mirror-a03d571dbd26035e86d7ab3b4236451754128b56.tar.gz |
Initial version.
Diffstat (limited to 'include/HFacer.py')
-rw-r--r-- | include/HFacer.py | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/include/HFacer.py b/include/HFacer.py new file mode 100644 index 000000000..c4100fdf9 --- /dev/null +++ b/include/HFacer.py @@ -0,0 +1,65 @@ +import string +import sys +import os +import Face + +def DEFINEName(ifaceName): + featureDefineName = string.upper(ifaceName) + if "_" not in featureDefineName: + featureDefineName = "SCI_" + featureDefineName + return featureDefineName + +def Contains(s,sub): + return string.find(s, sub) != -1 + +def printLexHFile(f,out): + for name in f.order: + v = f.features[name] + if v["FeatureType"] in ["val"]: + if Contains(name, "SCE_") or Contains(name, "SCLEX_"): + out.write("#define " + name + " " + v["Value"] + "\n") + +def printHFile(f,out): + for name in f.order: + v = f.features[name] + if v["Category"] != "Deprecated": + if v["FeatureType"] in ["fun", "get", "set"]: + featureDefineName = "SCI_" + string.upper(name) + out.write("#define " + featureDefineName + " " + v["Value"] + "\n") + elif v["FeatureType"] in ["evt"]: + featureDefineName = "SCN_" + string.upper(name) + out.write("#define " + featureDefineName + " " + v["Value"] + "\n") + elif v["FeatureType"] in ["val"]: + if not (Contains(name, "SCE_") or Contains(name, "SCLEX_")): + out.write("#define " + name + " " + v["Value"] + "\n") + +def CopyWithInsertion(input, output, gen, definition): + copying = 1 + for line in input.readlines(): + if copying: + out.write(line) + if Contains(line, "//++Autogenerated"): + copying = 0 + gen(definition, out) + if Contains(line, "//--Autogenerated"): + copying = 1 + out.write(line) + +f = Face.Face() +f.ReadFromFile("Scintilla.iface") + +out = open("Sci.h","w") +hfile = open("Scintilla.h") +CopyWithInsertion(hfile, out, printHFile, f) +out.close() +hfile.close() +os.unlink("Scintilla.h") +os.rename("Sci.h", "Scintilla.h") + +out = open("SciL.h","w") +lexhfile = open("SciLexer.h") +CopyWithInsertion(lexhfile, out, printLexHFile, f) +out.close() +lexhfile.close() +os.unlink("SciLexer.h") +os.rename("SciL.h", "SciLexer.h") |