| 1 | /* |
| 2 | * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. |
| 3 | * |
| 4 | * @APPLE_LICENSE_HEADER_START@ |
| 5 | * |
| 6 | * This file contains Original Code and/or Modifications of Original Code |
| 7 | * as defined in and that are subject to the Apple Public Source License |
| 8 | * Version 2.0 (the 'License'). You may not use this file except in |
| 9 | * compliance with the License. Please obtain a copy of the License at |
| 10 | * http://www.opensource.apple.com/apsl/ and read it before using this |
| 11 | * file. |
| 12 | * |
| 13 | * The Original Code and all software distributed under the License are |
| 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER |
| 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
| 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
| 18 | * Please see the License for the specific language governing rights and |
| 19 | * limitations under the License. |
| 20 | * |
| 21 | * @APPLE_LICENSE_HEADER_END@ |
| 22 | */ |
| 23 | |
| 24 | #ifndef _XLOCALE__WCHAR_H_ |
| 25 | #define _XLOCALE__WCHAR_H_ |
| 26 | |
| 27 | #include <_bounds.h> |
| 28 | #include <_stdio.h> |
| 29 | #include <__xlocale.h> |
| 30 | #include <sys/_types/_mbstate_t.h> |
| 31 | #include <sys/_types/_wint_t.h> |
| 32 | #include <stddef.h> /* wchar_t */ |
| 33 | |
| 34 | _LIBC_SINGLE_BY_DEFAULT() |
| 35 | |
| 36 | /* Initially added in Issue 4 */ |
| 37 | __BEGIN_DECLS |
| 38 | wint_t	btowc_l(int, locale_t); |
| 39 | wint_t	fgetwc_l(FILE *, locale_t); |
| 40 | wchar_t	*_LIBC_CSTR	fgetws_l(wchar_t * __restrict _LIBC_COUNT(__n), int __n, |
| 41 | 		FILE * __restrict, locale_t); |
| 42 | wint_t	fputwc_l(wchar_t, FILE *, locale_t); |
| 43 | int	fputws_l(const wchar_t * __restrict, FILE * __restrict, locale_t); |
| 44 | int	fwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...); |
| 45 | int	fwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...); |
| 46 | wint_t	getwc_l(FILE *, locale_t); |
| 47 | wint_t	getwchar_l(locale_t); |
| 48 | size_t	mbrlen_l(const char * __restrict _LIBC_COUNT(__n), size_t __n, |
| 49 | 	 mbstate_t * __restrict, locale_t); |
| 50 | size_t	mbrtowc_l(wchar_t * __restrict _LIBC_UNSAFE_INDEXABLE, |
| 51 | 	 const char * __restrict _LIBC_COUNT(__n), size_t __n, |
| 52 | 		mbstate_t * __restrict, locale_t); |
| 53 | int	mbsinit_l(const mbstate_t *, locale_t); |
| 54 | size_t	mbsrtowcs_l(wchar_t * __restrict _LIBC_COUNT(__len), |
| 55 | 	 const char ** __restrict, size_t __len, mbstate_t * __restrict, |
| 56 | 		locale_t); |
| 57 | wint_t	putwc_l(wchar_t, FILE *, locale_t); |
| 58 | wint_t	putwchar_l(wchar_t, locale_t); |
| 59 | int	swprintf_l(wchar_t * __restrict _LIBC_COUNT(n), size_t n, locale_t, |
| 60 | 		const wchar_t * __restrict, ...); |
| 61 | int	swscanf_l(const wchar_t * __restrict, locale_t, |
| 62 | 		const wchar_t * __restrict, ...); |
| 63 | wint_t	ungetwc_l(wint_t, FILE *, locale_t); |
| 64 | int	vfwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, |
| 65 | 		__darwin_va_list); |
| 66 | int	vswprintf_l(wchar_t * __restrict _LIBC_COUNT(n), size_t n, locale_t, |
| 67 | 		const wchar_t * __restrict, __darwin_va_list); |
| 68 | int	vwprintf_l(locale_t, const wchar_t * __restrict, __darwin_va_list); |
| 69 | size_t	wcrtomb_l( |
| 70 | 		char * __restrict _LIBC_UNSAFE_INDEXABLE /* __counted_by(MB_CUR_MAX), which is not a constant */, |
| 71 | 		wchar_t, mbstate_t * __restrict, locale_t); |
| 72 | int	wcscoll_l(const wchar_t *, const wchar_t *, locale_t); |
| 73 | size_t	wcsftime_l(wchar_t * __restrict _LIBC_COUNT(__n), size_t __n, |
| 74 | 		const wchar_t * __restrict, const struct tm * __restrict, locale_t) |
| 75 | 		__DARWIN_ALIAS(wcsftime_l); |
| 76 | size_t	wcsrtombs_l(char * __restrict _LIBC_COUNT(__len), |
| 77 | 	 const wchar_t ** __restrict, size_t __len, mbstate_t * __restrict, |
| 78 | 		locale_t); |
| 79 | double	wcstod_l(const wchar_t * __restrict, wchar_t *_LIBC_CSTR * __restrict, |
| 80 | 		locale_t); |
| 81 | long	wcstol_l(const wchar_t * __restrict, wchar_t *_LIBC_CSTR * __restrict, |
| 82 | 	 int, locale_t); |
| 83 | unsigned long |
| 84 | 	wcstoul_l(const wchar_t * __restrict, wchar_t *_LIBC_CSTR * __restrict, int, |
| 85 | 	 locale_t); |
| 86 | int	wcswidth_l(const wchar_t *_LIBC_COUNT(__n), size_t __n, locale_t); |
| 87 | size_t	wcsxfrm_l(wchar_t * __restrict _LIBC_COUNT(__n), |
| 88 | 		const wchar_t * __restrict, size_t __n, locale_t); |
| 89 | int	wctob_l(wint_t, locale_t); |
| 90 | int	wcwidth_l(wchar_t, locale_t); |
| 91 | int	wprintf_l(locale_t, const wchar_t * __restrict, ...); |
| 92 | int	wscanf_l(locale_t, const wchar_t * __restrict, ...); |
| 93 | __END_DECLS |
| 94 | |
| 95 | |
| 96 | |
| 97 | /* Additional functionality provided by: |
| 98 | * POSIX.1-2001 |
| 99 | */ |
| 100 | |
| 101 | #if __DARWIN_C_LEVEL >= 200112L |
| 102 | __BEGIN_DECLS |
| 103 | int	vfwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, |
| 104 | 		__darwin_va_list); |
| 105 | int	vswscanf_l(const wchar_t * __restrict, locale_t, |
| 106 | 		const wchar_t * __restrict, __darwin_va_list); |
| 107 | int	vwscanf_l(locale_t, const wchar_t * __restrict, __darwin_va_list); |
| 108 | float	wcstof_l(const wchar_t * __restrict, wchar_t *_LIBC_CSTR * __restrict, |
| 109 | 		locale_t); |
| 110 | long double |
| 111 | 	wcstold_l(const wchar_t * __restrict, wchar_t *_LIBC_CSTR * __restrict, |
| 112 | 		locale_t); |
| 113 | #if !__DARWIN_NO_LONG_LONG |
| 114 | long long |
| 115 | 	wcstoll_l(const wchar_t * __restrict, wchar_t *_LIBC_CSTR * __restrict, int, |
| 116 | 	 locale_t); |
| 117 | unsigned long long |
| 118 | 	wcstoull_l(const wchar_t * __restrict, wchar_t *_LIBC_CSTR * __restrict, |
| 119 | 	 int, locale_t); |
| 120 | #endif /* !__DARWIN_NO_LONG_LONG */ |
| 121 | __END_DECLS |
| 122 | #endif /* __DARWIN_C_LEVEL >= 200112L */ |
| 123 | |
| 124 | |
| 125 | |
| 126 | /* Additional functionality provided by: |
| 127 | * POSIX.1-2008 |
| 128 | */ |
| 129 | |
| 130 | #if __DARWIN_C_LEVEL >= 200809L |
| 131 | __BEGIN_DECLS |
| 132 | size_t	mbsnrtowcs_l(wchar_t * __restrict _LIBC_COUNT(__len), |
| 133 | 		const char ** __restrict, size_t, size_t __len, mbstate_t * __restrict, |
| 134 | 		locale_t); |
| 135 | int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); |
| 136 | int wcsncasecmp_l(const wchar_t *_LIBC_UNSAFE_INDEXABLE, |
| 137 | 		const wchar_t *_LIBC_UNSAFE_INDEXABLE, size_t n, locale_t) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); |
| 138 | size_t	wcsnrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t, |
| 139 | 	 size_t, mbstate_t * __restrict, locale_t); |
| 140 | __END_DECLS |
| 141 | #endif /* __DARWIN_C_LEVEL >= 200809L */ |
| 142 | |
| 143 | |
| 144 | |
| 145 | /* Darwin extensions */ |
| 146 | |
| 147 | #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL |
| 148 | __BEGIN_DECLS |
| 149 | wchar_t	*fgetwln_l(FILE * __restrict, size_t *, locale_t) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); |
| 150 | __END_DECLS |
| 151 | #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ |
| 152 | |
| 153 | |
| 154 | |
| 155 | /* Poison the following routines if -fshort-wchar is set */ |
| 156 | #if !defined(__cplusplus) && defined(__WCHAR_MAX__) && __WCHAR_MAX__ <= 0xffffU |
| 157 | #pragma GCC poison fgetwln_l fgetws_l fputwc_l fputws_l fwprintf_l fwscanf_l mbrtowc_l mbsnrtowcs_l mbsrtowcs_l putwc_l putwchar_l swprintf_l swscanf_l vfwprintf_l vfwscanf_l vswprintf_l vswscanf_l vwprintf_l vwscanf_l wcrtomb_l wcscoll_l wcsftime_l wcsftime_l wcsnrtombs_l wcsrtombs_l wcstod_l wcstof_l wcstol_l wcstold_l wcstoll_l wcstoul_l wcstoull_l wcswidth_l wcsxfrm_l wcwidth_l wprintf_l wscanf_l |
| 158 | #endif |
| 159 | |
| 160 | #endif /* _XLOCALE__WCHAR_H_ */ |