locale.library: use system default locale if locale argument is NULL.
[AROS.git] / workbench / libs / locale / isxxxx.c
blob458886433af75af509dc81aa444f2bf739529b9b
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: IsXXXX() - Stub for Language isXXXXX() functions.
6 Lang: english
7 */
8 #include "locale_intern.h"
9 #include <aros/asmcall.h>
10 #include <proto/locale.h>
12 /*****************************************************************************
14 NAME
15 #include <proto/locale.h>
17 AROS_LH2(BOOL, IsXXXX,
19 SYNOPSIS
20 AROS_LHA(const struct Locale *, locale, A0),
21 AROS_LHA(ULONG, character, D0),
23 LOCATION
24 struct LocaleBase *, LocaleBase, 0, Locale)
26 FUNCTION
27 These functions allow you to find out whether a character
28 matches a certain type according to the current Locale
29 settings.
31 The functions available are:
33 IsAlNum() - is this an alphanumeric character
34 IsAlpha() - is this an alphabet character
35 IsCntrl() - is this a control character
36 IsDigit() - is this a decimal digit character
37 IsGraph() - is this a graphical character
38 IsLower() - is this a lowercase character
39 IsPrint() - is this a printable character
40 IsPunct() - is this a punctuation character
41 IsSpace() - is this a whitespace character
42 IsUpper() - is this an uppercase character
43 IsXDigit() - is this a hexadecimal digit
45 INPUTS
46 locale - The Locale to use for this function or NULL
47 for the system default locale.
48 character - the character to test
50 RESULT
51 ind - An indication of whether the character matches the type.
52 TRUE - if the character is of the required type,
53 FALSE - otherwise
55 NOTES
56 These functions require a 32-bit character to support future
57 multi-byte character sets.
59 EXAMPLE
61 BUGS
63 SEE ALSO
65 INTERNALS
67 *****************************************************************************/
70 AROS_LH2(ULONG, IsAlNum,
71 AROS_LHA(struct Locale *, locale, A0),
72 AROS_LHA(ULONG , character, D0),
73 struct LocaleBase *, LocaleBase, 14, Locale)
75 AROS_LIBFUNC_INIT
77 ULONG retval;
78 struct Locale *def_locale = NULL;
80 if (locale == NULL)
82 locale = OpenLocale(NULL);
83 def_locale = locale;
86 #ifdef AROS_CALL1
87 retval = AROS_CALL1(BOOL, IntL(locale)->il_LanguageFunctions[4],
88 AROS_LCA(ULONG, character, D0),
89 struct LocaleBase *, LocaleBase);
90 #else
91 retval = AROS_UFC2(ULONG, IntL(locale)->il_LanguageFunctions[4],
92 AROS_UFCA(ULONG, character, D0),
93 AROS_UFCA(struct LocaleBase *, LocaleBase, A6));
94 #endif
96 CloseLocale(def_locale);
97 return retval;
99 AROS_LIBFUNC_EXIT
100 } /* IsAlNum */
102 AROS_LH2(ULONG, IsAlpha,
103 AROS_LHA(struct Locale *, locale, A0),
104 AROS_LHA(ULONG , character, D0),
105 struct LocaleBase *, LocaleBase, 15, Locale)
107 AROS_LIBFUNC_INIT
109 ULONG retval;
110 struct Locale *def_locale = NULL;
112 if (locale == NULL)
114 locale = OpenLocale(NULL);
115 def_locale = locale;
118 #ifdef AROS_CALL1
119 retval = AROS_CALL1(BOOL, IntL(locale)->il_LanguageFunctions[5],
120 AROS_LCA(ULONG, character, D0),
121 struct LocaleBase *, LocaleBase);
122 #else
123 retval = AROS_UFC2(ULONG, IntL(locale)->il_LanguageFunctions[5],
124 AROS_UFCA(ULONG, character, D0),
125 AROS_UFCA(struct LocaleBase *, LocaleBase, A6));
126 #endif
128 CloseLocale(def_locale);
129 return retval;
131 AROS_LIBFUNC_EXIT
132 } /* IsAlpha */
134 AROS_LH2(ULONG, IsCntrl,
135 AROS_LHA(struct Locale *, locale, A0),
136 AROS_LHA(ULONG , character, D0),
137 struct LocaleBase *, LocaleBase, 16, Locale)
139 AROS_LIBFUNC_INIT
141 ULONG retval;
142 struct Locale *def_locale = NULL;
144 if (locale == NULL)
146 locale = OpenLocale(NULL);
147 def_locale = locale;
150 #ifdef AROS_CALL1
151 retval = AROS_CALL1(BOOL, IntL(locale)->il_LanguageFunctions[6],
152 AROS_LCA(ULONG, character, D0),
153 struct LocaleBase *, LocaleBase);
154 #else
155 retval = AROS_UFC2(ULONG, IntL(locale)->il_LanguageFunctions[6],
156 AROS_UFCA(ULONG, character, D0),
157 AROS_UFCA(struct LocaleBase *, LocaleBase, A6));
158 #endif
160 CloseLocale(def_locale);
161 return retval;
163 AROS_LIBFUNC_EXIT
164 } /* IsCntrl */
166 AROS_LH2(ULONG, IsDigit,
167 AROS_LHA(struct Locale *, locale, A0),
168 AROS_LHA(ULONG , character, D0),
169 struct LocaleBase *, LocaleBase, 17, Locale)
171 AROS_LIBFUNC_INIT
173 ULONG retval;
174 struct Locale *def_locale = NULL;
176 if (locale == NULL)
178 locale = OpenLocale(NULL);
179 def_locale = locale;
182 #ifdef AROS_CALL1
183 retval = AROS_CALL1(BOOL, IntL(locale)->il_LanguageFunctions[7],
184 AROS_LCA(ULONG, character, D0),
185 struct LocaleBase *, LocaleBase);
186 #else
187 retval = AROS_UFC2(ULONG, IntL(locale)->il_LanguageFunctions[7],
188 AROS_UFCA(ULONG, character, D0),
189 AROS_UFCA(struct LocaleBase *, LocaleBase, A6));
190 #endif
192 CloseLocale(def_locale);
193 return retval;
195 AROS_LIBFUNC_EXIT
196 } /* IsDigit */
198 AROS_LH2(ULONG, IsGraph,
199 AROS_LHA(struct Locale *, locale, A0),
200 AROS_LHA(ULONG , character, D0),
201 struct LocaleBase *, LocaleBase, 18, Locale)
203 AROS_LIBFUNC_INIT
205 ULONG retval;
206 struct Locale *def_locale = NULL;
208 if (locale == NULL)
210 locale = OpenLocale(NULL);
211 def_locale = locale;
214 #ifdef AROS_CALL1
215 retval = AROS_CALL1(BOOL, IntL(locale)->il_LanguageFunctions[8],
216 AROS_LCA(ULONG, character, D0),
217 struct LocaleBase *, LocaleBase);
218 #else
219 retval = AROS_UFC2(ULONG, IntL(locale)->il_LanguageFunctions[8],
220 AROS_UFCA(ULONG, character, D0),
221 AROS_UFCA(struct LocaleBase *, LocaleBase, A6));
222 #endif
224 CloseLocale(def_locale);
225 return retval;
227 AROS_LIBFUNC_EXIT
228 } /* IsGraph */
230 AROS_LH2(ULONG, IsLower,
231 AROS_LHA(struct Locale *, locale, A0),
232 AROS_LHA(ULONG , character, D0),
233 struct LocaleBase *, LocaleBase, 19, Locale)
235 AROS_LIBFUNC_INIT
237 ULONG retval;
238 struct Locale *def_locale = NULL;
240 if (locale == NULL)
242 locale = OpenLocale(NULL);
243 def_locale = locale;
246 #ifdef AROS_CALL1
247 retval = AROS_CALL1(BOOL, IntL(locale)->il_LanguageFunctions[9],
248 AROS_LCA(ULONG, character, D0),
249 struct LocaleBase *, LocaleBase);
250 #else
251 retval = AROS_UFC2(ULONG, IntL(locale)->il_LanguageFunctions[9],
252 AROS_UFCA(ULONG, character, D0),
253 AROS_UFCA(struct LocaleBase *, LocaleBase, A6));
254 #endif
256 CloseLocale(def_locale);
257 return retval;
259 AROS_LIBFUNC_EXIT
260 } /* IsLower */
262 AROS_LH2(ULONG, IsPrint,
263 AROS_LHA(struct Locale *, locale, A0),
264 AROS_LHA(ULONG , character, D0),
265 struct LocaleBase *, LocaleBase, 20, Locale)
267 AROS_LIBFUNC_INIT
269 ULONG retval;
270 struct Locale *def_locale = NULL;
272 if (locale == NULL)
274 locale = OpenLocale(NULL);
275 def_locale = locale;
278 #ifdef AROS_CALL1
279 retval = AROS_CALL1(BOOL, IntL(locale)->il_LanguageFunctions[10],
280 AROS_LCA(ULONG, character, D0),
281 struct LocaleBase *, LocaleBase);
282 #else
283 retval = AROS_UFC2(ULONG, IntL(locale)->il_LanguageFunctions[10],
284 AROS_UFCA(ULONG, character, D0),
285 AROS_UFCA(struct LocaleBase *, LocaleBase, A6));
286 #endif
288 CloseLocale(def_locale);
289 return retval;
291 AROS_LIBFUNC_EXIT
292 } /* IsPrint */
294 AROS_LH2(ULONG, IsPunct,
295 AROS_LHA(struct Locale *, locale, A0),
296 AROS_LHA(ULONG , character, D0),
297 struct LocaleBase *, LocaleBase, 21, Locale)
299 AROS_LIBFUNC_INIT
301 ULONG retval;
302 struct Locale *def_locale = NULL;
304 if (locale == NULL)
306 locale = OpenLocale(NULL);
307 def_locale = locale;
310 #ifdef AROS_CALL1
311 retval = AROS_CALL1(BOOL, IntL(locale)->il_LanguageFunctions[11],
312 AROS_LCA(ULONG, character, D0),
313 struct LocaleBase *, LocaleBase);
314 #else
315 retval = AROS_UFC2(ULONG, IntL(locale)->il_LanguageFunctions[11],
316 AROS_UFCA(ULONG, character, D0),
317 AROS_UFCA(struct LocaleBase *, LocaleBase, A6));
318 #endif
320 CloseLocale(def_locale);
321 return retval;
323 AROS_LIBFUNC_EXIT
324 } /* IsPunct */
326 AROS_LH2(ULONG, IsSpace,
327 AROS_LHA(struct Locale *, locale, A0),
328 AROS_LHA(ULONG , character, D0),
329 struct LocaleBase *, LocaleBase, 22, Locale)
331 AROS_LIBFUNC_INIT
333 ULONG retval;
334 struct Locale *def_locale = NULL;
336 if (locale == NULL)
338 locale = OpenLocale(NULL);
339 def_locale = locale;
342 #ifdef AROS_CALL1
343 retval = AROS_CALL1(BOOL, IntL(locale)->il_LanguageFunctions[12],
344 AROS_LCA(ULONG, character, D0),
345 struct LocaleBase *, LocaleBase);
346 #else
347 retval = AROS_UFC2(ULONG, IntL(locale)->il_LanguageFunctions[12],
348 AROS_UFCA(ULONG, character, D0),
349 AROS_UFCA(struct LocaleBase *, LocaleBase, A6));
350 #endif
352 CloseLocale(def_locale);
353 return retval;
355 AROS_LIBFUNC_EXIT
356 } /* IsSpace */
358 AROS_LH2(ULONG, IsUpper,
359 AROS_LHA(struct Locale *, locale, A0),
360 AROS_LHA(ULONG , character, D0),
361 struct LocaleBase *, LocaleBase, 23, Locale)
363 AROS_LIBFUNC_INIT
365 ULONG retval;
366 struct Locale *def_locale = NULL;
368 if (locale == NULL)
370 locale = OpenLocale(NULL);
371 def_locale = locale;
374 #ifdef AROS_CALL1
375 retval = AROS_CALL1(BOOL, IntL(locale)->il_LanguageFunctions[13],
376 AROS_LCA(ULONG, character, D0),
377 struct LocaleBase *, LocaleBase);
378 #else
379 retval = AROS_UFC2(ULONG, IntL(locale)->il_LanguageFunctions[13],
380 AROS_UFCA(ULONG, character, D0),
381 AROS_UFCA(struct LocaleBase *, LocaleBase, A6));
382 #endif
384 CloseLocale(def_locale);
385 return retval;
387 AROS_LIBFUNC_EXIT
388 } /* IsUpper */
390 AROS_LH2(ULONG, IsXDigit,
391 AROS_LHA(struct Locale *, locale, A0),
392 AROS_LHA(ULONG , character, D0),
393 struct LocaleBase *, LocaleBase, 24, Locale)
395 AROS_LIBFUNC_INIT
397 ULONG retval;
398 struct Locale *def_locale = NULL;
400 if (locale == NULL)
402 locale = OpenLocale(NULL);
403 def_locale = locale;
406 #ifdef AROS_CALL1
407 retval = AROS_CALL1(BOOL, IntL(locale)->il_LanguageFunctions[14],
408 AROS_LCA(ULONG, character, D0),
409 struct LocaleBase *, LocaleBase);
410 #else
411 retval = AROS_UFC2(ULONG, IntL(locale)->il_LanguageFunctions[14],
412 AROS_UFCA(ULONG, character, D0),
413 AROS_UFCA(struct LocaleBase *, LocaleBase, A6));
414 #endif
416 CloseLocale(def_locale);
417 return retval;
419 AROS_LIBFUNC_EXIT
420 } /* IsXDigit */