Temporarily use -O1 until segfault with -O2+krb5+iksd is fixed
[ckermit.git] / ckcxla.h
1 /*
2   File CKCXLA.H
3
4   System-independent character-set translation header file for C-Kermit.
5 */
6
7 /*
8   Author: Frank da Cruz <fdc@columbia.edu>,
9   The Kermit Project - Columbia University, New York City.
10
11   Copyright (C) 1985, 2009,
12     Trustees of Columbia University in the City of New York.
13     All rights reserved.  See the C-Kermit COPYING.TXT file or the
14     copyright text in the ckcmai.c module for disclaimer and permissions.
15 */
16 /*
17   NOTE:
18   ISO 204 is Latin-1 + Euro.
19   ISO 205 is Latin-4 + Euro.
20   ISO 206 is Latin-7 + Euro.
21 */
22 #ifndef CKCXLA_H                        /* Guard against multiple inclusion */
23 #define CKCXLA_H
24
25 #ifndef KANJI                           /* Systems supporting Kanji */
26 #ifdef OS2
27 #define KANJI
28 #endif /* OS2 */
29 #endif /* KANJI */
30
31 #ifdef NOKANJI                          /* Except if NOKANJI is defined. */
32 #ifdef KANJI
33 #undef KANJI
34 #endif /* KANJI */
35 #endif /* NOKANJI */
36
37 #ifndef NOUNICODE
38 #ifndef UNICODE                         /* Unicode support */
39 #ifdef OS2ORUNIX                        /* Only for K95, UNIX, VMS,... */
40 #define UNICODE
41 #else
42 #ifdef VMS
43 #define UNICODE
44 #endif /* VMS */
45 #endif /* OS2ORUNIX */
46 #endif /* UNICODE */
47 #endif /* NOUNICODE */
48
49 #define XLA_NONE    0                   /* Translation types - none */
50 #define XLA_BYTE    1                   /* Byte-for-byte */
51 #define XLA_JAPAN   2                   /* Japanese */
52 #define XLA_UNICODE 3                   /* Unicode */
53
54 #ifndef UNIORKANJI                      /* Unicode OR Kanji */
55 #ifdef UNICODE                          /* i.e. some support for */
56 #define UNIORKANJI                      /* multibyte character sets */
57 #endif /* UNICODE */
58 #ifdef KANJI
59 #define UNIORKANJI
60 #endif /* KANJI */
61 #endif /* UNIORKANJI */
62 /*
63    Disable all support for all classes of character sets
64    if NOCSETS is defined.
65 */
66 #ifdef NOCSETS
67
68 #ifdef CKOUNI
69 #undef CKOUNI
70 #endif /* CKOUNI */
71 #ifdef KANJI
72 #undef KANJI
73 #endif /* KANJI */
74 #ifdef CYRILLIC
75 #undef CYRILLIC
76 #endif /* CYRILLIC */
77 #ifdef LATIN2
78 #undef LATIN2
79 #endif /* LATIN2 */
80 #ifdef HEBREW
81 #undef HEBREW
82 #endif /* HEBREW */
83 #ifdef UNICODE
84 #undef UNICODE
85 #endif /* UNICODE */
86 #ifndef NOUNICODE
87 #define NOUNICODE
88 #endif  /* NOUNICODE */
89
90 #else /* Not NOCSETS - Rest of this file... */
91
92 #ifdef NOUNICODE                        /* Unicode */
93 #ifdef UNICODE
94 #undef UNICODE
95 #endif /* UNICODE */
96 #endif /* NOUNICODE */
97
98 #ifdef UNICODE
99 #ifdef OS2
100 #ifndef CKOUNI
101 #define CKOUNI                          /* Special Unicode features for K95 */
102 #endif /* CKOUNI */
103 #endif /* OS2 */
104 #endif /* UNICODE */
105
106 #ifndef OS2
107 #ifdef CKOUNI
108 #undef CKOUNI
109 #endif /* CKOUNI */
110 #endif /* OS2 */
111
112 #ifndef NOLATIN2                        /* If they didn't say "no Latin-2" */
113 #ifndef LATIN2                          /* Then if LATIN2 isn't already */
114 #define LATIN2                          /* defined, define it. */
115 #endif /* LATIN2 */
116 #endif /* NOLATIN2 */
117
118 #ifdef NOCYRILLIC                       /* (spelling variant...) */
119 #ifndef NOCYRIL
120 #define NOCYRIL
121 #endif /* NOCYRIL */
122 #endif /* NOCYRILLIC */
123
124 #ifndef NOCYRIL                         /* If they didn't say "no Cyrillic" */
125 #ifndef CYRILLIC                        /* Then if CYRILLIC isn't already */
126 #define CYRILLIC                        /* defined, define it. */
127 #endif /* CYRILLIC */
128 #endif /* NOCYRIL */
129
130 #ifndef NOHEBREW                        /* If they didn't say "no Hebrew" */
131 #ifndef HEBREW                          /* Then if HEBREW isn't already */
132 #define HEBREW                          /* defined, define it. */
133 #endif /* HEBREW */
134 #endif /* NOHEBREW */
135
136 #ifndef NOGREEK                         /* If not no Greek */
137 #ifndef GREEK                           /* then if GREEK isn't already */
138 #define GREEK                           /* defined, define it. */
139 #endif /* GREEK */
140 #endif /* NOGREEK */
141
142 #ifndef NOKANJI                         /* If not no Kanji */
143 #ifndef KANJI                           /* then if KANJI isn't already */
144 #define KANJI                           /* defined, define it. */
145 #endif /* KANJI */
146 #endif /* NOKANJI */
147
148 /* File ckcxla.h -- Character-set-related definitions, system independent */
149
150 /* Codes for Kermit Transfer Syntax Level (obsolete) */
151
152 #define TS_L0 0          /* Level 0 (Transparent) */
153 #define TS_L1 1          /* Level 1 (one standard character set) */
154 #define TS_L2 2          /* Level 2 (multiple character sets in same file) */
155
156 #define UNK 63           /* Symbol to use for unknown character (63 = ?) */
157
158 /*
159   Codes for the base alphabet of a given character set.
160   These are assigned in roughly ISO 8859 order.
161   (Each is assumed to include ASCII/Roman.)
162 */
163 #define AL_UNIV    0                    /* Universal (like ISO 10646) */
164 #define AL_ROMAN   1                    /* Roman (Latin) alphabet */
165 #define AL_CYRIL   2                    /* Cyrillic alphabet */
166 #define AL_ARABIC  3                    /* Arabic */
167 #define AL_GREEK   4                    /* Greek */
168 #define AL_HEBREW  5                    /* Hebrew */
169 #define AL_KANA    6                    /* Japanese Katakana */
170 #define AL_JAPAN   7                    /* Japanese Katakana+Kanji ideograms */
171 #define AL_HAN     8                    /* Chinese/Japanese/Korean ideograms */
172 #define AL_INDIA   9                    /* Indian scripts (ISCII) */
173 #define AL_VIET   10                    /* Vietnamese (VISCII) */
174                                         /* Add more here... */
175 #define AL_UNK   999                    /* Unknown (transparent) */
176
177 /* Codes for languages */
178 /*
179   NOTE: It would perhaps be better to use ISO 639-1988 2-letter "Codes for
180   Representation of Names of Languages" here, shown in the comments below.
181 */
182 #define L_ASCII       0  /* EN ASCII, English */
183 #define L_USASCII     0  /* EN ASCII, English */
184 #define L_DUTCH       1  /* NL Dutch */
185 #define L_FINNISH     2  /* FI Finnish */
186 #define L_FRENCH      3  /* FR French */
187 #define L_GERMAN      4  /* DE German */
188 #define L_HUNGARIAN   5  /* HU Hungarian */
189 #define L_ITALIAN     6  /* IT Italian */
190 #define L_NORWEGIAN   7  /* NO Norwegian */
191 #define L_PORTUGUESE  8  /* PT Portuguese */
192 #define L_SPANISH     9  /* ES Spanish */
193 #define L_SWEDISH    10  /* SV Swedish */
194 #define L_SWISS      11  /* RM Swiss (Rhaeto-Romance) */
195 #define L_DANISH     12  /* DA Danish */
196 #define L_ICELANDIC  13  /* IS Icelandic */
197 #define L_RUSSIAN    14  /* RU Russian */
198 #define L_JAPANESE   15  /* JA Japanese */
199 #define L_HEBREW     16  /* IW Hebrew */
200 #define L_GREEK      17  /*    Greek */
201
202 #define MAXLANG      17  /* Number of languages */
203
204 /*
205   File character-sets are defined in the system-specific ck?xla.h file,
206   except for the following ones, which must be available to all versions:
207 */
208 #define FC_TRANSP  254                  /* Transparent */
209 #define FC_UNDEF   255                  /* Undefined   */
210 /*
211   Designators for Kermit's transfer character sets.  These are all standard
212   sets, or based on them.  Symbols must be unique in the first 8 characters,
213   because some C preprocessors have this limit.
214 */
215 /* LIST1 */
216 #define TC_TRANSP  0   /* Transparent, no character translation */
217 #define TC_USASCII 1   /* ISO 646 IRV / US 7-bit ASCII */
218 #define TC_1LATIN  2   /* ISO 8859-1, Latin Alphabet 1 */
219 #define TC_2LATIN  3   /* ISO 8859-2, Latin Alphabet 2 */
220 #define TC_CYRILL  4   /* ISO 8859-5, Latin/Cyrillic */
221 #define TC_JEUC    5   /* Japanese EUC = JIS 0201+0202+0208 */
222 #define TC_HEBREW  6   /* ISO 8859-8, Latin/Hebrew */
223 #define TC_GREEK   7   /* ISO 8859-7, Latin/Greek */
224 #define TC_9LATIN  8   /* ISO 8859-15 Latin Alphabet 9 (with Euro) */
225 #define TC_UCS2    9   /* ISO 10646 / Unicode UCS-2 */
226 #define TC_UTF8   10   /* ISO 10646 / Unicode UTF-8 */
227
228 #define MAXTCSETS 10   /* Highest Transfer Character Set Number */
229
230 #ifdef COMMENT
231 /*
232   Not used and probably won't be due to ISO-10646 / Unicode.
233 */
234 #define TC_3LATIN 11  /* ISO 8859-3, Latin-3 */
235 #define TC_4LATIN 12   /* ISO 8859-4, Latin-4 */
236 #define TC_5LATIN 13  /* ISO 8859-9, Latin-5 */
237 #define TC_ARABIC 14  /* ISO-8859-6, Latin/Arabic */
238 #define TC_JIS208 15  /* Japanese JIS X 0208 multibyte set */
239 #define TC_CHINES 16  /* Chinese Standard GB 2312-80 */
240 #define TC_KOREAN 17  /* Korean KS C 5601-1987 */
241 #define TC_ISCII  18  /* Indian standard code for ii... */
242 #define TC_VSCII  19  /* Vietnam standard code for ii... */
243 /* etc... */
244 #endif /* COMMENT */
245
246 /* Structure for character-set information */
247
248 struct csinfo {
249     char *name;                         /* Descriptive name of character set */
250     int size;                           /* Size (e.g. 128, 256, 16384) */
251     int code;                           /* Like TC_1LATIN, etc.  */
252     char *designator;                   /* Designator, like I2/100 = Latin-1 */
253     int alphabet;                       /* Base alphabet */
254     char *keyword;                      /* Keyword for this character-set */
255 };
256
257 /* Structure for language information */
258
259 struct langinfo {
260     int id;                             /* Language ID code (L_whatever) */
261     int fc;                             /* File character set to use */
262     int tc;                             /* Transfer character set to use */
263     char *description;                  /* Description of language */
264 };
265
266 /* Now take in the system-specific definitions */
267
268 #ifdef UNIX
269 #include "ckuxla.h"
270 #endif /* UNIX */
271
272 #ifdef OSK                              /* OS-9 */
273 #include "ckuxla.h"
274 #endif /* OS-9 */
275
276 #ifdef VMS                              /* VAX/VMS */
277 #include "ckuxla.h"
278 #endif /* VMS */
279
280 #ifdef GEMDOS                           /* Atari ST */
281 #include "ckuxla.h"
282 #endif /* GEMDOS */
283
284 #ifdef MAC                              /* Macintosh */
285 #include "ckmxla.h"
286 #endif /* MAC */
287
288 #ifdef OS2                              /* OS/2 */
289 #include "ckuxla.h"                     /* Uses big UNIX version */
290 #endif /* OS2 */
291
292 #ifdef AMIGA                            /* Commodore Amiga */
293 #include "ckuxla.h"
294 #endif /* AMIGA */
295
296 #ifdef datageneral                      /* Data General MV AOS/VS */
297 #include "ckuxla.h"
298 #endif /* datageneral */
299
300 #ifdef STRATUS                          /* Stratus Computer, Inc. VOS */
301 #include "ckuxla.h"
302 #endif /* STRATUS */
303
304 #ifdef UNICODE
305 #include "ckcuni.h"                     /* Unicode */
306 #endif /* UNICODE */
307
308 #ifdef KANJI
309 #define UNKSJIS 0x817f
310 _PROTOTYP(USHORT eu_to_sj, (USHORT) );  /* EUC-JP to Shift-JIS  */
311 _PROTOTYP(USHORT sj_to_eu, (USHORT) );  /* Shift-JIS to EUC-JP  */
312 _PROTOTYP( int xkanjf, (void) );
313 _PROTOTYP( int xkanji, (int, int (*)(char)) );
314 _PROTOTYP( int xkanjz, (int (*)(char) ) );
315 _PROTOTYP( int zkanjf, (void) );
316 _PROTOTYP( int zkanji, (int (*)(void)) ); /* Kanji function prototypes */
317 _PROTOTYP( int zkanjz, (void) );
318 _PROTOTYP(VOID j7init, ( void ) );      /* Initialize JIS-7 parser */
319 _PROTOTYP(int getj7, ( void ) );        /* Get next JIS-7 character */
320 #endif /* KANJI */
321
322 #ifndef MAC
323 #ifndef NOLOCAL
324 _PROTOTYP( int cs_size, (int) );
325 _PROTOTYP( int cs_is_std, (int) );
326 _PROTOTYP( int cs_is_nrc, (int) );
327 _PROTOTYP( VOID setremcharset, (int, int) );
328 _PROTOTYP( VOID setlclcharset, (int) );
329 #endif /* NOLOCAL */
330 #endif /* MAC */
331
332 _PROTOTYP(VOID setxlatype, (int, int));
333
334 #endif /* NOCSETS */
335 #endif /* CKCXLA_H */
336
337 /* End of ckcxla.h */