1 /* Copyright (C) 1999-2001 Free Software Foundation, Inc.
2 This file is part of the GNU LIBICONV Tools.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software Foundation,
16 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19 * Generates Unicode variants table from Koichi Yasuoka's UniVariants file.
25 #define ENTRIES 8176 /* number of lines in UniVariants file */
26 #define MAX_PER_ENTRY 10 /* max number of entries per line in file */
28 int main (int argc
, char *argv
[])
30 int variants
[MAX_PER_ENTRY
*ENTRIES
];
31 int uni2index
[0x10000];
38 printf(" * Copyright (C) 1999-2001 Free Software Foundation, Inc.\n");
39 printf(" * This file is part of the GNU LIBICONV Library.\n");
41 printf(" * The GNU LIBICONV Library is free software; you can redistribute it\n");
42 printf(" * and/or modify it under the terms of the GNU Library General Public\n");
43 printf(" * License as published by the Free Software Foundation; either version 2\n");
44 printf(" * of the License, or (at your option) any later version.\n");
46 printf(" * The GNU LIBICONV Library is distributed in the hope that it will be\n");
47 printf(" * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of\n");
48 printf(" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n");
49 printf(" * Library General Public License for more details.\n");
51 printf(" * You should have received a copy of the GNU Library General Public\n");
52 printf(" * License along with the GNU LIBICONV Library; see the file COPYING.LIB.\n");
53 printf(" * If not, write to the Free Software Foundation, Inc., 59 Temple Place -\n");
54 printf(" * Suite 330, Boston, MA 02111-1307, USA.\n");
58 printf(" * CJK variants table\n");
64 for (j
= 0; j
< 0x10000; j
++)
72 do { c
= getc(stdin
); } while (!(c
== EOF
|| c
== '\n'));
76 if (scanf("%x",&j
) != 1)
84 if (scanf("%x",&i
) != 1)
86 if (!(i
>= 0x3000 && i
< 0x3000+0x8000))
88 variants
[index
++] = i
-0x3000;
93 variants
[index
-1] |= 0x8000; /* end of list marker */
98 printf("static const unsigned short cjk_variants[%d] = {",index
);
101 for (i
= 0; i
< index
; i
++) {
104 printf(" 0x%04x,",variants
[i
]);
109 printf("static const short cjk_variants_indx[0x5200] = {\n");
112 for (j
= 0x4e00; j
< 0xa000; j
++) {
113 if ((j
% 0x100) == 0)
114 printf(" /* 0x%04x */\n", j
);
117 printf(" %5d,",uni2index
[j
]);