aboutsummaryrefslogtreecommitdiff
path: root/libX11/src/genhextable.py
diff options
context:
space:
mode:
Diffstat (limited to 'libX11/src/genhextable.py')
-rw-r--r--libX11/src/genhextable.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/libX11/src/genhextable.py b/libX11/src/genhextable.py
new file mode 100644
index 000000000..2a45a9e83
--- /dev/null
+++ b/libX11/src/genhextable.py
@@ -0,0 +1,39 @@
+import sys
+
+HexTable={
+ '0' : 0, '1' : 1,
+ '2' : 2, '3' : 3,
+ '4' : 4, '5' : 5,
+ '6' : 6, '7' : 7,
+ '8' : 8, '9' : 9,
+ 'A' : 10, 'B' : 11,
+ 'C' : 12, 'D' : 13,
+ 'E' : 14, 'F' : 15,
+ 'a' : 10, 'b' : 11,
+ 'c' : 12, 'd' : 13,
+ 'e' : 14, 'f' : 15,
+
+ ' ' : -1, ',' : -1,
+ '}' : -1, '\n' : -1,
+ '\t' : -1
+}
+
+OutHexTable=[0]*256
+
+for Char,Val in HexTable.iteritems():
+ OutHexTable[ord(Char)]=Val
+
+print "static const short hexTable[256] = {"
+i=0
+for Item in OutHexTable:
+ if i==0:
+ PreFix=" "
+ elif i%16 == 0:
+ PreFix="\n ,"
+ else:
+ PreFix=", "
+ i+=1
+ Val="%d"%Item
+ if len(Val)==1: Val = " "+Val
+ sys.stdout.write("%s%s"%(PreFix,Val))
+print "\n};" \ No newline at end of file