18 #define ENCODING_GROWTH_RATE 4
43 static int euc_tw2big5(
const unsigned char *euc,
unsigned char *p,
int len,
bool noError);
44 static int big52euc_tw(
const unsigned char *big5,
unsigned char *p,
int len,
bool noError);
45 static int big52mic(
const unsigned char *big5,
unsigned char *p,
int len,
bool noError);
46 static int mic2big5(
const unsigned char *mic,
unsigned char *p,
int len,
bool noError);
47 static int euc_tw2mic(
const unsigned char *euc,
unsigned char *p,
int len,
bool noError);
48 static int mic2euc_tw(
const unsigned char *mic,
unsigned char *p,
int len,
bool noError);
153 const unsigned char *start = euc;
155 unsigned short big5buf,
172 (
const char *) euc,
len);
183 cnsBuf = (euc[2] << 8) | euc[3];
188 cnsBuf = (c1 << 8) | euc[1];
198 (
const char *) euc,
len);
200 *p++ = (big5buf >> 8) & 0x00ff;
201 *p++ = big5buf & 0x00ff;
213 (
const char *) euc,
len);
231 const unsigned char *start = big5;
233 unsigned short big5buf,
250 (
const char *) big5,
len);
252 big5buf = (c1 << 8) | big5[1];
257 *p++ = (cnsBuf >> 8) & 0x00ff;
258 *p++ = cnsBuf & 0x00ff;
264 *p++ = (cnsBuf >> 8) & 0x00ff;
265 *p++ = cnsBuf & 0x00ff;
271 *p++ = (cnsBuf >> 8) & 0x00ff;
272 *p++ = cnsBuf & 0x00ff;
279 (
const char *) big5,
len);
293 (
const char *) big5,
len);
310 euc_tw2mic(
const unsigned char *euc,
unsigned char *p,
int len,
bool noError)
312 const unsigned char *start = euc;
327 (
const char *) euc,
len);
361 (
const char *) euc,
len);
377 mic2euc_tw(
const unsigned char *mic,
unsigned char *p,
int len,
bool noError)
379 const unsigned char *start = mic;
394 (
const char *) mic,
len);
407 (
const char *) mic,
len);
434 (
const char *) mic,
len);
448 big52mic(
const unsigned char *big5,
unsigned char *p,
int len,
bool noError)
450 const unsigned char *start = big5;
452 unsigned short big5buf,
468 (
const char *) big5,
len);
481 (
const char *) big5,
len);
483 big5buf = (c1 << 8) | big5[1];
491 *p++ = (cnsBuf >> 8) & 0x00ff;
492 *p++ = cnsBuf & 0x00ff;
499 (
const char *) big5,
len);
513 mic2big5(
const unsigned char *mic,
unsigned char *p,
int len,
bool noError)
515 const unsigned char *start = mic;
517 unsigned short big5buf,
532 (
const char *) mic,
len);
545 (
const char *) mic,
len);
552 cnsBuf = (mic[2] << 8) | mic[3];
556 cnsBuf = (mic[1] << 8) | mic[2];
564 (
const char *) mic,
len);
566 *p++ = (big5buf >> 8) & 0x00ff;
567 *p++ = big5buf & 0x00ff;
574 (
const char *) mic,
len);
unsigned short CNStoBIG5(unsigned short cns, unsigned char lc)
unsigned short BIG5toCNS(unsigned short big5, unsigned char *lc)
#define IS_HIGHBIT_SET(ch)
static int euc_tw2mic(const unsigned char *euc, unsigned char *p, int len, bool noError)
static int big52mic(const unsigned char *big5, unsigned char *p, int len, bool noError)
Datum euc_tw_to_mic(PG_FUNCTION_ARGS)
Datum big5_to_euc_tw(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(euc_tw_to_big5)
Datum mic_to_big5(PG_FUNCTION_ARGS)
Datum big5_to_mic(PG_FUNCTION_ARGS)
Datum euc_tw_to_big5(PG_FUNCTION_ARGS)
static int mic2euc_tw(const unsigned char *mic, unsigned char *p, int len, bool noError)
Datum mic_to_euc_tw(PG_FUNCTION_ARGS)
static int mic2big5(const unsigned char *mic, unsigned char *p, int len, bool noError)
static int euc_tw2big5(const unsigned char *euc, unsigned char *p, int len, bool noError)
static int big52euc_tw(const unsigned char *big5, unsigned char *p, int len, bool noError)
#define PG_GETARG_CSTRING(n)
#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)