PostgreSQL Source Code git master
Loading...
Searching...
No Matches
latin_and_mic.c
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * LATINn and MULE_INTERNAL
4 *
5 * Portions Copyright (c) 1996-2026, 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/latin_and_mic/latin_and_mic.c
10 *
11 *-------------------------------------------------------------------------
12 */
13
14#include "postgres.h"
15#include "fmgr.h"
16#include "mb/pg_wchar.h"
17
19 .name = "latin_and_mic",
20 .version = PG_VERSION
21);
22
29
30/* ----------
31 * conv_proc(
32 * INTEGER, -- source encoding id
33 * INTEGER, -- destination encoding id
34 * CSTRING, -- source string (null terminated C string)
35 * CSTRING, -- destination string (null terminated C string)
36 * INTEGER, -- source string length
37 * BOOL -- if true, don't throw an error if conversion fails
38 * ) returns INTEGER;
39 *
40 * Returns the number of bytes successfully converted.
41 * ----------
42 */
43
44
47{
48 unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
49 unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
50 int len = PG_GETARG_INT32(4);
51 bool noError = PG_GETARG_BOOL(5);
52 int converted;
53
55
57
59}
60
63{
64 unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
65 unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
66 int len = PG_GETARG_INT32(4);
67 bool noError = PG_GETARG_BOOL(5);
68 int converted;
69
71
73
75}
76
79{
80 unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
81 unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
82 int len = PG_GETARG_INT32(4);
83 bool noError = PG_GETARG_BOOL(5);
84 int converted;
85
87
89
91}
92
95{
96 unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
97 unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
98 int len = PG_GETARG_INT32(4);
99 bool noError = PG_GETARG_BOOL(5);
100 int converted;
101
103
105
107}
108
109Datum
111{
112 unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
113 unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
114 int len = PG_GETARG_INT32(4);
115 bool noError = PG_GETARG_BOOL(5);
116 int converted;
117
119
121
123}
124
125Datum
127{
128 unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
129 unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
130 int len = PG_GETARG_INT32(4);
131 bool noError = PG_GETARG_BOOL(5);
132 int converted;
133
135
137
139}
int mic2latin(const unsigned char *mic, unsigned char *p, int len, int lc, int encoding, bool noError)
Definition conv.c:127
int latin2mic(const unsigned char *l, unsigned char *p, int len, int lc, int encoding, bool noError)
Definition conv.c:89
#define PG_MODULE_MAGIC_EXT(...)
Definition fmgr.h:540
#define PG_GETARG_CSTRING(n)
Definition fmgr.h:278
#define PG_FUNCTION_INFO_V1(funcname)
Definition fmgr.h:417
#define PG_RETURN_INT32(x)
Definition fmgr.h:355
#define PG_GETARG_INT32(n)
Definition fmgr.h:269
#define PG_GETARG_BOOL(n)
Definition fmgr.h:274
#define PG_FUNCTION_ARGS
Definition fmgr.h:193
Datum latin3_to_mic(PG_FUNCTION_ARGS)
Datum mic_to_latin3(PG_FUNCTION_ARGS)
Datum mic_to_latin1(PG_FUNCTION_ARGS)
Datum mic_to_latin4(PG_FUNCTION_ARGS)
Datum latin1_to_mic(PG_FUNCTION_ARGS)
Datum latin4_to_mic(PG_FUNCTION_ARGS)
const void size_t len
@ PG_LATIN4
Definition pg_wchar.h:237
@ PG_MULE_INTERNAL
Definition pg_wchar.h:233
@ PG_LATIN3
Definition pg_wchar.h:236
@ PG_LATIN1
Definition pg_wchar.h:234
#define LC_ISO8859_3
Definition pg_wchar.h:107
#define LC_ISO8859_4
Definition pg_wchar.h:108
#define CHECK_ENCODING_CONVERSION_ARGS(srcencoding, destencoding)
Definition pg_wchar.h:507
#define LC_ISO8859_1
Definition pg_wchar.h:105
uint64_t Datum
Definition postgres.h:70
static int fb(int x)
const char * name