X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/3d9156a7a519a5e3aa1b92e9d9d4b991f1aed7ff..2be56ee90c5c5bee77895b8787a43e894249002b:/locale/FreeBSD/wctype.c diff --git a/locale/FreeBSD/wctype.c b/locale/FreeBSD/wctype.c index a0e21bc..f94c133 100644 --- a/locale/FreeBSD/wctype.c +++ b/locale/FreeBSD/wctype.c @@ -25,24 +25,20 @@ */ #include -__FBSDID("$FreeBSD: src/lib/libc/locale/wctype.c,v 1.3 2004/03/27 08:59:21 tjr Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/locale/wctype.c,v 1.4 2008/03/17 18:22:23 antoine Exp $"); + +#include "xlocale_private.h" #include #include #include - -#undef iswctype -int -iswctype(wint_t wc, wctype_t charclass) -{ - - return (__istype(wc, charclass)); -} +#include wctype_t -wctype(const char *property) +wctype_l(const char *property, locale_t loc) { - struct { + _RuneLocale *rl; + static const struct { const char *name; wctype_t mask; } props[] = { @@ -70,5 +66,23 @@ wctype(const char *property) while (props[i].name != NULL && strcmp(props[i].name, property) != 0) i++; - return (props[i].mask); + if (props[i].mask) + return (props[i].mask); + + NORMALIZE_LOCALE(loc); + rl = &loc->__lc_ctype->_CurrentRuneLocale; + if ((i = rl->__ncharclasses) > 0) { + _RuneCharClass *rp; + for (rp = rl->__charclasses; i-- > 0; rp++) { + if (strncmp(rp->__name, property, CHARCLASS_NAME_MAX) == 0) + return (rp->__mask); + } + } + return 0; +} + +wctype_t +wctype(const char *property) +{ + return wctype_l(property, __current_locale()); }