sh.char.c revision 69408
1178825Sdfr/* $Header: /src/pub/tcsh/sh.char.c,v 3.13 2000/06/11 02:14:13 kim Exp $ */
2178825Sdfr/*
3178825Sdfr * sh.char.c: Character classification tables
4178825Sdfr */
5178825Sdfr/*-
6178825Sdfr * Copyright (c) 1980, 1991 The Regents of the University of California.
7178825Sdfr * All rights reserved.
8178825Sdfr *
9178825Sdfr * Redistribution and use in source and binary forms, with or without
10178825Sdfr * modification, are permitted provided that the following conditions
11178825Sdfr * are met:
12178825Sdfr * 1. Redistributions of source code must retain the above copyright
13178825Sdfr *    notice, this list of conditions and the following disclaimer.
14178825Sdfr * 2. Redistributions in binary form must reproduce the above copyright
15178825Sdfr *    notice, this list of conditions and the following disclaimer in the
16178825Sdfr *    documentation and/or other materials provided with the distribution.
17178825Sdfr * 3. All advertising materials mentioning features or use of this software
18178825Sdfr *    must display the following acknowledgement:
19178825Sdfr *	This product includes software developed by the University of
20178825Sdfr *	California, Berkeley and its contributors.
21178825Sdfr * 4. Neither the name of the University nor the names of its contributors
22178825Sdfr *    may be used to endorse or promote products derived from this software
23178825Sdfr *    without specific prior written permission.
24178825Sdfr *
25178825Sdfr * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26178825Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27178825Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28178825Sdfr * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29178825Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30178825Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31178825Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32178825Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33178825Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34178825Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35233294Sstas * SUCH DAMAGE.
36178825Sdfr */
37178825Sdfr#include "sh.h"
38178825Sdfr
39178825SdfrRCSID("$Id: sh.char.c,v 3.13 2000/06/11 02:14:13 kim Exp $")
40178825Sdfr
41178825Sdfr#include "sh.char.h"
42178825Sdfr
43178825Sdfr#if defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE)
44178825Sdfr/* on default same as original map */
45178825Sdfrunsigned short _cmap[256] = {
46178825Sdfr/*	  0 nul		  1 soh		  2 stx		  3 etx	*/
47178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
48178825Sdfr
49178825Sdfr/*	  4 eot		  5 enq		  6 ack		  7 bel	*/
50178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
51178825Sdfr
52178825Sdfr/*	  8 bs		  9 ht		 10 nl		 11 vt	*/
53178825Sdfr	_CTR,		_CTR|_SP|_META,	_CTR|_NL|_META,	_CTR,
54178825Sdfr
55178825Sdfr/*	 12 np		 13 cr		 14 so		 15 si	*/
56178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
57178825Sdfr
58178825Sdfr/*	 16 dle		 17 dc1		 18 dc2		 19 dc3	*/
59178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
60178825Sdfr
61178825Sdfr/*	 20 dc4		 21 nak		 22 syn		 23 etb	*/
62178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
63178825Sdfr
64178825Sdfr/*	 24 can		 25 em		 26 sub		 27 esc	*/
65178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
66178825Sdfr
67178825Sdfr/*	 28 fs		 29 gs		 30 rs		 31 us	*/
68178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
69178825Sdfr
70178825Sdfr/*	 32 sp		 33 !		 34 "		 35 #	*/
71178825Sdfr	_SP|_META,	_PUN,		_QF|_PUN,	_META|_PUN,
72178825Sdfr
73178825Sdfr/*	 36 $		 37 %		 38 &		 39 '	*/
74178825Sdfr	_DOL|_PUN,	_PUN,		_META|_CMD|_PUN,_QF|_PUN,
75178825Sdfr
76178825Sdfr/*	 40 (		 41 )		 42 *		 43 +	*/
77178825Sdfr	_META|_CMD|_PUN,_META|_PUN,	_GLOB|_PUN,	_PUN,
78178825Sdfr
79178825Sdfr/*	 44 ,		 45 -		 46 .		 47 /	*/
80178825Sdfr	_PUN,		_PUN,		_PUN,		_PUN,
81178825Sdfr
82178825Sdfr/*	 48 0		 49 1		 50 2		 51 3	*/
83178825Sdfr	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,
84178825Sdfr
85178825Sdfr/*	 52 4		 53 5		 54 6		 55 7	*/
86178825Sdfr	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,
87178825Sdfr
88178825Sdfr/*	 56 8		 57 9		 58 :		 59 ;	*/
89178825Sdfr	_DIG|_XD,	_DIG|_XD,	_PUN,		_META|_CMD|_PUN,
90178825Sdfr
91178825Sdfr/*	 60 <		 61 =		 62 >		 63 ?	*/
92178825Sdfr	_META|_PUN,	_PUN,		_META|_PUN,	_GLOB|_PUN,
93178825Sdfr
94178825Sdfr/*	 64 @		 65 A		 66 B		 67 C	*/
95178825Sdfr	_PUN,		_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,
96178825Sdfr
97178825Sdfr/*	 68 D		 69 E		 70 F		 71 G	*/
98178825Sdfr	_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP,
99178825Sdfr
100178825Sdfr/*	 72 H		 73 I		 74 J		 75 K	*/
101178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
102178825Sdfr
103178825Sdfr/*	 76 L		 77 M		 78 N		 79 O	*/
104178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
105178825Sdfr
106178825Sdfr/*	 80 P		 81 Q		 82 R		 83 S	*/
107178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
108178825Sdfr
109178825Sdfr/*	 84 T		 85 U		 86 V		 87 W	*/
110178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
111178825Sdfr
112178825Sdfr/*	 88 X		 89 Y		 90 Z		 91 [	*/
113178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_GLOB|_PUN,
114178825Sdfr
115178825Sdfr/*	 92 \		 93 ]		 94 ^		 95 _	*/
116178825Sdfr	_ESC|_PUN,	_PUN,		_PUN,		_PUN,
117178825Sdfr
118178825Sdfr/*	 96 `		 97 a		 98 b		 99 c	*/
119178825Sdfr  _QB|_GLOB|_META|_PUN,	_LET|_DOW|_XD,	_LET|_DOW|_XD,	_LET|_DOW|_XD,
120178825Sdfr
121178825Sdfr/*	100 d		101 e		102 f		103 g	*/
122178825Sdfr	_LET|_DOW|_XD,	_LET|_DOW|_XD,	_LET|_DOW|_XD,	_LET|_DOW,
123178825Sdfr
124178825Sdfr/*	104 h		105 i		106 j		107 k	*/
125178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
126178825Sdfr
127178825Sdfr/*	108 l		109 m		110 n		111 o	*/
128178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
129178825Sdfr
130178825Sdfr/*	112 p		113 q		114 r		115 s	*/
131178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
132178825Sdfr
133178825Sdfr/*	116 t		117 u		118 v		119 w	*/
134178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
135178825Sdfr
136178825Sdfr/*	120 x		121 y		122 z		123 {	*/
137178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_GLOB|_PUN,
138178825Sdfr
139178825Sdfr/*	124 |		125 }		126 ~		127 del	*/
140178825Sdfr	_META|_CMD|_PUN,_PUN,		_PUN,		_CTR,
141178825Sdfr
142178825Sdfr/****************************************************************/
143178825Sdfr/* 128 - 255 The below is supposedly ISO 8859/1			*/
144178825Sdfr/****************************************************************/
145178825Sdfr/*	128 (undef)	129 (undef)	130 (undef)	131 (undef)	*/
146178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
147178825Sdfr
148178825Sdfr/*	132 (undef)	133 (undef)	134 (undef)	135 (undef)	*/
149178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
150178825Sdfr
151178825Sdfr/*	136 (undef)	137 (undef)	138 (undef)	139 (undef)	*/
152178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
153178825Sdfr
154178825Sdfr/*	140 (undef)	141 (undef)	142 (undef)	143 (undef)	*/
155178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
156178825Sdfr
157178825Sdfr/*	144 (undef)	145 (undef)	146 (undef)	147 (undef)	*/
158178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
159178825Sdfr
160178825Sdfr/*	148 (undef)	149 (undef)	150 (undef)	151 (undef)	*/
161178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
162178825Sdfr
163178825Sdfr/*	152 (undef)	153 (undef)	154 (undef)	155 (undef)	*/
164233294Sstas	_CTR,		_CTR,		_CTR,		_CTR,
165178825Sdfr
166178825Sdfr/*	156 (undef)	157 (undef)	158 (undef)	159 (undef)	*/
167178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
168178825Sdfr
169178825Sdfr/*	160 nobreakspace 161 exclamdown	162 cent	163 sterling	*/
170178825Sdfr	_PUN, /* XXX */	_PUN,		_PUN,		_PUN,
171178825Sdfr
172178825Sdfr/*	164 currency	165 yen		166 brokenbar	167 section	*/
173178825Sdfr	_PUN,		_PUN,		_PUN,		_PUN,
174178825Sdfr
175178825Sdfr/*	168 diaeresis	169 copyright	170 ordfeminine	171 guillemotleft*/
176178825Sdfr	_PUN,		_PUN,		_PUN,		_PUN,
177178825Sdfr
178178825Sdfr/*	172 notsign	173 hyphen	174 registered	175 macron	*/
179178825Sdfr	_PUN,		_PUN,		_PUN,		_PUN,
180178825Sdfr
181178825Sdfr/*	176 degree	177 plusminus	178 twosuperior	179 threesuperior*/
182178825Sdfr	_PUN,		_PUN,		_PUN,		_PUN,
183178825Sdfr
184178825Sdfr/*	180 acute	181 mu 		182 paragraph	183 periodcentered*/
185178825Sdfr	_PUN,		_PUN, /*XXX*/	_PUN,		_PUN,
186178825Sdfr
187178825Sdfr/*	184 cedilla	185 onesuperior	186 masculine	187 guillemotright*/
188178825Sdfr	_PUN,		_PUN,		_PUN,		_PUN,
189178825Sdfr
190178825Sdfr/*	188 onequarter	189 onehalf	190 threequarters 191 questiondown*/
191178825Sdfr	_PUN,		_PUN,		_PUN,		_PUN,
192178825Sdfr
193178825Sdfr/*	192 Agrave	193 Aacute	194 Acircumflex	195 Atilde	*/
194178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
195178825Sdfr
196178825Sdfr/*	196 Adiaeresis	197 Aring	198 AE		199 Ccedilla	*/
197178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
198178825Sdfr
199178825Sdfr/*	200 Egrave	201 Eacute	202 Ecircumflex	203 Ediaeresis	*/
200178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
201178825Sdfr
202178825Sdfr/*	204 Igrave	205 Iacute	206 Icircumflex	207 Idiaeresis	*/
203178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
204178825Sdfr
205178825Sdfr/*	208 ETH		209 Ntilde	210 Ograve	211 Oacute	*/
206178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
207178825Sdfr
208178825Sdfr/*	212 Ocircumflex	213 Otilde	214 Odiaeresis	215 multiply	*/
209233294Sstas	_LET|_UP,	_LET|_UP,	_LET|_UP,	_PUN,
210178825Sdfr
211178825Sdfr/*	216 Ooblique	217 Ugrave	218 Uacute	219 Ucircumflex	*/
212178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
213178825Sdfr
214178825Sdfr/*	220 Udiaeresis	221 Yacute	222 THORN	223 ssharp	*/
215178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_DOW,
216178825Sdfr
217178825Sdfr/*	224 agrave	225 aacute	226 acircumflex	227 atilde	*/
218178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
219178825Sdfr
220178825Sdfr/*	228 adiaeresis	229 aring	230 ae		231 ccedilla	*/
221178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
222178825Sdfr
223178825Sdfr/*	232 egrave	233 eacute	234 ecircumflex	235 ediaeresis	*/
224178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
225178825Sdfr
226178825Sdfr/*	236 igrave	237 iacute	238 icircumflex	239 idiaeresis	*/
227178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
228178825Sdfr
229178825Sdfr/*	240 eth		241 ntilde	242 ograve	243 oacute	*/
230178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
231178825Sdfr
232178825Sdfr/*	244 ocircumflex	245 otilde	246 odiaeresis	247 division	*/
233178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_PUN,
234178825Sdfr
235178825Sdfr/*	248 oslash	249 ugrave	250 uacute	251 ucircumflex	*/
236178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
237178825Sdfr
238178825Sdfr/*	252 udiaeresis	253 yacute	254 thorn	255 ydiaeresis	*/
239178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
240178825Sdfr};
241178825Sdfr/* original table */
242178825Sdfrunsigned short _cmap_c[256] = {
243178825Sdfr/*	  0 nul		  1 soh		  2 stx		  3 etx	*/
244178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
245178825Sdfr
246178825Sdfr/*	  4 eot		  5 enq		  6 ack		  7 bel	*/
247178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
248178825Sdfr
249178825Sdfr/*	  8 bs		  9 ht		 10 nl		 11 vt	*/
250178825Sdfr	_CTR,		_CTR|_SP|_META,	_CTR|_NL|_META,	_CTR,
251178825Sdfr
252178825Sdfr/*	 12 np		 13 cr		 14 so		 15 si	*/
253178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
254178825Sdfr
255178825Sdfr/*	 16 dle		 17 dc1		 18 dc2		 19 dc3	*/
256178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
257178825Sdfr
258178825Sdfr/*	 20 dc4		 21 nak		 22 syn		 23 etb	*/
259178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
260178825Sdfr
261178825Sdfr/*	 24 can		 25 em		 26 sub		 27 esc	*/
262178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
263178825Sdfr
264178825Sdfr/*	 28 fs		 29 gs		 30 rs		 31 us	*/
265178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
266178825Sdfr
267178825Sdfr/*	 32 sp		 33 !		 34 "		 35 #	*/
268178825Sdfr	_SP|_META,	_PUN,		_QF|_PUN,	_META|_PUN,
269178825Sdfr
270178825Sdfr/*	 36 $		 37 %		 38 &		 39 '	*/
271178825Sdfr	_DOL|_PUN,	_PUN,		_META|_CMD|_PUN,_QF|_PUN,
272178825Sdfr
273178825Sdfr/*	 40 (		 41 )		 42 *		 43 +	*/
274178825Sdfr	_META|_CMD|_PUN,_META|_PUN,	_GLOB|_PUN,	_PUN,
275178825Sdfr
276178825Sdfr/*	 44 ,		 45 -		 46 .		 47 /	*/
277178825Sdfr	_PUN,		_PUN,		_PUN,		_PUN,
278178825Sdfr
279178825Sdfr/*	 48 0		 49 1		 50 2		 51 3	*/
280178825Sdfr	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,
281178825Sdfr
282178825Sdfr/*	 52 4		 53 5		 54 6		 55 7	*/
283178825Sdfr	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,
284178825Sdfr
285178825Sdfr/*	 56 8		 57 9		 58 :		 59 ;	*/
286178825Sdfr	_DIG|_XD,	_DIG|_XD,	_PUN,		_META|_CMD|_PUN,
287178825Sdfr
288178825Sdfr/*	 60 <		 61 =		 62 >		 63 ?	*/
289178825Sdfr	_META|_PUN,	_PUN,		_META|_PUN,	_GLOB|_PUN,
290178825Sdfr
291178825Sdfr/*	 64 @		 65 A		 66 B		 67 C	*/
292178825Sdfr	_PUN,		_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,
293178825Sdfr
294178825Sdfr/*	 68 D		 69 E		 70 F		 71 G	*/
295178825Sdfr	_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP,
296178825Sdfr
297178825Sdfr/*	 72 H		 73 I		 74 J		 75 K	*/
298178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
299178825Sdfr
300178825Sdfr/*	 76 L		 77 M		 78 N		 79 O	*/
301178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
302178825Sdfr
303178825Sdfr/*	 80 P		 81 Q		 82 R		 83 S	*/
304178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
305178825Sdfr
306178825Sdfr/*	 84 T		 85 U		 86 V		 87 W	*/
307178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
308178825Sdfr
309178825Sdfr/*	 88 X		 89 Y		 90 Z		 91 [	*/
310178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_GLOB|_PUN,
311178825Sdfr
312178825Sdfr/*	 92 \		 93 ]		 94 ^		 95 _	*/
313178825Sdfr	_ESC|_PUN,	_PUN,		_PUN,		_PUN,
314178825Sdfr
315178825Sdfr/*	 96 `		 97 a		 98 b		 99 c	*/
316178825Sdfr  _QB|_GLOB|_META|_PUN,	_LET|_DOW|_XD,	_LET|_DOW|_XD,	_LET|_DOW|_XD,
317178825Sdfr
318178825Sdfr/*	100 d		101 e		102 f		103 g	*/
319178825Sdfr	_LET|_DOW|_XD,	_LET|_DOW|_XD,	_LET|_DOW|_XD,	_LET|_DOW,
320178825Sdfr
321178825Sdfr/*	104 h		105 i		106 j		107 k	*/
322178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
323178825Sdfr
324178825Sdfr/*	108 l		109 m		110 n		111 o	*/
325178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
326178825Sdfr
327178825Sdfr/*	112 p		113 q		114 r		115 s	*/
328178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
329178825Sdfr
330178825Sdfr/*	116 t		117 u		118 v		119 w	*/
331178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
332178825Sdfr
333178825Sdfr/*	120 x		121 y		122 z		123 {	*/
334178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_GLOB|_PUN,
335178825Sdfr
336178825Sdfr/*	124 |		125 }		126 ~		127 del	*/
337178825Sdfr	_META|_CMD|_PUN,_PUN,		_PUN,		_CTR,
338178825Sdfr
339178825Sdfr/****************************************************************/
340178825Sdfr/* 128 - 255 The below is supposedly ISO 8859/1			*/
341178825Sdfr/****************************************************************/
342178825Sdfr/*	128 (undef)	129 (undef)	130 (undef)	131 (undef)	*/
343178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
344178825Sdfr
345178825Sdfr/*	132 (undef)	133 (undef)	134 (undef)	135 (undef)	*/
346178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
347178825Sdfr
348178825Sdfr/*	136 (undef)	137 (undef)	138 (undef)	139 (undef)	*/
349178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
350178825Sdfr
351178825Sdfr/*	140 (undef)	141 (undef)	142 (undef)	143 (undef)	*/
352178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
353178825Sdfr
354178825Sdfr/*	144 (undef)	145 (undef)	146 (undef)	147 (undef)	*/
355178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
356233294Sstas
357178825Sdfr/*	148 (undef)	149 (undef)	150 (undef)	151 (undef)	*/
358178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
359178825Sdfr
360178825Sdfr/*	152 (undef)	153 (undef)	154 (undef)	155 (undef)	*/
361178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
362178825Sdfr
363178825Sdfr/*	156 (undef)	157 (undef)	158 (undef)	159 (undef)	*/
364178825Sdfr	_CTR,		_CTR,		_CTR,		_CTR,
365178825Sdfr
366178825Sdfr/*	160 nobreakspace 161 exclamdown	162 cent	163 sterling	*/
367178825Sdfr	_PUN, /* XXX */	_PUN,		_PUN,		_PUN,
368178825Sdfr
369178825Sdfr/*	164 currency	165 yen		166 brokenbar	167 section	*/
370178825Sdfr	_PUN,		_PUN,		_PUN,		_PUN,
371178825Sdfr
372178825Sdfr/*	168 diaeresis	169 copyright	170 ordfeminine	171 guillemotleft*/
373178825Sdfr	_PUN,		_PUN,		_PUN,		_PUN,
374178825Sdfr
375178825Sdfr/*	172 notsign	173 hyphen	174 registered	175 macron	*/
376178825Sdfr	_PUN,		_PUN,		_PUN,		_PUN,
377178825Sdfr
378178825Sdfr/*	176 degree	177 plusminus	178 twosuperior	179 threesuperior*/
379178825Sdfr	_PUN,		_PUN,		_PUN,		_PUN,
380178825Sdfr
381178825Sdfr/*	180 acute	181 mu 		182 paragraph	183 periodcentered*/
382178825Sdfr	_PUN,		_PUN, /*XXX*/	_PUN,		_PUN,
383178825Sdfr
384178825Sdfr/*	184 cedilla	185 onesuperior	186 masculine	187 guillemotright*/
385178825Sdfr	_PUN,		_PUN,		_PUN,		_PUN,
386178825Sdfr
387178825Sdfr/*	188 onequarter	189 onehalf	190 threequarters 191 questiondown*/
388178825Sdfr	_PUN,		_PUN,		_PUN,		_PUN,
389178825Sdfr
390178825Sdfr/*	192 Agrave	193 Aacute	194 Acircumflex	195 Atilde	*/
391178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
392178825Sdfr
393178825Sdfr/*	196 Adiaeresis	197 Aring	198 AE		199 Ccedilla	*/
394178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
395178825Sdfr
396178825Sdfr/*	200 Egrave	201 Eacute	202 Ecircumflex	203 Ediaeresis	*/
397233294Sstas	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
398178825Sdfr
399178825Sdfr/*	204 Igrave	205 Iacute	206 Icircumflex	207 Idiaeresis	*/
400178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
401178825Sdfr
402178825Sdfr/*	208 ETH		209 Ntilde	210 Ograve	211 Oacute	*/
403178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
404178825Sdfr
405178825Sdfr/*	212 Ocircumflex	213 Otilde	214 Odiaeresis	215 multiply	*/
406178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_PUN,
407178825Sdfr
408178825Sdfr/*	216 Ooblique	217 Ugrave	218 Uacute	219 Ucircumflex	*/
409178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
410178825Sdfr
411178825Sdfr/*	220 Udiaeresis	221 Yacute	222 THORN	223 ssharp	*/
412178825Sdfr	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_DOW,
413178825Sdfr
414178825Sdfr/*	224 agrave	225 aacute	226 acircumflex	227 atilde	*/
415178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
416178825Sdfr
417178825Sdfr/*	228 adiaeresis	229 aring	230 ae		231 ccedilla	*/
418178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
419178825Sdfr
420178825Sdfr/*	232 egrave	233 eacute	234 ecircumflex	235 ediaeresis	*/
421178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
422178825Sdfr
423178825Sdfr/*	236 igrave	237 iacute	238 icircumflex	239 idiaeresis	*/
424178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
425178825Sdfr
426178825Sdfr/*	240 eth		241 ntilde	242 ograve	243 oacute	*/
427178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
428178825Sdfr
429178825Sdfr/*	244 ocircumflex	245 otilde	246 odiaeresis	247 division	*/
430178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_PUN,
431178825Sdfr
432178825Sdfr/*	248 oslash	249 ugrave	250 uacute	251 ucircumflex	*/
433178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
434178825Sdfr
435178825Sdfr/*	252 udiaeresis	253 yacute	254 thorn	255 ydiaeresis	*/
436178825Sdfr	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
437178825Sdfr};
438178825Sdfr
439178825Sdfr/* multi-byte table */
440/* BY Masaaki Koyanagi VERY THANKS */
441unsigned 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
638short _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()) */
642unsigned short _mbmap[256];
643
644unsigned 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
712unsigned 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#else /* !(defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE)) */
817unsigned short _cmap[256] = {
818/*	  0 nul		  1 soh		  2 stx		  3 etx	*/
819	_CTR,		_CTR,		_CTR,		_CTR,
820
821/*	  4 eot		  5 enq		  6 ack		  7 bel	*/
822	_CTR,		_CTR,		_CTR,		_CTR,
823
824/*	  8 bs		  9 ht		 10 nl		 11 vt	*/
825	_CTR,		_CTR|_SP|_META,	_CTR|_NL|_META,	_CTR,
826
827/*	 12 np		 13 cr		 14 so		 15 si	*/
828	_CTR,		_CTR,		_CTR,		_CTR,
829
830/*	 16 dle		 17 dc1		 18 dc2		 19 dc3	*/
831	_CTR,		_CTR,		_CTR,		_CTR,
832
833/*	 20 dc4		 21 nak		 22 syn		 23 etb	*/
834	_CTR,		_CTR,		_CTR,		_CTR,
835
836/*	 24 can		 25 em		 26 sub		 27 esc	*/
837	_CTR,		_CTR,		_CTR,		_CTR,
838
839/*	 28 fs		 29 gs		 30 rs		 31 us	*/
840	_CTR,		_CTR,		_CTR,		_CTR,
841
842/*	 32 sp		 33 !		 34 "		 35 #	*/
843	_SP|_META,	_PUN,		_QF|_PUN,	_META|_PUN,
844
845/*	 36 $		 37 %		 38 &		 39 '	*/
846	_DOL|_PUN,	_PUN,		_META|_CMD|_PUN,_QF|_PUN,
847
848/*	 40 (		 41 )		 42 *		 43 +	*/
849	_META|_CMD|_PUN,_META|_PUN,	_GLOB|_PUN,	_PUN,
850
851/*	 44 ,		 45 -		 46 .		 47 /	*/
852	_PUN,		_PUN,		_PUN,		_PUN,
853
854/*	 48 0		 49 1		 50 2		 51 3	*/
855	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,
856
857/*	 52 4		 53 5		 54 6		 55 7	*/
858	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,
859
860/*	 56 8		 57 9		 58 :		 59 ;	*/
861	_DIG|_XD,	_DIG|_XD,	_PUN,		_META|_CMD|_PUN,
862
863/*	 60 <		 61 =		 62 >		 63 ?	*/
864	_META|_PUN,	_PUN,		_META|_PUN,	_GLOB|_PUN,
865
866/*	 64 @		 65 A		 66 B		 67 C	*/
867	_PUN,		_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,
868
869/*	 68 D		 69 E		 70 F		 71 G	*/
870	_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP,
871
872/*	 72 H		 73 I		 74 J		 75 K	*/
873	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
874
875/*	 76 L		 77 M		 78 N		 79 O	*/
876	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
877
878/*	 80 P		 81 Q		 82 R		 83 S	*/
879	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
880
881/*	 84 T		 85 U		 86 V		 87 W	*/
882	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
883
884/*	 88 X		 89 Y		 90 Z		 91 [	*/
885	_LET|_UP,	_LET|_UP,	_LET|_UP,	_GLOB|_PUN,
886
887/*	 92 \		 93 ]		 94 ^		 95 _	*/
888	_ESC|_PUN,	_PUN,		_PUN,		_PUN,
889
890/*	 96 `		 97 a		 98 b		 99 c	*/
891  _QB|_GLOB|_META|_PUN,	_LET|_DOW|_XD,	_LET|_DOW|_XD,	_LET|_DOW|_XD,
892
893/*	100 d		101 e		102 f		103 g	*/
894	_LET|_DOW|_XD,	_LET|_DOW|_XD,	_LET|_DOW|_XD,	_LET|_DOW,
895
896/*	104 h		105 i		106 j		107 k	*/
897	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
898
899/*	108 l		109 m		110 n		111 o	*/
900	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
901
902/*	112 p		113 q		114 r		115 s	*/
903	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
904
905/*	116 t		117 u		118 v		119 w	*/
906	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
907
908/*	120 x		121 y		122 z		123 {	*/
909	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_GLOB|_PUN,
910
911/*	124 |		125 }		126 ~		127 del	*/
912	_META|_CMD|_PUN,_PUN,		_PUN,		_CTR,
913
914#ifdef SHORT_STRINGS
915/****************************************************************/
916/* 128 - 255 The below is supposedly ISO 8859/1			*/
917/****************************************************************/
918/*	128 (undef)	129 (undef)	130 (undef)	131 (undef)	*/
919	_CTR,		_CTR,		_CTR,		_CTR,
920
921/*	132 (undef)	133 (undef)	134 (undef)	135 (undef)	*/
922	_CTR,		_CTR,		_CTR,		_CTR,
923
924/*	136 (undef)	137 (undef)	138 (undef)	139 (undef)	*/
925	_CTR,		_CTR,		_CTR,		_CTR,
926
927/*	140 (undef)	141 (undef)	142 (undef)	143 (undef)	*/
928	_CTR,		_CTR,		_CTR,		_CTR,
929
930/*	144 (undef)	145 (undef)	146 (undef)	147 (undef)	*/
931	_CTR,		_CTR,		_CTR,		_CTR,
932
933/*	148 (undef)	149 (undef)	150 (undef)	151 (undef)	*/
934	_CTR,		_CTR,		_CTR,		_CTR,
935
936/*	152 (undef)	153 (undef)	154 (undef)	155 (undef)	*/
937	_CTR,		_CTR,		_CTR,		_CTR,
938
939/*	156 (undef)	157 (undef)	158 (undef)	159 (undef)	*/
940	_CTR,		_CTR,		_CTR,		_CTR,
941
942/*	160 nobreakspace 161 exclamdown	162 cent	163 sterling	*/
943	_PUN, /* XXX */	_PUN,		_PUN,		_PUN,
944
945/*	164 currency	165 yen		166 brokenbar	167 section	*/
946	_PUN,		_PUN,		_PUN,		_PUN,
947
948/*	168 diaeresis	169 copyright	170 ordfeminine	171 guillemotleft*/
949	_PUN,		_PUN,		_PUN,		_PUN,
950
951/*	172 notsign	173 hyphen	174 registered	175 macron	*/
952	_PUN,		_PUN,		_PUN,		_PUN,
953
954/*	176 degree	177 plusminus	178 twosuperior	179 threesuperior*/
955	_PUN,		_PUN,		_PUN,		_PUN,
956
957/*	180 acute	181 mu 		182 paragraph	183 periodcentered*/
958	_PUN,		_PUN, /*XXX*/	_PUN,		_PUN,
959
960/*	184 cedilla	185 onesuperior	186 masculine	187 guillemotright*/
961	_PUN,		_PUN,		_PUN,		_PUN,
962
963/*	188 onequarter	189 onehalf	190 threequarters 191 questiondown*/
964	_PUN,		_PUN,		_PUN,		_PUN,
965
966/*	192 Agrave	193 Aacute	194 Acircumflex	195 Atilde	*/
967	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
968
969/*	196 Adiaeresis	197 Aring	198 AE		199 Ccedilla	*/
970	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
971
972/*	200 Egrave	201 Eacute	202 Ecircumflex	203 Ediaeresis	*/
973	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
974
975/*	204 Igrave	205 Iacute	206 Icircumflex	207 Idiaeresis	*/
976	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
977
978/*	208 ETH		209 Ntilde	210 Ograve	211 Oacute	*/
979	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
980
981/*	212 Ocircumflex	213 Otilde	214 Odiaeresis	215 multiply	*/
982	_LET|_UP,	_LET|_UP,	_LET|_UP,	_PUN,
983
984/*	216 Ooblique	217 Ugrave	218 Uacute	219 Ucircumflex	*/
985	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
986
987/*	220 Udiaeresis	221 Yacute	222 THORN	223 ssharp	*/
988	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_DOW,
989
990/*	224 agrave	225 aacute	226 acircumflex	227 atilde	*/
991	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
992
993/*	228 adiaeresis	229 aring	230 ae		231 ccedilla	*/
994	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
995
996/*	232 egrave	233 eacute	234 ecircumflex	235 ediaeresis	*/
997	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
998
999/*	236 igrave	237 iacute	238 icircumflex	239 idiaeresis	*/
1000	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
1001
1002/*	240 eth		241 ntilde	242 ograve	243 oacute	*/
1003	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
1004
1005/*	244 ocircumflex	245 otilde	246 odiaeresis	247 division	*/
1006	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_PUN,
1007
1008/*	248 oslash	249 ugrave	250 uacute	251 ucircumflex	*/
1009	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
1010
1011/*	252 udiaeresis	253 yacute	254 thorn	255 ydiaeresis	*/
1012	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,	_LET|_DOW,
1013#endif /* SHORT_STRINGS */
1014};
1015#endif /* defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE) */
1016
1017#ifndef NLS
1018/* _cmap_lower, _cmap_upper for ISO 8859/1 */
1019
1020unsigned char _cmap_lower[256] = {
1021	0000,	0001,	0002,	0003,	0004,	0005,	0006,	0007,
1022	0010,	0011,	0012,	0013,	0014,	0015,	0016,	0017,
1023	0020,	0021,	0022,	0023,	0024,	0025,	0026,	0027,
1024	0030,	0031,	0032,	0033,	0034,	0035,	0036,	0037,
1025	0040,	0041,	0042,	0043,	0044,	0045,	0046,	0047,
1026	0050,	0051,	0052,	0053,	0054,	0055,	0056,	0057,
1027	0060,	0061,	0062,	0063,	0064,	0065,	0066,	0067,
1028	0070,	0071,	0072,	0073,	0074,	0075,	0076,	0077,
1029	0100,	0141,	0142,	0143,	0144,	0145,	0146,	0147,
1030	0150,	0151,	0152,	0153,	0154,	0155,	0156,	0157,
1031	0160,	0161,	0162,	0163,	0164,	0165,	0166,	0167,
1032	0170,	0171,	0172,	0133,	0134,	0135,	0136,	0137,
1033	0140,	0141,	0142,	0143,	0144,	0145,	0146,	0147,
1034	0150,	0151,	0152,	0153,	0154,	0155,	0156,	0157,
1035	0160,	0161,	0162,	0163,	0164,	0165,	0166,	0167,
1036	0170,	0171,	0172,	0173,	0174,	0175,	0176,	0177,
1037	0200,	0201,	0202,	0203,	0204,	0205,	0206,	0207,
1038	0210,	0211,	0212,	0213,	0214,	0215,	0216,	0217,
1039	0220,	0221,	0222,	0223,	0224,	0225,	0226,	0227,
1040	0230,	0231,	0232,	0233,	0234,	0235,	0236,	0237,
1041	0240,	0241,	0242,	0243,	0244,	0245,	0246,	0247,
1042	0250,	0251,	0252,	0253,	0254,	0255,	0256,	0257,
1043	0260,	0261,	0262,	0263,	0264,	0265,	0266,	0267,
1044	0270,	0271,	0272,	0273,	0274,	0275,	0276,	0277,
1045	0340,	0341,	0342,	0343,	0344,	0345,	0346,	0347,
1046	0350,	0351,	0352,	0353,	0354,	0355,	0356,	0357,
1047	0360,	0361,	0362,	0363,	0364,	0365,	0366,	0327,
1048	0370,	0371,	0372,	0373,	0374,	0375,	0376,	0337,
1049	0340,	0341,	0342,	0343,	0344,	0345,	0346,	0347,
1050	0350,	0351,	0352,	0353,	0354,	0355,	0356,	0357,
1051	0360,	0361,	0362,	0363,	0364,	0365,	0366,	0367,
1052	0370,	0371,	0372,	0373,	0374,	0375,	0376,	0377,
1053};
1054
1055unsigned char _cmap_upper[256] = {
1056	0000,	0001,	0002,	0003,	0004,	0005,	0006,	0007,
1057	0010,	0011,	0012,	0013,	0014,	0015,	0016,	0017,
1058	0020,	0021,	0022,	0023,	0024,	0025,	0026,	0027,
1059	0030,	0031,	0032,	0033,	0034,	0035,	0036,	0037,
1060	0040,	0041,	0042,	0043,	0044,	0045,	0046,	0047,
1061	0050,	0051,	0052,	0053,	0054,	0055,	0056,	0057,
1062	0060,	0061,	0062,	0063,	0064,	0065,	0066,	0067,
1063	0070,	0071,	0072,	0073,	0074,	0075,	0076,	0077,
1064	0100,	0101,	0102,	0103,	0104,	0105,	0106,	0107,
1065	0110,	0111,	0112,	0113,	0114,	0115,	0116,	0117,
1066	0120,	0121,	0122,	0123,	0124,	0125,	0126,	0127,
1067	0130,	0131,	0132,	0133,	0134,	0135,	0136,	0137,
1068	0140,	0101,	0102,	0103,	0104,	0105,	0106,	0107,
1069	0110,	0111,	0112,	0113,	0114,	0115,	0116,	0117,
1070	0120,	0121,	0122,	0123,	0124,	0125,	0126,	0127,
1071	0130,	0131,	0132,	0173,	0174,	0175,	0176,	0177,
1072	0200,	0201,	0202,	0203,	0204,	0205,	0206,	0207,
1073	0210,	0211,	0212,	0213,	0214,	0215,	0216,	0217,
1074	0220,	0221,	0222,	0223,	0224,	0225,	0226,	0227,
1075	0230,	0231,	0232,	0233,	0234,	0235,	0236,	0237,
1076	0240,	0241,	0242,	0243,	0244,	0245,	0246,	0247,
1077	0250,	0251,	0252,	0253,	0254,	0255,	0256,	0257,
1078	0260,	0261,	0262,	0263,	0264,	0265,	0266,	0267,
1079	0270,	0271,	0272,	0273,	0274,	0275,	0276,	0277,
1080	0300,	0301,	0302,	0303,	0304,	0305,	0306,	0307,
1081	0310,	0311,	0312,	0313,	0314,	0315,	0316,	0317,
1082	0320,	0321,	0322,	0323,	0324,	0325,	0326,	0327,
1083	0330,	0331,	0332,	0333,	0334,	0335,	0336,	0337,
1084	0300,	0301,	0302,	0303,	0304,	0305,	0306,	0307,
1085	0310,	0311,	0312,	0313,	0314,	0315,	0316,	0317,
1086	0320,	0321,	0322,	0323,	0324,	0325,	0326,	0367,
1087	0330,	0331,	0332,	0333,	0334,	0335,	0336,	0377,
1088};
1089#endif /* NLS */
1090
1091#ifdef _OSD_POSIX
1092/*
1093	   Initial Port for tcsh-6.07.04 by <Martin.Kraemer@Mch.SNI.De>
1094
1095"BS2000 OSD" is a POSIX on a main frame.
1096It is made by Siemens Nixdorf AG, Germany.
1097Within the POSIX subsystem, the same character set was chosen as in
1098"native BS2000", namely EBCDIC.  Yes, tcsh now runs on EBCDIC platforms, too.
1099
1100EBCDIC Table. (Yes, in EBCDIC, the letters 'a'..'z' are not contiguous!)
1101This table is bijective, i.e. there are no ambigous or duplicate characters
110200    00 01 02 03 85 09 86 7f  87 8d 8e 0b 0c 0d 0e 0f  * ................ *
110310    10 11 12 13 8f 0a 08 97  18 19 9c 9d 1c 1d 1e 1f  * ................ *
110420    80 81 82 83 84 92 17 1b  88 89 8a 8b 8c 05 06 07  * ................ *
110530    90 91 16 93 94 95 96 04  98 99 9a 9b 14 15 9e 1a  * ................ *
110640    20 a0 e2 e4 e0 e1 e3 e5  e7 f1 60 2e 3c 28 2b 7c  *  .........`.<(+| *
110750    26 e9 ea eb e8 ed ee ef  ec df 21 24 2a 29 3b 9f  * &.........!$*);. *
110860    2d 2f c2 c4 c0 c1 c3 c5  c7 d1 5e 2c 25 5f 3e 3f  * -/........^,%_>? *
110970    f8 c9 ca cb c8 cd ce cf  cc a8 3a 23 40 27 3d 22  * ..........:#@'=" *
111080    d8 61 62 63 64 65 66 67  68 69 ab bb f0 fd fe b1  * .abcdefghi...... *
111190    b0 6a 6b 6c 6d 6e 6f 70  71 72 aa ba e6 b8 c6 a4  * .jklmnopqr...... *
1112a0    b5 af 73 74 75 76 77 78  79 7a a1 bf d0 dd de ae  * ..stuvwxyz...... *
1113b0    a2 a3 a5 b7 a9 a7 b6 bc  bd be ac 5b 5c 5d b4 d7  * ...........[\].. *
1114c0    f9 41 42 43 44 45 46 47  48 49 ad f4 f6 f2 f3 f5  * .ABCDEFGHI...... *
1115d0    a6 4a 4b 4c 4d 4e 4f 50  51 52 b9 fb fc db fa ff  * .JKLMNOPQR...... *
1116e0    d9 f7 53 54 55 56 57 58  59 5a b2 d4 d6 d2 d3 d5  * ..STUVWXYZ...... *
1117f0    30 31 32 33 34 35 36 37  38 39 b3 7b dc 7d da 7e  * 0123456789.{.}.~ *
1118*/
1119unsigned short _toascii[256] = {
1120/*00*/ 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f,
1121       0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */
1122/*10*/ 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97,
1123       0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */
1124/*20*/ 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b,
1125       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /* ................ */
1126/*30*/ 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
1127       0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /* ................ */
1128/*40*/ 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5,
1129       0xe7, 0xf1, 0x60, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* .........`.<(+|  */
1130/*50*/ 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef,
1131       0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x9f, /* &.........!$*);. */
1132/*60*/ 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5,
1133       0xc7, 0xd1, 0x5e, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /* -/........^,%_>? */
1134/*70*/ 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf,
1135       0xcc, 0xa8, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /* ..........:#@'=" */
1136/*80*/ 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
1137       0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /* .abcdefghi...... */
1138/*90*/ 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
1139       0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /* .jklmnopqr...... */
1140/*a0*/ 0xb5, 0xaf, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
1141       0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xde, 0xae, /* ..stuvwxyz...... */
1142/*b0*/ 0xa2, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc,
1143       0xbd, 0xbe, 0xac, 0x5b, 0x5c, 0x5d, 0xb4, 0xd7, /* ...........[\].. */
1144/*c0*/ 0xf9, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
1145       0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /* .ABCDEFGHI...... */
1146/*d0*/ 0xa6, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
1147       0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xdb, 0xfa, 0xff, /* .JKLMNOPQR...... */
1148/*e0*/ 0xd9, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
1149       0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /* ..STUVWXYZ...... */
1150/*f0*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
1151       0x38, 0x39, 0xb3, 0x7b, 0xdc, 0x7d, 0xda, 0x7e  /* 0123456789.{.}.~ */
1152};
1153/* The same, for ascii-in-ebcdic
115400    00 01 02 03 37 2d 2e 2f  16 05 15 0b 0c 0d 0e 0f  * ................ *
115510    10 11 12 13 3c 3d 32 26  18 19 3f 27 1c 1d 1e 1f  * ................ *
115620    40 5a 7f 7b 5b 6c 50 7d  4d 5d 5c 4e 6b 60 4b 61  *  !"#$%&'()*+,-./ *
115730    f0 f1 f2 f3 f4 f5 f6 f7  f8 f9 7a 5e 4c 7e 6e 6f  * 0123456789:;<=>? *
115840    7c c1 c2 c3 c4 c5 c6 c7  c8 c9 d1 d2 d3 d4 d5 d6  * @ABCDEFGHIJKLMNO *
115950    d7 d8 d9 e2 e3 e4 e5 e6  e7 e8 e9 bb bc bd 6a 6d  * PQRSTUVWXYZ[\]^_ *
116060    4a 81 82 83 84 85 86 87  88 89 91 92 93 94 95 96  * `abcdefghijklmno *
116170    97 98 99 a2 a3 a4 a5 a6  a7 a8 a9 fb 4f fd ff 07  * pqrstuvwxyz{|}~. *
116280    20 21 22 23 24 04 06 08  28 29 2a 2b 2c 09 0a 14  * ................ *
116390    30 31 25 33 34 35 36 17  38 39 3a 3b 1a 1b 3e 5f  * ................ *
1164a0    41 aa b0 b1 9f b2 d0 b5  79 b4 9a 8a ba ca af a1  * ................ *
1165b0    90 8f ea fa be a0 b6 b3  9d da 9b 8b b7 b8 b9 ab  * ................ *
1166c0    64 65 62 66 63 67 9e 68  74 71 72 73 78 75 76 77  * ................ *
1167d0    ac 69 ed ee eb ef ec bf  80 e0 fe dd fc ad ae 59  * ................ *
1168e0    44 45 42 46 43 47 9c 48  54 51 52 53 58 55 56 57  * ................ *
1169f0    8c 49 cd ce cb cf cc e1  70 c0 de db dc 8d 8e df  * ................ *
1170*/
1171unsigned short _toebcdic[256] = {
1172/*00*/  0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
1173	0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,  /* ................ */
1174/*10*/  0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
1175	0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,  /* ................ */
1176/*20*/  0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
1177	0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,  /*  !"#$%&'()*+,-./ */
1178/*30*/  0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
1179	0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f,  /* 0123456789:;<=>? */
1180/*40*/  0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
1181	0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,  /* @ABCDEFGHIJKLMNO */
1182/*50*/  0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
1183	0xe7, 0xe8, 0xe9, 0xbb, 0xbc, 0xbd, 0x6a, 0x6d,  /* PQRSTUVWXYZ[\]^_ */
1184/*60*/  0x4a, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
1185	0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,  /* `abcdefghijklmno */
1186/*70*/  0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
1187	0xa7, 0xa8, 0xa9, 0xfb, 0x4f, 0xfd, 0xff, 0x07,  /* pqrstuvwxyz{|}~. */
1188/*80*/  0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08,
1189	0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14,  /* ................ */
1190/*90*/  0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17,
1191	0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0x5f,  /* ................ */
1192/*a0*/  0x41, 0xaa, 0xb0, 0xb1, 0x9f, 0xb2, 0xd0, 0xb5,
1193	0x79, 0xb4, 0x9a, 0x8a, 0xba, 0xca, 0xaf, 0xa1,  /* ................ */
1194/*b0*/  0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
1195	0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab,  /* ................ */
1196/*c0*/  0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
1197	0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77,  /* ................ */
1198/*d0*/  0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
1199	0x80, 0xe0, 0xfe, 0xdd, 0xfc, 0xad, 0xae, 0x59,  /* ................ */
1200/*e0*/  0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
1201	0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57,  /* ................ */
1202/*f0*/  0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
1203	0x70, 0xc0, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf   /* ................ */
1204};
1205
1206#endif /*_OSD_POSIX*/
1207
1208#ifdef __MVS__
1209/*
1210   The IBM 1047 coded char set to/from ISO 8859-1 mapping differs from
1211   the POSIX-BC mapping in several places
1212 */
1213unsigned short _toascii[256] = {
1214      0x00, 0x01, 0x02, 0x03, 0x9c, 0x09, 0x86, 0x7f,
1215      0x97, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1216      0x10, 0x11, 0x12, 0x13, 0x9d, 0x0a, 0x08, 0x87,
1217      0x18, 0x19, 0x92, 0x8f, 0x1c, 0x1d, 0x1e, 0x1f,
1218      0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x17, 0x1b,
1219      0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07,
1220      0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
1221      0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a,
1222      0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5,
1223      0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c,
1224      0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef,
1225      0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e,
1226      0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5,
1227      0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f,
1228      0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf,
1229      0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22,
1230      0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
1231      0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1,
1232      0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
1233      0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4,
1234      0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
1235      0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0x5b, 0xde, 0xae,
1236      0xac, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc,
1237      0xbd, 0xbe, 0xdd, 0xa8, 0xaf, 0x5d, 0xb4, 0xd7,
1238      0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
1239      0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5,
1240      0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
1241      0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff,
1242      0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
1243      0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5,
1244      0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
1245      0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f,
1246};
1247unsigned short _toebcdic[256] = {
1248      0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
1249      0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1250      0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
1251      0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,
1252      0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
1253      0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,
1254      0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
1255      0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f,
1256      0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
1257      0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
1258      0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
1259      0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x5f, 0x6d,
1260      0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
1261      0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
1262      0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
1263      0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x07,
1264      0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x06, 0x17,
1265      0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x1b,
1266      0x30, 0x31, 0x1a, 0x33, 0x34, 0x35, 0x36, 0x08,
1267      0x38, 0x39, 0x3a, 0x3b, 0x04, 0x14, 0x3e, 0xff,
1268      0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5,
1269      0xbb, 0xb4, 0x9a, 0x8a, 0xb0, 0xca, 0xaf, 0xbc,
1270      0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
1271      0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab,
1272      0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
1273      0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77,
1274      0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
1275      0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xba, 0xae, 0x59,
1276      0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
1277      0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57,
1278      0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
1279      0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf
1280};
1281#endif /*__MVS__*/
1282