1 /*
2 * ctable.c
3 *
4 * All rights reserved. Copyright (C) 1996 by NARITA Tomio.
5 * $Id: ctable.c,v 1.5 2004/01/05 07:23:29 nrt Exp $
6 */
7 /*
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23 #include <stdio.h>
24 #include <stdlib.h>
25
26 #include <import.h>
27 #include <itable.h>
28 #include <begin.h>
29 #include <ctable_t.h>
30
31 /*
32 * coding system table
33 */
34
35 public c_table_t cTable[ C_TABLE_SIZE ] = {
36 /*
37 * Auto select: decoding on iso-2022-kr and encoding on iso-2022-jp
38 */
39 { AUTOSELECT, FALSE, "AUTO",
40 {{0, 1}, {ASCII, KSC5601, ASCII, ASCII}, 0, 0 } },
41
42 /*
43 * 7bit
44 */
45 { UTF_7, FALSE, "UTF-7",
46 {{0, 1}, {ASCII, ASCII, ASCII, ASCII}, 0, 0 } },
47 { HZ_GB, FALSE, "HZ",
48 {{0, 1}, {ASCII, GB2312, ASCII, ASCII}, 0, 0 } },
49
50 /*
51 * EUC encoding
52 */
53 { EUC_KOREA, FALSE, "EUC-KR",
54 {{0, 1}, {ASCII, KSC5601, ASCII, ASCII}, 0, 0 } },
55 { EUC_JAPAN, FALSE, "EUC-JP",
56 {{0, 1}, {ASCII, X0208, X0201KANA, X0212}, 0, 0 } },
57 { EUC_TAIWAN, FALSE, "EUC-TW",
58 {{0, 1}, {ASCII, CNS_1, CNS_1, ASCII}, 0, 0 } },
59 { EUC_CHINA, FALSE, "EUC-CN",
60 {{0, 1}, {ASCII, GB2312, ASCII, ASCII}, 0, 0 } },
61
62 /*
63 * non iso-2022 encoding
64 */
65 { BIG_FIVE, FALSE, "BIG5",
66 {{0, 1}, {ASCII, ASCII, ASCII, ASCII}, 0, 0 } },
67 { SHIFT_JIS, FALSE, "SHIFT-JIS",
68 {{0, 1}, {ASCII, X0201KANA, ASCII, ASCII}, 0, 0 } },
69 { UTF_8, FALSE, "UTF-8",
70 {{0, 1}, {ASCII, ASCII, ASCII, ASCII}, 0, 0 } },
71
72 /*
73 * ISO 2022 8bit encoding
74 */
75 { ISO_8859_1, TRUE, "ISO-8859-1",
76 {{0, 1}, {ASCII, ISO8859_1, ASCII, ASCII}, 0, 0 } },
77 { ISO_8859_2, TRUE, "ISO-8859-2",
78 {{0, 1}, {ASCII, ISO8859_2, ASCII, ASCII}, 0, 0 } },
79 { ISO_8859_3, TRUE, "ISO-8859-3",
80 {{0, 1}, {ASCII, ISO8859_3, ASCII, ASCII}, 0, 0 } },
81 { ISO_8859_4, TRUE, "ISO-8859-4",
82 {{0, 1}, {ASCII, ISO8859_4, ASCII, ASCII}, 0, 0 } },
83 { ISO_8859_5, TRUE, "ISO-8859-5",
84 {{0, 1}, {ASCII, ISO8859_5, ASCII, ASCII}, 0, 0 } },
85 { ISO_8859_6, TRUE, "ISO-8859-6",
86 {{0, 1}, {ASCII, ISO8859_6, ASCII, ASCII}, 0, 0 } },
87 { ISO_8859_7, TRUE, "ISO-8859-7",
88 {{0, 1}, {ASCII, ISO8859_7, ASCII, ASCII}, 0, 0 } },
89 { ISO_8859_8, TRUE, "ISO-8859-8",
90 {{0, 1}, {ASCII, ISO8859_8, ASCII, ASCII}, 0, 0 } },
91 { ISO_8859_9, TRUE, "ISO-8859-9",
92 {{0, 1}, {ASCII, ISO8859_9, ASCII, ASCII}, 0, 0 } },
93 { ISO_8859_10, TRUE, "ISO-8859-10",
94 {{0, 1}, {ASCII, ISO8859_10, ASCII, ASCII}, 0, 0 } },
95 { ISO_8859_11, TRUE, "ISO-8859-11",
96 {{0, 1}, {ASCII, ISO8859_11, ASCII, ASCII}, 0, 0 } },
97 { ISO_8859_13, TRUE, "ISO-8859-13",
98 {{0, 1}, {ASCII, ISO8859_13, ASCII, ASCII}, 0, 0 } },
99 { ISO_8859_14, TRUE, "ISO-8859-14",
100 {{0, 1}, {ASCII, ISO8859_14, ASCII, ASCII}, 0, 0 } },
101 { ISO_8859_15, TRUE, "ISO-8859-15",
102 {{0, 1}, {ASCII, ISO8859_15, ASCII, ASCII}, 0, 0 } },
103 { ISO_8859_16, TRUE, "ISO-8859-16",
104 {{0, 1}, {ASCII, ISO8859_16, ASCII, ASCII}, 0, 0 } },
105
106 /*
107 * ISO 2022 7bit encoding
108 */
109 { ISO_2022_CN, FALSE, "ISO-2022-CN",
110 {{0, 1}, {ASCII, GB2312, ASCII, ASCII}, 0, 0 } },
111 { ISO_2022_JP, FALSE, "ISO-2022-JP",
112 {{0, 3}, {ASCII, X0201KANA, X0201KANA, X0208}, 0, 0 } },
113 { ISO_2022_KR, FALSE, "ISO-2022-KR",
114 {{0, 1}, {ASCII, KSC5601, ASCII, ASCII}, 0, 0 } },
115
116 /*
117 * Raw encoding
118 */
119 { RAW, FALSE, "RAW",
120 {{0, 1}, {ASCII, ASCII, ASCII, ASCII}, 0, 0 } }
121 };
122
CtableInit()123 public void CtableInit()
124 {
125 int i;
126
127 for( i = 0 ; i < C_TABLE_SIZE ; i++ )
128 if( cTable[ i ].codingSystem != i )
129 fprintf( stderr, "lv: invalid charset table\n" ), exit( -1 );
130 }
131