xref: /titanic_44/usr/src/lib/libast/common/string/ccmap.c (revision 0bb073995ac5a95bd35f2dd790df1ea3d8c2d507)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *           Copyright (c) 1985-2007 AT&T Knowledge Ventures            *
5 *                      and is licensed under the                       *
6 *                  Common Public License, Version 1.0                  *
7 *                      by AT&T Knowledge Ventures                      *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *            http://www.opensource.org/licenses/cpl1.0.txt             *
11 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
12 *                                                                      *
13 *              Information and Software Systems Research               *
14 *                            AT&T Research                             *
15 *                           Florham Park NJ                            *
16 *                                                                      *
17 *                 Glenn Fowler <gsf@research.att.com>                  *
18 *                  David Korn <dgk@research.att.com>                   *
19 *                   Phong Vo <kpv@research.att.com>                    *
20 *                                                                      *
21 ***********************************************************************/
22 #pragma prototyped
23 
24 /*
25  * Glenn Fowler
26  * AT&T Research
27  *
28  * dynamic single byte character code maps
29  */
30 
31 #include <ast.h>
32 #include <ccode.h>
33 
34 #if !GENERATE
35 
36 /*
37  * catenated CC_ASCII to CC_* character code map table
38  * order determined by CC_* index definitions
39  * old definition values/indices must not change!
40  * each table is followed by its inverse
41  */
42 
43 static const unsigned char tab[] =
44 {
45 
46  /* ascii => ascii */
47 
48  0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
49  0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
50  0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
51  0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
52  0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
53  0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
54  0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
55  0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
56  0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
57  0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
58  0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
59  0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
60  0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
61  0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
62  0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
63  0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
64  0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
65  0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
66  0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
67  0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
68  0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
69  0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
70  0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
71  0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
72  0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
73  0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
74  0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
75  0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
76  0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
77  0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
78  0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
79  0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
80 
81  /* ascii => ascii */
82 
83  0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
84  0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
85  0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
86  0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
87  0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
88  0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
89  0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
90  0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
91  0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
92  0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
93  0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
94  0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
95  0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
96  0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
97  0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
98  0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
99  0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
100  0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
101  0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
102  0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
103  0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
104  0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
105  0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
106  0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
107  0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
108  0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
109  0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
110  0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
111  0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
112  0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
113  0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
114  0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
115 
116  /* ascii => ebcdic */
117 
118  0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
119  0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
120  0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
121  0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,
122  0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
123  0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,
124  0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
125  0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f,
126  0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
127  0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
128  0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
129  0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x9a, 0x6d,
130  0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
131  0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
132  0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
133  0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0x5f, 0x07,
134  0x20, 0x21, 0x22, 0x23, 0x24, 0x15, 0x06, 0x17,
135  0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x1b,
136  0x30, 0x31, 0x1a, 0x33, 0x34, 0x35, 0x36, 0x08,
137  0x38, 0x39, 0x3a, 0x3b, 0x04, 0x14, 0x3e, 0xe1,
138  0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
139  0x49, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
140  0x58, 0x59, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
141  0x68, 0x69, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75,
142  0x76, 0x77, 0x78, 0x80, 0x8a, 0x8b, 0x8c, 0x8d,
143  0x8e, 0x8f, 0x90, 0x6a, 0x9b, 0x9c, 0x9d, 0x9e,
144  0x9f, 0xa0, 0xaa, 0xab, 0xac, 0x4a, 0xae, 0xaf,
145  0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
146  0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xa1, 0xbe, 0xbf,
147  0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xda, 0xdb,
148  0xdc, 0xdd, 0xde, 0xdf, 0xea, 0xeb, 0xec, 0xed,
149  0xee, 0xef, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
150 
151  /* ebcdic => ascii */
152 
153  0x00, 0x01, 0x02, 0x03, 0x9c, 0x09, 0x86, 0x7f,
154  0x97, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
155  0x10, 0x11, 0x12, 0x13, 0x9d, 0x85, 0x08, 0x87,
156  0x18, 0x19, 0x92, 0x8f, 0x1c, 0x1d, 0x1e, 0x1f,
157  0x80, 0x81, 0x82, 0x83, 0x84, 0x0a, 0x17, 0x1b,
158  0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07,
159  0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
160  0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a,
161  0x20, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
162  0xa7, 0xa8, 0xd5, 0x2e, 0x3c, 0x28, 0x2b, 0x7c,
163  0x26, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
164  0xb0, 0xb1, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x7e,
165  0x2d, 0x2f, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
166  0xb8, 0xb9, 0xcb, 0x2c, 0x25, 0x5f, 0x3e, 0x3f,
167  0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1,
168  0xc2, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22,
169  0xc3, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
170  0x68, 0x69, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9,
171  0xca, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
172  0x71, 0x72, 0x5e, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
173  0xd1, 0xe5, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
174  0x79, 0x7a, 0xd2, 0xd3, 0xd4, 0x5b, 0xd6, 0xd7,
175  0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
176  0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0x5d, 0xe6, 0xe7,
177  0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
178  0x48, 0x49, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed,
179  0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
180  0x51, 0x52, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3,
181  0x5c, 0x9f, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
182  0x59, 0x5a, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
183  0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
184  0x38, 0x39, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
185 
186  /* ascii => ebcdic-i */
187 
188  0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
189  0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
190  0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
191  0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,
192  0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
193  0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,
194  0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
195  0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f,
196  0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
197  0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
198  0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
199  0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x5f, 0x6d,
200  0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
201  0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
202  0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
203  0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x07,
204  0x20, 0x21, 0x22, 0x23, 0x24, 0x15, 0x06, 0x17,
205  0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x1b,
206  0x30, 0x31, 0x1a, 0x33, 0x34, 0x35, 0x36, 0x08,
207  0x38, 0x39, 0x3a, 0x3b, 0x04, 0x14, 0x3e, 0xe1,
208  0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
209  0x49, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
210  0x58, 0x59, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
211  0x68, 0x69, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75,
212  0x76, 0x77, 0x78, 0x80, 0x8a, 0x8b, 0x8c, 0x8d,
213  0x8e, 0x8f, 0x90, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e,
214  0x9f, 0xa0, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
215  0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
216  0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
217  0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xda, 0xdb,
218  0xdc, 0xdd, 0xde, 0xdf, 0xea, 0xeb, 0xec, 0xed,
219  0xee, 0xef, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
220 
221  /* ebcdic-i => ascii */
222 
223  0x00, 0x01, 0x02, 0x03, 0x9c, 0x09, 0x86, 0x7f,
224  0x97, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
225  0x10, 0x11, 0x12, 0x13, 0x9d, 0x85, 0x08, 0x87,
226  0x18, 0x19, 0x92, 0x8f, 0x1c, 0x1d, 0x1e, 0x1f,
227  0x80, 0x81, 0x82, 0x83, 0x84, 0x0a, 0x17, 0x1b,
228  0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07,
229  0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
230  0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a,
231  0x20, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
232  0xa7, 0xa8, 0x4a, 0x2e, 0x3c, 0x28, 0x2b, 0x7c,
233  0x26, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
234  0xb0, 0xb1, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e,
235  0x2d, 0x2f, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
236  0xb8, 0xb9, 0x6a, 0x2c, 0x25, 0x5f, 0x3e, 0x3f,
237  0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1,
238  0xc2, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22,
239  0xc3, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
240  0x68, 0x69, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9,
241  0xca, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
242  0x71, 0x72, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
243  0xd1, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
244  0x79, 0x7a, 0xd2, 0xd3, 0xd4, 0x5b, 0xd6, 0xd7,
245  0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
246  0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0x5d, 0xe6, 0xe7,
247  0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
248  0x48, 0x49, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed,
249  0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
250  0x51, 0x52, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3,
251  0x5c, 0x9f, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
252  0x59, 0x5a, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
253  0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
254  0x38, 0x39, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
255 
256  /* ascii => ebcdic-o */
257 
258  0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
259  0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
260  0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
261  0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,
262  0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
263  0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,
264  0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
265  0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f,
266  0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
267  0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
268  0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
269  0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x5f, 0x6d,
270  0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
271  0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
272  0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
273  0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x07,
274  0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x06, 0x17,
275  0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x1b,
276  0x30, 0x31, 0x1a, 0x33, 0x34, 0x35, 0x36, 0x08,
277  0x38, 0x39, 0x3a, 0x3b, 0x04, 0x14, 0x3e, 0xff,
278  0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5,
279  0xbb, 0xb4, 0x9a, 0x8a, 0xb0, 0xca, 0xaf, 0xbc,
280  0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
281  0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab,
282  0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
283  0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77,
284  0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
285  0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xba, 0xae, 0x59,
286  0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
287  0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57,
288  0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
289  0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf,
290 
291  /* ebcdic-o => ascii */
292 
293  0x00, 0x01, 0x02, 0x03, 0x9c, 0x09, 0x86, 0x7f,
294  0x97, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
295  0x10, 0x11, 0x12, 0x13, 0x9d, 0x0a, 0x08, 0x87,
296  0x18, 0x19, 0x92, 0x8f, 0x1c, 0x1d, 0x1e, 0x1f,
297  0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x17, 0x1b,
298  0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07,
299  0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
300  0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a,
301  0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5,
302  0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c,
303  0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef,
304  0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e,
305  0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5,
306  0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f,
307  0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf,
308  0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22,
309  0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
310  0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1,
311  0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
312  0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4,
313  0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
314  0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0x5b, 0xde, 0xae,
315  0xac, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc,
316  0xbd, 0xbe, 0xdd, 0xa8, 0xaf, 0x5d, 0xb4, 0xd7,
317  0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
318  0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5,
319  0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
320  0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff,
321  0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
322  0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5,
323  0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
324  0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f,
325 
326  /* ascii => ebcdic-s */
327 
328  0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
329  0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
330  0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
331  0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,
332  0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
333  0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,
334  0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
335  0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f,
336  0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
337  0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
338  0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
339  0xe7, 0xe8, 0xe9, 0xbb, 0xbc, 0xbd, 0x6a, 0x6d,
340  0x4a, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
341  0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
342  0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
343  0xa7, 0xa8, 0xa9, 0xfb, 0x4f, 0xfd, 0xff, 0x07,
344  0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x06, 0x17,
345  0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x1b,
346  0x30, 0x31, 0x1a, 0x33, 0x34, 0x35, 0x36, 0x08,
347  0x38, 0x39, 0x3a, 0x3b, 0x04, 0x14, 0x3e, 0x5f,
348  0x41, 0xaa, 0xb0, 0xb1, 0x9f, 0xb2, 0xd0, 0xb5,
349  0x79, 0xb4, 0x9a, 0x8a, 0xba, 0xca, 0xaf, 0xa1,
350  0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
351  0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab,
352  0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
353  0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77,
354  0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
355  0x80, 0xe0, 0xfe, 0xdd, 0xfc, 0xad, 0xae, 0x59,
356  0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
357  0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57,
358  0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
359  0x70, 0xc0, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf,
360 
361  /* ebcdic-s => ascii */
362 
363  0x00, 0x01, 0x02, 0x03, 0x9c, 0x09, 0x86, 0x7f,
364  0x97, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
365  0x10, 0x11, 0x12, 0x13, 0x9d, 0x0a, 0x08, 0x87,
366  0x18, 0x19, 0x92, 0x8f, 0x1c, 0x1d, 0x1e, 0x1f,
367  0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x17, 0x1b,
368  0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07,
369  0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
370  0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a,
371  0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5,
372  0xe7, 0xf1, 0x60, 0x2e, 0x3c, 0x28, 0x2b, 0x7c,
373  0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef,
374  0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x9f,
375  0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5,
376  0xc7, 0xd1, 0x5e, 0x2c, 0x25, 0x5f, 0x3e, 0x3f,
377  0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf,
378  0xcc, 0xa8, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22,
379  0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
380  0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1,
381  0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
382  0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4,
383  0xb5, 0xaf, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
384  0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xde, 0xae,
385  0xa2, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc,
386  0xbd, 0xbe, 0xac, 0x5b, 0x5c, 0x5d, 0xb4, 0xd7,
387  0xf9, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
388  0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5,
389  0xa6, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
390  0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xdb, 0xfa, 0xff,
391  0xd9, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
392  0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5,
393  0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
394  0x38, 0x39, 0xb3, 0x7b, 0xdc, 0x7d, 0xda, 0x7e,
395 
396  /* ascii => ebcdic-h */
397 
398  0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
399  0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
400  0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
401  0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,
402  0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
403  0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,
404  0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
405  0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f,
406  0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
407  0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
408  0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
409  0xe7, 0xe8, 0xe9, 0xba, 0xe0, 0xbb, 0xb0, 0x6d,
410  0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
411  0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
412  0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
413  0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x07,
414  0x20, 0x21, 0x22, 0x23, 0x24, 0x15, 0x06, 0x17,
415  0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x1b,
416  0x30, 0x31, 0x1a, 0x33, 0x34, 0x35, 0x36, 0x08,
417  0x38, 0x39, 0x3a, 0x3b, 0x04, 0x14, 0x3e, 0xff,
418  0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5,
419  0xbd, 0xb4, 0x9a, 0x8a, 0x5f, 0xca, 0xaf, 0xbc,
420  0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
421  0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab,
422  0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
423  0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77,
424  0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
425  0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xad, 0xae, 0x59,
426  0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
427  0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57,
428  0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
429  0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf,
430 
431  /* ebcdic-h => ascii */
432 
433  0x00, 0x01, 0x02, 0x03, 0x9c, 0x09, 0x86, 0x7f,
434  0x97, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
435  0x10, 0x11, 0x12, 0x13, 0x9d, 0x85, 0x08, 0x87,
436  0x18, 0x19, 0x92, 0x8f, 0x1c, 0x1d, 0x1e, 0x1f,
437  0x80, 0x81, 0x82, 0x83, 0x84, 0x0a, 0x17, 0x1b,
438  0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07,
439  0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
440  0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a,
441  0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5,
442  0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c,
443  0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef,
444  0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0xac,
445  0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5,
446  0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f,
447  0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf,
448  0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22,
449  0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
450  0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1,
451  0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
452  0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4,
453  0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
454  0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xde, 0xae,
455  0x5e, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc,
456  0xbd, 0xbe, 0x5b, 0x5d, 0xaf, 0xa8, 0xb4, 0xd7,
457  0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
458  0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5,
459  0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
460  0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff,
461  0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
462  0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5,
463  0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
464  0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f,
465 
466  /* ascii => ebcdic-m */
467 
468  0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
469  0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
470  0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
471  0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,
472  0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
473  0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,
474  0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
475  0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f,
476  0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
477  0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
478  0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
479  0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x5f, 0x6d,
480  0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
481  0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
482  0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
483  0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x07,
484  0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x06, 0x17,
485  0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x1b,
486  0x30, 0x31, 0x1a, 0x33, 0x34, 0x35, 0x36, 0x08,
487  0x38, 0x39, 0x3a, 0x3b, 0x04, 0x14, 0x3e, 0xdf,
488  0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5,
489  0xbb, 0xb4, 0x9a, 0x8a, 0xb0, 0xca, 0xaf, 0xbc,
490  0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
491  0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab,
492  0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
493  0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77,
494  0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
495  0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xba, 0xae, 0x59,
496  0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
497  0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57,
498  0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
499  0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xff,
500 
501  /* ebcdic-m => ascii */
502 
503  0x00, 0x01, 0x02, 0x03, 0x9c, 0x09, 0x86, 0x7f,
504  0x97, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
505  0x10, 0x11, 0x12, 0x13, 0x9d, 0x0a, 0x08, 0x87,
506  0x18, 0x19, 0x92, 0x8f, 0x1c, 0x1d, 0x1e, 0x1f,
507  0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x17, 0x1b,
508  0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07,
509  0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
510  0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a,
511  0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5,
512  0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c,
513  0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef,
514  0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e,
515  0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5,
516  0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f,
517  0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf,
518  0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22,
519  0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
520  0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1,
521  0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
522  0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4,
523  0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
524  0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0x5b, 0xde, 0xae,
525  0xac, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc,
526  0xbd, 0xbe, 0xdd, 0xa8, 0xaf, 0x5d, 0xb4, 0xd7,
527  0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
528  0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5,
529  0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
530  0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0x9f,
531  0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
532  0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5,
533  0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
534  0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0xff,
535 
536  /* ascii => ebcdic-u */
537 
538  0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
539  0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x9f,
540  0x10, 0x11, 0x12, 0x13, 0xb6, 0xb5, 0x32, 0x26,
541  0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,
542  0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
543  0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,
544  0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
545  0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f,
546  0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
547  0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
548  0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
549  0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x5f, 0x6d,
550  0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
551  0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
552  0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
553  0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x07,
554  0x68, 0xdc, 0x51, 0x42, 0x43, 0x44, 0x47, 0x48,
555  0x52, 0x53, 0x54, 0x57, 0x56, 0x58, 0x63, 0x67,
556  0x71, 0x9c, 0x9e, 0xcb, 0xcc, 0xcd, 0xdb, 0xdd,
557  0xdf, 0xec, 0xfc, 0xb0, 0xb1, 0xb2, 0x3e, 0xb4,
558  0x45, 0x55, 0xce, 0xde, 0x49, 0x69, 0x9a, 0x9b,
559  0xab, 0x0f, 0xba, 0xb8, 0xb7, 0xaa, 0x8a, 0x8b,
560  0x3c, 0x3d, 0x62, 0x6a, 0x64, 0x65, 0x66, 0x20,
561  0x21, 0x22, 0x70, 0x23, 0x72, 0x73, 0x74, 0xbe,
562  0x76, 0x77, 0x78, 0x80, 0x24, 0x15, 0x8c, 0x8d,
563  0x8e, 0x41, 0x06, 0x17, 0x28, 0x29, 0x9d, 0x2a,
564  0x2b, 0x2c, 0x09, 0x0a, 0xac, 0x4a, 0xae, 0xaf,
565  0x1b, 0x30, 0x31, 0xfa, 0x1a, 0x33, 0x34, 0x35,
566  0x36, 0x59, 0x08, 0x38, 0xbc, 0x39, 0xa0, 0xbf,
567  0xca, 0x3a, 0xfe, 0x3b, 0x04, 0xcf, 0xda, 0x14,
568  0xe1, 0x8f, 0x46, 0x75, 0xfd, 0xeb, 0xee, 0xed,
569  0x90, 0xef, 0xb3, 0xfb, 0xb9, 0xea, 0xbb, 0xff,
570 
571  /* ebcdic-u => ascii */
572 
573  0x00, 0x01, 0x02, 0x03, 0xec, 0x09, 0xca, 0x7f,
574  0xe2, 0xd2, 0xd3, 0x0b, 0x0c, 0x0d, 0x0e, 0xa9,
575  0x10, 0x11, 0x12, 0x13, 0xef, 0xc5, 0x08, 0xcb,
576  0x18, 0x19, 0xdc, 0xd8, 0x1c, 0x1d, 0x1e, 0x1f,
577  0xb7, 0xb8, 0xb9, 0xbb, 0xc4, 0x0a, 0x17, 0x1b,
578  0xcc, 0xcd, 0xcf, 0xd0, 0xd1, 0x05, 0x06, 0x07,
579  0xd9, 0xda, 0x16, 0xdd, 0xde, 0xdf, 0xe0, 0x04,
580  0xe3, 0xe5, 0xe9, 0xeb, 0xb0, 0xb1, 0x9e, 0x1a,
581  0x20, 0xc9, 0x83, 0x84, 0x85, 0xa0, 0xf2, 0x86,
582  0x87, 0xa4, 0xd5, 0x2e, 0x3c, 0x28, 0x2b, 0x7c,
583  0x26, 0x82, 0x88, 0x89, 0x8a, 0xa1, 0x8c, 0x8b,
584  0x8d, 0xe1, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e,
585  0x2d, 0x2f, 0xb2, 0x8e, 0xb4, 0xb5, 0xb6, 0x8f,
586  0x80, 0xa5, 0xb3, 0x2c, 0x25, 0x5f, 0x3e, 0x3f,
587  0xba, 0x90, 0xbc, 0xbd, 0xbe, 0xf3, 0xc0, 0xc1,
588  0xc2, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22,
589  0xc3, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
590  0x68, 0x69, 0xae, 0xaf, 0xc6, 0xc7, 0xc8, 0xf1,
591  0xf8, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
592  0x71, 0x72, 0xa6, 0xa7, 0x91, 0xce, 0x92, 0x0f,
593  0xe6, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
594  0x79, 0x7a, 0xad, 0xa8, 0xd4, 0x5b, 0xd6, 0xd7,
595  0x9b, 0x9c, 0x9d, 0xfa, 0x9f, 0x15, 0x14, 0xac,
596  0xab, 0xfc, 0xaa, 0xfe, 0xe4, 0x5d, 0xbf, 0xe7,
597  0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
598  0x48, 0x49, 0xe8, 0x93, 0x94, 0x95, 0xa2, 0xed,
599  0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
600  0x51, 0x52, 0xee, 0x96, 0x81, 0x97, 0xa3, 0x98,
601  0x5c, 0xf0, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
602  0x59, 0x5a, 0xfd, 0xf5, 0x99, 0xf7, 0xf6, 0xf9,
603  0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
604  0x38, 0x39, 0xdb, 0xfb, 0x9a, 0xf4, 0xea, 0xff,
605 
606 };
607 
608 #define MAP	256
609 #define MAPS	(sizeof(tab)/MAP)
610 
611 struct Map_s; typedef struct Map_s Map_t;
612 
613 struct Map_s
614 {
615 	Map_t*		next;
616 	int		op;
617 	unsigned char	map[MAP];
618 };
619 
620 static Map_t*	maps;
621 
622 /*
623  * generate and return ccode map from i to o
624  */
625 
626 unsigned char*
627 _ccmap(int i, int o)
628 {
629 	register unsigned char*	a;
630 	register unsigned char*	m;
631 	register unsigned char*	z;
632 	register Map_t*		map;
633 	register int		n;
634 	int			op;
635 
636 	if (!i && !o)
637 		return (unsigned char*)tab;
638 	if (CCCONVERT(i))
639 	{
640 		o = CCOUT(i);
641 		i = CCIN(i);
642 	}
643 	else if (CCCONVERT(o))
644 	{
645 		i = CCIN(o);
646 		o = CCOUT(o);
647 	}
648 	else
649 	{
650 		if (i == 0)
651 			i = CC_NATIVE;
652 		if (o == 0)
653 			o = CC_NATIVE;
654 	}
655 	if (i == o || i < 1 || i > MAPS || o < 1 || o > MAPS)
656 		return 0;
657 	if (i == CC_ASCII)
658 		return (unsigned char*)tab + MAP * (2 * (o - 1));
659 	if (o == CC_ASCII)
660 		return (unsigned char*)tab + MAP * (2 * (i - 1) + 1);
661 	op = CCOP(i, o);
662 	for (map = maps; map; map = map->next)
663 		if (map->op == op)
664 			return map->map;
665 	if (!(map = newof(0, Map_t, 1, 0)))
666 		return 0;
667 	map->op = op;
668 	a = (unsigned char*)tab + MAP * (2 * (o - 1));
669 	z = (unsigned char*)tab + MAP * (2 * (i - 1) + 1);
670 	m = map->map;
671 	for (n = 0; n < MAP; n++)
672 		m[n] = n;
673 	for (n = MAP - 1; n >= 0; n--)
674 		m[n] = a[z[n]];
675 	map->next = maps;
676 	maps = map;
677 	return m;
678 }
679 
680 void*
681 _ccmapcpy(register unsigned char* m, void* b, const void* a, size_t n)
682 {
683 	register unsigned char*	ub;
684 	register unsigned char*	ue;
685 	register unsigned char*	ua;
686 
687 	if (m)
688 	{
689 		ub = (unsigned char*)b;
690 		ue = ub + n;
691 		ua = (unsigned char*)a;
692 		while (ub < ue)
693 			*ub++ = m[*ua++];
694 	}
695 	else
696 		memcpy(b, a, n);
697 	return b;
698 }
699 
700 void*
701 _ccmapstr(register unsigned char* m, void* b, size_t n)
702 {
703 	register unsigned char*	s;
704 	register unsigned char*	e;
705 
706 	if (m)
707 		for (e = (s = (unsigned char*)b) + n; s < e; s++)
708 			*s = m[*s];
709 	return b;
710 }
711 
712 #else
713 
714 static void
715 dump(int from, int to)
716 {
717 	register const unsigned char*	m;
718 	register int			c;
719 	register int			i;
720 
721 	m = ccmap(from, to);
722 	sfprintf(sfstdout, "\n /* %s => %s */\n\n", ccmapname(from), ccmapname(to));
723 	for (c = i = 0; c <= UCHAR_MAX; c++)
724 	{
725 		sfprintf(sfstdout, " 0x%02x,", m ? m[c] : c);
726 		if (!(++i & 0x7))
727 		{
728 			i = 0;
729 			sfprintf(sfstdout, "\n");
730 		}
731 	}
732 }
733 
734 main(int argc, char** argv)
735 {
736 	register int			i;
737 
738 	for (i = 1; i <= CC_MAPS; i++)
739 	{
740 		dump(CC_ASCII, i);
741 		dump(i, CC_ASCII);
742 	}
743 	return 0;
744 }
745 
746 #endif
747