1 /*-----------------------------------------------------------------------
3 * PostgreSQL locale utilities
5 * src/include/utils/pg_locale.h
7 * Copyright (c) 2002-2014, PostgreSQL Global Development Group
9 *-----------------------------------------------------------------------
16 #ifdef LOCALE_T_IN_XLOCALE
20 #include "utils/guc.h"
24 extern char *locale_messages;
25 extern char *locale_monetary;
26 extern char *locale_numeric;
27 extern char *locale_time;
29 /* lc_time localization cache */
30 extern char *localized_abbrev_days[];
31 extern char *localized_full_days[];
32 extern char *localized_abbrev_months[];
33 extern char *localized_full_months[];
36 extern bool check_locale_messages(char **newval, void **extra, GucSource source);
37 extern void assign_locale_messages(const char *newval, void *extra);
38 extern bool check_locale_monetary(char **newval, void **extra, GucSource source);
39 extern void assign_locale_monetary(const char *newval, void *extra);
40 extern bool check_locale_numeric(char **newval, void **extra, GucSource source);
41 extern void assign_locale_numeric(const char *newval, void *extra);
42 extern bool check_locale_time(char **newval, void **extra, GucSource source);
43 extern void assign_locale_time(const char *newval, void *extra);
45 extern bool check_locale(int category, const char *locale, char **canonname);
46 extern char *pg_perm_setlocale(int category, const char *locale);
48 extern bool lc_collate_is_c(Oid collation);
49 extern bool lc_ctype_is_c(Oid collation);
52 * Return the POSIX lconv struct (contains number/money formatting
53 * information) with locale information for all categories.
55 extern struct lconv *PGLC_localeconv(void);
57 extern void cache_locale_time(void);
61 * We define our own wrapper around locale_t so we can keep the same
62 * function signatures for all builds, while not having to create a
63 * fake version of the standard type locale_t in the global namespace.
64 * The fake version of pg_locale_t can be checked for truth; that's
65 * about all it will be needed for.
68 typedef locale_t pg_locale_t;
70 typedef int pg_locale_t;
73 extern pg_locale_t pg_newlocale_from_collation(Oid collid);
75 /* These functions convert from/to libc's wchar_t, *not* pg_wchar_t */
76 #ifdef USE_WIDE_UPPER_LOWER
77 extern size_t wchar2char(char *to, const wchar_t *from, size_t tolen,
79 extern size_t char2wchar(wchar_t *to, size_t tolen,
80 const char *from, size_t fromlen, pg_locale_t locale);
83 #endif /* _PG_LOCALE_ */