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

Go to the source code of this file.

Functions

 PG_FUNCTION_INFO_V1 (latin2_to_mic)
 
 PG_FUNCTION_INFO_V1 (mic_to_latin2)
 
 PG_FUNCTION_INFO_V1 (win1250_to_mic)
 
 PG_FUNCTION_INFO_V1 (mic_to_win1250)
 
 PG_FUNCTION_INFO_V1 (latin2_to_win1250)
 
 PG_FUNCTION_INFO_V1 (win1250_to_latin2)
 
Datum latin2_to_mic (PG_FUNCTION_ARGS)
 
Datum mic_to_latin2 (PG_FUNCTION_ARGS)
 
Datum win1250_to_mic (PG_FUNCTION_ARGS)
 
Datum mic_to_win1250 (PG_FUNCTION_ARGS)
 
Datum latin2_to_win1250 (PG_FUNCTION_ARGS)
 
Datum win1250_to_latin2 (PG_FUNCTION_ARGS)
 

Variables

 PG_MODULE_MAGIC
 
static const unsigned char win1250_2_iso88592 []
 
static const unsigned char iso88592_2_win1250 []
 

Function Documentation

◆ latin2_to_mic()

Datum latin2_to_mic ( PG_FUNCTION_ARGS  )

Definition at line 83 of file latin2_and_win1250.c.

84 {
85  unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
86  unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
87  int len = PG_GETARG_INT32(4);
88  bool noError = PG_GETARG_BOOL(5);
89  int converted;
90 
92 
93  converted = latin2mic(src, dest, len, LC_ISO8859_2, PG_LATIN2, noError);
94 
95  PG_RETURN_INT32(converted);
96 }
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:231
@ PG_LATIN2
Definition: pg_wchar.h:233
#define LC_ISO8859_2
Definition: pg_wchar.h:103
#define CHECK_ENCODING_CONVERSION_ARGS(srcencoding, destencoding)
Definition: pg_wchar.h:511

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

◆ latin2_to_win1250()

Datum latin2_to_win1250 ( PG_FUNCTION_ARGS  )

Definition at line 149 of file latin2_and_win1250.c.

150 {
151  unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
152  unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
153  int len = PG_GETARG_INT32(4);
154  bool noError = PG_GETARG_BOOL(5);
155  int converted;
156 
158 
159  converted = local2local(src, dest, len, PG_LATIN2, PG_WIN1250,
160  iso88592_2_win1250, noError);
161 
162  PG_RETURN_INT32(converted);
163 }
int local2local(const unsigned char *l, unsigned char *p, int len, int src_encoding, int dest_encoding, const unsigned char *tab, bool noError)
Definition: conv.c:33
static const unsigned char iso88592_2_win1250[]
@ PG_WIN1250
Definition: pg_wchar.h:253

References CHECK_ENCODING_CONVERSION_ARGS, generate_unaccent_rules::dest, iso88592_2_win1250, len, local2local(), PG_GETARG_BOOL, PG_GETARG_CSTRING, PG_GETARG_INT32, PG_LATIN2, PG_RETURN_INT32, and PG_WIN1250.

◆ mic_to_latin2()

Datum mic_to_latin2 ( PG_FUNCTION_ARGS  )

Definition at line 99 of file latin2_and_win1250.c.

100 {
101  unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
102  unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
103  int len = PG_GETARG_INT32(4);
104  bool noError = PG_GETARG_BOOL(5);
105  int converted;
106 
108 
109  converted = mic2latin(src, dest, len, LC_ISO8859_2, PG_LATIN2, noError);
110 
111  PG_RETURN_INT32(converted);
112 }
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_2, len, mic2latin(), PG_GETARG_BOOL, PG_GETARG_CSTRING, PG_GETARG_INT32, PG_LATIN2, PG_MULE_INTERNAL, and PG_RETURN_INT32.

◆ mic_to_win1250()

Datum mic_to_win1250 ( PG_FUNCTION_ARGS  )

Definition at line 132 of file latin2_and_win1250.c.

133 {
134  unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
135  unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
136  int len = PG_GETARG_INT32(4);
137  bool noError = PG_GETARG_BOOL(5);
138  int converted;
139 
141 
143  iso88592_2_win1250, noError);
144 
145  PG_RETURN_INT32(converted);
146 }
int mic2latin_with_table(const unsigned char *mic, unsigned char *p, int len, int lc, int encoding, const unsigned char *tab, bool noError)
Definition: conv.c:257

References CHECK_ENCODING_CONVERSION_ARGS, generate_unaccent_rules::dest, iso88592_2_win1250, LC_ISO8859_2, len, mic2latin_with_table(), PG_GETARG_BOOL, PG_GETARG_CSTRING, PG_GETARG_INT32, PG_MULE_INTERNAL, PG_RETURN_INT32, and PG_WIN1250.

