wchar.h revision 233600
176633Stshiozak/*-
276633Stshiozak * Copyright (c)1999 Citrus Project,
376633Stshiozak * All rights reserved.
476633Stshiozak *
576633Stshiozak * Redistribution and use in source and binary forms, with or without
676633Stshiozak * modification, are permitted provided that the following conditions
776633Stshiozak * are met:
876633Stshiozak * 1. Redistributions of source code must retain the above copyright
976633Stshiozak *    notice, this list of conditions and the following disclaimer.
1076633Stshiozak * 2. Redistributions in binary form must reproduce the above copyright
1176633Stshiozak *    notice, this list of conditions and the following disclaimer in the
1276633Stshiozak *    documentation and/or other materials provided with the distribution.
1376633Stshiozak *
1476633Stshiozak * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1576633Stshiozak * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1676633Stshiozak * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1776633Stshiozak * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1876633Stshiozak * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1976633Stshiozak * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2076633Stshiozak * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2176633Stshiozak * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2276633Stshiozak * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2376633Stshiozak * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2476633Stshiozak * SUCH DAMAGE.
2576633Stshiozak *
2676633Stshiozak * $FreeBSD: head/include/wchar.h 233600 2012-03-28 12:11:54Z theraven $
2776633Stshiozak */
2876633Stshiozak
2976633Stshiozak/*-
3076633Stshiozak * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
3176633Stshiozak * All rights reserved.
3276633Stshiozak *
3376633Stshiozak * This code is derived from software contributed to The NetBSD Foundation
3476633Stshiozak * by Julian Coleman.
3576633Stshiozak *
3676633Stshiozak * Redistribution and use in source and binary forms, with or without
3776633Stshiozak * modification, are permitted provided that the following conditions
3876633Stshiozak * are met:
3976633Stshiozak * 1. Redistributions of source code must retain the above copyright
4076633Stshiozak *    notice, this list of conditions and the following disclaimer.
4176633Stshiozak * 2. Redistributions in binary form must reproduce the above copyright
4276633Stshiozak *    notice, this list of conditions and the following disclaimer in the
4376633Stshiozak *    documentation and/or other materials provided with the distribution.
4476633Stshiozak *
4576633Stshiozak * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
4676633Stshiozak * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
4776633Stshiozak * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
4876633Stshiozak * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
4976633Stshiozak * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
5076633Stshiozak * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
5176633Stshiozak * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
5276633Stshiozak * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
5376633Stshiozak * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
5476633Stshiozak * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
5576633Stshiozak * POSSIBILITY OF SUCH DAMAGE.
5679555Sobrien *
5779555Sobrien *	$NetBSD: wchar.h,v 1.8 2000/12/22 05:31:42 itojun Exp $
5876633Stshiozak */
5976633Stshiozak
6076633Stshiozak#ifndef _WCHAR_H_
6176633Stshiozak#define _WCHAR_H_
6276633Stshiozak
6376633Stshiozak#include <sys/cdefs.h>
64123257Smarcel#include <sys/_null.h>
65102227Smike#include <sys/_types.h>
66114185Skan#include <machine/_limits.h>
67133564Stjr#include <_ctype.h>
68101776Stjr
69102227Smike#ifndef _MBSTATE_T_DECLARED
70102227Smiketypedef	__mbstate_t	mbstate_t;
71102227Smike#define	_MBSTATE_T_DECLARED
72101409Stjr#endif
73101409Stjr
74102227Smike#ifndef _SIZE_T_DECLARED
75102227Smiketypedef	__size_t	size_t;
76102227Smike#define	_SIZE_T_DECLARED
77101409Stjr#endif
78101409Stjr
7999640Sobrien#ifndef	__cplusplus
80102227Smike#ifndef _WCHAR_T_DECLARED
81102227Smiketypedef	__wchar_t	wchar_t;
82102227Smike#define	_WCHAR_T_DECLARED
8376633Stshiozak#endif
8499640Sobrien#endif
8576633Stshiozak
86102227Smike#ifndef _WINT_T_DECLARED
87102227Smiketypedef	__wint_t	wint_t;
88102227Smike#define	_WINT_T_DECLARED
8976633Stshiozak#endif
9076633Stshiozak
91114185Skan#ifndef	WCHAR_MIN
92114185Skan#define	WCHAR_MIN	__INT_MIN
93114185Skan#define	WCHAR_MAX	__INT_MAX
94114185Skan#endif
95114185Skan
9676633Stshiozak#ifndef WEOF
9776633Stshiozak#define	WEOF 	((wint_t)-1)
9876633Stshiozak#endif
9976633Stshiozak
100227487Stheraven#ifndef _STDFILE_DECLARED
101227487Stheraven#define _STDFILE_DECLARED
102227487Stheraventypedef struct __sFILE FILE;
103227487Stheraven#endif
104103218Stjrstruct tm;
105103177Stjr
10676633Stshiozak__BEGIN_DECLS
107101411Stjrwint_t	btowc(int);
108227487Stheravenwint_t	fgetwc(FILE *);
109101776Stjrwchar_t	*
110227487Stheraven	fgetws(wchar_t * __restrict, int, FILE * __restrict);
111227487Stheravenwint_t	fputwc(wchar_t, FILE *);
112227487Stheravenint	fputws(const wchar_t * __restrict, FILE * __restrict);
113227487Stheravenint	fwide(FILE *, int);
114227487Stheravenint	fwprintf(FILE * __restrict, const wchar_t * __restrict, ...);
115227487Stheravenint	fwscanf(FILE * __restrict, const wchar_t * __restrict, ...);
116227487Stheravenwint_t	getwc(FILE *);
117101776Stjrwint_t	getwchar(void);
11893032Simpsize_t	mbrlen(const char * __restrict, size_t, mbstate_t * __restrict);
11993032Simpsize_t	mbrtowc(wchar_t * __restrict, const char * __restrict, size_t,
12093032Simp	    mbstate_t * __restrict);
12193032Simpint	mbsinit(const mbstate_t *);
12293032Simpsize_t	mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
12393032Simp	    mbstate_t * __restrict);
124227487Stheravenwint_t	putwc(wchar_t, FILE *);
125101776Stjrwint_t	putwchar(wchar_t);
126103739Stjrint	swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
127103739Stjr	    ...);
128103856Stjrint	swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...);
129227487Stheravenwint_t	ungetwc(wint_t, FILE *);
130227487Stheravenint	vfwprintf(FILE * __restrict, const wchar_t * __restrict,
131103739Stjr	    __va_list);
132103739Stjrint	vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
133103739Stjr	    __va_list);
134103739Stjrint	vwprintf(const wchar_t * __restrict, __va_list);
13593032Simpsize_t	wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict);
13693032Simpwchar_t	*wcscat(wchar_t * __restrict, const wchar_t * __restrict);
137132565Stjrwchar_t	*wcschr(const wchar_t *, wchar_t) __pure;
138132565Stjrint	wcscmp(const wchar_t *, const wchar_t *) __pure;
139104443Stjrint	wcscoll(const wchar_t *, const wchar_t *);
14093032Simpwchar_t	*wcscpy(wchar_t * __restrict, const wchar_t * __restrict);
141132565Stjrsize_t	wcscspn(const wchar_t *, const wchar_t *) __pure;
142103218Stjrsize_t	wcsftime(wchar_t * __restrict, size_t, const wchar_t * __restrict,
143103218Stjr	    const struct tm * __restrict);
144132565Stjrsize_t	wcslen(const wchar_t *) __pure;
14593032Simpwchar_t	*wcsncat(wchar_t * __restrict, const wchar_t * __restrict,
14693032Simp	    size_t);
147132565Stjrint	wcsncmp(const wchar_t *, const wchar_t *, size_t) __pure;
14893032Simpwchar_t	*wcsncpy(wchar_t * __restrict , const wchar_t * __restrict, size_t);
149132565Stjrwchar_t	*wcspbrk(const wchar_t *, const wchar_t *) __pure;
150132565Stjrwchar_t	*wcsrchr(const wchar_t *, wchar_t) __pure;
15193032Simpsize_t	wcsrtombs(char * __restrict, const wchar_t ** __restrict, size_t,
15293032Simp	    mbstate_t * __restrict);
153132565Stjrsize_t	wcsspn(const wchar_t *, const wchar_t *) __pure;
154132565Stjrwchar_t	*wcsstr(const wchar_t * __restrict, const wchar_t * __restrict)
155132565Stjr	    __pure;
156104443Stjrsize_t	wcsxfrm(wchar_t * __restrict, const wchar_t * __restrict, size_t);
157102142Sacheint	wctob(wint_t);
158103339Stjrdouble	wcstod(const wchar_t * __restrict, wchar_t ** __restrict);
159103067Stjrwchar_t	*wcstok(wchar_t * __restrict, const wchar_t * __restrict,
160103067Stjr	    wchar_t ** __restrict);
161103097Stjrlong	 wcstol(const wchar_t * __restrict, wchar_t ** __restrict, int);
162103097Stjrunsigned long
163103097Stjr	 wcstoul(const wchar_t * __restrict, wchar_t ** __restrict, int);
164132565Stjrwchar_t	*wmemchr(const wchar_t *, wchar_t, size_t) __pure;
165132565Stjrint	wmemcmp(const wchar_t *, const wchar_t *, size_t) __pure;
166101411Stjrwchar_t	*wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);
167101411Stjrwchar_t	*wmemmove(wchar_t *, const wchar_t *, size_t);
168101411Stjrwchar_t	*wmemset(wchar_t *, wchar_t, size_t);
169103739Stjrint	wprintf(const wchar_t * __restrict, ...);
170103856Stjrint	wscanf(const wchar_t * __restrict, ...);
171102198Stjr
172129774Stjr#ifndef _STDSTREAM_DECLARED
173227487Stheravenextern FILE *__stdinp;
174227487Stheravenextern FILE *__stdoutp;
175227487Stheravenextern FILE *__stderrp;
176129774Stjr#define	_STDSTREAM_DECLARED
177129774Stjr#endif
178129774Stjr
179129774Stjr#define	getwc(fp)	fgetwc(fp)
180129774Stjr#define	getwchar()	fgetwc(__stdinp)
181130185Stjr#define	putwc(wc, fp)	fputwc(wc, fp)
182129774Stjr#define	putwchar(wc)	fputwc(wc, __stdoutp)
183129774Stjr
184106035Stjr#if __ISO_C_VISIBLE >= 1999
185227487Stheravenint	vfwscanf(FILE * __restrict, const wchar_t * __restrict,
186106035Stjr	    __va_list);
187106035Stjrint	vswscanf(const wchar_t * __restrict, const wchar_t * __restrict,
188106035Stjr	    __va_list);
189106035Stjrint	vwscanf(const wchar_t * __restrict, __va_list);
190112177Stjrfloat	wcstof(const wchar_t * __restrict, wchar_t ** __restrict);
191112177Stjrlong double
192112177Stjr	wcstold(const wchar_t * __restrict, wchar_t ** __restrict);
193106035Stjr#ifdef __LONG_LONG_SUPPORTED
194106035Stjr/* LONGLONG */
195106035Stjrlong long
196106035Stjr	wcstoll(const wchar_t * __restrict, wchar_t ** __restrict, int);
197106035Stjr/* LONGLONG */
198106035Stjrunsigned long long
199106035Stjr	 wcstoull(const wchar_t * __restrict, wchar_t ** __restrict, int);
200106035Stjr#endif
201106035Stjr#endif	/* __ISO_C_VISIBLE >= 1999 */
202106035Stjr
203102198Stjr#if __XSI_VISIBLE
204102198Stjrint	wcswidth(const wchar_t *, size_t);
205102198Stjrint	wcwidth(wchar_t);
206133564Stjr#define	wcwidth(_c)	__wcwidth(_c)
207102198Stjr#endif
208103737Stjr
209189136Sdas#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE
210132497Stjrsize_t	mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
211132497Stjr	    size_t, mbstate_t * __restrict);
212189365Sdaswchar_t	*wcpcpy(wchar_t * __restrict, const wchar_t * __restrict);
213189365Sdaswchar_t	*wcpncpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);
214187961Sdaswchar_t	*wcsdup(const wchar_t *) __malloc_like;
215189136Sdasint	wcscasecmp(const wchar_t *, const wchar_t *);
216189136Sdasint	wcsncasecmp(const wchar_t *, const wchar_t *, size_t n);
217189136Sdassize_t	wcsnlen(const wchar_t *, size_t) __pure;
218132497Stjrsize_t	wcsnrtombs(char * __restrict, const wchar_t ** __restrict, size_t,
219132497Stjr	    size_t, mbstate_t * __restrict);
220189136Sdas#endif
221189136Sdas
222189136Sdas#if __BSD_VISIBLE
223227487Stheravenwchar_t	*fgetwln(FILE * __restrict, size_t * __restrict);
224103737Stjrsize_t	wcslcat(wchar_t *, const wchar_t *, size_t);
225103737Stjrsize_t	wcslcpy(wchar_t *, const wchar_t *, size_t);
226103737Stjr#endif
227232498Stheraven
228233600Stheraven#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
229232498Stheraven#include <xlocale/_wchar.h>
230232498Stheraven#endif
23176633Stshiozak__END_DECLS
23276633Stshiozak
23376633Stshiozak#endif /* !_WCHAR_H_ */
234