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
 38wint_t	btowc_l(int, locale_t);
 39wint_t	fgetwc_l(FILE *, locale_t);
 40wchar_t	*_LIBC_CSTR	fgetws_l(wchar_t * __restrict _LIBC_COUNT(__n), int __n,
 41		FILE * __restrict, locale_t);
 42wint_t	fputwc_l(wchar_t, FILE *, locale_t);
 43int	fputws_l(const wchar_t * __restrict, FILE * __restrict, locale_t);
 44int	fwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...);
 45int	fwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...);
 46wint_t	getwc_l(FILE *, locale_t);
 47wint_t	getwchar_l(locale_t);
 48size_t	mbrlen_l(const char * __restrict _LIBC_COUNT(__n), size_t __n,
 49	    mbstate_t * __restrict, locale_t);
 50size_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);
 53int	mbsinit_l(const mbstate_t *, locale_t);
 54size_t	mbsrtowcs_l(wchar_t * __restrict _LIBC_COUNT(__len),
 55	    const char ** __restrict, size_t __len, mbstate_t * __restrict,
 56		locale_t);
 57wint_t	putwc_l(wchar_t, FILE *, locale_t);
 58wint_t	putwchar_l(wchar_t, locale_t);
 59int	swprintf_l(wchar_t * __restrict _LIBC_COUNT(n), size_t n, locale_t,
 60		const wchar_t * __restrict, ...);
 61int	swscanf_l(const wchar_t * __restrict, locale_t,
 62		const wchar_t * __restrict, ...);
 63wint_t	ungetwc_l(wint_t, FILE *, locale_t);
 64int	vfwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict,
 65		__darwin_va_list);
 66int	vswprintf_l(wchar_t * __restrict _LIBC_COUNT(n), size_t n, locale_t,
 67		const wchar_t * __restrict, __darwin_va_list);
 68int	vwprintf_l(locale_t, const wchar_t * __restrict, __darwin_va_list);
 69size_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);
 72int	wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
 73size_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);
 76size_t	wcsrtombs_l(char * __restrict _LIBC_COUNT(__len),
 77	    const wchar_t ** __restrict, size_t __len, mbstate_t * __restrict,
 78		locale_t);
 79double	wcstod_l(const wchar_t * __restrict, wchar_t *_LIBC_CSTR * __restrict,
 80		locale_t);
 81long	wcstol_l(const wchar_t * __restrict, wchar_t *_LIBC_CSTR * __restrict,
 82	    int, locale_t);
 83unsigned long
 84	wcstoul_l(const wchar_t * __restrict, wchar_t *_LIBC_CSTR * __restrict, int,
 85	    locale_t);
 86int	wcswidth_l(const wchar_t *_LIBC_COUNT(__n), size_t __n, locale_t);
 87size_t	wcsxfrm_l(wchar_t * __restrict _LIBC_COUNT(__n),
 88		const wchar_t * __restrict, size_t __n, locale_t);
 89int	wctob_l(wint_t, locale_t);
 90int	wcwidth_l(wchar_t, locale_t);
 91int	wprintf_l(locale_t, const wchar_t * __restrict, ...);
 92int	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
103int	vfwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict,
104		__darwin_va_list);
105int	vswscanf_l(const wchar_t * __restrict, locale_t,
106		const wchar_t * __restrict, __darwin_va_list);
107int	vwscanf_l(locale_t, const wchar_t * __restrict, __darwin_va_list);
108float	wcstof_l(const wchar_t * __restrict, wchar_t *_LIBC_CSTR * __restrict,
109		locale_t);
110long double
111	wcstold_l(const wchar_t * __restrict, wchar_t *_LIBC_CSTR * __restrict,
112		locale_t);
113#if !__DARWIN_NO_LONG_LONG
114long long
115	wcstoll_l(const wchar_t * __restrict, wchar_t *_LIBC_CSTR * __restrict, int,
116	    locale_t);
117unsigned 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
132size_t	mbsnrtowcs_l(wchar_t * __restrict _LIBC_COUNT(__len),
133		const char ** __restrict, size_t, size_t __len, mbstate_t * __restrict,
134		locale_t);
135int     wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
136int     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);
138size_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
149wchar_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_ */