◆ PG_FUNCTION_INFO_V1() [1/6]

PG_FUNCTION_INFO_V1 ( latin2_to_mic  )

◆ PG_FUNCTION_INFO_V1() [2/6]

PG_FUNCTION_INFO_V1 ( latin2_to_win1250  )

◆ PG_FUNCTION_INFO_V1() [3/6]

PG_FUNCTION_INFO_V1 ( mic_to_latin2  )

◆ PG_FUNCTION_INFO_V1() [4/6]

PG_FUNCTION_INFO_V1 ( mic_to_win1250  )

◆ PG_FUNCTION_INFO_V1() [5/6]

PG_FUNCTION_INFO_V1 ( win1250_to_latin2  )

◆ PG_FUNCTION_INFO_V1() [6/6]

PG_FUNCTION_INFO_V1 ( win1250_to_mic  )

◆ win1250_to_latin2()

Datum win1250_to_latin2 ( PG_FUNCTION_ARGS  )

Definition at line 166 of file latin2_and_win1250.c.

167 {
168  unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
169  unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
170  int len = PG_GETARG_INT32(4);
171  bool noError = PG_GETARG_BOOL(5);
172  int converted;
173 
175 
176  converted = local2local(src, dest, len, PG_WIN1250, PG_LATIN2,
177  win1250_2_iso88592, noError);
178 
179  PG_RETURN_INT32(converted);
180 }
static const unsigned char win1250_2_iso88592[]

References CHECK_ENCODING_CONVERSION_ARGS, generate_unaccent_rules::dest, len, local2local(), PG_GETARG_BOOL, PG_GETARG_CSTRING, PG_GETARG_INT32, PG_LATIN2, PG_RETURN_INT32, PG_WIN1250, and win1250_2_iso88592.

◆ win1250_to_mic()

Datum win1250_to_mic ( PG_FUNCTION_ARGS  )

Definition at line 115 of file latin2_and_win1250.c.

116 {
117  unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
118  unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
119  int len = PG_GETARG_INT32(4);
120  bool noError = PG_GETARG_BOOL(5);
121  int converted;
122 
124 
126  win1250_2_iso88592, noError);
127 
128  PG_RETURN_INT32(converted);
129 }
int latin2mic_with_table(const unsigned char *l, unsigned char *p, int len, int lc, int encoding, const unsigned char *tab, bool noError)
Definition: conv.c:194

References CHECK_ENCODING_CONVERSION_ARGS, generate_unaccent_rules::dest, latin2mic_with_table(), LC_ISO8859_2, len, PG_GETARG_BOOL, PG_GETARG_CSTRING, PG_GETARG_INT32, PG_MULE_INTERNAL, PG_RETURN_INT32, PG_WIN1250, and win1250_2_iso88592.

Variable Documentation

◆ iso88592_2_win1250

const unsigned char iso88592_2_win1250[]
static
Initial value:
= {
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
0x88, 0x89, 0x00, 0x8B, 0x00, 0x00, 0x00, 0x00,
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
0x98, 0x99, 0x00, 0x9B, 0x00, 0x00, 0x00, 0x00,
0xA0, 0xA5, 0xA2, 0xA3, 0xA4, 0xBC, 0x8C, 0xA7,
0xA8, 0x8A, 0xAA, 0x8D, 0x8F, 0xAD, 0x8E, 0xAF,
0xB0, 0xB9, 0xB2, 0xB3, 0xB4, 0xBE, 0x9C, 0xA1,
0xB8, 0x9A, 0xBA, 0x9D, 0x9F, 0xBD, 0x9E, 0xBF,
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
}

Definition at line 62 of file latin2_and_win1250.c.

Referenced by latin2_to_win1250(), and mic_to_win1250().

◆ PG_MODULE_MAGIC

PG_MODULE_MAGIC

Definition at line 18 of file latin2_and_win1250.c.

◆ win1250_2_iso88592

const unsigned char win1250_2_iso88592[]
static
Initial value:
= {
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
0x88, 0x89, 0xA9, 0x8B, 0xA6, 0xAB, 0xAE, 0xAC,
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
0x98, 0x99, 0xB9, 0x9B, 0xB6, 0xBB, 0xBE, 0xBC,
0xA0, 0xB7, 0xA2, 0xA3, 0xA4, 0xA1, 0x00, 0xA7,
0xA8, 0x00, 0xAA, 0x00, 0x00, 0xAD, 0x00, 0xAF,
0xB0, 0x00, 0xB2, 0xB3, 0xB4, 0x00, 0x00, 0x00,
0xB8, 0xB1, 0xBA, 0x00, 0xA5, 0xBD, 0xB5, 0xBF,
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
}

Definition at line 42 of file latin2_and_win1250.c.

Referenced by win1250_to_latin2(), and win1250_to_mic().