xref: /onnv-gate/usr/src/lib/libldap5/sources/ldap/common/charset.c (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * Copyright (c) 2001 by Sun Microsystems, Inc.
3*0Sstevel@tonic-gate  * All rights reserved.
4*0Sstevel@tonic-gate  */
5*0Sstevel@tonic-gate 
6*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
7*0Sstevel@tonic-gate 
8*0Sstevel@tonic-gate /*
9*0Sstevel@tonic-gate  * The contents of this file are subject to the Netscape Public
10*0Sstevel@tonic-gate  * License Version 1.1 (the "License"); you may not use this file
11*0Sstevel@tonic-gate  * except in compliance with the License. You may obtain a copy of
12*0Sstevel@tonic-gate  * the License at http://www.mozilla.org/NPL/
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * Software distributed under the License is distributed on an "AS
15*0Sstevel@tonic-gate  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
16*0Sstevel@tonic-gate  * implied. See the License for the specific language governing
17*0Sstevel@tonic-gate  * rights and limitations under the License.
18*0Sstevel@tonic-gate  *
19*0Sstevel@tonic-gate  * The Original Code is Mozilla Communicator client code, released
20*0Sstevel@tonic-gate  * March 31, 1998.
21*0Sstevel@tonic-gate  *
22*0Sstevel@tonic-gate  * The Initial Developer of the Original Code is Netscape
23*0Sstevel@tonic-gate  * Communications Corporation. Portions created by Netscape are
24*0Sstevel@tonic-gate  * Copyright (C) 1998-1999 Netscape Communications Corporation. All
25*0Sstevel@tonic-gate  * Rights Reserved.
26*0Sstevel@tonic-gate  *
27*0Sstevel@tonic-gate  * Contributor(s):
28*0Sstevel@tonic-gate  */
29*0Sstevel@tonic-gate /*
30*0Sstevel@tonic-gate  *  Copyright (c) 1995 Regents of the University of Michigan.
31*0Sstevel@tonic-gate  *  All rights reserved.
32*0Sstevel@tonic-gate  */
33*0Sstevel@tonic-gate /*
34*0Sstevel@tonic-gate  *  charset.c
35*0Sstevel@tonic-gate  */
36*0Sstevel@tonic-gate 
37*0Sstevel@tonic-gate #include "ldap-int.h"
38*0Sstevel@tonic-gate 
39*0Sstevel@tonic-gate #ifdef STR_TRANSLATION
40*0Sstevel@tonic-gate 
41*0Sstevel@tonic-gate void
ldap_set_string_translators(LDAP * ld,BERTranslateProc encode_proc,BERTranslateProc decode_proc)42*0Sstevel@tonic-gate ldap_set_string_translators( LDAP *ld, BERTranslateProc encode_proc,
43*0Sstevel@tonic-gate 	BERTranslateProc decode_proc )
44*0Sstevel@tonic-gate {
45*0Sstevel@tonic-gate 	if ( ld == NULL ) {
46*0Sstevel@tonic-gate 		if ( !nsldapi_initialized ) {
47*0Sstevel@tonic-gate 			nsldapi_initialize_defaults();
48*0Sstevel@tonic-gate 		}
49*0Sstevel@tonic-gate 		ld = &nsldapi_ld_defaults;
50*0Sstevel@tonic-gate 	}
51*0Sstevel@tonic-gate 
52*0Sstevel@tonic-gate 	if ( NSLDAPI_VALID_LDAP_POINTER( ld )) {
53*0Sstevel@tonic-gate 		ld->ld_lber_encode_translate_proc = encode_proc;
54*0Sstevel@tonic-gate 		ld->ld_lber_decode_translate_proc = decode_proc;
55*0Sstevel@tonic-gate 	}
56*0Sstevel@tonic-gate }
57*0Sstevel@tonic-gate 
58*0Sstevel@tonic-gate 
59*0Sstevel@tonic-gate void
ldap_enable_translation(LDAP * ld,LDAPMessage * entry,int enable)60*0Sstevel@tonic-gate ldap_enable_translation( LDAP *ld, LDAPMessage *entry, int enable )
61*0Sstevel@tonic-gate {
62*0Sstevel@tonic-gate 	char	*optionsp;
63*0Sstevel@tonic-gate 
64*0Sstevel@tonic-gate 	if ( ld == NULL ) {
65*0Sstevel@tonic-gate 		if ( !nsldapi_initialized ) {
66*0Sstevel@tonic-gate 			nsldapi_initialize_defaults();
67*0Sstevel@tonic-gate 		}
68*0Sstevel@tonic-gate 		ld = &nsldapi_ld_defaults;
69*0Sstevel@tonic-gate 	}
70*0Sstevel@tonic-gate 
71*0Sstevel@tonic-gate 	optionsp = ( entry == NULLMSG ) ? &ld->ld_lberoptions :
72*0Sstevel@tonic-gate 	    &entry->lm_ber->ber_options;
73*0Sstevel@tonic-gate 
74*0Sstevel@tonic-gate 	if ( enable ) {
75*0Sstevel@tonic-gate 		*optionsp |= LBER_OPT_TRANSLATE_STRINGS;
76*0Sstevel@tonic-gate 	} else {
77*0Sstevel@tonic-gate 		*optionsp &= ~LBER_OPT_TRANSLATE_STRINGS;
78*0Sstevel@tonic-gate 	}
79*0Sstevel@tonic-gate }
80*0Sstevel@tonic-gate 
81*0Sstevel@tonic-gate 
82*0Sstevel@tonic-gate int
ldap_translate_from_t61(LDAP * ld,char ** bufp,unsigned long * lenp,int free_input)83*0Sstevel@tonic-gate ldap_translate_from_t61( LDAP *ld, char **bufp, unsigned long *lenp,
84*0Sstevel@tonic-gate     int free_input )
85*0Sstevel@tonic-gate {
86*0Sstevel@tonic-gate 	ber_len_t length = (ber_len_t)*lenp;
87*0Sstevel@tonic-gate 
88*0Sstevel@tonic-gate 	if ( ld->ld_lber_decode_translate_proc == NULL ) {
89*0Sstevel@tonic-gate 		return( LDAP_SUCCESS );
90*0Sstevel@tonic-gate 	}
91*0Sstevel@tonic-gate 
92*0Sstevel@tonic-gate 	return( (*ld->ld_lber_decode_translate_proc)( bufp, &length, free_input ));
93*0Sstevel@tonic-gate }
94*0Sstevel@tonic-gate 
95*0Sstevel@tonic-gate 
96*0Sstevel@tonic-gate int
ldap_translate_to_t61(LDAP * ld,char ** bufp,unsigned long * lenp,int free_input)97*0Sstevel@tonic-gate ldap_translate_to_t61( LDAP *ld, char **bufp, unsigned long *lenp,
98*0Sstevel@tonic-gate     int free_input )
99*0Sstevel@tonic-gate {
100*0Sstevel@tonic-gate 	ber_len_t length = (ber_len_t)*lenp;
101*0Sstevel@tonic-gate 
102*0Sstevel@tonic-gate 	if ( ld->ld_lber_encode_translate_proc == NULL ) {
103*0Sstevel@tonic-gate 		return( LDAP_SUCCESS );
104*0Sstevel@tonic-gate 	}
105*0Sstevel@tonic-gate 
106*0Sstevel@tonic-gate 	return( (*ld->ld_lber_encode_translate_proc)( bufp, &length, free_input ));
107*0Sstevel@tonic-gate }
108*0Sstevel@tonic-gate 
109*0Sstevel@tonic-gate 
110*0Sstevel@tonic-gate /*
111*0Sstevel@tonic-gate  ** Character translation routine notes:
112*0Sstevel@tonic-gate  *
113*0Sstevel@tonic-gate  * On entry:  bufp points to a "string" to be converted (not necessarily
114*0Sstevel@tonic-gate  *  zero-terminated) and buflenp points to the length of the buffer.
115*0Sstevel@tonic-gate  *
116*0Sstevel@tonic-gate  * On exit:  bufp should point to a malloc'd result.  If free_input is
117*0Sstevel@tonic-gate  *  non-zero then the original bufp will be freed.  *buflenp should be
118*0Sstevel@tonic-gate  *  set to the new length.  Zero bytes in the input buffer must be left
119*0Sstevel@tonic-gate  *  as zero bytes.
120*0Sstevel@tonic-gate  *
121*0Sstevel@tonic-gate  * Return values: any ldap error code (LDAP_SUCCESS if all goes well).
122*0Sstevel@tonic-gate  */
123*0Sstevel@tonic-gate 
124*0Sstevel@tonic-gate 
125*0Sstevel@tonic-gate #ifdef LDAP_CHARSET_8859
126*0Sstevel@tonic-gate 
127*0Sstevel@tonic-gate #if LDAP_CHARSET_8859 == 88591
128*0Sstevel@tonic-gate #define ISO_8859 1
129*0Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88592
130*0Sstevel@tonic-gate #define ISO_8859 2
131*0Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88593
132*0Sstevel@tonic-gate #define ISO_8859 3
133*0Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88594
134*0Sstevel@tonic-gate #define ISO_8859 4
135*0Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88595
136*0Sstevel@tonic-gate #define ISO_8859 5
137*0Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88596
138*0Sstevel@tonic-gate #define ISO_8859 6
139*0Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88597
140*0Sstevel@tonic-gate #define ISO_8859 7
141*0Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88598
142*0Sstevel@tonic-gate #define ISO_8859 8
143*0Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88599
144*0Sstevel@tonic-gate #define ISO_8859 9
145*0Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 885910
146*0Sstevel@tonic-gate #define ISO_8859 10
147*0Sstevel@tonic-gate #else
148*0Sstevel@tonic-gate #define ISO_8859 0
149*0Sstevel@tonic-gate #endif
150*0Sstevel@tonic-gate 
151*0Sstevel@tonic-gate /*
152*0Sstevel@tonic-gate  * the following ISO_8859 to/afrom T.61 character set translation code is
153*0Sstevel@tonic-gate  * based on the code found in Enrique Silvestre Mora's iso-t61.c, found
154*0Sstevel@tonic-gate  * as part of this package:
155*0Sstevel@tonic-gate  *   ftp://pereiii.uji.es/pub/uji-ftp/unix/ldap/iso-t61.translation.tar.Z
156*0Sstevel@tonic-gate  * Enrique is now (10/95) at this address: enrique.silvestre@uv.es
157*0Sstevel@tonic-gate  *
158*0Sstevel@tonic-gate  * changes made by mcs@umich.edu 12 October 1995:
159*0Sstevel@tonic-gate  *   Change calling conventions of iso8859_t61() and t61_iso8859() to
160*0Sstevel@tonic-gate  *	match libldap conventions; rename to ldap_8859_to_t61() and
161*0Sstevel@tonic-gate  *	ldap_t61_to_8859().
162*0Sstevel@tonic-gate  *   Change conversion routines to deal with non-zero terminated strings.
163*0Sstevel@tonic-gate  *   ANSI-ize functions and include prototypes.
164*0Sstevel@tonic-gate  */
165*0Sstevel@tonic-gate 
166*0Sstevel@tonic-gate /* iso-t61.c - ISO-T61 translation routines (version: 0.2.1, July-1994) */
167*0Sstevel@tonic-gate /*
168*0Sstevel@tonic-gate  * Copyright (c) 1994 Enrique Silvestre Mora, Universitat Jaume I, Spain.
169*0Sstevel@tonic-gate  * All rights reserved.
170*0Sstevel@tonic-gate  *
171*0Sstevel@tonic-gate  * Redistribution and use in source and binary forms are permitted
172*0Sstevel@tonic-gate  * provided that this notice is preserved and that due credit is given
173*0Sstevel@tonic-gate  * to the Universitat Jaume I. The name of the University
174*0Sstevel@tonic-gate  * may not be used to endorse or promote products derived from this
175*0Sstevel@tonic-gate  * software without specific prior written permission. This software
176*0Sstevel@tonic-gate  * is provided ``as is'' without express or implied warranty.
177*0Sstevel@tonic-gate */
178*0Sstevel@tonic-gate 
179*0Sstevel@tonic-gate 
180*0Sstevel@tonic-gate #include <stdio.h>
181*0Sstevel@tonic-gate #include <stdlib.h>
182*0Sstevel@tonic-gate #include <string.h>
183*0Sstevel@tonic-gate 
184*0Sstevel@tonic-gate /* Character set used: ISO 8859-1, ISO 8859-2, ISO 8859-3, ... */
185*0Sstevel@tonic-gate /* #define  ISO_8859      1 */
186*0Sstevel@tonic-gate 
187*0Sstevel@tonic-gate #ifndef ISO_8859
188*0Sstevel@tonic-gate #  define ISO_8859     0
189*0Sstevel@tonic-gate #endif
190*0Sstevel@tonic-gate 
191*0Sstevel@tonic-gate typedef unsigned char  Byte;
192*0Sstevel@tonic-gate typedef struct { Byte  a, b; } Couple;
193*0Sstevel@tonic-gate 
194*0Sstevel@tonic-gate #ifdef NEEDPROTOS
195*0Sstevel@tonic-gate static Byte *c_to_hh( Byte *o, Byte c );
196*0Sstevel@tonic-gate static Byte *c_to_cc( Byte *o, Couple *cc, Byte c );
197*0Sstevel@tonic-gate static int hh_to_c( Byte *h );
198*0Sstevel@tonic-gate static Byte *cc_to_t61( Byte *o, Byte *s );
199*0Sstevel@tonic-gate #else /* NEEDPROTOS */
200*0Sstevel@tonic-gate static Byte *c_to_hh();
201*0Sstevel@tonic-gate static Byte *c_to_cc();
202*0Sstevel@tonic-gate static int hh_to_c();
203*0Sstevel@tonic-gate static Byte *cc_to_t61();
204*0Sstevel@tonic-gate #endif /* NEEDPROTOS */
205*0Sstevel@tonic-gate 
206*0Sstevel@tonic-gate /*
207*0Sstevel@tonic-gate    Character choosed as base in diacritics alone: NO-BREAK SPACE.
208*0Sstevel@tonic-gate    (The standard say it must be a blank space, 0x20.)
209*0Sstevel@tonic-gate */
210*0Sstevel@tonic-gate #define  ALONE  0xA0
211*0Sstevel@tonic-gate 
212*0Sstevel@tonic-gate static Couple diacritic[16] = {
213*0Sstevel@tonic-gate #if (ISO_8859 == 1) || (ISO_8859 == 9)
214*0Sstevel@tonic-gate 	{0,0},       {'`',0},     {0xb4,0},    {'^',0},
215*0Sstevel@tonic-gate 	{'~',0},     {0xaf,0},    {'(',ALONE}, {'.',ALONE},
216*0Sstevel@tonic-gate 	{0xa8,0},    {0,0},       {'0',ALONE}, {0xb8,0},
217*0Sstevel@tonic-gate 	{0,0},       {'"',ALONE}, {';',ALONE}, {'<',ALONE},
218*0Sstevel@tonic-gate #elif (ISO_8859 == 2)
219*0Sstevel@tonic-gate 	{0,0},       {'`',0},     {0xb4,0},    {'^',0},
220*0Sstevel@tonic-gate 	{'~',0},     {'-',ALONE}, {0xa2,0},    {0xff,0},
221*0Sstevel@tonic-gate 	{0xa8,0},    {0,0},       {'0',ALONE}, {0xb8,0},
222*0Sstevel@tonic-gate 	{0,0},       {0xbd,0},    {0xb2,0},    {0xb7,0}
223*0Sstevel@tonic-gate #elif (ISO_8859 == 3)
224*0Sstevel@tonic-gate 	{0,0},       {'`',0},     {0xb4,0},    {'^',0},
225*0Sstevel@tonic-gate 	{'~',0},     {'-',ALONE}, {0xa2,0},    {0xff,0},
226*0Sstevel@tonic-gate 	{0xa8,0},    {0,0},       {'0',ALONE}, {0xb8,0},
227*0Sstevel@tonic-gate 	{0,0},       {'"',ALONE}, {';',ALONE}, {'<',ALONE}
228*0Sstevel@tonic-gate #elif (ISO_8859 == 4)
229*0Sstevel@tonic-gate 	{0,0},       {'`',0},     {0xb4,0},    {'^',0},
230*0Sstevel@tonic-gate 	{'~',0},     {0xaf,0},    {'(',ALONE}, {0xff,0},
231*0Sstevel@tonic-gate 	{0xa8,0},    {0,0},       {'0',ALONE}, {0xb8,0},
232*0Sstevel@tonic-gate 	{0,0},       {'"',ALONE}, {0xb2,0},    {0xb7,0}
233*0Sstevel@tonic-gate #else
234*0Sstevel@tonic-gate 	{0,0},       {'`',0},     {'\'',ALONE}, {'^',0},
235*0Sstevel@tonic-gate 	{'~',0},     {'-',ALONE}, {'(',ALONE},  {'.',ALONE},
236*0Sstevel@tonic-gate 	{':',ALONE}, {0,0},       {'0',ALONE},  {',',ALONE},
237*0Sstevel@tonic-gate 	{0,0},       {'"',ALONE}, {';',ALONE},  {'<',ALONE}
238*0Sstevel@tonic-gate #endif
239*0Sstevel@tonic-gate };
240*0Sstevel@tonic-gate 
241*0Sstevel@tonic-gate /*
242*0Sstevel@tonic-gate    --- T.61 (T.51) letters with diacritics: conversion to ISO 8859-n -----
243*0Sstevel@tonic-gate        A,   C,   D,   E,   G,   H,   I,   J,   K,
244*0Sstevel@tonic-gate        L,   N,   O,   R,   S,   T,   U,   W,   Y,   Z.
245*0Sstevel@tonic-gate    -----------------------------------------------------------------------
246*0Sstevel@tonic-gate */
247*0Sstevel@tonic-gate static int letter_w_diacritic[16][38] = {
248*0Sstevel@tonic-gate #if (ISO_8859 == 1)
249*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
250*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
251*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
252*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
253*0Sstevel@tonic-gate 	0xc0,0,   0,   0xc8,0,   0,   0xcc,0,   0,
254*0Sstevel@tonic-gate 	0,   0,   0xd2,0,   0,   0,   0xd9,0,   0,   0,
255*0Sstevel@tonic-gate 	0xe0,0,   0,   0xe8,0,   0,   0xec,0,   0,
256*0Sstevel@tonic-gate 	0,   0,   0xf2,0,   0,   0,   0xf9,0,   0,   0,
257*0Sstevel@tonic-gate 	0xc1,-1,  0,   0xc9,0,   0,   0xcd,0,   0,
258*0Sstevel@tonic-gate 	-1,  -1,  0xd3,-1,  -1,  0,   0xda,0,   0xdd,-1,
259*0Sstevel@tonic-gate 	0xe1,-1,  0,   0xe9,0,   0,   0xed,0,   0,
260*0Sstevel@tonic-gate 	-1,  -1,  0xf3,-1,  -1,  0,   0xfa,0,   0xfd,-1,
261*0Sstevel@tonic-gate 	0xc2,-1,  0,   0xca,-1,  -1,  0xce,-1,  0,
262*0Sstevel@tonic-gate 	0,   0,   0xd4,0,   -1,  0,   0xdb,-1,  -1,  0,
263*0Sstevel@tonic-gate 	0xe2,-1,  0,   0xea,-1,  -1,  0xee,-1,  0,
264*0Sstevel@tonic-gate 	0,   0,   0xf4,0,   -1,  0,   0xfb,-1,  -1,  0,
265*0Sstevel@tonic-gate 	0xc3,0,   0,   0,   0,   0,   -1,  0,   0,
266*0Sstevel@tonic-gate 	0,   0xd1,0xd5,0,   0,   0,   -1,  0,   0,   0,
267*0Sstevel@tonic-gate 	0xe3,0,   0,   0,   0,   0,   -1,  0,   0,
268*0Sstevel@tonic-gate 	0,   0xf1,0xf5,0,   0,   0,   -1,  0,   0,   0,
269*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
270*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
271*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
272*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
273*0Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
274*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
275*0Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
276*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
277*0Sstevel@tonic-gate 	0,   -1,  0,   -1,  -1,  0,   -1,  0,   0,
278*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
279*0Sstevel@tonic-gate 	0,   -1,  0,   -1,  -1,  0,   0,   0,   0,
280*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
281*0Sstevel@tonic-gate 	0xc4,0,   0,   0xcb,0,   0,   0xcf,0,   0,
282*0Sstevel@tonic-gate 	0,   0,   0xd6,0,   0,   0,   0xdc,0,   -1,  0,
283*0Sstevel@tonic-gate 	0xe4,0,   0,   0xeb,0,   0,   0xef,0,   0,
284*0Sstevel@tonic-gate 	0,   0,   0xf6,0,   0,   0,   0xfc,0,   0xff,0,
285*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
286*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
287*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
288*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
289*0Sstevel@tonic-gate 	0xc5,0,   0,   0,   0,   0,   0,   0,   0,
290*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
291*0Sstevel@tonic-gate 	0xe5,0,   0,   0,   0,   0,   0,   0,   0,
292*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
293*0Sstevel@tonic-gate 	0,   0xc7,0,   0,   -1,  0,   0,   0,   -1,
294*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   0,
295*0Sstevel@tonic-gate 	0,   0xe7,0,   0,   -1,  0,   0,   0,   -1,
296*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   0,
297*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
298*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
299*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
300*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
301*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
302*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
303*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
304*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
305*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
306*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
307*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
308*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
309*0Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
310*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1,
311*0Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
312*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1
313*0Sstevel@tonic-gate #elif (ISO_8859 == 2)
314*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
315*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
316*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
317*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
318*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
319*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
320*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
321*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
322*0Sstevel@tonic-gate 	0xc1,0xc6,0,   0xc9,0,   0,   0xcd,0,   0,
323*0Sstevel@tonic-gate 	0xc5,0xd1,0xd3,0xc0,0xa6,0,   0xda,0,   0xdd,0xac,
324*0Sstevel@tonic-gate 	0xe1,0xe6,0,   0xe9,0,   0,   0xed,0,   0,
325*0Sstevel@tonic-gate 	0xe5,0xf1,0xf3,0xe0,0xb6,0,   0xfa,0,   0xfd,0xbc,
326*0Sstevel@tonic-gate 	0xc2,-1,  0,   -1,  -1,  -1,  0xce,-1,  0,
327*0Sstevel@tonic-gate 	0,   0,   0xd4,0,   -1,  0,   -1,  -1,  -1,  0,
328*0Sstevel@tonic-gate 	0xe2,-1,  0,   -1,  -1,  -1,  0xee,-1,  0,
329*0Sstevel@tonic-gate 	0,   0,   0xf4,0,   -1,  0,   -1,  -1,  -1,  0,
330*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   -1,  0,   0,
331*0Sstevel@tonic-gate 	0,   -1,  -1,  0,   0,   0,   -1,  0,   0,   0,
332*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   -1,  0,   0,
333*0Sstevel@tonic-gate 	0,   -1,  -1,  0,   0,   0,   -1,  0,   0,   0,
334*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
335*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
336*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
337*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
338*0Sstevel@tonic-gate 	0xc3,0,   0,   0,   -1,  0,   0,   0,   0,
339*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
340*0Sstevel@tonic-gate 	0xe3,0,   0,   0,   -1,  0,   0,   0,   0,
341*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
342*0Sstevel@tonic-gate 	0,   -1,  0,   -1,  -1,  0,   -1,  0,   0,
343*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0xaf,
344*0Sstevel@tonic-gate 	0,   -1,  0,   -1,  -1,  0,   0,   0,   0,
345*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0xbf,
346*0Sstevel@tonic-gate 	0xc4,0,   0,   0xcb,0,   0,   -1,  0,   0,
347*0Sstevel@tonic-gate 	0,   0,   0xd6,0,   0,   0,   0xdc,0,   -1,  0,
348*0Sstevel@tonic-gate 	0xe4,0,   0,   0xeb,0,   0,   -1,  0,   0,
349*0Sstevel@tonic-gate 	0,   0,   0xf6,0,   0,   0,   0xfc,0,   -1,  0,
350*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
351*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
352*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
353*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
354*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   0,   0,   0,
355*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xd9,0,   0,   0,
356*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   0,   0,   0,
357*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xf9,0,   0,   0,
358*0Sstevel@tonic-gate 	0,   0xc7,0,   0,   -1,  0,   0,   0,   -1,
359*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xaa,0xde,0,   0,   0,   0,
360*0Sstevel@tonic-gate 	0,   0xe7,0,   0,   -1,  0,   0,   0,   -1,
361*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xba,0xfe,0,   0,   0,   0,
362*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
363*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
364*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
365*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
366*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
367*0Sstevel@tonic-gate 	0,   0,   0xd5,0,   0,   0,   0xdb,0,   0,   0,
368*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
369*0Sstevel@tonic-gate 	0,   0,   0xf5,0,   0,   0,   0xfb,0,   0,   0,
370*0Sstevel@tonic-gate 	0xa1,0,   0,   0xca,0,   0,   -1,  0,   0,
371*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
372*0Sstevel@tonic-gate 	0xb1,0,   0,   0xea,0,   0,   -1,  0,   0,
373*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
374*0Sstevel@tonic-gate 	0,   0xc8,0xcf,0xcc,0,   0,   0,   0,   0,
375*0Sstevel@tonic-gate 	0xa5,0xd2,0,   0xd8,0xa9,0xab,0,   0,   0,   0xae,
376*0Sstevel@tonic-gate 	0,   0xe8,0xef,0xec,0,   0,   0,   0,   0,
377*0Sstevel@tonic-gate 	0xb5,0xf2,0,   0xf8,0xb9,0xbb,0,   0,   0,   0xbe
378*0Sstevel@tonic-gate #elif (ISO_8859 == 3)
379*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
380*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
381*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
382*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
383*0Sstevel@tonic-gate 	0xc0,0,   0,   0xc8,0,   0,   0xcc,0,   0,
384*0Sstevel@tonic-gate 	0,   0,   0xd2,0,   0,   0,   0xd9,0,   0,   0,
385*0Sstevel@tonic-gate 	0xe0,0,   0,   0xe8,0,   0,   0xec,0,   0,
386*0Sstevel@tonic-gate 	0,   0,   0xf2,0,   0,   0,   0xf9,0,   0,   0,
387*0Sstevel@tonic-gate 	0xc1,-1,  0,   0xc9,0,   0,   0xcd,0,   0,
388*0Sstevel@tonic-gate 	-1,  -1,  0xd3,-1,  -1,  0,   0xda,0,   -1,  -1,
389*0Sstevel@tonic-gate 	0xe1,-1,  0,   0xe9,0,   0,   0xed,0,   0,
390*0Sstevel@tonic-gate 	-1,  -1,  0xf3,-1,  -1,  0,   0xfa,0,   -1,  -1,
391*0Sstevel@tonic-gate 	0xc2,0xc6,0,   0xca,0xd8,0xa6,0xce,0xac,0,
392*0Sstevel@tonic-gate 	0,   0,   0xd4,0,   0xde,0,   0xdb,-1,  -1,  0,
393*0Sstevel@tonic-gate 	0xe2,0xe6,0,   0xea,0xf8,0xb6,0xee,0xbc,0,
394*0Sstevel@tonic-gate 	0,   0,   0xf4,0,   0xfe,0,   0xfb,-1,  -1,  0,
395*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   -1,  0,   0,
396*0Sstevel@tonic-gate 	0,   0xd1,-1,  0,   0,   0,   -1,  0,   0,   0,
397*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   -1,  0,   0,
398*0Sstevel@tonic-gate 	0,   0xf1,-1,  0,   0,   0,   -1,  0,   0,   0,
399*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
400*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
401*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
402*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
403*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0xab,0,   0,   0,   0,
404*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xdd,0,   0,   0,
405*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0xbb,0,   0,   0,   0,
406*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xfd,0,   0,   0,
407*0Sstevel@tonic-gate 	0,   0xc5,0,   -1,  0xd5,0,   0xa9,0,   0,
408*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0xaf,
409*0Sstevel@tonic-gate 	0,   0xe5,0,   -1,  0xf5,0,   0,   0,   0,
410*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0xbf,
411*0Sstevel@tonic-gate 	0xc4,0,   0,   0xcb,0,   0,   0xcf,0,   0,
412*0Sstevel@tonic-gate 	0,   0,   0xd6,0,   0,   0,   0xdc,0,   -1,  0,
413*0Sstevel@tonic-gate 	0xe4,0,   0,   0xeb,0,   0,   0xef,0,   0,
414*0Sstevel@tonic-gate 	0,   0,   0xf6,0,   0,   0,   0xfc,0,   -1,  0,
415*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
416*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
417*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
418*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
419*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   0,   0,   0,
420*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
421*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   0,   0,   0,
422*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
423*0Sstevel@tonic-gate 	0,   0xc7,0,   0,   -1,  0,   0,   0,   -1,
424*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xaa,-1,  0,   0,   0,   0,
425*0Sstevel@tonic-gate 	0,   0xe7,0,   0,   -1,  0,   0,   0,   -1,
426*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xba,-1,  0,   0,   0,   0,
427*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
428*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
429*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
430*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
431*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
432*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
433*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
434*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
435*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
436*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
437*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
438*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
439*0Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
440*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1,
441*0Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
442*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1
443*0Sstevel@tonic-gate #elif (ISO_8859 == 4)
444*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
445*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
446*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
447*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
448*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
449*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
450*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
451*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
452*0Sstevel@tonic-gate 	0xc1,-1,  0,   0xc9,0,   0,   0xcd,0,   0,
453*0Sstevel@tonic-gate 	-1,  -1,  -1,  -1,  -1,  0,   0xda,0,   -1,  -1,
454*0Sstevel@tonic-gate 	0xe1,-1,  0,   0xe9,0,   0,   0xed,0,   0,
455*0Sstevel@tonic-gate 	-1,  -1,  -1,  -1,  -1,  0,   0xfa,0,   -1,  -1,
456*0Sstevel@tonic-gate 	0xc2,-1,  0,   -1,  -1,  -1,  0xce,-1,  0,
457*0Sstevel@tonic-gate 	0,   0,   0xd4,0,   -1,  0,   0xdb,-1,  -1,  0,
458*0Sstevel@tonic-gate 	0xe2,-1,  0,   -1,  -1,  -1,  0xee,-1,  0,
459*0Sstevel@tonic-gate 	0,   0,   0xf4,0,   -1,  0,   0xfb,-1,  -1,  0,
460*0Sstevel@tonic-gate 	0xc3,0,   0,   0,   0,   0,   0xa5,0,   0,
461*0Sstevel@tonic-gate 	0,   -1,  0xd5,0,   0,   0,   0xdd,0,   0,   0,
462*0Sstevel@tonic-gate 	0xe3,0,   0,   0,   0,   0,   0xb5,0,   0,
463*0Sstevel@tonic-gate 	0,   -1,  0xf5,0,   0,   0,   0xfd,0,   0,   0,
464*0Sstevel@tonic-gate 	0xc0,0,   0,   0xaa,0,   0,   0xcf,0,   0,
465*0Sstevel@tonic-gate 	0,   0,   0xd2,0,   0,   0,   0xde,0,   0,   0,
466*0Sstevel@tonic-gate 	0xe0,0,   0,   0xba,0,   0,   0xef,0,   0,
467*0Sstevel@tonic-gate 	0,   0,   0xf2,0,   0,   0,   0xfe,0,   0,   0,
468*0Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
469*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
470*0Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
471*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
472*0Sstevel@tonic-gate 	0,   -1,  0,   0xcc,-1,  0,   -1,  0,   0,
473*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
474*0Sstevel@tonic-gate 	0,   -1,  0,   0xec,-1,  0,   0,   0,   0,
475*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
476*0Sstevel@tonic-gate 	0xc4,0,   0,   0xcb,0,   0,   -1,  0,   0,
477*0Sstevel@tonic-gate 	0,   0,   0xd6,0,   0,   0,   0xdc,0,   -1,  0,
478*0Sstevel@tonic-gate 	0xe4,0,   0,   0xeb,0,   0,   -1,  0,   0,
479*0Sstevel@tonic-gate 	0,   0,   0xf6,0,   0,   0,   0xfc,0,   -1,  0,
480*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
481*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
482*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
483*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
484*0Sstevel@tonic-gate 	0xc5,0,   0,   0,   0,   0,   0,   0,   0,
485*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
486*0Sstevel@tonic-gate 	0xe5,0,   0,   0,   0,   0,   0,   0,   0,
487*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
488*0Sstevel@tonic-gate 	0,   -1,  0,   0,   0xab,0,   0,   0,   0xd3,
489*0Sstevel@tonic-gate 	0xa6,0xd1,0,   0xa3,-1,  -1,  0,   0,   0,   0,
490*0Sstevel@tonic-gate 	0,   -1,  0,   0,   0xbb,0,   0,   0,   0xf3,
491*0Sstevel@tonic-gate 	0xb6,0xf1,0,   0xb3,-1,  -1,  0,   0,   0,   0,
492*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
493*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
494*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
495*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
496*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
497*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
498*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
499*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
500*0Sstevel@tonic-gate 	0xa1,0,   0,   0xca,0,   0,   0xc7,0,   0,
501*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xd9,0,   0,   0,
502*0Sstevel@tonic-gate 	0xb1,0,   0,   0xea,0,   0,   0xe7,0,   0,
503*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xf9,0,   0,   0,
504*0Sstevel@tonic-gate 	0,   0xc8,-1,  -1,  0,   0,   0,   0,   0,
505*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xa9,-1,  0,   0,   0,   0xae,
506*0Sstevel@tonic-gate 	0,   0xe8,-1,  -1,  0,   0,   0,   0,   0,
507*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xb9,-1,  0,   0,   0,   0xbe
508*0Sstevel@tonic-gate #elif (ISO_8859 == 9)
509*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
510*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
511*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
512*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
513*0Sstevel@tonic-gate 	0xc0,0,   0,   0xc8,0,   0,   0xcc,0,   0,
514*0Sstevel@tonic-gate 	0,   0,   0xd2,0,   0,   0,   0xd9,0,   0,   0,
515*0Sstevel@tonic-gate 	0xe0,0,   0,   0xe8,0,   0,   -1,  0,   0,
516*0Sstevel@tonic-gate 	0,   0,   0xf2,0,   0,   0,   0xf9,0,   0,   0,
517*0Sstevel@tonic-gate 	0xc1,-1,  0,   0xc9,0,   0,   0xcd,0,   0,
518*0Sstevel@tonic-gate 	-1,  -1,  0xd3,-1,  -1,  0,   0xda,0,   -1,  -1,
519*0Sstevel@tonic-gate 	0xe1,-1,  0,   0xe9,0,   0,   0xed,0,   0,
520*0Sstevel@tonic-gate 	-1,  -1,  0xf3,-1,  -1,  0,   0xfa,0,   -1,  -1,
521*0Sstevel@tonic-gate 	0xc2,-1,  0,   0xca,-1,  -1,  0xce,-1,  0,
522*0Sstevel@tonic-gate 	0,   0,   0xd4,0,   -1,  0,   0xdb,-1,  -1,  0,
523*0Sstevel@tonic-gate 	0xe2,-1,  0,   -1,  -1,  -1,  0xee,-1,  0,
524*0Sstevel@tonic-gate 	0,   0,   0xf4,0,   -1,  0,   0xfb,-1,  -1,  0,
525*0Sstevel@tonic-gate 	0xc3,0,   0,   0,   0,   0,   -1,  0,   0,
526*0Sstevel@tonic-gate 	0,   0xd1,0xd5,0,   0,   0,   -1,  0,   0,   0,
527*0Sstevel@tonic-gate 	0xe3,0,   0,   0,   0,   0,   -1,  0,   0,
528*0Sstevel@tonic-gate 	0,   0xf1,0xf5,0,   0,   0,   -1,  0,   0,   0,
529*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
530*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
531*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   0xef,0,   0,
532*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
533*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0xd0,0,   0,   0,   0,
534*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
535*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0xf0,0,   0,   0,   0,
536*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
537*0Sstevel@tonic-gate 	0,   -1,  0,   -1,  -1,  0,   0xdd,0,   0,
538*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
539*0Sstevel@tonic-gate 	0,   -1,  0,   0xec,-1,  0,   0,   0,   0,
540*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
541*0Sstevel@tonic-gate 	0xc4,0,   0,   0xcb,0,   0,   0xcf,0,   0,
542*0Sstevel@tonic-gate 	0,   0,   0xd6,0,   0,   0,   0xdc,0,   -1,  0,
543*0Sstevel@tonic-gate 	0xe4,0,   0,   0xeb,0,   0,   -1,  0,   0,
544*0Sstevel@tonic-gate 	0,   0,   0xf6,0,   0,   0,   0xfc,0,   0xff,0,
545*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
546*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
547*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
548*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
549*0Sstevel@tonic-gate 	0xc5,0,   0,   0,   0,   0,   0,   0,   0,
550*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
551*0Sstevel@tonic-gate 	0xe5,0,   0,   0,   0,   0,   0,   0,   0,
552*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
553*0Sstevel@tonic-gate 	0,   0xc7,0,   0,   -1,  0,   0,   0,   -1,
554*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xde,-1,  0,   0,   0,   0,
555*0Sstevel@tonic-gate 	0,   0xe7,0,   0,   -1,  0,   0,   0,   -1,
556*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xfe,-1,  0,   0,   0,   0,
557*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
558*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
559*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
560*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
561*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
562*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
563*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
564*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
565*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
566*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
567*0Sstevel@tonic-gate 	-1,  0,   0,   0xea,0,   0,   -1,  0,   0,
568*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
569*0Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
570*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1,
571*0Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
572*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1
573*0Sstevel@tonic-gate #elif (ISO_8859 == 10)
574*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
575*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
576*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
577*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
578*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
579*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
580*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
581*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
582*0Sstevel@tonic-gate 	0xc1,-1,  0,   0xc9,0,   0,   0xcd,0,   0,
583*0Sstevel@tonic-gate 	-1,  -1,  0xd3,-1,  -1,  0,   0xda,0,   0xdd,-1,
584*0Sstevel@tonic-gate 	0xe1,-1,  0,   0xe9,0,   0,   0xed,0,   0,
585*0Sstevel@tonic-gate 	-1,  -1,  0xf3,-1,  -1,  0,   0xfa,0,   0xfd,-1,
586*0Sstevel@tonic-gate 	0xc2,-1,  0,   -1,  -1,  -1,  0xce,-1,  0,
587*0Sstevel@tonic-gate 	0,   0,   0xd4,0,   -1,  0,   0xdb,-1,  -1,  0,
588*0Sstevel@tonic-gate 	0xe2,-1,  0,   -1,  -1,  -1,  0xee,-1,  0,
589*0Sstevel@tonic-gate 	0,   0,   0xf4,0,   -1,  0,   0xfb,-1,  -1,  0,
590*0Sstevel@tonic-gate 	0xc3,0,   0,   0,   0,   0,   0xa5,0,   0,
591*0Sstevel@tonic-gate 	0,   -1,  0xd5,0,   0,   0,   0xd7,0,   0,   0,
592*0Sstevel@tonic-gate 	0xe3,0,   0,   0,   0,   0,   0xb5,0,   0,
593*0Sstevel@tonic-gate 	0,   -1,  0xf5,0,   0,   0,   0xf7,0,   0,   0,
594*0Sstevel@tonic-gate 	0xc0,0,   0,   0xa2,0,   0,   0xa4,0,   0,
595*0Sstevel@tonic-gate 	0,   0,   0xd2,0,   0,   0,   0xae,0,   0,   0,
596*0Sstevel@tonic-gate 	0xe0,0,   0,   0xb2,0,   0,   0xb4,0,   0,
597*0Sstevel@tonic-gate 	0,   0,   0xf2,0,   0,   0,   0xbe,0,   0,   0,
598*0Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
599*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
600*0Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
601*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
602*0Sstevel@tonic-gate 	0,   -1,  0,   0xcc,-1,  0,   -1,  0,   0,
603*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
604*0Sstevel@tonic-gate 	0,   -1,  0,   0xec,-1,  0,   0,   0,   0,
605*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
606*0Sstevel@tonic-gate 	0xc4,0,   0,   0xcb,0,   0,   0xcf,0,   0,
607*0Sstevel@tonic-gate 	0,   0,   0xd6,0,   0,   0,   0xdc,0,   -1,  0,
608*0Sstevel@tonic-gate 	0xe4,0,   0,   0xeb,0,   0,   0xef,0,   0,
609*0Sstevel@tonic-gate 	0,   0,   0xf6,0,   0,   0,   0xfc,0,   -1,  0,
610*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
611*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
612*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
613*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
614*0Sstevel@tonic-gate 	0xc5,0,   0,   0,   0,   0,   0,   0,   0,
615*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
616*0Sstevel@tonic-gate 	0xe5,0,   0,   0,   0,   0,   0,   0,   0,
617*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
618*0Sstevel@tonic-gate 	0,   -1,  0,   0,   0xa3,0,   0,   0,   0xa6,
619*0Sstevel@tonic-gate 	0xa8,0xd1,0,   -1,  -1,  -1,  0,   0,   0,   0,
620*0Sstevel@tonic-gate 	0,   -1,  0,   0,   0xb3,0,   0,   0,   0xb6,
621*0Sstevel@tonic-gate 	0xb8,0xf1,0,   -1,  -1,  -1,  0,   0,   0,   0,
622*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
623*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
624*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
625*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
626*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
627*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
628*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
629*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
630*0Sstevel@tonic-gate 	0xa1,0,   0,   0xca,0,   0,   0xc7,0,   0,
631*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xd9,0,   0,   0,
632*0Sstevel@tonic-gate 	0xb1,0,   0,   0xea,0,   0,   0xe7,0,   0,
633*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xf9,0,   0,   0,
634*0Sstevel@tonic-gate 	0,   0xc8,-1,  -1,  0,   0,   0,   0,   0,
635*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xaa,-1,  0,   0,   0,   0xac,
636*0Sstevel@tonic-gate 	0,   0xe8,-1,  -1,  0,   0,   0,   0,   0,
637*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xba,-1,  0,   0,   0,   0xbc
638*0Sstevel@tonic-gate #else
639*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
640*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
641*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
642*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
643*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
644*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
645*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
646*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
647*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0,   0,   -1,  0,   0,
648*0Sstevel@tonic-gate 	-1,  -1,  -1,  -1,  -1,  0,   -1,  0,   -1,  -1,
649*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0,   0,   -1,  0,   0,
650*0Sstevel@tonic-gate 	-1,  -1,  -1,  -1,  -1,  0,   -1,  0,   -1,  -1,
651*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  -1,  -1,  0,
652*0Sstevel@tonic-gate 	0,   0,   -1,  0,   -1,  0,   -1,  -1,  -1,  0,
653*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  -1,  -1,  0,
654*0Sstevel@tonic-gate 	0,   0,   -1,  0,   -1,  0,   -1,  -1,  -1,  0,
655*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   -1,  0,   0,
656*0Sstevel@tonic-gate 	0,   -1,  -1,  0,   0,   0,   -1,  0,   0,   0,
657*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   -1,  0,   0,
658*0Sstevel@tonic-gate 	0,   -1,  -1,  0,   0,   0,   -1,  0,   0,   0,
659*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
660*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
661*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
662*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
663*0Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
664*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
665*0Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
666*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
667*0Sstevel@tonic-gate 	0,   -1,  0,   -1,  -1,  0,   -1,  0,   0,
668*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
669*0Sstevel@tonic-gate 	0,   -1,  0,   -1,  -1,  0,   0,   0,   0,
670*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
671*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
672*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   -1,  0,
673*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
674*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   -1,  0,
675*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
676*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
677*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
678*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
679*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   0,   0,   0,
680*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
681*0Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   0,   0,   0,
682*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
683*0Sstevel@tonic-gate 	0,   -1,  0,   0,   -1,  0,   0,   0,   -1,
684*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   0,
685*0Sstevel@tonic-gate 	0,   -1,  0,   0,   -1,  0,   0,   0,   -1,
686*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   0,
687*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
688*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
689*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
690*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
691*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
692*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
693*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
694*0Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
695*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
696*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
697*0Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
698*0Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
699*0Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
700*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1,
701*0Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
702*0Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1
703*0Sstevel@tonic-gate #endif
704*0Sstevel@tonic-gate };
705*0Sstevel@tonic-gate 
706*0Sstevel@tonic-gate /*
707*0Sstevel@tonic-gate --- T.61 characters [0xA0 .. 0xBF] -----------------
708*0Sstevel@tonic-gate */
709*0Sstevel@tonic-gate static Couple trans_t61a_iso8859[32] = {
710*0Sstevel@tonic-gate #if (ISO_8859 == 1) || (ISO_8859 == 9)
711*0Sstevel@tonic-gate 	{'N','S'}, {0xa1,0},  {0xa2,0},  {0xa3,0},
712*0Sstevel@tonic-gate 	{'D','O'}, {0xa5,0},  {'C','u'}, {0xa7,0},
713*0Sstevel@tonic-gate 	{0xa4,0},  {'\'','6'},{'"','6'}, {0xab,0},
714*0Sstevel@tonic-gate 	{'<','-'}, {'-','!'}, {'-','>'}, {'-','v'},
715*0Sstevel@tonic-gate 	{0xb0,0},  {0xb1,0},  {0xb2,0},  {0xb3,0},
716*0Sstevel@tonic-gate 	{0xd7,0},  {0xb5,0},  {0xb6,0},  {0xb7,0},
717*0Sstevel@tonic-gate 	{0xf7,0},  {'\'','9'},{'"','9'}, {0xbb,0},
718*0Sstevel@tonic-gate 	{0xbc,0},  {0xbd,0},  {0xbe,0},  {0xbf,0}
719*0Sstevel@tonic-gate #elif (ISO_8859 == 2) || (ISO_8859 == 4)
720*0Sstevel@tonic-gate 	{'N','S'}, {'!','I'}, {'C','t'}, {'P','d'},
721*0Sstevel@tonic-gate 	{'D','O'}, {'Y','e'}, {'C','u'}, {0xa7,0},
722*0Sstevel@tonic-gate 	{0xa4,0},  {'\'','6'},{'"','6'}, {'<','<'},
723*0Sstevel@tonic-gate 	{'<','-'}, {'-','!'}, {'-','>'}, {'-','v'},
724*0Sstevel@tonic-gate 	{0xb0,0},  {'+','-'}, {'2','S'}, {'3','S'},
725*0Sstevel@tonic-gate 	{0xd7,0},  {'M','y'}, {'P','I'}, {'.','M'},
726*0Sstevel@tonic-gate 	{0xf7,0},  {'\'','9'},{'"','9'}, {'>','>'},
727*0Sstevel@tonic-gate 	{'1','4'}, {'1','2'}, {'3','4'}, {'?','I'},
728*0Sstevel@tonic-gate #elif (ISO_8859 == 3)
729*0Sstevel@tonic-gate 	{'N','S'}, {'!','I'}, {'C','t'}, {0xa3,0},
730*0Sstevel@tonic-gate 	{'D','O'}, {'Y','e'}, {'C','u'}, {0xa7,0},
731*0Sstevel@tonic-gate 	{0xa4,0},  {'\'','6'},{'"','6'}, {'<','<'},
732*0Sstevel@tonic-gate 	{'<','-'}, {'-','!'}, {'-','>'}, {'-','v'},
733*0Sstevel@tonic-gate 	{0xb0,0},  {'+','-'}, {0xb2,0},  {0xb3,0},
734*0Sstevel@tonic-gate 	{0xd7,0},  {0xb5,0},  {'P','I'}, {0xb7,0},
735*0Sstevel@tonic-gate 	{0xf7,0},  {'\'','9'},{'"','9'}, {'>','>'},
736*0Sstevel@tonic-gate 	{'1','4'}, {0xbd,0},  {'3','4'}, {'?','I'}
737*0Sstevel@tonic-gate #elif (ISO_8859 == 10)
738*0Sstevel@tonic-gate 	{'N','S'}, {'!','I'}, {'C','t'}, {'P','d'},
739*0Sstevel@tonic-gate 	{'D','O'}, {'Y','e'}, {'C','u'}, {0xa7,0},
740*0Sstevel@tonic-gate 	{'C','u'}, {'\'','6'},{'"','6'}, {'<','<'},
741*0Sstevel@tonic-gate 	{'<','-'}, {'-','!'}, {'-','>'}, {'-','v'},
742*0Sstevel@tonic-gate 	{0xb0,0},  {'+','-'}, {'2','S'}, {'3','S'},
743*0Sstevel@tonic-gate 	{'*','X'}, {'M','y'}, {'P','I'}, {0xb7,0},
744*0Sstevel@tonic-gate 	{'-',':'}, {'\'','9'},{'"','9'}, {'>','>'},
745*0Sstevel@tonic-gate 	{'1','4'}, {'1','2'}, {'3','4'}, {'?','I'}
746*0Sstevel@tonic-gate #else
747*0Sstevel@tonic-gate 	{'N','S'}, {'!','I'}, {'C','t'}, {'P','d'},
748*0Sstevel@tonic-gate 	{'D','O'}, {'Y','e'}, {'C','u'}, {'S','E'},
749*0Sstevel@tonic-gate 	{'X','O'}, {'\'','6'},{'"','6'}, {'<','<'},
750*0Sstevel@tonic-gate 	{'<','-'}, {'-','!'}, {'-','>'}, {'-','v'},
751*0Sstevel@tonic-gate 	{'D','G'}, {'+','-'}, {'2','S'}, {'3','S'},
752*0Sstevel@tonic-gate 	{'*','X'}, {'M','y'}, {'P','I'}, {'.','M'},
753*0Sstevel@tonic-gate 	{'-',':'}, {'\'','9'},{'"','9'}, {'>','>'},
754*0Sstevel@tonic-gate 	{'1','4'}, {'1','2'}, {'3','4'}, {'?','I'}
755*0Sstevel@tonic-gate #endif
756*0Sstevel@tonic-gate };
757*0Sstevel@tonic-gate 
758*0Sstevel@tonic-gate /*
759*0Sstevel@tonic-gate --- T.61 characters [0xE0 .. 0xFF] -----------------
760*0Sstevel@tonic-gate */
761*0Sstevel@tonic-gate static Couple trans_t61b_iso8859[48] = {
762*0Sstevel@tonic-gate #if (ISO_8859 == 1)
763*0Sstevel@tonic-gate 	{'-','M'}, {0xb9,0},  {0xae,0},  {0xa9,0},
764*0Sstevel@tonic-gate 	{'T','M'}, {'M','8'}, {0xac,0},  {0xa6,0},
765*0Sstevel@tonic-gate 	{0,0},     {0,0},     {0,0},     {0,0},
766*0Sstevel@tonic-gate 	{'1','8'}, {'3','8'}, {'5','8'}, {'7','8'},
767*0Sstevel@tonic-gate 	{'O','m'}, {0xc6,0},  {0xd0,0},  {0xaa,0},
768*0Sstevel@tonic-gate 	{'H','/'}, {0,0},     {'I','J'}, {'L','.'},
769*0Sstevel@tonic-gate 	{'L','/'}, {0xd8,0},  {'O','E'}, {0xba,0},
770*0Sstevel@tonic-gate 	{0xde,0},  {'T','/'}, {'N','G'}, {'\'','n'},
771*0Sstevel@tonic-gate 	{'k','k'}, {0xe6,0},  {'d','/'}, {0xf0,0},
772*0Sstevel@tonic-gate 	{'h','/'}, {'i','.'}, {'i','j'}, {'l','.'},
773*0Sstevel@tonic-gate 	{'l','/'}, {0xf8,0},  {'o','e'}, {0xdf,0},
774*0Sstevel@tonic-gate 	{0xfe,0},  {'t','/'}, {'n','g'}, {'-','-'}
775*0Sstevel@tonic-gate #elif (ISO_8859 == 2)
776*0Sstevel@tonic-gate 	{'-','M'}, {'1','S'}, {'R','g'}, {'C','o'},
777*0Sstevel@tonic-gate 	{'T','M'}, {'M','8'}, {'N','O'}, {'B','B'},
778*0Sstevel@tonic-gate 	{0,0},     {0,0},     {0,0},     {0,0},
779*0Sstevel@tonic-gate 	{'1','8'}, {'3','8'}, {'5','8'}, {'7','8'},
780*0Sstevel@tonic-gate 	{'O','m'}, {'A','E'}, {0xd0,0},  {'-','a'},
781*0Sstevel@tonic-gate 	{'H','/'}, {0,0},     {'I','J'}, {'L','.'},
782*0Sstevel@tonic-gate 	{0xa3,0},  {'O','/'}, {'O','E'}, {'-','o'},
783*0Sstevel@tonic-gate 	{'T','H'}, {'T','/'}, {'N','G'}, {'\'','n'},
784*0Sstevel@tonic-gate 	{'k','k'}, {'a','e'}, {0xf0,0},  {'d','-'},
785*0Sstevel@tonic-gate 	{'h','/'}, {'i','.'}, {'i','j'}, {'l','.'},
786*0Sstevel@tonic-gate 	{0xb3,0},  {'o','/'}, {'o','e'}, {0xdf,0},
787*0Sstevel@tonic-gate 	{'t','h'}, {'t','/'}, {'n','g'}, {'-','-'}
788*0Sstevel@tonic-gate #elif (ISO_8859 == 3)
789*0Sstevel@tonic-gate 	{'-','M'}, {'1','S'}, {'R','g'}, {'C','o'},
790*0Sstevel@tonic-gate 	{'T','M'}, {'M','8'}, {'N','O'}, {'B','B'},
791*0Sstevel@tonic-gate 	{0,0},     {0,0},     {0,0},     {0,0},
792*0Sstevel@tonic-gate 	{'1','8'}, {'3','8'}, {'5','8'}, {'7','8'},
793*0Sstevel@tonic-gate 	{'O','m'}, {'A','E'}, {'D','/'}, {'-','a'},
794*0Sstevel@tonic-gate 	{0xa1,0},  {0,0},     {'I','J'}, {'L','.'},
795*0Sstevel@tonic-gate 	{'L','/'}, {'O','/'}, {'O','E'}, {'-','o'},
796*0Sstevel@tonic-gate 	{'T','H'}, {'T','/'}, {'N','G'}, {'\'','n'},
797*0Sstevel@tonic-gate 	{'k','k'}, {'a','e'}, {'d','/'}, {'d','-'},
798*0Sstevel@tonic-gate 	{0xb1,0},  {0xb9,0},  {'i','j'}, {'l','.'},
799*0Sstevel@tonic-gate 	{'l','/'}, {'o','/'}, {'o','e'}, {0xdf,0},
800*0Sstevel@tonic-gate 	{'t','h'}, {'t','/'}, {'n','g'}, {'-','-'}
801*0Sstevel@tonic-gate #elif (ISO_8859 == 4)
802*0Sstevel@tonic-gate 	{'-','M'}, {'1','S'}, {'R','g'}, {'C','o'},
803*0Sstevel@tonic-gate 	{'T','M'}, {'M','8'}, {'N','O'}, {'B','B'},
804*0Sstevel@tonic-gate 	{0,0},     {0,0},     {0,0},     {0,0},
805*0Sstevel@tonic-gate 	{'1','8'}, {'3','8'}, {'5','8'}, {'7','8'},
806*0Sstevel@tonic-gate 	{'O','m'}, {0xc6,0},  {0xd0,0},  {'-','a'},
807*0Sstevel@tonic-gate 	{'H','/'}, {0,0},     {'I','J'}, {'L','.'},
808*0Sstevel@tonic-gate 	{'L','/'}, {0xd8,0},  {'O','E'}, {'-','o'},
809*0Sstevel@tonic-gate 	{'T','H'}, {0xac,0},  {0xbd,0},  {'\'','n'},
810*0Sstevel@tonic-gate 	{0xa2,0},  {0xe6,0},  {0xf0,0},  {'d','-'},
811*0Sstevel@tonic-gate 	{'h','/'}, {'i','.'}, {'i','j'}, {'l','.'},
812*0Sstevel@tonic-gate 	{'l','/'}, {0xf8,0},  {'o','e'}, {0xdf,0},
813*0Sstevel@tonic-gate 	{'t','h'}, {0xbc,0},  {0xbf,0},  {'-','-'}
814*0Sstevel@tonic-gate #elif (ISO_8859 == 9)
815*0Sstevel@tonic-gate 	{'-','M'}, {0xb9,0},  {0xae,0},  {0xa9,0},
816*0Sstevel@tonic-gate 	{'T','M'}, {'M','8'}, {0xac,0},  {0xa6,0},
817*0Sstevel@tonic-gate 	{0,0},     {0,0},     {0,0},     {0,0},
818*0Sstevel@tonic-gate 	{'1','8'}, {'3','8'}, {'5','8'}, {'7','8'},
819*0Sstevel@tonic-gate 	{'O','m'}, {0xc6,0},  {'D','/'}, {0xaa,0},
820*0Sstevel@tonic-gate 	{'H','/'}, {0,0},     {'I','J'}, {'L','.'},
821*0Sstevel@tonic-gate 	{'L','/'}, {0xd8,0},  {'O','E'}, {0xba,0},
822*0Sstevel@tonic-gate 	{'T','H'}, {'T','/'}, {'N','G'}, {'\'','n'},
823*0Sstevel@tonic-gate 	{'k','k'}, {0xe6,0},  {'d','/'}, {'d','-'},
824*0Sstevel@tonic-gate 	{'h','/'}, {0xfd,0},  {'i','j'}, {'l','.'},
825*0Sstevel@tonic-gate 	{'l','/'}, {0xf8,0},  {'o','e'}, {0xdf,0},
826*0Sstevel@tonic-gate 	{'t','h'}, {'t','/'}, {'n','g'}, {'-','-'}
827*0Sstevel@tonic-gate #elif (ISO_8859 == 10)
828*0Sstevel@tonic-gate 	{0xbd,0},  {'1','S'}, {'R','g'}, {'C','o'},
829*0Sstevel@tonic-gate 	{'T','M'}, {'M','8'}, {'N','O'}, {'B','B'},
830*0Sstevel@tonic-gate 	{0,0},     {0,0},     {0,0},     {0,0},
831*0Sstevel@tonic-gate 	{'1','8'}, {'3','8'}, {'5','8'}, {'7','8'},
832*0Sstevel@tonic-gate 	{'O','m'}, {0xc6,0},  {0xa9,0},  {'-','a'},
833*0Sstevel@tonic-gate 	{'H','/'}, {0,0},     {'I','J'}, {'L','.'},
834*0Sstevel@tonic-gate 	{'L','/'}, {0xd8,0},  {'O','E'}, {'-','o'},
835*0Sstevel@tonic-gate 	{0xde,0},  {0xab,0},  {0xaf,0},  {'\'','n'},
836*0Sstevel@tonic-gate 	{0xff,0},  {0xe6,0},  {0xb9,0},  {0xf0,0},
837*0Sstevel@tonic-gate 	{'h','/'}, {'i','.'}, {'i','j'}, {'l','.'},
838*0Sstevel@tonic-gate 	{'l','/'}, {0xf8,0},  {'o','e'}, {0xdf,0},
839*0Sstevel@tonic-gate 	{0xfe,0},  {0xbb,0},  {0xbf,0},  {'-','-'}
840*0Sstevel@tonic-gate #else
841*0Sstevel@tonic-gate 	{'-','M'}, {'1','S'}, {'R','g'}, {'C','o'},
842*0Sstevel@tonic-gate 	{'T','M'}, {'M','8'}, {'N','O'}, {'B','B'},
843*0Sstevel@tonic-gate 	{0,0},     {0,0},     {0,0},     {0,0},
844*0Sstevel@tonic-gate 	{'1','8'}, {'3','8'}, {'5','8'}, {'7','8'},
845*0Sstevel@tonic-gate 	{'O','m'}, {'A','E'}, {'D','/'}, {'-','a'},
846*0Sstevel@tonic-gate 	{'H','/'}, {0,0},     {'I','J'}, {'L','.'},
847*0Sstevel@tonic-gate 	{'L','/'}, {'O','/'}, {'O','E'}, {'-','o'},
848*0Sstevel@tonic-gate 	{'T','H'}, {'T','/'}, {'N','G'}, {'\'','n'},
849*0Sstevel@tonic-gate 	{'k','k'}, {'a','e'}, {'d','/'}, {'d','-'},
850*0Sstevel@tonic-gate 	{'h','/'}, {'i','.'}, {'i','j'}, {'l','.'},
851*0Sstevel@tonic-gate 	{'l','/'}, {'o','/'}, {'o','e'}, {'s','s'},
852*0Sstevel@tonic-gate 	{'t','h'}, {'t','-'}, {'n','g'}, {'-','-'}
853*0Sstevel@tonic-gate #endif
854*0Sstevel@tonic-gate };
855*0Sstevel@tonic-gate 
856*0Sstevel@tonic-gate /*
857*0Sstevel@tonic-gate --- ISO 8859-n characters <0xA0 .. 0xFF> -------------------
858*0Sstevel@tonic-gate */
859*0Sstevel@tonic-gate #if (ISO_8859 == 1)
860*0Sstevel@tonic-gate static Couple trans_iso8859_t61[96] = {
861*0Sstevel@tonic-gate 	{0xa0,0},     {0xa1,0},     {0xa2,0},     {0xa3,0},
862*0Sstevel@tonic-gate 	{0xa8,0},     {0xa5,0},     {0xd7,0},     {0xa7,0},
863*0Sstevel@tonic-gate 	{0xc8,ALONE}, {0xd3,0},     {0xe3,0},     {0xab,0},
864*0Sstevel@tonic-gate 	{0xd6,0},     {0xff,0},     {0xd2,0},     {0xc5,ALONE},
865*0Sstevel@tonic-gate 	{0xb0,0},     {0xb1,0},     {0xb2,0},     {0xb3,0},
866*0Sstevel@tonic-gate 	{0xc2,ALONE}, {0xb5,0},     {0xb6,0},     {0xb7,0},
867*0Sstevel@tonic-gate 	{0xcb,ALONE}, {0xd1,0},     {0xeb,0},     {0xbb,0},
868*0Sstevel@tonic-gate 	{0xbc,0},     {0xbd,0},     {0xbe,0},     {0xbf,0},
869*0Sstevel@tonic-gate 	{0xc1,'A'},   {0xc2,'A'},   {0xc3,'A'},   {0xc4,'A'},
870*0Sstevel@tonic-gate 	{0xc8,'A'},   {0xca,'A'},   {0xe1,0},     {0xcb,'C'},
871*0Sstevel@tonic-gate 	{0xc1,'E'},   {0xc2,'E'},   {0xc3,'E'},   {0xc8,'E'},
872*0Sstevel@tonic-gate 	{0xc1,'I'},   {0xc2,'I'},   {0xc3,'I'},   {0xc8,'I'},
873*0Sstevel@tonic-gate 	{0xe2,0},     {0xc4,'N'},   {0xc1,'O'},   {0xc2,'O'},
874*0Sstevel@tonic-gate 	{0xc3,'O'},   {0xc4,'O'},   {0xc8,'O'},   {0xb4,0},
875*0Sstevel@tonic-gate 	{0xe9,0},     {0xc1,'U'},   {0xc2,'U'},   {0xc3,'U'},
876*0Sstevel@tonic-gate 	{0xc8,'U'},   {0xc2,'Y'},   {0xec,0},     {0xfb,0},
877*0Sstevel@tonic-gate 	{0xc1,'a'},   {0xc2,'a'},   {0xc3,'a'},   {0xc4,'a'},
878*0Sstevel@tonic-gate 	{0xc8,'a'},   {0xca,'a'},   {0xf1,0},     {0xcb,'c'},
879*0Sstevel@tonic-gate 	{0xc1,'e'},   {0xc2,'e'},   {0xc3,'e'},   {0xc8,'e'},
880*0Sstevel@tonic-gate 	{0xc1,'i'},   {0xc2,'i'},   {0xc3,'i'},   {0xc8,'i'},
881*0Sstevel@tonic-gate 	{0xf3,0},     {0xc4,'n'},   {0xc1,'o'},   {0xc2,'o'},
882*0Sstevel@tonic-gate 	{0xc3,'o'},   {0xc4,'o'},   {0xc8,'o'},   {0xb8,0},
883*0Sstevel@tonic-gate 	{0xf9,0},     {0xc1,'u'},   {0xc2,'u'},   {0xc3,'u'},
884*0Sstevel@tonic-gate 	{0xc8,'u'},   {0xc2,'y'},   {0xfc,0},     {0xc8,'y'}
885*0Sstevel@tonic-gate };
886*0Sstevel@tonic-gate #elif (ISO_8859 == 2)
887*0Sstevel@tonic-gate static Couple trans_iso8859_t61[96] = {
888*0Sstevel@tonic-gate 	{0xa0,0},     {0xce,'A'},   {0xc6,ALONE}, {0xe8,0},
889*0Sstevel@tonic-gate 	{0xa8,0},     {0xcf,'L'},   {0xc2,'S'},   {0xa7,0},
890*0Sstevel@tonic-gate 	{0xc8,ALONE}, {0xcf,'S'},   {0xcb,'S'},   {0xcf,'T'},
891*0Sstevel@tonic-gate 	{0xc2,'Z'},   {0xff,0},     {0xcf,'Z'},   {0xc7,'Z'},
892*0Sstevel@tonic-gate 	{0xb0,0},     {0xce,'a'},   {0xce,ALONE}, {0xf8,0},
893*0Sstevel@tonic-gate 	{0xc2,ALONE}, {0xcf,'l'},   {0xc2,'s'},   {0xcf,ALONE},
894*0Sstevel@tonic-gate 	{0xcb,ALONE}, {0xcf,'s'},   {0xcb,'s'},   {0xcf,'t'},
895*0Sstevel@tonic-gate 	{0xc2,'z'},   {0xcd,ALONE}, {0xcf,'z'},   {0xc7,'z'},
896*0Sstevel@tonic-gate 	{0xc2,'R'},   {0xc2,'A'},   {0xc3,'A'},   {0xc6,'A'},
897*0Sstevel@tonic-gate 	{0xc8,'A'},   {0xc2,'L'},   {0xc2,'C'},   {0xcb,'C'},
898*0Sstevel@tonic-gate 	{0xcf,'C'},   {0xc2,'E'},   {0xce,'E'},   {0xc8,'E'},
899*0Sstevel@tonic-gate 	{0xcf,'E'},   {0xc2,'I'},   {0xc3,'I'},   {0xcf,'D'},
900*0Sstevel@tonic-gate 	{0xe2,0},     {0xc2,'N'},   {0xcf,'N'},   {0xc2,'O'},
901*0Sstevel@tonic-gate 	{0xc3,'O'},   {0xcd,'O'},   {0xc8,'O'},   {0xb4,0},
902*0Sstevel@tonic-gate 	{0xcf,'R'},   {0xca,'U'},   {0xc2,'U'},   {0xcd,'U'},
903*0Sstevel@tonic-gate 	{0xc8,'U'},   {0xc2,'Y'},   {0xcb,'T'},   {0xfb,0},
904*0Sstevel@tonic-gate 	{0xc2,'r'},   {0xc2,'a'},   {0xc3,'a'},   {0xc6,'a'},
905*0Sstevel@tonic-gate 	{0xc8,'a'},   {0xc2,'l'},   {0xc2,'c'},   {0xcb,'c'},
906*0Sstevel@tonic-gate 	{0xcf,'c'},   {0xc2,'e'},   {0xce,'e'},   {0xc8,'e'},
907*0Sstevel@tonic-gate 	{0xcf,'e'},   {0xc2,'i'},   {0xc3,'i'},   {0xcf,'d'},
908*0Sstevel@tonic-gate 	{0xf2,0},     {0xc2,'n'},   {0xcf,'n'},   {0xc2,'o'},
909*0Sstevel@tonic-gate 	{0xc3,'o'},   {0xcd,'o'},   {0xc8,'o'},   {0xb8,0},
910*0Sstevel@tonic-gate 	{0xcf,'r'},   {0xca,'u'},   {0xc2,'u'},   {0xcd,'u'},
911*0Sstevel@tonic-gate 	{0xc8,'u'},   {0xc2,'y'},   {0xcb,'t'},   {0xc7,ALONE}
912*0Sstevel@tonic-gate };
913*0Sstevel@tonic-gate #elif (ISO_8859 == 3)
914*0Sstevel@tonic-gate static Couple trans_iso8859_t61[96] = {
915*0Sstevel@tonic-gate 	{0xa0,0},     {0xe4,0},     {0xc6,ALONE}, {0xa3,0},
916*0Sstevel@tonic-gate 	{0xa8,0},     {0,0},        {0xc3,'H'},   {0xa7,0},
917*0Sstevel@tonic-gate 	{0xc8,ALONE}, {0xc7,'I'},   {0xcb,'S'},   {0xc6,'G'},
918*0Sstevel@tonic-gate 	{0xc3,'J'},   {0xff,0},     {0,0},        {0xc7,'Z'},
919*0Sstevel@tonic-gate 	{0xb0,0},     {0xf4,0},     {0xb2,0},     {0xb3,0},
920*0Sstevel@tonic-gate 	{0xc2,ALONE}, {0xb5,0},     {0xc3,'h'},   {0xb7,0},
921*0Sstevel@tonic-gate 	{0xcb,ALONE}, {0xf5,0},     {0xcb,'s'},   {0xc6,'g'},
922*0Sstevel@tonic-gate 	{0xc3,'j'},   {0xbd,0},     {0,0},        {0xc7,'z'},
923*0Sstevel@tonic-gate 	{0xc1,'A'},   {0xc2,'A'},   {0xc3,'A'},   {0,0},
924*0Sstevel@tonic-gate 	{0xc8,'A'},   {0xc7,'C'},   {0xc3,'C'},   {0xcb,'C'},
925*0Sstevel@tonic-gate 	{0xc1,'E'},   {0xc2,'E'},   {0xc3,'E'},   {0xc8,'E'},
926*0Sstevel@tonic-gate 	{0xc1,'I'},   {0xc2,'I'},   {0xc3,'I'},   {0xc8,'I'},
927*0Sstevel@tonic-gate 	{0,0},        {0xc4,'N'},   {0xc1,'O'},   {0xc2,'O'},
928*0Sstevel@tonic-gate 	{0xc3,'O'},   {0xc7,'G'},   {0xc8,'O'},   {0xb4,0},
929*0Sstevel@tonic-gate 	{0xc3,'G'},   {0xc1,'U'},   {0xc2,'U'},   {0xc3,'U'},
930*0Sstevel@tonic-gate 	{0xc8,'U'},   {0xc6,'U'},   {0xc3,'S'},   {0xfb,0},
931*0Sstevel@tonic-gate 	{0xc1,'a'},   {0xc2,'a'},   {0xc3,'a'},   {0,0},
932*0Sstevel@tonic-gate 	{0xc8,'a'},   {0xc7,'c'},   {0xc3,'c'},   {0xcb,'c'},
933*0Sstevel@tonic-gate 	{0xc1,'e'},   {0xc2,'e'},   {0xc3,'e'},   {0xc8,'e'},
934*0Sstevel@tonic-gate 	{0xc1,'i'},   {0xc2,'i'},   {0xc3,'i'},   {0xc8,'i'},
935*0Sstevel@tonic-gate 	{0,0},        {0xc4,'n'},   {0xc1,'o'},   {0xc2,'o'},
936*0Sstevel@tonic-gate 	{0xc3,'o'},   {0xc7,'g'},   {0xc8,'o'},   {0xb8,0},
937*0Sstevel@tonic-gate 	{0xc3,'g'},   {0xc1,'u'},   {0xc2,'u'},   {0xc3,'u'},
938*0Sstevel@tonic-gate 	{0xc8,'u'},   {0xc6,'u'},   {0xc3,'s'},   {0xc7,ALONE}
939*0Sstevel@tonic-gate };
940*0Sstevel@tonic-gate #elif (ISO_8859 == 4)
941*0Sstevel@tonic-gate static Couple trans_iso8859_t61[96] = {
942*0Sstevel@tonic-gate 	{0xa0,0},     {0xce,'A'},   {0xf0,0},     {0xcb,'R'},
943*0Sstevel@tonic-gate 	{0xa8,0},     {0xc4,'I'},   {0xcb,'L'},   {0xa7,0},
944*0Sstevel@tonic-gate 	{0xc8,ALONE}, {0xcf,'S'},   {0xc5,'E'},   {0xcb,'G'},
945*0Sstevel@tonic-gate 	{0xed,0},     {0xff,0},     {0xcf,'Z'},   {0xc5,ALONE},
946*0Sstevel@tonic-gate 	{0xb0,0},     {0xce,'a'},   {0xce,ALONE}, {0xcb,'r'},
947*0Sstevel@tonic-gate 	{0xc2,ALONE}, {0xc4,'i'},   {0xcb,'l'},   {0xcf,ALONE},
948*0Sstevel@tonic-gate 	{0xcb,ALONE}, {0xcf,'s'},   {0xc5,'e'},   {0xcb,'g'},
949*0Sstevel@tonic-gate 	{0xfd,0},     {0xee,0},     {0xcf,'z'},   {0xfe,0},
950*0Sstevel@tonic-gate 	{0xc5,'A'},   {0xc2,'A'},   {0xc3,'A'},   {0xc4,'A'},
951*0Sstevel@tonic-gate 	{0xc8,'A'},   {0xca,'A'},   {0xe1,0},     {0xce,'I'},
952*0Sstevel@tonic-gate 	{0xcf,'C'},   {0xc2,'E'},   {0xce,'E'},   {0xc8,'E'},
953*0Sstevel@tonic-gate 	{0xc7,'E'},   {0xc2,'I'},   {0xc3,'I'},   {0xc5,'I'},
954*0Sstevel@tonic-gate 	{0xe2,0},     {0xcb,'N'},   {0xc5,'O'},   {0xcb,'K'},
955*0Sstevel@tonic-gate 	{0xc3,'O'},   {0xc4,'O'},   {0xc8,'O'},   {0xb4,0},
956*0Sstevel@tonic-gate 	{0xe9,0},     {0xce,'U'},   {0xc2,'U'},   {0xc3,'U'},
957*0Sstevel@tonic-gate 	{0xc8,'U'},   {0xc4,'U'},   {0xc5,'U'},   {0xfb,0},
958*0Sstevel@tonic-gate 	{0xc5,'a'},   {0xc2,'a'},   {0xc3,'a'},   {0xc4,'a'},
959*0Sstevel@tonic-gate 	{0xc8,'a'},   {0xca,'a'},   {0xf1,0},     {0xce,'i'},
960*0Sstevel@tonic-gate 	{0xcf,'c'},   {0xc2,'e'},   {0xce,'e'},   {0xc8,'e'},
961*0Sstevel@tonic-gate 	{0xc7,'e'},   {0xc2,'i'},   {0xc3,'i'},   {0xc5,'i'},
962*0Sstevel@tonic-gate 	{0xf2,0},     {0xcb,'n'},   {0xc5,'o'},   {0xcb,'k'},
963*0Sstevel@tonic-gate 	{0xc3,'o'},   {0xc4,'o'},   {0xc8,'o'},   {0xb8,0},
964*0Sstevel@tonic-gate 	{0xf9,0},     {0xce,'u'},   {0xc2,'u'},   {0xc3,'u'},
965*0Sstevel@tonic-gate 	{0xc8,'u'},   {0xc4,'u'},   {0xc5,'u'},   {0xc7,ALONE}
966*0Sstevel@tonic-gate };
967*0Sstevel@tonic-gate #elif (ISO_8859 == 9)
968*0Sstevel@tonic-gate static Couple trans_iso8859_t61[96] = {
969*0Sstevel@tonic-gate 	{0xa0,0},     {0xa1,0},     {0xa2,0},     {0xa3,0},
970*0Sstevel@tonic-gate 	{0xa8,0},     {0xa5,0},     {0xd7,0},     {0xa7,0},
971*0Sstevel@tonic-gate 	{0xc8,ALONE}, {0xd3,0},     {0xe3,0},     {0xab,0},
972*0Sstevel@tonic-gate 	{0xd6,0},     {0xff,0},     {0xd2,0},     {0xc5,ALONE},
973*0Sstevel@tonic-gate 	{0xb0,0},     {0xb1,0},     {0xb2,0},     {0xb3,0},
974*0Sstevel@tonic-gate 	{0xc2,ALONE}, {0xb5,0},     {0xb6,0},     {0xb7,0},
975*0Sstevel@tonic-gate 	{0xcb,ALONE}, {0xd1,0},     {0xeb,0},     {0xbb,0},
976*0Sstevel@tonic-gate 	{0xbc,0},     {0xbd,0},     {0xbe,0},     {0xbf,0},
977*0Sstevel@tonic-gate 	{0xc1,'A'},   {0xc2,'A'},   {0xc3,'A'},   {0xc4,'A'},
978*0Sstevel@tonic-gate 	{0xc8,'A'},   {0xca,'A'},   {0xe1,0},     {0xcb,'C'},
979*0Sstevel@tonic-gate 	{0xc1,'E'},   {0xc2,'E'},   {0xc3,'E'},   {0xc8,'E'},
980*0Sstevel@tonic-gate 	{0xc1,'I'},   {0xc2,'I'},   {0xc3,'I'},   {0xc8,'I'},
981*0Sstevel@tonic-gate 	{0xc6,'G'},   {0xc4,'N'},   {0xc1,'O'},   {0xc2,'O'},
982*0Sstevel@tonic-gate 	{0xc3,'O'},   {0xc4,'O'},   {0xc8,'O'},   {0xb4,0},
983*0Sstevel@tonic-gate 	{0xe9,0},     {0xc1,'U'},   {0xc2,'U'},   {0xc3,'U'},
984*0Sstevel@tonic-gate 	{0xc8,'U'},   {0xc7,'I'},   {0xcb,'S'},   {0xfb,0},
985*0Sstevel@tonic-gate 	{0xc1,'a'},   {0xc2,'a'},   {0xc3,'a'},   {0xc4,'a'},
986*0Sstevel@tonic-gate 	{0xc8,'a'},   {0xca,'a'},   {0xf1,0},     {0xcb,'c'},
987*0Sstevel@tonic-gate 	{0xc1,'e'},   {0xc2,'e'},   {0xce,'e'},   {0xc8,'e'},
988*0Sstevel@tonic-gate 	{0xc7,'e'},   {0xc2,'i'},   {0xc3,'i'},   {0xc5,'i'},
989*0Sstevel@tonic-gate 	{0xc6,'g'},   {0xc4,'n'},   {0xc1,'o'},   {0xc2,'o'},
990*0Sstevel@tonic-gate 	{0xc3,'o'},   {0xc4,'o'},   {0xc8,'o'},   {0xb8,0},
991*0Sstevel@tonic-gate 	{0xf9,0},     {0xc1,'u'},   {0xc2,'u'},   {0xc3,'u'},
992*0Sstevel@tonic-gate 	{0xc8,'u'},   {0xf5,0},     {0xcb,'s'},   {0xc8,'y'}
993*0Sstevel@tonic-gate };
994*0Sstevel@tonic-gate #elif (ISO_8859 == 10)
995*0Sstevel@tonic-gate static Couple trans_iso8859_t61[96] = {
996*0Sstevel@tonic-gate 	{0xa0,0},     {0xce,'A'},   {0xc5,'E'},   {0xcb,'G'},
997*0Sstevel@tonic-gate 	{0xc5,'I'},   {0xc4,'I'},   {0xcb,'K'},   {0xa7,0},
998*0Sstevel@tonic-gate 	{0xcb,'L'},   {0xe2,0},     {0xcf,'S'},   {0xed,0},
999*0Sstevel@tonic-gate 	{0xcf,'Z'},   {0xff,0},     {0xc5,'U'},   {0xee,0},
1000*0Sstevel@tonic-gate 	{0xb0,0},     {0xce,'a'},   {0xc5,'e'},   {0xcb,'g'},
1001*0Sstevel@tonic-gate 	{0xc5,'i'},   {0xc4,'i'},   {0xcb,'k'},   {0xb7,0},
1002*0Sstevel@tonic-gate 	{0xcb,'l'},   {0xf2,0},     {0xcf,'s'},   {0xfd,0},
1003*0Sstevel@tonic-gate 	{0xcf,'z'},   {0xd0,0},     {0xc5,'u'},   {0xfe,0},
1004*0Sstevel@tonic-gate 	{0xc5,'A'},   {0xc2,'A'},   {0xc3,'A'},   {0xc4,'A'},
1005*0Sstevel@tonic-gate 	{0xc8,'A'},   {0xca,'A'},   {0xe1,0},     {0xce,'I'},
1006*0Sstevel@tonic-gate 	{0xcf,'C'},   {0xc2,'E'},   {0xce,'E'},   {0xc8,'E'},
1007*0Sstevel@tonic-gate 	{0xc7,'E'},   {0xc2,'I'},   {0xc3,'I'},   {0xc8,'I'},
1008*0Sstevel@tonic-gate 	{0,0},        {0xcb,'N'},   {0xc5,'O'},   {0xc2,'O'},
1009*0Sstevel@tonic-gate 	{0xc3,'O'},   {0xc4,'O'},   {0xc8,'O'},   {0xc4,'U'},
1010*0Sstevel@tonic-gate 	{0xe9,0},     {0xce,'U'},   {0xc2,'U'},   {0xc3,'U'},
1011*0Sstevel@tonic-gate 	{0xc8,'U'},   {0xc2,'Y'},   {0xec,0},     {0xfb,0},
1012*0Sstevel@tonic-gate 	{0xc5,'a'},   {0xc2,'a'},   {0xc3,'a'},   {0xc4,'a'},
1013*0Sstevel@tonic-gate 	{0xc8,'a'},   {0xca,'a'},   {0xf1,0},     {0xce,'i'},
1014*0Sstevel@tonic-gate 	{0xcf,'c'},   {0xc2,'e'},   {0xce,'e'},   {0xc8,'e'},
1015*0Sstevel@tonic-gate 	{0xc7,'e'},   {0xc2,'i'},   {0xc3,'i'},   {0xc8,'i'},
1016*0Sstevel@tonic-gate 	{0xf3,0},     {0xcb,'n'},   {0xc5,'o'},   {0xc2,'o'},
1017*0Sstevel@tonic-gate 	{0xc3,'o'},   {0xc4,'o'},   {0xc8,'o'},   {0xc4,'u'},
1018*0Sstevel@tonic-gate 	{0xf9,0},     {0xce,'u'},   {0xc2,'u'},   {0xc3,'u'},
1019*0Sstevel@tonic-gate 	{0xc8,'u'},   {0xc2,'y'},   {0xfc,0},     {0xf0,0}
1020*0Sstevel@tonic-gate };
1021*0Sstevel@tonic-gate #endif
1022*0Sstevel@tonic-gate 
1023*0Sstevel@tonic-gate 
1024*0Sstevel@tonic-gate static Byte *
c_to_hh(Byte * o,Byte c)1025*0Sstevel@tonic-gate c_to_hh( Byte *o, Byte c )
1026*0Sstevel@tonic-gate {
1027*0Sstevel@tonic-gate   Byte n;
1028*0Sstevel@tonic-gate 
1029*0Sstevel@tonic-gate   *o++ = '{'; *o++ = 'x';
1030*0Sstevel@tonic-gate   n = c >> 4;
1031*0Sstevel@tonic-gate   *o++ = ((n < 0xA) ? '0' : 'A' - 0xA) + n;
1032*0Sstevel@tonic-gate   n = c & 0x0F;
1033*0Sstevel@tonic-gate   *o++ = ((n < 0xA) ? '0' : 'A' - 0xA) + n;
1034*0Sstevel@tonic-gate   *o++ = '}';
1035*0Sstevel@tonic-gate   return o;
1036*0Sstevel@tonic-gate }
1037*0Sstevel@tonic-gate 
1038*0Sstevel@tonic-gate 
1039*0Sstevel@tonic-gate static Byte *
c_to_cc(Byte * o,Couple * cc,Byte c)1040*0Sstevel@tonic-gate c_to_cc( Byte *o, Couple *cc, Byte c )
1041*0Sstevel@tonic-gate {
1042*0Sstevel@tonic-gate   if ( (*cc).a != 0 ) {
1043*0Sstevel@tonic-gate     if ( (*cc).b == 0 )
1044*0Sstevel@tonic-gate       *o++ = (*cc).a;
1045*0Sstevel@tonic-gate     else {
1046*0Sstevel@tonic-gate       *o++ = '{';
1047*0Sstevel@tonic-gate       *o++ = (*cc).a;
1048*0Sstevel@tonic-gate       *o++ = (*cc).b;
1049*0Sstevel@tonic-gate       *o++ = '}';
1050*0Sstevel@tonic-gate     }
1051*0Sstevel@tonic-gate     return o;
1052*0Sstevel@tonic-gate   }
1053*0Sstevel@tonic-gate   else
1054*0Sstevel@tonic-gate     return c_to_hh( o, c );
1055*0Sstevel@tonic-gate }
1056*0Sstevel@tonic-gate 
1057*0Sstevel@tonic-gate /* --- routine to convert from T.61 to ISO 8859-n --- */
1058*0Sstevel@tonic-gate 
1059*0Sstevel@tonic-gate int
ldap_t61_to_8859(char ** bufp,unsigned long * buflenp,int free_input)1060*0Sstevel@tonic-gate ldap_t61_to_8859( char **bufp, unsigned long *buflenp, int free_input )
1061*0Sstevel@tonic-gate {
1062*0Sstevel@tonic-gate   Byte		*s, *oo, *o;
1063*0Sstevel@tonic-gate   unsigned int  n;
1064*0Sstevel@tonic-gate   int           c;
1065*0Sstevel@tonic-gate   unsigned long len;
1066*0Sstevel@tonic-gate   Couple        *cc;
1067*0Sstevel@tonic-gate 
1068*0Sstevel@tonic-gate   LDAPDebug( LDAP_DEBUG_TRACE, "ldap_t61_to_8859 input length: %ld\n",
1069*0Sstevel@tonic-gate 	*buflenp, 0, 0 );
1070*0Sstevel@tonic-gate 
1071*0Sstevel@tonic-gate   len = *buflenp;
1072*0Sstevel@tonic-gate   s = (Byte *) *bufp;
1073*0Sstevel@tonic-gate 
1074*0Sstevel@tonic-gate   if ( (o = oo = (Byte *)NSLDAPI_MALLOC( 2 * len + 64 )) == NULL ) {
1075*0Sstevel@tonic-gate         return( 1 );
1076*0Sstevel@tonic-gate   }
1077*0Sstevel@tonic-gate 
1078*0Sstevel@tonic-gate   while ( (char *)s - *(char **)bufp < len ) {
1079*0Sstevel@tonic-gate     switch ( *s >> 4 ) {
1080*0Sstevel@tonic-gate 
1081*0Sstevel@tonic-gate     case 0xA: case 0xB:
1082*0Sstevel@tonic-gate       o = c_to_cc( o, &trans_t61a_iso8859[ *s - 0xA0 ], *s );
1083*0Sstevel@tonic-gate       s++;
1084*0Sstevel@tonic-gate       break;
1085*0Sstevel@tonic-gate 
1086*0Sstevel@tonic-gate     case 0xD: case 0xE: case 0xF:
1087*0Sstevel@tonic-gate       o = c_to_cc( o, &trans_t61b_iso8859[ *s - 0xD0 ], *s );
1088*0Sstevel@tonic-gate       s++;
1089*0Sstevel@tonic-gate       break;
1090*0Sstevel@tonic-gate 
1091*0Sstevel@tonic-gate     case 0xC:
1092*0Sstevel@tonic-gate       if ( (*s == 0xC0) || (*s == 0xC9) || (*s == 0xCC) ) {
1093*0Sstevel@tonic-gate         o = c_to_hh( o, *s++ );
1094*0Sstevel@tonic-gate         break;
1095*0Sstevel@tonic-gate       }
1096*0Sstevel@tonic-gate 
1097*0Sstevel@tonic-gate       n = (*s++) - 0xC0;
1098*0Sstevel@tonic-gate       switch ( *s ) {
1099*0Sstevel@tonic-gate 
1100*0Sstevel@tonic-gate       case 'A':  c = letter_w_diacritic[n][0]; break;
1101*0Sstevel@tonic-gate       case 'C':  c = letter_w_diacritic[n][1]; break;
1102*0Sstevel@tonic-gate       case 'D':  c = letter_w_diacritic[n][2]; break;
1103*0Sstevel@tonic-gate       case 'E':  c = letter_w_diacritic[n][3]; break;
1104*0Sstevel@tonic-gate       case 'G':  c = letter_w_diacritic[n][4]; break;
1105*0Sstevel@tonic-gate       case 'H':  c = letter_w_diacritic[n][5]; break;
1106*0Sstevel@tonic-gate       case 'I':  c = letter_w_diacritic[n][6]; break;
1107*0Sstevel@tonic-gate       case 'J':  c = letter_w_diacritic[n][7]; break;
1108*0Sstevel@tonic-gate       case 'K':  c = letter_w_diacritic[n][8]; break;
1109*0Sstevel@tonic-gate       case 'L':  c = letter_w_diacritic[n][9]; break;
1110*0Sstevel@tonic-gate       case 'N':  c = letter_w_diacritic[n][10]; break;
1111*0Sstevel@tonic-gate       case 'O':  c = letter_w_diacritic[n][11]; break;
1112*0Sstevel@tonic-gate       case 'R':  c = letter_w_diacritic[n][12]; break;
1113*0Sstevel@tonic-gate       case 'S':  c = letter_w_diacritic[n][13]; break;
1114*0Sstevel@tonic-gate       case 'T':  c = letter_w_diacritic[n][14]; break;
1115*0Sstevel@tonic-gate       case 'U':  c = letter_w_diacritic[n][15]; break;
1116*0Sstevel@tonic-gate       case 'W':  c = letter_w_diacritic[n][16]; break;
1117*0Sstevel@tonic-gate       case 'Y':  c = letter_w_diacritic[n][17]; break;
1118*0Sstevel@tonic-gate       case 'Z':  c = letter_w_diacritic[n][18]; break;
1119*0Sstevel@tonic-gate 
1120*0Sstevel@tonic-gate       case 'a':  c = letter_w_diacritic[n][19]; break;
1121*0Sstevel@tonic-gate       case 'c':  c = letter_w_diacritic[n][20]; break;
1122*0Sstevel@tonic-gate       case 'd':  c = letter_w_diacritic[n][21]; break;
1123*0Sstevel@tonic-gate       case 'e':  c = letter_w_diacritic[n][22]; break;
1124*0Sstevel@tonic-gate       case 'g':  c = letter_w_diacritic[n][23]; break;
1125*0Sstevel@tonic-gate       case 'h':  c = letter_w_diacritic[n][24]; break;
1126*0Sstevel@tonic-gate       case 'i':  c = letter_w_diacritic[n][25]; break;
1127*0Sstevel@tonic-gate       case 'j':  c = letter_w_diacritic[n][26]; break;
1128*0Sstevel@tonic-gate       case 'k':  c = letter_w_diacritic[n][27]; break;
1129*0Sstevel@tonic-gate       case 'l':  c = letter_w_diacritic[n][28]; break;
1130*0Sstevel@tonic-gate       case 'n':  c = letter_w_diacritic[n][29]; break;
1131*0Sstevel@tonic-gate       case 'o':  c = letter_w_diacritic[n][30]; break;
1132*0Sstevel@tonic-gate       case 'r':  c = letter_w_diacritic[n][31]; break;
1133*0Sstevel@tonic-gate       case 's':  c = letter_w_diacritic[n][32]; break;
1134*0Sstevel@tonic-gate       case 't':  c = letter_w_diacritic[n][33]; break;
1135*0Sstevel@tonic-gate       case 'u':  c = letter_w_diacritic[n][34]; break;
1136*0Sstevel@tonic-gate       case 'w':  c = letter_w_diacritic[n][35]; break;
1137*0Sstevel@tonic-gate       case 'y':  c = letter_w_diacritic[n][36]; break;
1138*0Sstevel@tonic-gate       case 'z':  c = letter_w_diacritic[n][37]; break;
1139*0Sstevel@tonic-gate 
1140*0Sstevel@tonic-gate       case ALONE:  c = (( !diacritic[n].b ) ? diacritic[n].a : -1);
1141*0Sstevel@tonic-gate                    break;
1142*0Sstevel@tonic-gate 
1143*0Sstevel@tonic-gate       default:   c = 0;
1144*0Sstevel@tonic-gate       }
1145*0Sstevel@tonic-gate 
1146*0Sstevel@tonic-gate       if ( c > 0 ) {
1147*0Sstevel@tonic-gate         *o++ = c;  s++;
1148*0Sstevel@tonic-gate       } else {
1149*0Sstevel@tonic-gate         *o++ = '{';
1150*0Sstevel@tonic-gate         if ( c == -1 ) {
1151*0Sstevel@tonic-gate           *o++ = ( ( *s == ALONE ) ? ' ' : *s );
1152*0Sstevel@tonic-gate           s++;
1153*0Sstevel@tonic-gate         } else {
1154*0Sstevel@tonic-gate           *o++ = '"';
1155*0Sstevel@tonic-gate         }
1156*0Sstevel@tonic-gate         *o++ = diacritic[n].a;
1157*0Sstevel@tonic-gate         *o++ = '}';
1158*0Sstevel@tonic-gate       }
1159*0Sstevel@tonic-gate       break;
1160*0Sstevel@tonic-gate 
1161*0Sstevel@tonic-gate #if (ISO_8859 == 0)
1162*0Sstevel@tonic-gate     case 0x8: case 0x9:
1163*0Sstevel@tonic-gate       *o++ = 0x1B; /* <ESC> */
1164*0Sstevel@tonic-gate       *o++ = *s++ - 0x40;
1165*0Sstevel@tonic-gate       break;
1166*0Sstevel@tonic-gate #endif
1167*0Sstevel@tonic-gate 
1168*0Sstevel@tonic-gate       default:
1169*0Sstevel@tonic-gate         *o++ = *s++;
1170*0Sstevel@tonic-gate     }
1171*0Sstevel@tonic-gate   }
1172*0Sstevel@tonic-gate 
1173*0Sstevel@tonic-gate   len = o - oo;
1174*0Sstevel@tonic-gate   o = oo;
1175*0Sstevel@tonic-gate 
1176*0Sstevel@tonic-gate   if ( (oo = (Byte *)NSLDAPI_REALLOC( o, len )) == NULL ) {
1177*0Sstevel@tonic-gate     NSLDAPI_FREE( o );
1178*0Sstevel@tonic-gate     return( 1 );
1179*0Sstevel@tonic-gate   }
1180*0Sstevel@tonic-gate 
1181*0Sstevel@tonic-gate   if ( free_input ) {
1182*0Sstevel@tonic-gate     NSLDAPI_FREE( *bufp );
1183*0Sstevel@tonic-gate   }
1184*0Sstevel@tonic-gate   *bufp = (char *) oo;
1185*0Sstevel@tonic-gate   *buflenp = len;
1186*0Sstevel@tonic-gate   return( 0 );
1187*0Sstevel@tonic-gate }
1188*0Sstevel@tonic-gate 
1189*0Sstevel@tonic-gate 
1190*0Sstevel@tonic-gate static int
hh_to_c(Byte * h)1191*0Sstevel@tonic-gate hh_to_c( Byte *h )
1192*0Sstevel@tonic-gate {
1193*0Sstevel@tonic-gate   Byte c;
1194*0Sstevel@tonic-gate 
1195*0Sstevel@tonic-gate   if ( (*h >= '0') && (*h <= '9') )      c = *h++ - '0';
1196*0Sstevel@tonic-gate   else if ( (*h >= 'A') && (*h <= 'F') ) c = *h++ - 'A' + 10;
1197*0Sstevel@tonic-gate   else if ( (*h >= 'a') && (*h <= 'f') ) c = *h++ - 'a' + 10;
1198*0Sstevel@tonic-gate   else return -1;
1199*0Sstevel@tonic-gate 
1200*0Sstevel@tonic-gate   c <<= 4;
1201*0Sstevel@tonic-gate 
1202*0Sstevel@tonic-gate   if ( (*h >= '0') && (*h <= '9') )      c |= *h - '0';
1203*0Sstevel@tonic-gate   else if ( (*h >= 'A') && (*h <= 'F') ) c |= *h - 'A' + 10;
1204*0Sstevel@tonic-gate   else if ( (*h >= 'a') && (*h <= 'f') ) c |= *h - 'a' + 10;
1205*0Sstevel@tonic-gate   else return -1;
1206*0Sstevel@tonic-gate 
1207*0Sstevel@tonic-gate   return c;
1208*0Sstevel@tonic-gate }
1209*0Sstevel@tonic-gate 
1210*0Sstevel@tonic-gate 
1211*0Sstevel@tonic-gate static Byte *
cc_to_t61(Byte * o,Byte * s)1212*0Sstevel@tonic-gate cc_to_t61( Byte *o, Byte *s )
1213*0Sstevel@tonic-gate {
1214*0Sstevel@tonic-gate   int n, c = 0;
1215*0Sstevel@tonic-gate 
1216*0Sstevel@tonic-gate   switch ( *(s + 1) ) {
1217*0Sstevel@tonic-gate 
1218*0Sstevel@tonic-gate   case '`':  c = -1;   break;    /* <grave-accent> */
1219*0Sstevel@tonic-gate 
1220*0Sstevel@tonic-gate   case '!':
1221*0Sstevel@tonic-gate     switch ( *s ) {
1222*0Sstevel@tonic-gate     case '!':  c = 0x7C;  break;  /* <vertical-line> */
1223*0Sstevel@tonic-gate     case '(':  c = 0x7B;  break;  /* <left-curly-bracket> */
1224*0Sstevel@tonic-gate     case '-':  c = 0xAD;  break;  /* <upwards-arrow> */
1225*0Sstevel@tonic-gate     default:   c = -1;            /* <grave-accent> */
1226*0Sstevel@tonic-gate     }
1227*0Sstevel@tonic-gate     break;
1228*0Sstevel@tonic-gate 
1229*0Sstevel@tonic-gate #if (ISO_8859 == 1) || (ISO_8859 == 2) || (ISO_8859 == 3) || \
1230*0Sstevel@tonic-gate     (ISO_8859 == 4) || (ISO_8859 == 9)
1231*0Sstevel@tonic-gate   case 0xB4:
1232*0Sstevel@tonic-gate #endif
1233*0Sstevel@tonic-gate   case '\'': c = -2;  break;    /* <acute-accent> */
1234*0Sstevel@tonic-gate 
1235*0Sstevel@tonic-gate   case '^':  c = -3;  break;    /* <circumflex-acent> */
1236*0Sstevel@tonic-gate 
1237*0Sstevel@tonic-gate   case '>':
1238*0Sstevel@tonic-gate     switch ( *s ) {
1239*0Sstevel@tonic-gate     case ')':  c = 0x5D;  break;  /* <right-square-bracket> */
1240*0Sstevel@tonic-gate     case '>':  c = 0xBB;  break;  /* <right-angle-quotation> */
1241*0Sstevel@tonic-gate     case '-':  c = 0xAE;  break;  /* <rightwards-arrow> */
1242*0Sstevel@tonic-gate     default:   c = -3;            /* <circumflex-acent> */
1243*0Sstevel@tonic-gate     }
1244*0Sstevel@tonic-gate     break;
1245*0Sstevel@tonic-gate 
1246*0Sstevel@tonic-gate   case '~':
1247*0Sstevel@tonic-gate   case '?':  c = -4;  break;        /* <tilde> */
1248*0Sstevel@tonic-gate 
1249*0Sstevel@tonic-gate #if (ISO_8859 == 1) || (ISO_8859 == 4) || (ISO_8859 == 9)
1250*0Sstevel@tonic-gate   case 0xAF:  c = -5;  break;       /* <macron> */
1251*0Sstevel@tonic-gate #endif
1252*0Sstevel@tonic-gate 
1253*0Sstevel@tonic-gate   case '-':
1254*0Sstevel@tonic-gate     switch ( *s ) {
1255*0Sstevel@tonic-gate     case '-':  c = 0xFF; break; /* <soft-hyphen> */
1256*0Sstevel@tonic-gate     case '<':  c = 0xAC; break; /* <leftwards arrow> */
1257*0Sstevel@tonic-gate     case '+':  c = 0xB1; break; /* <plus-minus> */
1258*0Sstevel@tonic-gate     case 'd':  c = 0xF3; break; /* <eth> */
1259*0Sstevel@tonic-gate     default:   c = -5;          /* <macron> */
1260*0Sstevel@tonic-gate     }
1261*0Sstevel@tonic-gate     break;
1262*0Sstevel@tonic-gate 
1263*0Sstevel@tonic-gate #if (ISO_8859 == 2) || (ISO_8859 == 3)
1264*0Sstevel@tonic-gate   case 0xA2:  c = -6;  break;            /* <breve> */
1265*0Sstevel@tonic-gate #endif
1266*0Sstevel@tonic-gate 
1267*0Sstevel@tonic-gate   case '(':
1268*0Sstevel@tonic-gate     if ( *s == '<' ) c = 0x5B;  /* <left-square-bracket> */
1269*0Sstevel@tonic-gate     else             c = -6;    /* <breve> */
1270*0Sstevel@tonic-gate     break;
1271*0Sstevel@tonic-gate 
1272*0Sstevel@tonic-gate #if (ISO_8859 == 2) || (ISO_8859 == 3) || (ISO_8859 == 4)
1273*0Sstevel@tonic-gate   case 0xFF:  c = -7;  break;    /* <dot-accent> */
1274*0Sstevel@tonic-gate #endif
1275*0Sstevel@tonic-gate 
1276*0Sstevel@tonic-gate   case '.':
1277*0Sstevel@tonic-gate     switch ( *s ) {
1278*0Sstevel@tonic-gate     case 'i':  c = 0xF5; break; /* <dotless-i> */
1279*0Sstevel@tonic-gate     case 'L':  c = 0xE7; break; /* <L-middle-dot> */
1280*0Sstevel@tonic-gate     case 'l':  c = 0xF7; break; /* <l-middle-dot> */
1281*0Sstevel@tonic-gate     default:   c = -7;          /* <dot-accent> */
1282*0Sstevel@tonic-gate     }
1283*0Sstevel@tonic-gate     break;
1284*0Sstevel@tonic-gate 
1285*0Sstevel@tonic-gate #if (ISO_8859 == 1) || (ISO_8859 == 2) || (ISO_8859 == 3) || \
1286*0Sstevel@tonic-gate     (ISO_8859 == 4) || (ISO_8859 == 9)
1287*0Sstevel@tonic-gate   case 0xA8:  c = -8; break; /* <diaeresis> */
1288*0Sstevel@tonic-gate #endif
1289*0Sstevel@tonic-gate 
1290*0Sstevel@tonic-gate   case ':':
1291*0Sstevel@tonic-gate     if ( *s == '-')  c = 0xB8; /* <division-sign> */
1292*0Sstevel@tonic-gate     else             c = -8;   /* <diaeresis> */
1293*0Sstevel@tonic-gate     break;
1294*0Sstevel@tonic-gate 
1295*0Sstevel@tonic-gate #if (ISO_8859 == 1) || (ISO_8859 == 2) || (ISO_8859 == 3) || \
1296*0Sstevel@tonic-gate     (ISO_8859 == 4) || (ISO_8859 == 9) || (ISO_8859 == 10)
1297*0Sstevel@tonic-gate   case 0xB0:
1298*0Sstevel@tonic-gate #endif
1299*0Sstevel@tonic-gate   case '0':  c = -10;  break;  /* <ring-above> */
1300*0Sstevel@tonic-gate 
1301*0Sstevel@tonic-gate #if (ISO_8859 == 1) || (ISO_8859 == 2) || (ISO_8859 == 3) || \
1302*0Sstevel@tonic-gate     (ISO_8859 == 4) || (ISO_8859 == 9)
1303*0Sstevel@tonic-gate   case 0xB8:
1304*0Sstevel@tonic-gate #endif
1305*0Sstevel@tonic-gate   case ',':  c = -11; break; /* <cedilla> */
1306*0Sstevel@tonic-gate 
1307*0Sstevel@tonic-gate #if (ISO_8859 == 2)
1308*0Sstevel@tonic-gate   case 0xBD:
1309*0Sstevel@tonic-gate #endif
1310*0Sstevel@tonic-gate   case '"':  c = -13; break; /* <double-acute-accent> */
1311*0Sstevel@tonic-gate 
1312*0Sstevel@tonic-gate #if (ISO_8859 == 2) || (ISO_8859 == 4)
1313*0Sstevel@tonic-gate   case 0xB2:
1314*0Sstevel@tonic-gate #endif
1315*0Sstevel@tonic-gate   case ';':  c = -14; break; /* <ogonek> */
1316*0Sstevel@tonic-gate 
1317*0Sstevel@tonic-gate #if (ISO_8859 == 2) || (ISO_8859 == 4)
1318*0Sstevel@tonic-gate   case 0xB7:  c = -15;  break;  /* <caron> */
1319*0Sstevel@tonic-gate #endif
1320*0Sstevel@tonic-gate 
1321*0Sstevel@tonic-gate   case ')':
1322*0Sstevel@tonic-gate     if ( *s == '!' )  c = 0x7D;  /* <left-curly-bracket> */
1323*0Sstevel@tonic-gate     break;
1324*0Sstevel@tonic-gate 
1325*0Sstevel@tonic-gate   case '<':
1326*0Sstevel@tonic-gate     if ( *s == '<' )  c = 0xAB;  /* <left-angle-quotation> */
1327*0Sstevel@tonic-gate     else              c = -15;   /* <caron> */
1328*0Sstevel@tonic-gate     break;
1329*0Sstevel@tonic-gate 
1330*0Sstevel@tonic-gate   case '/':
1331*0Sstevel@tonic-gate     switch ( *s ) {
1332*0Sstevel@tonic-gate     case '/':  c = 0x5C; break; /* <reverse-solidus> */
1333*0Sstevel@tonic-gate     case 'D':  c = 0xE2; break; /* <D-stroke> */
1334*0Sstevel@tonic-gate     case 'd':  c = 0xF2; break; /* <d-stroke> */
1335*0Sstevel@tonic-gate     case 'H':  c = 0xE4; break; /* <H-stroke> */
1336*0Sstevel@tonic-gate     case 'h':  c = 0xF4; break; /* <h-stroke> */
1337*0Sstevel@tonic-gate     case 'L':  c = 0xE8; break; /* <L-stroke> */
1338*0Sstevel@tonic-gate     case 'l':  c = 0xF8; break; /* <l-stroke> */
1339*0Sstevel@tonic-gate     case 'O':  c = 0xE9; break; /* <O-stroke> */
1340*0Sstevel@tonic-gate     case 'o':  c = 0xF9; break; /* <o-stroke> */
1341*0Sstevel@tonic-gate     case 'T':  c = 0xED; break; /* <T-stroke> */
1342*0Sstevel@tonic-gate     case 't':  c = 0xFD; break; /* <t-stroke> */
1343*0Sstevel@tonic-gate     }
1344*0Sstevel@tonic-gate     break;
1345*0Sstevel@tonic-gate 
1346*0Sstevel@tonic-gate   case '2':
1347*0Sstevel@tonic-gate     if ( *s == '1' )  c = 0xBD;    /* <one-half> */
1348*0Sstevel@tonic-gate     break;
1349*0Sstevel@tonic-gate 
1350*0Sstevel@tonic-gate   case '4':
1351*0Sstevel@tonic-gate     switch ( *s ) {
1352*0Sstevel@tonic-gate     case '1':  c = 0xBC; break; /* <one-quarter> */
1353*0Sstevel@tonic-gate     case '3':  c = 0xBE; break; /* <three-quarters> */
1354*0Sstevel@tonic-gate     }
1355*0Sstevel@tonic-gate     break;
1356*0Sstevel@tonic-gate 
1357*0Sstevel@tonic-gate   case '6':
1358*0Sstevel@tonic-gate     switch ( *s ) {
1359*0Sstevel@tonic-gate     case '\'': c = 0xA9; break; /* <left-single-quotation> */
1360*0Sstevel@tonic-gate     case '"':  c = 0xAA; break; /* <left-double-quotation> */
1361*0Sstevel@tonic-gate     }
1362*0Sstevel@tonic-gate     break;
1363*0Sstevel@tonic-gate 
1364*0Sstevel@tonic-gate   case '8':
1365*0Sstevel@tonic-gate     switch ( *s ) {
1366*0Sstevel@tonic-gate     case '1':  c = 0xDC; break; /* <one-eighth> */
1367*0Sstevel@tonic-gate     case '3':  c = 0xDD; break; /* <three-eighths> */
1368*0Sstevel@tonic-gate     case '5':  c = 0xDE; break; /* <five-eighths> */
1369*0Sstevel@tonic-gate     case '7':  c = 0xDF; break; /* <seven-eighths> */
1370*0Sstevel@tonic-gate     case 'M':  c = 0xD5; break; /* <eighth-note> */
1371*0Sstevel@tonic-gate     }
1372*0Sstevel@tonic-gate     break;
1373*0Sstevel@tonic-gate 
1374*0Sstevel@tonic-gate   case '9':
1375*0Sstevel@tonic-gate     switch ( *s ) {
1376*0Sstevel@tonic-gate     case '\'': c = 0xB9; break; /* <right-single-quotation> */
1377*0Sstevel@tonic-gate     case '"':  c = 0xBA; break; /* <right-double-quotation> */
1378*0Sstevel@tonic-gate     }
1379*0Sstevel@tonic-gate     break;
1380*0Sstevel@tonic-gate 
1381*0Sstevel@tonic-gate   case 'A':
1382*0Sstevel@tonic-gate     if ( *s == 'A' )  c = -10;  /* <ring-above> + <A> */
1383*0Sstevel@tonic-gate     break;
1384*0Sstevel@tonic-gate 
1385*0Sstevel@tonic-gate   case 'a':
1386*0Sstevel@tonic-gate     switch ( *s ) {
1387*0Sstevel@tonic-gate     case '-':  c = 0xE3; break; /* <femenine-ordinal-a> */
1388*0Sstevel@tonic-gate     case 'a':  c = -10;  break; /* <ring-above> + <a> */
1389*0Sstevel@tonic-gate     }
1390*0Sstevel@tonic-gate     break;
1391*0Sstevel@tonic-gate 
1392*0Sstevel@tonic-gate   case 'B':
1393*0Sstevel@tonic-gate     if ( *s == 'B' )  c = 0xD7; /* <broken-bar> */
1394*0Sstevel@tonic-gate     break;
1395*0Sstevel@tonic-gate 
1396*0Sstevel@tonic-gate   case 'b':
1397*0Sstevel@tonic-gate     if ( *s == 'N' )  c = 0xA6;  /* <number-sign> */
1398*0Sstevel@tonic-gate     break;
1399*0Sstevel@tonic-gate 
1400*0Sstevel@tonic-gate   case 'd':
1401*0Sstevel@tonic-gate     if ( *s == 'P' )  c = 0xA3;  /* <pound-sign> */
1402*0Sstevel@tonic-gate     break;
1403*0Sstevel@tonic-gate 
1404*0Sstevel@tonic-gate   case 'E':
1405*0Sstevel@tonic-gate     switch ( *s ) {
1406*0Sstevel@tonic-gate     case 'S':  c = 0xA7; break; /* <section-sign> */
1407*0Sstevel@tonic-gate     case 'A':  c = 0xE1; break; /* <AE> */
1408*0Sstevel@tonic-gate     case 'O':  c = 0xEA; break; /* <OE> */
1409*0Sstevel@tonic-gate     }
1410*0Sstevel@tonic-gate     break;
1411*0Sstevel@tonic-gate 
1412*0Sstevel@tonic-gate   case 'e':
1413*0Sstevel@tonic-gate     switch ( *s ) {
1414*0Sstevel@tonic-gate     case 'a':  c = 0xF1; break; /* <ae> */
1415*0Sstevel@tonic-gate     case 'o':  c = 0xFA; break; /* <oe> */
1416*0Sstevel@tonic-gate     case 'Y':  c = 0xA5;  break;  /* <yen-sign> */
1417*0Sstevel@tonic-gate     }
1418*0Sstevel@tonic-gate     break;
1419*0Sstevel@tonic-gate 
1420*0Sstevel@tonic-gate   case 'G':
1421*0Sstevel@tonic-gate     switch ( *s ) {
1422*0Sstevel@tonic-gate     case 'D':  c = 0xB0; break; /* <degree-sign> */
1423*0Sstevel@tonic-gate     case 'N':  c = 0xEE; break; /* <Eng> */
1424*0Sstevel@tonic-gate     }
1425*0Sstevel@tonic-gate     break;
1426*0Sstevel@tonic-gate 
1427*0Sstevel@tonic-gate   case 'g':
1428*0Sstevel@tonic-gate     switch ( *s ) {
1429*0Sstevel@tonic-gate     case 'R':  c = 0xD2; break;  /* <registered-sign> */
1430*0Sstevel@tonic-gate     case 'n':  c = 0xFE; break; /* <eng> */
1431*0Sstevel@tonic-gate     }
1432*0Sstevel@tonic-gate     break;
1433*0Sstevel@tonic-gate 
1434*0Sstevel@tonic-gate   case 'H':
1435*0Sstevel@tonic-gate     if ( *s == 'T' )  c = 0xEC;  /* <Thorn> */
1436*0Sstevel@tonic-gate     break;
1437*0Sstevel@tonic-gate 
1438*0Sstevel@tonic-gate   case 'h':
1439*0Sstevel@tonic-gate     if ( *s == 't' )  c = 0xFC; /* <thorn> */
1440*0Sstevel@tonic-gate     break;
1441*0Sstevel@tonic-gate 
1442*0Sstevel@tonic-gate   case 'I':
1443*0Sstevel@tonic-gate     switch ( *s ) {
1444*0Sstevel@tonic-gate     case 'P':  c = 0xB6; break;  /* <pilcrow-sign> */
1445*0Sstevel@tonic-gate     case '!':  c = 0xA1; break; /* <inverted-exclamation> */
1446*0Sstevel@tonic-gate     case '?':  c = 0xBF; break; /* <inverted-question> */
1447*0Sstevel@tonic-gate     }
1448*0Sstevel@tonic-gate     break;
1449*0Sstevel@tonic-gate 
1450*0Sstevel@tonic-gate   case 'J':
1451*0Sstevel@tonic-gate     if ( *s == 'I' )  c = 0xE6; /* <IJ> */
1452*0Sstevel@tonic-gate     break;
1453*0Sstevel@tonic-gate 
1454*0Sstevel@tonic-gate   case 'j':
1455*0Sstevel@tonic-gate     if ( *s == 'i' )  c = 0xF6;  /* <ij> */
1456*0Sstevel@tonic-gate     break;
1457*0Sstevel@tonic-gate 
1458*0Sstevel@tonic-gate   case 'k':
1459*0Sstevel@tonic-gate     if ( *s == 'k' )  c = 0xF0; /* <kra> */
1460*0Sstevel@tonic-gate     break;
1461*0Sstevel@tonic-gate 
1462*0Sstevel@tonic-gate   case 'M':
1463*0Sstevel@tonic-gate     switch ( *s ) {
1464*0Sstevel@tonic-gate     case '.':  c = 0xB7; break; /* <middle-dot> */
1465*0Sstevel@tonic-gate     case '-':  c = 0xD0; break; /* <em-dash> */
1466*0Sstevel@tonic-gate     case 'T':  c = 0xD4; break; /* <trade-mark-sign> */
1467*0Sstevel@tonic-gate     }
1468*0Sstevel@tonic-gate     break;
1469*0Sstevel@tonic-gate 
1470*0Sstevel@tonic-gate   case 'm':
1471*0Sstevel@tonic-gate     switch ( *s ) {
1472*0Sstevel@tonic-gate     case '\'':                  /* <macron> RFC 1345 */
1473*0Sstevel@tonic-gate     case ' ':  c = -5;   break; /* <macron> */
1474*0Sstevel@tonic-gate     case 'O':  c = 0xE0; break; /* <Ohm sign> */
1475*0Sstevel@tonic-gate     }
1476*0Sstevel@tonic-gate     break;
1477*0Sstevel@tonic-gate 
1478*0Sstevel@tonic-gate   case 'n':
1479*0Sstevel@tonic-gate     if ( *s == '\'' )  c = 0xEF; /* <n-preceded-by-apostrophe> */
1480*0Sstevel@tonic-gate     break;
1481*0Sstevel@tonic-gate 
1482*0Sstevel@tonic-gate   case 'O':
1483*0Sstevel@tonic-gate     switch ( *s ) {
1484*0Sstevel@tonic-gate     case 'D':  c = 0xA4; break; /* <dollar-sign> */
1485*0Sstevel@tonic-gate     case 'N':  c = 0xD6; break; /* <not-sign> */
1486*0Sstevel@tonic-gate     }
1487*0Sstevel@tonic-gate     break;
1488*0Sstevel@tonic-gate 
1489*0Sstevel@tonic-gate   case 'o':
1490*0Sstevel@tonic-gate     switch ( *s ) {
1491*0Sstevel@tonic-gate     case 'C':  c = 0xD3; break; /* <copyright-sign> */
1492*0Sstevel@tonic-gate     case '-':  c = 0xEB; break; /* <masculine-ordinal-o> */
1493*0Sstevel@tonic-gate     }
1494*0Sstevel@tonic-gate     break;
1495*0Sstevel@tonic-gate 
1496*0Sstevel@tonic-gate   case 'S':
1497*0Sstevel@tonic-gate     switch ( *s ) {
1498*0Sstevel@tonic-gate     case '1':  c = 0xD1; break; /* <superscript-1> */
1499*0Sstevel@tonic-gate     case '2':  c = 0xB2; break; /* <superscript-2> */
1500*0Sstevel@tonic-gate     case '3':  c = 0xB3; break; /* <superscript-3> */
1501*0Sstevel@tonic-gate     case 'N':  c = 0xA0; break; /* <no-break-space> */
1502*0Sstevel@tonic-gate     }
1503*0Sstevel@tonic-gate     break;
1504*0Sstevel@tonic-gate 
1505*0Sstevel@tonic-gate   case 's':
1506*0Sstevel@tonic-gate     if ( *s == 's' )  c = 0xFB; /* <sharp-s> */
1507*0Sstevel@tonic-gate     break;
1508*0Sstevel@tonic-gate 
1509*0Sstevel@tonic-gate   case 't':
1510*0Sstevel@tonic-gate     if ( *s == 'C' )  c = 0xA2; /* <cent-sign> */
1511*0Sstevel@tonic-gate     break;
1512*0Sstevel@tonic-gate 
1513*0Sstevel@tonic-gate   case 'u':
1514*0Sstevel@tonic-gate     if ( *s == 'C' )  c = 0xA8; /* <currency-sign> */
1515*0Sstevel@tonic-gate     break;
1516*0Sstevel@tonic-gate 
1517*0Sstevel@tonic-gate   case 'v':
1518*0Sstevel@tonic-gate     if ( *s == '-' )  c = 0xAF; /* <downwards-arrow> */
1519*0Sstevel@tonic-gate     break;
1520*0Sstevel@tonic-gate 
1521*0Sstevel@tonic-gate   case 'X':
1522*0Sstevel@tonic-gate     if ( *s == '*' )  c = 0xB4; /* <multiplication-sign> */
1523*0Sstevel@tonic-gate     break;
1524*0Sstevel@tonic-gate 
1525*0Sstevel@tonic-gate   case 'y':
1526*0Sstevel@tonic-gate     if ( *s == 'M' )  c = 0xB5; /* <micro-sign> */
1527*0Sstevel@tonic-gate     break;
1528*0Sstevel@tonic-gate   }
1529*0Sstevel@tonic-gate 
1530*0Sstevel@tonic-gate   if ( c > 0 ) {
1531*0Sstevel@tonic-gate     *o++ = c;
1532*0Sstevel@tonic-gate     return o;
1533*0Sstevel@tonic-gate   } else if ( !c )
1534*0Sstevel@tonic-gate     return NULL;
1535*0Sstevel@tonic-gate 
1536*0Sstevel@tonic-gate   /* else: c < 0 */
1537*0Sstevel@tonic-gate   n = -c;
1538*0Sstevel@tonic-gate   switch ( *s ) {
1539*0Sstevel@tonic-gate 
1540*0Sstevel@tonic-gate   case 'A':  c = letter_w_diacritic[n][0]; break;
1541*0Sstevel@tonic-gate   case 'C':  c = letter_w_diacritic[n][1]; break;
1542*0Sstevel@tonic-gate   case 'D':  c = letter_w_diacritic[n][2]; break;
1543*0Sstevel@tonic-gate   case 'E':  c = letter_w_diacritic[n][3]; break;
1544*0Sstevel@tonic-gate   case 'G':  c = letter_w_diacritic[n][4]; break;
1545*0Sstevel@tonic-gate   case 'H':  c = letter_w_diacritic[n][5]; break;
1546*0Sstevel@tonic-gate   case 'I':  c = letter_w_diacritic[n][6]; break;
1547*0Sstevel@tonic-gate   case 'J':  c = letter_w_diacritic[n][7]; break;
1548*0Sstevel@tonic-gate   case 'K':  c = letter_w_diacritic[n][8]; break;
1549*0Sstevel@tonic-gate   case 'L':  c = letter_w_diacritic[n][9]; break;
1550*0Sstevel@tonic-gate   case 'N':  c = letter_w_diacritic[n][10]; break;
1551*0Sstevel@tonic-gate   case 'O':  c = letter_w_diacritic[n][11]; break;
1552*0Sstevel@tonic-gate   case 'R':  c = letter_w_diacritic[n][12]; break;
1553*0Sstevel@tonic-gate   case 'S':  c = letter_w_diacritic[n][13]; break;
1554*0Sstevel@tonic-gate   case 'T':  c = letter_w_diacritic[n][14]; break;
1555*0Sstevel@tonic-gate   case 'U':  c = letter_w_diacritic[n][15]; break;
1556*0Sstevel@tonic-gate   case 'W':  c = letter_w_diacritic[n][16]; break;
1557*0Sstevel@tonic-gate   case 'Y':  c = letter_w_diacritic[n][17]; break;
1558*0Sstevel@tonic-gate   case 'Z':  c = letter_w_diacritic[n][18]; break;
1559*0Sstevel@tonic-gate 
1560*0Sstevel@tonic-gate   case 'a':  c = letter_w_diacritic[n][19]; break;
1561*0Sstevel@tonic-gate   case 'c':  c = letter_w_diacritic[n][20]; break;
1562*0Sstevel@tonic-gate   case 'd':  c = letter_w_diacritic[n][21]; break;
1563*0Sstevel@tonic-gate   case 'e':  c = letter_w_diacritic[n][22]; break;
1564*0Sstevel@tonic-gate   case 'g':  c = letter_w_diacritic[n][23]; break;
1565*0Sstevel@tonic-gate   case 'h':  c = letter_w_diacritic[n][24]; break;
1566*0Sstevel@tonic-gate   case 'i':  c = letter_w_diacritic[n][25]; break;
1567*0Sstevel@tonic-gate   case 'j':  c = letter_w_diacritic[n][26]; break;
1568*0Sstevel@tonic-gate   case 'k':  c = letter_w_diacritic[n][27]; break;
1569*0Sstevel@tonic-gate   case 'l':  c = letter_w_diacritic[n][28]; break;
1570*0Sstevel@tonic-gate   case 'n':  c = letter_w_diacritic[n][29]; break;
1571*0Sstevel@tonic-gate   case 'o':  c = letter_w_diacritic[n][30]; break;
1572*0Sstevel@tonic-gate   case 'r':  c = letter_w_diacritic[n][31]; break;
1573*0Sstevel@tonic-gate   case 's':  c = letter_w_diacritic[n][32]; break;
1574*0Sstevel@tonic-gate   case 't':  c = letter_w_diacritic[n][33]; break;
1575*0Sstevel@tonic-gate   case 'u':  c = letter_w_diacritic[n][34]; break;
1576*0Sstevel@tonic-gate   case 'w':  c = letter_w_diacritic[n][35]; break;
1577*0Sstevel@tonic-gate   case 'y':  c = letter_w_diacritic[n][36]; break;
1578*0Sstevel@tonic-gate   case 'z':  c = letter_w_diacritic[n][37]; break;
1579*0Sstevel@tonic-gate 
1580*0Sstevel@tonic-gate   case '\'':
1581*0Sstevel@tonic-gate   case ' ':  c = -1; break;
1582*0Sstevel@tonic-gate 
1583*0Sstevel@tonic-gate   default:   c = 0;
1584*0Sstevel@tonic-gate   }
1585*0Sstevel@tonic-gate 
1586*0Sstevel@tonic-gate   if ( !c )
1587*0Sstevel@tonic-gate     return NULL;
1588*0Sstevel@tonic-gate 
1589*0Sstevel@tonic-gate   *o++ = n + 0xC0;
1590*0Sstevel@tonic-gate   *o++ = ( ( (*s == ' ') || (*s == '\'') ) ? ALONE : *s );
1591*0Sstevel@tonic-gate   return o;
1592*0Sstevel@tonic-gate }
1593*0Sstevel@tonic-gate 
1594*0Sstevel@tonic-gate 
1595*0Sstevel@tonic-gate /* --- routine to convert from ISO 8859-n to T.61 --- */
1596*0Sstevel@tonic-gate 
1597*0Sstevel@tonic-gate int
ldap_8859_to_t61(char ** bufp,unsigned long * buflenp,int free_input)1598*0Sstevel@tonic-gate ldap_8859_to_t61( char **bufp, unsigned long *buflenp, int free_input )
1599*0Sstevel@tonic-gate {
1600*0Sstevel@tonic-gate   Byte		*s, *oo, *o, *aux;
1601*0Sstevel@tonic-gate   int		c;
1602*0Sstevel@tonic-gate   unsigned long len;
1603*0Sstevel@tonic-gate   Couple	*cc;
1604*0Sstevel@tonic-gate 
1605*0Sstevel@tonic-gate   LDAPDebug( LDAP_DEBUG_TRACE, "ldap_8859_to_t61 input length: %ld\n",
1606*0Sstevel@tonic-gate 	*buflenp, 0, 0 );
1607*0Sstevel@tonic-gate 
1608*0Sstevel@tonic-gate   len = *buflenp;
1609*0Sstevel@tonic-gate   s = (Byte *) *bufp;
1610*0Sstevel@tonic-gate 
1611*0Sstevel@tonic-gate   if ( (o = oo = (Byte *)NSLDAPI_MALLOC( 2 * len + 64 )) == NULL ) {
1612*0Sstevel@tonic-gate         return( 1 );
1613*0Sstevel@tonic-gate   }
1614*0Sstevel@tonic-gate 
1615*0Sstevel@tonic-gate   while ( (char *)s - *(char **)bufp < len ) {
1616*0Sstevel@tonic-gate     switch( *s >> 5 ) {
1617*0Sstevel@tonic-gate 
1618*0Sstevel@tonic-gate     case 2:
1619*0Sstevel@tonic-gate       switch ( *s ) {
1620*0Sstevel@tonic-gate 
1621*0Sstevel@tonic-gate       case '^':  *o++ = 0xC3; *o++ = ALONE; s++; break;
1622*0Sstevel@tonic-gate 
1623*0Sstevel@tonic-gate       case '\\':
1624*0Sstevel@tonic-gate         s++;
1625*0Sstevel@tonic-gate         if ( (c = hh_to_c( s )) != -1 ) {
1626*0Sstevel@tonic-gate           *o++ = c;
1627*0Sstevel@tonic-gate           s += 2;
1628*0Sstevel@tonic-gate         } else
1629*0Sstevel@tonic-gate           *o++ = '\\';
1630*0Sstevel@tonic-gate         break;
1631*0Sstevel@tonic-gate 
1632*0Sstevel@tonic-gate       default:  *o++ = *s++;
1633*0Sstevel@tonic-gate       }
1634*0Sstevel@tonic-gate       break;
1635*0Sstevel@tonic-gate 
1636*0Sstevel@tonic-gate     case 3:
1637*0Sstevel@tonic-gate       switch ( *s ) {
1638*0Sstevel@tonic-gate 
1639*0Sstevel@tonic-gate       case '`':  *o++ = 0xC1; *o++ = ALONE; s++; break;
1640*0Sstevel@tonic-gate       case '~':  *o++ = 0xC4; *o++ = ALONE; s++; break;
1641*0Sstevel@tonic-gate 
1642*0Sstevel@tonic-gate       case '{':
1643*0Sstevel@tonic-gate         s++;
1644*0Sstevel@tonic-gate         if ( *(s + 2) == '}' ) {
1645*0Sstevel@tonic-gate           if ( (aux = cc_to_t61( o, s )) != NULL ) {
1646*0Sstevel@tonic-gate             o = aux;
1647*0Sstevel@tonic-gate             s += 3;
1648*0Sstevel@tonic-gate           } else {
1649*0Sstevel@tonic-gate             *o++ = '{';
1650*0Sstevel@tonic-gate           }
1651*0Sstevel@tonic-gate         } else if ( (*(s + 3) == '}') && ( (*s == 'x') || (*s == 'X') ) &&
1652*0Sstevel@tonic-gate                     ( (c = hh_to_c( s + 1 )) != -1 ) ) {
1653*0Sstevel@tonic-gate           *o++ = c;
1654*0Sstevel@tonic-gate           s += 4;
1655*0Sstevel@tonic-gate         } else {
1656*0Sstevel@tonic-gate           *o++ = '{';
1657*0Sstevel@tonic-gate         }
1658*0Sstevel@tonic-gate         break;
1659*0Sstevel@tonic-gate 
1660*0Sstevel@tonic-gate       default:
1661*0Sstevel@tonic-gate         *o++ = *s++;
1662*0Sstevel@tonic-gate       }
1663*0Sstevel@tonic-gate       break;
1664*0Sstevel@tonic-gate 
1665*0Sstevel@tonic-gate #if (ISO_8859 == 0)
1666*0Sstevel@tonic-gate     case 4: case 5: case 6: case 7:
1667*0Sstevel@tonic-gate       s++;
1668*0Sstevel@tonic-gate       break;
1669*0Sstevel@tonic-gate #else
1670*0Sstevel@tonic-gate     case 5: case 6: case 7:
1671*0Sstevel@tonic-gate # if (ISO_8859 == 1) || (ISO_8859 == 2) || (ISO_8859 == 3) || \
1672*0Sstevel@tonic-gate      (ISO_8859 == 4) || (ISO_8859 == 9) || (ISO_8859 == 10)
1673*0Sstevel@tonic-gate       if ( (*(cc = &trans_iso8859_t61[ *s - 0xA0 ])).a ) {
1674*0Sstevel@tonic-gate 	*o++ = (*cc).a;
1675*0Sstevel@tonic-gate 	if ( (*cc).b )  *o++ = (*cc).b;
1676*0Sstevel@tonic-gate       }
1677*0Sstevel@tonic-gate # endif
1678*0Sstevel@tonic-gate       s++;
1679*0Sstevel@tonic-gate       break;
1680*0Sstevel@tonic-gate #endif
1681*0Sstevel@tonic-gate 
1682*0Sstevel@tonic-gate     default:
1683*0Sstevel@tonic-gate       *o++ = *s++;
1684*0Sstevel@tonic-gate     }
1685*0Sstevel@tonic-gate   }
1686*0Sstevel@tonic-gate 
1687*0Sstevel@tonic-gate   len = o - oo;
1688*0Sstevel@tonic-gate   o = oo;
1689*0Sstevel@tonic-gate 
1690*0Sstevel@tonic-gate   if ( (oo = (Byte *)NSLDAPI_REALLOC( o, len )) == NULL ) {
1691*0Sstevel@tonic-gate     NSLDAPI_FREE( o );
1692*0Sstevel@tonic-gate     return( 1 );
1693*0Sstevel@tonic-gate   }
1694*0Sstevel@tonic-gate 
1695*0Sstevel@tonic-gate   if ( free_input ) {
1696*0Sstevel@tonic-gate     NSLDAPI_FREE( *bufp );
1697*0Sstevel@tonic-gate   }
1698*0Sstevel@tonic-gate   *bufp = (char *) oo;
1699*0Sstevel@tonic-gate   *buflenp = len;
1700*0Sstevel@tonic-gate   return( 0 );
1701*0Sstevel@tonic-gate }
1702*0Sstevel@tonic-gate 
1703*0Sstevel@tonic-gate 
1704*0Sstevel@tonic-gate #ifdef NOT_NEEDED_IN_LIBLDAP	/* mcs@umich.edu 12 Oct 1995 */
1705*0Sstevel@tonic-gate /* --- routine to convert "escaped" (\hh) characters to 8bits --- */
1706*0Sstevel@tonic-gate 
convert_escaped_to_8bit(s)1707*0Sstevel@tonic-gate void convert_escaped_to_8bit( s )
1708*0Sstevel@tonic-gate char	*s;
1709*0Sstevel@tonic-gate {
1710*0Sstevel@tonic-gate   char	*o = s;
1711*0Sstevel@tonic-gate   int	c;
1712*0Sstevel@tonic-gate 
1713*0Sstevel@tonic-gate   while ( *s ) {
1714*0Sstevel@tonic-gate     if ( *s == '\\' ) {
1715*0Sstevel@tonic-gate       if ( (c = hh_to_c( ++s )) != -1 ) {
1716*0Sstevel@tonic-gate 	*o++ = c;
1717*0Sstevel@tonic-gate 	s += 2;
1718*0Sstevel@tonic-gate       } else
1719*0Sstevel@tonic-gate         *o++ = '\\';
1720*0Sstevel@tonic-gate     } else
1721*0Sstevel@tonic-gate       *o++ = *s++;
1722*0Sstevel@tonic-gate   }
1723*0Sstevel@tonic-gate   *o = '\0';
1724*0Sstevel@tonic-gate }
1725*0Sstevel@tonic-gate 
1726*0Sstevel@tonic-gate /* --- routine to convert 8bits characters to the "escaped" (\hh) form --- */
1727*0Sstevel@tonic-gate 
convert_8bit_to_escaped(s)1728*0Sstevel@tonic-gate char *convert_8bit_to_escaped( s )
1729*0Sstevel@tonic-gate Byte  *s;
1730*0Sstevel@tonic-gate {
1731*0Sstevel@tonic-gate   Byte	*o, *oo;
1732*0Sstevel@tonic-gate   Byte	n;
1733*0Sstevel@tonic-gate 
1734*0Sstevel@tonic-gate   if ( (o = oo = (Byte *)NSLDAPI_MALLOC( 2 * strlen( s ) + 64 )) == NULL ) {
1735*0Sstevel@tonic-gate         return( NULL );
1736*0Sstevel@tonic-gate   }
1737*0Sstevel@tonic-gate 
1738*0Sstevel@tonic-gate   while ( *s ) {
1739*0Sstevel@tonic-gate     if ( *s < 0x80 )
1740*0Sstevel@tonic-gate       *o++ = *s++;
1741*0Sstevel@tonic-gate     else {
1742*0Sstevel@tonic-gate       *o++ = '\\';
1743*0Sstevel@tonic-gate       n = *s >> 4;
1744*0Sstevel@tonic-gate       *o++ = ((n < 0xA) ? '0' : 'A' - 0xA) + n;
1745*0Sstevel@tonic-gate       n = *s++ & 0x0F;
1746*0Sstevel@tonic-gate       *o++ = ((n < 0xA) ? '0' : 'A' - 0xA) + n;
1747*0Sstevel@tonic-gate     }
1748*0Sstevel@tonic-gate   }
1749*0Sstevel@tonic-gate   *o = '\0';
1750*0Sstevel@tonic-gate 
1751*0Sstevel@tonic-gate   o = oo;
1752*0Sstevel@tonic-gate 
1753*0Sstevel@tonic-gate   if ( (oo = (Byte *)NSLDAPI_REALLOC( o, strlen( o ) + 1 )) == NULL ) {
1754*0Sstevel@tonic-gate     NSLDAPI_FREE( o );
1755*0Sstevel@tonic-gate     return( NULL );
1756*0Sstevel@tonic-gate   }
1757*0Sstevel@tonic-gate 
1758*0Sstevel@tonic-gate   return( (char *)oo );
1759*0Sstevel@tonic-gate }
1760*0Sstevel@tonic-gate 
1761*0Sstevel@tonic-gate /* --- routine to convert from T.61 to printable characters --- */
1762*0Sstevel@tonic-gate 
1763*0Sstevel@tonic-gate /*
1764*0Sstevel@tonic-gate    printable characters [RFC 1488]: 'A'..'Z', 'a'..'z', '0'..'9',
1765*0Sstevel@tonic-gate        '\'', '(', ')', '+', ',', '-', '.', '/', ':', '?, ' '.
1766*0Sstevel@tonic-gate 
1767*0Sstevel@tonic-gate    that conversion is language dependent.
1768*0Sstevel@tonic-gate */
1769*0Sstevel@tonic-gate 
1770*0Sstevel@tonic-gate static Couple last_t61_printabled[32] = {
1771*0Sstevel@tonic-gate 	{0,0},     {'A','E'}, {'D',0},   {0,0},
1772*0Sstevel@tonic-gate 	{'H',0},   {0,0},     {'I','J'}, {'L',0},
1773*0Sstevel@tonic-gate 	{'L',0},   {'O',0},   {'O','E'}, {0,0},
1774*0Sstevel@tonic-gate 	{'T','H'}, {'T',0},   {'N','G'}, {'n',0},
1775*0Sstevel@tonic-gate 	{'k',0},   {'a','e'}, {'d',0},   {'d',0},
1776*0Sstevel@tonic-gate 	{'h',0},   {'i',0},   {'i','j'}, {'l',0},
1777*0Sstevel@tonic-gate 	{'l',0},   {'o',0},   {'o','e'}, {'s','s'},
1778*0Sstevel@tonic-gate 	{'t','h'}, {'t',0},   {'n','g'}, {0,0}
1779*0Sstevel@tonic-gate };
1780*0Sstevel@tonic-gate 
t61_printable(s)1781*0Sstevel@tonic-gate char *t61_printable( s )
1782*0Sstevel@tonic-gate Byte  *s;
1783*0Sstevel@tonic-gate {
1784*0Sstevel@tonic-gate   Byte   *o, *oo;
1785*0Sstevel@tonic-gate   Byte   n;
1786*0Sstevel@tonic-gate   Couple *cc;
1787*0Sstevel@tonic-gate 
1788*0Sstevel@tonic-gate   if ( (o = oo = (Byte *)NSLDAPI_MALLOC( 2 * strlen( s ) + 64 )) == NULL ) {
1789*0Sstevel@tonic-gate         return( NULL );
1790*0Sstevel@tonic-gate   }
1791*0Sstevel@tonic-gate 
1792*0Sstevel@tonic-gate   while ( *s ) {
1793*0Sstevel@tonic-gate     if ( ( (*s >= 'A') && (*s <= 'Z') ) ||
1794*0Sstevel@tonic-gate          ( (*s >= 'a') && (*s <= 'z') ) ||
1795*0Sstevel@tonic-gate          ( (*s >= '0') && (*s <= '9') ) ||
1796*0Sstevel@tonic-gate          ( (*s >= '\'') && (*s <= ')') ) ||
1797*0Sstevel@tonic-gate          ( (*s >= '+') && (*s <= '/') ) ||
1798*0Sstevel@tonic-gate          ( *s == '?' ) || ( *s == ' ' ) )
1799*0Sstevel@tonic-gate       *o++ = *s++;
1800*0Sstevel@tonic-gate     else {
1801*0Sstevel@tonic-gate       if ( *s >= 0xE0 ) {
1802*0Sstevel@tonic-gate 	if ( (*(cc = &last_t61_printabled[ *s - 0xE0 ])).a ) {
1803*0Sstevel@tonic-gate           *o++ = (*cc).a;
1804*0Sstevel@tonic-gate           if ( (*cc).b )  *o++ = (*cc).b;
1805*0Sstevel@tonic-gate         }
1806*0Sstevel@tonic-gate       }
1807*0Sstevel@tonic-gate       else if ( (*s >> 4) == 0xC ) {
1808*0Sstevel@tonic-gate         switch ( *s ) {
1809*0Sstevel@tonic-gate 	case 0xCA:			/* ring */
1810*0Sstevel@tonic-gate 	  switch ( *(s + 1) ) {
1811*0Sstevel@tonic-gate 	  case 'A':  *o++ = 'A'; *o++ = 'A'; s++; break; /* Swedish */
1812*0Sstevel@tonic-gate 	  case 'a':  *o++ = 'a'; *o++ = 'a'; s++; break; /* Swedish */
1813*0Sstevel@tonic-gate 	  }
1814*0Sstevel@tonic-gate 	  break;
1815*0Sstevel@tonic-gate 
1816*0Sstevel@tonic-gate 	case 0xC8:			/* diaeresis */
1817*0Sstevel@tonic-gate 	  switch ( *(s + 1) ) {
1818*0Sstevel@tonic-gate 	  case 'Y':  *o++ = 'I'; *o++ = 'J'; s++; break; /* Dutch */
1819*0Sstevel@tonic-gate 	  case 'y':  *o++ = 'i'; *o++ = 'j'; s++; break; /* Dutch */
1820*0Sstevel@tonic-gate           }
1821*0Sstevel@tonic-gate 	  break;
1822*0Sstevel@tonic-gate         }
1823*0Sstevel@tonic-gate       }
1824*0Sstevel@tonic-gate       s++;
1825*0Sstevel@tonic-gate     }
1826*0Sstevel@tonic-gate   }
1827*0Sstevel@tonic-gate   *o = '\0';
1828*0Sstevel@tonic-gate 
1829*0Sstevel@tonic-gate   o = oo;
1830*0Sstevel@tonic-gate 
1831*0Sstevel@tonic-gate   if ( (oo = (Byte *)NSLDAPI_REALLOC( o, strlen( o ) + 1 )) == NULL ) {
1832*0Sstevel@tonic-gate     NSLDAPI_FREE( o );
1833*0Sstevel@tonic-gate     return( NULL );
1834*0Sstevel@tonic-gate   }
1835*0Sstevel@tonic-gate 
1836*0Sstevel@tonic-gate   return( (char *)oo );
1837*0Sstevel@tonic-gate }
1838*0Sstevel@tonic-gate #endif /* NOT_NEEDED_IN_LIBLDAP */	/* mcs@umich.edu 12 Oct 1995 */
1839*0Sstevel@tonic-gate 
1840*0Sstevel@tonic-gate #endif /* LDAP_CHARSET_8859 */
1841*0Sstevel@tonic-gate #endif /* STR_TRANSLATION */
1842