Index: projects/collation/include/_ctype.h =================================================================== --- projects/collation/include/_ctype.h (revision 289262) +++ projects/collation/include/_ctype.h (revision 289263) @@ -1,186 +1,187 @@ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * This code is derived from software contributed to Berkeley by * Paul Borman at Krystal Technologies. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * From @(#)ctype.h 8.4 (Berkeley) 1/21/94 * From FreeBSD: src/include/ctype.h,v 1.27 2004/06/23 07:11:39 tjr Exp * $FreeBSD$ */ #ifndef __CTYPE_H_ #define __CTYPE_H_ #include #include #define _CTYPE_A 0x00000100L /* Alpha */ #define _CTYPE_C 0x00000200L /* Control */ #define _CTYPE_D 0x00000400L /* Digit */ #define _CTYPE_G 0x00000800L /* Graph */ #define _CTYPE_L 0x00001000L /* Lower */ #define _CTYPE_P 0x00002000L /* Punct */ #define _CTYPE_S 0x00004000L /* Space */ #define _CTYPE_U 0x00008000L /* Upper */ #define _CTYPE_X 0x00010000L /* X digit */ #define _CTYPE_B 0x00020000L /* Blank */ #define _CTYPE_R 0x00040000L /* Print */ #define _CTYPE_I 0x00080000L /* Ideogram */ #define _CTYPE_T 0x00100000L /* Special */ #define _CTYPE_Q 0x00200000L /* Phonogram */ +#define _CTYPE_N 0x00400000L /* Number (superset of digit) */ #define _CTYPE_SW0 0x20000000L /* 0 width character */ #define _CTYPE_SW1 0x40000000L /* 1 width character */ #define _CTYPE_SW2 0x80000000L /* 2 width character */ #define _CTYPE_SW3 0xc0000000L /* 3 width character */ #define _CTYPE_SWM 0xe0000000L /* Mask for screen width data */ #define _CTYPE_SWS 30 /* Bits to shift to get width */ /* See comments in about __ct_rune_t. */ __BEGIN_DECLS unsigned long ___runetype(__ct_rune_t) __pure; __ct_rune_t ___tolower(__ct_rune_t) __pure; __ct_rune_t ___toupper(__ct_rune_t) __pure; __END_DECLS /* * _EXTERNALIZE_CTYPE_INLINES_ is defined in locale/nomacros.c to tell us * to generate code for extern versions of all our inline functions. */ #ifdef _EXTERNALIZE_CTYPE_INLINES_ #define _USE_CTYPE_INLINE_ #define static #define __inline #endif extern int __mb_sb_limit; /* * Use inline functions if we are allowed to and the compiler supports them. */ #if !defined(_DONT_USE_CTYPE_INLINE_) && \ (defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus)) #include static __inline int __maskrune(__ct_rune_t _c, unsigned long _f) { return ((_c < 0 || _c >= _CACHED_RUNES) ? ___runetype(_c) : _CurrentRuneLocale->__runetype[_c]) & _f; } static __inline int __sbmaskrune(__ct_rune_t _c, unsigned long _f) { return (_c < 0 || _c >= __mb_sb_limit) ? 0 : _CurrentRuneLocale->__runetype[_c] & _f; } static __inline int __istype(__ct_rune_t _c, unsigned long _f) { return (!!__maskrune(_c, _f)); } static __inline int __sbistype(__ct_rune_t _c, unsigned long _f) { return (!!__sbmaskrune(_c, _f)); } static __inline int __isctype(__ct_rune_t _c, unsigned long _f) { return (_c < 0 || _c >= 128) ? 0 : !!(_DefaultRuneLocale.__runetype[_c] & _f); } static __inline __ct_rune_t __toupper(__ct_rune_t _c) { return (_c < 0 || _c >= _CACHED_RUNES) ? ___toupper(_c) : _CurrentRuneLocale->__mapupper[_c]; } static __inline __ct_rune_t __sbtoupper(__ct_rune_t _c) { return (_c < 0 || _c >= __mb_sb_limit) ? _c : _CurrentRuneLocale->__mapupper[_c]; } static __inline __ct_rune_t __tolower(__ct_rune_t _c) { return (_c < 0 || _c >= _CACHED_RUNES) ? ___tolower(_c) : _CurrentRuneLocale->__maplower[_c]; } static __inline __ct_rune_t __sbtolower(__ct_rune_t _c) { return (_c < 0 || _c >= __mb_sb_limit) ? _c : _CurrentRuneLocale->__maplower[_c]; } static __inline int __wcwidth(__ct_rune_t _c) { unsigned int _x; if (_c == 0) return (0); _x = (unsigned int)__maskrune(_c, _CTYPE_SWM|_CTYPE_R); if ((_x & _CTYPE_SWM) != 0) return ((_x & _CTYPE_SWM) >> _CTYPE_SWS); return ((_x & _CTYPE_R) != 0 ? 1 : -1); } #else /* not using inlines */ __BEGIN_DECLS int __maskrune(__ct_rune_t, unsigned long); int __sbmaskrune(__ct_rune_t, unsigned long); int __istype(__ct_rune_t, unsigned long); int __sbistype(__ct_rune_t, unsigned long); int __isctype(__ct_rune_t, unsigned long); __ct_rune_t __toupper(__ct_rune_t); __ct_rune_t __sbtoupper(__ct_rune_t); __ct_rune_t __tolower(__ct_rune_t); __ct_rune_t __sbtolower(__ct_rune_t); int __wcwidth(__ct_rune_t); __END_DECLS #endif /* using inlines */ #endif /* !__CTYPE_H_ */ Index: projects/collation/include/ctype.h =================================================================== --- projects/collation/include/ctype.h (revision 289262) +++ projects/collation/include/ctype.h (revision 289263) @@ -1,135 +1,135 @@ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * This code is derived from software contributed to Berkeley by * Paul Borman at Krystal Technologies. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)ctype.h 8.4 (Berkeley) 1/21/94 * $FreeBSD$ */ #ifndef _CTYPE_H_ #define _CTYPE_H_ #include #include #include <_ctype.h> __BEGIN_DECLS int isalnum(int); int isalpha(int); int iscntrl(int); int isdigit(int); int isgraph(int); int islower(int); int isprint(int); int ispunct(int); int isspace(int); int isupper(int); int isxdigit(int); int tolower(int); int toupper(int); #if __XSI_VISIBLE int isascii(int); int toascii(int); #endif #if __ISO_C_VISIBLE >= 1999 int isblank(int); #endif #if __BSD_VISIBLE int digittoint(int); int ishexnumber(int); int isideogram(int); int isnumber(int); int isphonogram(int); int isrune(int); int isspecial(int); #endif #if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_) #include #endif __END_DECLS #ifndef __cplusplus -#define isalnum(c) __sbistype((c), _CTYPE_A|_CTYPE_D) +#define isalnum(c) __sbistype((c), _CTYPE_A|_CTYPE_D|_CTYPE_N) #define isalpha(c) __sbistype((c), _CTYPE_A) #define iscntrl(c) __sbistype((c), _CTYPE_C) -#define isdigit(c) __isctype((c), _CTYPE_D) /* ANSI -- locale independent */ +#define isdigit(c) __sbistype((c), _CTYPE_D) #define isgraph(c) __sbistype((c), _CTYPE_G) #define islower(c) __sbistype((c), _CTYPE_L) #define isprint(c) __sbistype((c), _CTYPE_R) #define ispunct(c) __sbistype((c), _CTYPE_P) #define isspace(c) __sbistype((c), _CTYPE_S) #define isupper(c) __sbistype((c), _CTYPE_U) -#define isxdigit(c) __isctype((c), _CTYPE_X) /* ANSI -- locale independent */ +#define isxdigit(c) __sbistype((c), _CTYPE_X) #define tolower(c) __sbtolower(c) #define toupper(c) __sbtoupper(c) #endif /* !__cplusplus */ #if __XSI_VISIBLE /* * POSIX.1-2001 specifies _tolower() and _toupper() to be macros equivalent to * tolower() and toupper() respectively, minus extra checking to ensure that * the argument is a lower or uppercase letter respectively. We've chosen to * implement these macros with the same error checking as tolower() and * toupper() since this doesn't violate the specification itself, only its * intent. We purposely leave _tolower() and _toupper() undocumented to * discourage their use. * * XXX isascii() and toascii() should similarly be undocumented. */ #define _tolower(c) __sbtolower(c) #define _toupper(c) __sbtoupper(c) #define isascii(c) (((c) & ~0x7F) == 0) #define toascii(c) ((c) & 0x7F) #endif #if __ISO_C_VISIBLE >= 1999 && !defined(__cplusplus) #define isblank(c) __sbistype((c), _CTYPE_B) #endif #if __BSD_VISIBLE #define digittoint(c) __sbmaskrune((c), 0xFF) #define ishexnumber(c) __sbistype((c), _CTYPE_X) #define isideogram(c) __sbistype((c), _CTYPE_I) -#define isnumber(c) __sbistype((c), _CTYPE_D) +#define isnumber(c) __sbistype((c), _CTYPE_D|_CTYPE_N) #define isphonogram(c) __sbistype((c), _CTYPE_Q) #define isrune(c) __sbistype((c), 0xFFFFFF00L) #define isspecial(c) __sbistype((c), _CTYPE_T) #endif #endif /* !_CTYPE_H_ */ Index: projects/collation/include/wctype.h =================================================================== --- projects/collation/include/wctype.h (revision 289262) +++ projects/collation/include/wctype.h (revision 289263) @@ -1,125 +1,125 @@ /*- * Copyright (c)1999 Citrus Project, * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * citrus Id: wctype.h,v 1.4 2000/12/21 01:50:21 itojun Exp * $NetBSD: wctype.h,v 1.3 2000/12/22 14:16:16 itojun Exp $ * $FreeBSD$ */ #ifndef _WCTYPE_H_ #define _WCTYPE_H_ #include #include #include <_ctype.h> #ifndef _WCTRANS_T typedef int wctrans_t; #define _WCTRANS_T #endif #ifndef _WCTYPE_T typedef unsigned long wctype_t; #define _WCTYPE_T #endif #ifndef _WINT_T_DECLARED typedef __wint_t wint_t; #define _WINT_T_DECLARED #endif #ifndef WEOF #define WEOF ((wint_t)-1) #endif __BEGIN_DECLS int iswalnum(wint_t); int iswalpha(wint_t); int iswblank(wint_t); int iswcntrl(wint_t); int iswctype(wint_t, wctype_t); int iswdigit(wint_t); int iswgraph(wint_t); int iswlower(wint_t); int iswprint(wint_t); int iswpunct(wint_t); int iswspace(wint_t); int iswupper(wint_t); int iswxdigit(wint_t); wint_t towctrans(wint_t, wctrans_t); wint_t towlower(wint_t); wint_t towupper(wint_t); wctrans_t wctrans(const char *); wctype_t wctype(const char *); #if __BSD_VISIBLE wint_t iswascii(wint_t); wint_t iswhexnumber(wint_t); wint_t iswideogram(wint_t); wint_t iswnumber(wint_t); wint_t iswphonogram(wint_t); wint_t iswrune(wint_t); wint_t iswspecial(wint_t); wint_t nextwctype(wint_t, wctype_t); #endif #if __POSIX_VISIBLE >= 200809 #define _XLOCALE_WCTYPES 1 #include #endif /* __POSIX_VISIBLE >= 200809 */ __END_DECLS #ifndef __cplusplus -#define iswalnum(wc) __istype((wc), _CTYPE_A|_CTYPE_D) +#define iswalnum(wc) __istype((wc), _CTYPE_A|_CTYPE_D|_CTYPE_N) #define iswalpha(wc) __istype((wc), _CTYPE_A) #define iswblank(wc) __istype((wc), _CTYPE_B) #define iswcntrl(wc) __istype((wc), _CTYPE_C) #define iswctype(wc, charclass) __istype((wc), (charclass)) -#define iswdigit(wc) __isctype((wc), _CTYPE_D) +#define iswdigit(wc) __istype((wc), _CTYPE_D) #define iswgraph(wc) __istype((wc), _CTYPE_G) #define iswlower(wc) __istype((wc), _CTYPE_L) #define iswprint(wc) __istype((wc), _CTYPE_R) #define iswpunct(wc) __istype((wc), _CTYPE_P) #define iswspace(wc) __istype((wc), _CTYPE_S) #define iswupper(wc) __istype((wc), _CTYPE_U) -#define iswxdigit(wc) __isctype((wc), _CTYPE_X) +#define iswxdigit(wc) __istype((wc), _CTYPE_X) #define towlower(wc) __tolower(wc) #define towupper(wc) __toupper(wc) #if __BSD_VISIBLE #define iswascii(wc) (((wc) & ~0x7F) == 0) -#define iswhexnumber(wc) __istype((wc), _CTYPE_X) +#define iswhexnumber(wc) __istype((wc), _CTYPE_X) /* alias of iswxdigit */ #define iswideogram(wc) __istype((wc), _CTYPE_I) -#define iswnumber(wc) __istype((wc), _CTYPE_D) +#define iswnumber(wc) __istype((wc), _CTYPE_D|_CTYPE_N) #define iswphonogram(wc) __istype((wc), _CTYPE_Q) #define iswrune(wc) __istype((wc), 0xFFFFFF00L) #define iswspecial(wc) __istype((wc), _CTYPE_T) #endif /* __BSD_VISIBLE */ #endif /* __cplusplus */ #endif /* _WCTYPE_H_ */ Index: projects/collation/include/xlocale/_ctype.h =================================================================== --- projects/collation/include/xlocale/_ctype.h (revision 289262) +++ projects/collation/include/xlocale/_ctype.h (revision 289263) @@ -1,203 +1,203 @@ /*- * Copyright (c) 2011 The FreeBSD Foundation * All rights reserved. * * This software was developed by David Chisnall under sponsorship from * the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #if (defined(_XLOCALE_WCTYPES) && !defined(_XLOCALE_WCTYPE_H)) || \ (!defined(_XLOCALE_WCTYPES) && !defined(_XLOCALE_CTYPE_H)) #ifdef _XLOCALE_WCTYPES #define _XLOCALE_WCTYPE_H #else #define _XLOCALE_CTYPE_H #endif #ifndef _LOCALE_T_DEFINED #define _LOCALE_T_DEFINED typedef struct _xlocale *locale_t; #endif #ifndef _XLOCALE_RUN_FUNCTIONS_DEFINED #define _XLOCALE_RUN_FUNCTIONS_DEFINED 1 unsigned long ___runetype_l(__ct_rune_t, locale_t) __pure; __ct_rune_t ___tolower_l(__ct_rune_t, locale_t) __pure; __ct_rune_t ___toupper_l(__ct_rune_t, locale_t) __pure; _RuneLocale *__runes_for_locale(locale_t, int*); #endif #ifndef _XLOCALE_INLINE #if defined(__GNUC__) && !defined(__GNUC_STDC_INLINE__) /* GNU89 inline has nonstandard semantics. */ #define _XLOCALE_INLINE extern __inline #else /* Hack to work around people who define inline away */ #ifdef inline #define _XLOCALE_INLINE static __inline #else /* Define with C++ / C99 compatible semantics */ #define _XLOCALE_INLINE inline #endif #endif #endif /* _XLOCALE_INLINE */ #ifdef _XLOCALE_WCTYPES _XLOCALE_INLINE int __maskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc); _XLOCALE_INLINE int __istype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc); _XLOCALE_INLINE int __maskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc) { int __limit; _RuneLocale *runes = __runes_for_locale(__loc, &__limit); return ((__c < 0 || __c >= _CACHED_RUNES) ? ___runetype_l(__c, __loc) : runes->__runetype[__c]) & __f; } _XLOCALE_INLINE int __istype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc) { return (!!__maskrune_l(__c, __f, __loc)); } #define XLOCALE_ISCTYPE(fname, cat) \ _XLOCALE_INLINE int isw##fname##_l(int, locale_t);\ _XLOCALE_INLINE int isw##fname##_l(int __c, locale_t __l)\ { return __istype_l(__c, cat, __l); } #else _XLOCALE_INLINE int __sbmaskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc); _XLOCALE_INLINE int __sbistype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc); _XLOCALE_INLINE int __sbmaskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc) { int __limit; _RuneLocale *runes = __runes_for_locale(__loc, &__limit); return (__c < 0 || __c >= __limit) ? 0 : runes->__runetype[__c] & __f; } _XLOCALE_INLINE int __sbistype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc) { return (!!__sbmaskrune_l(__c, __f, __loc)); } #define XLOCALE_ISCTYPE(__fname, __cat) \ _XLOCALE_INLINE int is##__fname##_l(int, locale_t); \ _XLOCALE_INLINE int is##__fname##_l(int __c, locale_t __l)\ { return __sbistype_l(__c, __cat, __l); } #endif -XLOCALE_ISCTYPE(alnum, _CTYPE_A|_CTYPE_D) +XLOCALE_ISCTYPE(alnum, _CTYPE_A|_CTYPE_D|_CTYPE_N) XLOCALE_ISCTYPE(alpha, _CTYPE_A) XLOCALE_ISCTYPE(blank, _CTYPE_B) XLOCALE_ISCTYPE(cntrl, _CTYPE_C) XLOCALE_ISCTYPE(digit, _CTYPE_D) XLOCALE_ISCTYPE(graph, _CTYPE_G) XLOCALE_ISCTYPE(hexnumber, _CTYPE_X) XLOCALE_ISCTYPE(ideogram, _CTYPE_I) XLOCALE_ISCTYPE(lower, _CTYPE_L) -XLOCALE_ISCTYPE(number, _CTYPE_D) +XLOCALE_ISCTYPE(number, _CTYPE_D|_CTYPE_N) XLOCALE_ISCTYPE(phonogram, _CTYPE_Q) XLOCALE_ISCTYPE(print, _CTYPE_R) XLOCALE_ISCTYPE(punct, _CTYPE_P) XLOCALE_ISCTYPE(rune, 0xFFFFFF00L) XLOCALE_ISCTYPE(space, _CTYPE_S) XLOCALE_ISCTYPE(special, _CTYPE_T) XLOCALE_ISCTYPE(upper, _CTYPE_U) XLOCALE_ISCTYPE(xdigit, _CTYPE_X) #undef XLOCALE_ISCTYPE #ifdef _XLOCALE_WCTYPES _XLOCALE_INLINE int towlower_l(int, locale_t); _XLOCALE_INLINE int __wcwidth_l(__ct_rune_t, locale_t); _XLOCALE_INLINE int towupper_l(int, locale_t); _XLOCALE_INLINE int towlower_l(int __c, locale_t __l) { int __limit; _RuneLocale *__runes = __runes_for_locale(__l, &__limit); return (__c < 0 || __c >= _CACHED_RUNES) ? ___tolower_l(__c, __l) : __runes->__maplower[__c]; } _XLOCALE_INLINE int towupper_l(int __c, locale_t __l) { int __limit; _RuneLocale *__runes = __runes_for_locale(__l, &__limit); return (__c < 0 || __c >= _CACHED_RUNES) ? ___toupper_l(__c, __l) : __runes->__mapupper[__c]; } _XLOCALE_INLINE int __wcwidth_l(__ct_rune_t _c, locale_t __l) { unsigned int _x; if (_c == 0) return (0); _x = (unsigned int)__maskrune_l(_c, _CTYPE_SWM|_CTYPE_R, __l); if ((_x & _CTYPE_SWM) != 0) return ((_x & _CTYPE_SWM) >> _CTYPE_SWS); return ((_x & _CTYPE_R) != 0 ? 1 : -1); } int iswctype_l(wint_t __wc, wctype_t __charclass, locale_t __l); wctype_t wctype_l(const char *property, locale_t __l); wint_t towctrans_l(wint_t __wc, wctrans_t desc, locale_t __l); wint_t nextwctype_l(wint_t __wc, wctype_t wct, locale_t __l); wctrans_t wctrans_l(const char *__charclass, locale_t __l); #undef _XLOCALE_WCTYPES #else _XLOCALE_INLINE int digittoint_l(int, locale_t); _XLOCALE_INLINE int tolower_l(int, locale_t); _XLOCALE_INLINE int toupper_l(int, locale_t); _XLOCALE_INLINE int digittoint_l(int __c, locale_t __l) { return __sbmaskrune_l((__c), 0xFF, __l); } _XLOCALE_INLINE int tolower_l(int __c, locale_t __l) { int __limit; _RuneLocale *__runes = __runes_for_locale(__l, &__limit); return (__c < 0 || __c >= __limit) ? __c : __runes->__maplower[__c]; } _XLOCALE_INLINE int toupper_l(int __c, locale_t __l) { int __limit; _RuneLocale *__runes = __runes_for_locale(__l, &__limit); return (__c < 0 || __c >= __limit) ? __c : __runes->__mapupper[__c]; } #endif #endif /* (defined(_XLOCALE_WCTYPES) && !defined(_XLOCALE_WCTYPE_H)) || \ (!defined(_XLOCALE_WCTYPES) && !defined(_XLOCALE_CTYPE_H)) */ Index: projects/collation/lib/libc/locale/isctype.c =================================================================== --- projects/collation/lib/libc/locale/isctype.c (revision 289262) +++ projects/collation/lib/libc/locale/isctype.c (revision 289263) @@ -1,206 +1,206 @@ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * This code is derived from software contributed to Berkeley by * Paul Borman at Krystal Technologies. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)isctype.c 8.3 (Berkeley) 2/24/94"; #endif /* LIBC_SCCS and not lint */ #include __FBSDID("$FreeBSD$"); #include #undef digittoint int digittoint(int c) { return (__sbmaskrune(c, 0xFF)); } #undef isalnum int isalnum(int c) { - return (__sbistype(c, _CTYPE_A|_CTYPE_D)); + return (__sbistype(c, _CTYPE_A|_CTYPE_N)); } #undef isalpha int isalpha(int c) { return (__sbistype(c, _CTYPE_A)); } #undef isascii int isascii(int c) { return ((c & ~0x7F) == 0); } #undef isblank int isblank(int c) { return (__sbistype(c, _CTYPE_B)); } #undef iscntrl int iscntrl(int c) { return (__sbistype(c, _CTYPE_C)); } #undef isdigit int isdigit(int c) { return (__isctype(c, _CTYPE_D)); } #undef isgraph int isgraph(int c) { return (__sbistype(c, _CTYPE_G)); } #undef ishexnumber int ishexnumber(int c) { return (__sbistype(c, _CTYPE_X)); } #undef isideogram int isideogram(int c) { return (__sbistype(c, _CTYPE_I)); } #undef islower int islower(int c) { return (__sbistype(c, _CTYPE_L)); } #undef isnumber int isnumber(int c) { - return (__sbistype(c, _CTYPE_D)); + return (__sbistype(c, _CTYPE_N)); } #undef isphonogram int isphonogram(int c) { return (__sbistype(c, _CTYPE_Q)); } #undef isprint int isprint(int c) { return (__sbistype(c, _CTYPE_R)); } #undef ispunct int ispunct(int c) { return (__sbistype(c, _CTYPE_P)); } #undef isrune int isrune(int c) { return (__sbistype(c, 0xFFFFFF00L)); } #undef isspace int isspace(int c) { return (__sbistype(c, _CTYPE_S)); } #undef isspecial int isspecial(int c) { return (__sbistype(c, _CTYPE_T)); } #undef isupper int isupper(int c) { return (__sbistype(c, _CTYPE_U)); } #undef isxdigit int isxdigit(int c) { return (__isctype(c, _CTYPE_X)); } #undef toascii int toascii(int c) { return (c & 0x7F); } #undef tolower int tolower(int c) { return (__sbtolower(c)); } #undef toupper int toupper(int c) { return (__sbtoupper(c)); } Index: projects/collation/lib/libc/locale/iswctype.c =================================================================== --- projects/collation/lib/libc/locale/iswctype.c (revision 289262) +++ projects/collation/lib/libc/locale/iswctype.c (revision 289263) @@ -1,189 +1,189 @@ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * This code is derived from software contributed to Berkeley by * Paul Borman at Krystal Technologies. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #include #undef iswalnum int iswalnum(wint_t wc) { - return (__istype(wc, _CTYPE_A|_CTYPE_D)); + return (__istype(wc, _CTYPE_A|_CTYPE_N)); } #undef iswalpha int iswalpha(wint_t wc) { return (__istype(wc, _CTYPE_A)); } #undef iswascii int iswascii(wint_t wc) { return ((wc & ~0x7F) == 0); } #undef iswblank int iswblank(wint_t wc) { return (__istype(wc, _CTYPE_B)); } #undef iswcntrl int iswcntrl(wint_t wc) { return (__istype(wc, _CTYPE_C)); } #undef iswdigit int iswdigit(wint_t wc) { - return (__isctype(wc, _CTYPE_D)); + return (__istype(wc, _CTYPE_D)); } #undef iswgraph int iswgraph(wint_t wc) { return (__istype(wc, _CTYPE_G)); } #undef iswhexnumber int iswhexnumber(wint_t wc) { return (__istype(wc, _CTYPE_X)); } #undef iswideogram int iswideogram(wint_t wc) { return (__istype(wc, _CTYPE_I)); } #undef iswlower int iswlower(wint_t wc) { return (__istype(wc, _CTYPE_L)); } #undef iswnumber int iswnumber(wint_t wc) { - return (__istype(wc, _CTYPE_D)); + return (__istype(wc, _CTYPE_N)); } #undef iswphonogram int iswphonogram(wint_t wc) { return (__istype(wc, _CTYPE_Q)); } #undef iswprint int iswprint(wint_t wc) { return (__istype(wc, _CTYPE_R)); } #undef iswpunct int iswpunct(wint_t wc) { return (__istype(wc, _CTYPE_P)); } #undef iswrune int iswrune(wint_t wc) { return (__istype(wc, 0xFFFFFF00L)); } #undef iswspace int iswspace(wint_t wc) { return (__istype(wc, _CTYPE_S)); } #undef iswspecial int iswspecial(wint_t wc) { return (__istype(wc, _CTYPE_T)); } #undef iswupper int iswupper(wint_t wc) { return (__istype(wc, _CTYPE_U)); } #undef iswxdigit int iswxdigit(wint_t wc) { - return (__isctype(wc, _CTYPE_X)); + return (__istype(wc, _CTYPE_X)); } #undef towlower wint_t towlower(wint_t wc) { return (__tolower(wc)); } #undef towupper wint_t towupper(wint_t wc) { return (__toupper(wc)); } Index: projects/collation/lib/libc/locale/table.c =================================================================== --- projects/collation/lib/libc/locale/table.c (revision 289262) +++ projects/collation/lib/libc/locale/table.c (revision 289263) @@ -1,263 +1,263 @@ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Paul Borman at Krystal Technologies. * * Copyright (c) 2011 The FreeBSD Foundation * All rights reserved. * Portions of this software were developed by David Chisnall * under sponsorship from the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)table.c 8.1 (Berkeley) 6/27/93"; #endif /* LIBC_SCCS and not lint */ #include __FBSDID("$FreeBSD$"); #include #include #include #include "mblocal.h" const _RuneLocale _DefaultRuneLocale = { _RUNE_MAGIC_1, "NONE", NULL, NULL, 0xFFFD, { /*00*/ _CTYPE_C, _CTYPE_C, _CTYPE_C, _CTYPE_C, _CTYPE_C, _CTYPE_C, _CTYPE_C, _CTYPE_C, /*08*/ _CTYPE_C, _CTYPE_C|_CTYPE_S|_CTYPE_B, _CTYPE_C|_CTYPE_S, _CTYPE_C|_CTYPE_S, _CTYPE_C|_CTYPE_S, _CTYPE_C|_CTYPE_S, _CTYPE_C, _CTYPE_C, /*10*/ _CTYPE_C, _CTYPE_C, _CTYPE_C, _CTYPE_C, _CTYPE_C, _CTYPE_C, _CTYPE_C, _CTYPE_C, /*18*/ _CTYPE_C, _CTYPE_C, _CTYPE_C, _CTYPE_C, _CTYPE_C, _CTYPE_C, _CTYPE_C, _CT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xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, }, { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, }, }; #undef _CurrentRuneLocale const _RuneLocale *_CurrentRuneLocale = &_DefaultRuneLocale; _RuneLocale * __runes_for_locale(locale_t locale, int *mb_sb_limit) { FIX_LOCALE(locale); struct xlocale_ctype *c = XLOCALE_CTYPE(locale); *mb_sb_limit = c->__mb_sb_limit; return c->runes; } Index: projects/collation/lib/libc/locale/wctype.c =================================================================== --- projects/collation/lib/libc/locale/wctype.c (revision 289262) +++ projects/collation/lib/libc/locale/wctype.c (revision 289263) @@ -1,113 +1,115 @@ /*- * Copyright (c) 2002 Tim J. Robbins. * All rights reserved. * * Copyright (c) 2011 The FreeBSD Foundation * All rights reserved. * Portions of this software were developed by David Chisnall * under sponsorship from the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #undef iswctype int iswctype(wint_t wc, wctype_t charclass) { return (__istype(wc, charclass)); } int iswctype_l(wint_t wc, wctype_t charclass, locale_t locale) { return __istype_l(wc, charclass, locale); } /* * IMPORTANT: The 0 in the call to this function in wctype() must be changed to * __get_locale() if wctype_l() is ever modified to actually use the locale * parameter. */ wctype_t wctype_l(const char *property, locale_t locale) { const char *propnames = "alnum\0" "alpha\0" "blank\0" "cntrl\0" "digit\0" "graph\0" "lower\0" "print\0" "punct\0" "space\0" "upper\0" "xdigit\0" "ideogram\0" /* BSD extension */ "special\0" /* BSD extension */ "phonogram\0" /* BSD extension */ + "number\0" /* BSD extension */ "rune\0"; /* BSD extension */ static const wctype_t propmasks[] = { - _CTYPE_A|_CTYPE_D, + _CTYPE_A|_CTYPE_N, _CTYPE_A, _CTYPE_B, _CTYPE_C, _CTYPE_D, _CTYPE_G, _CTYPE_L, _CTYPE_R, _CTYPE_P, _CTYPE_S, _CTYPE_U, _CTYPE_X, _CTYPE_I, _CTYPE_T, _CTYPE_Q, + _CTYPE_N, 0xFFFFFF00L }; size_t len1, len2; const char *p; const wctype_t *q; len1 = strlen(property); q = propmasks; for (p = propnames; (len2 = strlen(p)) != 0; p += len2 + 1) { if (len1 == len2 && memcmp(property, p, len1) == 0) return (*q); q++; } return (0UL); } wctype_t wctype(const char *property) { return wctype_l(property, 0); } Index: projects/collation/usr.bin/localedef/ctype.c =================================================================== --- projects/collation/usr.bin/localedef/ctype.c (revision 289262) +++ projects/collation/usr.bin/localedef/ctype.c (revision 289263) @@ -1,456 +1,461 @@ /* * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright 2012 Garrett D'Amore All rights reserved. * Copyright 2015 John Marino * * This source code is derived from the illumos localedef command, and * provided under BSD-style license terms by Nexenta Systems, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /* * LC_CTYPE database generation routines for localedef. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include #include #include #include "localedef.h" #include "parser.h" #include "runefile.h" +/* Needed for bootstrapping, _CTYPE_N */ +#ifndef _CTYPE_N +#define _CTYPE_N 0x00400000L +#endif + #define _ISUPPER _CTYPE_U #define _ISLOWER _CTYPE_L #define _ISDIGIT _CTYPE_D #define _ISXDIGIT _CTYPE_X #define _ISSPACE _CTYPE_S #define _ISBLANK _CTYPE_B #define _ISALPHA _CTYPE_A #define _ISPUNCT _CTYPE_P #define _ISGRAPH _CTYPE_G #define _ISPRINT _CTYPE_R #define _ISCNTRL _CTYPE_C #define _E1 _CTYPE_Q #define _E2 _CTYPE_I #define _E3 0 -#define _E4 0 +#define _E4 _CTYPE_N #define _E5 _CTYPE_T static wchar_t last_ctype; static int ctype_compare(const void *n1, const void *n2); typedef struct ctype_node { wchar_t wc; int32_t ctype; int32_t toupper; int32_t tolower; RB_ENTRY(ctype_node) entry; } ctype_node_t; static RB_HEAD(ctypes, ctype_node) ctypes; RB_GENERATE_STATIC(ctypes, ctype_node, entry, ctype_compare); static int ctype_compare(const void *n1, const void *n2) { const ctype_node_t *c1 = n1; const ctype_node_t *c2 = n2; return (c1->wc < c2->wc ? -1 : c1->wc > c2->wc ? 1 : 0); } void init_ctype(void) { RB_INIT(&ctypes); } static void add_ctype_impl(ctype_node_t *ctn) { switch (last_kw) { case T_ISUPPER: ctn->ctype |= (_ISUPPER | _ISALPHA | _ISGRAPH | _ISPRINT); break; case T_ISLOWER: ctn->ctype |= (_ISLOWER | _ISALPHA | _ISGRAPH | _ISPRINT); break; case T_ISALPHA: ctn->ctype |= (_ISALPHA | _ISGRAPH | _ISPRINT); break; case T_ISDIGIT: ctn->ctype |= (_ISDIGIT | _ISGRAPH | _ISPRINT | _ISXDIGIT); break; case T_ISSPACE: ctn->ctype |= _ISSPACE; break; case T_ISCNTRL: ctn->ctype |= _ISCNTRL; break; case T_ISGRAPH: ctn->ctype |= (_ISGRAPH | _ISPRINT); break; case T_ISPRINT: ctn->ctype |= _ISPRINT; break; case T_ISPUNCT: ctn->ctype |= (_ISPUNCT | _ISGRAPH | _ISPRINT); break; case T_ISXDIGIT: ctn->ctype |= (_ISXDIGIT | _ISPRINT); break; case T_ISBLANK: ctn->ctype |= (_ISBLANK | _ISSPACE); break; case T_ISPHONOGRAM: ctn->ctype |= (_E1 | _ISPRINT | _ISGRAPH); break; case T_ISIDEOGRAM: ctn->ctype |= (_E2 | _ISPRINT | _ISGRAPH); break; case T_ISENGLISH: ctn->ctype |= (_E3 | _ISPRINT | _ISGRAPH); break; case T_ISNUMBER: ctn->ctype |= (_E4 | _ISPRINT | _ISGRAPH); break; case T_ISSPECIAL: ctn->ctype |= (_E5 | _ISPRINT | _ISGRAPH); break; case T_ISALNUM: /* * We can't do anything with this. The character * should already be specified as a digit or alpha. */ break; default: errf("not a valid character class"); } } static ctype_node_t * get_ctype(wchar_t wc) { ctype_node_t srch; ctype_node_t *ctn; srch.wc = wc; if ((ctn = RB_FIND(ctypes, &ctypes, &srch)) == NULL) { if ((ctn = calloc(1, sizeof (*ctn))) == NULL) { errf("out of memory"); return (NULL); } ctn->wc = wc; RB_INSERT(ctypes, &ctypes, ctn); } return (ctn); } void add_ctype(int val) { ctype_node_t *ctn; if ((ctn = get_ctype(val)) == NULL) { INTERR; return; } add_ctype_impl(ctn); last_ctype = ctn->wc; } void add_ctype_range(int end) { ctype_node_t *ctn; wchar_t cur; if (end < last_ctype) { errf("malformed character range (%u ... %u))", last_ctype, end); return; } for (cur = last_ctype + 1; cur <= end; cur++) { if ((ctn = get_ctype(cur)) == NULL) { INTERR; return; } add_ctype_impl(ctn); } last_ctype = end; } /* * A word about widths: if the width mask is specified, then libc * unconditionally honors it. Otherwise, it assumes printable * characters have width 1, and non-printable characters have width * -1 (except for NULL which is special with with 0). Hence, we have * no need to inject defaults here -- the "default" unset value of 0 * indicates that libc should use its own logic in wcwidth as described. */ void add_width(int wc, int width) { ctype_node_t *ctn; if ((ctn = get_ctype(wc)) == NULL) { INTERR; return; } ctn->ctype &= ~(_CTYPE_SWM); switch (width) { case 0: ctn->ctype |= _CTYPE_SW0; break; case 1: ctn->ctype |= _CTYPE_SW1; break; case 2: ctn->ctype |= _CTYPE_SW2; break; case 3: ctn->ctype |= _CTYPE_SW3; break; } } void add_width_range(int start, int end, int width) { for (; start <= end; start++) { add_width(start, width); } } void add_caseconv(int val, int wc) { ctype_node_t *ctn; ctn = get_ctype(val); if (ctn == NULL) { INTERR; return; } switch (last_kw) { case T_TOUPPER: ctn->toupper = wc; break; case T_TOLOWER: ctn->tolower = wc; break; default: INTERR; break; } } void dump_ctype(void) { FILE *f; _FileRuneLocale rl; ctype_node_t *ctn, *last_ct, *last_lo, *last_up; _FileRuneEntry *ct = NULL; _FileRuneEntry *lo = NULL; _FileRuneEntry *up = NULL; wchar_t wc; (void) memset(&rl, 0, sizeof (rl)); last_ct = NULL; last_lo = NULL; last_up = NULL; if ((f = open_category()) == NULL) return; (void) memcpy(rl.magic, _FILE_RUNE_MAGIC_1, 8); (void) strncpy(rl.encoding, get_wide_encoding(), sizeof (rl.encoding)); /* * Initialize the identity map. */ for (wc = 0; (unsigned)wc < _CACHED_RUNES; wc++) { rl.maplower[wc] = wc; rl.mapupper[wc] = wc; } RB_FOREACH(ctn, ctypes, &ctypes) { int conflict = 0; wc = ctn->wc; /* * POSIX requires certain portable characters have * certain types. Add them if they are missing. */ if ((wc >= 1) && (wc <= 127)) { if ((wc >= 'A') && (wc <= 'Z')) ctn->ctype |= _ISUPPER; if ((wc >= 'a') && (wc <= 'z')) ctn->ctype |= _ISLOWER; if ((wc >= '0') && (wc <= '9')) ctn->ctype |= _ISDIGIT; if (strchr(" \f\n\r\t\v", (char)wc) != NULL) ctn->ctype |= _ISSPACE; if (strchr("0123456789ABCDEFabcdef", (char)wc) != NULL) ctn->ctype |= _ISXDIGIT; if (strchr(" \t", (char)wc)) ctn->ctype |= _ISBLANK; /* * Technically these settings are only * required for the C locale. However, it * turns out that because of the historical * version of isprint(), we need them for all * locales as well. Note that these are not * necessarily valid punctation characters in * the current language, but ispunct() needs * to return TRUE for them. */ if (strchr("!\"'#$%&()*+,-./:;<=>?@[\\]^_`{|}~", (char)wc)) ctn->ctype |= _ISPUNCT; } /* * POSIX also requires that certain types imply * others. Add any inferred types here. */ if (ctn->ctype & (_ISUPPER |_ISLOWER)) ctn->ctype |= _ISALPHA; if (ctn->ctype & _ISDIGIT) ctn->ctype |= _ISXDIGIT; if (ctn->ctype & _ISBLANK) ctn->ctype |= _ISSPACE; if (ctn->ctype & (_ISALPHA|_ISDIGIT|_ISXDIGIT)) ctn->ctype |= _ISGRAPH; if (ctn->ctype & _ISGRAPH) ctn->ctype |= _ISPRINT; /* * Finally, POSIX requires that certain combinations * are invalid. We don't flag this as a fatal error, * but we will warn about. */ if ((ctn->ctype & _ISALPHA) && (ctn->ctype & (_ISPUNCT|_ISDIGIT))) conflict++; if ((ctn->ctype & _ISPUNCT) & (ctn->ctype & (_ISDIGIT|_ISALPHA|_ISXDIGIT))) conflict++; if ((ctn->ctype & _ISSPACE) && (ctn->ctype & _ISGRAPH)) conflict++; if ((ctn->ctype & _ISCNTRL) & _ISPRINT) conflict++; if ((wc == ' ') && (ctn->ctype & (_ISPUNCT|_ISGRAPH))) conflict++; if (conflict) { warn("conflicting classes for character 0x%x (%x)", wc, ctn->ctype); } /* * Handle the lower 256 characters using the simple * optimization. Note that if we have not defined the * upper/lower case, then we identity map it. */ if ((unsigned)wc < _CACHED_RUNES) { rl.runetype[wc] = ctn->ctype; if (ctn->tolower) rl.maplower[wc] = ctn->tolower; if (ctn->toupper) rl.mapupper[wc] = ctn->toupper; continue; } if ((last_ct != NULL) && (last_ct->ctype == ctn->ctype)) { ct[rl.runetype_ext_nranges-1].max = wc; last_ct = ctn; } else { rl.runetype_ext_nranges++; ct = realloc(ct, sizeof (*ct) * rl.runetype_ext_nranges); ct[rl.runetype_ext_nranges - 1].min = wc; ct[rl.runetype_ext_nranges - 1].max = wc; ct[rl.runetype_ext_nranges - 1].map = ctn->ctype; last_ct = ctn; } if (ctn->tolower == 0) { last_lo = NULL; } else if ((last_lo != NULL) && (last_lo->tolower + 1 == ctn->tolower)) { lo[rl.maplower_ext_nranges-1].max = wc; last_lo = ctn; } else { rl.maplower_ext_nranges++; lo = realloc(lo, sizeof (*lo) * rl.maplower_ext_nranges); lo[rl.maplower_ext_nranges - 1].min = wc; lo[rl.maplower_ext_nranges - 1].max = wc; lo[rl.maplower_ext_nranges - 1].map = ctn->tolower; last_lo = ctn; } if (ctn->toupper == 0) { last_up = NULL; } else if ((last_up != NULL) && (last_up->toupper + 1 == ctn->toupper)) { up[rl.mapupper_ext_nranges-1].max = wc; last_up = ctn; } else { rl.mapupper_ext_nranges++; up = realloc(up, sizeof (*up) * rl.mapupper_ext_nranges); up[rl.mapupper_ext_nranges - 1].min = wc; up[rl.mapupper_ext_nranges - 1].max = wc; up[rl.mapupper_ext_nranges - 1].map = ctn->toupper; last_up = ctn; } } if ((wr_category(&rl, sizeof (rl), f) < 0) || (wr_category(ct, sizeof (*ct) * rl.runetype_ext_nranges, f) < 0) || (wr_category(lo, sizeof (*lo) * rl.maplower_ext_nranges, f) < 0) || (wr_category(up, sizeof (*up) * rl.mapupper_ext_nranges, f) < 0)) { return; } close_category(f); }