summaryrefslogtreecommitdiffstats
path: root/genmethodchartbl.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 19:37:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 19:37:08 +0000
commitd710a65c8b50bc3d4d0920dc6e865296f42edd5e (patch)
treed3bf9843448af9398b55f49a50a194bbaacd724e /genmethodchartbl.py
parentInitial commit. (diff)
downloadnghttp2-d710a65c8b50bc3d4d0920dc6e865296f42edd5e.tar.xz
nghttp2-d710a65c8b50bc3d4d0920dc6e865296f42edd5e.zip
Adding upstream version 1.59.0.upstream/1.59.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'genmethodchartbl.py')
-rwxr-xr-xgenmethodchartbl.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/genmethodchartbl.py b/genmethodchartbl.py
new file mode 100755
index 0000000..a0c3a37
--- /dev/null
+++ b/genmethodchartbl.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python3
+import sys
+
+def name(i):
+ if i < 0x21:
+ 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 ',
+ 'SPC '][i]
+ elif i == 0x7f:
+ return 'DEL '
+
+for i in range(256):
+ if chr(i) in ["!" , "#" , "$" , "%" , "&" , "'" , "*",
+ "+" , "-" , "." , "^" , "_" , "`" , "|" , "~"] or\
+ ('0' <= chr(i) and chr(i) <= '9') or \
+ ('A' <= chr(i) and chr(i) <= 'Z') or \
+ ('a' <= chr(i) and chr(i) <= 'z'):
+ sys.stdout.write('1 /* {} */, '.format(chr(i)))
+ elif (0x21 <= i and i < 0x7f):
+ sys.stdout.write('0 /* {} */, '.format(chr(i)))
+ elif 0x80 <= i:
+ sys.stdout.write('0 /* {} */, '.format(hex(i)))
+ else:
+ sys.stdout.write('0 /* {} */, '.format(name(i)))
+ if (i + 1)%4 == 0:
+ sys.stdout.write('\n')