1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

pgindent run over code.

This commit is contained in:
Bruce Momjian
1999-05-25 16:15:34 +00:00
parent 4b04b01aaa
commit 07842084fe
413 changed files with 11723 additions and 10769 deletions

View File

@@ -2,7 +2,7 @@
* conversion between client encoding and server internal encoding
* (currently mule internal code (mic) is used)
* Tatsuo Ishii
* $Id: conv.c,v 1.7 1999/04/25 18:09:54 tgl Exp $
* $Id: conv.c,v 1.8 1999/05/25 16:12:41 momjian Exp $
*/
#include <stdio.h>
#include <string.h>
@@ -375,43 +375,52 @@ mic2euc_tw(unsigned char *mic, unsigned char *p, int len)
static void
big52mic(unsigned char *big5, unsigned char *p, int len)
{
unsigned short c1;
unsigned short big5buf, cnsBuf;
unsigned char lc;
char bogusBuf[2];
int i;
unsigned short c1;
unsigned short big5buf,
cnsBuf;
unsigned char lc;
char bogusBuf[2];
int i;
while (len > 0 && (c1 = *big5++))
{
if (c1 <= 0x007fU) { /* ASCII */
len--;
*p++ = c1;
} else {
len -= 2;
big5buf = c1 << 8;
c1 = *big5++;
big5buf |= c1;
cnsBuf = BIG5toCNS(big5buf, &lc);
if (lc != 0) {
if (lc == LC_CNS11643_3 || lc == LC_CNS11643_4) {
*p++ = 0x9d; /* LCPRV2 */
}
*p++ = lc; /* Plane No. */
*p++ = (cnsBuf >> 8) & 0x00ff;
*p++ = cnsBuf & 0x00ff;
} else { /* cannot convert */
big5 -= 2;
*p++ = '(';
for (i=0;i<2;i++) {
sprintf(bogusBuf,"%02x",*big5++);
*p++ = bogusBuf[0];
*p++ = bogusBuf[1];
}
*p++ = ')';
while (len > 0 && (c1 = *big5++))
{
if (c1 <= 0x007f U)
{ /* ASCII */
len--;
*p++ = c1;
}
else
{
len -= 2;
big5buf = c1 << 8;
c1 = *big5++;
big5buf |= c1;
cnsBuf = BIG5toCNS(big5buf, &lc);
if (lc != 0)
{
if (lc == LC_CNS11643_3 || lc == LC_CNS11643_4)
{
*p++ = 0x9d;/* LCPRV2 */
}
*p++ = lc; /* Plane No. */
*p++ = (cnsBuf >> 8) & 0x00ff;
*p++ = cnsBuf & 0x00ff;
}
else
{ /* cannot convert */
big5 -= 2;
*p++ = '(';
for (i = 0; i < 2; i++)
{
sprintf(bogusBuf, "%02x", *big5++);
*p++ = bogusBuf[0];
*p++ = bogusBuf[1];
}
*p++ = ')';
}
}
}
}
}
*p = '\0';
*p = '\0';
}
/*
@@ -420,41 +429,46 @@ big52mic(unsigned char *big5, unsigned char *p, int len)
static void
mic2big5(unsigned char *mic, unsigned char *p, int len)
{
int l;
unsigned short c1;
unsigned short big5buf, cnsBuf;
int l;
unsigned short c1;
unsigned short big5buf,
cnsBuf;
while (len > 0 && (c1 = *mic))
{
l = pg_mic_mblen(mic++);
len -= l;
while (len > 0 && (c1 = *mic))
{
l = pg_mic_mblen(mic++);
len -= l;
/* 0x9d means LCPRV2 */
if (c1 == LC_CNS11643_1 || c1 == LC_CNS11643_2 || c1 == 0x9d)
{
if (c1 == 0x9d) {
c1 = *mic++; /* get plane no. */
}
cnsBuf = (*mic++)<<8;
cnsBuf |= (*mic++) & 0x00ff;
big5buf = CNStoBIG5(cnsBuf, c1);
if (big5buf == 0) { /* cannot convert to Big5! */
mic -= l;
printBogusChar(&mic, &p);
} else {
*p++ = (big5buf >> 8) & 0x00ff;
*p++ = big5buf & 0x00ff;
}
/* 0x9d means LCPRV2 */
if (c1 == LC_CNS11643_1 || c1 == LC_CNS11643_2 || c1 == 0x9d)
{
if (c1 == 0x9d)
{
c1 = *mic++; /* get plane no. */
}
cnsBuf = (*mic++) << 8;
cnsBuf |= (*mic++) & 0x00ff;
big5buf = CNStoBIG5(cnsBuf, c1);
if (big5buf == 0)
{ /* cannot convert to Big5! */
mic -= l;
printBogusChar(&mic, &p);
}
else
{
*p++ = (big5buf >> 8) & 0x00ff;
*p++ = big5buf & 0x00ff;
}
}
else if (c1 <= 0x7f) /* ASCII */
*p++ = c1;
else
{ /* cannot convert to Big5! */
mic--;
printBogusChar(&mic, &p);
}
}
else if (c1 <= 0x7f) /* ASCII */
{
*p++ = c1;
} else { /* cannot convert to Big5! */
mic--;
printBogusChar(&mic, &p);
}
}
*p = '\0';
*p = '\0';
}
/*
@@ -543,6 +557,7 @@ mic2latin4(unsigned char *mic, unsigned char *p, int len)
{
mic2latin(mic, p, len, LC_ISO8859_4);
}
#ifdef NOT_USED
static void
latin52mic(unsigned char *l, unsigned char *p, int len)
@@ -554,6 +569,7 @@ mic2latin5(unsigned char *mic, unsigned char *p, int len)
{
mic2latin(mic, p, len, LC_ISO8859_5);
}
#endif
/*
@@ -590,7 +606,7 @@ mic2ascii(unsigned char *mic, unsigned char *p, int len)
*p = '\0';
}
/*
/*
* Cyrillic support
* currently supported Cyrillic encodings:
*
@@ -601,18 +617,18 @@ mic2ascii(unsigned char *mic, unsigned char *p, int len)
* Alternativny Variant (MS-DOS CP866)
*/
/* koi2mic: KOI8-R to Mule internal code */
/* koi2mic: KOI8-R to Mule internal code */
static void
koi2mic(unsigned char *l, unsigned char *p, int len)
{
latin2mic(l, p, len, LC_KOI8_R);
latin2mic(l, p, len, LC_KOI8_R);
}
/* mic2koi: Mule internal code to KOI8-R */
static void
mic2koi(unsigned char *mic, unsigned char *p, int len)
{
mic2latin(mic, p, len, LC_KOI8_R);
mic2latin(mic, p, len, LC_KOI8_R);
}
/*
@@ -625,30 +641,36 @@ mic2koi(unsigned char *mic, unsigned char *p, int len)
*/
static void
latin2mic_with_table(
unsigned char *l, /* local charset string (source) */
unsigned char *p, /* pointer to store mule internal code
(destination) */
int len, /* length of l */
int lc, /* leading character of p */
unsigned char *tab /* code conversion table */
)
unsigned char *l, /* local charset string (source) */
unsigned char *p, /* pointer to store mule internal
* code (destination) */
int len, /* length of l */
int lc, /* leading character of p */
unsigned char *tab /* code conversion table */
)
{
unsigned char c1,c2;
while (len-- > 0 && (c1 = *l++)) {
if (c1 < 128) {
*p++ = c1;
} else {
c2 = tab[c1 - 128];
if (c2) {
*p++ = lc;
*p++ = c2;
} else {
*p++ = ' '; /* cannot convert */
}
}
}
*p = '\0';
unsigned char c1,
c2;
while (len-- > 0 && (c1 = *l++))
{
if (c1 < 128)
*p++ = c1;
else
{
c2 = tab[c1 - 128];
if (c2)
{
*p++ = lc;
*p++ = c2;
}
else
{
*p++ = ' '; /* cannot convert */
}
}
}
*p = '\0';
}
/*
@@ -656,190 +678,202 @@ latin2mic_with_table(
* conversion from the mule internal code to a local charset
* with a encoding conversion table.
* the table is ordered according to the second byte of the mule
* internal code starting from 128 (0x80).
* internal code starting from 128 (0x80).
* each entry in the table
* holds the corresponding code point for the local code.
*/
static void
mic2latin_with_table(
unsigned char *mic, /* mule internal code (source) */
unsigned char *p, /* local code (destination) */
int len, /* length of p */
int lc, /* leading character */
unsigned char *tab /* code conversion table */
)
unsigned char *mic, /* mule internal code
* (source) */
unsigned char *p, /* local code (destination) */
int len, /* length of p */
int lc, /* leading character */
unsigned char *tab /* code conversion table */
)
{
unsigned char c1,c2;
unsigned char c1,
c2;
while (len-- > 0 && (c1 = *mic++)) {
if (c1 < 128) {
*p++ = c1;
} else if (c1 == lc) {
c1 = *mic++;
len--;
c2 = tab[c1 - 128];
if (c2) {
*p++ = c2;
} else {
*p++ = ' '; /* cannot convert */
}
} else {
*p++ = ' '; /* bogus character */
}
}
*p = '\0';
while (len-- > 0 && (c1 = *mic++))
{
if (c1 < 128)
*p++ = c1;
else if (c1 == lc)
{
c1 = *mic++;
len--;
c2 = tab[c1 - 128];
if (c2)
*p++ = c2;
else
{
*p++ = ' '; /* cannot convert */
}
}
else
{
*p++ = ' '; /* bogus character */
}
}
*p = '\0';
}
/* iso2mic: ISO-8859-5 to Mule internal code */
/* iso2mic: ISO-8859-5 to Mule internal code */
static void
iso2mic(unsigned char *l, unsigned char *p, int len)
{
static char iso2koi[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa,
0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0,
0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe,
0xfb, 0xfd, 0xff, 0xf9, 0xf8, 0xfc, 0xe0, 0xf1,
0xc1, 0xc2, 0xd7, 0xc7, 0xc4, 0xc5, 0xd6, 0xda,
0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
0xd2, 0xd3, 0xd4, 0xd5, 0xc6, 0xc8, 0xc3, 0xde,
0xdb, 0xdd, 0xdf, 0xd9, 0xd8, 0xdc, 0xc0, 0xd1,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
latin2mic_with_table(l, p, len, LC_KOI8_R, iso2koi);
static char iso2koi[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa,
0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0,
0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe,
0xfb, 0xfd, 0xff, 0xf9, 0xf8, 0xfc, 0xe0, 0xf1,
0xc1, 0xc2, 0xd7, 0xc7, 0xc4, 0xc5, 0xd6, 0xda,
0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
0xd2, 0xd3, 0xd4, 0xd5, 0xc6, 0xc8, 0xc3, 0xde,
0xdb, 0xdd, 0xdf, 0xd9, 0xd8, 0xdc, 0xc0, 0xd1,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
latin2mic_with_table(l, p, len, LC_KOI8_R, iso2koi);
}
/* mic2iso: Mule internal code to ISO8859-5 */
static void
mic2iso(unsigned char *mic, unsigned char *p, int len)
{
static char koi2iso[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xee, 0xd0, 0xd1, 0xe6, 0xd4, 0xd5, 0xe4, 0xd3,
0xe5, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde,
0xdf, 0xef, 0xe0, 0xe1, 0xe2, 0xe3, 0xd6, 0xd2,
0xec, 0xeb, 0xd7, 0xe8, 0xed, 0xe9, 0xe7, 0xea,
0xce, 0xb0, 0xb1, 0xc6, 0xb4, 0xb5, 0xc4, 0xb3,
0xc5, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe,
0xbf, 0xcf, 0xc0, 0xc1, 0xc2, 0xc3, 0xb6, 0xb2,
0xcc, 0xcb, 0xb7, 0xc8, 0xcd, 0xc9, 0xc7, 0xca
};
static char koi2iso[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xee, 0xd0, 0xd1, 0xe6, 0xd4, 0xd5, 0xe4, 0xd3,
0xe5, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde,
0xdf, 0xef, 0xe0, 0xe1, 0xe2, 0xe3, 0xd6, 0xd2,
0xec, 0xeb, 0xd7, 0xe8, 0xed, 0xe9, 0xe7, 0xea,
0xce, 0xb0, 0xb1, 0xc6, 0xb4, 0xb5, 0xc4, 0xb3,
0xc5, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe,
0xbf, 0xcf, 0xc0, 0xc1, 0xc2, 0xc3, 0xb6, 0xb2,
0xcc, 0xcb, 0xb7, 0xc8, 0xcd, 0xc9, 0xc7, 0xca
};
mic2latin_with_table(mic, p, len, LC_KOI8_R, koi2iso);
mic2latin_with_table(mic, p, len, LC_KOI8_R, koi2iso);
}
/* win2mic: CP1251 to Mule internal code */
/* win2mic: CP1251 to Mule internal code */
static void
win2mic(unsigned char *l, unsigned char *p, int len)
{
static char win2koi[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00,
0xb3, 0x00, 0xb4, 0x00, 0x00, 0x00, 0x00, 0xb7,
0x00, 0x00, 0xb6, 0xa6, 0xad, 0x00, 0x00, 0x00,
0xa3, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x00, 0xa7,
0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa,
0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0,
0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe,
0xfb, 0xfd, 0xff, 0xf9, 0xf8, 0xfc, 0xe0, 0xf1,
0xc1, 0xc2, 0xd7, 0xc7, 0xc4, 0xc5, 0xd6, 0xda,
0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
0xd2, 0xd3, 0xd4, 0xd5, 0xc6, 0xc8, 0xc3, 0xde,
0xdb, 0xdd, 0xdf, 0xd9, 0xd8, 0xdc, 0xc0, 0xd1
};
latin2mic_with_table(l, p, len, LC_KOI8_R, win2koi);
static char win2koi[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00,
0xb3, 0x00, 0xb4, 0x00, 0x00, 0x00, 0x00, 0xb7,
0x00, 0x00, 0xb6, 0xa6, 0xad, 0x00, 0x00, 0x00,
0xa3, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x00, 0xa7,
0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa,
0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0,
0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe,
0xfb, 0xfd, 0xff, 0xf9, 0xf8, 0xfc, 0xe0, 0xf1,
0xc1, 0xc2, 0xd7, 0xc7, 0xc4, 0xc5, 0xd6, 0xda,
0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
0xd2, 0xd3, 0xd4, 0xd5, 0xc6, 0xc8, 0xc3, 0xde,
0xdb, 0xdd, 0xdf, 0xd9, 0xd8, 0xdc, 0xc0, 0xd1
};
latin2mic_with_table(l, p, len, LC_KOI8_R, win2koi);
}
/* mic2win: Mule internal code to CP1251 */
static void
mic2win(unsigned char *mic, unsigned char *p, int len)
{
static char koi2win[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xb8, 0xba, 0x00, 0xb3, 0xbf,
0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00,
0x00, 0x00, 0x00, 0xa8, 0xaa, 0x00, 0xb2, 0xaf,
0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0x00, 0x00,
0xfe, 0xe0, 0xe1, 0xf6, 0xe4, 0xe5, 0xf4, 0xe3,
0xf5, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee,
0xef, 0xff, 0xf0, 0xf1, 0xf2, 0xf3, 0xe6, 0xe2,
0xfc, 0xfb, 0xe7, 0xf8, 0xfd, 0xf9, 0xf7, 0xfa,
0xde, 0xc0, 0xc1, 0xd6, 0xc4, 0xc5, 0xd4, 0xc3,
0xd5, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce,
0xcf, 0xdf, 0xd0, 0xd1, 0xd2, 0xd3, 0xc6, 0xc2,
0xdc, 0xdb, 0xc7, 0xd8, 0xdd, 0xd9, 0xd7, 0xda
};
mic2latin_with_table(mic, p, len, LC_KOI8_R, koi2win);
static char koi2win[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xb8, 0xba, 0x00, 0xb3, 0xbf,
0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00,
0x00, 0x00, 0x00, 0xa8, 0xaa, 0x00, 0xb2, 0xaf,
0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0x00, 0x00,
0xfe, 0xe0, 0xe1, 0xf6, 0xe4, 0xe5, 0xf4, 0xe3,
0xf5, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee,
0xef, 0xff, 0xf0, 0xf1, 0xf2, 0xf3, 0xe6, 0xe2,
0xfc, 0xfb, 0xe7, 0xf8, 0xfd, 0xf9, 0xf7, 0xfa,
0xde, 0xc0, 0xc1, 0xd6, 0xc4, 0xc5, 0xd4, 0xc3,
0xd5, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce,
0xcf, 0xdf, 0xd0, 0xd1, 0xd2, 0xd3, 0xc6, 0xc2,
0xdc, 0xdb, 0xc7, 0xd8, 0xdd, 0xd9, 0xd7, 0xda
};
mic2latin_with_table(mic, p, len, LC_KOI8_R, koi2win);
}
/* alt2mic: CP866 to Mule internal code */
/* alt2mic: CP866 to Mule internal code */
static void
alt2mic(unsigned char *l, unsigned char *p, int len)
{
static char alt2koi[] = {
0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa,
0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0,
0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe,
0xfb, 0xfd, 0xff, 0xf9, 0xf8, 0xfc, 0xe0, 0xf1,
0xc1, 0xc2, 0xd7, 0xc7, 0xc4, 0xc5, 0xd6, 0xda,
0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xd2, 0xd3, 0xd4, 0xd5, 0xc6, 0xc8, 0xc3, 0xde,
0xdb, 0xdd, 0xdf, 0xd9, 0xd8, 0xdc, 0xc0, 0xd1,
0xb3, 0xa3, 0xb4, 0xa4, 0xb7, 0xa7, 0x00, 0x00,
0xb6, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
latin2mic_with_table(l, p, len, LC_KOI8_R, alt2koi);
static char alt2koi[] = {
0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa,
0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0,
0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe,
0xfb, 0xfd, 0xff, 0xf9, 0xf8, 0xfc, 0xe0, 0xf1,
0xc1, 0xc2, 0xd7, 0xc7, 0xc4, 0xc5, 0xd6, 0xda,
0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xd2, 0xd3, 0xd4, 0xd5, 0xc6, 0xc8, 0xc3, 0xde,
0xdb, 0xdd, 0xdf, 0xd9, 0xd8, 0xdc, 0xc0, 0xd1,
0xb3, 0xa3, 0xb4, 0xa4, 0xb7, 0xa7, 0x00, 0x00,
0xb6, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
latin2mic_with_table(l, p, len, LC_KOI8_R, alt2koi);
}
/* mic2alt: Mule internal code to CP866 */
static void
mic2alt(unsigned char *mic, unsigned char *p, int len)
{
static char koi2alt[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xf1, 0xf3, 0x00, 0xf9, 0xf5,
0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00,
0x00, 0x00, 0x00, 0xf0, 0xf2, 0x00, 0xf8, 0xf4,
0x00, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00,
0xee, 0xa0, 0xa1, 0xe6, 0xa4, 0xa5, 0xe4, 0xa3,
0xe5, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae,
0xaf, 0xef, 0xe0, 0xe1, 0xe2, 0xe3, 0xa6, 0xa2,
0xec, 0xeb, 0xa7, 0xe8, 0xed, 0xe9, 0xe7, 0xea,
0x9e, 0x80, 0x81, 0x96, 0x84, 0x85, 0x94, 0x83,
0x95, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e,
0x8f, 0x9f, 0x90, 0x91, 0x92, 0x93, 0x86, 0x82,
0x9c, 0x9b, 0x87, 0x98, 0x9d, 0x99, 0x97, 0x9a
};
mic2latin_with_table(mic, p, len, LC_KOI8_R, koi2alt);
static char koi2alt[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xf1, 0xf3, 0x00, 0xf9, 0xf5,
0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00,
0x00, 0x00, 0x00, 0xf0, 0xf2, 0x00, 0xf8, 0xf4,
0x00, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00,
0xee, 0xa0, 0xa1, 0xe6, 0xa4, 0xa5, 0xe4, 0xa3,
0xe5, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae,
0xaf, 0xef, 0xe0, 0xe1, 0xe2, 0xe3, 0xa6, 0xa2,
0xec, 0xeb, 0xa7, 0xe8, 0xed, 0xe9, 0xe7, 0xea,
0x9e, 0x80, 0x81, 0x96, 0x84, 0x85, 0x94, 0x83,
0x95, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e,
0x8f, 0x9f, 0x90, 0x91, 0x92, 0x93, 0x86, 0x82,
0x9c, 0x9b, 0x87, 0x98, 0x9d, 0x99, 0x97, 0x9a
};
mic2latin_with_table(mic, p, len, LC_KOI8_R, koi2alt);
}
/*
@@ -858,8 +892,8 @@ pg_encoding_conv_tbl pg_conv_tbl[] = {
{LATIN2, "LATIN2", 0, latin22mic, mic2latin2}, /* ISO 8859 Latin 2 */
{LATIN3, "LATIN3", 0, latin32mic, mic2latin3}, /* ISO 8859 Latin 3 */
{LATIN4, "LATIN4", 0, latin42mic, mic2latin4}, /* ISO 8859 Latin 4 */
{LATIN5, "LATIN5", 0, iso2mic, mic2iso}, /* ISO 8859 Latin 5 */
{KOI8, "KOI8", 0, koi2mic, mic2koi}, /* KOI8-R */
{LATIN5, "LATIN5", 0, iso2mic, mic2iso}, /* ISO 8859 Latin 5 */
{KOI8, "KOI8", 0, koi2mic, mic2koi}, /* KOI8-R */
{WIN, "WIN", 0, win2mic, mic2win}, /* CP1251 */
{ALT, "ALT", 0, alt2mic, mic2alt}, /* CP866 */
{SJIS, "SJIS", 1, sjis2mic, mic2sjis}, /* SJIS */