]> git.saurik.com Git - apple/libc.git/blob - locale/xlocale.3
101402b8bbe8c173d5f050c2913c056a8fdff81c
[apple/libc.git] / locale / xlocale.3
1 .Dd March 11, 2005
2 .Dt XLOCALE 3
3 .Os
4 .Sh NAME
5 .Nm xlocale
6 .Nd Extended locale support.
7 .Sh LIBRARY
8 .Lb libc
9 .Sh DESCRIPTION
10 Include
11 .Aq xlocale.h
12 for extended locale support.
13 It can be used alone or with the POSIX locale API in
14 .Aq locale.h .
15 .Pp
16 The extended locale, or "xlocale" API consists of five basic routines,
17 which are documented separately:
18 .Xr duplocale 3 ,
19 .Xr freelocale 3 ,
20 .Xr newlocale 3 ,
21 .Xr querylocale 3 ,
22 and
23 .Xr uselocale 3 .
24 For each of these routines, if a NULL
25 .Vt locale_t
26 is given, the current locale is used.
27 .Pp
28 In addition,
29 .Aq xlocale.h
30 defines a few macros:
31 .Pp
32 .Bl -dash
33 .It
34 LC_GLOBAL_LOCALE - A special
35 .Vt locale_t
36 value that corresponds to the global, process-wide locale.
37 .It
38 MB_CUR_MAX - This macro is traditionally defined as an integer
39 containing the value of the longest multi-byte string
40 that a single-wide character in the global locale can translate into.
41 With extended locales, this macro is replaced with a function
42 that returns the value of the longest multi-byte string
43 that a single-wide character in the current locale (per-thread or global)
44 can translate into.
45 .It
46 MB_CUR_MAX_L(loc) - This macro is equivalent to MB_CUR_MAX,
47 except that it may be passed a specific locale directly.
48 .El
49 .Sh CAVEATS
50 The POSIX
51 .Xr setlocale 3
52 function only affects the global locale,
53 so using it when a per-thread locale is in effect
54 will not change locale behavior for that thread.
55 However, it will change behavior for threads
56 with no per-thread locale in effect.
57 .Pp
58 The routines defined in
59 .Aq rune.h
60 are deprecated, and may not be fully consistent with the xlocale API.
61 Of particular note is
62 .Fn setinvalidrune ,
63 which would normally modify the value in the global locale.
64 Since this value resides in a sub-structure of
65 .Vt locale_t
66 and sub-structures may be shared by multiple locales,
67 .Fn setinvalidrune
68 has been modified to make a copy of the sub-structure.
69 This prevents it from affecting other locales.
70 .Sh SEE ALSO
71 .Xr duplocale 3 ,
72 .Xr freelocale 3 ,
73 .Xr localeconv 3 ,
74 .Xr newlocale 3 ,
75 .Xr querylocale 3 ,
76 .Xr uselocale 3
77 .Sh CONVENIENCE FUNCTIONS
78 The xlocale API also includes "convenience functions":
79 functions that can be executed using a given locale,
80 rather than the current locale.
81 These functions all take one extra
82 .Vt locale_t
83 argument at the end of the traditional argument list,
84 except in the case of variable-argument functions,
85 in which case the extra argument comes before the format string.
86 If a NULL
87 .Vt locale_t
88 is passed, the C locale will be used.
89 .Pp
90 For completeness,
91 the convenience functions are listed here
92 (organized by the header file that contains the original function).
93 .Pp
94 .Bl -tag -width monetary.h
95 .It Aq _wctype.h
96 .Xr iswalnum_l 3 ,
97 .Xr iswalpha_l 3 ,
98 .Xr iswcntrl_l 3 ,
99 .Xr iswctype_l 3 ,
100 .Xr iswdigit_l 3 ,
101 .Xr iswgraph_l 3 ,
102 .Xr iswlower_l 3 ,
103 .Xr iswprint_l 3 ,
104 .Xr iswpunct_l 3 ,
105 .Xr iswspace_l 3 ,
106 .Xr iswupper_l 3 ,
107 .Xr iswxdigit_l 3 ,
108 .Xr towlower_l 3 ,
109 .Xr towupper_l 3 ,
110 .Xr wctype_l 3
111 .It Aq ctype.h
112 .Xr digittoint_l 3 ,
113 .Xr isalnum_l 3 ,
114 .Xr isalpha_l 3 ,
115 .Xr isblank_l 3 ,
116 .Xr iscntrl_l 3 ,
117 .Xr isdigit_l 3 ,
118 .Xr isgraph_l 3 ,
119 .Xr ishexnumber_l 3 ,
120 .Xr isideogram_l 3 ,
121 .Xr islower_l 3 ,
122 .Xr isnumber_l 3 ,
123 .Xr isphonogram_l 3 ,
124 .Xr isprint_l 3 ,
125 .Xr ispunct_l 3 ,
126 .Xr isrune_l 3 ,
127 .Xr isspace_l 3 ,
128 .Xr isspecial_l 3 ,
129 .Xr isupper_l 3 ,
130 .Xr isxdigit_l 3 ,
131 .Xr tolower_l 3 ,
132 .Xr toupper_l 3
133 .It Aq inttypes.h
134 .Xr strtoimax_l 3 ,
135 .Xr strtoumax_l 3 ,
136 .Xr wcstoimax_l 3 ,
137 .Xr wcstoumax_l 3
138 .It Aq langinfo.h
139 .Xr nl_langinfo_l 3
140 .It Aq monetary.h
141 .Xr strfmon_l 3
142 .It Aq stdio.h
143 .Xr asprintf_l 3 ,
144 .Xr fprintf_l 3 ,
145 .Xr fscanf_l 3 ,
146 .Xr printf_l 3 ,
147 .Xr scanf_l 3 ,
148 .Xr snprintf_l 3 ,
149 .Xr sprintf_l 3 ,
150 .Xr sscanf_l 3 ,
151 .Xr vasprintf_l 3 ,
152 .Xr vfprintf_l 3 ,
153 .Xr vfscanf_l 3 ,
154 .Xr vprintf_l 3 ,
155 .Xr vscanf_l 3 ,
156 .Xr vsnprintf_l 3 ,
157 .Xr vsprintf_l 3 ,
158 .Xr vsscanf_l 3
159 .It Aq stdlib.h
160 .Xr atof_l 3 ,
161 .Xr atoi_l 3 ,
162 .Xr atol_l 3 ,
163 .Xr atoll_l 3 ,
164 .Xr mblen_l 3 ,
165 .Xr mbstowcs_l 3 ,
166 .Xr mbtowc_l 3 ,
167 .Xr strtod_l 3 ,
168 .Xr strtof_l 3 ,
169 .Xr strtol_l 3 ,
170 .Xr strtold_l 3 ,
171 .Xr strtoll_l 3 ,
172 .Xr strtoq_l 3 ,
173 .Xr strtoul_l 3 ,
174 .Xr strtoull_l 3 ,
175 .Xr strtouq_l 3 ,
176 .Xr wcstombs_l 3 ,
177 .Xr wctomb_l 3
178 .It Aq string.h
179 .Xr strcoll_l 3 ,
180 .Xr strxfrm_l 3 ,
181 .Xr strcasecmp_l 3 ,
182 .Xr strcasestr_l 3 ,
183 .Xr strncasecmp_l 3
184 .It Aq time.h
185 .Xr strftime_l 3 ,
186 .Xr strptime_l 3
187 .It Aq wchar.h
188 .Xr btowc_l 3 ,
189 .Xr fgetwc_l 3 ,
190 .Xr *fgetws_l 3 ,
191 .Xr fputwc_l 3 ,
192 .Xr fputws_l 3 ,
193 .Xr fwprintf_l 3 ,
194 .Xr fwscanf_l 3 ,
195 .Xr getwc_l 3 ,
196 .Xr getwchar_l 3 ,
197 .Xr mbrlen_l 3 ,
198 .Xr mbrtowc_l 3 ,
199 .Xr mbsinit_l 3 ,
200 .Xr mbsnrtowcs_l 3 ,
201 .Xr mbsrtowcs_l 3 ,
202 .Xr putwc_l 3 ,
203 .Xr putwchar_l 3 ,
204 .Xr swprintf_l 3 ,
205 .Xr swscanf_l 3 ,
206 .Xr ungetwc_l 3 ,
207 .Xr vfwprintf_l 3 ,
208 .Xr vfwscanf_l 3 ,
209 .Xr vswprintf_l 3 ,
210 .Xr vswscanf_l 3 ,
211 .Xr vwprintf_l 3 ,
212 .Xr vwscanf_l 3 ,
213 .Xr wcrtomb_l 3 ,
214 .Xr wcscoll_l 3 ,
215 .Xr wcsftime_l 3 ,
216 .Xr wcsnrtombs_l 3 ,
217 .Xr wcsrtombs_l 3 ,
218 .Xr wcstod_l 3 ,
219 .Xr wcstof_l 3 ,
220 .Xr wcstol_l 3 ,
221 .Xr wcstold_l 3 ,
222 .Xr wcstoll_l 3 ,
223 .Xr wcstoul_l 3 ,
224 .Xr wcstoull_l 3 ,
225 .Xr wcswidth_l 3 ,
226 .Xr wcsxfrm_l 3 ,
227 .Xr wctob_l 3 ,
228 .Xr wcwidth_l 3 ,
229 .Xr wprintf_l 3 ,
230 .Xr wscanf_l 3
231 .It Aq wctype.h
232 .Xr iswblank_l 3 ,
233 .Xr iswhexnumber_l 3 ,
234 .Xr iswideogram_l 3 ,
235 .Xr iswnumber_l 3 ,
236 .Xr iswphonogram_l 3 ,
237 .Xr iswrune_l 3 ,
238 .Xr iswspecial_l 3 ,
239 .Xr nextwctype_l 3 ,
240 .Xr towctrans_l 3 ,
241 .Xr wctrans_l 3
242 .It Aq xlocale.h
243 .Xr localeconv_l 3
244 .El