diff --git a/include/xlocale/_ctype.h b/include/xlocale/_ctype.h index bf4da73f58bd..7d25eec25f0a 100644 --- a/include/xlocale/_ctype.h +++ b/include/xlocale/_ctype.h @@ -1,205 +1,204 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * 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|_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|_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)) */ diff --git a/include/xlocale/_inttypes.h b/include/xlocale/_inttypes.h index 2617f5ef17d7..35729139c71e 100644 --- a/include/xlocale/_inttypes.h +++ b/include/xlocale/_inttypes.h @@ -1,46 +1,45 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2011, 2012 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$ */ /* * Extended locale versions of the locale-aware functions from inttypes.h. * Include before to expose these. */ intmax_t strtoimax_l(const char * __restrict, char ** __restrict, int, locale_t); uintmax_t strtoumax_l(const char * __restrict, char ** __restrict, int, locale_t); intmax_t wcstoimax_l(const wchar_t * __restrict, wchar_t ** __restrict, int , locale_t); uintmax_t wcstoumax_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t); diff --git a/include/xlocale/_langinfo.h b/include/xlocale/_langinfo.h index 0d44394dff23..6886ca335f22 100644 --- a/include/xlocale/_langinfo.h +++ b/include/xlocale/_langinfo.h @@ -1,44 +1,43 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2011, 2012 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$ */ #ifndef _XLOCALE_LANGINFO_H #define _XLOCALE_LANGINFO_H #ifndef _LOCALE_T_DEFINED #define _LOCALE_T_DEFINED typedef struct _xlocale *locale_t; #endif char *nl_langinfo_l(nl_item, locale_t); #endif /* _XLOCALE_LANGINFO_H */ diff --git a/include/xlocale/_locale.h b/include/xlocale/_locale.h index c9543e576ac9..d186b04ecd6d 100644 --- a/include/xlocale/_locale.h +++ b/include/xlocale/_locale.h @@ -1,60 +1,59 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2011, 2012 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$ */ #ifndef _XLOCALE_LOCALE_H #define _XLOCALE_LOCALE_H /* Bit shifting order of LC_*_MASK should match XLC_* and LC_* order. */ #define LC_COLLATE_MASK (1<<0) #define LC_CTYPE_MASK (1<<1) #define LC_MONETARY_MASK (1<<2) #define LC_NUMERIC_MASK (1<<3) #define LC_TIME_MASK (1<<4) #define LC_MESSAGES_MASK (1<<5) #define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | \ LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK) #define LC_VERSION_MASK (1<<6) #define LC_GLOBAL_LOCALE ((locale_t)-1) #ifndef _LOCALE_T_DEFINED #define _LOCALE_T_DEFINED typedef struct _xlocale *locale_t; #endif locale_t duplocale(locale_t base); void freelocale(locale_t loc); locale_t newlocale(int mask, const char *locale, locale_t base); const char *querylocale(int mask, locale_t loc); locale_t uselocale(locale_t loc); #endif /* _XLOCALE_LOCALE_H */ diff --git a/include/xlocale/_monetary.h b/include/xlocale/_monetary.h index 3cfc86b1f1a7..13b1c3cc2a3d 100644 --- a/include/xlocale/_monetary.h +++ b/include/xlocale/_monetary.h @@ -1,47 +1,46 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2011, 2012 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$ */ #ifndef _LOCALE_T_DEFINED #define _LOCALE_T_DEFINED typedef struct _xlocale *locale_t; #endif #if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_) #ifndef _XLOCALE_MONETARY_H #define _XLOCALE_MONETARY_H ssize_t strfmon_l(char *, size_t, locale_t, const char *, ...) __strfmonlike(4, 5); #endif /* _XLOCALE_MONETARY_H */ #endif /* __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_) */ diff --git a/include/xlocale/_stdio.h b/include/xlocale/_stdio.h index 2d4f6f5e2423..d0df7931cfd0 100644 --- a/include/xlocale/_stdio.h +++ b/include/xlocale/_stdio.h @@ -1,66 +1,65 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2011, 2012 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$ */ int asprintf_l(char **, locale_t, const char *, ...) __printflike(3, 4); int dprintf_l(int, locale_t, const char * __restrict, ...) __printflike(3, 4); int fprintf_l(FILE * __restrict, locale_t, const char * __restrict, ...) __printflike(3, 4); int fscanf_l(FILE * __restrict, locale_t, const char * __restrict, ...) __scanflike(3, 4); int printf_l(locale_t, const char * __restrict, ...) __printflike(2, 3); int scanf_l(locale_t, const char * __restrict, ...) __scanflike(2, 3); int snprintf_l(char * __restrict, size_t, locale_t, const char * __restrict, ...) __printflike(4, 5); int sprintf_l(char * __restrict, locale_t, const char * __restrict, ...) __printflike(3, 4); int sscanf_l(const char * __restrict, locale_t, const char * __restrict, ...) __scanflike(3, 4); int vfprintf_l(FILE * __restrict, locale_t, const char * __restrict, __va_list) __printflike(3, 0); int vprintf_l(locale_t, const char * __restrict, __va_list) __printflike(2, 0); int vsprintf_l(char * __restrict, locale_t, const char * __restrict, __va_list) __printflike(3, 0); int vfscanf_l(FILE * __restrict, locale_t, const char * __restrict, __va_list) __scanflike(3, 0); int vscanf_l(locale_t, const char * __restrict, __va_list) __scanflike(2, 0); int vsnprintf_l(char * __restrict, size_t, locale_t, const char * __restrict, __va_list) __printflike(4, 0); int vsscanf_l(const char * __restrict, locale_t, const char * __restrict, __va_list) __scanflike(3, 0); int vdprintf_l(int, locale_t, const char * __restrict, __va_list) __printflike(3, 0); int vasprintf_l(char **, locale_t, const char *, __va_list) __printflike(3, 0); diff --git a/include/xlocale/_stdlib.h b/include/xlocale/_stdlib.h index c4e5a0ca662c..380cbe0bdb1b 100644 --- a/include/xlocale/_stdlib.h +++ b/include/xlocale/_stdlib.h @@ -1,61 +1,60 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2011, 2012 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$ */ /* * Extended locale versions of the locale-aware functions from stdlib.h. * * Include before to expose these. */ double atof_l(const char *, locale_t); int atoi_l(const char *, locale_t); long atol_l(const char *, locale_t); long long atoll_l(const char *, locale_t); int mblen_l(const char *, size_t, locale_t); size_t mbstowcs_l(wchar_t * __restrict, const char * __restrict, size_t, locale_t); int mbtowc_l(wchar_t * __restrict, const char * __restrict, size_t, locale_t); double strtod_l(const char *, char **, locale_t); float strtof_l(const char *, char **, locale_t); long strtol_l(const char *, char **, int, locale_t); long double strtold_l(const char *, char **, locale_t); long long strtoll_l(const char *, char **, int, locale_t); unsigned long strtoul_l(const char *, char **, int, locale_t); unsigned long long strtoull_l(const char *, char **, int, locale_t); size_t wcstombs_l(char * __restrict, const wchar_t * __restrict, size_t, locale_t); int wctomb_l(char *, wchar_t, locale_t); int ___mb_cur_max_l(locale_t); #define MB_CUR_MAX_L(x) ((size_t)___mb_cur_max_l(x)) diff --git a/include/xlocale/_string.h b/include/xlocale/_string.h index 6df9132de171..64b128df161d 100644 --- a/include/xlocale/_string.h +++ b/include/xlocale/_string.h @@ -1,62 +1,61 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2011, 2012 The FreeBSD Foundation - * 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. * * $FreeBSD$ */ #ifndef _LOCALE_T_DEFINED #define _LOCALE_T_DEFINED typedef struct _xlocale *locale_t; #endif /* * This file is included from both string.h and xlocale.h. We need to expose * the declarations unconditionally if we are included from xlocale.h, but only * if we are in POSIX2008 mode if included from string.h. */ #ifndef _XLOCALE_STRING1_H #define _XLOCALE_STRING1_H /* * POSIX2008 functions */ int strcoll_l(const char *, const char *, locale_t); char *strerror_l(int num, locale_t); size_t strxfrm_l(char *, const char *, size_t, locale_t); #endif /* _XLOCALE_STRING1_H */ /* * xlocale extensions */ #ifdef _XLOCALE_H_ #ifndef _XLOCALE_STRING2_H #define _XLOCALE_STRING2_H char *strcasestr_l(const char *, const char *, locale_t); #endif /* _XLOCALE_STRING2_H */ #endif /* _XLOCALE_H_ */ diff --git a/include/xlocale/_strings.h b/include/xlocale/_strings.h index da1cff3e7077..1ec05ac79f2d 100644 --- a/include/xlocale/_strings.h +++ b/include/xlocale/_strings.h @@ -1,48 +1,47 @@ /*- * Copyright (c) 2011, 2012 The FreeBSD Foundation - * 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. * * $FreeBSD$ */ #ifndef _LOCALE_T_DEFINED #define _LOCALE_T_DEFINED typedef struct _xlocale *locale_t; #endif /* * This file is included from both strings.h and xlocale.h. We need to expose * the declarations unconditionally if we are included from xlocale.h, but only * if we are in POSIX2008 mode if included from string.h. */ #ifndef _XLOCALE_STRINGS1_H #define _XLOCALE_STRINGS1_H /* * POSIX2008 functions */ int strcasecmp_l(const char *, const char *, locale_t); int strncasecmp_l(const char *, const char *, size_t, locale_t); #endif /* _XLOCALE_STRINGS1_H */ diff --git a/include/xlocale/_time.h b/include/xlocale/_time.h index 4b47b1aea1ff..fe0057b0b15f 100644 --- a/include/xlocale/_time.h +++ b/include/xlocale/_time.h @@ -1,60 +1,59 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2011, 2012 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$ */ #ifndef _LOCALE_T_DEFINED #define _LOCALE_T_DEFINED typedef struct _xlocale *locale_t; #endif /* * This file is included from both locale.h and xlocale.h. We need to expose * the declarations unconditionally if we are included from xlocale.h, but only * if we are in POSIX2008 mode if included from locale.h. */ #ifndef _XLOCALE_LOCALE1_H #define _XLOCALE_LOCALE1_H size_t strftime_l(char * __restrict, size_t, const char * __restrict, const struct tm * __restrict, locale_t) __strftimelike(3, 0); #endif /* _XLOCALE_LOCALE1_H */ #ifdef _XLOCALE_H_ #ifndef _XLOCALE_LOCALE2_H #define _XLOCALE_LOCALE2_H char *strptime_l(const char * __restrict, const char * __restrict, struct tm * __restrict, locale_t); #endif /* _XLOCALE_LOCALE2_H */ #endif /* _XLOCALE_H_ */ diff --git a/include/xlocale/_wchar.h b/include/xlocale/_wchar.h index 3a7261354f84..7ce562eb7c21 100644 --- a/include/xlocale/_wchar.h +++ b/include/xlocale/_wchar.h @@ -1,135 +1,134 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2011, 2012 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$ */ #ifndef _LOCALE_T_DEFINED #define _LOCALE_T_DEFINED typedef struct _xlocale *locale_t; #endif #ifndef _XLOCALE_WCHAR1_H #define _XLOCALE_WCHAR1_H int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t); int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t); int wcscoll_l(const wchar_t *, const wchar_t *, locale_t); size_t wcsxfrm_l(wchar_t * __restrict, const wchar_t * __restrict, size_t, locale_t); #endif /* _XLOCALE_WCHAR1_H */ /* * Only declare the non-POSIX functions if we're included from xlocale.h. */ #ifdef _XLOCALE_H_ #ifndef _XLOCALE_WCHAR2_H #define _XLOCALE_WCHAR2_H wint_t btowc_l(int, locale_t); wint_t fgetwc_l(FILE *, locale_t); wchar_t *fgetws_l(wchar_t * __restrict, int, FILE * __restrict, locale_t); wint_t fputwc_l(wchar_t, FILE *, locale_t); int fputws_l(const wchar_t * __restrict, FILE * __restrict, locale_t); int fwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...); int fwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...); wint_t getwc_l(FILE *, locale_t); wint_t getwchar_l(locale_t); size_t mbrlen_l(const char * __restrict, size_t, mbstate_t * __restrict, locale_t); size_t mbrtowc_l(wchar_t * __restrict, const char * __restrict, size_t, mbstate_t * __restrict, locale_t); int mbsinit_l(const mbstate_t *, locale_t); size_t mbsrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t, mbstate_t * __restrict, locale_t); wint_t putwc_l(wchar_t, FILE *, locale_t); wint_t putwchar_l(wchar_t, locale_t); int swprintf_l(wchar_t * __restrict, size_t n, locale_t, const wchar_t * __restrict, ...); int swscanf_l(const wchar_t * __restrict, locale_t, const wchar_t * __restrict, ...); wint_t ungetwc_l(wint_t, FILE *, locale_t); int vfwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, __va_list); int vswprintf_l(wchar_t * __restrict, size_t n, locale_t, const wchar_t * __restrict, __va_list); int vwprintf_l(locale_t, const wchar_t * __restrict, __va_list); size_t wcrtomb_l(char * __restrict, wchar_t, mbstate_t * __restrict, locale_t); size_t wcsftime_l(wchar_t * __restrict, size_t, const wchar_t * __restrict, const struct tm * __restrict, locale_t); size_t wcsrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t, mbstate_t * __restrict, locale_t); double wcstod_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t); long wcstol_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t); unsigned long wcstoul_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t); int wcswidth_l(const wchar_t *, size_t, locale_t); int wctob_l(wint_t, locale_t); int wcwidth_l(wchar_t, locale_t); int wprintf_l(locale_t, const wchar_t * __restrict, ...); int wscanf_l(locale_t, const wchar_t * __restrict, ...); int vfwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, __va_list); int vswscanf_l(const wchar_t * __restrict, locale_t, const wchar_t *__restrict, __va_list); int vwscanf_l(locale_t, const wchar_t * __restrict, __va_list); float wcstof_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t); long double wcstold_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t); long long wcstoll_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t); unsigned long long wcstoull_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t); size_t mbsnrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t, size_t, mbstate_t * __restrict, locale_t); size_t wcsnrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t, size_t, mbstate_t * __restrict, locale_t); #endif /* _XLOCALE_WCHAR_H */ #endif /* _XLOCALE_H_ */