summaryrefslogtreecommitdiffstats
path: root/genvchartbl.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 07:34:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 07:34:15 +0000
commitafea5f9539cbf1eeaa85ec77d79eb2f59724f470 (patch)
tree2a4eba394a6bc60d2eaa8304d91168a07225d51e /genvchartbl.py
parentInitial commit. (diff)
downloadnghttp2-upstream.tar.xz
nghttp2-upstream.zip
Adding upstream version 1.52.0.upstream/1.52.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'genvchartbl.py')
-rwxr-xr-xgenvchartbl.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/genvchartbl.py b/genvchartbl.py
new file mode 100755
index 0000000..a4ff8d1
--- /dev/null
+++ b/genvchartbl.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+import sys
+
+def name(i):
+ if i < 0x20:
+ return \
+ ['NUL ', 'SOH ', 'STX ', 'ETX ', 'EOT ', 'ENQ ', 'ACK ', 'BEL ',
+ 'BS ', 'HT ', 'LF ', 'VT ', 'FF ', 'CR ', 'SO ', 'SI ',
+ 'DLE ', 'DC1 ', 'DC2 ', 'DC3 ', 'DC4 ', 'NAK ', 'SYN ', 'ETB ',
+ 'CAN ', 'EM ', 'SUB ', 'ESC ', 'FS ', 'GS ', 'RS ', 'US '][i]
+ elif i == 0x7f:
+ return 'DEL '
+
+for i in range(256):
+ if chr(i) == ' ':
+ sys.stdout.write('1 /* SPC */, ')
+ elif chr(i) == '\t':
+ sys.stdout.write('1 /* HT */, ')
+ elif (0x21 <= i and i < 0x7f):
+ sys.stdout.write('1 /* {} */, '.format(chr(i)))
+ elif 0x80 <= i:
+ sys.stdout.write('1 /* {} */, '.format(hex(i)))
+ else:
+ sys.stdout.write('0 /* {} */, '.format(name(i)))
+ if (i + 1)%4 == 0:
+ sys.stdout.write('\n')