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