PostgreSQL Source Code git master
latin_and_mic.c File Reference
#include "postgres.h"
#include "fmgr.h"
#include "mb/pg_wchar.h"
Include dependency graph for latin_and_mic.c:

Go to the source code of this file.

Functions

 PG_MODULE_MAGIC_EXT (.name="latin_and_mic",.version=PG_VERSION)
 
 PG_FUNCTION_INFO_V1 (latin1_to_mic)
 
 PG_FUNCTION_INFO_V1 (mic_to_latin1)
 
 PG_FUNCTION_INFO_V1 (latin3_to_mic)
 
 PG_FUNCTION_INFO_V1 (mic_to_latin3)
 
 PG_FUNCTION_INFO_V1 (latin4_to_mic)
 
 PG_FUNCTION_INFO_V1 (mic_to_latin4)
 
Datum latin1_to_mic (PG_FUNCTION_ARGS)
 
Datum mic_to_latin1 (PG_FUNCTION_ARGS)
 
Datum latin3_to_mic (PG_FUNCTION_ARGS)
 
Datum mic_to_latin3 (PG_FUNCTION_ARGS)
 
Datum latin4_to_mic (PG_FUNCTION_ARGS)
 
Datum mic_to_latin4 (PG_FUNCTION_ARGS)
 

Function Documentation

◆ latin1_to_mic()

Datum latin1_to_mic ( PG_FUNCTION_ARGS  )

Definition at line 46 of file latin_and_mic.c.

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
56 converted = latin2mic(src, dest, len, LC_ISO8859_1, PG_LATIN1, noError);
57
58 PG_RETURN_INT32(converted);
59}
int latin2mic(const unsigned char *l, unsigned char *p, int len, int lc, int encoding, bool noError)
Definition: conv.c:89
#define PG_GETARG_CSTRING(n)
Definition: fmgr.h:277
#define PG_RETURN_INT32(x)
Definition: fmgr.h:354
#define PG_GETARG_INT32(n)
Definition: fmgr.h:269
#define PG_GETARG_BOOL(n)
Definition: fmgr.h:274
const void size_t len
@ PG_MULE_INTERNAL
Definition: pg_wchar.h:233
@ PG_LATIN1
Definition: pg_wchar.h:234
#define CHECK_ENCODING_CONVERSION_ARGS(srcencoding, destencoding)
Definition: pg_wchar.h:507
#define LC_ISO8859_1
Definition: pg_wchar.h:105

References CHECK_ENCODING_CONVERSION_ARGS, generate_unaccent_rules::dest, latin2mic(), LC_ISO8859_1, len, PG_GETARG_BOOL, PG_GETARG_CSTRING, PG_GETARG_INT32, PG_LATIN1, PG_MULE_INTERNAL, and PG_RETURN_INT32.

◆ latin3_to_mic()

Datum latin3_to_mic ( PG_FUNCTION_ARGS  )

Definition at line 78 of file latin_and_mic.c.

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
88 converted = latin2mic(src, dest, len, LC_ISO8859_3, PG_LATIN3, noError);
89
90 PG_RETURN_INT32(converted);
91}
@ PG_LATIN3
Definition: pg_wchar.h:236
#define LC_ISO8859_3
Definition: pg_wchar.h:107

References CHECK_ENCODING_CONVERSION_ARGS, generate_unaccent_rules::dest, latin2mic(), LC_ISO8859_3, len, PG_GETARG_BOOL, PG_GETARG_CSTRING, PG_GETARG_INT32, PG_LATIN3, PG_MULE_INTERNAL, and PG_RETURN_INT32.

◆ latin4_to_mic()

Datum latin4_to_mic ( PG_FUNCTION_ARGS  )

Definition at line 110 of file latin_and_mic.c.

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
120 converted = latin2mic(src, dest, len, LC_ISO8859_4, PG_LATIN4, noError);
121
122 PG_RETURN_INT32(converted);
123}
@ PG_LATIN4
Definition: pg_wchar.h:237
#define LC_ISO8859_4
Definition: pg_wchar.h:108

References CHECK_ENCODING_CONVERSION_ARGS, generate_unaccent_rules::dest, latin2mic(), LC_ISO8859_4, len, PG_GETARG_BOOL, PG_GETARG_CSTRING, PG_GETARG_INT32, PG_LATIN4, PG_MULE_INTERNAL, and PG_RETURN_INT32.

◆ mic_to_latin1()

Datum mic_to_latin1 ( PG_FUNCTION_ARGS  )

Definition at line 62 of file latin_and_mic.c.

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
72 converted = mic2latin(src, dest, len, LC_ISO8859_1, PG_LATIN1, noError);
73
74 PG_RETURN_INT32(converted);
75}
int mic2latin(const unsigned char *mic, unsigned char *p, int len, int lc, int encoding, bool noError)
Definition: conv.c:127

References CHECK_ENCODING_CONVERSION_ARGS, generate_unaccent_rules::dest, LC_ISO8859_1, len, mic2latin(), PG_GETARG_BOOL, PG_GETARG_CSTRING, PG_GETARG_INT32, PG_LATIN1, PG_MULE_INTERNAL, and PG_RETURN_INT32.

◆ mic_to_latin3()

Datum mic_to_latin3 ( PG_FUNCTION_ARGS  )

Definition at line 94 of file latin_and_mic.c.

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
104 converted = mic2latin(src, dest, len, LC_ISO8859_3, PG_LATIN3, noError);
105
106 PG_RETURN_INT32(converted);
107}

References CHECK_ENCODING_CONVERSION_ARGS, generate_unaccent_rules::dest, LC_ISO8859_3, len, mic2latin(), PG_GETARG_BOOL, PG_GETARG_CSTRING, PG_GETARG_INT32, PG_LATIN3, PG_MULE_INTERNAL, and PG_RETURN_INT32.

◆ mic_to_latin4()

Datum mic_to_latin4 ( PG_FUNCTION_ARGS  )

Definition at line 126 of file latin_and_mic.c.

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
136 converted = mic2latin(src, dest, len, LC_ISO8859_4, PG_LATIN4, noError);
137
138 PG_RETURN_INT32(converted);
139}

References CHECK_ENCODING_CONVERSION_ARGS, generate_unaccent_rules::dest, LC_ISO8859_4, len, mic2latin(), PG_GETARG_BOOL, PG_GETARG_CSTRING, PG_GETARG_INT32, PG_LATIN4, PG_MULE_INTERNAL, and PG_RETURN_INT32.

◆ PG_FUNCTION_INFO_V1() [1/6]

PG_FUNCTION_INFO_V1 ( latin1_to_mic  )

◆ PG_FUNCTION_INFO_V1() [2/6]

PG_FUNCTION_INFO_V1 ( latin3_to_mic  )

◆ PG_FUNCTION_INFO_V1() [3/6]

PG_FUNCTION_INFO_V1 ( latin4_to_mic  )

◆ PG_FUNCTION_INFO_V1() [4/6]

PG_FUNCTION_INFO_V1 ( mic_to_latin1  )

◆ PG_FUNCTION_INFO_V1() [5/6]

PG_FUNCTION_INFO_V1 ( mic_to_latin3  )

◆ PG_FUNCTION_INFO_V1() [6/6]

PG_FUNCTION_INFO_V1 ( mic_to_latin4  )

◆ PG_MODULE_MAGIC_EXT()

PG_MODULE_MAGIC_EXT ( name = "latin_and_mic",
version = PG_VERSION 
)