1 /* C K C U N I . H -- Unicode/Terminal character-set translations */
4 Copyright (C) 1999, 2004,
5 Trustees of Columbia University in the City of New York.
6 All rights reserved. See the C-Kermit COPYING.TXT file or the
7 copyright text in the ckcmai.c module for disclaimer and permissions.
10 Frank da Cruz <fdc@columbia.edu>
11 The Kermit Project, Columbia University, New York City.
12 Jeffrey E Altman <jaltman@secure-endpoints.com>
13 Secure Endpoints Inc., New York City
17 /* Terminal character sets */
23 #define CKOUNI /* Use UNICODE for OS/2 functions */
26 #define X_CKOUNI_IN /* Use Unicode Input */
31 /* Terminal Character Sets */
33 #define TX_ASCII 0 /* US ASCII */
34 #define TX_BRITISH 1 /* British ISO 646 */
35 #define TX_CN_FRENCH 2 /* Canadian French NRC */
36 #define TX_CUBAN 3 /* Cuba */
37 #define TX_CZECH 4 /* Czech Republic */
38 #define TX_DANISH 5 /* Denmark / Norway ISO 646 */
39 #define TX_DUTCH 6 /* Dutch NRC */
40 #define TX_FINNISH 7 /* Finnish NRC */
41 #define TX_FRENCH 8 /* French ISO 646 */
42 #define TX_GERMAN 9 /* German ISO 646 */
43 #define TX_HE7 10 /* Hebrew 7 (DEC) */
44 #define TX_HUNGARIAN 11 /* Hungarian ISO 646 */
45 #define TX_ICELANDIC 12 /* Icelandic NRC */
46 #define TX_ITALIAN 13 /* Italian ISO 646 */
47 #define TX_J201R 14 /* JIS 0201 Japanese Roman */
48 #define TX_J201K 15 /* JIS 0201 Katakana */
49 #define TX_KOI7 16 /* Short KOI */
50 #define TX_NORWEGIAN 17 /* Denmark / Norway ISO 646 */
51 #define TX_PORTUGUESE 18 /* Portuguese ISO 646 */
52 #define TX_SPANISH 19 /* Spanish ISO 646 */
53 #define TX_SWEDISH 20 /* Swedish ISO 646 */
54 #define TX_SWE_2 21 /* Swedish for names ISO 646 */
55 #define TX_SWISS 22 /* Swiss NRC */
56 #define TX_8859_1 23 /* Latin-1 */
57 #define TX_8859_2 24 /* Latin-2 */
58 #define TX_8859_3 25 /* Latin-3 */
59 #define TX_8859_4 26 /* Latin-4 */
60 #define TX_8859_5 27 /* Latin/Cyrillic */
61 #define TX_8859_6 28 /* Latin/Arabic */
62 #define TX_8859_7 29 /* Latin/Greek */
63 #define TX_8859_8 30 /* Latin/Hebrew */
64 #define TX_8859_9 31 /* Latin-5 */
65 #define TX_8859_10 32 /* Latin-6 */
67 #define TX_KOI8 33 /* GOST 19768-74 KOI-8 */
69 #define TX_JIS7 34 /* JIS-7 */
70 #define TX_SHJIS 35 /* Shift JIS */
71 #define TX_JEUC 36 /* Japanese EUC */
72 #define TX_JDEC 37 /* Japanese DEC Kanji */
74 #define TX_DECMCS 38 /* DEC MCS */
75 #define TX_NEXT 39 /* NeXT */
76 #define TX_DGI 40 /* Data General International */
77 #define TX_MACL1 41 /* Macintosh Latin-1 */
78 #define TX_HPR8 42 /* HP Roman 8 */
82 #define TX_CP437 43 /* Original */
83 #define TX_CP850 44 /* Multinational (Western Europe) */
84 #define TX_CP852 45 /* Eastern Europe */
85 #define TX_CP857 46 /* Turkey */
86 #define TX_CP862 47 /* Hebrew */
87 #define TX_CP864 48 /* Arabic */
88 #define TX_CP866 49 /* Cyrillic */
89 #define TX_CP869 50 /* Greek */
91 #define TX_DECSPEC 51 /* DEC Special Graphics */
92 #define TX_DECTECH 52 /* DEC Technical */
93 #define TX_C0PICT 53 /* C0 Display Controls */
94 #define TX_C1PICT 54 /* C1 Display Controls */
95 #define TX_IBMC0GRPH 55 /* IBM C0 Graphics (smileys) */
96 #define TX_H19GRAPH 56 /* Heath/Zenith 19 Graphics */
97 #define TX_TVIGRAPH 57 /* Televideo Graphics */
98 #define TX_WYSE60G_N 58 /* Wyse 60 Native Mode Graphics */
99 #define TX_WYSE60G_1 59 /* Wyse 60 Graphics 1 */
100 #define TX_WYSE60G_2 60 /* Wyse 60 Graphics 2 */
101 #define TX_WYSE60G_3 61 /* Wyse 60 Graphics 3 */
103 /* New ones that came too late for the nice grouping... */
105 #define TX_ELOT927 62 /* Greek ELOT 927 */
106 #define TX_DGPCGRPH 63 /* DG PC Graphics */
107 #define TX_DGLDGRPH 64 /* DG Line Drawing Graphics */
108 #define TX_DGWPGRPH 65 /* DG Word Processing (etc) Graphics */
109 #define TX_HPLINE 66 /* HP Line Drawing */
110 #define TX_HPMATH 67 /* HP Math/Technical */
111 #define TX_QNXGRPH 68 /* QNX Graphics */
113 /* Siemens Nixdorf character sets */
115 #define TX_SNIBRACK 69 /* SNI 97801 Brackets */
116 #define TX_SNIEURO 70 /* SNI 97801 Euro */
117 #define TX_SNIFACET 71 /* SNI 97801 Facet */
118 #define TX_SNIIBM 72 /* SNI 97801 "IBM" */
119 #define TX_SNIBLANK 73 /* SNI 97801 Blanks */
121 /* Windows Code pages */
123 #define TX_CP1252 74 /* Latin-1 Windows */
124 #define TX_CP1250 75 /* Latin-2 Windows */
125 #define TX_CP1251 76 /* Cyrillic Windows */
126 #define TX_CP1253 77 /* Greece Windows */
127 #define TX_CP1254 78 /* Turkey Windows */
128 #define TX_CP1257 79 /* Latin-4 Windows */
130 #define TX_CP856 80 /* Bulgaria CP856 (DATECS Ltd) */
132 #define TX_CP819 82 /* Same as ISO 8859-1 */
133 #define TX_CP912 83 /* Same as ISO 8859-2 */
134 #define TX_CP913 84 /* Same as ISO 8859-3 */
135 #define TX_CP914 85 /* Same as ISO 8859-4 */
136 #define TX_CP915 86 /* Same as ISO 8859-5 */
137 #define TX_CP1089 87 /* Same as ISO 8859-6 */
138 #define TX_CP813 88 /* Same as ISO 8859-7 */
139 #define TX_CP916 89 /* Same as ISO 8859-8 */
140 #define TX_CP920 90 /* Same as ISO 8859-9 */
141 #define TX_CP1051 91 /* Same as HP Roman 8 */
142 #define TX_CP858 92 /* Multinational (W. Europe) w/Euro */
143 #define TX_8859_15 93 /* Latin-9 */
144 #define TX_CP923 94 /* Same as ISO 8859-15 */
146 #define TX_ELOT928 95 /* Same as ISO 8859-7 */
147 #define TX_CP10000 96 /* Same as original Apple Quickdraw */
148 #define TX_CP37 97 /* EBCDIC */
149 #define TX_CP1255 98 /* Israel Windows */
150 #define TX_CP1256 99 /* Arabic Windows */
151 #define TX_CP1258 100 /* Viet Nam Windows */
152 #define TX_MAZOVIA 101
153 #define TX_TRANSP 102 /* Transparent - no translation */
154 #define TX_HZ1500 103 /* Hazeltine 1500 graphics set */
155 #define TX_KOI8R 104 /* KOI8R - Russian */
156 #define TX_KOI8U 105 /* KOI8U - Ukrainian */
157 #define TX_APL1 106 /* APL ISO IR 68 */
158 #define TX_APL2 107 /* Dyadic Systems Inc APL */
159 #define TX_APL3 108 /* APL-Plus (APL-2000) */
160 #define TX_APL4 109 /* IBM APL/2 */
161 #define TX_APL5 110 /* APL-2741 */
163 #define MAXTXSETS 111 /* Number of terminal character sets */
165 /* The following are not implemented yet */
166 /* UTF-8 is supported as a special mode in Kermit 95 (see utf8 flag) */
171 #define TX_HEXBYTES 242 /* Hex bytes */
172 #define TX_DEBUG 243 /* Debugging but not hex bytes */
174 /* These are actually used */
176 #define TX_UNDEF 255 /* Unknown character-set */
178 /* Flag bit values */
180 #define X2U_STD 1 /* Has standard ISO 4873 layout */
181 #define X2U_ISO 2 /* ISO standard character set */
182 #define X2U_JIS 4 /* Japan Industrial Standard */
183 #define X2U_CP 8 /* PC Code Page */
184 #define X2U_DEC 16 /* DEC Private character set */
185 #define X2U_CXG 32 /* Control codes used for graphics */
187 struct x_to_unicode {
188 int size; /* 94, 96, 128, or other */
189 int offset; /* 0, 32, 33, 128, 160, ... */
191 int family; /* Language family, writing system */
192 char * keywd; /* Keyword name */
193 char * name; /* Descriptive name */
194 int code; /* ISO reg number if Standard */
195 /* CP number if Code-page, etc. */
196 char * final; /* Esc seq final char(s) (ISO, DEC) */
197 unsigned short map[256]; /* Mapping table */
200 extern struct keytab txrtab[];
204 #define NULL (char *)0
208 #define USHORT unsigned short
212 #define ULONG unsigned long
216 #define CHAR unsigned char
220 extern USHORT (*xl_u[MAXTXSETS+1])(CHAR); /* Blah-to-Unicode functions */
221 extern int (*xl_tx[MAXTXSETS+1])(USHORT); /* Unicode-to-Blah functions */
223 extern USHORT (*xl_u[MAXTXSETS+1])();
224 extern int (*xl_tx[MAXTXSETS+1])();
225 #endif /* CK_ANSIC */
226 extern struct x_to_unicode * txrinfo[MAXTXSETS+1];
228 _PROTOTYP(int isunicode, (void));
229 _PROTOTYP(int utf8_to_ucs2, (CHAR, USHORT **));
230 _PROTOTYP(int ucs2_to_utf8, (USHORT, CHAR **));
231 _PROTOTYP(int tx_cpsub, (USHORT));
232 _PROTOTYP(int u_to_b, (CHAR) );
233 _PROTOTYP(int u_to_b2, (void) );
234 _PROTOTYP(int b_to_u, (CHAR, CHAR *, int, int) );
237 _PROTOTYP(USHORT sj_to_un, (USHORT) ); /* Shift-JIS to Unicode */
238 _PROTOTYP(USHORT un_to_sj, (USHORT) ); /* Unicode to Shift-JIS */
251 #endif /* CK_ANSIC */
253 extern int tt_unicode;
258 if (tt_unicode && !isWin95())
268 #endif /* CKOUNI_H */