xref: /onnv-gate/usr/src/lib/libldap4/common/charset.c (revision 3857:21b9b714e4ab)
10Sstevel@tonic-gate /*
2*3857Sstevel  * Portions Copyright 1998 Sun Microsystems, Inc.  All rights reserved.
3*3857Sstevel  * Use is subject to license terms.
40Sstevel@tonic-gate  */
50Sstevel@tonic-gate 
60Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
70Sstevel@tonic-gate 
80Sstevel@tonic-gate /*
90Sstevel@tonic-gate  *  Copyright (c) 1995 Regents of the University of Michigan.
100Sstevel@tonic-gate  *  All rights reserved.
110Sstevel@tonic-gate  *
120Sstevel@tonic-gate  *  charset.c
130Sstevel@tonic-gate  */
140Sstevel@tonic-gate 
150Sstevel@tonic-gate #if defined( DOS ) || defined( _WIN32 )
160Sstevel@tonic-gate /*
170Sstevel@tonic-gate  * This MUST precede "#ifdef STR_TRANSLATION"
180Sstevel@tonic-gate  * because STR_TRANSLATION and friends are defined in msdos.h.
190Sstevel@tonic-gate  */
200Sstevel@tonic-gate #include "msdos.h"
210Sstevel@tonic-gate #endif /* DOS */
220Sstevel@tonic-gate 
230Sstevel@tonic-gate #ifdef STR_TRANSLATION
240Sstevel@tonic-gate 
250Sstevel@tonic-gate #ifndef lint
260Sstevel@tonic-gate static char copyright[] = "@(#) Copyright (c) 1995 Regents of the University of Michigan.\nAll rights reserved.\n";
270Sstevel@tonic-gate #endif
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #include <stdio.h>
300Sstevel@tonic-gate #include <string.h>
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #ifdef MACOS
330Sstevel@tonic-gate #include <stdlib.h>
340Sstevel@tonic-gate #include "macos.h"
350Sstevel@tonic-gate #endif /* MACOS */
360Sstevel@tonic-gate 
370Sstevel@tonic-gate #if !defined(MACOS) && !defined(DOS) && !defined( _WIN32 ) && !defined(VMS)
380Sstevel@tonic-gate #include <sys/time.h>
390Sstevel@tonic-gate #include <sys/types.h>
400Sstevel@tonic-gate #include <sys/socket.h>
410Sstevel@tonic-gate #include <sys/param.h>
420Sstevel@tonic-gate #endif
430Sstevel@tonic-gate #include "lber.h"
440Sstevel@tonic-gate #include "ldap.h"
450Sstevel@tonic-gate #include "ldap-private.h"
460Sstevel@tonic-gate #include "ldap-int.h"
470Sstevel@tonic-gate 
480Sstevel@tonic-gate 
490Sstevel@tonic-gate void
ldap_set_string_translators(LDAP * ld,BERTranslateProc encode_proc,BERTranslateProc decode_proc)500Sstevel@tonic-gate ldap_set_string_translators( LDAP *ld, BERTranslateProc encode_proc,
510Sstevel@tonic-gate 	BERTranslateProc decode_proc )
520Sstevel@tonic-gate {
530Sstevel@tonic-gate #if defined( SUN ) && defined( _REENTRANT )
540Sstevel@tonic-gate 	LOCK_LDAP(ld);
550Sstevel@tonic-gate #endif
560Sstevel@tonic-gate 	ld->ld_lber_encode_translate_proc = encode_proc;
570Sstevel@tonic-gate 	ld->ld_lber_decode_translate_proc = decode_proc;
580Sstevel@tonic-gate #if defined( SUN ) && defined( _REENTRANT )
590Sstevel@tonic-gate 	UNLOCK_LDAP(ld);
600Sstevel@tonic-gate #endif
610Sstevel@tonic-gate }
620Sstevel@tonic-gate 
630Sstevel@tonic-gate 
640Sstevel@tonic-gate void
ldap_enable_translation(LDAP * ld,LDAPMessage * entry,int enable)650Sstevel@tonic-gate ldap_enable_translation( LDAP *ld, LDAPMessage *entry, int enable )
660Sstevel@tonic-gate {
670Sstevel@tonic-gate 	char	*optionsp;
680Sstevel@tonic-gate 
690Sstevel@tonic-gate #if defined( SUN ) && defined( _REENTRANT )
700Sstevel@tonic-gate 	LOCK_LDAP(ld);
710Sstevel@tonic-gate #endif
720Sstevel@tonic-gate 	optionsp = ( entry == NULLMSG ) ? &ld->ld_lberoptions :
730Sstevel@tonic-gate 	    &entry->lm_ber->ber_options;
740Sstevel@tonic-gate 
750Sstevel@tonic-gate 	if ( enable ) {
760Sstevel@tonic-gate 		*optionsp |= LBER_TRANSLATE_STRINGS;
770Sstevel@tonic-gate 	} else {
780Sstevel@tonic-gate 		*optionsp &= ~LBER_TRANSLATE_STRINGS;
790Sstevel@tonic-gate 	}
800Sstevel@tonic-gate #if defined( SUN ) && defined( _REENTRANT )
810Sstevel@tonic-gate 	UNLOCK_LDAP(ld);
820Sstevel@tonic-gate #endif
830Sstevel@tonic-gate }
840Sstevel@tonic-gate 
850Sstevel@tonic-gate 
860Sstevel@tonic-gate int
ldap_translate_from_t61(LDAP * ld,char ** bufp,unsigned int * lenp,int free_input)870Sstevel@tonic-gate ldap_translate_from_t61( LDAP *ld, char **bufp, unsigned int *lenp,
880Sstevel@tonic-gate     int free_input )
890Sstevel@tonic-gate {
900Sstevel@tonic-gate #if defined( SUN ) && defined( _REENTRANT )
910Sstevel@tonic-gate 	BERTranslateProc decode_proc;
920Sstevel@tonic-gate 
930Sstevel@tonic-gate 	LOCK_LDAP(ld);
940Sstevel@tonic-gate #endif
950Sstevel@tonic-gate 	if ( ld->ld_lber_decode_translate_proc == NULL ) {
960Sstevel@tonic-gate #if defined( SUN ) && defined( _REENTRANT )
970Sstevel@tonic-gate 		UNLOCK_LDAP(ld);
980Sstevel@tonic-gate #endif
990Sstevel@tonic-gate 		return( LDAP_SUCCESS );
1000Sstevel@tonic-gate 	}
1010Sstevel@tonic-gate #if defined( SUN ) && defined( _REENTRANT )
1020Sstevel@tonic-gate 	decode_proc = ld->ld_lber_decode_translate_proc;
1030Sstevel@tonic-gate 	UNLOCK_LDAP(ld);
1040Sstevel@tonic-gate 
1050Sstevel@tonic-gate 	return( (*decode_proc)( bufp, lenp, free_input ));
1060Sstevel@tonic-gate #else
1070Sstevel@tonic-gate 	return( (*ld->ld_lber_decode_translate_proc)( bufp, lenp, free_input ));
1080Sstevel@tonic-gate #endif
1090Sstevel@tonic-gate }
1100Sstevel@tonic-gate 
1110Sstevel@tonic-gate 
1120Sstevel@tonic-gate int
ldap_translate_to_t61(LDAP * ld,char ** bufp,unsigned int * lenp,int free_input)1130Sstevel@tonic-gate ldap_translate_to_t61( LDAP *ld, char **bufp, unsigned int *lenp,
1140Sstevel@tonic-gate     int free_input )
1150Sstevel@tonic-gate {
1160Sstevel@tonic-gate #if defined( SUN ) && defined( _REENTRANT )
1170Sstevel@tonic-gate 	BERTranslateProc encode_proc;
1180Sstevel@tonic-gate 
1190Sstevel@tonic-gate 	LOCK_LDAP(ld);
1200Sstevel@tonic-gate #endif
1210Sstevel@tonic-gate 	if ( ld->ld_lber_encode_translate_proc == NULL ) {
1220Sstevel@tonic-gate #if defined( SUN ) && defined( _REENTRANT )
1230Sstevel@tonic-gate 	UNLOCK_LDAP(ld);
1240Sstevel@tonic-gate #endif
1250Sstevel@tonic-gate 		return( LDAP_SUCCESS );
1260Sstevel@tonic-gate 	}
1270Sstevel@tonic-gate 
1280Sstevel@tonic-gate #if defined( SUN ) && defined( _REENTRANT )
1290Sstevel@tonic-gate 	encode_proc = ld->ld_lber_encode_translate_proc;
1300Sstevel@tonic-gate 	UNLOCK_LDAP(ld);
1310Sstevel@tonic-gate 	return( (*encode_proc)( bufp, lenp, free_input ));
1320Sstevel@tonic-gate #else
1330Sstevel@tonic-gate 	return( (*ld->ld_lber_encode_translate_proc)( bufp, lenp, free_input ));
1340Sstevel@tonic-gate #endif
1350Sstevel@tonic-gate }
1360Sstevel@tonic-gate 
1370Sstevel@tonic-gate 
1380Sstevel@tonic-gate /*
1390Sstevel@tonic-gate  ** Character translation routine notes:
1400Sstevel@tonic-gate  *
1410Sstevel@tonic-gate  * On entry:  bufp points to a "string" to be converted (not necessarily
1420Sstevel@tonic-gate  *  zero-terminated) and buflenp points to the length of the buffer.
1430Sstevel@tonic-gate  *
1440Sstevel@tonic-gate  * On exit:  bufp should point to a malloc'd result.  If free_input is
1450Sstevel@tonic-gate  *  non-zero then the original bufp will be freed.  *buflenp should be
1460Sstevel@tonic-gate  *  set to the new length.  Zero bytes in the input buffer must be left
1470Sstevel@tonic-gate  *  as zero bytes.
1480Sstevel@tonic-gate  *
1490Sstevel@tonic-gate  * Return values: any ldap error code (LDAP_SUCCESS if all goes well).
1500Sstevel@tonic-gate  */
1510Sstevel@tonic-gate 
1520Sstevel@tonic-gate 
1530Sstevel@tonic-gate #ifdef LDAP_CHARSET_8859
1540Sstevel@tonic-gate 
1550Sstevel@tonic-gate #if LDAP_CHARSET_8859 == 88591
1560Sstevel@tonic-gate #define ISO_8859 1
1570Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88592
1580Sstevel@tonic-gate #define ISO_8859 2
1590Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88593
1600Sstevel@tonic-gate #define ISO_8859 3
1610Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88594
1620Sstevel@tonic-gate #define ISO_8859 4
1630Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88595
1640Sstevel@tonic-gate #define ISO_8859 5
1650Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88596
1660Sstevel@tonic-gate #define ISO_8859 6
1670Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88597
1680Sstevel@tonic-gate #define ISO_8859 7
1690Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88598
1700Sstevel@tonic-gate #define ISO_8859 8
1710Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 88599
1720Sstevel@tonic-gate #define ISO_8859 9
1730Sstevel@tonic-gate #elif LDAP_CHARSET_8859 == 885910
1740Sstevel@tonic-gate #define ISO_8859 10
1750Sstevel@tonic-gate #else
1760Sstevel@tonic-gate #define ISO_8859 0
1770Sstevel@tonic-gate #endif
1780Sstevel@tonic-gate 
1790Sstevel@tonic-gate /*
1800Sstevel@tonic-gate  * the following ISO_8859 to/afrom T.61 character set translation code is
1810Sstevel@tonic-gate  * based on the code found in Enrique Silvestre Mora's iso-t61.c, found
1820Sstevel@tonic-gate  * as part of this package:
1830Sstevel@tonic-gate  *   ftp://pereiii.uji.es/pub/uji-ftp/unix/ldap/iso-t61.translation.tar.Z
1840Sstevel@tonic-gate  * Enrique is now (10/95) at this address: enrique.silvestre@uv.es
1850Sstevel@tonic-gate  *
1860Sstevel@tonic-gate  * changes made by mcs@umich.edu 12 October 1995:
1870Sstevel@tonic-gate  *   Change calling conventions of iso8859_t61() and t61_iso8859() to
1880Sstevel@tonic-gate  *	match libldap conventions; rename to ldap_8859_to_t61() and
1890Sstevel@tonic-gate  *	ldap_t61_to_8859().
1900Sstevel@tonic-gate  *   Change conversion routines to deal with non-zero terminated strings.
1910Sstevel@tonic-gate  *   ANSI-ize functions and include prototypes.
1920Sstevel@tonic-gate  */
1930Sstevel@tonic-gate 
1940Sstevel@tonic-gate /* iso-t61.c - ISO-T61 translation routines (version: 0.2.1, July-1994) */
1950Sstevel@tonic-gate /*
1960Sstevel@tonic-gate  * Copyright (c) 1994 Enrique Silvestre Mora, Universitat Jaume I, Spain.
1970Sstevel@tonic-gate  * All rights reserved.
1980Sstevel@tonic-gate  *
1990Sstevel@tonic-gate  * Redistribution and use in source and binary forms are permitted
2000Sstevel@tonic-gate  * provided that this notice is preserved and that due credit is given
2010Sstevel@tonic-gate  * to the Universitat Jaume I. The name of the University
2020Sstevel@tonic-gate  * may not be used to endorse or promote products derived from this
2030Sstevel@tonic-gate  * software without specific prior written permission. This software
2040Sstevel@tonic-gate  * is provided ``as is'' without express or implied warranty.
2050Sstevel@tonic-gate */
2060Sstevel@tonic-gate 
2070Sstevel@tonic-gate 
2080Sstevel@tonic-gate #include <stdio.h>
2090Sstevel@tonic-gate #include <stdlib.h>
2100Sstevel@tonic-gate #include <string.h>
2110Sstevel@tonic-gate 
2120Sstevel@tonic-gate /* Character set used: ISO 8859-1, ISO 8859-2, ISO 8859-3, ... */
2130Sstevel@tonic-gate /* #define  ISO_8859      1 */
2140Sstevel@tonic-gate 
2150Sstevel@tonic-gate #ifndef ISO_8859
2160Sstevel@tonic-gate #  define ISO_8859     0
2170Sstevel@tonic-gate #endif
2180Sstevel@tonic-gate 
2190Sstevel@tonic-gate typedef unsigned char  Byte;
2200Sstevel@tonic-gate typedef struct { Byte  a, b; } Couple;
2210Sstevel@tonic-gate 
2220Sstevel@tonic-gate #ifdef NEEDPROTOS
2230Sstevel@tonic-gate static Byte *c_to_hh( Byte *o, Byte c );
2240Sstevel@tonic-gate static Byte *c_to_cc( Byte *o, Couple *cc, Byte c );
2250Sstevel@tonic-gate static int hh_to_c( Byte *h );
2260Sstevel@tonic-gate static Byte *cc_to_t61( Byte *o, Byte *s );
2270Sstevel@tonic-gate #else /* NEEDPROTOS */
2280Sstevel@tonic-gate static Byte *c_to_hh();
2290Sstevel@tonic-gate static Byte *c_to_cc();
2300Sstevel@tonic-gate static int hh_to_c();
2310Sstevel@tonic-gate static Byte *cc_to_t61();
2320Sstevel@tonic-gate #endif /* NEEDPROTOS */
2330Sstevel@tonic-gate 
2340Sstevel@tonic-gate /*
2350Sstevel@tonic-gate    Character choosed as base in diacritics alone: NO-BREAK SPACE.
2360Sstevel@tonic-gate    (The standard say it must be a blank space, 0x20.)
2370Sstevel@tonic-gate */
2380Sstevel@tonic-gate #define  ALONE  0xA0
2390Sstevel@tonic-gate 
2400Sstevel@tonic-gate static Couple diacritic[16] = {
2410Sstevel@tonic-gate #if (ISO_8859 == 1) || (ISO_8859 == 9)
2420Sstevel@tonic-gate 	{0,0},       {'`',0},     {0xb4,0},    {'^',0},
2430Sstevel@tonic-gate 	{'~',0},     {0xaf,0},    {'(',ALONE}, {'.',ALONE},
2440Sstevel@tonic-gate 	{0xa8,0},    {0,0},       {'0',ALONE}, {0xb8,0},
2450Sstevel@tonic-gate 	{0,0},       {'"',ALONE}, {';',ALONE}, {'<',ALONE},
2460Sstevel@tonic-gate #elif (ISO_8859 == 2)
2470Sstevel@tonic-gate 	{0,0},       {'`',0},     {0xb4,0},    {'^',0},
2480Sstevel@tonic-gate 	{'~',0},     {'-',ALONE}, {0xa2,0},    {0xff,0},
2490Sstevel@tonic-gate 	{0xa8,0},    {0,0},       {'0',ALONE}, {0xb8,0},
2500Sstevel@tonic-gate 	{0,0},       {0xbd,0},    {0xb2,0},    {0xb7,0}
2510Sstevel@tonic-gate #elif (ISO_8859 == 3)
2520Sstevel@tonic-gate 	{0,0},       {'`',0},     {0xb4,0},    {'^',0},
2530Sstevel@tonic-gate 	{'~',0},     {'-',ALONE}, {0xa2,0},    {0xff,0},
2540Sstevel@tonic-gate 	{0xa8,0},    {0,0},       {'0',ALONE}, {0xb8,0},
2550Sstevel@tonic-gate 	{0,0},       {'"',ALONE}, {';',ALONE}, {'<',ALONE}
2560Sstevel@tonic-gate #elif (ISO_8859 == 4)
2570Sstevel@tonic-gate 	{0,0},       {'`',0},     {0xb4,0},    {'^',0},
2580Sstevel@tonic-gate 	{'~',0},     {0xaf,0},    {'(',ALONE}, {0xff,0},
2590Sstevel@tonic-gate 	{0xa8,0},    {0,0},       {'0',ALONE}, {0xb8,0},
2600Sstevel@tonic-gate 	{0,0},       {'"',ALONE}, {0xb2,0},    {0xb7,0}
2610Sstevel@tonic-gate #else
2620Sstevel@tonic-gate 	{0,0},       {'`',0},     {'\'',ALONE}, {'^',0},
2630Sstevel@tonic-gate 	{'~',0},     {'-',ALONE}, {'(',ALONE},  {'.',ALONE},
2640Sstevel@tonic-gate 	{':',ALONE}, {0,0},       {'0',ALONE},  {',',ALONE},
2650Sstevel@tonic-gate 	{0,0},       {'"',ALONE}, {';',ALONE},  {'<',ALONE}
2660Sstevel@tonic-gate #endif
2670Sstevel@tonic-gate };
2680Sstevel@tonic-gate 
2690Sstevel@tonic-gate /*
2700Sstevel@tonic-gate    --- T.61 (T.51) letters with diacritics: conversion to ISO 8859-n -----
2710Sstevel@tonic-gate        A,   C,   D,   E,   G,   H,   I,   J,   K,
2720Sstevel@tonic-gate        L,   N,   O,   R,   S,   T,   U,   W,   Y,   Z.
2730Sstevel@tonic-gate    -----------------------------------------------------------------------
2740Sstevel@tonic-gate */
2750Sstevel@tonic-gate static int letter_w_diacritic[16][38] = {
2760Sstevel@tonic-gate #if (ISO_8859 == 1)
2770Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
2780Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
2790Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
2800Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
2810Sstevel@tonic-gate 	0xc0,0,   0,   0xc8,0,   0,   0xcc,0,   0,
2820Sstevel@tonic-gate 	0,   0,   0xd2,0,   0,   0,   0xd9,0,   0,   0,
2830Sstevel@tonic-gate 	0xe0,0,   0,   0xe8,0,   0,   0xec,0,   0,
2840Sstevel@tonic-gate 	0,   0,   0xf2,0,   0,   0,   0xf9,0,   0,   0,
2850Sstevel@tonic-gate 	0xc1,-1,  0,   0xc9,0,   0,   0xcd,0,   0,
2860Sstevel@tonic-gate 	-1,  -1,  0xd3,-1,  -1,  0,   0xda,0,   0xdd,-1,
2870Sstevel@tonic-gate 	0xe1,-1,  0,   0xe9,0,   0,   0xed,0,   0,
2880Sstevel@tonic-gate 	-1,  -1,  0xf3,-1,  -1,  0,   0xfa,0,   0xfd,-1,
2890Sstevel@tonic-gate 	0xc2,-1,  0,   0xca,-1,  -1,  0xce,-1,  0,
2900Sstevel@tonic-gate 	0,   0,   0xd4,0,   -1,  0,   0xdb,-1,  -1,  0,
2910Sstevel@tonic-gate 	0xe2,-1,  0,   0xea,-1,  -1,  0xee,-1,  0,
2920Sstevel@tonic-gate 	0,   0,   0xf4,0,   -1,  0,   0xfb,-1,  -1,  0,
2930Sstevel@tonic-gate 	0xc3,0,   0,   0,   0,   0,   -1,  0,   0,
2940Sstevel@tonic-gate 	0,   0xd1,0xd5,0,   0,   0,   -1,  0,   0,   0,
2950Sstevel@tonic-gate 	0xe3,0,   0,   0,   0,   0,   -1,  0,   0,
2960Sstevel@tonic-gate 	0,   0xf1,0xf5,0,   0,   0,   -1,  0,   0,   0,
2970Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
2980Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
2990Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
3000Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
3010Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
3020Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
3030Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
3040Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
3050Sstevel@tonic-gate 	0,   -1,  0,   -1,  -1,  0,   -1,  0,   0,
3060Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
3070Sstevel@tonic-gate 	0,   -1,  0,   -1,  -1,  0,   0,   0,   0,
3080Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
3090Sstevel@tonic-gate 	0xc4,0,   0,   0xcb,0,   0,   0xcf,0,   0,
3100Sstevel@tonic-gate 	0,   0,   0xd6,0,   0,   0,   0xdc,0,   -1,  0,
3110Sstevel@tonic-gate 	0xe4,0,   0,   0xeb,0,   0,   0xef,0,   0,
3120Sstevel@tonic-gate 	0,   0,   0xf6,0,   0,   0,   0xfc,0,   0xff,0,
3130Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
3140Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
3150Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
3160Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
3170Sstevel@tonic-gate 	0xc5,0,   0,   0,   0,   0,   0,   0,   0,
3180Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
3190Sstevel@tonic-gate 	0xe5,0,   0,   0,   0,   0,   0,   0,   0,
3200Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
3210Sstevel@tonic-gate 	0,   0xc7,0,   0,   -1,  0,   0,   0,   -1,
3220Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   0,
3230Sstevel@tonic-gate 	0,   0xe7,0,   0,   -1,  0,   0,   0,   -1,
3240Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   0,
3250Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
3260Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
3270Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
3280Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
3290Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
3300Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
3310Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
3320Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
3330Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
3340Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
3350Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
3360Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
3370Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
3380Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1,
3390Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
3400Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1
3410Sstevel@tonic-gate #elif (ISO_8859 == 2)
3420Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
3430Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
3440Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
3450Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
3460Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
3470Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
3480Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
3490Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
3500Sstevel@tonic-gate 	0xc1,0xc6,0,   0xc9,0,   0,   0xcd,0,   0,
3510Sstevel@tonic-gate 	0xc5,0xd1,0xd3,0xc0,0xa6,0,   0xda,0,   0xdd,0xac,
3520Sstevel@tonic-gate 	0xe1,0xe6,0,   0xe9,0,   0,   0xed,0,   0,
3530Sstevel@tonic-gate 	0xe5,0xf1,0xf3,0xe0,0xb6,0,   0xfa,0,   0xfd,0xbc,
3540Sstevel@tonic-gate 	0xc2,-1,  0,   -1,  -1,  -1,  0xce,-1,  0,
3550Sstevel@tonic-gate 	0,   0,   0xd4,0,   -1,  0,   -1,  -1,  -1,  0,
3560Sstevel@tonic-gate 	0xe2,-1,  0,   -1,  -1,  -1,  0xee,-1,  0,
3570Sstevel@tonic-gate 	0,   0,   0xf4,0,   -1,  0,   -1,  -1,  -1,  0,
3580Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   -1,  0,   0,
3590Sstevel@tonic-gate 	0,   -1,  -1,  0,   0,   0,   -1,  0,   0,   0,
3600Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   -1,  0,   0,
3610Sstevel@tonic-gate 	0,   -1,  -1,  0,   0,   0,   -1,  0,   0,   0,
3620Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
3630Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
3640Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
3650Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
3660Sstevel@tonic-gate 	0xc3,0,   0,   0,   -1,  0,   0,   0,   0,
3670Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
3680Sstevel@tonic-gate 	0xe3,0,   0,   0,   -1,  0,   0,   0,   0,
3690Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
3700Sstevel@tonic-gate 	0,   -1,  0,   -1,  -1,  0,   -1,  0,   0,
3710Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0xaf,
3720Sstevel@tonic-gate 	0,   -1,  0,   -1,  -1,  0,   0,   0,   0,
3730Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0xbf,
3740Sstevel@tonic-gate 	0xc4,0,   0,   0xcb,0,   0,   -1,  0,   0,
3750Sstevel@tonic-gate 	0,   0,   0xd6,0,   0,   0,   0xdc,0,   -1,  0,
3760Sstevel@tonic-gate 	0xe4,0,   0,   0xeb,0,   0,   -1,  0,   0,
3770Sstevel@tonic-gate 	0,   0,   0xf6,0,   0,   0,   0xfc,0,   -1,  0,
3780Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
3790Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
3800Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
3810Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
3820Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   0,   0,   0,
3830Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xd9,0,   0,   0,
3840Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   0,   0,   0,
3850Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xf9,0,   0,   0,
3860Sstevel@tonic-gate 	0,   0xc7,0,   0,   -1,  0,   0,   0,   -1,
3870Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xaa,0xde,0,   0,   0,   0,
3880Sstevel@tonic-gate 	0,   0xe7,0,   0,   -1,  0,   0,   0,   -1,
3890Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xba,0xfe,0,   0,   0,   0,
3900Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
3910Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
3920Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
3930Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
3940Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
3950Sstevel@tonic-gate 	0,   0,   0xd5,0,   0,   0,   0xdb,0,   0,   0,
3960Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
3970Sstevel@tonic-gate 	0,   0,   0xf5,0,   0,   0,   0xfb,0,   0,   0,
3980Sstevel@tonic-gate 	0xa1,0,   0,   0xca,0,   0,   -1,  0,   0,
3990Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
4000Sstevel@tonic-gate 	0xb1,0,   0,   0xea,0,   0,   -1,  0,   0,
4010Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
4020Sstevel@tonic-gate 	0,   0xc8,0xcf,0xcc,0,   0,   0,   0,   0,
4030Sstevel@tonic-gate 	0xa5,0xd2,0,   0xd8,0xa9,0xab,0,   0,   0,   0xae,
4040Sstevel@tonic-gate 	0,   0xe8,0xef,0xec,0,   0,   0,   0,   0,
4050Sstevel@tonic-gate 	0xb5,0xf2,0,   0xf8,0xb9,0xbb,0,   0,   0,   0xbe
4060Sstevel@tonic-gate #elif (ISO_8859 == 3)
4070Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
4080Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
4090Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
4100Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
4110Sstevel@tonic-gate 	0xc0,0,   0,   0xc8,0,   0,   0xcc,0,   0,
4120Sstevel@tonic-gate 	0,   0,   0xd2,0,   0,   0,   0xd9,0,   0,   0,
4130Sstevel@tonic-gate 	0xe0,0,   0,   0xe8,0,   0,   0xec,0,   0,
4140Sstevel@tonic-gate 	0,   0,   0xf2,0,   0,   0,   0xf9,0,   0,   0,
4150Sstevel@tonic-gate 	0xc1,-1,  0,   0xc9,0,   0,   0xcd,0,   0,
4160Sstevel@tonic-gate 	-1,  -1,  0xd3,-1,  -1,  0,   0xda,0,   -1,  -1,
4170Sstevel@tonic-gate 	0xe1,-1,  0,   0xe9,0,   0,   0xed,0,   0,
4180Sstevel@tonic-gate 	-1,  -1,  0xf3,-1,  -1,  0,   0xfa,0,   -1,  -1,
4190Sstevel@tonic-gate 	0xc2,0xc6,0,   0xca,0xd8,0xa6,0xce,0xac,0,
4200Sstevel@tonic-gate 	0,   0,   0xd4,0,   0xde,0,   0xdb,-1,  -1,  0,
4210Sstevel@tonic-gate 	0xe2,0xe6,0,   0xea,0xf8,0xb6,0xee,0xbc,0,
4220Sstevel@tonic-gate 	0,   0,   0xf4,0,   0xfe,0,   0xfb,-1,  -1,  0,
4230Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   -1,  0,   0,
4240Sstevel@tonic-gate 	0,   0xd1,-1,  0,   0,   0,   -1,  0,   0,   0,
4250Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   -1,  0,   0,
4260Sstevel@tonic-gate 	0,   0xf1,-1,  0,   0,   0,   -1,  0,   0,   0,
4270Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
4280Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
4290Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
4300Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
4310Sstevel@tonic-gate 	-1,  0,   0,   0,   0xab,0,   0,   0,   0,
4320Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xdd,0,   0,   0,
4330Sstevel@tonic-gate 	-1,  0,   0,   0,   0xbb,0,   0,   0,   0,
4340Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xfd,0,   0,   0,
4350Sstevel@tonic-gate 	0,   0xc5,0,   -1,  0xd5,0,   0xa9,0,   0,
4360Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0xaf,
4370Sstevel@tonic-gate 	0,   0xe5,0,   -1,  0xf5,0,   0,   0,   0,
4380Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0xbf,
4390Sstevel@tonic-gate 	0xc4,0,   0,   0xcb,0,   0,   0xcf,0,   0,
4400Sstevel@tonic-gate 	0,   0,   0xd6,0,   0,   0,   0xdc,0,   -1,  0,
4410Sstevel@tonic-gate 	0xe4,0,   0,   0xeb,0,   0,   0xef,0,   0,
4420Sstevel@tonic-gate 	0,   0,   0xf6,0,   0,   0,   0xfc,0,   -1,  0,
4430Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
4440Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
4450Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
4460Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
4470Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   0,   0,   0,
4480Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
4490Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   0,   0,   0,
4500Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
4510Sstevel@tonic-gate 	0,   0xc7,0,   0,   -1,  0,   0,   0,   -1,
4520Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xaa,-1,  0,   0,   0,   0,
4530Sstevel@tonic-gate 	0,   0xe7,0,   0,   -1,  0,   0,   0,   -1,
4540Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xba,-1,  0,   0,   0,   0,
4550Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
4560Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
4570Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
4580Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
4590Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
4600Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
4610Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
4620Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
4630Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
4640Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
4650Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
4660Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
4670Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
4680Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1,
4690Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
4700Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1
4710Sstevel@tonic-gate #elif (ISO_8859 == 4)
4720Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
4730Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
4740Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
4750Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
4760Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
4770Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
4780Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
4790Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
4800Sstevel@tonic-gate 	0xc1,-1,  0,   0xc9,0,   0,   0xcd,0,   0,
4810Sstevel@tonic-gate 	-1,  -1,  -1,  -1,  -1,  0,   0xda,0,   -1,  -1,
4820Sstevel@tonic-gate 	0xe1,-1,  0,   0xe9,0,   0,   0xed,0,   0,
4830Sstevel@tonic-gate 	-1,  -1,  -1,  -1,  -1,  0,   0xfa,0,   -1,  -1,
4840Sstevel@tonic-gate 	0xc2,-1,  0,   -1,  -1,  -1,  0xce,-1,  0,
4850Sstevel@tonic-gate 	0,   0,   0xd4,0,   -1,  0,   0xdb,-1,  -1,  0,
4860Sstevel@tonic-gate 	0xe2,-1,  0,   -1,  -1,  -1,  0xee,-1,  0,
4870Sstevel@tonic-gate 	0,   0,   0xf4,0,   -1,  0,   0xfb,-1,  -1,  0,
4880Sstevel@tonic-gate 	0xc3,0,   0,   0,   0,   0,   0xa5,0,   0,
4890Sstevel@tonic-gate 	0,   -1,  0xd5,0,   0,   0,   0xdd,0,   0,   0,
4900Sstevel@tonic-gate 	0xe3,0,   0,   0,   0,   0,   0xb5,0,   0,
4910Sstevel@tonic-gate 	0,   -1,  0xf5,0,   0,   0,   0xfd,0,   0,   0,
4920Sstevel@tonic-gate 	0xc0,0,   0,   0xaa,0,   0,   0xcf,0,   0,
4930Sstevel@tonic-gate 	0,   0,   0xd2,0,   0,   0,   0xde,0,   0,   0,
4940Sstevel@tonic-gate 	0xe0,0,   0,   0xba,0,   0,   0xef,0,   0,
4950Sstevel@tonic-gate 	0,   0,   0xf2,0,   0,   0,   0xfe,0,   0,   0,
4960Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
4970Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
4980Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
4990Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
5000Sstevel@tonic-gate 	0,   -1,  0,   0xcc,-1,  0,   -1,  0,   0,
5010Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
5020Sstevel@tonic-gate 	0,   -1,  0,   0xec,-1,  0,   0,   0,   0,
5030Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
5040Sstevel@tonic-gate 	0xc4,0,   0,   0xcb,0,   0,   -1,  0,   0,
5050Sstevel@tonic-gate 	0,   0,   0xd6,0,   0,   0,   0xdc,0,   -1,  0,
5060Sstevel@tonic-gate 	0xe4,0,   0,   0xeb,0,   0,   -1,  0,   0,
5070Sstevel@tonic-gate 	0,   0,   0xf6,0,   0,   0,   0xfc,0,   -1,  0,
5080Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
5090Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
5100Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
5110Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
5120Sstevel@tonic-gate 	0xc5,0,   0,   0,   0,   0,   0,   0,   0,
5130Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
5140Sstevel@tonic-gate 	0xe5,0,   0,   0,   0,   0,   0,   0,   0,
5150Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
5160Sstevel@tonic-gate 	0,   -1,  0,   0,   0xab,0,   0,   0,   0xd3,
5170Sstevel@tonic-gate 	0xa6,0xd1,0,   0xa3,-1,  -1,  0,   0,   0,   0,
5180Sstevel@tonic-gate 	0,   -1,  0,   0,   0xbb,0,   0,   0,   0xf3,
5190Sstevel@tonic-gate 	0xb6,0xf1,0,   0xb3,-1,  -1,  0,   0,   0,   0,
5200Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
5210Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
5220Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
5230Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
5240Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
5250Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
5260Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
5270Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
5280Sstevel@tonic-gate 	0xa1,0,   0,   0xca,0,   0,   0xc7,0,   0,
5290Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xd9,0,   0,   0,
5300Sstevel@tonic-gate 	0xb1,0,   0,   0xea,0,   0,   0xe7,0,   0,
5310Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xf9,0,   0,   0,
5320Sstevel@tonic-gate 	0,   0xc8,-1,  -1,  0,   0,   0,   0,   0,
5330Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xa9,-1,  0,   0,   0,   0xae,
5340Sstevel@tonic-gate 	0,   0xe8,-1,  -1,  0,   0,   0,   0,   0,
5350Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xb9,-1,  0,   0,   0,   0xbe
5360Sstevel@tonic-gate #elif (ISO_8859 == 9)
5370Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
5380Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
5390Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
5400Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
5410Sstevel@tonic-gate 	0xc0,0,   0,   0xc8,0,   0,   0xcc,0,   0,
5420Sstevel@tonic-gate 	0,   0,   0xd2,0,   0,   0,   0xd9,0,   0,   0,
5430Sstevel@tonic-gate 	0xe0,0,   0,   0xe8,0,   0,   -1,  0,   0,
5440Sstevel@tonic-gate 	0,   0,   0xf2,0,   0,   0,   0xf9,0,   0,   0,
5450Sstevel@tonic-gate 	0xc1,-1,  0,   0xc9,0,   0,   0xcd,0,   0,
5460Sstevel@tonic-gate 	-1,  -1,  0xd3,-1,  -1,  0,   0xda,0,   -1,  -1,
5470Sstevel@tonic-gate 	0xe1,-1,  0,   0xe9,0,   0,   0xed,0,   0,
5480Sstevel@tonic-gate 	-1,  -1,  0xf3,-1,  -1,  0,   0xfa,0,   -1,  -1,
5490Sstevel@tonic-gate 	0xc2,-1,  0,   0xca,-1,  -1,  0xce,-1,  0,
5500Sstevel@tonic-gate 	0,   0,   0xd4,0,   -1,  0,   0xdb,-1,  -1,  0,
5510Sstevel@tonic-gate 	0xe2,-1,  0,   -1,  -1,  -1,  0xee,-1,  0,
5520Sstevel@tonic-gate 	0,   0,   0xf4,0,   -1,  0,   0xfb,-1,  -1,  0,
5530Sstevel@tonic-gate 	0xc3,0,   0,   0,   0,   0,   -1,  0,   0,
5540Sstevel@tonic-gate 	0,   0xd1,0xd5,0,   0,   0,   -1,  0,   0,   0,
5550Sstevel@tonic-gate 	0xe3,0,   0,   0,   0,   0,   -1,  0,   0,
5560Sstevel@tonic-gate 	0,   0xf1,0xf5,0,   0,   0,   -1,  0,   0,   0,
5570Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
5580Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
5590Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   0xef,0,   0,
5600Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
5610Sstevel@tonic-gate 	-1,  0,   0,   0,   0xd0,0,   0,   0,   0,
5620Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
5630Sstevel@tonic-gate 	-1,  0,   0,   0,   0xf0,0,   0,   0,   0,
5640Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
5650Sstevel@tonic-gate 	0,   -1,  0,   -1,  -1,  0,   0xdd,0,   0,
5660Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
5670Sstevel@tonic-gate 	0,   -1,  0,   0xec,-1,  0,   0,   0,   0,
5680Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
5690Sstevel@tonic-gate 	0xc4,0,   0,   0xcb,0,   0,   0xcf,0,   0,
5700Sstevel@tonic-gate 	0,   0,   0xd6,0,   0,   0,   0xdc,0,   -1,  0,
5710Sstevel@tonic-gate 	0xe4,0,   0,   0xeb,0,   0,   -1,  0,   0,
5720Sstevel@tonic-gate 	0,   0,   0xf6,0,   0,   0,   0xfc,0,   0xff,0,
5730Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
5740Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
5750Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
5760Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
5770Sstevel@tonic-gate 	0xc5,0,   0,   0,   0,   0,   0,   0,   0,
5780Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
5790Sstevel@tonic-gate 	0xe5,0,   0,   0,   0,   0,   0,   0,   0,
5800Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
5810Sstevel@tonic-gate 	0,   0xc7,0,   0,   -1,  0,   0,   0,   -1,
5820Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xde,-1,  0,   0,   0,   0,
5830Sstevel@tonic-gate 	0,   0xe7,0,   0,   -1,  0,   0,   0,   -1,
5840Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xfe,-1,  0,   0,   0,   0,
5850Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
5860Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
5870Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
5880Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
5890Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
5900Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
5910Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
5920Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
5930Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
5940Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
5950Sstevel@tonic-gate 	-1,  0,   0,   0xea,0,   0,   -1,  0,   0,
5960Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
5970Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
5980Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1,
5990Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
6000Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1
6010Sstevel@tonic-gate #elif (ISO_8859 == 10)
6020Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
6030Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
6040Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
6050Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
6060Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
6070Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
6080Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
6090Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
6100Sstevel@tonic-gate 	0xc1,-1,  0,   0xc9,0,   0,   0xcd,0,   0,
6110Sstevel@tonic-gate 	-1,  -1,  0xd3,-1,  -1,  0,   0xda,0,   0xdd,-1,
6120Sstevel@tonic-gate 	0xe1,-1,  0,   0xe9,0,   0,   0xed,0,   0,
6130Sstevel@tonic-gate 	-1,  -1,  0xf3,-1,  -1,  0,   0xfa,0,   0xfd,-1,
6140Sstevel@tonic-gate 	0xc2,-1,  0,   -1,  -1,  -1,  0xce,-1,  0,
6150Sstevel@tonic-gate 	0,   0,   0xd4,0,   -1,  0,   0xdb,-1,  -1,  0,
6160Sstevel@tonic-gate 	0xe2,-1,  0,   -1,  -1,  -1,  0xee,-1,  0,
6170Sstevel@tonic-gate 	0,   0,   0xf4,0,   -1,  0,   0xfb,-1,  -1,  0,
6180Sstevel@tonic-gate 	0xc3,0,   0,   0,   0,   0,   0xa5,0,   0,
6190Sstevel@tonic-gate 	0,   -1,  0xd5,0,   0,   0,   0xd7,0,   0,   0,
6200Sstevel@tonic-gate 	0xe3,0,   0,   0,   0,   0,   0xb5,0,   0,
6210Sstevel@tonic-gate 	0,   -1,  0xf5,0,   0,   0,   0xf7,0,   0,   0,
6220Sstevel@tonic-gate 	0xc0,0,   0,   0xa2,0,   0,   0xa4,0,   0,
6230Sstevel@tonic-gate 	0,   0,   0xd2,0,   0,   0,   0xae,0,   0,   0,
6240Sstevel@tonic-gate 	0xe0,0,   0,   0xb2,0,   0,   0xb4,0,   0,
6250Sstevel@tonic-gate 	0,   0,   0xf2,0,   0,   0,   0xbe,0,   0,   0,
6260Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
6270Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
6280Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
6290Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
6300Sstevel@tonic-gate 	0,   -1,  0,   0xcc,-1,  0,   -1,  0,   0,
6310Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
6320Sstevel@tonic-gate 	0,   -1,  0,   0xec,-1,  0,   0,   0,   0,
6330Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
6340Sstevel@tonic-gate 	0xc4,0,   0,   0xcb,0,   0,   0xcf,0,   0,
6350Sstevel@tonic-gate 	0,   0,   0xd6,0,   0,   0,   0xdc,0,   -1,  0,
6360Sstevel@tonic-gate 	0xe4,0,   0,   0xeb,0,   0,   0xef,0,   0,
6370Sstevel@tonic-gate 	0,   0,   0xf6,0,   0,   0,   0xfc,0,   -1,  0,
6380Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
6390Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
6400Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
6410Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
6420Sstevel@tonic-gate 	0xc5,0,   0,   0,   0,   0,   0,   0,   0,
6430Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
6440Sstevel@tonic-gate 	0xe5,0,   0,   0,   0,   0,   0,   0,   0,
6450Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
6460Sstevel@tonic-gate 	0,   -1,  0,   0,   0xa3,0,   0,   0,   0xa6,
6470Sstevel@tonic-gate 	0xa8,0xd1,0,   -1,  -1,  -1,  0,   0,   0,   0,
6480Sstevel@tonic-gate 	0,   -1,  0,   0,   0xb3,0,   0,   0,   0xb6,
6490Sstevel@tonic-gate 	0xb8,0xf1,0,   -1,  -1,  -1,  0,   0,   0,   0,
6500Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
6510Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
6520Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
6530Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
6540Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
6550Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
6560Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
6570Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
6580Sstevel@tonic-gate 	0xa1,0,   0,   0xca,0,   0,   0xc7,0,   0,
6590Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xd9,0,   0,   0,
6600Sstevel@tonic-gate 	0xb1,0,   0,   0xea,0,   0,   0xe7,0,   0,
6610Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0xf9,0,   0,   0,
6620Sstevel@tonic-gate 	0,   0xc8,-1,  -1,  0,   0,   0,   0,   0,
6630Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xaa,-1,  0,   0,   0,   0xac,
6640Sstevel@tonic-gate 	0,   0xe8,-1,  -1,  0,   0,   0,   0,   0,
6650Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0xba,-1,  0,   0,   0,   0xbc
6660Sstevel@tonic-gate #else
6670Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
6680Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
6690Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
6700Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
6710Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
6720Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
6730Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
6740Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
6750Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0,   0,   -1,  0,   0,
6760Sstevel@tonic-gate 	-1,  -1,  -1,  -1,  -1,  0,   -1,  0,   -1,  -1,
6770Sstevel@tonic-gate 	-1,  -1,  0,   -1,  0,   0,   -1,  0,   0,
6780Sstevel@tonic-gate 	-1,  -1,  -1,  -1,  -1,  0,   -1,  0,   -1,  -1,
6790Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  -1,  -1,  0,
6800Sstevel@tonic-gate 	0,   0,   -1,  0,   -1,  0,   -1,  -1,  -1,  0,
6810Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  -1,  -1,  0,
6820Sstevel@tonic-gate 	0,   0,   -1,  0,   -1,  0,   -1,  -1,  -1,  0,
6830Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   -1,  0,   0,
6840Sstevel@tonic-gate 	0,   -1,  -1,  0,   0,   0,   -1,  0,   0,   0,
6850Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   -1,  0,   0,
6860Sstevel@tonic-gate 	0,   -1,  -1,  0,   0,   0,   -1,  0,   0,   0,
6870Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
6880Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
6890Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
6900Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
6910Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
6920Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
6930Sstevel@tonic-gate 	-1,  0,   0,   0,   -1,  0,   0,   0,   0,
6940Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
6950Sstevel@tonic-gate 	0,   -1,  0,   -1,  -1,  0,   -1,  0,   0,
6960Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
6970Sstevel@tonic-gate 	0,   -1,  0,   -1,  -1,  0,   0,   0,   0,
6980Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   -1,
6990Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
7000Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   -1,  0,
7010Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
7020Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   -1,  0,
7030Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
7040Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
7050Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
7060Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
7070Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   0,   0,   0,
7080Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
7090Sstevel@tonic-gate 	-1,  0,   0,   0,   0,   0,   0,   0,   0,
7100Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
7110Sstevel@tonic-gate 	0,   -1,  0,   0,   -1,  0,   0,   0,   -1,
7120Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   0,
7130Sstevel@tonic-gate 	0,   -1,  0,   0,   -1,  0,   0,   0,   -1,
7140Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   0,
7150Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
7160Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
7170Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
7180Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
7190Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
7200Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
7210Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   0,   0,   0,
7220Sstevel@tonic-gate 	0,   0,   -1,  0,   0,   0,   -1,  0,   0,   0,
7230Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
7240Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
7250Sstevel@tonic-gate 	-1,  0,   0,   -1,  0,   0,   -1,  0,   0,
7260Sstevel@tonic-gate 	0,   0,   0,   0,   0,   0,   -1,  0,   0,   0,
7270Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
7280Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1,
7290Sstevel@tonic-gate 	0,   -1,  -1,  -1,  0,   0,   0,   0,   0,
7300Sstevel@tonic-gate 	-1,  -1,  0,   -1,  -1,  -1,  0,   0,   0,   -1
7310Sstevel@tonic-gate #endif
7320Sstevel@tonic-gate };
7330Sstevel@tonic-gate 
7340Sstevel@tonic-gate /*
7350Sstevel@tonic-gate --- T.61 characters [0xA0 .. 0xBF] -----------------
7360Sstevel@tonic-gate */
7370Sstevel@tonic-gate static Couple trans_t61a_iso8859[32] = {
7380Sstevel@tonic-gate #if (ISO_8859 == 1) || (ISO_8859 == 9)
7390Sstevel@tonic-gate 	{'N','S'}, {0xa1,0},  {0xa2,0},  {0xa3,0},
7400Sstevel@tonic-gate 	{'D','O'}, {0xa5,0},  {'C','u'}, {0xa7,0},
7410Sstevel@tonic-gate 	{0xa4,0},  {'\'','6'},{'"','6'}, {0xab,0},
7420Sstevel@tonic-gate 	{'<','-'}, {'-','!'}, {'-','>'}, {'-','v'},
7430Sstevel@tonic-gate 	{0xb0,0},  {0xb1,0},  {0xb2,0},  {0xb3,0},
7440Sstevel@tonic-gate 	{0xd7,0},  {0xb5,0},  {0xb6,0},  {0xb7,0},
7450Sstevel@tonic-gate 	{0xf7,0},  {'\'','9'},{'"','9'}, {0xbb,0},
7460Sstevel@tonic-gate 	{0xbc,0},  {0xbd,0},  {0xbe,0},  {0xbf,0}
7470Sstevel@tonic-gate #elif (ISO_8859 == 2) || (ISO_8859 == 4)
7480Sstevel@tonic-gate 	{'N','S'}, {'!','I'}, {'C','t'}, {'P','d'},
7490Sstevel@tonic-gate 	{'D','O'}, {'Y','e'}, {'C','u'}, {0xa7,0},
7500Sstevel@tonic-gate 	{0xa4,0},  {'\'','6'},{'"','6'}, {'<','<'},
7510Sstevel@tonic-gate 	{'<','-'}, {'-','!'}, {'-','>'}, {'-','v'},
7520Sstevel@tonic-gate 	{0xb0,0},  {'+','-'}, {'2','S'}, {'3','S'},
7530Sstevel@tonic-gate 	{0xd7,0},  {'M','y'}, {'P','I'}, {'.','M'},
7540Sstevel@tonic-gate 	{0xf7,0},  {'\'','9'},{'"','9'}, {'>','>'},
7550Sstevel@tonic-gate 	{'1','4'}, {'1','2'}, {'3','4'}, {'?','I'},
7560Sstevel@tonic-gate #elif (ISO_8859 == 3)
7570Sstevel@tonic-gate 	{'N','S'}, {'!','I'}, {'C','t'}, {0xa3,0},
7580Sstevel@tonic-gate 	{'D','O'}, {'Y','e'}, {'C','u'}, {0xa7,0},
7590Sstevel@tonic-gate 	{0xa4,0},  {'\'','6'},{'"','6'}, {'<','<'},
7600Sstevel@tonic-gate 	{'<','-'}, {'-','!'}, {'-','>'}, {'-','v'},
7610Sstevel@tonic-gate 	{0xb0,0},  {'+','-'}, {0xb2,0},  {0xb3,0},
7620Sstevel@tonic-gate 	{0xd7,0},  {0xb5,0},  {'P','I'}, {0xb7,0},
7630Sstevel@tonic-gate 	{0xf7,0},  {'\'','9'},{'"','9'}, {'>','>'},
7640Sstevel@tonic-gate 	{'1','4'}, {0xbd,0},  {'3','4'}, {'?','I'}
7650Sstevel@tonic-gate #elif (ISO_8859 == 10)
7660Sstevel@tonic-gate 	{'N','S'}, {'!','I'}, {'C','t'}, {'P','d'},
7670Sstevel@tonic-gate 	{'D','O'}, {'Y','e'}, {'C','u'}, {0xa7,0},
7680Sstevel@tonic-gate 	{'C','u'}, {'\'','6'},{'"','6'}, {'<','<'},
7690Sstevel@tonic-gate 	{'<','-'}, {'-','!'}, {'-','>'}, {'-','v'},
7700Sstevel@tonic-gate 	{0xb0,0},  {'+','-'}, {'2','S'}, {'3','S'},
7710Sstevel@tonic-gate 	{'*','X'}, {'M','y'}, {'P','I'}, {0xb7,0},
7720Sstevel@tonic-gate 	{'-',':'}, {'\'','9'},{'"','9'}, {'>','>'},
7730Sstevel@tonic-gate 	{'1','4'}, {'1','2'}, {'3','4'}, {'?','I'}
7740Sstevel@tonic-gate #else
7750Sstevel@tonic-gate 	{'N','S'}, {'!','I'}, {'C','t'}, {'P','d'},
7760Sstevel@tonic-gate 	{'D','O'}, {'Y','e'}, {'C','u'}, {'S','E'},
7770Sstevel@tonic-gate 	{'X','O'}, {'\'','6'},{'"','6'}, {'<','<'},
7780Sstevel@tonic-gate 	{'<','-'}, {'-','!'}, {'-','>'}, {'-','v'},
7790Sstevel@tonic-gate 	{'D','G'}, {'+','-'}, {'2','S'}, {'3','S'},
7800Sstevel@tonic-gate 	{'*','X'}, {'M','y'}, {'P','I'}, {'.','M'},
7810Sstevel@tonic-gate 	{'-',':'}, {'\'','9'},{'"','9'}, {'>','>'},
7820Sstevel@tonic-gate 	{'1','4'}, {'1','2'}, {'3','4'}, {'?','I'}
7830Sstevel@tonic-gate #endif
7840Sstevel@tonic-gate };
7850Sstevel@tonic-gate 
7860Sstevel@tonic-gate /*
7870Sstevel@tonic-gate --- T.61 characters [0xE0 .. 0xFF] -----------------
7880Sstevel@tonic-gate */
7890Sstevel@tonic-gate static Couple trans_t61b_iso8859[48] = {
7900Sstevel@tonic-gate #if (ISO_8859 == 1)
7910Sstevel@tonic-gate 	{'-','M'}, {0xb9,0},  {0xae,0},  {0xa9,0},
7920Sstevel@tonic-gate 	{'T','M'}, {'M','8'}, {0xac,0},  {0xa6,0},
7930Sstevel@tonic-gate 	{0,0},     {0,0},     {0,0},     {0,0},
7940Sstevel@tonic-gate 	{'1','8'}, {'3','8'}, {'5','8'}, {'7','8'},
7950Sstevel@tonic-gate 	{'O','m'}, {0xc6,0},  {0xd0,0},  {0xaa,0},
7960Sstevel@tonic-gate 	{'H','/'}, {0,0},     {'I','J'}, {'L','.'},
7970Sstevel@tonic-gate 	{'L','/'}, {0xd8,0},  {'O','E'}, {0xba,0},
7980Sstevel@tonic-gate 	{0xde,0},  {'T','/'}, {'N','G'}, {'\'','n'},
7990Sstevel@tonic-gate 	{'k','k'}, {0xe6,0},  {'d','/'}, {0xf0,0},
8000Sstevel@tonic-gate 	{'h','/'}, {'i','.'}, {'i','j'}, {'l','.'},
8010Sstevel@tonic-gate 	{'l','/'}, {0xf8,0},  {'o','e'}, {0xdf,0},
8020Sstevel@tonic-gate 	{0xfe,0},  {'t','/'}, {'n','g'}, {'-','-'}
8030Sstevel@tonic-gate #elif (ISO_8859 == 2)
8040Sstevel@tonic-gate 	{'-','M'}, {'1','S'}, {'R','g'}, {'C','o'},
8050Sstevel@tonic-gate 	{'T','M'}, {'M','8'}, {'N','O'}, {'B','B'},
8060Sstevel@tonic-gate 	{0,0},     {0,0},     {0,0},     {0,0},
8070Sstevel@tonic-gate 	{'1','8'}, {'3','8'}, {'5','8'}, {'7','8'},
8080Sstevel@tonic-gate 	{'O','m'}, {'A','E'}, {0xd0,0},  {'-','a'},
8090Sstevel@tonic-gate 	{'H','/'}, {0,0},     {'I','J'}, {'L','.'},
8100Sstevel@tonic-gate 	{0xa3,0},  {'O','/'}, {'O','E'}, {'-','o'},
8110Sstevel@tonic-gate 	{'T','H'}, {'T','/'}, {'N','G'}, {'\'','n'},
8120Sstevel@tonic-gate 	{'k','k'}, {'a','e'}, {0xf0,0},  {'d','-'},
8130Sstevel@tonic-gate 	{'h','/'}, {'i','.'}, {'i','j'}, {'l','.'},
8140Sstevel@tonic-gate 	{0xb3,0},  {'o','/'}, {'o','e'}, {0xdf,0},
8150Sstevel@tonic-gate 	{'t','h'}, {'t','/'}, {'n','g'}, {'-','-'}
8160Sstevel@tonic-gate #elif (ISO_8859 == 3)
8170Sstevel@tonic-gate 	{'-','M'}, {'1','S'}, {'R','g'}, {'C','o'},
8180Sstevel@tonic-gate 	{'T','M'}, {'M','8'}, {'N','O'}, {'B','B'},
8190Sstevel@tonic-gate 	{0,0},     {0,0},     {0,0},     {0,0},
8200Sstevel@tonic-gate 	{'1','8'}, {'3','8'}, {'5','8'}, {'7','8'},
8210Sstevel@tonic-gate 	{'O','m'}, {'A','E'}, {'D','/'}, {'-','a'},
8220Sstevel@tonic-gate 	{0xa1,0},  {0,0},     {'I','J'}, {'L','.'},
8230Sstevel@tonic-gate 	{'L','/'}, {'O','/'}, {'O','E'}, {'-','o'},
8240Sstevel@tonic-gate 	{'T','H'}, {'T','/'}, {'N','G'}, {'\'','n'},
8250Sstevel@tonic-gate 	{'k','k'}, {'a','e'}, {'d','/'}, {'d','-'},
8260Sstevel@tonic-gate 	{0xb1,0},  {0xb9,0},  {'i','j'}, {'l','.'},
8270Sstevel@tonic-gate 	{'l','/'}, {'o','/'}, {'o','e'}, {0xdf,0},
8280Sstevel@tonic-gate 	{'t','h'}, {'t','/'}, {'n','g'}, {'-','-'}
8290Sstevel@tonic-gate #elif (ISO_8859 == 4)
8300Sstevel@tonic-gate 	{'-','M'}, {'1','S'}, {'R','g'}, {'C','o'},
8310Sstevel@tonic-gate 	{'T','M'}, {'M','8'}, {'N','O'}, {'B','B'},
8320Sstevel@tonic-gate 	{0,0},     {0,0},     {0,0},     {0,0},
8330Sstevel@tonic-gate 	{'1','8'}, {'3','8'}, {'5','8'}, {'7','8'},
8340Sstevel@tonic-gate 	{'O','m'}, {0xc6,0},  {0xd0,0},  {'-','a'},
8350Sstevel@tonic-gate 	{'H','/'}, {0,0},     {'I','J'}, {'L','.'},
8360Sstevel@tonic-gate 	{'L','/'}, {0xd8,0},  {'O','E'}, {'-','o'},
8370Sstevel@tonic-gate 	{'T','H'}, {0xac,0},  {0xbd,0},  {'\'','n'},
8380Sstevel@tonic-gate 	{0xa2,0},  {0xe6,0},  {0xf0,0},  {'d','-'},
8390Sstevel@tonic-gate 	{'h','/'}, {'i','.'}, {'i','j'}, {'l','.'},
8400Sstevel@tonic-gate 	{'l','/'}, {0xf8,0},  {'o','e'}, {0xdf,0},
8410Sstevel@tonic-gate 	{'t','h'}, {0xbc,0},  {0xbf,0},  {'-','-'}
8420Sstevel@tonic-gate #elif (ISO_8859 == 9)
8430Sstevel@tonic-gate 	{'-','M'}, {0xb9,0},  {0xae,0},  {0xa9,0},
8440Sstevel@tonic-gate 	{'T','M'}, {'M','8'}, {0xac,0},  {0xa6,0},
8450Sstevel@tonic-gate 	{0,0},     {0,0},     {0,0},     {0,0},
8460Sstevel@tonic-gate 	{'1','8'}, {'3','8'}, {'5','8'}, {'7','8'},
8470Sstevel@tonic-gate 	{'O','m'}, {0xc6,0},  {'D','/'}, {0xaa,0},
8480Sstevel@tonic-gate 	{'H','/'}, {0,0},     {'I','J'}, {'L','.'},
8490Sstevel@tonic-gate 	{'L','/'}, {0xd8,0},  {'O','E'}, {0xba,0},
8500Sstevel@tonic-gate 	{'T','H'}, {'T','/'}, {'N','G'}, {'\'','n'},
8510Sstevel@tonic-gate 	{'k','k'}, {0xe6,0},  {'d','/'}, {'d','-'},
8520Sstevel@tonic-gate 	{'h','/'}, {0xfd,0},  {'i','j'}, {'l','.'},
8530Sstevel@tonic-gate 	{'l','/'}, {0xf8,0},  {'o','e'}, {0xdf,0},
8540Sstevel@tonic-gate 	{'t','h'}, {'t','/'}, {'n','g'}, {'-','-'}
8550Sstevel@tonic-gate #elif (ISO_8859 == 10)
8560Sstevel@tonic-gate 	{0xbd,0},  {'1','S'}, {'R','g'}, {'C','o'},
8570Sstevel@tonic-gate 	{'T','M'}, {'M','8'}, {'N','O'}, {'B','B'},
8580Sstevel@tonic-gate 	{0,0},     {0,0},     {0,0},     {0,0},
8590Sstevel@tonic-gate 	{'1','8'}, {'3','8'}, {'5','8'}, {'7','8'},
8600Sstevel@tonic-gate 	{'O','m'}, {0xc6,0},  {0xa9,0},  {'-','a'},
8610Sstevel@tonic-gate 	{'H','/'}, {0,0},     {'I','J'}, {'L','.'},
8620Sstevel@tonic-gate 	{'L','/'}, {0xd8,0},  {'O','E'}, {'-','o'},
8630Sstevel@tonic-gate 	{0xde,0},  {0xab,0},  {0xaf,0},  {'\'','n'},
8640Sstevel@tonic-gate 	{0xff,0},  {0xe6,0},  {0xb9,0},  {0xf0,0},
8650Sstevel@tonic-gate 	{'h','/'}, {'i','.'}, {'i','j'}, {'l','.'},
8660Sstevel@tonic-gate 	{'l','/'}, {0xf8,0},  {'o','e'}, {0xdf,0},
8670Sstevel@tonic-gate 	{0xfe,0},  {0xbb,0},  {0xbf,0},  {'-','-'}
8680Sstevel@tonic-gate #else
8690Sstevel@tonic-gate 	{'-','M'}, {'1','S'}, {'R','g'}, {'C','o'},
8700Sstevel@tonic-gate 	{'T','M'}, {'M','8'}, {'N','O'}, {'B','B'},
8710Sstevel@tonic-gate 	{0,0},     {0,0},     {0,0},     {0,0},
8720Sstevel@tonic-gate 	{'1','8'}, {'3','8'}, {'5','8'}, {'7','8'},
8730Sstevel@tonic-gate 	{'O','m'}, {'A','E'}, {'D','/'}, {'-','a'},
8740Sstevel@tonic-gate 	{'H','/'}, {0,0},     {'I','J'}, {'L','.'},
8750Sstevel@tonic-gate 	{'L','/'}, {'O','/'}, {'O','E'}, {'-','o'},
8760Sstevel@tonic-gate 	{'T','H'}, {'T','/'}, {'N','G'}, {'\'','n'},
8770Sstevel@tonic-gate 	{'k','k'}, {'a','e'}, {'d','/'}, {'d','-'},
8780Sstevel@tonic-gate 	{'h','/'}, {'i','.'}, {'i','j'}, {'l','.'},
8790Sstevel@tonic-gate 	{'l','/'}, {'o','/'}, {'o','e'}, {'s','s'},
8800Sstevel@tonic-gate 	{'t','h'}, {'t','-'}, {'n','g'}, {'-','-'}
8810Sstevel@tonic-gate #endif
8820Sstevel@tonic-gate };
8830Sstevel@tonic-gate 
8840Sstevel@tonic-gate /*
8850Sstevel@tonic-gate --- ISO 8859-n characters <0xA0 .. 0xFF> -------------------
8860Sstevel@tonic-gate */
8870Sstevel@tonic-gate #if (ISO_8859 == 1)
8880Sstevel@tonic-gate static Couple trans_iso8859_t61[96] = {
8890Sstevel@tonic-gate 	{0xa0,0},     {0xa1,0},     {0xa2,0},     {0xa3,0},
8900Sstevel@tonic-gate 	{0xa8,0},     {0xa5,0},     {0xd7,0},     {0xa7,0},
8910Sstevel@tonic-gate 	{0xc8,ALONE}, {0xd3,0},     {0xe3,0},     {0xab,0},
8920Sstevel@tonic-gate 	{0xd6,0},     {0xff,0},     {0xd2,0},     {0xc5,ALONE},
8930Sstevel@tonic-gate 	{0xb0,0},     {0xb1,0},     {0xb2,0},     {0xb3,0},
8940Sstevel@tonic-gate 	{0xc2,ALONE}, {0xb5,0},     {0xb6,0},     {0xb7,0},
8950Sstevel@tonic-gate 	{0xcb,ALONE}, {0xd1,0},     {0xeb,0},     {0xbb,0},
8960Sstevel@tonic-gate 	{0xbc,0},     {0xbd,0},     {0xbe,0},     {0xbf,0},
8970Sstevel@tonic-gate 	{0xc1,'A'},   {0xc2,'A'},   {0xc3,'A'},   {0xc4,'A'},
8980Sstevel@tonic-gate 	{0xc8,'A'},   {0xca,'A'},   {0xe1,0},     {0xcb,'C'},
8990Sstevel@tonic-gate 	{0xc1,'E'},   {0xc2,'E'},   {0xc3,'E'},   {0xc8,'E'},
9000Sstevel@tonic-gate 	{0xc1,'I'},   {0xc2,'I'},   {0xc3,'I'},   {0xc8,'I'},
9010Sstevel@tonic-gate 	{0xe2,0},     {0xc4,'N'},   {0xc1,'O'},   {0xc2,'O'},
9020Sstevel@tonic-gate 	{0xc3,'O'},   {0xc4,'O'},   {0xc8,'O'},   {0xb4,0},
9030Sstevel@tonic-gate 	{0xe9,0},     {0xc1,'U'},   {0xc2,'U'},   {0xc3,'U'},
9040Sstevel@tonic-gate 	{0xc8,'U'},   {0xc2,'Y'},   {0xec,0},     {0xfb,0},
9050Sstevel@tonic-gate 	{0xc1,'a'},   {0xc2,'a'},   {0xc3,'a'},   {0xc4,'a'},
9060Sstevel@tonic-gate 	{0xc8,'a'},   {0xca,'a'},   {0xf1,0},     {0xcb,'c'},
9070Sstevel@tonic-gate 	{0xc1,'e'},   {0xc2,'e'},   {0xc3,'e'},   {0xc8,'e'},
9080Sstevel@tonic-gate 	{0xc1,'i'},   {0xc2,'i'},   {0xc3,'i'},   {0xc8,'i'},
9090Sstevel@tonic-gate 	{0xf3,0},     {0xc4,'n'},   {0xc1,'o'},   {0xc2,'o'},
9100Sstevel@tonic-gate 	{0xc3,'o'},   {0xc4,'o'},   {0xc8,'o'},   {0xb8,0},
9110Sstevel@tonic-gate 	{0xf9,0},     {0xc1,'u'},   {0xc2,'u'},   {0xc3,'u'},
9120Sstevel@tonic-gate 	{0xc8,'u'},   {0xc2,'y'},   {0xfc,0},     {0xc8,'y'}
9130Sstevel@tonic-gate };
9140Sstevel@tonic-gate #elif (ISO_8859 == 2)
9150Sstevel@tonic-gate static Couple trans_iso8859_t61[96] = {
9160Sstevel@tonic-gate 	{0xa0,0},     {0xce,'A'},   {0xc6,ALONE}, {0xe8,0},
9170Sstevel@tonic-gate 	{0xa8,0},     {0xcf,'L'},   {0xc2,'S'},   {0xa7,0},
9180Sstevel@tonic-gate 	{0xc8,ALONE}, {0xcf,'S'},   {0xcb,'S'},   {0xcf,'T'},
9190Sstevel@tonic-gate 	{0xc2,'Z'},   {0xff,0},     {0xcf,'Z'},   {0xc7,'Z'},
9200Sstevel@tonic-gate 	{0xb0,0},     {0xce,'a'},   {0xce,ALONE}, {0xf8,0},
9210Sstevel@tonic-gate 	{0xc2,ALONE}, {0xcf,'l'},   {0xc2,'s'},   {0xcf,ALONE},
9220Sstevel@tonic-gate 	{0xcb,ALONE}, {0xcf,'s'},   {0xcb,'s'},   {0xcf,'t'},
9230Sstevel@tonic-gate 	{0xc2,'z'},   {0xcd,ALONE}, {0xcf,'z'},   {0xc7,'z'},
9240Sstevel@tonic-gate 	{0xc2,'R'},   {0xc2,'A'},   {0xc3,'A'},   {0xc6,'A'},
9250Sstevel@tonic-gate 	{0xc8,'A'},   {0xc2,'L'},   {0xc2,'C'},   {0xcb,'C'},
9260Sstevel@tonic-gate 	{0xcf,'C'},   {0xc2,'E'},   {0xce,'E'},   {0xc8,'E'},
9270Sstevel@tonic-gate 	{0xcf,'E'},   {0xc2,'I'},   {0xc3,'I'},   {0xcf,'D'},
9280Sstevel@tonic-gate 	{0xe2,0},     {0xc2,'N'},   {0xcf,'N'},   {0xc2,'O'},
9290Sstevel@tonic-gate 	{0xc3,'O'},   {0xcd,'O'},   {0xc8,'O'},   {0xb4,0},
9300Sstevel@tonic-gate 	{0xcf,'R'},   {0xca,'U'},   {0xc2,'U'},   {0xcd,'U'},
9310Sstevel@tonic-gate 	{0xc8,'U'},   {0xc2,'Y'},   {0xcb,'T'},   {0xfb,0},
9320Sstevel@tonic-gate 	{0xc2,'r'},   {0xc2,'a'},   {0xc3,'a'},   {0xc6,'a'},
9330Sstevel@tonic-gate 	{0xc8,'a'},   {0xc2,'l'},   {0xc2,'c'},   {0xcb,'c'},
9340Sstevel@tonic-gate 	{0xcf,'c'},   {0xc2,'e'},   {0xce,'e'},   {0xc8,'e'},
9350Sstevel@tonic-gate 	{0xcf,'e'},   {0xc2,'i'},   {0xc3,'i'},   {0xcf,'d'},
9360Sstevel@tonic-gate 	{0xf2,0},     {0xc2,'n'},   {0xcf,'n'},   {0xc2,'o'},
9370Sstevel@tonic-gate 	{0xc3,'o'},   {0xcd,'o'},   {0xc8,'o'},   {0xb8,0},
9380Sstevel@tonic-gate 	{0xcf,'r'},   {0xca,'u'},   {0xc2,'u'},   {0xcd,'u'},
9390Sstevel@tonic-gate 	{0xc8,'u'},   {0xc2,'y'},   {0xcb,'t'},   {0xc7,ALONE}
9400Sstevel@tonic-gate };
9410Sstevel@tonic-gate #elif (ISO_8859 == 3)
9420Sstevel@tonic-gate static Couple trans_iso8859_t61[96] = {
9430Sstevel@tonic-gate 	{0xa0,0},     {0xe4,0},     {0xc6,ALONE}, {0xa3,0},
9440Sstevel@tonic-gate 	{0xa8,0},     {0,0},        {0xc3,'H'},   {0xa7,0},
9450Sstevel@tonic-gate 	{0xc8,ALONE}, {0xc7,'I'},   {0xcb,'S'},   {0xc6,'G'},
9460Sstevel@tonic-gate 	{0xc3,'J'},   {0xff,0},     {0,0},        {0xc7,'Z'},
9470Sstevel@tonic-gate 	{0xb0,0},     {0xf4,0},     {0xb2,0},     {0xb3,0},
9480Sstevel@tonic-gate 	{0xc2,ALONE}, {0xb5,0},     {0xc3,'h'},   {0xb7,0},
9490Sstevel@tonic-gate 	{0xcb,ALONE}, {0xf5,0},     {0xcb,'s'},   {0xc6,'g'},
9500Sstevel@tonic-gate 	{0xc3,'j'},   {0xbd,0},     {0,0},        {0xc7,'z'},
9510Sstevel@tonic-gate 	{0xc1,'A'},   {0xc2,'A'},   {0xc3,'A'},   {0,0},
9520Sstevel@tonic-gate 	{0xc8,'A'},   {0xc7,'C'},   {0xc3,'C'},   {0xcb,'C'},
9530Sstevel@tonic-gate 	{0xc1,'E'},   {0xc2,'E'},   {0xc3,'E'},   {0xc8,'E'},
9540Sstevel@tonic-gate 	{0xc1,'I'},   {0xc2,'I'},   {0xc3,'I'},   {0xc8,'I'},
9550Sstevel@tonic-gate 	{0,0},        {0xc4,'N'},   {0xc1,'O'},   {0xc2,'O'},
9560Sstevel@tonic-gate 	{0xc3,'O'},   {0xc7,'G'},   {0xc8,'O'},   {0xb4,0},
9570Sstevel@tonic-gate 	{0xc3,'G'},   {0xc1,'U'},   {0xc2,'U'},   {0xc3,'U'},
9580Sstevel@tonic-gate 	{0xc8,'U'},   {0xc6,'U'},   {0xc3,'S'},   {0xfb,0},
9590Sstevel@tonic-gate 	{0xc1,'a'},   {0xc2,'a'},   {0xc3,'a'},   {0,0},
9600Sstevel@tonic-gate 	{0xc8,'a'},   {0xc7,'c'},   {0xc3,'c'},   {0xcb,'c'},
9610Sstevel@tonic-gate 	{0xc1,'e'},   {0xc2,'e'},   {0xc3,'e'},   {0xc8,'e'},
9620Sstevel@tonic-gate 	{0xc1,'i'},   {0xc2,'i'},   {0xc3,'i'},   {0xc8,'i'},
9630Sstevel@tonic-gate 	{0,0},        {0xc4,'n'},   {0xc1,'o'},   {0xc2,'o'},
9640Sstevel@tonic-gate 	{0xc3,'o'},   {0xc7,'g'},   {0xc8,'o'},   {0xb8,0},
9650Sstevel@tonic-gate 	{0xc3,'g'},   {0xc1,'u'},   {0xc2,'u'},   {0xc3,'u'},
9660Sstevel@tonic-gate 	{0xc8,'u'},   {0xc6,'u'},   {0xc3,'s'},   {0xc7,ALONE}
9670Sstevel@tonic-gate };
9680Sstevel@tonic-gate #elif (ISO_8859 == 4)
9690Sstevel@tonic-gate static Couple trans_iso8859_t61[96] = {
9700Sstevel@tonic-gate 	{0xa0,0},     {0xce,'A'},   {0xf0,0},     {0xcb,'R'},
9710Sstevel@tonic-gate 	{0xa8,0},     {0xc4,'I'},   {0xcb,'L'},   {0xa7,0},
9720Sstevel@tonic-gate 	{0xc8,ALONE}, {0xcf,'S'},   {0xc5,'E'},   {0xcb,'G'},
9730Sstevel@tonic-gate 	{0xed,0},     {0xff,0},     {0xcf,'Z'},   {0xc5,ALONE},
9740Sstevel@tonic-gate 	{0xb0,0},     {0xce,'a'},   {0xce,ALONE}, {0xcb,'r'},
9750Sstevel@tonic-gate 	{0xc2,ALONE}, {0xc4,'i'},   {0xcb,'l'},   {0xcf,ALONE},
9760Sstevel@tonic-gate 	{0xcb,ALONE}, {0xcf,'s'},   {0xc5,'e'},   {0xcb,'g'},
9770Sstevel@tonic-gate 	{0xfd,0},     {0xee,0},     {0xcf,'z'},   {0xfe,0},
9780Sstevel@tonic-gate 	{0xc5,'A'},   {0xc2,'A'},   {0xc3,'A'},   {0xc4,'A'},
9790Sstevel@tonic-gate 	{0xc8,'A'},   {0xca,'A'},   {0xe1,0},     {0xce,'I'},
9800Sstevel@tonic-gate 	{0xcf,'C'},   {0xc2,'E'},   {0xce,'E'},   {0xc8,'E'},
9810Sstevel@tonic-gate 	{0xc7,'E'},   {0xc2,'I'},   {0xc3,'I'},   {0xc5,'I'},
9820Sstevel@tonic-gate 	{0xe2,0},     {0xcb,'N'},   {0xc5,'O'},   {0xcb,'K'},
9830Sstevel@tonic-gate 	{0xc3,'O'},   {0xc4,'O'},   {0xc8,'O'},   {0xb4,0},
9840Sstevel@tonic-gate 	{0xe9,0},     {0xce,'U'},   {0xc2,'U'},   {0xc3,'U'},
9850Sstevel@tonic-gate 	{0xc8,'U'},   {0xc4,'U'},   {0xc5,'U'},   {0xfb,0},
9860Sstevel@tonic-gate 	{0xc5,'a'},   {0xc2,'a'},   {0xc3,'a'},   {0xc4,'a'},
9870Sstevel@tonic-gate 	{0xc8,'a'},   {0xca,'a'},   {0xf1,0},     {0xce,'i'},
9880Sstevel@tonic-gate 	{0xcf,'c'},   {0xc2,'e'},   {0xce,'e'},   {0xc8,'e'},
9890Sstevel@tonic-gate 	{0xc7,'e'},   {0xc2,'i'},   {0xc3,'i'},   {0xc5,'i'},
9900Sstevel@tonic-gate 	{0xf2,0},     {0xcb,'n'},   {0xc5,'o'},   {0xcb,'k'},
9910Sstevel@tonic-gate 	{0xc3,'o'},   {0xc4,'o'},   {0xc8,'o'},   {0xb8,0},
9920Sstevel@tonic-gate 	{0xf9,0},     {0xce,'u'},   {0xc2,'u'},   {0xc3,'u'},
9930Sstevel@tonic-gate 	{0xc8,'u'},   {0xc4,'u'},   {0xc5,'u'},   {0xc7,ALONE}
9940Sstevel@tonic-gate };
9950Sstevel@tonic-gate #elif (ISO_8859 == 9)
9960Sstevel@tonic-gate static Couple trans_iso8859_t61[96] = {
9970Sstevel@tonic-gate 	{0xa0,0},     {0xa1,0},     {0xa2,0},     {0xa3,0},
9980Sstevel@tonic-gate 	{0xa8,0},     {0xa5,0},     {0xd7,0},     {0xa7,0},
9990Sstevel@tonic-gate 	{0xc8,ALONE}, {0xd3,0},     {0xe3,0},     {0xab,0},
10000Sstevel@tonic-gate 	{0xd6,0},     {0xff,0},     {0xd2,0},     {0xc5,ALONE},
10010Sstevel@tonic-gate 	{0xb0,0},     {0xb1,0},     {0xb2,0},     {0xb3,0},
10020Sstevel@tonic-gate 	{0xc2,ALONE}, {0xb5,0},     {0xb6,0},     {0xb7,0},
10030Sstevel@tonic-gate 	{0xcb,ALONE}, {0xd1,0},     {0xeb,0},     {0xbb,0},
10040Sstevel@tonic-gate 	{0xbc,0},     {0xbd,0},     {0xbe,0},     {0xbf,0},
10050Sstevel@tonic-gate 	{0xc1,'A'},   {0xc2,'A'},   {0xc3,'A'},   {0xc4,'A'},
10060Sstevel@tonic-gate 	{0xc8,'A'},   {0xca,'A'},   {0xe1,0},     {0xcb,'C'},
10070Sstevel@tonic-gate 	{0xc1,'E'},   {0xc2,'E'},   {0xc3,'E'},   {0xc8,'E'},
10080Sstevel@tonic-gate 	{0xc1,'I'},   {0xc2,'I'},   {0xc3,'I'},   {0xc8,'I'},
10090Sstevel@tonic-gate 	{0xc6,'G'},   {0xc4,'N'},   {0xc1,'O'},   {0xc2,'O'},
10100Sstevel@tonic-gate 	{0xc3,'O'},   {0xc4,'O'},   {0xc8,'O'},   {0xb4,0},
10110Sstevel@tonic-gate 	{0xe9,0},     {0xc1,'U'},   {0xc2,'U'},   {0xc3,'U'},
10120Sstevel@tonic-gate 	{0xc8,'U'},   {0xc7,'I'},   {0xcb,'S'},   {0xfb,0},
10130Sstevel@tonic-gate 	{0xc1,'a'},   {0xc2,'a'},   {0xc3,'a'},   {0xc4,'a'},
10140Sstevel@tonic-gate 	{0xc8,'a'},   {0xca,'a'},   {0xf1,0},     {0xcb,'c'},
10150Sstevel@tonic-gate 	{0xc1,'e'},   {0xc2,'e'},   {0xce,'e'},   {0xc8,'e'},
10160Sstevel@tonic-gate 	{0xc7,'e'},   {0xc2,'i'},   {0xc3,'i'},   {0xc5,'i'},
10170Sstevel@tonic-gate 	{0xc6,'g'},   {0xc4,'n'},   {0xc1,'o'},   {0xc2,'o'},
10180Sstevel@tonic-gate 	{0xc3,'o'},   {0xc4,'o'},   {0xc8,'o'},   {0xb8,0},
10190Sstevel@tonic-gate 	{0xf9,0},     {0xc1,'u'},   {0xc2,'u'},   {0xc3,'u'},
10200Sstevel@tonic-gate 	{0xc8,'u'},   {0xf5,0},     {0xcb,'s'},   {0xc8,'y'}
10210Sstevel@tonic-gate };
10220Sstevel@tonic-gate #elif (ISO_8859 == 10)
10230Sstevel@tonic-gate static Couple trans_iso8859_t61[96] = {
10240Sstevel@tonic-gate 	{0xa0,0},     {0xce,'A'},   {0xc5,'E'},   {0xcb,'G'},
10250Sstevel@tonic-gate 	{0xc5,'I'},   {0xc4,'I'},   {0xcb,'K'},   {0xa7,0},
10260Sstevel@tonic-gate 	{0xcb,'L'},   {0xe2,0},     {0xcf,'S'},   {0xed,0},
10270Sstevel@tonic-gate 	{0xcf,'Z'},   {0xff,0},     {0xc5,'U'},   {0xee,0},
10280Sstevel@tonic-gate 	{0xb0,0},     {0xce,'a'},   {0xc5,'e'},   {0xcb,'g'},
10290Sstevel@tonic-gate 	{0xc5,'i'},   {0xc4,'i'},   {0xcb,'k'},   {0xb7,0},
10300Sstevel@tonic-gate 	{0xcb,'l'},   {0xf2,0},     {0xcf,'s'},   {0xfd,0},
10310Sstevel@tonic-gate 	{0xcf,'z'},   {0xd0,0},     {0xc5,'u'},   {0xfe,0},
10320Sstevel@tonic-gate 	{0xc5,'A'},   {0xc2,'A'},   {0xc3,'A'},   {0xc4,'A'},
10330Sstevel@tonic-gate 	{0xc8,'A'},   {0xca,'A'},   {0xe1,0},     {0xce,'I'},
10340Sstevel@tonic-gate 	{0xcf,'C'},   {0xc2,'E'},   {0xce,'E'},   {0xc8,'E'},
10350Sstevel@tonic-gate 	{0xc7,'E'},   {0xc2,'I'},   {0xc3,'I'},   {0xc8,'I'},
10360Sstevel@tonic-gate 	{0,0},        {0xcb,'N'},   {0xc5,'O'},   {0xc2,'O'},
10370Sstevel@tonic-gate 	{0xc3,'O'},   {0xc4,'O'},   {0xc8,'O'},   {0xc4,'U'},
10380Sstevel@tonic-gate 	{0xe9,0},     {0xce,'U'},   {0xc2,'U'},   {0xc3,'U'},
10390Sstevel@tonic-gate 	{0xc8,'U'},   {0xc2,'Y'},   {0xec,0},     {0xfb,0},
10400Sstevel@tonic-gate 	{0xc5,'a'},   {0xc2,'a'},   {0xc3,'a'},   {0xc4,'a'},
10410Sstevel@tonic-gate 	{0xc8,'a'},   {0xca,'a'},   {0xf1,0},     {0xce,'i'},
10420Sstevel@tonic-gate 	{0xcf,'c'},   {0xc2,'e'},   {0xce,'e'},   {0xc8,'e'},
10430Sstevel@tonic-gate 	{0xc7,'e'},   {0xc2,'i'},   {0xc3,'i'},   {0xc8,'i'},
10440Sstevel@tonic-gate 	{0xf3,0},     {0xcb,'n'},   {0xc5,'o'},   {0xc2,'o'},
10450Sstevel@tonic-gate 	{0xc3,'o'},   {0xc4,'o'},   {0xc8,'o'},   {0xc4,'u'},
10460Sstevel@tonic-gate 	{0xf9,0},     {0xce,'u'},   {0xc2,'u'},   {0xc3,'u'},
10470Sstevel@tonic-gate 	{0xc8,'u'},   {0xc2,'y'},   {0xfc,0},     {0xf0,0}
10480Sstevel@tonic-gate };
10490Sstevel@tonic-gate #endif
10500Sstevel@tonic-gate 
10510Sstevel@tonic-gate 
10520Sstevel@tonic-gate static Byte *
c_to_hh(Byte * o,Byte c)10530Sstevel@tonic-gate c_to_hh( Byte *o, Byte c )
10540Sstevel@tonic-gate {
10550Sstevel@tonic-gate   Byte n;
10560Sstevel@tonic-gate 
10570Sstevel@tonic-gate   *o++ = '{'; *o++ = 'x';
10580Sstevel@tonic-gate   n = c >> 4;
10590Sstevel@tonic-gate   *o++ = ((n < 0xA) ? '0' : 'A' - 0xA) + n;
10600Sstevel@tonic-gate   n = c & 0x0F;
10610Sstevel@tonic-gate   *o++ = ((n < 0xA) ? '0' : 'A' - 0xA) + n;
10620Sstevel@tonic-gate   *o++ = '}';
10630Sstevel@tonic-gate   return o;
10640Sstevel@tonic-gate }
10650Sstevel@tonic-gate 
10660Sstevel@tonic-gate 
10670Sstevel@tonic-gate static Byte *
c_to_cc(Byte * o,Couple * cc,Byte c)10680Sstevel@tonic-gate c_to_cc( Byte *o, Couple *cc, Byte c )
10690Sstevel@tonic-gate {
10700Sstevel@tonic-gate   if ( (*cc).a != 0 ) {
10710Sstevel@tonic-gate     if ( (*cc).b == 0 )
10720Sstevel@tonic-gate       *o++ = (*cc).a;
10730Sstevel@tonic-gate     else {
10740Sstevel@tonic-gate       *o++ = '{';
10750Sstevel@tonic-gate       *o++ = (*cc).a;
10760Sstevel@tonic-gate       *o++ = (*cc).b;
10770Sstevel@tonic-gate       *o++ = '}';
10780Sstevel@tonic-gate     }
10790Sstevel@tonic-gate     return o;
10800Sstevel@tonic-gate   }
10810Sstevel@tonic-gate   else
10820Sstevel@tonic-gate     return c_to_hh( o, c );
10830Sstevel@tonic-gate }
10840Sstevel@tonic-gate 
10850Sstevel@tonic-gate /* --- routine to convert from T.61 to ISO 8859-n --- */
10860Sstevel@tonic-gate 
10870Sstevel@tonic-gate int
ldap_t61_to_8859(char ** bufp,unsigned int * buflenp,int free_input)10880Sstevel@tonic-gate ldap_t61_to_8859( char **bufp, unsigned int *buflenp, int free_input )
10890Sstevel@tonic-gate {
10900Sstevel@tonic-gate   Byte		*s, *oo, *o;
10910Sstevel@tonic-gate   unsigned int  n;
10920Sstevel@tonic-gate   int           c;
10930Sstevel@tonic-gate   unsigned int len;
10940Sstevel@tonic-gate   Couple        *cc;
10950Sstevel@tonic-gate 
10960Sstevel@tonic-gate   Debug( LDAP_DEBUG_TRACE, catgets(slapdcat, 1, 111, "ldap_t61_to_8859 input length: %ld\n"),
10970Sstevel@tonic-gate 	*buflenp, 0, 0 );
10980Sstevel@tonic-gate 
10990Sstevel@tonic-gate   len = *buflenp;
11000Sstevel@tonic-gate   s = (Byte *) *bufp;
11010Sstevel@tonic-gate 
11020Sstevel@tonic-gate   if ( (o = oo = (Byte *)malloc( 2 * len + 64 )) == NULL ) {
11030Sstevel@tonic-gate         return( 1 );
11040Sstevel@tonic-gate   }
11050Sstevel@tonic-gate 
11060Sstevel@tonic-gate   while ( (char *)s - *(char **)bufp < len ) {
11070Sstevel@tonic-gate     switch ( *s >> 4 ) {
11080Sstevel@tonic-gate 
11090Sstevel@tonic-gate     case 0xA: case 0xB:
11100Sstevel@tonic-gate       o = c_to_cc( o, &trans_t61a_iso8859[ *s - 0xA0 ], *s );
11110Sstevel@tonic-gate       s++;
11120Sstevel@tonic-gate       break;
11130Sstevel@tonic-gate 
11140Sstevel@tonic-gate     case 0xD: case 0xE: case 0xF:
11150Sstevel@tonic-gate       o = c_to_cc( o, &trans_t61b_iso8859[ *s - 0xD0 ], *s );
11160Sstevel@tonic-gate       s++;
11170Sstevel@tonic-gate       break;
11180Sstevel@tonic-gate 
11190Sstevel@tonic-gate     case 0xC:
11200Sstevel@tonic-gate       if ( (*s == 0xC0) || (*s == 0xC9) || (*s == 0xCC) ) {
11210Sstevel@tonic-gate         o = c_to_hh( o, *s++ );
11220Sstevel@tonic-gate         break;
11230Sstevel@tonic-gate       }
11240Sstevel@tonic-gate 
11250Sstevel@tonic-gate       n = (*s++) - 0xC0;
11260Sstevel@tonic-gate       switch ( *s ) {
11270Sstevel@tonic-gate 
11280Sstevel@tonic-gate       case 'A':  c = letter_w_diacritic[n][0]; break;
11290Sstevel@tonic-gate       case 'C':  c = letter_w_diacritic[n][1]; break;
11300Sstevel@tonic-gate       case 'D':  c = letter_w_diacritic[n][2]; break;
11310Sstevel@tonic-gate       case 'E':  c = letter_w_diacritic[n][3]; break;
11320Sstevel@tonic-gate       case 'G':  c = letter_w_diacritic[n][4]; break;
11330Sstevel@tonic-gate       case 'H':  c = letter_w_diacritic[n][5]; break;
11340Sstevel@tonic-gate       case 'I':  c = letter_w_diacritic[n][6]; break;
11350Sstevel@tonic-gate       case 'J':  c = letter_w_diacritic[n][7]; break;
11360Sstevel@tonic-gate       case 'K':  c = letter_w_diacritic[n][8]; break;
11370Sstevel@tonic-gate       case 'L':  c = letter_w_diacritic[n][9]; break;
11380Sstevel@tonic-gate       case 'N':  c = letter_w_diacritic[n][10]; break;
11390Sstevel@tonic-gate       case 'O':  c = letter_w_diacritic[n][11]; break;
11400Sstevel@tonic-gate       case 'R':  c = letter_w_diacritic[n][12]; break;
11410Sstevel@tonic-gate       case 'S':  c = letter_w_diacritic[n][13]; break;
11420Sstevel@tonic-gate       case 'T':  c = letter_w_diacritic[n][14]; break;
11430Sstevel@tonic-gate       case 'U':  c = letter_w_diacritic[n][15]; break;
11440Sstevel@tonic-gate       case 'W':  c = letter_w_diacritic[n][16]; break;
11450Sstevel@tonic-gate       case 'Y':  c = letter_w_diacritic[n][17]; break;
11460Sstevel@tonic-gate       case 'Z':  c = letter_w_diacritic[n][18]; break;
11470Sstevel@tonic-gate 
11480Sstevel@tonic-gate       case 'a':  c = letter_w_diacritic[n][19]; break;
11490Sstevel@tonic-gate       case 'c':  c = letter_w_diacritic[n][20]; break;
11500Sstevel@tonic-gate       case 'd':  c = letter_w_diacritic[n][21]; break;
11510Sstevel@tonic-gate       case 'e':  c = letter_w_diacritic[n][22]; break;
11520Sstevel@tonic-gate       case 'g':  c = letter_w_diacritic[n][23]; break;
11530Sstevel@tonic-gate       case 'h':  c = letter_w_diacritic[n][24]; break;
11540Sstevel@tonic-gate       case 'i':  c = letter_w_diacritic[n][25]; break;
11550Sstevel@tonic-gate       case 'j':  c = letter_w_diacritic[n][26]; break;
11560Sstevel@tonic-gate       case 'k':  c = letter_w_diacritic[n][27]; break;
11570Sstevel@tonic-gate       case 'l':  c = letter_w_diacritic[n][28]; break;
11580Sstevel@tonic-gate       case 'n':  c = letter_w_diacritic[n][29]; break;
11590Sstevel@tonic-gate       case 'o':  c = letter_w_diacritic[n][30]; break;
11600Sstevel@tonic-gate       case 'r':  c = letter_w_diacritic[n][31]; break;
11610Sstevel@tonic-gate       case 's':  c = letter_w_diacritic[n][32]; break;
11620Sstevel@tonic-gate       case 't':  c = letter_w_diacritic[n][33]; break;
11630Sstevel@tonic-gate       case 'u':  c = letter_w_diacritic[n][34]; break;
11640Sstevel@tonic-gate       case 'w':  c = letter_w_diacritic[n][35]; break;
11650Sstevel@tonic-gate       case 'y':  c = letter_w_diacritic[n][36]; break;
11660Sstevel@tonic-gate       case 'z':  c = letter_w_diacritic[n][37]; break;
11670Sstevel@tonic-gate 
11680Sstevel@tonic-gate       case ALONE:  c = (( !diacritic[n].b ) ? diacritic[n].a : -1);
11690Sstevel@tonic-gate                    break;
11700Sstevel@tonic-gate 
11710Sstevel@tonic-gate       default:   c = 0;
11720Sstevel@tonic-gate       }
11730Sstevel@tonic-gate 
11740Sstevel@tonic-gate       if ( c > 0 ) {
11750Sstevel@tonic-gate         *o++ = c;  s++;
11760Sstevel@tonic-gate       } else {
11770Sstevel@tonic-gate         *o++ = '{';
11780Sstevel@tonic-gate         if ( c == -1 ) {
11790Sstevel@tonic-gate           *o++ = ( ( *s == ALONE ) ? ' ' : *s );
11800Sstevel@tonic-gate           s++;
11810Sstevel@tonic-gate         } else {
11820Sstevel@tonic-gate           *o++ = '"';
11830Sstevel@tonic-gate         }
11840Sstevel@tonic-gate         *o++ = diacritic[n].a;
11850Sstevel@tonic-gate         *o++ = '}';
11860Sstevel@tonic-gate       }
11870Sstevel@tonic-gate       break;
11880Sstevel@tonic-gate 
11890Sstevel@tonic-gate #if (ISO_8859 == 0)
11900Sstevel@tonic-gate     case 0x8: case 0x9:
11910Sstevel@tonic-gate       *o++ = 0x1B; /* <ESC> */
11920Sstevel@tonic-gate       *o++ = *s++ - 0x40;
11930Sstevel@tonic-gate       break;
11940Sstevel@tonic-gate #endif
11950Sstevel@tonic-gate 
11960Sstevel@tonic-gate       default:
11970Sstevel@tonic-gate         *o++ = *s++;
11980Sstevel@tonic-gate     }
11990Sstevel@tonic-gate   }
12000Sstevel@tonic-gate 
12010Sstevel@tonic-gate   len = o - oo;
12020Sstevel@tonic-gate   o = oo;
12030Sstevel@tonic-gate 
12040Sstevel@tonic-gate   if ( (oo = (Byte *)realloc( o, len )) == NULL ) {
12050Sstevel@tonic-gate     free( o );
12060Sstevel@tonic-gate     return( 1 );
12070Sstevel@tonic-gate   }
12080Sstevel@tonic-gate 
12090Sstevel@tonic-gate   if ( free_input ) {
12100Sstevel@tonic-gate     free( *bufp );
12110Sstevel@tonic-gate   }
12120Sstevel@tonic-gate   *bufp = (char *) oo;
12130Sstevel@tonic-gate   *buflenp = len;
12140Sstevel@tonic-gate   return( 0 );
12150Sstevel@tonic-gate }
12160Sstevel@tonic-gate 
12170Sstevel@tonic-gate 
12180Sstevel@tonic-gate static int
hh_to_c(Byte * h)12190Sstevel@tonic-gate hh_to_c( Byte *h )
12200Sstevel@tonic-gate {
12210Sstevel@tonic-gate   Byte c;
12220Sstevel@tonic-gate 
12230Sstevel@tonic-gate   if ( (*h >= '0') && (*h <= '9') )      c = *h++ - '0';
12240Sstevel@tonic-gate   else if ( (*h >= 'A') && (*h <= 'F') ) c = *h++ - 'A' + 10;
12250Sstevel@tonic-gate   else if ( (*h >= 'a') && (*h <= 'f') ) c = *h++ - 'a' + 10;
12260Sstevel@tonic-gate   else return -1;
12270Sstevel@tonic-gate 
12280Sstevel@tonic-gate   c <<= 4;
12290Sstevel@tonic-gate 
12300Sstevel@tonic-gate   if ( (*h >= '0') && (*h <= '9') )      c |= *h - '0';
12310Sstevel@tonic-gate   else if ( (*h >= 'A') && (*h <= 'F') ) c |= *h - 'A' + 10;
12320Sstevel@tonic-gate   else if ( (*h >= 'a') && (*h <= 'f') ) c |= *h - 'a' + 10;
12330Sstevel@tonic-gate   else return -1;
12340Sstevel@tonic-gate 
12350Sstevel@tonic-gate   return c;
12360Sstevel@tonic-gate }
12370Sstevel@tonic-gate 
12380Sstevel@tonic-gate 
12390Sstevel@tonic-gate static Byte *
cc_to_t61(Byte * o,Byte * s)12400Sstevel@tonic-gate cc_to_t61( Byte *o, Byte *s )
12410Sstevel@tonic-gate {
12420Sstevel@tonic-gate   int n, c = 0;
12430Sstevel@tonic-gate 
12440Sstevel@tonic-gate   switch ( *(s + 1) ) {
12450Sstevel@tonic-gate 
12460Sstevel@tonic-gate   case '`':  c = -1;   break;    /* <grave-accent> */
12470Sstevel@tonic-gate 
12480Sstevel@tonic-gate   case '!':
12490Sstevel@tonic-gate     switch ( *s ) {
12500Sstevel@tonic-gate     case '!':  c = 0x7C;  break;  /* <vertical-line> */
12510Sstevel@tonic-gate     case '(':  c = 0x7B;  break;  /* <left-curly-bracket> */
12520Sstevel@tonic-gate     case '-':  c = 0xAD;  break;  /* <upwards-arrow> */
12530Sstevel@tonic-gate     default:   c = -1;            /* <grave-accent> */
12540Sstevel@tonic-gate     }
12550Sstevel@tonic-gate     break;
12560Sstevel@tonic-gate 
12570Sstevel@tonic-gate #if (ISO_8859 == 1) || (ISO_8859 == 2) || (ISO_8859 == 3) || \
12580Sstevel@tonic-gate     (ISO_8859 == 4) || (ISO_8859 == 9)
12590Sstevel@tonic-gate   case 0xB4:
12600Sstevel@tonic-gate #endif
12610Sstevel@tonic-gate   case '\'': c = -2;  break;    /* <acute-accent> */
12620Sstevel@tonic-gate 
12630Sstevel@tonic-gate   case '^':  c = -3;  break;    /* <circumflex-acent> */
12640Sstevel@tonic-gate 
12650Sstevel@tonic-gate   case '>':
12660Sstevel@tonic-gate     switch ( *s ) {
12670Sstevel@tonic-gate     case ')':  c = 0x5D;  break;  /* <right-square-bracket> */
12680Sstevel@tonic-gate     case '>':  c = 0xBB;  break;  /* <right-angle-quotation> */
12690Sstevel@tonic-gate     case '-':  c = 0xAE;  break;  /* <rightwards-arrow> */
12700Sstevel@tonic-gate     default:   c = -3;            /* <circumflex-acent> */
12710Sstevel@tonic-gate     }
12720Sstevel@tonic-gate     break;
12730Sstevel@tonic-gate 
12740Sstevel@tonic-gate   case '~':
12750Sstevel@tonic-gate   case '?':  c = -4;  break;        /* <tilde> */
12760Sstevel@tonic-gate 
12770Sstevel@tonic-gate #if (ISO_8859 == 1) || (ISO_8859 == 4) || (ISO_8859 == 9)
12780Sstevel@tonic-gate   case 0xAF:  c = -5;  break;       /* <macron> */
12790Sstevel@tonic-gate #endif
12800Sstevel@tonic-gate 
12810Sstevel@tonic-gate   case '-':
12820Sstevel@tonic-gate     switch ( *s ) {
12830Sstevel@tonic-gate     case '-':  c = 0xFF; break; /* <soft-hyphen> */
12840Sstevel@tonic-gate     case '<':  c = 0xAC; break; /* <leftwards arrow> */
12850Sstevel@tonic-gate     case '+':  c = 0xB1; break; /* <plus-minus> */
12860Sstevel@tonic-gate     case 'd':  c = 0xF3; break; /* <eth> */
12870Sstevel@tonic-gate     default:   c = -5;          /* <macron> */
12880Sstevel@tonic-gate     }
12890Sstevel@tonic-gate     break;
12900Sstevel@tonic-gate 
12910Sstevel@tonic-gate #if (ISO_8859 == 2) || (ISO_8859 == 3)
12920Sstevel@tonic-gate   case 0xA2:  c = -6;  break;            /* <breve> */
12930Sstevel@tonic-gate #endif
12940Sstevel@tonic-gate 
12950Sstevel@tonic-gate   case '(':
12960Sstevel@tonic-gate     if ( *s == '<' ) c = 0x5B;  /* <left-square-bracket> */
12970Sstevel@tonic-gate     else             c = -6;    /* <breve> */
12980Sstevel@tonic-gate     break;
12990Sstevel@tonic-gate 
13000Sstevel@tonic-gate #if (ISO_8859 == 2) || (ISO_8859 == 3) || (ISO_8859 == 4)
13010Sstevel@tonic-gate   case 0xFF:  c = -7;  break;    /* <dot-accent> */
13020Sstevel@tonic-gate #endif
13030Sstevel@tonic-gate 
13040Sstevel@tonic-gate   case '.':
13050Sstevel@tonic-gate     switch ( *s ) {
13060Sstevel@tonic-gate     case 'i':  c = 0xF5; break; /* <dotless-i> */
13070Sstevel@tonic-gate     case 'L':  c = 0xE7; break; /* <L-middle-dot> */
13080Sstevel@tonic-gate     case 'l':  c = 0xF7; break; /* <l-middle-dot> */
13090Sstevel@tonic-gate     default:   c = -7;          /* <dot-accent> */
13100Sstevel@tonic-gate     }
13110Sstevel@tonic-gate     break;
13120Sstevel@tonic-gate 
13130Sstevel@tonic-gate #if (ISO_8859 == 1) || (ISO_8859 == 2) || (ISO_8859 == 3) || \
13140Sstevel@tonic-gate     (ISO_8859 == 4) || (ISO_8859 == 9)
13150Sstevel@tonic-gate   case 0xA8:  c = -8; break; /* <diaeresis> */
13160Sstevel@tonic-gate #endif
13170Sstevel@tonic-gate 
13180Sstevel@tonic-gate   case ':':
13190Sstevel@tonic-gate     if ( *s == '-')  c = 0xB8; /* <division-sign> */
13200Sstevel@tonic-gate     else             c = -8;   /* <diaeresis> */
13210Sstevel@tonic-gate     break;
13220Sstevel@tonic-gate 
13230Sstevel@tonic-gate #if (ISO_8859 == 1) || (ISO_8859 == 2) || (ISO_8859 == 3) || \
13240Sstevel@tonic-gate     (ISO_8859 == 4) || (ISO_8859 == 9) || (ISO_8859 == 10)
13250Sstevel@tonic-gate   case 0xB0:
13260Sstevel@tonic-gate #endif
13270Sstevel@tonic-gate   case '0':  c = -10;  break;  /* <ring-above> */
13280Sstevel@tonic-gate 
13290Sstevel@tonic-gate #if (ISO_8859 == 1) || (ISO_8859 == 2) || (ISO_8859 == 3) || \
13300Sstevel@tonic-gate     (ISO_8859 == 4) || (ISO_8859 == 9)
13310Sstevel@tonic-gate   case 0xB8:
13320Sstevel@tonic-gate #endif
13330Sstevel@tonic-gate   case ',':  c = -11; break; /* <cedilla> */
13340Sstevel@tonic-gate 
13350Sstevel@tonic-gate #if (ISO_8859 == 2)
13360Sstevel@tonic-gate   case 0xBD:
13370Sstevel@tonic-gate #endif
13380Sstevel@tonic-gate   case '"':  c = -13; break; /* <double-acute-accent> */
13390Sstevel@tonic-gate 
13400Sstevel@tonic-gate #if (ISO_8859 == 2) || (ISO_8859 == 4)
13410Sstevel@tonic-gate   case 0xB2:
13420Sstevel@tonic-gate #endif
13430Sstevel@tonic-gate   case ';':  c = -14; break; /* <ogonek> */
13440Sstevel@tonic-gate 
13450Sstevel@tonic-gate #if (ISO_8859 == 2) || (ISO_8859 == 4)
13460Sstevel@tonic-gate   case 0xB7:  c = -15;  break;  /* <caron> */
13470Sstevel@tonic-gate #endif
13480Sstevel@tonic-gate 
13490Sstevel@tonic-gate   case ')':
13500Sstevel@tonic-gate     if ( *s == '!' )  c = 0x7D;  /* <left-curly-bracket> */
13510Sstevel@tonic-gate     break;
13520Sstevel@tonic-gate 
13530Sstevel@tonic-gate   case '<':
13540Sstevel@tonic-gate     if ( *s == '<' )  c = 0xAB;  /* <left-angle-quotation> */
13550Sstevel@tonic-gate     else              c = -15;   /* <caron> */
13560Sstevel@tonic-gate     break;
13570Sstevel@tonic-gate 
13580Sstevel@tonic-gate   case '/':
13590Sstevel@tonic-gate     switch ( *s ) {
13600Sstevel@tonic-gate     case '/':  c = 0x5C; break; /* <reverse-solidus> */
13610Sstevel@tonic-gate     case 'D':  c = 0xE2; break; /* <D-stroke> */
13620Sstevel@tonic-gate     case 'd':  c = 0xF2; break; /* <d-stroke> */
13630Sstevel@tonic-gate     case 'H':  c = 0xE4; break; /* <H-stroke> */
13640Sstevel@tonic-gate     case 'h':  c = 0xF4; break; /* <h-stroke> */
13650Sstevel@tonic-gate     case 'L':  c = 0xE8; break; /* <L-stroke> */
13660Sstevel@tonic-gate     case 'l':  c = 0xF8; break; /* <l-stroke> */
13670Sstevel@tonic-gate     case 'O':  c = 0xE9; break; /* <O-stroke> */
13680Sstevel@tonic-gate     case 'o':  c = 0xF9; break; /* <o-stroke> */
13690Sstevel@tonic-gate     case 'T':  c = 0xED; break; /* <T-stroke> */
13700Sstevel@tonic-gate     case 't':  c = 0xFD; break; /* <t-stroke> */
13710Sstevel@tonic-gate     }
13720Sstevel@tonic-gate     break;
13730Sstevel@tonic-gate 
13740Sstevel@tonic-gate   case '2':
13750Sstevel@tonic-gate     if ( *s == '1' )  c = 0xBD;    /* <one-half> */
13760Sstevel@tonic-gate     break;
13770Sstevel@tonic-gate 
13780Sstevel@tonic-gate   case '4':
13790Sstevel@tonic-gate     switch ( *s ) {
13800Sstevel@tonic-gate     case '1':  c = 0xBC; break; /* <one-quarter> */
13810Sstevel@tonic-gate     case '3':  c = 0xBE; break; /* <three-quarters> */
13820Sstevel@tonic-gate     }
13830Sstevel@tonic-gate     break;
13840Sstevel@tonic-gate 
13850Sstevel@tonic-gate   case '6':
13860Sstevel@tonic-gate     switch ( *s ) {
13870Sstevel@tonic-gate     case '\'': c = 0xA9; break; /* <left-single-quotation> */
13880Sstevel@tonic-gate     case '"':  c = 0xAA; break; /* <left-double-quotation> */
13890Sstevel@tonic-gate     }
13900Sstevel@tonic-gate     break;
13910Sstevel@tonic-gate 
13920Sstevel@tonic-gate   case '8':
13930Sstevel@tonic-gate     switch ( *s ) {
13940Sstevel@tonic-gate     case '1':  c = 0xDC; break; /* <one-eighth> */
13950Sstevel@tonic-gate     case '3':  c = 0xDD; break; /* <three-eighths> */
13960Sstevel@tonic-gate     case '5':  c = 0xDE; break; /* <five-eighths> */
13970Sstevel@tonic-gate     case '7':  c = 0xDF; break; /* <seven-eighths> */
13980Sstevel@tonic-gate     case 'M':  c = 0xD5; break; /* <eighth-note> */
13990Sstevel@tonic-gate     }
14000Sstevel@tonic-gate     break;
14010Sstevel@tonic-gate 
14020Sstevel@tonic-gate   case '9':
14030Sstevel@tonic-gate     switch ( *s ) {
14040Sstevel@tonic-gate     case '\'': c = 0xB9; break; /* <right-single-quotation> */
14050Sstevel@tonic-gate     case '"':  c = 0xBA; break; /* <right-double-quotation> */
14060Sstevel@tonic-gate     }
14070Sstevel@tonic-gate     break;
14080Sstevel@tonic-gate 
14090Sstevel@tonic-gate   case 'A':
14100Sstevel@tonic-gate     if ( *s == 'A' )  c = -10;  /* <ring-above> + <A> */
14110Sstevel@tonic-gate     break;
14120Sstevel@tonic-gate 
14130Sstevel@tonic-gate   case 'a':
14140Sstevel@tonic-gate     switch ( *s ) {
14150Sstevel@tonic-gate     case '-':  c = 0xE3; break; /* <femenine-ordinal-a> */
14160Sstevel@tonic-gate     case 'a':  c = -10;  break; /* <ring-above> + <a> */
14170Sstevel@tonic-gate     }
14180Sstevel@tonic-gate     break;
14190Sstevel@tonic-gate 
14200Sstevel@tonic-gate   case 'B':
14210Sstevel@tonic-gate     if ( *s == 'B' )  c = 0xD7; /* <broken-bar> */
14220Sstevel@tonic-gate     break;
14230Sstevel@tonic-gate 
14240Sstevel@tonic-gate   case 'b':
14250Sstevel@tonic-gate     if ( *s == 'N' )  c = 0xA6;  /* <number-sign> */
14260Sstevel@tonic-gate     break;
14270Sstevel@tonic-gate 
14280Sstevel@tonic-gate   case 'd':
14290Sstevel@tonic-gate     if ( *s == 'P' )  c = 0xA3;  /* <pound-sign> */
14300Sstevel@tonic-gate     break;
14310Sstevel@tonic-gate 
14320Sstevel@tonic-gate   case 'E':
14330Sstevel@tonic-gate     switch ( *s ) {
14340Sstevel@tonic-gate     case 'S':  c = 0xA7; break; /* <section-sign> */
14350Sstevel@tonic-gate     case 'A':  c = 0xE1; break; /* <AE> */
14360Sstevel@tonic-gate     case 'O':  c = 0xEA; break; /* <OE> */
14370Sstevel@tonic-gate     }
14380Sstevel@tonic-gate     break;
14390Sstevel@tonic-gate 
14400Sstevel@tonic-gate   case 'e':
14410Sstevel@tonic-gate     switch ( *s ) {
14420Sstevel@tonic-gate     case 'a':  c = 0xF1; break; /* <ae> */
14430Sstevel@tonic-gate     case 'o':  c = 0xFA; break; /* <oe> */
14440Sstevel@tonic-gate     case 'Y':  c = 0xA5;  break;  /* <yen-sign> */
14450Sstevel@tonic-gate     }
14460Sstevel@tonic-gate     break;
14470Sstevel@tonic-gate 
14480Sstevel@tonic-gate   case 'G':
14490Sstevel@tonic-gate     switch ( *s ) {
14500Sstevel@tonic-gate     case 'D':  c = 0xB0; break; /* <degree-sign> */
14510Sstevel@tonic-gate     case 'N':  c = 0xEE; break; /* <Eng> */
14520Sstevel@tonic-gate     }
14530Sstevel@tonic-gate     break;
14540Sstevel@tonic-gate 
14550Sstevel@tonic-gate   case 'g':
14560Sstevel@tonic-gate     switch ( *s ) {
14570Sstevel@tonic-gate     case 'R':  c = 0xD2; break;  /* <registered-sign> */
14580Sstevel@tonic-gate     case 'n':  c = 0xFE; break; /* <eng> */
14590Sstevel@tonic-gate     }
14600Sstevel@tonic-gate     break;
14610Sstevel@tonic-gate 
14620Sstevel@tonic-gate   case 'H':
14630Sstevel@tonic-gate     if ( *s == 'T' )  c = 0xEC;  /* <Thorn> */
14640Sstevel@tonic-gate     break;
14650Sstevel@tonic-gate 
14660Sstevel@tonic-gate   case 'h':
14670Sstevel@tonic-gate     if ( *s == 't' )  c = 0xFC; /* <thorn> */
14680Sstevel@tonic-gate     break;
14690Sstevel@tonic-gate 
14700Sstevel@tonic-gate   case 'I':
14710Sstevel@tonic-gate     switch ( *s ) {
14720Sstevel@tonic-gate     case 'P':  c = 0xB6; break;  /* <pilcrow-sign> */
14730Sstevel@tonic-gate     case '!':  c = 0xA1; break; /* <inverted-exclamation> */
14740Sstevel@tonic-gate     case '?':  c = 0xBF; break; /* <inverted-question> */
14750Sstevel@tonic-gate     }
14760Sstevel@tonic-gate     break;
14770Sstevel@tonic-gate 
14780Sstevel@tonic-gate   case 'J':
14790Sstevel@tonic-gate     if ( *s == 'I' )  c = 0xE6; /* <IJ> */
14800Sstevel@tonic-gate     break;
14810Sstevel@tonic-gate 
14820Sstevel@tonic-gate   case 'j':
14830Sstevel@tonic-gate     if ( *s == 'i' )  c = 0xF6;  /* <ij> */
14840Sstevel@tonic-gate     break;
14850Sstevel@tonic-gate 
14860Sstevel@tonic-gate   case 'k':
14870Sstevel@tonic-gate     if ( *s == 'k' )  c = 0xF0; /* <kra> */
14880Sstevel@tonic-gate     break;
14890Sstevel@tonic-gate 
14900Sstevel@tonic-gate   case 'M':
14910Sstevel@tonic-gate     switch ( *s ) {
14920Sstevel@tonic-gate     case '.':  c = 0xB7; break; /* <middle-dot> */
14930Sstevel@tonic-gate     case '-':  c = 0xD0; break; /* <em-dash> */
14940Sstevel@tonic-gate     case 'T':  c = 0xD4; break; /* <trade-mark-sign> */
14950Sstevel@tonic-gate     }
14960Sstevel@tonic-gate     break;
14970Sstevel@tonic-gate 
14980Sstevel@tonic-gate   case 'm':
14990Sstevel@tonic-gate     switch ( *s ) {
15000Sstevel@tonic-gate     case '\'':                  /* <macron> RFC 1345 */
15010Sstevel@tonic-gate     case ' ':  c = -5;   break; /* <macron> */
15020Sstevel@tonic-gate     case 'O':  c = 0xE0; break; /* <Ohm sign> */
15030Sstevel@tonic-gate     }
15040Sstevel@tonic-gate     break;
15050Sstevel@tonic-gate 
15060Sstevel@tonic-gate   case 'n':
15070Sstevel@tonic-gate     if ( *s == '\'' )  c = 0xEF; /* <n-preceded-by-apostrophe> */
15080Sstevel@tonic-gate     break;
15090Sstevel@tonic-gate 
15100Sstevel@tonic-gate   case 'O':
15110Sstevel@tonic-gate     switch ( *s ) {
15120Sstevel@tonic-gate     case 'D':  c = 0xA4; break; /* <dollar-sign> */
15130Sstevel@tonic-gate     case 'N':  c = 0xD6; break; /* <not-sign> */
15140Sstevel@tonic-gate     }
15150Sstevel@tonic-gate     break;
15160Sstevel@tonic-gate 
15170Sstevel@tonic-gate   case 'o':
15180Sstevel@tonic-gate     switch ( *s ) {
15190Sstevel@tonic-gate     case 'C':  c = 0xD3; break; /* <copyright-sign> */
15200Sstevel@tonic-gate     case '-':  c = 0xEB; break; /* <masculine-ordinal-o> */
15210Sstevel@tonic-gate     }
15220Sstevel@tonic-gate     break;
15230Sstevel@tonic-gate 
15240Sstevel@tonic-gate   case 'S':
15250Sstevel@tonic-gate     switch ( *s ) {
15260Sstevel@tonic-gate     case '1':  c = 0xD1; break; /* <superscript-1> */
15270Sstevel@tonic-gate     case '2':  c = 0xB2; break; /* <superscript-2> */
15280Sstevel@tonic-gate     case '3':  c = 0xB3; break; /* <superscript-3> */
15290Sstevel@tonic-gate     case 'N':  c = 0xA0; break; /* <no-break-space> */
15300Sstevel@tonic-gate     }
15310Sstevel@tonic-gate     break;
15320Sstevel@tonic-gate 
15330Sstevel@tonic-gate   case 's':
15340Sstevel@tonic-gate     if ( *s == 's' )  c = 0xFB; /* <sharp-s> */
15350Sstevel@tonic-gate     break;
15360Sstevel@tonic-gate 
15370Sstevel@tonic-gate   case 't':
15380Sstevel@tonic-gate     if ( *s == 'C' )  c = 0xA2; /* <cent-sign> */
15390Sstevel@tonic-gate     break;
15400Sstevel@tonic-gate 
15410Sstevel@tonic-gate   case 'u':
15420Sstevel@tonic-gate     if ( *s == 'C' )  c = 0xA8; /* <currency-sign> */
15430Sstevel@tonic-gate     break;
15440Sstevel@tonic-gate 
15450Sstevel@tonic-gate   case 'v':
15460Sstevel@tonic-gate     if ( *s == '-' )  c = 0xAF; /* <downwards-arrow> */
15470Sstevel@tonic-gate     break;
15480Sstevel@tonic-gate 
15490Sstevel@tonic-gate   case 'X':
15500Sstevel@tonic-gate     if ( *s == '*' )  c = 0xB4; /* <multiplication-sign> */
15510Sstevel@tonic-gate     break;
15520Sstevel@tonic-gate 
15530Sstevel@tonic-gate   case 'y':
15540Sstevel@tonic-gate     if ( *s == 'M' )  c = 0xB5; /* <micro-sign> */
15550Sstevel@tonic-gate     break;
15560Sstevel@tonic-gate   }
15570Sstevel@tonic-gate 
15580Sstevel@tonic-gate   if ( c > 0 ) {
15590Sstevel@tonic-gate     *o++ = c;
15600Sstevel@tonic-gate     return o;
15610Sstevel@tonic-gate   } else if ( !c )
15620Sstevel@tonic-gate     return NULL;
15630Sstevel@tonic-gate 
15640Sstevel@tonic-gate   /* else: c < 0 */
15650Sstevel@tonic-gate   n = -c;
15660Sstevel@tonic-gate   switch ( *s ) {
15670Sstevel@tonic-gate 
15680Sstevel@tonic-gate   case 'A':  c = letter_w_diacritic[n][0]; break;
15690Sstevel@tonic-gate   case 'C':  c = letter_w_diacritic[n][1]; break;
15700Sstevel@tonic-gate   case 'D':  c = letter_w_diacritic[n][2]; break;
15710Sstevel@tonic-gate   case 'E':  c = letter_w_diacritic[n][3]; break;
15720Sstevel@tonic-gate   case 'G':  c = letter_w_diacritic[n][4]; break;
15730Sstevel@tonic-gate   case 'H':  c = letter_w_diacritic[n][5]; break;
15740Sstevel@tonic-gate   case 'I':  c = letter_w_diacritic[n][6]; break;
15750Sstevel@tonic-gate   case 'J':  c = letter_w_diacritic[n][7]; break;
15760Sstevel@tonic-gate   case 'K':  c = letter_w_diacritic[n][8]; break;
15770Sstevel@tonic-gate   case 'L':  c = letter_w_diacritic[n][9]; break;
15780Sstevel@tonic-gate   case 'N':  c = letter_w_diacritic[n][10]; break;
15790Sstevel@tonic-gate   case 'O':  c = letter_w_diacritic[n][11]; break;
15800Sstevel@tonic-gate   case 'R':  c = letter_w_diacritic[n][12]; break;
15810Sstevel@tonic-gate   case 'S':  c = letter_w_diacritic[n][13]; break;
15820Sstevel@tonic-gate   case 'T':  c = letter_w_diacritic[n][14]; break;
15830Sstevel@tonic-gate   case 'U':  c = letter_w_diacritic[n][15]; break;
15840Sstevel@tonic-gate   case 'W':  c = letter_w_diacritic[n][16]; break;
15850Sstevel@tonic-gate   case 'Y':  c = letter_w_diacritic[n][17]; break;
15860Sstevel@tonic-gate   case 'Z':  c = letter_w_diacritic[n][18]; break;
15870Sstevel@tonic-gate 
15880Sstevel@tonic-gate   case 'a':  c = letter_w_diacritic[n][19]; break;
15890Sstevel@tonic-gate   case 'c':  c = letter_w_diacritic[n][20]; break;
15900Sstevel@tonic-gate   case 'd':  c = letter_w_diacritic[n][21]; break;
15910Sstevel@tonic-gate   case 'e':  c = letter_w_diacritic[n][22]; break;
15920Sstevel@tonic-gate   case 'g':  c = letter_w_diacritic[n][23]; break;
15930Sstevel@tonic-gate   case 'h':  c = letter_w_diacritic[n][24]; break;
15940Sstevel@tonic-gate   case 'i':  c = letter_w_diacritic[n][25]; break;
15950Sstevel@tonic-gate   case 'j':  c = letter_w_diacritic[n][26]; break;
15960Sstevel@tonic-gate   case 'k':  c = letter_w_diacritic[n][27]; break;
15970Sstevel@tonic-gate   case 'l':  c = letter_w_diacritic[n][28]; break;
15980Sstevel@tonic-gate   case 'n':  c = letter_w_diacritic[n][29]; break;
15990Sstevel@tonic-gate   case 'o':  c = letter_w_diacritic[n][30]; break;
16000Sstevel@tonic-gate   case 'r':  c = letter_w_diacritic[n][31]; break;
16010Sstevel@tonic-gate   case 's':  c = letter_w_diacritic[n][32]; break;
16020Sstevel@tonic-gate   case 't':  c = letter_w_diacritic[n][33]; break;
16030Sstevel@tonic-gate   case 'u':  c = letter_w_diacritic[n][34]; break;
16040Sstevel@tonic-gate   case 'w':  c = letter_w_diacritic[n][35]; break;
16050Sstevel@tonic-gate   case 'y':  c = letter_w_diacritic[n][36]; break;
16060Sstevel@tonic-gate   case 'z':  c = letter_w_diacritic[n][37]; break;
16070Sstevel@tonic-gate 
16080Sstevel@tonic-gate   case '\'':
16090Sstevel@tonic-gate   case ' ':  c = -1; break;
16100Sstevel@tonic-gate 
16110Sstevel@tonic-gate   default:   c = 0;
16120Sstevel@tonic-gate   }
16130Sstevel@tonic-gate 
16140Sstevel@tonic-gate   if ( !c )
16150Sstevel@tonic-gate     return NULL;
16160Sstevel@tonic-gate 
16170Sstevel@tonic-gate   *o++ = n + 0xC0;
16180Sstevel@tonic-gate   *o++ = ( ( (*s == ' ') || (*s == '\'') ) ? ALONE : *s );
16190Sstevel@tonic-gate   return o;
16200Sstevel@tonic-gate }
16210Sstevel@tonic-gate 
16220Sstevel@tonic-gate 
16230Sstevel@tonic-gate /* --- routine to convert from ISO 8859-n to T.61 --- */
16240Sstevel@tonic-gate 
16250Sstevel@tonic-gate int
ldap_8859_to_t61(char ** bufp,unsigned int * buflenp,int free_input)16260Sstevel@tonic-gate ldap_8859_to_t61( char **bufp, unsigned int *buflenp, int free_input )
16270Sstevel@tonic-gate {
16280Sstevel@tonic-gate   Byte		*s, *oo, *o, *aux;
16290Sstevel@tonic-gate   int		c;
16300Sstevel@tonic-gate   unsigned int len;
16310Sstevel@tonic-gate   Couple	*cc;
16320Sstevel@tonic-gate 
16330Sstevel@tonic-gate   Debug( LDAP_DEBUG_TRACE, catgets(slapdcat, 1, 112, "ldap_8859_to_t61 input length: %ld\n"),
16340Sstevel@tonic-gate 	*buflenp, 0, 0 );
16350Sstevel@tonic-gate 
16360Sstevel@tonic-gate   len = *buflenp;
16370Sstevel@tonic-gate   s = (Byte *) *bufp;
16380Sstevel@tonic-gate 
16390Sstevel@tonic-gate   if ( (o = oo = (Byte *)malloc( 2 * len + 64 )) == NULL ) {
16400Sstevel@tonic-gate         return( 1 );
16410Sstevel@tonic-gate   }
16420Sstevel@tonic-gate 
16430Sstevel@tonic-gate   while ( (char *)s - *(char **)bufp < len ) {
16440Sstevel@tonic-gate     switch( *s >> 5 ) {
16450Sstevel@tonic-gate 
16460Sstevel@tonic-gate     case 2:
16470Sstevel@tonic-gate       switch ( *s ) {
16480Sstevel@tonic-gate 
16490Sstevel@tonic-gate       case '^':  *o++ = 0xC3; *o++ = ALONE; s++; break;
16500Sstevel@tonic-gate 
16510Sstevel@tonic-gate       case '\\':
16520Sstevel@tonic-gate         s++;
16530Sstevel@tonic-gate         if ( (c = hh_to_c( s )) != -1 ) {
16540Sstevel@tonic-gate           *o++ = c;
16550Sstevel@tonic-gate           s += 2;
16560Sstevel@tonic-gate         } else
16570Sstevel@tonic-gate           *o++ = '\\';
16580Sstevel@tonic-gate         break;
16590Sstevel@tonic-gate 
16600Sstevel@tonic-gate       default:  *o++ = *s++;
16610Sstevel@tonic-gate       }
16620Sstevel@tonic-gate       break;
16630Sstevel@tonic-gate 
16640Sstevel@tonic-gate     case 3:
16650Sstevel@tonic-gate       switch ( *s ) {
16660Sstevel@tonic-gate 
16670Sstevel@tonic-gate       case '`':  *o++ = 0xC1; *o++ = ALONE; s++; break;
16680Sstevel@tonic-gate       case '~':  *o++ = 0xC4; *o++ = ALONE; s++; break;
16690Sstevel@tonic-gate 
16700Sstevel@tonic-gate       case '{':
16710Sstevel@tonic-gate         s++;
16720Sstevel@tonic-gate         if ( *(s + 2) == '}' ) {
16730Sstevel@tonic-gate           if ( (aux = cc_to_t61( o, s )) != NULL ) {
16740Sstevel@tonic-gate             o = aux;
16750Sstevel@tonic-gate             s += 3;
16760Sstevel@tonic-gate           } else {
16770Sstevel@tonic-gate             *o++ = '{';
16780Sstevel@tonic-gate           }
16790Sstevel@tonic-gate         } else if ( (*(s + 3) == '}') && ( (*s == 'x') || (*s == 'X') ) &&
16800Sstevel@tonic-gate                     ( (c = hh_to_c( s + 1 )) != -1 ) ) {
16810Sstevel@tonic-gate           *o++ = c;
16820Sstevel@tonic-gate           s += 4;
16830Sstevel@tonic-gate         } else {
16840Sstevel@tonic-gate           *o++ = '{';
16850Sstevel@tonic-gate         }
16860Sstevel@tonic-gate         break;
16870Sstevel@tonic-gate 
16880Sstevel@tonic-gate       default:
16890Sstevel@tonic-gate         *o++ = *s++;
16900Sstevel@tonic-gate       }
16910Sstevel@tonic-gate       break;
16920Sstevel@tonic-gate 
16930Sstevel@tonic-gate #if (ISO_8859 == 0)
16940Sstevel@tonic-gate     case 4: case 5: case 6: case 7:
16950Sstevel@tonic-gate       s++;
16960Sstevel@tonic-gate       break;
16970Sstevel@tonic-gate #else
16980Sstevel@tonic-gate     case 5: case 6: case 7:
16990Sstevel@tonic-gate # if (ISO_8859 == 1) || (ISO_8859 == 2) || (ISO_8859 == 3) || \
17000Sstevel@tonic-gate      (ISO_8859 == 4) || (ISO_8859 == 9) || (ISO_8859 == 10)
17010Sstevel@tonic-gate       if ( (*(cc = &trans_iso8859_t61[ *s - 0xA0 ])).a ) {
17020Sstevel@tonic-gate 	*o++ = (*cc).a;
17030Sstevel@tonic-gate 	if ( (*cc).b )  *o++ = (*cc).b;
17040Sstevel@tonic-gate       }
17050Sstevel@tonic-gate # endif
17060Sstevel@tonic-gate       s++;
17070Sstevel@tonic-gate       break;
17080Sstevel@tonic-gate #endif
17090Sstevel@tonic-gate 
17100Sstevel@tonic-gate     default:
17110Sstevel@tonic-gate       *o++ = *s++;
17120Sstevel@tonic-gate     }
17130Sstevel@tonic-gate   }
17140Sstevel@tonic-gate 
17150Sstevel@tonic-gate   len = o - oo;
17160Sstevel@tonic-gate   o = oo;
17170Sstevel@tonic-gate 
17180Sstevel@tonic-gate   if ( (oo = (Byte *)realloc( o, len )) == NULL ) {
17190Sstevel@tonic-gate     free( o );
17200Sstevel@tonic-gate     return( 1 );
17210Sstevel@tonic-gate   }
17220Sstevel@tonic-gate 
17230Sstevel@tonic-gate   if ( free_input ) {
17240Sstevel@tonic-gate     free( *bufp );
17250Sstevel@tonic-gate   }
17260Sstevel@tonic-gate   *bufp = (char *) oo;
17270Sstevel@tonic-gate   *buflenp = len;
17280Sstevel@tonic-gate   return( 0 );
17290Sstevel@tonic-gate }
17300Sstevel@tonic-gate 
17310Sstevel@tonic-gate 
17320Sstevel@tonic-gate #ifdef NOT_NEEDED_IN_LIBLDAP	/* mcs@umich.edu 12 Oct 1995 */
17330Sstevel@tonic-gate /* --- routine to convert "escaped" (\hh) characters to 8bits --- */
17340Sstevel@tonic-gate 
convert_escaped_to_8bit(s)17350Sstevel@tonic-gate void convert_escaped_to_8bit( s )
17360Sstevel@tonic-gate char	*s;
17370Sstevel@tonic-gate {
17380Sstevel@tonic-gate   char	*o = s;
17390Sstevel@tonic-gate   int	c;
17400Sstevel@tonic-gate 
17410Sstevel@tonic-gate   while ( *s ) {
17420Sstevel@tonic-gate     if ( *s == '\\' ) {
17430Sstevel@tonic-gate       if ( (c = hh_to_c( ++s )) != -1 ) {
17440Sstevel@tonic-gate 	*o++ = c;
17450Sstevel@tonic-gate 	s += 2;
17460Sstevel@tonic-gate       } else
17470Sstevel@tonic-gate         *o++ = '\\';
17480Sstevel@tonic-gate     } else
17490Sstevel@tonic-gate       *o++ = *s++;
17500Sstevel@tonic-gate   }
17510Sstevel@tonic-gate   *o = '\0';
17520Sstevel@tonic-gate }
17530Sstevel@tonic-gate 
17540Sstevel@tonic-gate /* --- routine to convert 8bits characters to the "escaped" (\hh) form --- */
17550Sstevel@tonic-gate 
convert_8bit_to_escaped(s)17560Sstevel@tonic-gate char *convert_8bit_to_escaped( s )
17570Sstevel@tonic-gate Byte  *s;
17580Sstevel@tonic-gate {
17590Sstevel@tonic-gate   Byte	*o, *oo;
17600Sstevel@tonic-gate   Byte	n;
17610Sstevel@tonic-gate 
17620Sstevel@tonic-gate   if ( (o = oo = (Byte *)malloc( 2 * strlen( s ) + 64 )) == NULL ) {
17630Sstevel@tonic-gate         return( NULL );
17640Sstevel@tonic-gate   }
17650Sstevel@tonic-gate 
17660Sstevel@tonic-gate   while ( *s ) {
17670Sstevel@tonic-gate     if ( *s < 0x80 )
17680Sstevel@tonic-gate       *o++ = *s++;
17690Sstevel@tonic-gate     else {
17700Sstevel@tonic-gate       *o++ = '\\';
17710Sstevel@tonic-gate       n = *s >> 4;
17720Sstevel@tonic-gate       *o++ = ((n < 0xA) ? '0' : 'A' - 0xA) + n;
17730Sstevel@tonic-gate       n = *s++ & 0x0F;
17740Sstevel@tonic-gate       *o++ = ((n < 0xA) ? '0' : 'A' - 0xA) + n;
17750Sstevel@tonic-gate     }
17760Sstevel@tonic-gate   }
17770Sstevel@tonic-gate   *o = '\0';
17780Sstevel@tonic-gate 
17790Sstevel@tonic-gate   o = oo;
17800Sstevel@tonic-gate 
17810Sstevel@tonic-gate   if ( (oo = (Byte *)realloc( o, strlen( o ) + 1 )) == NULL ) {
17820Sstevel@tonic-gate     free( o );
17830Sstevel@tonic-gate     return( NULL );
17840Sstevel@tonic-gate   }
17850Sstevel@tonic-gate 
17860Sstevel@tonic-gate   return( (char *)oo );
17870Sstevel@tonic-gate }
17880Sstevel@tonic-gate 
17890Sstevel@tonic-gate /* --- routine to convert from T.61 to printable characters --- */
17900Sstevel@tonic-gate 
17910Sstevel@tonic-gate /*
17920Sstevel@tonic-gate    printable characters [RFC 1488]: 'A'..'Z', 'a'..'z', '0'..'9',
17930Sstevel@tonic-gate        '\'', '(', ')', '+', ',', '-', '.', '/', ':', '?, ' '.
17940Sstevel@tonic-gate 
17950Sstevel@tonic-gate    that conversion is language dependent.
17960Sstevel@tonic-gate */
17970Sstevel@tonic-gate 
17980Sstevel@tonic-gate static Couple last_t61_printabled[32] = {
17990Sstevel@tonic-gate 	{0,0},     {'A','E'}, {'D',0},   {0,0},
18000Sstevel@tonic-gate 	{'H',0},   {0,0},     {'I','J'}, {'L',0},
18010Sstevel@tonic-gate 	{'L',0},   {'O',0},   {'O','E'}, {0,0},
18020Sstevel@tonic-gate 	{'T','H'}, {'T',0},   {'N','G'}, {'n',0},
18030Sstevel@tonic-gate 	{'k',0},   {'a','e'}, {'d',0},   {'d',0},
18040Sstevel@tonic-gate 	{'h',0},   {'i',0},   {'i','j'}, {'l',0},
18050Sstevel@tonic-gate 	{'l',0},   {'o',0},   {'o','e'}, {'s','s'},
18060Sstevel@tonic-gate 	{'t','h'}, {'t',0},   {'n','g'}, {0,0}
18070Sstevel@tonic-gate };
18080Sstevel@tonic-gate 
t61_printable(s)18090Sstevel@tonic-gate char *t61_printable( s )
18100Sstevel@tonic-gate Byte  *s;
18110Sstevel@tonic-gate {
18120Sstevel@tonic-gate   Byte   *o, *oo;
18130Sstevel@tonic-gate   Byte   n;
18140Sstevel@tonic-gate   Couple *cc;
18150Sstevel@tonic-gate 
18160Sstevel@tonic-gate   if ( (o = oo = (Byte *)malloc( 2 * strlen( s ) + 64 )) == NULL ) {
18170Sstevel@tonic-gate         return( NULL );
18180Sstevel@tonic-gate   }
18190Sstevel@tonic-gate 
18200Sstevel@tonic-gate   while ( *s ) {
18210Sstevel@tonic-gate     if ( ( (*s >= 'A') && (*s <= 'Z') ) ||
18220Sstevel@tonic-gate          ( (*s >= 'a') && (*s <= 'z') ) ||
18230Sstevel@tonic-gate          ( (*s >= '0') && (*s <= '9') ) ||
18240Sstevel@tonic-gate          ( (*s >= '\'') && (*s <= ')') ) ||
18250Sstevel@tonic-gate          ( (*s >= '+') && (*s <= '/') ) ||
18260Sstevel@tonic-gate          ( *s == '?' ) || ( *s == ' ' ) )
18270Sstevel@tonic-gate       *o++ = *s++;
18280Sstevel@tonic-gate     else {
18290Sstevel@tonic-gate       if ( *s >= 0xE0 ) {
18300Sstevel@tonic-gate 	if ( (*(cc = &last_t61_printabled[ *s - 0xE0 ])).a ) {
18310Sstevel@tonic-gate           *o++ = (*cc).a;
18320Sstevel@tonic-gate           if ( (*cc).b )  *o++ = (*cc).b;
18330Sstevel@tonic-gate         }
18340Sstevel@tonic-gate       }
18350Sstevel@tonic-gate       else if ( (*s >> 4) == 0xC ) {
18360Sstevel@tonic-gate         switch ( *s ) {
18370Sstevel@tonic-gate 	case 0xCA:			/* ring */
18380Sstevel@tonic-gate 	  switch ( *(s + 1) ) {
18390Sstevel@tonic-gate 	  case 'A':  *o++ = 'A'; *o++ = 'A'; s++; break; /* Swedish */
18400Sstevel@tonic-gate 	  case 'a':  *o++ = 'a'; *o++ = 'a'; s++; break; /* Swedish */
18410Sstevel@tonic-gate 	  }
18420Sstevel@tonic-gate 	  break;
18430Sstevel@tonic-gate 
18440Sstevel@tonic-gate 	case 0xC8:			/* diaeresis */
18450Sstevel@tonic-gate 	  switch ( *(s + 1) ) {
18460Sstevel@tonic-gate 	  case 'Y':  *o++ = 'I'; *o++ = 'J'; s++; break; /* Dutch */
18470Sstevel@tonic-gate 	  case 'y':  *o++ = 'i'; *o++ = 'j'; s++; break; /* Dutch */
18480Sstevel@tonic-gate           }
18490Sstevel@tonic-gate 	  break;
18500Sstevel@tonic-gate         }
18510Sstevel@tonic-gate       }
18520Sstevel@tonic-gate       s++;
18530Sstevel@tonic-gate     }
18540Sstevel@tonic-gate   }
18550Sstevel@tonic-gate   *o = '\0';
18560Sstevel@tonic-gate 
18570Sstevel@tonic-gate   o = oo;
18580Sstevel@tonic-gate 
18590Sstevel@tonic-gate   if ( (oo = (Byte *)realloc( o, strlen( o ) + 1 )) == NULL ) {
18600Sstevel@tonic-gate     free( o );
18610Sstevel@tonic-gate     return( NULL );
18620Sstevel@tonic-gate   }
18630Sstevel@tonic-gate 
18640Sstevel@tonic-gate   return( (char *)oo );
18650Sstevel@tonic-gate }
18660Sstevel@tonic-gate #endif /* NOT_NEEDED_IN_LIBLDAP */	/* mcs@umich.edu 12 Oct 1995 */
18670Sstevel@tonic-gate 
18680Sstevel@tonic-gate #endif /* LDAP_CHARSET_8859 */
18690Sstevel@tonic-gate #endif /* STR_TRANSLATION */
1870