xref: /freebsd/contrib/tcsh/sh.char.c (revision 4f29da19bd44f0e99f021510460a81bf754c21d2)
1 /* $Header: /src/pub/tcsh/sh.char.c,v 3.18 2002/07/01 20:50:21 christos Exp $ */
2 /*
3  * sh.char.c: Character classification tables
4  */
5 /*-
6  * Copyright (c) 1980, 1991 The Regents of the University of California.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. Neither the name of the University nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  */
33 #include "sh.h"
34 
35 RCSID("$Id: sh.char.c,v 3.18 2002/07/01 20:50:21 christos Exp $")
36 
37 #include "sh.char.h"
38 
39 #if defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE)
40 /* on default same as original map */
41 unsigned short _cmap[256] = {
42 /*	  0 nul		  1 soh		  2 stx		  3 etx	*/
43 	_CTR,		_CTR,		_CTR,		_CTR,
44 
45 /*	  4 eot		  5 enq		  6 ack		  7 bel	*/
46 	_CTR,		_CTR,		_CTR,		_CTR,
47 
48 /*	  8 bs		  9 ht		 10 nl		 11 vt	*/
49 	_CTR,		_CTR|_SP|_META,	_CTR|_NL|_META,	_CTR,
50 
51 /*	 12 np		 13 cr		 14 so		 15 si	*/
52 	_CTR,		_CTR,		_CTR,		_CTR,
53 
54 /*	 16 dle		 17 dc1		 18 dc2		 19 dc3	*/
55 	_CTR,		_CTR,		_CTR,		_CTR,
56 
57 /*	 20 dc4		 21 nak		 22 syn		 23 etb	*/
58 	_CTR,		_CTR,		_CTR,		_CTR,
59 
60 /*	 24 can		 25 em		 26 sub		 27 esc	*/
61 	_CTR,		_CTR,		_CTR,		_CTR,
62 
63 /*	 28 fs		 29 gs		 30 rs		 31 us	*/
64 	_CTR,		_CTR,		_CTR,		_CTR,
65 
66 /*	 32 sp		 33 !		 34 "		 35 #	*/
67 	_SP|_META,	_PUN,		_QF|_PUN,	_META|_PUN,
68 
69 /*	 36 $		 37 %		 38 &		 39 '	*/
70 	_DOL|_PUN,	_PUN,		_META|_CMD|_PUN,_QF|_PUN,
71 
72 /*	 40 (		 41 )		 42 *		 43 +	*/
73 	_META|_CMD|_PUN,_META|_PUN,	_GLOB|_PUN,	_PUN,
74 
75 /*	 44 ,		 45 -		 46 .		 47 /	*/
76 	_PUN,		_PUN,		_PUN,		_PUN,
77 
78 /*	 48 0		 49 1		 50 2		 51 3	*/
79 	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,
80 
81 /*	 52 4		 53 5		 54 6		 55 7	*/
82 	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,
83 
84 /*	 56 8		 57 9		 58 :		 59 ;	*/
85 	_DIG|_XD,	_DIG|_XD,	_PUN,		_META|_CMD|_PUN,
86 
87 /*	 60 <		 61 =		 62 >		 63 ?	*/
88 	_META|_PUN,	_PUN,		_META|_PUN,	_GLOB|_PUN,
89 
90 /*	 64 @		 65 A		 66 B		 67 C	*/
91 	_PUN,		_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,
92 
93 /*	 68 D		 69 E		 70 F		 71 G	*/
94 	_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP,
95 
96 /*	 72 H		 73 I		 74 J		 75 K	*/
97 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
98 
99 /*	 76 L		 77 M		 78 N		 79 O	*/
100 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
101 
102 /*	 80 P		 81 Q		 82 R		 83 S	*/
103 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
104 
105 /*	 84 T		 85 U		 86 V		 87 W	*/
106 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
107 
108 /*	 88 X		 89 Y		 90 Z		 91 [	*/
109 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_GLOB|_PUN,
110 
111 /*	 92 \		 93 ]		 94 ^		 95 _	*/
112 	_ESC|_PUN,	_PUN,		_PUN,		_PUN,
113 
114 /*	 96 `		 97 a		 98 b		 99 c	*/
115   _QB|_GLOB|_META|_PUN,	_LET|_DOW|_XD,	_LET|_DOW|_XD,	_LET|_DOW|_XD,
116 
117 /*	100 d		101 e		102 f		103 g	*/
118 	_LET|_DOW|_XD,	_LET|_DOW|_XD,	_LET|_DOW|_XD,	_LET|_DOW,
119 
120 /*	104 h		105 i		106 j		107 k	*/
121 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
122 
123 /*	108 l		109 m		110 n		111 o	*/
124 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
125 
126 /*	112 p		113 q		114 r		115 s	*/
127 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
128 
129 /*	116 t		117 u		118 v		119 w	*/
130 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
131 
132 /*	120 x		121 y		122 z		123 {	*/
133 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_GLOB|_PUN,
134 
135 /*	124 |		125 }		126 ~		127 del	*/
136 	_META|_CMD|_PUN,_PUN,		_PUN,		_CTR,
137 
138 /****************************************************************/
139 /* 128 - 255 The below is supposedly ISO 8859/1			*/
140 /****************************************************************/
141 /*	128 (undef)	129 (undef)	130 (undef)	131 (undef)	*/
142 	_CTR,		_CTR,		_CTR,		_CTR,
143 
144 /*	132 (undef)	133 (undef)	134 (undef)	135 (undef)	*/
145 	_CTR,		_CTR,		_CTR,		_CTR,
146 
147 /*	136 (undef)	137 (undef)	138 (undef)	139 (undef)	*/
148 	_CTR,		_CTR,		_CTR,		_CTR,
149 
150 /*	140 (undef)	141 (undef)	142 (undef)	143 (undef)	*/
151 	_CTR,		_CTR,		_CTR,		_CTR,
152 
153 /*	144 (undef)	145 (undef)	146 (undef)	147 (undef)	*/
154 	_CTR,		_CTR,		_CTR,		_CTR,
155 
156 /*	148 (undef)	149 (undef)	150 (undef)	151 (undef)	*/
157 	_CTR,		_CTR,		_CTR,		_CTR,
158 
159 /*	152 (undef)	153 (undef)	154 (undef)	155 (undef)	*/
160 	_CTR,		_CTR,		_CTR,		_CTR,
161 
162 /*	156 (undef)	157 (undef)	158 (undef)	159 (undef)	*/
163 	_CTR,		_CTR,		_CTR,		_CTR,
164 
165 /*	160 nobreakspace 161 exclamdown	162 cent	163 sterling	*/
166 	_PUN, /* XXX */	_PUN,		_PUN,		_PUN,
167 
168 /*	164 currency	165 yen		166 brokenbar	167 section	*/
169 	_PUN,		_PUN,		_PUN,		_PUN,
170 
171 /*	168 diaeresis	169 copyright	170 ordfeminine	171 guillemotleft*/
172 	_PUN,		_PUN,		_PUN,		_PUN,
173 
174 /*	172 notsign	173 hyphen	174 registered	175 macron	*/
175 	_PUN,		_PUN,		_PUN,		_PUN,
176 
177 /*	176 degree	177 plusminus	178 twosuperior	179 threesuperior*/
178 	_PUN,		_PUN,		_PUN,		_PUN,
179 
180 /*	180 acute	181 mu 		182 paragraph	183 periodcentered*/
181 	_PUN,		_PUN, /*XXX*/	_PUN,		_PUN,
182 
183 /*	184 cedilla	185 onesuperior	186 masculine	187 guillemotright*/
184 	_PUN,		_PUN,		_PUN,		_PUN,
185 
186 /*	188 onequarter	189 onehalf	190 threequarters 191 questiondown*/
187 	_PUN,		_PUN,		_PUN,		_PUN,
188 
189 /*	192 Agrave	193 Aacute	194 Acircumflex	195 Atilde	*/
190 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
191 
192 /*	196 Adiaeresis	197 Aring	198 AE		199 Ccedilla	*/
193 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
194 
195 /*	200 Egrave	201 Eacute	202 Ecircumflex	203 Ediaeresis	*/
196 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
197 
198 /*	204 Igrave	205 Iacute	206 Icircumflex	207 Idiaeresis	*/
199 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
200 
201 /*	208 ETH		209 Ntilde	210 Ograve	211 Oacute	*/
202 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
203 
204 /*	212 Ocircumflex	213 Otilde	214 Odiaeresis	215 multiply	*/
205 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_PUN,
206 
207 /*	216 Ooblique	217 Ugrave	218 Uacute	219 Ucircumflex	*/
208 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
209 
210 /*	220 Udiaeresis	221 Yacute	222 THORN	223 ssharp	*/
211 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_DOW,
212 
213 /*	224 agrave	225 aacute	226 acircumflex	227 atilde	*/
214 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
215 
216 /*	228 adiaeresis	229 aring	230 ae		231 ccedilla	*/
217 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
218 
219 /*	232 egrave	233 eacute	234 ecircumflex	235 ediaeresis	*/
220 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
221 
222 /*	236 igrave	237 iacute	238 icircumflex	239 idiaeresis	*/
223 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
224 
225 /*	240 eth		241 ntilde	242 ograve	243 oacute	*/
226 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
227 
228 /*	244 ocircumflex	245 otilde	246 odiaeresis	247 division	*/
229 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_PUN,
230 
231 /*	248 oslash	249 ugrave	250 uacute	251 ucircumflex	*/
232 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
233 
234 /*	252 udiaeresis	253 yacute	254 thorn	255 ydiaeresis	*/
235 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
236 };
237 /* original table */
238 unsigned short _cmap_c[256] = {
239 /*	  0 nul		  1 soh		  2 stx		  3 etx	*/
240 	_CTR,		_CTR,		_CTR,		_CTR,
241 
242 /*	  4 eot		  5 enq		  6 ack		  7 bel	*/
243 	_CTR,		_CTR,		_CTR,		_CTR,
244 
245 /*	  8 bs		  9 ht		 10 nl		 11 vt	*/
246 	_CTR,		_CTR|_SP|_META,	_CTR|_NL|_META,	_CTR,
247 
248 /*	 12 np		 13 cr		 14 so		 15 si	*/
249 	_CTR,		_CTR,		_CTR,		_CTR,
250 
251 /*	 16 dle		 17 dc1		 18 dc2		 19 dc3	*/
252 	_CTR,		_CTR,		_CTR,		_CTR,
253 
254 /*	 20 dc4		 21 nak		 22 syn		 23 etb	*/
255 	_CTR,		_CTR,		_CTR,		_CTR,
256 
257 /*	 24 can		 25 em		 26 sub		 27 esc	*/
258 	_CTR,		_CTR,		_CTR,		_CTR,
259 
260 /*	 28 fs		 29 gs		 30 rs		 31 us	*/
261 	_CTR,		_CTR,		_CTR,		_CTR,
262 
263 /*	 32 sp		 33 !		 34 "		 35 #	*/
264 	_SP|_META,	_PUN,		_QF|_PUN,	_META|_PUN,
265 
266 /*	 36 $		 37 %		 38 &		 39 '	*/
267 	_DOL|_PUN,	_PUN,		_META|_CMD|_PUN,_QF|_PUN,
268 
269 /*	 40 (		 41 )		 42 *		 43 +	*/
270 	_META|_CMD|_PUN,_META|_PUN,	_GLOB|_PUN,	_PUN,
271 
272 /*	 44 ,		 45 -		 46 .		 47 /	*/
273 	_PUN,		_PUN,		_PUN,		_PUN,
274 
275 /*	 48 0		 49 1		 50 2		 51 3	*/
276 	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,
277 
278 /*	 52 4		 53 5		 54 6		 55 7	*/
279 	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,
280 
281 /*	 56 8		 57 9		 58 :		 59 ;	*/
282 	_DIG|_XD,	_DIG|_XD,	_PUN,		_META|_CMD|_PUN,
283 
284 /*	 60 <		 61 =		 62 >		 63 ?	*/
285 	_META|_PUN,	_PUN,		_META|_PUN,	_GLOB|_PUN,
286 
287 /*	 64 @		 65 A		 66 B		 67 C	*/
288 	_PUN,		_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,
289 
290 /*	 68 D		 69 E		 70 F		 71 G	*/
291 	_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP,
292 
293 /*	 72 H		 73 I		 74 J		 75 K	*/
294 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
295 
296 /*	 76 L		 77 M		 78 N		 79 O	*/
297 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
298 
299 /*	 80 P		 81 Q		 82 R		 83 S	*/
300 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
301 
302 /*	 84 T		 85 U		 86 V		 87 W	*/
303 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
304 
305 /*	 88 X		 89 Y		 90 Z		 91 [	*/
306 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_GLOB|_PUN,
307 
308 /*	 92 \		 93 ]		 94 ^		 95 _	*/
309 	_ESC|_PUN,	_PUN,		_PUN,		_PUN,
310 
311 /*	 96 `		 97 a		 98 b		 99 c	*/
312   _QB|_GLOB|_META|_PUN,	_LET|_DOW|_XD,	_LET|_DOW|_XD,	_LET|_DOW|_XD,
313 
314 /*	100 d		101 e		102 f		103 g	*/
315 	_LET|_DOW|_XD,	_LET|_DOW|_XD,	_LET|_DOW|_XD,	_LET|_DOW,
316 
317 /*	104 h		105 i		106 j		107 k	*/
318 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
319 
320 /*	108 l		109 m		110 n		111 o	*/
321 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
322 
323 /*	112 p		113 q		114 r		115 s	*/
324 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
325 
326 /*	116 t		117 u		118 v		119 w	*/
327 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
328 
329 /*	120 x		121 y		122 z		123 {	*/
330 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_GLOB|_PUN,
331 
332 /*	124 |		125 }		126 ~		127 del	*/
333 	_META|_CMD|_PUN,_PUN,		_PUN,		_CTR,
334 
335 /****************************************************************/
336 /* 128 - 255 The below is supposedly ISO 8859/1			*/
337 /****************************************************************/
338 /*	128 (undef)	129 (undef)	130 (undef)	131 (undef)	*/
339 	_CTR,		_CTR,		_CTR,		_CTR,
340 
341 /*	132 (undef)	133 (undef)	134 (undef)	135 (undef)	*/
342 	_CTR,		_CTR,		_CTR,		_CTR,
343 
344 /*	136 (undef)	137 (undef)	138 (undef)	139 (undef)	*/
345 	_CTR,		_CTR,		_CTR,		_CTR,
346 
347 /*	140 (undef)	141 (undef)	142 (undef)	143 (undef)	*/
348 	_CTR,		_CTR,		_CTR,		_CTR,
349 
350 /*	144 (undef)	145 (undef)	146 (undef)	147 (undef)	*/
351 	_CTR,		_CTR,		_CTR,		_CTR,
352 
353 /*	148 (undef)	149 (undef)	150 (undef)	151 (undef)	*/
354 	_CTR,		_CTR,		_CTR,		_CTR,
355 
356 /*	152 (undef)	153 (undef)	154 (undef)	155 (undef)	*/
357 	_CTR,		_CTR,		_CTR,		_CTR,
358 
359 /*	156 (undef)	157 (undef)	158 (undef)	159 (undef)	*/
360 	_CTR,		_CTR,		_CTR,		_CTR,
361 
362 /*	160 nobreakspace 161 exclamdown	162 cent	163 sterling	*/
363 	_PUN, /* XXX */	_PUN,		_PUN,		_PUN,
364 
365 /*	164 currency	165 yen		166 brokenbar	167 section	*/
366 	_PUN,		_PUN,		_PUN,		_PUN,
367 
368 /*	168 diaeresis	169 copyright	170 ordfeminine	171 guillemotleft*/
369 	_PUN,		_PUN,		_PUN,		_PUN,
370 
371 /*	172 notsign	173 hyphen	174 registered	175 macron	*/
372 	_PUN,		_PUN,		_PUN,		_PUN,
373 
374 /*	176 degree	177 plusminus	178 twosuperior	179 threesuperior*/
375 	_PUN,		_PUN,		_PUN,		_PUN,
376 
377 /*	180 acute	181 mu 		182 paragraph	183 periodcentered*/
378 	_PUN,		_PUN, /*XXX*/	_PUN,		_PUN,
379 
380 /*	184 cedilla	185 onesuperior	186 masculine	187 guillemotright*/
381 	_PUN,		_PUN,		_PUN,		_PUN,
382 
383 /*	188 onequarter	189 onehalf	190 threequarters 191 questiondown*/
384 	_PUN,		_PUN,		_PUN,		_PUN,
385 
386 /*	192 Agrave	193 Aacute	194 Acircumflex	195 Atilde	*/
387 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
388 
389 /*	196 Adiaeresis	197 Aring	198 AE		199 Ccedilla	*/
390 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
391 
392 /*	200 Egrave	201 Eacute	202 Ecircumflex	203 Ediaeresis	*/
393 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
394 
395 /*	204 Igrave	205 Iacute	206 Icircumflex	207 Idiaeresis	*/
396 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
397 
398 /*	208 ETH		209 Ntilde	210 Ograve	211 Oacute	*/
399 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
400 
401 /*	212 Ocircumflex	213 Otilde	214 Odiaeresis	215 multiply	*/
402 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_PUN,
403 
404 /*	216 Ooblique	217 Ugrave	218 Uacute	219 Ucircumflex	*/
405 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
406 
407 /*	220 Udiaeresis	221 Yacute	222 THORN	223 ssharp	*/
408 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_DOW,
409 
410 /*	224 agrave	225 aacute	226 acircumflex	227 atilde	*/
411 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
412 
413 /*	228 adiaeresis	229 aring	230 ae		231 ccedilla	*/
414 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
415 
416 /*	232 egrave	233 eacute	234 ecircumflex	235 ediaeresis	*/
417 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
418 
419 /*	236 igrave	237 iacute	238 icircumflex	239 idiaeresis	*/
420 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
421 
422 /*	240 eth		241 ntilde	242 ograve	243 oacute	*/
423 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
424 
425 /*	244 ocircumflex	245 otilde	246 odiaeresis	247 division	*/
426 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_PUN,
427 
428 /*	248 oslash	249 ugrave	250 uacute	251 ucircumflex	*/
429 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
430 
431 /*	252 udiaeresis	253 yacute	254 thorn	255 ydiaeresis	*/
432 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
433 };
434 
435 /* multi-byte table */
436 /* BY Masaaki Koyanagi VERY THANKS */
437 unsigned short _cmap_mbyte[256] = {
438 /*	  0 nul		  1 soh		  2 stx		  3 etx	*/
439 	_CTR,		_CTR,		_CTR,		_CTR,
440 
441 /*	  4 eot		  5 enq		  6 ack		  7 bel	*/
442 	_CTR,		_CTR,		_CTR,		_CTR,
443 
444 /*	  8 bs		  9 ht		 10 nl		 11 vt	*/
445 	_CTR,		_CTR|_SP|_META,	_CTR|_NL|_META,	_CTR,
446 
447 /*	 12 np		 13 cr		 14 so		 15 si	*/
448 	_CTR,		_CTR,		_CTR,		_CTR,
449 
450 /*	 16 dle		 17 dc1		 18 dc2		 19 dc3	*/
451 	_CTR,		_CTR,		_CTR,		_CTR,
452 
453 /*	 20 dc4		 21 nak		 22 syn		 23 etb	*/
454 	_CTR,		_CTR,		_CTR,		_CTR,
455 
456 /*	 24 can		 25 em		 26 sub		 27 esc	*/
457 	_CTR,		_CTR,		_CTR,		_CTR,
458 
459 /*	 28 fs		 29 gs		 30 rs		 31 us	*/
460 	_CTR,		_CTR,		_CTR,		_CTR,
461 
462 /*	 32 sp		 33 !		 34 "		 35 #	*/
463 	_SP|_META,	_PUN,		_QF|_PUN,	_META|_PUN,
464 
465 /*	 36 $		 37 %		 38 &		 39 '	*/
466 	_DOL|_PUN,	_PUN,		_META|_CMD|_PUN,_QF|_PUN,
467 
468 /*	 40 (		 41 )		 42 *		 43 +	*/
469 	_META|_CMD|_PUN,_META|_PUN,	_GLOB|_PUN,	_PUN,
470 
471 /*	 44 ,		 45 -		 46 .		 47 /	*/
472 	_PUN,		_PUN,		_PUN,		_PUN,
473 
474 /*	 48 0		 49 1		 50 2		 51 3	*/
475 	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,
476 
477 /*	 52 4		 53 5		 54 6		 55 7	*/
478 	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,
479 
480 /*	 56 8		 57 9		 58 :		 59 ;	*/
481 	_DIG|_XD,	_DIG|_XD,	_PUN,		_META|_CMD|_PUN,
482 
483 /*	 60 <		 61 =		 62 >		 63 ?	*/
484 	_META|_PUN,	_PUN,		_META|_PUN,	_GLOB|_PUN,
485 
486 /*	 64 @		 65 A		 66 B		 67 C	*/
487 	_PUN,		_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,
488 
489 /*	 68 D		 69 E		 70 F		 71 G	*/
490 	_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP,
491 
492 /*	 72 H		 73 I		 74 J		 75 K	*/
493 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
494 
495 /*	 76 L		 77 M		 78 N		 79 O	*/
496 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
497 
498 /*	 80 P		 81 Q		 82 R		 83 S	*/
499 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
500 
501 /*	 84 T		 85 U		 86 V		 87 W	*/
502 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
503 
504 /*	 88 X		 89 Y		 90 Z		 91 [	*/
505 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_GLOB|_PUN,
506 
507 /*	 92 \		 93 ]		 94 ^		 95 _	*/
508 	_ESC|_PUN,	_PUN,		_PUN,		_PUN,
509 
510 /*	 96 `		 97 a		 98 b		 99 c	*/
511   _QB|_GLOB|_META|_PUN,	_LET|_DOW|_XD,	_LET|_DOW|_XD,	_LET|_DOW|_XD,
512 
513 /*	100 d		101 e		102 f		103 g	*/
514 	_LET|_DOW|_XD,	_LET|_DOW|_XD,	_LET|_DOW|_XD,	_LET|_DOW,
515 
516 /*	104 h		105 i		106 j		107 k	*/
517 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
518 
519 /*	108 l		109 m		110 n		111 o	*/
520 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
521 
522 /*	112 p		113 q		114 r		115 s	*/
523 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
524 
525 /*	116 t		117 u		118 v		119 w	*/
526 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
527 
528 /*	120 x		121 y		122 z		123 {	*/
529 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_GLOB|_PUN,
530 
531 /*	124 |		125 }		126 ~		127 del	*/
532 	_META|_CMD|_PUN,_PUN,		_PUN,		_CTR,
533 
534 /****************************************************************/
535 /* 128 - 255 The below is supposedly ISO 8859/1			*/
536 /****************************************************************/
537 /*	128 (undef)	129 (undef)	130 (undef)	131 (undef)	*/
538 	_PUN,		_PUN,		_PUN,		_PUN,
539 
540 /*	132 (undef)	133 (undef)	134 (undef)	135 (undef)	*/
541 	_PUN,		_PUN,		_PUN,		_PUN,
542 
543 /*	136 (undef)	137 (undef)	138 (undef)	139 (undef)	*/
544 	_PUN,		_PUN,		_PUN,		_PUN,
545 
546 /*	140 (undef)	141 (undef)	142 (undef)	143 (undef)	*/
547 	_PUN,		_PUN,		_PUN,		_PUN,
548 
549 /*	144 (undef)	145 (undef)	146 (undef)	147 (undef)	*/
550 	_PUN,		_PUN,		_PUN,		_PUN,
551 
552 /*	148 (undef)	149 (undef)	150 (undef)	151 (undef)	*/
553 	_PUN,		_PUN,		_PUN,		_PUN,
554 
555 /*	152 (undef)	153 (undef)	154 (undef)	155 (undef)	*/
556 	_PUN,		_PUN,		_PUN,		_PUN,
557 
558 /*	156 (undef)	157 (undef)	158 (undef)	159 (undef)	*/
559 	_PUN,		_PUN,		_PUN,		_PUN,
560 
561 /*	160 nobreakspace 161 exclamdown	162 cent	163 sterling	*/
562 	_PUN, /* XXX */	_PUN,		_PUN,		_PUN,
563 
564 /*	164 currency	165 yen		166 brokenbar	167 section	*/
565 	_PUN,		_PUN,		_PUN,		_PUN,
566 
567 /*	168 diaeresis	169 copyright	170 ordfeminine	171 guillemotleft*/
568 	_PUN,		_PUN,		_PUN,		_PUN,
569 
570 /*	172 notsign	173 hyphen	174 registered	175 macron	*/
571 	_PUN,		_PUN,		_PUN,		_PUN,
572 
573 /*	176 degree	177 plusminus	178 twosuperior	179 threesuperior*/
574 	_PUN,		_PUN,		_PUN,		_PUN,
575 
576 /*	180 acute	181 mu 		182 paragraph	183 periodcentered*/
577 	_PUN,		_PUN, /*XXX*/	_PUN,		_PUN,
578 
579 /*	184 cedilla	185 onesuperior	186 masculine	187 guillemotright*/
580 	_PUN,		_PUN,		_PUN,		_PUN,
581 
582 /*	188 onequarter	189 onehalf	190 threequarters 191 questiondown*/
583 	_PUN,		_PUN,		_PUN,		_PUN,
584 
585 /*	192 Agrave	193 Aacute	194 Acircumflex	195 Atilde	*/
586 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
587 
588 /*	196 Adiaeresis	197 Aring	198 AE		199 Ccedilla	*/
589 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
590 
591 /*	200 Egrave	201 Eacute	202 Ecircumflex	203 Ediaeresis	*/
592 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
593 
594 /*	204 Igrave	205 Iacute	206 Icircumflex	207 Idiaeresis	*/
595 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
596 
597 /*	208 ETH		209 Ntilde	210 Ograve	211 Oacute	*/
598 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
599 
600 /*	212 Ocircumflex	213 Otilde	214 Odiaeresis	215 multiply	*/
601 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_PUN,
602 
603 /*	216 Ooblique	217 Ugrave	218 Uacute	219 Ucircumflex	*/
604 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
605 
606 /*	220 Udiaeresis	221 Yacute	222 THORN	223 ssharp	*/
607 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_DOW,
608 
609 /*	224 agrave	225 aacute	226 acircumflex	227 atilde	*/
610 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
611 
612 /*	228 adiaeresis	229 aring	230 ae		231 ccedilla	*/
613 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
614 
615 /*	232 egrave	233 eacute	234 ecircumflex	235 ediaeresis	*/
616 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
617 
618 /*	236 igrave	237 iacute	238 icircumflex	239 idiaeresis	*/
619 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
620 
621 /*	240 eth		241 ntilde	242 ograve	243 oacute	*/
622 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
623 
624 /*	244 ocircumflex	245 otilde	246 odiaeresis	247 division	*/
625 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_PUN,
626 
627 /*	248 oslash	249 ugrave	250 uacute	251 ucircumflex	*/
628 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
629 
630 /*	252 udiaeresis	253 yacute	254 thorn	255 ydiaeresis	*/
631 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
632 };
633 
634 short _enable_mbdisp = 0; /* control multi-byte 0...disable 1...enable */
635 
636 /* multi-byte check table */
637 /* default = all 0 (clear process in update_vars()/unset()) */
638 unsigned short _mbmap[256];
639 
640 unsigned short _mbmap_euc[256] = {
641 /* first byte	0x8e,0xa0 - 0xf4 */
642 /* second byte 	0xa0 - 0xfe */
643 /* 0 - 7f all 0 */
644     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
645     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
646     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
647     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
648 /*  80		81		82		83 */
649     0,		0,		0,		0,
650 /*  84		85		86		87 */
651     0,		0,		0,		0,
652 /*  88		89		8a		8b */
653     0,		0,		0,		0,
654 /*  8c		8d		8e		8f */
655     0,		0,		_MB1,		0,
656 /* 90 - 9f all 0 */
657     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
658 /*  a0		a1		a2		a3 */
659     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
660 /*  a4		a5		a6		a7 */
661     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
662 /*  a8		a9		aa		ab */
663     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
664 /*  ac		ad		ae		af */
665     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
666 /*  b0		b1		b2		b3 */
667     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
668 /*  b4		b5		b6		b7 */
669     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
670 /*  b8		b9		ba		bb */
671     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
672 /*  bc		bd		be		bf */
673     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
674 /*  c0		c1		c2		c3 */
675     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
676 /*  c4		c5		c6		c7 */
677     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
678 /*  c8		c9		ca		cb */
679     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
680 /*  cc		cd		ce		cf */
681     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
682 /*  d0		d1		d2		d3 */
683     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
684 /*  d4		d5		d6		d7 */
685     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
686 /*  d8		d9		da		db */
687     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
688 /*  dc		dd		de		df */
689     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
690 /*  e0		e1		e2		e3 */
691     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
692 /*  e4		e5		e6		e7 */
693     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
694 /*  e8		e9		ea		eb */
695     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
696 /*  ec		ed		ee		ef */
697     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
698 /*  f0		f1		f2		f3 */
699     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
700 /*  f4		f5		f6		f7 */
701     _MB1|_MB2,	_MB2,		_MB2,		_MB2,
702 /*  f8		f9		fa		fb */
703     _MB2,	_MB2,		_MB2,		_MB2,
704 /*  fc		fd		fe		ff */
705     _MB2,	_MB2,		_MB2,		0,
706 };
707 
708 unsigned short _mbmap_sjis[256] = {
709 /* first byte	0x81-0x9f,0xe0 - 0xfc */
710 /* second byte 	0x40-0x7e,0x80 - 0xfc */
711 /* 0 - 3f all 0 */
712     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
713     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
714 /*  40		41		42		43 */
715     _MB2,	_MB2,		_MB2,		_MB2,
716 /*  44		45		46		47 */
717     _MB2,	_MB2,		_MB2,		_MB2,
718 /*  48		49		4a		4b */
719     _MB2,	_MB2,		_MB2,		_MB2,
720 /*  4c		4d		4e		4f */
721     _MB2,	_MB2,		_MB2,		_MB2,
722 /*  50		51		52		53 */
723     _MB2,	_MB2,		_MB2,		_MB2,
724 /*  54		55		56		57 */
725     _MB2,	_MB2,		_MB2,		_MB2,
726 /*  58		59		5a		5b */
727     _MB2,	_MB2,		_MB2,		_MB2,
728 /*  5c		5d		5e		5f */
729     _MB2,	_MB2,		_MB2,		_MB2,
730 /*  60		61		62		63 */
731     _MB2,	_MB2,		_MB2,		_MB2,
732 /*  64		65		66		67 */
733     _MB2,	_MB2,		_MB2,		_MB2,
734 /*  68		69		6a		6b */
735     _MB2,	_MB2,		_MB2,		_MB2,
736 /*  6c		6d		6e		6f */
737     _MB2,	_MB2,		_MB2,		_MB2,
738 /*  70		71		72		73 */
739     _MB2,	_MB2,		_MB2,		_MB2,
740 /*  74		75		76		77 */
741     _MB2,	_MB2,		_MB2,		_MB2,
742 /*  78		79		7a		7b */
743     _MB2,	_MB2,		_MB2,		_MB2,
744 /*  7c		7d		7e		7f */
745     _MB2,	_MB2,		_MB2,		0,
746 /*  80		81		82		83 */
747     _MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
748 /*  84		85		86		87 */
749     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
750 /*  88		89		8a		8b */
751     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
752 /*  8c		8d		8e		8f */
753     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
754 /*  90		91		92		93 */
755     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
756 /*  94		95		96		97 */
757     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
758 /*  98		99		9a		9b */
759     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
760 /*  9c		9d		9e		9f */
761     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
762 /*  a0		a1		a2		a3 */
763     _MB2,	_MB2,		_MB2,		_MB2,
764 /*  a4		a5		a6		a7 */
765     _MB2,	_MB2,		_MB2,		_MB2,
766 /*  a8		a9		aa		ab */
767     _MB2,	_MB2,		_MB2,		_MB2,
768 /*  ac		ad		ae		af */
769     _MB2,	_MB2,		_MB2,		_MB2,
770 /*  b0		b1		b2		b3 */
771     _MB2,	_MB2,		_MB2,		_MB2,
772 /*  b4		b5		b6		b7 */
773     _MB2,	_MB2,		_MB2,		_MB2,
774 /*  b8		b9		ba		bb */
775     _MB2,	_MB2,		_MB2,		_MB2,
776 /*  bc		bd		be		bf */
777     _MB2,	_MB2,		_MB2,		_MB2,
778 /*  c0		c1		c2		c3 */
779     _MB2,	_MB2,		_MB2,		_MB2,
780 /*  c4		c5		c6		c7 */
781     _MB2,	_MB2,		_MB2,		_MB2,
782 /*  c8		c9		ca		cb */
783     _MB2,	_MB2,		_MB2,		_MB2,
784 /*  cc		cd		ce		cf */
785     _MB2,	_MB2,		_MB2,		_MB2,
786 /*  d0		d1		d2		d3 */
787     _MB2,	_MB2,		_MB2,		_MB2,
788 /*  d4		d5		d6		d7 */
789     _MB2,	_MB2,		_MB2,		_MB2,
790 /*  d8		d9		da		db */
791     _MB2,	_MB2,		_MB2,		_MB2,
792 /*  dc		dd		de		df */
793     _MB2,	_MB2,		_MB2,		_MB2,
794 /*  e0		e1		e2		e3 */
795     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
796 /*  e4		e5		e6		e7 */
797     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
798 /*  e8		e9		ea		eb */
799     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
800 /*  ec		ed		ee		ef */
801     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
802 /*  f0		f1		f2		f3 */
803     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
804 /*  f4		f5		f6		f7 */
805     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
806 /*  f8		f9		fa		fb */
807     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
808 /*  fc		fd		fe		ff */
809     _MB1|_MB2,	0,		0,		0,
810 };
811 
812 unsigned short _mbmap_big5[256] = {
813 /* This is latest big5 charmap, so called "Big5+" */
814 /* first byte   0x81 - 0xfe */
815 /* second byte  0x40 - 0x7e, 0x80 - 0xfe */
816 /* 0x00 - 0x3f = 0 */
817     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
818     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
819 /* 0x40 - 0x7e = 2 */
820     _MB2,	_MB2,		_MB2,		_MB2,
821     _MB2,	_MB2,		_MB2,		_MB2,
822     _MB2,	_MB2,		_MB2,		_MB2,
823     _MB2,	_MB2,		_MB2,		_MB2,
824     _MB2,	_MB2,		_MB2,		_MB2,
825     _MB2,	_MB2,		_MB2,		_MB2,
826     _MB2,	_MB2,		_MB2,		_MB2,
827     _MB2,	_MB2,		_MB2,		_MB2,
828     _MB2,	_MB2,		_MB2,		_MB2,
829     _MB2,	_MB2,		_MB2,		_MB2,
830     _MB2,	_MB2,		_MB2,		_MB2,
831     _MB2,	_MB2,		_MB2,		_MB2,
832     _MB2,	_MB2,		_MB2,		_MB2,
833     _MB2,	_MB2,		_MB2,		_MB2,
834     _MB2,	_MB2,		_MB2,		_MB2,
835 						/* 0x7f = 0 */
836     _MB2,	_MB2,		_MB2,		0,
837 /* 0x80 = 2, 0x81 - 0xfe = 3 */
838     _MB2,      _MB1|_MB2,      _MB1|_MB2,      _MB1|_MB2,
839     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
840     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
841     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
842     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
843     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
844     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
845     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
846     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
847     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
848     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
849     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
850     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
851     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
852     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
853     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
854     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
855     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
856     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
857     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
858     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
859     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
860     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
861     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
862     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
863     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
864     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
865     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
866     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
867     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
868     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,
869 						/* 0xff = 0 */
870     _MB1|_MB2,	_MB1|_MB2,	_MB1|_MB2,	0,
871 };
872 
873 unsigned short _mbmap_utf8[256] = {
874 /* utf8 uses up to 6 bytes */
875 /* first byte        0xc0 - 0xfd */
876 /* any further bytes 0x80 - 0xbf */
877 /* 0 - 7f all 0 */
878     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
879     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
880     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
881     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
882 /*  80 - bf : all _MB2 */
883     _MB2, _MB2, _MB2, _MB2, _MB2, _MB2, _MB2, _MB2,
884     _MB2, _MB2, _MB2, _MB2, _MB2, _MB2, _MB2, _MB2,
885     _MB2, _MB2, _MB2, _MB2, _MB2, _MB2, _MB2, _MB2,
886     _MB2, _MB2, _MB2, _MB2, _MB2, _MB2, _MB2, _MB2,
887     _MB2, _MB2, _MB2, _MB2, _MB2, _MB2, _MB2, _MB2,
888     _MB2, _MB2, _MB2, _MB2, _MB2, _MB2, _MB2, _MB2,
889     _MB2, _MB2, _MB2, _MB2, _MB2, _MB2, _MB2, _MB2,
890     _MB2, _MB2, _MB2, _MB2, _MB2, _MB2, _MB2, _MB2,
891 /* c0 - fc : all _MB1 */
892     _MB1, _MB1, _MB1, _MB1, _MB1, _MB1, _MB1, _MB1,
893     _MB1, _MB1, _MB1, _MB1, _MB1, _MB1, _MB1, _MB1,
894     _MB1, _MB1, _MB1, _MB1, _MB1, _MB1, _MB1, _MB1,
895     _MB1, _MB1, _MB1, _MB1, _MB1, _MB1, _MB1, _MB1,
896     _MB1, _MB1, _MB1, _MB1, _MB1, _MB1, _MB1, _MB1,
897     _MB1, _MB1, _MB1, _MB1, _MB1, _MB1, _MB1, _MB1,
898     _MB1, _MB1, _MB1, _MB1, _MB1, _MB1, _MB1, _MB1,
899 /*  f8    f9    fa    fb    fc    fd    fe    ff*/
900     _MB1, _MB1, _MB1, _MB1, _MB1, _MB1, 0,    0
901 };
902 
903 #else /* !(defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE)) */
904 unsigned short _cmap[256] = {
905 /*	  0 nul		  1 soh		  2 stx		  3 etx	*/
906 	_CTR,		_CTR,		_CTR,		_CTR,
907 
908 /*	  4 eot		  5 enq		  6 ack		  7 bel	*/
909 	_CTR,		_CTR,		_CTR,		_CTR,
910 
911 /*	  8 bs		  9 ht		 10 nl		 11 vt	*/
912 	_CTR,		_CTR|_SP|_META,	_CTR|_NL|_META,	_CTR,
913 
914 /*	 12 np		 13 cr		 14 so		 15 si	*/
915 	_CTR,		_CTR,		_CTR,		_CTR,
916 
917 /*	 16 dle		 17 dc1		 18 dc2		 19 dc3	*/
918 	_CTR,		_CTR,		_CTR,		_CTR,
919 
920 /*	 20 dc4		 21 nak		 22 syn		 23 etb	*/
921 	_CTR,		_CTR,		_CTR,		_CTR,
922 
923 /*	 24 can		 25 em		 26 sub		 27 esc	*/
924 	_CTR,		_CTR,		_CTR,		_CTR,
925 
926 /*	 28 fs		 29 gs		 30 rs		 31 us	*/
927 	_CTR,		_CTR,		_CTR,		_CTR,
928 
929 /*	 32 sp		 33 !		 34 "		 35 #	*/
930 	_SP|_META,	_PUN,		_QF|_PUN,	_META|_PUN,
931 
932 /*	 36 $		 37 %		 38 &		 39 '	*/
933 	_DOL|_PUN,	_PUN,		_META|_CMD|_PUN,_QF|_PUN,
934 
935 /*	 40 (		 41 )		 42 *		 43 +	*/
936 	_META|_CMD|_PUN,_META|_PUN,	_GLOB|_PUN,	_PUN,
937 
938 /*	 44 ,		 45 -		 46 .		 47 /	*/
939 	_PUN,		_PUN,		_PUN,		_PUN,
940 
941 /*	 48 0		 49 1		 50 2		 51 3	*/
942 	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,
943 
944 /*	 52 4		 53 5		 54 6		 55 7	*/
945 	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,
946 
947 /*	 56 8		 57 9		 58 :		 59 ;	*/
948 	_DIG|_XD,	_DIG|_XD,	_PUN,		_META|_CMD|_PUN,
949 
950 /*	 60 <		 61 =		 62 >		 63 ?	*/
951 	_META|_PUN,	_PUN,		_META|_PUN,	_GLOB|_PUN,
952 
953 /*	 64 @		 65 A		 66 B		 67 C	*/
954 	_PUN,		_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,
955 
956 /*	 68 D		 69 E		 70 F		 71 G	*/
957 	_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP,
958 
959 /*	 72 H		 73 I		 74 J		 75 K	*/
960 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
961 
962 /*	 76 L		 77 M		 78 N		 79 O	*/
963 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
964 
965 /*	 80 P		 81 Q		 82 R		 83 S	*/
966 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
967 
968 /*	 84 T		 85 U		 86 V		 87 W	*/
969 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
970 
971 /*	 88 X		 89 Y		 90 Z		 91 [	*/
972 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_GLOB|_PUN,
973 
974 /*	 92 \		 93 ]		 94 ^		 95 _	*/
975 	_ESC|_PUN,	_PUN,		_PUN,		_PUN,
976 
977 /*	 96 `		 97 a		 98 b		 99 c	*/
978   _QB|_GLOB|_META|_PUN,	_LET|_DOW|_XD,	_LET|_DOW|_XD,	_LET|_DOW|_XD,
979 
980 /*	100 d		101 e		102 f		103 g	*/
981 	_LET|_DOW|_XD,	_LET|_DOW|_XD,	_LET|_DOW|_XD,	_LET|_DOW,
982 
983 /*	104 h		105 i		106 j		107 k	*/
984 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
985 
986 /*	108 l		109 m		110 n		111 o	*/
987 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
988 
989 /*	112 p		113 q		114 r		115 s	*/
990 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
991 
992 /*	116 t		117 u		118 v		119 w	*/
993 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
994 
995 /*	120 x		121 y		122 z		123 {	*/
996 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_GLOB|_PUN,
997 
998 /*	124 |		125 }		126 ~		127 del	*/
999 	_META|_CMD|_PUN,_PUN,		_PUN,		_CTR,
1000 
1001 #ifdef SHORT_STRINGS
1002 /****************************************************************/
1003 /* 128 - 255 The below is supposedly ISO 8859/1			*/
1004 /****************************************************************/
1005 /*	128 (undef)	129 (undef)	130 (undef)	131 (undef)	*/
1006 	_CTR,		_CTR,		_CTR,		_CTR,
1007 
1008 /*	132 (undef)	133 (undef)	134 (undef)	135 (undef)	*/
1009 	_CTR,		_CTR,		_CTR,		_CTR,
1010 
1011 /*	136 (undef)	137 (undef)	138 (undef)	139 (undef)	*/
1012 	_CTR,		_CTR,		_CTR,		_CTR,
1013 
1014 /*	140 (undef)	141 (undef)	142 (undef)	143 (undef)	*/
1015 	_CTR,		_CTR,		_CTR,		_CTR,
1016 
1017 /*	144 (undef)	145 (undef)	146 (undef)	147 (undef)	*/
1018 	_CTR,		_CTR,		_CTR,		_CTR,
1019 
1020 /*	148 (undef)	149 (undef)	150 (undef)	151 (undef)	*/
1021 	_CTR,		_CTR,		_CTR,		_CTR,
1022 
1023 /*	152 (undef)	153 (undef)	154 (undef)	155 (undef)	*/
1024 	_CTR,		_CTR,		_CTR,		_CTR,
1025 
1026 /*	156 (undef)	157 (undef)	158 (undef)	159 (undef)	*/
1027 	_CTR,		_CTR,		_CTR,		_CTR,
1028 
1029 /*	160 nobreakspace 161 exclamdown	162 cent	163 sterling	*/
1030 	_PUN, /* XXX */	_PUN,		_PUN,		_PUN,
1031 
1032 /*	164 currency	165 yen		166 brokenbar	167 section	*/
1033 	_PUN,		_PUN,		_PUN,		_PUN,
1034 
1035 /*	168 diaeresis	169 copyright	170 ordfeminine	171 guillemotleft*/
1036 	_PUN,		_PUN,		_PUN,		_PUN,
1037 
1038 /*	172 notsign	173 hyphen	174 registered	175 macron	*/
1039 	_PUN,		_PUN,		_PUN,		_PUN,
1040 
1041 /*	176 degree	177 plusminus	178 twosuperior	179 threesuperior*/
1042 	_PUN,		_PUN,		_PUN,		_PUN,
1043 
1044 /*	180 acute	181 mu 		182 paragraph	183 periodcentered*/
1045 	_PUN,		_PUN, /*XXX*/	_PUN,		_PUN,
1046 
1047 /*	184 cedilla	185 onesuperior	186 masculine	187 guillemotright*/
1048 	_PUN,		_PUN,		_PUN,		_PUN,
1049 
1050 /*	188 onequarter	189 onehalf	190 threequarters 191 questiondown*/
1051 	_PUN,		_PUN,		_PUN,		_PUN,
1052 
1053 /*	192 Agrave	193 Aacute	194 Acircumflex	195 Atilde	*/
1054 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
1055 
1056 /*	196 Adiaeresis	197 Aring	198 AE		199 Ccedilla	*/
1057 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
1058 
1059 /*	200 Egrave	201 Eacute	202 Ecircumflex	203 Ediaeresis	*/
1060 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
1061 
1062 /*	204 Igrave	205 Iacute	206 Icircumflex	207 Idiaeresis	*/
1063 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
1064 
1065 /*	208 ETH		209 Ntilde	210 Ograve	211 Oacute	*/
1066 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
1067 
1068 /*	212 Ocircumflex	213 Otilde	214 Odiaeresis	215 multiply	*/
1069 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_PUN,
1070 
1071 /*	216 Ooblique	217 Ugrave	218 Uacute	219 Ucircumflex	*/
1072 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
1073 
1074 /*	220 Udiaeresis	221 Yacute	222 THORN	223 ssharp	*/
1075 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_DOW,
1076 
1077 /*	224 agrave	225 aacute	226 acircumflex	227 atilde	*/
1078 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
1079 
1080 /*	228 adiaeresis	229 aring	230 ae		231 ccedilla	*/
1081 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
1082 
1083 /*	232 egrave	233 eacute	234 ecircumflex	235 ediaeresis	*/
1084 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
1085 
1086 /*	236 igrave	237 iacute	238 icircumflex	239 idiaeresis	*/
1087 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
1088 
1089 /*	240 eth		241 ntilde	242 ograve	243 oacute	*/
1090 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
1091 
1092 /*	244 ocircumflex	245 otilde	246 odiaeresis	247 division	*/
1093 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_PUN,
1094 
1095 /*	248 oslash	249 ugrave	250 uacute	251 ucircumflex	*/
1096 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
1097 
1098 /*	252 udiaeresis	253 yacute	254 thorn	255 ydiaeresis	*/
1099 	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
1100 #endif /* SHORT_STRINGS */
1101 };
1102 #endif /* defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE) */
1103 
1104 #ifndef NLS
1105 /* _cmap_lower, _cmap_upper for ISO 8859/1 */
1106 
1107 unsigned char _cmap_lower[256] = {
1108 	0000,	0001,	0002,	0003,	0004,	0005,	0006,	0007,
1109 	0010,	0011,	0012,	0013,	0014,	0015,	0016,	0017,
1110 	0020,	0021,	0022,	0023,	0024,	0025,	0026,	0027,
1111 	0030,	0031,	0032,	0033,	0034,	0035,	0036,	0037,
1112 	0040,	0041,	0042,	0043,	0044,	0045,	0046,	0047,
1113 	0050,	0051,	0052,	0053,	0054,	0055,	0056,	0057,
1114 	0060,	0061,	0062,	0063,	0064,	0065,	0066,	0067,
1115 	0070,	0071,	0072,	0073,	0074,	0075,	0076,	0077,
1116 	0100,	0141,	0142,	0143,	0144,	0145,	0146,	0147,
1117 	0150,	0151,	0152,	0153,	0154,	0155,	0156,	0157,
1118 	0160,	0161,	0162,	0163,	0164,	0165,	0166,	0167,
1119 	0170,	0171,	0172,	0133,	0134,	0135,	0136,	0137,
1120 	0140,	0141,	0142,	0143,	0144,	0145,	0146,	0147,
1121 	0150,	0151,	0152,	0153,	0154,	0155,	0156,	0157,
1122 	0160,	0161,	0162,	0163,	0164,	0165,	0166,	0167,
1123 	0170,	0171,	0172,	0173,	0174,	0175,	0176,	0177,
1124 	0200,	0201,	0202,	0203,	0204,	0205,	0206,	0207,
1125 	0210,	0211,	0212,	0213,	0214,	0215,	0216,	0217,
1126 	0220,	0221,	0222,	0223,	0224,	0225,	0226,	0227,
1127 	0230,	0231,	0232,	0233,	0234,	0235,	0236,	0237,
1128 	0240,	0241,	0242,	0243,	0244,	0245,	0246,	0247,
1129 	0250,	0251,	0252,	0253,	0254,	0255,	0256,	0257,
1130 	0260,	0261,	0262,	0263,	0264,	0265,	0266,	0267,
1131 	0270,	0271,	0272,	0273,	0274,	0275,	0276,	0277,
1132 	0340,	0341,	0342,	0343,	0344,	0345,	0346,	0347,
1133 	0350,	0351,	0352,	0353,	0354,	0355,	0356,	0357,
1134 	0360,	0361,	0362,	0363,	0364,	0365,	0366,	0327,
1135 	0370,	0371,	0372,	0373,	0374,	0375,	0376,	0337,
1136 	0340,	0341,	0342,	0343,	0344,	0345,	0346,	0347,
1137 	0350,	0351,	0352,	0353,	0354,	0355,	0356,	0357,
1138 	0360,	0361,	0362,	0363,	0364,	0365,	0366,	0367,
1139 	0370,	0371,	0372,	0373,	0374,	0375,	0376,	0377,
1140 };
1141 
1142 unsigned char _cmap_upper[256] = {
1143 	0000,	0001,	0002,	0003,	0004,	0005,	0006,	0007,
1144 	0010,	0011,	0012,	0013,	0014,	0015,	0016,	0017,
1145 	0020,	0021,	0022,	0023,	0024,	0025,	0026,	0027,
1146 	0030,	0031,	0032,	0033,	0034,	0035,	0036,	0037,
1147 	0040,	0041,	0042,	0043,	0044,	0045,	0046,	0047,
1148 	0050,	0051,	0052,	0053,	0054,	0055,	0056,	0057,
1149 	0060,	0061,	0062,	0063,	0064,	0065,	0066,	0067,
1150 	0070,	0071,	0072,	0073,	0074,	0075,	0076,	0077,
1151 	0100,	0101,	0102,	0103,	0104,	0105,	0106,	0107,
1152 	0110,	0111,	0112,	0113,	0114,	0115,	0116,	0117,
1153 	0120,	0121,	0122,	0123,	0124,	0125,	0126,	0127,
1154 	0130,	0131,	0132,	0133,	0134,	0135,	0136,	0137,
1155 	0140,	0101,	0102,	0103,	0104,	0105,	0106,	0107,
1156 	0110,	0111,	0112,	0113,	0114,	0115,	0116,	0117,
1157 	0120,	0121,	0122,	0123,	0124,	0125,	0126,	0127,
1158 	0130,	0131,	0132,	0173,	0174,	0175,	0176,	0177,
1159 	0200,	0201,	0202,	0203,	0204,	0205,	0206,	0207,
1160 	0210,	0211,	0212,	0213,	0214,	0215,	0216,	0217,
1161 	0220,	0221,	0222,	0223,	0224,	0225,	0226,	0227,
1162 	0230,	0231,	0232,	0233,	0234,	0235,	0236,	0237,
1163 	0240,	0241,	0242,	0243,	0244,	0245,	0246,	0247,
1164 	0250,	0251,	0252,	0253,	0254,	0255,	0256,	0257,
1165 	0260,	0261,	0262,	0263,	0264,	0265,	0266,	0267,
1166 	0270,	0271,	0272,	0273,	0274,	0275,	0276,	0277,
1167 	0300,	0301,	0302,	0303,	0304,	0305,	0306,	0307,
1168 	0310,	0311,	0312,	0313,	0314,	0315,	0316,	0317,
1169 	0320,	0321,	0322,	0323,	0324,	0325,	0326,	0327,
1170 	0330,	0331,	0332,	0333,	0334,	0335,	0336,	0337,
1171 	0300,	0301,	0302,	0303,	0304,	0305,	0306,	0307,
1172 	0310,	0311,	0312,	0313,	0314,	0315,	0316,	0317,
1173 	0320,	0321,	0322,	0323,	0324,	0325,	0326,	0367,
1174 	0330,	0331,	0332,	0333,	0334,	0335,	0336,	0377,
1175 };
1176 #endif /* NLS */
1177 
1178 #ifdef _OSD_POSIX
1179 /*
1180 	   Initial Port for tcsh-6.07.04 by <Martin.Kraemer@Mch.SNI.De>
1181 
1182 "BS2000 OSD" is a POSIX on a main frame.
1183 It is made by Siemens Nixdorf AG, Germany.
1184 Within the POSIX subsystem, the same character set was chosen as in
1185 "native BS2000", namely EBCDIC.  Yes, tcsh now runs on EBCDIC platforms, too.
1186 
1187 EBCDIC Table. (Yes, in EBCDIC, the letters 'a'..'z' are not contiguous!)
1188 This table is bijective, i.e. there are no ambigous or duplicate characters
1189 00    00 01 02 03 85 09 86 7f  87 8d 8e 0b 0c 0d 0e 0f  * ................ *
1190 10    10 11 12 13 8f 0a 08 97  18 19 9c 9d 1c 1d 1e 1f  * ................ *
1191 20    80 81 82 83 84 92 17 1b  88 89 8a 8b 8c 05 06 07  * ................ *
1192 30    90 91 16 93 94 95 96 04  98 99 9a 9b 14 15 9e 1a  * ................ *
1193 40    20 a0 e2 e4 e0 e1 e3 e5  e7 f1 60 2e 3c 28 2b 7c  *  .........`.<(+| *
1194 50    26 e9 ea eb e8 ed ee ef  ec df 21 24 2a 29 3b 9f  * &.........!$*);. *
1195 60    2d 2f c2 c4 c0 c1 c3 c5  c7 d1 5e 2c 25 5f 3e 3f  * -/........^,%_>? *
1196 70    f8 c9 ca cb c8 cd ce cf  cc a8 3a 23 40 27 3d 22  * ..........:#@'=" *
1197 80    d8 61 62 63 64 65 66 67  68 69 ab bb f0 fd fe b1  * .abcdefghi...... *
1198 90    b0 6a 6b 6c 6d 6e 6f 70  71 72 aa ba e6 b8 c6 a4  * .jklmnopqr...... *
1199 a0    b5 af 73 74 75 76 77 78  79 7a a1 bf d0 dd de ae  * ..stuvwxyz...... *
1200 b0    a2 a3 a5 b7 a9 a7 b6 bc  bd be ac 5b 5c 5d b4 d7  * ...........[\].. *
1201 c0    f9 41 42 43 44 45 46 47  48 49 ad f4 f6 f2 f3 f5  * .ABCDEFGHI...... *
1202 d0    a6 4a 4b 4c 4d 4e 4f 50  51 52 b9 fb fc db fa ff  * .JKLMNOPQR...... *
1203 e0    d9 f7 53 54 55 56 57 58  59 5a b2 d4 d6 d2 d3 d5  * ..STUVWXYZ...... *
1204 f0    30 31 32 33 34 35 36 37  38 39 b3 7b dc 7d da 7e  * 0123456789.{.}.~ *
1205 */
1206 unsigned short _toascii[256] = {
1207 /*00*/ 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f,
1208        0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */
1209 /*10*/ 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97,
1210        0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */
1211 /*20*/ 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b,
1212        0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /* ................ */
1213 /*30*/ 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
1214        0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /* ................ */
1215 /*40*/ 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5,
1216        0xe7, 0xf1, 0x60, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* .........`.<(+|  */
1217 /*50*/ 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef,
1218        0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x9f, /* &.........!$*);. */
1219 /*60*/ 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5,
1220        0xc7, 0xd1, 0x5e, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /* -/........^,%_>? */
1221 /*70*/ 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf,
1222        0xcc, 0xa8, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /* ..........:#@'=" */
1223 /*80*/ 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
1224        0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /* .abcdefghi...... */
1225 /*90*/ 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
1226        0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /* .jklmnopqr...... */
1227 /*a0*/ 0xb5, 0xaf, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
1228        0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xde, 0xae, /* ..stuvwxyz...... */
1229 /*b0*/ 0xa2, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc,
1230        0xbd, 0xbe, 0xac, 0x5b, 0x5c, 0x5d, 0xb4, 0xd7, /* ...........[\].. */
1231 /*c0*/ 0xf9, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
1232        0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /* .ABCDEFGHI...... */
1233 /*d0*/ 0xa6, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
1234        0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xdb, 0xfa, 0xff, /* .JKLMNOPQR...... */
1235 /*e0*/ 0xd9, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
1236        0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /* ..STUVWXYZ...... */
1237 /*f0*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
1238        0x38, 0x39, 0xb3, 0x7b, 0xdc, 0x7d, 0xda, 0x7e  /* 0123456789.{.}.~ */
1239 };
1240 /* The same, for ascii-in-ebcdic
1241 00    00 01 02 03 37 2d 2e 2f  16 05 15 0b 0c 0d 0e 0f  * ................ *
1242 10    10 11 12 13 3c 3d 32 26  18 19 3f 27 1c 1d 1e 1f  * ................ *
1243 20    40 5a 7f 7b 5b 6c 50 7d  4d 5d 5c 4e 6b 60 4b 61  *  !"#$%&'()*+,-./ *
1244 30    f0 f1 f2 f3 f4 f5 f6 f7  f8 f9 7a 5e 4c 7e 6e 6f  * 0123456789:;<=>? *
1245 40    7c c1 c2 c3 c4 c5 c6 c7  c8 c9 d1 d2 d3 d4 d5 d6  * @ABCDEFGHIJKLMNO *
1246 50    d7 d8 d9 e2 e3 e4 e5 e6  e7 e8 e9 bb bc bd 6a 6d  * PQRSTUVWXYZ[\]^_ *
1247 60    4a 81 82 83 84 85 86 87  88 89 91 92 93 94 95 96  * `abcdefghijklmno *
1248 70    97 98 99 a2 a3 a4 a5 a6  a7 a8 a9 fb 4f fd ff 07  * pqrstuvwxyz{|}~. *
1249 80    20 21 22 23 24 04 06 08  28 29 2a 2b 2c 09 0a 14  * ................ *
1250 90    30 31 25 33 34 35 36 17  38 39 3a 3b 1a 1b 3e 5f  * ................ *
1251 a0    41 aa b0 b1 9f b2 d0 b5  79 b4 9a 8a ba ca af a1  * ................ *
1252 b0    90 8f ea fa be a0 b6 b3  9d da 9b 8b b7 b8 b9 ab  * ................ *
1253 c0    64 65 62 66 63 67 9e 68  74 71 72 73 78 75 76 77  * ................ *
1254 d0    ac 69 ed ee eb ef ec bf  80 e0 fe dd fc ad ae 59  * ................ *
1255 e0    44 45 42 46 43 47 9c 48  54 51 52 53 58 55 56 57  * ................ *
1256 f0    8c 49 cd ce cb cf cc e1  70 c0 de db dc 8d 8e df  * ................ *
1257 */
1258 unsigned short _toebcdic[256] = {
1259 /*00*/  0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
1260 	0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,  /* ................ */
1261 /*10*/  0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
1262 	0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,  /* ................ */
1263 /*20*/  0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
1264 	0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,  /*  !"#$%&'()*+,-./ */
1265 /*30*/  0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
1266 	0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f,  /* 0123456789:;<=>? */
1267 /*40*/  0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
1268 	0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,  /* @ABCDEFGHIJKLMNO */
1269 /*50*/  0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
1270 	0xe7, 0xe8, 0xe9, 0xbb, 0xbc, 0xbd, 0x6a, 0x6d,  /* PQRSTUVWXYZ[\]^_ */
1271 /*60*/  0x4a, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
1272 	0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,  /* `abcdefghijklmno */
1273 /*70*/  0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
1274 	0xa7, 0xa8, 0xa9, 0xfb, 0x4f, 0xfd, 0xff, 0x07,  /* pqrstuvwxyz{|}~. */
1275 /*80*/  0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08,
1276 	0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14,  /* ................ */
1277 /*90*/  0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17,
1278 	0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0x5f,  /* ................ */
1279 /*a0*/  0x41, 0xaa, 0xb0, 0xb1, 0x9f, 0xb2, 0xd0, 0xb5,
1280 	0x79, 0xb4, 0x9a, 0x8a, 0xba, 0xca, 0xaf, 0xa1,  /* ................ */
1281 /*b0*/  0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
1282 	0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab,  /* ................ */
1283 /*c0*/  0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
1284 	0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77,  /* ................ */
1285 /*d0*/  0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
1286 	0x80, 0xe0, 0xfe, 0xdd, 0xfc, 0xad, 0xae, 0x59,  /* ................ */
1287 /*e0*/  0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
1288 	0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57,  /* ................ */
1289 /*f0*/  0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
1290 	0x70, 0xc0, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf   /* ................ */
1291 };
1292 
1293 #endif /*_OSD_POSIX*/
1294 
1295 #ifdef __MVS__
1296 /*
1297    The IBM 1047 coded char set to/from ISO 8859-1 mapping differs from
1298    the POSIX-BC mapping in several places
1299  */
1300 unsigned short _toascii[256] = {
1301       0x00, 0x01, 0x02, 0x03, 0x9c, 0x09, 0x86, 0x7f,
1302       0x97, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1303       0x10, 0x11, 0x12, 0x13, 0x9d, 0x0a, 0x08, 0x87,
1304       0x18, 0x19, 0x92, 0x8f, 0x1c, 0x1d, 0x1e, 0x1f,
1305       0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x17, 0x1b,
1306       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07,
1307       0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
1308       0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a,
1309       0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5,
1310       0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c,
1311       0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef,
1312       0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e,
1313       0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5,
1314       0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f,
1315       0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf,
1316       0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22,
1317       0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
1318       0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1,
1319       0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
1320       0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4,
1321       0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
1322       0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0x5b, 0xde, 0xae,
1323       0xac, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc,
1324       0xbd, 0xbe, 0xdd, 0xa8, 0xaf, 0x5d, 0xb4, 0xd7,
1325       0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
1326       0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5,
1327       0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
1328       0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff,
1329       0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
1330       0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5,
1331       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
1332       0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f,
1333 };
1334 unsigned short _toebcdic[256] = {
1335       0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
1336       0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1337       0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
1338       0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,
1339       0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
1340       0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,
1341       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
1342       0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f,
1343       0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
1344       0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
1345       0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
1346       0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x5f, 0x6d,
1347       0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
1348       0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
1349       0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
1350       0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x07,
1351       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x06, 0x17,
1352       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x1b,
1353       0x30, 0x31, 0x1a, 0x33, 0x34, 0x35, 0x36, 0x08,
1354       0x38, 0x39, 0x3a, 0x3b, 0x04, 0x14, 0x3e, 0xff,
1355       0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5,
1356       0xbb, 0xb4, 0x9a, 0x8a, 0xb0, 0xca, 0xaf, 0xbc,
1357       0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
1358       0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab,
1359       0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
1360       0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77,
1361       0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
1362       0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xba, 0xae, 0x59,
1363       0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
1364       0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57,
1365       0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
1366       0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf
1367 };
1368 #endif /*__MVS__*/
1369