22#define PGSJISALTCODE 0x81ac
23#define PGEUCALTCODE 0xa2ae
31 .
name =
"euc_jp_and_sjis",
175 if (
c1 >= 0xa1 &&
c1 <= 0xdf)
196 if (k >= 0xed40 && k < 0xf040)
207 c1 = (k >> 8) & 0xff;
217 *p++ = ((
c1 & 0x3f) << 1) + 0x9f + (
c2 > 0x9e);
218 *p++ =
c2 + ((
c2 > 0x9e) ? 2 : 0x60) + (
c2 < 0x80);
220 else if ((k >= 0xeb40 && k < 0xf040) || (k >= 0xfc4c && k <= 0xfcfc))
227 else if (k >= 0xf040 && k < 0xf540)
235 *p++ = ((
c1 & 0x3f) << 1) + 0xf3 + (
c2 > 0x9e);
236 *p++ =
c2 + ((
c2 > 0x9e) ? 2 : 0x60) + (
c2 < 0x80);
238 else if (k >= 0xf540 && k < 0xfa40)
246 *p++ = ((
c1 & 0x3f) << 1) + 0xf3 + (
c2 > 0x9e);
247 *p++ =
c2 + ((
c2 > 0x9e) ? 2 : 0x60) + (
c2 < 0x80);
249 else if (k >= 0xfa40)
265 *p++ = 0x80 | ((k & 0xff00) >> 8);
266 *p++ = 0x80 | (k & 0xff);
271 *p++ = 0x80 | (k >> 8);
272 *p++ = 0x80 | (k & 0xff);
342 k = (
c1 << 8) | (
c2 & 0xff);
347 *p++ = ((
c1 - 0xa1) >> 1) + ((
c1 < 0xdf) ? 0x81 : 0xc1) + 0x6f;
350 *p++ = ((
c1 - 0xa1) >> 1) + ((
c1 < 0xdf) ? 0x81 : 0xc1);
351 *p++ =
c2 - ((
c1 & 1) ? ((
c2 < 0xe0) ? 0x61 : 0x60) : 2);
365 *p++ = ((
c1 - 0xa1) >> 1) + ((
c1 < 0xdf) ? 0x81 : 0xc1) + 0x74;
366 *p++ =
c2 - ((
c1 & 1) ? ((
c2 < 0xe0) ? 0x61 : 0x60) : 2);
586 *p++ = ((
c1 - 0xa1) >> 1) + ((
c1 < 0xdf) ? 0x81 : 0xc1) + 0x74;
587 *p++ =
c2 - ((
c1 & 1) ? ((
c2 < 0xe0) ? 0x61 : 0x60) : 2);
618 k = (
c1 << 8) | (
c2 & 0xff);
623 *p++ = ((
c1 - 0xa1) >> 1) + ((
c1 < 0xdf) ? 0x81 : 0xc1) + 0x6f;
626 *p++ = ((
c1 - 0xa1) >> 1) + ((
c1 < 0xdf) ? 0x81 : 0xc1);
627 *p++ =
c2 - ((
c1 & 1) ? ((
c2 < 0xe0) ? 0x61 : 0x60) : 2);
677 if (
c1 >= 0xa1 &&
c1 <= 0xdf)
690 if (k >= 0xed40 && k < 0xf040)
701 c1 = (k >> 8) & 0xff;
710 *p++ = ((
c1 & 0x3f) << 1) + 0x9f + (
c2 > 0x9e);
711 *p++ =
c2 + ((
c2 > 0x9e) ? 2 : 0x60) + (
c2 < 0x80);
713 else if ((k >= 0xeb40 && k < 0xf040) || (k >= 0xfc4c && k <= 0xfcfc))
719 else if (k >= 0xf040 && k < 0xf540)
726 *p++ = ((
c1 & 0x3f) << 1) + 0xf3 + (
c2 > 0x9e);
727 *p++ =
c2 + ((
c2 > 0x9e) ? 2 : 0x60) + (
c2 < 0x80);
729 else if (k >= 0xf540 && k < 0xfa40)
737 *p++ = ((
c1 & 0x3f) << 1) + 0xf3 + (
c2 > 0x9e);
738 *p++ =
c2 + ((
c2 > 0x9e) ? 2 : 0x60) + (
c2 < 0x80);
740 else if (k >= 0xfa40)
757 *p++ = 0x80 | ((k & 0xff00) >> 8);
758 *p++ = 0x80 | (k & 0xff);
762 *p++ = 0x80 | (k >> 8);
763 *p++ = 0x80 | (k & 0xff);
#define IS_HIGHBIT_SET(ch)
static int mic2euc_jp(const unsigned char *mic, unsigned char *p, int len, bool noError)
Datum mic_to_sjis(PG_FUNCTION_ARGS)
Datum euc_jp_to_sjis(PG_FUNCTION_ARGS)
static int sjis2euc_jp(const unsigned char *sjis, unsigned char *p, int len, bool noError)
Datum euc_jp_to_mic(PG_FUNCTION_ARGS)
static int sjis2mic(const unsigned char *sjis, unsigned char *p, int len, bool noError)
Datum sjis_to_euc_jp(PG_FUNCTION_ARGS)
Datum mic_to_euc_jp(PG_FUNCTION_ARGS)
Datum sjis_to_mic(PG_FUNCTION_ARGS)
static int euc_jp2mic(const unsigned char *euc, unsigned char *p, int len, bool noError)
static int euc_jp2sjis(const unsigned char *euc, unsigned char *p, int len, bool noError)
static int mic2sjis(const unsigned char *mic, unsigned char *p, int len, bool noError)
#define PG_MODULE_MAGIC_EXT(...)
#define PG_GETARG_CSTRING(n)
#define PG_FUNCTION_INFO_V1(funcname)
#define PG_RETURN_INT32(x)
#define PG_GETARG_INT32(n)
#define PG_GETARG_BOOL(n)
void report_untranslatable_char(int src_encoding, int dest_encoding, const char *mbstr, int len)
void report_invalid_encoding(int encoding, const char *mbstr, int len)
#define CHECK_ENCODING_CONVERSION_ARGS(srcencoding, destencoding)
int pg_encoding_verifymbchar(int encoding, const char *mbstr, int len)