summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pttbbs/common/sys/Makefile6
-rwxr-xr-xpttbbs/common/sys/big5_gen.py24
-rw-r--r--pttbbs/common/sys/big5data.zip (renamed from pttbbs/common/sys/uao250.zip)bin314736 -> 315566 bytes
3 files changed, 25 insertions, 5 deletions
diff --git a/pttbbs/common/sys/Makefile b/pttbbs/common/sys/Makefile
index dd4ca747..0eb22858 100644
--- a/pttbbs/common/sys/Makefile
+++ b/pttbbs/common/sys/Makefile
@@ -10,10 +10,10 @@ LIB:= cmsys
all: .depend
-big5.c: uao250.zip big5_gen.py
- unzip uao250.zip
+big5.c: big5data.zip big5_gen.py
+ unzip big5data.zip
./big5_gen.py > big5.c
- rm -f uao*.txt
+ rm -f *.big5.txt
install:
diff --git a/pttbbs/common/sys/big5_gen.py b/pttbbs/common/sys/big5_gen.py
index f34ef697..32a86a1e 100755
--- a/pttbbs/common/sys/big5_gen.py
+++ b/pttbbs/common/sys/big5_gen.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# b2u
-b2u = open('uao250-b2u.txt', 'r').readlines()
+b2u = open('uao250-b2u.big5.txt', 'r').readlines()
b2u = [line.strip().split(' ')
for line in b2u
if line.strip().startswith('0x')]
@@ -10,6 +10,7 @@ b2u = dict((int(b, 0), int(u, 0)) for (b, u) in b2u)
print """#include <stdint.h>
extern const uint16_t const b2u_table[];
extern const uint16_t const u2b_table[];
+extern const uint8_t const b2u_ambiguous_width[];
"""
print "const uint16_t const b2u_table[0x10000] = {"
for i in range(0x10000):
@@ -19,7 +20,7 @@ for i in range(0x10000):
print "};\n"
# u2b
-u2b = open('uao250-u2b.txt', 'r').readlines()
+u2b = open('uao250-u2b.big5.txt', 'r').readlines()
u2b = [line.strip().split(' ')
for line in u2b
if line.strip().startswith('0x')]
@@ -31,3 +32,22 @@ for i in range(0x10000):
if i % 10 == 9:
print ''
print "};\n"
+
+# ambiguous cjk width
+ambcjk_data = open("ambcjk.big5.txt").readlines()
+ambcjk = []
+for entry in ambcjk_data:
+ (a, b) = entry.strip().split()
+ a = int(a, 0)
+ b = int(b, 0)
+ ambcjk = ambcjk + range(a, b+1)
+print "const uint8_t const b2u_ambiguous_width[0x10000] = {"
+for i in range(0, 0x10000):
+ if i in b2u and b2u[i] in ambcjk:
+ print "1,",
+ else:
+ print "0,",
+ if i % 25 == 24:
+ print ''
+
+print "};\n"
diff --git a/pttbbs/common/sys/uao250.zip b/pttbbs/common/sys/big5data.zip
index 0529fc8a..a885a780 100644
--- a/pttbbs/common/sys/uao250.zip
+++ b/pttbbs/common/sys/big5data.zip
Binary files differ