From 0805dbad68142d7d031e54a4d73fa000cce46d98 Mon Sep 17 00:00:00 2001 From: piaip Date: Sun, 17 Apr 2011 01:47:08 +0000 Subject: update big5 table generation git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5335 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- pttbbs/common/sys/Makefile | 6 +++--- pttbbs/common/sys/big5_gen.py | 24 ++++++++++++++++++++++-- pttbbs/common/sys/big5data.zip | Bin 0 -> 315566 bytes pttbbs/common/sys/uao250.zip | Bin 314736 -> 0 bytes 4 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 pttbbs/common/sys/big5data.zip delete mode 100644 pttbbs/common/sys/uao250.zip 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 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/big5data.zip b/pttbbs/common/sys/big5data.zip new file mode 100644 index 00000000..a885a780 Binary files /dev/null and b/pttbbs/common/sys/big5data.zip differ diff --git a/pttbbs/common/sys/uao250.zip b/pttbbs/common/sys/uao250.zip deleted file mode 100644 index 0529fc8a..00000000 Binary files a/pttbbs/common/sys/uao250.zip and /dev/null differ -- cgit v1.2.3