1
/*-------------------------------------------------------------------------
3
* ASCII and MULE_INTERNAL
5
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
6
* Portions Copyright (c) 1994, Regents of the University of California
9
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c,v 1.9 2004-12-31 22:01:45 pgsql Exp $
11
*-------------------------------------------------------------------------
16
#include "mb/pg_wchar.h"
18
PG_FUNCTION_INFO_V1(ascii_to_mic);
19
PG_FUNCTION_INFO_V1(mic_to_ascii);
21
extern Datum ascii_to_mic(PG_FUNCTION_ARGS);
22
extern Datum mic_to_ascii(PG_FUNCTION_ARGS);
26
* INTEGER, -- source encoding id
27
* INTEGER, -- destination encoding id
28
* CSTRING, -- source string (null terminated C string)
29
* CSTRING, -- destination string (null terminated C string)
30
* INTEGER -- source string length
36
ascii_to_mic(PG_FUNCTION_ARGS)
38
unsigned char *src = PG_GETARG_CSTRING(2);
39
unsigned char *dest = PG_GETARG_CSTRING(3);
40
int len = PG_GETARG_INT32(4);
42
Assert(PG_GETARG_INT32(0) == PG_SQL_ASCII);
43
Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
46
pg_ascii2mic(src, dest, len);
52
mic_to_ascii(PG_FUNCTION_ARGS)
54
unsigned char *src = PG_GETARG_CSTRING(2);
55
unsigned char *dest = PG_GETARG_CSTRING(3);
56
int len = PG_GETARG_INT32(4);
58
Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
59
Assert(PG_GETARG_INT32(1) == PG_SQL_ASCII);
62
pg_mic2ascii(src, dest, len);