X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=jis.py;h=7fe20d08501ea08b9d577ce3bbbb26495a052a4a;hp=b167eb35072413321a2e720e0d4d9712b3d5aca0;hb=fd074aa05df58fd60d490bb4e367aa2c82338741;hpb=9da6abdcabec59f4845da256a8ad75a810ed1589 diff --git a/jis.py b/jis.py index b167eb3..7fe20d0 100755 --- a/jis.py +++ b/jis.py @@ -1,5 +1,4 @@ #!/usr/bin/python -# $Id$ import sys import os @@ -13,13 +12,14 @@ for line in file(in_fn): if line[0]=='#': continue parts=line.split(None, 3) - code=eval(parts[1]) - code2=((code&0xFF)-0x21)+(((code>>8)&0xFF)-0x21)*94 + code=eval(parts[1])-0x2020 + code2=(code&0xFF)+((code>>8)&0xFF)*94-95 data.append((code, eval(parts[2]), code2)) out=file(out_fn, "w") out.write("namespace {\n\n") +data.sort(lambda x,y: cmp(x[0],y[0])) out.write("const unsigned short jisx0208_to_ucs_table[94*94] =\n{\n\t") i=0 for code in xrange(94*94):