PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
ascii_and_mic.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * ASCII and MULE_INTERNAL
4  *
5  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
6  * Portions Copyright (c) 1994, Regents of the University of California
7  *
8  * IDENTIFICATION
9  * src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c
10  *
11  *-------------------------------------------------------------------------
12  */
13 
14 #include "postgres.h"
15 #include "fmgr.h"
16 #include "mb/pg_wchar.h"
17 
19 
22 
23 /* ----------
24  * conv_proc(
25  * INTEGER, -- source encoding id
26  * INTEGER, -- destination encoding id
27  * CSTRING, -- source string (null terminated C string)
28  * CSTRING, -- destination string (null terminated C string)
29  * INTEGER -- source string length
30  * ) returns VOID;
31  * ----------
32  */
33 
34 Datum
36 {
37  unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
38  unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
39  int len = PG_GETARG_INT32(4);
40 
42 
43  pg_ascii2mic(src, dest, len);
44 
46 }
47 
48 Datum
50 {
51  unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
52  unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
53  int len = PG_GETARG_INT32(4);
54 
56 
57  pg_mic2ascii(src, dest, len);
58 
60 }
#define PG_GETARG_INT32(n)
Definition: fmgr.h:234
Datum ascii_to_mic(PG_FUNCTION_ARGS)
Definition: ascii_and_mic.c:35
void pg_ascii2mic(const unsigned char *l, unsigned char *p, int len)
Definition: conv.c:143
Datum mic_to_ascii(PG_FUNCTION_ARGS)
Definition: ascii_and_mic.c:49
uintptr_t Datum
Definition: postgres.h:372
#define PG_RETURN_VOID()
Definition: fmgr.h:309
#define CHECK_ENCODING_CONVERSION_ARGS(srcencoding, destencoding)
Definition: pg_wchar.h:503
PG_MODULE_MAGIC
Definition: ascii_and_mic.c:18
void pg_mic2ascii(const unsigned char *mic, unsigned char *p, int len)
Definition: conv.c:163
#define PG_GETARG_CSTRING(n)
Definition: fmgr.h:242
#define PG_FUNCTION_ARGS
Definition: fmgr.h:158
PG_FUNCTION_INFO_V1(ascii_to_mic)