1
/* Copyright (C) 2010 Edward Der-Hua Liu, Hsin-Chu, Taiwan
3
* This library is free software; you can redistribute it and/or
4
* modify it under the terms of the GNU Lesser General Public
5
* License as published by the Free Software Foundation; either
6
* version 2.1 of the License, or (at your option) any later version.
8
* This library is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
* Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public
14
* License along with this library; if not, write to the Free Software
15
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
#include <sys/types.h>
25
T2S t2s[3000],s2t[3000];
28
int qcmp(const void *aa0, const void *bb0)
47
void gen(T2S *t, char *name)
49
qsort(t, t2sn, sizeof(T2S), qcmp);
52
if ((fw=fopen(name,"w"))==NULL)
53
p_err("cannot write %s", name);
54
fwrite(t, sizeof(T2S), t2sn, fw);
60
/* This data file is maintained by caleb-, ONLY for conversion
61
* from Traditional Chinese to Simplified Chinese.
62
* (Single Chinese glyph, one to one conversion.)
64
* However, "hime-sim2trad" also use this file to do "S to T"
65
* conversion, so the conversion result is not very ideal.
67
char *fname="t2s-file.table";
68
FILE *fp=fopen(fname, "r");
71
dbg("cannot open %s", fname);
76
fgets(tt, sizeof(tt), fp);
83
sscanf(tt,"%s %s",a,b);
84
memcpy(&t2s[t2sn].a, a, sizeof(t2s[0].a));
85
memcpy(&t2s[t2sn].b, b, sizeof(t2s[0].b));
86
memcpy(&s2t[t2sn].b, a, sizeof(s2t[0].a));
87
memcpy(&s2t[t2sn].a, b, sizeof(s2t[0].b));
89
// dbg("%s %s\n", a,b);