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 <_stdio.h>
28 #include <_xlocale.h>
29 #include <sys/_types/_mbstate_t.h>
30 
31 /* Initially added in Issue 4 */
32 __BEGIN_DECLS
33 wint_t	btowc_l(int, locale_t);
34 wint_t	fgetwc_l(FILE *, locale_t);
35 wchar_t	*fgetws_l(wchar_t * __restrict, int, FILE * __restrict, locale_t);
36 wint_t	fputwc_l(wchar_t, FILE *, locale_t);
37 int	fputws_l(const wchar_t * __restrict, FILE * __restrict, locale_t);
38 int	fwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...);
39 int	fwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...);
40 wint_t	getwc_l(FILE *, locale_t);
41 wint_t	getwchar_l(locale_t);
42 size_t	mbrlen_l(const char * __restrict, size_t, mbstate_t * __restrict,
43 	    locale_t);
44 size_t	mbrtowc_l(wchar_t * __restrict, const char * __restrict, size_t,
45 	    mbstate_t * __restrict, locale_t);
46 int	mbsinit_l(const mbstate_t *, locale_t);
47 size_t	mbsrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t,
48 	    mbstate_t * __restrict, locale_t);
49 wint_t	putwc_l(wchar_t, FILE *, locale_t);
50 wint_t	putwchar_l(wchar_t, locale_t);
51 int	swprintf_l(wchar_t * __restrict, size_t n, locale_t,
52 		const wchar_t * __restrict, ...);
53 int	swscanf_l(const wchar_t * __restrict, locale_t,
54 		const wchar_t * __restrict, ...);
55 wint_t	ungetwc_l(wint_t, FILE *, locale_t);
56 int	vfwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict,
57 		__darwin_va_list);
58 int	vswprintf_l(wchar_t * __restrict, size_t n, locale_t,
59 		const wchar_t * __restrict, __darwin_va_list);
60 int	vwprintf_l(locale_t, const wchar_t * __restrict, __darwin_va_list);
61 size_t	wcrtomb_l(char * __restrict, wchar_t, mbstate_t * __restrict,
62 	    locale_t);
63 int	wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
64 size_t	wcsftime_l(wchar_t * __restrict, size_t, const wchar_t * __restrict,
65 		const struct tm * __restrict, locale_t)
66 		__DARWIN_ALIAS(wcsftime_l);
67 size_t	wcsrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t,
68 	    mbstate_t * __restrict, locale_t);
69 double	wcstod_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t);
70 long	wcstol_l(const wchar_t * __restrict, wchar_t ** __restrict, int,
71 	    locale_t);
72 unsigned long
73 	wcstoul_l(const wchar_t * __restrict, wchar_t ** __restrict, int,
74 	    locale_t);
75 int	wcswidth_l(const wchar_t *, size_t, locale_t);
76 size_t	wcsxfrm_l(wchar_t * __restrict, const wchar_t * __restrict, size_t,
77 	    locale_t);
78 int	wctob_l(wint_t, locale_t);
79 int	wcwidth_l(wchar_t, locale_t);
80 int	wprintf_l(locale_t, const wchar_t * __restrict, ...);
81 int	wscanf_l(locale_t, const wchar_t * __restrict, ...);
82 __END_DECLS
83 
84 
85 
86 /* Additional functionality provided by:
87  * POSIX.1-2001
88  */
89 
90 #if __DARWIN_C_LEVEL >= 200112L
91 __BEGIN_DECLS
92 int	vfwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict,
93 		__darwin_va_list);
94 int	vswscanf_l(const wchar_t * __restrict, locale_t,
95 		const wchar_t * __restrict, __darwin_va_list);
96 int	vwscanf_l(locale_t, const wchar_t * __restrict, __darwin_va_list);
97 float	wcstof_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t);
98 long double
99 	wcstold_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t);
100 #if !__DARWIN_NO_LONG_LONG
101 long long
102 	wcstoll_l(const wchar_t * __restrict, wchar_t ** __restrict, int,
103 	    locale_t);
104 unsigned long long
105 	wcstoull_l(const wchar_t * __restrict, wchar_t ** __restrict, int,
106 	    locale_t);
107 #endif /* !__DARWIN_NO_LONG_LONG */
108 __END_DECLS
109 #endif /* __DARWIN_C_LEVEL >= 200112L */
110 
111 
112 
113 /* Additional functionality provided by:
114  * POSIX.1-2008
115  */
116 
117 #if __DARWIN_C_LEVEL >= 200809L
118 __BEGIN_DECLS
119 size_t	mbsnrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t,
120 	    size_t, mbstate_t * __restrict, locale_t);
121 int     wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
122 int     wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t n, locale_t) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
123 size_t	wcsnrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t,
124 	    size_t, mbstate_t * __restrict, locale_t);
125 __END_DECLS
126 #endif /* __DARWIN_C_LEVEL >= 200809L */
127 
128 
129 
130 /* Darwin extensions */
131 
132 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
133 __BEGIN_DECLS
134 wchar_t	*fgetwln_l(FILE * __restrict, size_t *, locale_t) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
135 __END_DECLS
136 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
137 
138 
139 
140 /* Poison the following routines if -fshort-wchar is set */
141 #if !defined(__cplusplus) && defined(__WCHAR_MAX__) && __WCHAR_MAX__ <= 0xffffU
142 #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
143 #endif
144 
145 #endif /* _XLOCALE__WCHAR_H_ */