Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
rw_locale.h
Go to the documentation of this file.
1
29#ifndef RW_LOCALE_H_INCLUDED
30#define RW_LOCALE_H_INCLUDED
31
32
33#include <rw_testdefs.h>
34
35
36#define _UNUSED_CAT 69
37
38
39// get a list of all native locales that match the cannonical
40// locale name query strings
41_TEST_EXPORT char*
42rw_locale_query (int = _UNUSED_CAT, const char* = 0, _RWSTD_SIZE_T = 0);
43
44
45// this function will likely be deprecated!
46_TEST_EXPORT char*
47rw_locales (int = _UNUSED_CAT, const char* = 0, bool = true);
48
49
50// invokes the locale utility with the arguments specified by 'arg',
51// redirecting its output to the file named by 'fname' if non-null
52// returns the exit status of the utility
54rw_locale (const char* /* args */, const char* /* fname */);
55
56
57#define LOCALE_ROOT_ENVAR "RWSTD_LOCALE_ROOT"
58
59// creates a temporary directory and defines the RWSTD_LOCALE_ROOT
60// environment variable to the name of the directory; the directory
61// will be automatically removed on program exit as if by calling
62// atexit()
63// if the environment variable RW_PUTENV is defined, defines any
64// additional environment variable(s) specified by it (by calling
65// rw_putenv(0))
66// returns the absolute pathname of the directory
67_TEST_EXPORT const char*
69
70
71// invokes localedef to create a locale database named by the last argument,
72// if non-0, or in a directory specified by the RWSTD_LOCALE_ROOT environment
73// variable otherwise, if it is defined, otherwise in the current working
74// directory
75// returns the name of the locale; successive calls to the function may
76// change the contents of the character array pointed to by the pointer
77// returned from prior calls
78_TEST_EXPORT const char*
79rw_localedef (const char*, const char*, const char*, const char*);
80
81
82// stores up to 'size' wide characters valid in the current locale
83// in consecutive elements of the 'wbuf' buffer; if 'nbytes' is
84// non-zero only wide characters with multibyte sequences of the
85// specified length will be stored (as determined by mblen())
86// returns the number of elements stored
87_TEST_EXPORT _RWSTD_SIZE_T
88rw_get_wchars (wchar_t* /* wbuf */,
89 _RWSTD_SIZE_T /* size */,
90 int /* nbytes */ = 0);
91
92
93// an array of multibyte characters 1 to MB_LEN_MAX bytes in length
94typedef char
95rw_mbchar_array_t [_RWSTD_MB_LEN_MAX][_RWSTD_MB_LEN_MAX];
96
97// fills consecutive elements of the `mb_chars' array with multibyte
98// characters between 1 and MB_CUR_MAX bytes long for the currently
99// set locale
100// returns the number of elements populated (normally, MB_CUR_MAX)
101_TEST_EXPORT _RWSTD_SIZE_T
102rw_get_mb_chars (rw_mbchar_array_t /* mb_chars */);
103
104
105// finds the multibyte locale with the largest MB_CUR_MAX value and
106// fills consecutive elements of the `mb_chars' array with multibyte
107// characters between 1 and MB_CUR_MAX bytes long for such a locale
108_TEST_EXPORT const char*
109rw_find_mb_locale (_RWSTD_SIZE_T* /* mb_cur_max */,
110 rw_mbchar_array_t /* mb_chars */);
111
112// invokes localedef with charmap and locale def to create a locale database
113// in a directory specified by the RWSTD_LOCALE_ROOT environment
114// variable, if it is defined, otherwise in the current working
115// directory
116// returns the name of the locale
117_TEST_EXPORT const char*
118rw_create_locale (const char* /* charmap */, const char* /* locale */);
119
120
121// NUL-separated list of locale names specified by the --locales
122// command line option (set by the rw_opt_setlocales handler)
123_TEST_EXPORT extern const char* const&
125
126
127// callback function invoked in response to the --locales=<locale-list>
128// command line option to set the rw_opt_locales global variable to the
129// NUL-separated list of locale names to exercise
130_TEST_EXPORT int
131rw_opt_setlocales (int, char*[]);
132
133
134// creates message file and invokes gencat to create message catalog
135// then removes the message file
136// catalog is a '\0' separated list of strings, each of which representing
137// a single message, and with a blank line separating one set from another
138// returns 0 in success
139_TEST_EXPORT int
140rw_create_catalog (const char * /* catname */, const char * /* catalog */);
141
142#endif // RW_LOCALE_H_INCLUDED
_TEST_EXPORT int rw_opt_setlocales(int, char *[])
Definition locale.cpp:866
_TEST_EXPORT _RWSTD_SIZE_T rw_get_wchars(wchar_t *, _RWSTD_SIZE_T, int=0)
_TEST_EXPORT const char * rw_create_locale(const char *, const char *)
Definition locale.cpp:792
_TEST_EXPORT int rw_locale(const char *, const char *)
Definition locale.cpp:132
_TEST_EXPORT _RWSTD_SIZE_T rw_get_mb_chars(rw_mbchar_array_t)
Definition locale.cpp:618
_TEST_EXPORT const char *const & rw_opt_locales
Definition locale.cpp:862
_TEST_EXPORT const char * rw_set_locale_root()
Definition locale.cpp:324
_TEST_EXPORT char * rw_locales(int=_UNUSED_CAT, const char *=0, bool=true)
Definition locale.cpp:368
_TEST_EXPORT const char * rw_localedef(const char *, const char *, const char *, const char *)
Definition locale.cpp:154
char rw_mbchar_array_t[_RWSTD_MB_LEN_MAX][_RWSTD_MB_LEN_MAX]
Definition rw_locale.h:95
#define _UNUSED_CAT
Definition rw_locale.h:36
_TEST_EXPORT int rw_create_catalog(const char *, const char *)
Definition locale.cpp:920
_TEST_EXPORT char * rw_locale_query(int=_UNUSED_CAT, const char *=0, _RWSTD_SIZE_T=0)
_TEST_EXPORT const char * rw_find_mb_locale(_RWSTD_SIZE_T *, rw_mbchar_array_t)
#define _TEST_EXPORT
Definition rw_testdefs.h:55