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