PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
utf8_and_cyrillic.c File Reference
#include "postgres.h"
#include "fmgr.h"
#include "mb/pg_wchar.h"
#include "../../Unicode/utf8_to_koi8r.map"
#include "../../Unicode/koi8r_to_utf8.map"
#include "../../Unicode/utf8_to_koi8u.map"
#include "../../Unicode/koi8u_to_utf8.map"
Include dependency graph for utf8_and_cyrillic.c:

Go to the source code of this file.

Functions

 PG_FUNCTION_INFO_V1 (utf8_to_koi8r)
 
 PG_FUNCTION_INFO_V1 (koi8r_to_utf8)
 
 PG_FUNCTION_INFO_V1 (utf8_to_koi8u)
 
 PG_FUNCTION_INFO_V1 (koi8u_to_utf8)
 
Datum utf8_to_koi8r (PG_FUNCTION_ARGS)
 
Datum koi8r_to_utf8 (PG_FUNCTION_ARGS)
 
Datum utf8_to_koi8u (PG_FUNCTION_ARGS)
 
Datum koi8u_to_utf8 (PG_FUNCTION_ARGS)
 

Variables

 PG_MODULE_MAGIC
 

Function Documentation

Datum koi8r_to_utf8 ( PG_FUNCTION_ARGS  )

Definition at line 60 of file utf8_and_cyrillic.c.

References CHECK_ENCODING_CONVERSION_ARGS, LocalToUtf(), PG_GETARG_CSTRING, PG_GETARG_INT32, PG_KOI8R, PG_RETURN_VOID, and PG_UTF8.

61 {
62  unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
63  unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
64  int len = PG_GETARG_INT32(4);
65 
67 
68  LocalToUtf(src, len, dest,
69  &koi8r_to_unicode_tree,
70  NULL, 0,
71  NULL,
72  PG_KOI8R);
73 
75 }
#define PG_GETARG_INT32(n)
Definition: fmgr.h:234
void LocalToUtf(const unsigned char *iso, int len, unsigned char *utf, const pg_mb_radix_tree *map, const pg_local_to_utf_combined *cmap, int cmapsize, utf_local_conversion_func conv_func, int encoding)
Definition: conv.c:666
#define PG_RETURN_VOID()
Definition: fmgr.h:309
#define CHECK_ENCODING_CONVERSION_ARGS(srcencoding, destencoding)
Definition: pg_wchar.h:503
#define PG_GETARG_CSTRING(n)
Definition: fmgr.h:242
Datum koi8u_to_utf8 ( PG_FUNCTION_ARGS  )

Definition at line 96 of file utf8_and_cyrillic.c.

References CHECK_ENCODING_CONVERSION_ARGS, LocalToUtf(), PG_GETARG_CSTRING, PG_GETARG_INT32, PG_KOI8U, PG_RETURN_VOID, and PG_UTF8.

97 {
98  unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
99  unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
100  int len = PG_GETARG_INT32(4);
101 
103 
104  LocalToUtf(src, len, dest,
105  &koi8u_to_unicode_tree,
106  NULL, 0,
107  NULL,
108  PG_KOI8U);
109 
110  PG_RETURN_VOID();
111 }
#define PG_GETARG_INT32(n)
Definition: fmgr.h:234
void LocalToUtf(const unsigned char *iso, int len, unsigned char *utf, const pg_mb_radix_tree *map, const pg_local_to_utf_combined *cmap, int cmapsize, utf_local_conversion_func conv_func, int encoding)
Definition: conv.c:666
#define PG_RETURN_VOID()
Definition: fmgr.h:309
#define CHECK_ENCODING_CONVERSION_ARGS(srcencoding, destencoding)
Definition: pg_wchar.h:503
#define PG_GETARG_CSTRING(n)
Definition: fmgr.h:242
PG_FUNCTION_INFO_V1 ( utf8_to_koi8r  )
PG_FUNCTION_INFO_V1 ( koi8r_to_utf8  )
PG_FUNCTION_INFO_V1 ( utf8_to_koi8u  )
PG_FUNCTION_INFO_V1 ( koi8u_to_utf8  )
Datum utf8_to_koi8r ( PG_FUNCTION_ARGS  )

Definition at line 42 of file utf8_and_cyrillic.c.

References CHECK_ENCODING_CONVERSION_ARGS, PG_GETARG_CSTRING, PG_GETARG_INT32, PG_KOI8R, PG_RETURN_VOID, PG_UTF8, and UtfToLocal().

43 {
44  unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
45  unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
46  int len = PG_GETARG_INT32(4);
47 
49 
50  UtfToLocal(src, len, dest,
51  &koi8r_from_unicode_tree,
52  NULL, 0,
53  NULL,
54  PG_KOI8R);
55 
57 }
void UtfToLocal(const unsigned char *utf, int len, unsigned char *iso, const pg_mb_radix_tree *map, const pg_utf_to_local_combined *cmap, int cmapsize, utf_local_conversion_func conv_func, int encoding)
Definition: conv.c:474
#define PG_GETARG_INT32(n)
Definition: fmgr.h:234
#define PG_RETURN_VOID()
Definition: fmgr.h:309
#define CHECK_ENCODING_CONVERSION_ARGS(srcencoding, destencoding)
Definition: pg_wchar.h:503
#define PG_GETARG_CSTRING(n)
Definition: fmgr.h:242
Datum utf8_to_koi8u ( PG_FUNCTION_ARGS  )

Definition at line 78 of file utf8_and_cyrillic.c.

References CHECK_ENCODING_CONVERSION_ARGS, PG_GETARG_CSTRING, PG_GETARG_INT32, PG_KOI8U, PG_RETURN_VOID, PG_UTF8, and UtfToLocal().

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 
85 
86  UtfToLocal(src, len, dest,
87  &koi8u_from_unicode_tree,
88  NULL, 0,
89  NULL,
90  PG_KOI8U);
91 
93 }
void UtfToLocal(const unsigned char *utf, int len, unsigned char *iso, const pg_mb_radix_tree *map, const pg_utf_to_local_combined *cmap, int cmapsize, utf_local_conversion_func conv_func, int encoding)
Definition: conv.c:474
#define PG_GETARG_INT32(n)
Definition: fmgr.h:234
#define PG_RETURN_VOID()
Definition: fmgr.h:309
#define CHECK_ENCODING_CONVERSION_ARGS(srcencoding, destencoding)
Definition: pg_wchar.h:503
#define PG_GETARG_CSTRING(n)
Definition: fmgr.h:242

Variable Documentation

PG_MODULE_MAGIC

Definition at line 22 of file utf8_and_cyrillic.c.