summaryrefslogtreecommitdiffstats
path: root/gen_utf8_tables.py
diff options
context:
space:
mode:
authorStephen Dolan <mu@netsoc.tcd.ie>2012-10-22 18:47:52 +0100
committerStephen Dolan <mu@netsoc.tcd.ie>2012-10-22 18:47:52 +0100
commit2620e21dcc03efc14f9f570195ee6d1d55cb90a6 (patch)
tree82982be3ff5d5b50b3f747fde43de138593547c5 /gen_utf8_tables.py
parentc53e001973b5d6d749cae20f739eaa3b674a1d92 (diff)
Make the gen_utf8_tables script Python3 compatible (#20)
Diffstat (limited to 'gen_utf8_tables.py')
-rw-r--r--gen_utf8_tables.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/gen_utf8_tables.py b/gen_utf8_tables.py
index 2179222d..98df9144 100644
--- a/gen_utf8_tables.py
+++ b/gen_utf8_tables.py
@@ -5,12 +5,12 @@ mask = lambda n: (1 << n) - 1
def print_table(type, name, t):
assert len(t) == 256
- print "static const",type, name+"[]", "="
+ print("static const %s %s[] =" % (type, name))
first = True
for i in range(0,len(t),16):
- print (" {" if i == 0 else " ") +\
- ", ".join("0x%02x"%n for n in t[i:i+16]) + \
- ("," if i + 16 < 256 else "};")
+ print ((" {" if i == 0 else " ") +
+ ", ".join("0x%02x"%n for n in t[i:i+16]) +
+ ("," if i + 16 < 256 else "};"))
def utf8info(c):
@@ -24,7 +24,7 @@ def utf8info(c):
table = lambda i: [utf8info(c)[i] for c in range(256)]
-print "#define UTF8_CONTINUATION_BYTE ((unsigned char)255)"
+print("#define UTF8_CONTINUATION_BYTE ((unsigned char)255)")
print_table("unsigned char", "utf8_coding_length", table(0))
print_table("unsigned char", "utf8_coding_bits", table(1))