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