PostgreSQL Source Code  git master
utf8_and_johab.c File Reference
#include "postgres.h"
#include "fmgr.h"
#include "mb/pg_wchar.h"
#include "../../Unicode/johab_to_utf8.map"
#include "../../Unicode/utf8_to_johab.map"
Include dependency graph for utf8_and_johab.c:

Go to the source code of this file.

Functions

 PG_FUNCTION_INFO_V1 (johab_to_utf8)
 
 PG_FUNCTION_INFO_V1 (utf8_to_johab)
 
Datum johab_to_utf8 (PG_FUNCTION_ARGS)
 
Datum utf8_to_johab (PG_FUNCTION_ARGS)
 

Variables

 PG_MODULE_MAGIC
 

Function Documentation

◆ johab_to_utf8()

Datum johab_to_utf8 ( PG_FUNCTION_ARGS  )

Definition at line 36 of file utf8_and_johab.c.

References CHECK_ENCODING_CONVERSION_ARGS, generate_unaccent_rules::dest, LocalToUtf(), PG_GETARG_CSTRING, PG_GETARG_INT32, PG_JOHAB, PG_RETURN_VOID, and PG_UTF8.

37 {
38  unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
39  unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
40  int len = PG_GETARG_INT32(4);
41 
43 
44  LocalToUtf(src, len, dest,
45  &johab_to_unicode_tree,
46  NULL, 0,
47  NULL,
48  PG_JOHAB);
49 
51 }
#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() [1/2]

PG_FUNCTION_INFO_V1 ( johab_to_utf8  )

◆ PG_FUNCTION_INFO_V1() [2/2]

PG_FUNCTION_INFO_V1 ( utf8_to_johab  )

◆ utf8_to_johab()

Datum utf8_to_johab ( PG_FUNCTION_ARGS  )

Definition at line 54 of file utf8_and_johab.c.

References CHECK_ENCODING_CONVERSION_ARGS, generate_unaccent_rules::dest, PG_GETARG_CSTRING, PG_GETARG_INT32, PG_JOHAB, PG_RETURN_VOID, PG_UTF8, and UtfToLocal().

55 {
56  unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
57  unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
58  int len = PG_GETARG_INT32(4);
59 
61 
62  UtfToLocal(src, len, dest,
63  &johab_from_unicode_tree,
64  NULL, 0,
65  NULL,
66  PG_JOHAB);
67 
69 }
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

PG_MODULE_MAGIC

Definition at line 20 of file utf8_and_johab.c.