summaryrefslogtreecommitdiffstats
path: root/scintilla/scripts/HFacer.py
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@users.sourceforge.net>2014-03-07 09:24:13 +0200
committerXhmikosR <xhmikosr@users.sourceforge.net>2014-03-07 09:24:40 +0200
commite7a0f350adc29d7a46bab8ff6ad501a7e6e41cec (patch)
tree6b5b25116fe1c5c15a5bef1eb2c03f904476218f /scintilla/scripts/HFacer.py
parente63f2e0dcebcc22f24764654b637a4d871b31ae5 (diff)
downloadnotepad2-mod-e7a0f350adc29d7a46bab8ff6ad501a7e6e41cec.zip
notepad2-mod-e7a0f350adc29d7a46bab8ff6ad501a7e6e41cec.tar.gz
notepad2-mod-e7a0f350adc29d7a46bab8ff6ad501a7e6e41cec.tar.bz2
Add scintilla scripts folder back.
LexGen.py has a couple of stuff commented out since we don't use them. Close #74.
Diffstat (limited to 'scintilla/scripts/HFacer.py')
-rw-r--r--scintilla/scripts/HFacer.py58
1 files changed, 58 insertions, 0 deletions
diff --git a/scintilla/scripts/HFacer.py b/scintilla/scripts/HFacer.py
new file mode 100644
index 0000000..819181f
--- /dev/null
+++ b/scintilla/scripts/HFacer.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+# HFacer.py - regenerate the Scintilla.h and SciLexer.h files from the Scintilla.iface interface
+# definition file.
+# Implemented 2000 by Neil Hodgson neilh@scintilla.org
+# Requires Python 2.5 or later
+
+import sys
+import os
+import Face
+
+from FileGenerator import UpdateFile, Generate, Regenerate, UpdateLineInFile, lineEnd
+
+def printLexHFile(f):
+ out = []
+ for name in f.order:
+ v = f.features[name]
+ if v["FeatureType"] in ["val"]:
+ if "SCE_" in name or "SCLEX_" in name:
+ out.append("#define " + name + " " + v["Value"])
+ return out
+
+def printHFile(f):
+ out = []
+ previousCategory = ""
+ for name in f.order:
+ v = f.features[name]
+ if v["Category"] != "Deprecated":
+ if v["Category"] == "Provisional" and previousCategory != "Provisional":
+ out.append("#ifndef SCI_DISABLE_PROVISIONAL")
+ previousCategory = v["Category"]
+ if v["FeatureType"] in ["fun", "get", "set"]:
+ featureDefineName = "SCI_" + name.upper()
+ out.append("#define " + featureDefineName + " " + v["Value"])
+ elif v["FeatureType"] in ["evt"]:
+ featureDefineName = "SCN_" + name.upper()
+ out.append("#define " + featureDefineName + " " + v["Value"])
+ elif v["FeatureType"] in ["val"]:
+ if not ("SCE_" in name or "SCLEX_" in name):
+ out.append("#define " + name + " " + v["Value"])
+ out.append("#endif")
+ return out
+
+def RegenerateAll(root, showMaxID):
+ f = Face.Face()
+ f.ReadFromFile(root + "include/Scintilla.iface")
+ Regenerate(root + "include/Scintilla.h", "/* ", printHFile(f))
+ Regenerate(root + "include/SciLexer.h", "/* ", printLexHFile(f))
+ if showMaxID:
+ valueSet = set(int(x) for x in f.values if int(x) < 3000)
+ maximumID = max(valueSet)
+ print("Maximum ID is %d" % maximumID)
+ #~ valuesUnused = sorted(x for x in range(2001,maximumID) if x not in valueSet)
+ #~ print("\nUnused values")
+ #~ for v in valuesUnused:
+ #~ print(v)
+
+if __name__ == "__main__":
+ RegenerateAll("../", True)