wchar.h revision 103737
11558Srgrimes/*-
21558Srgrimes * Copyright (c)1999 Citrus Project,
31558Srgrimes * All rights reserved.
41558Srgrimes *
51558Srgrimes * Redistribution and use in source and binary forms, with or without
61558Srgrimes * modification, are permitted provided that the following conditions
71558Srgrimes * are met:
81558Srgrimes * 1. Redistributions of source code must retain the above copyright
91558Srgrimes *    notice, this list of conditions and the following disclaimer.
101558Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
111558Srgrimes *    notice, this list of conditions and the following disclaimer in the
121558Srgrimes *    documentation and/or other materials provided with the distribution.
131558Srgrimes *
141558Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
151558Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
161558Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
171558Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
181558Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
191558Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
201558Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
211558Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
221558Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
231558Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
241558Srgrimes * SUCH DAMAGE.
251558Srgrimes *
261558Srgrimes * $FreeBSD: head/include/wchar.h 103737 2002-09-21 08:55:16Z tjr $
271558Srgrimes */
281558Srgrimes
291558Srgrimes/*-
301558Srgrimes * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
311558Srgrimes * All rights reserved.
321558Srgrimes *
331558Srgrimes * This code is derived from software contributed to The NetBSD Foundation
34114589Sobrien * by Julian Coleman.
351558Srgrimes *
3623678Speter * Redistribution and use in source and binary forms, with or without
37114589Sobrien * modification, are permitted provided that the following conditions
3828671Ssteve * are met:
39114589Sobrien * 1. Redistributions of source code must retain the above copyright
40114589Sobrien *    notice, this list of conditions and the following disclaimer.
411558Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
421558Srgrimes *    notice, this list of conditions and the following disclaimer in the
4352055Sphk *    documentation and/or other materials provided with the distribution.
441558Srgrimes * 3. All advertising materials mentioning features or use of this software
451558Srgrimes *    must display the following acknowledgement:
4652055Sphk *        This product includes software developed by the NetBSD
471558Srgrimes *        Foundation, Inc. and its contributors.
481558Srgrimes * 4. Neither the name of The NetBSD Foundation nor the names of its
4952055Sphk *    contributors may be used to endorse or promote products derived
501558Srgrimes *    from this software without specific prior written permission.
511558Srgrimes *
521558Srgrimes * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
534065Swollman * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
544065Swollman * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
551558Srgrimes * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
564065Swollman * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
571558Srgrimes * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
581558Srgrimes * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
591558Srgrimes * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
604065Swollman * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
611558Srgrimes * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
621558Srgrimes * POSSIBILITY OF SUCH DAMAGE.
633202Sache *
6423678Speter *	$NetBSD: wchar.h,v 1.8 2000/12/22 05:31:42 itojun Exp $
654065Swollman */
661558Srgrimes
671558Srgrimes#ifndef _WCHAR_H_
681558Srgrimes#define _WCHAR_H_
691558Srgrimes
701558Srgrimes#include <sys/cdefs.h>
711558Srgrimes#include <sys/_types.h>
721558Srgrimes
731558Srgrimes#ifndef NULL
741558Srgrimes#define	NULL	0
751558Srgrimes#endif
761558Srgrimes
771558Srgrimes#ifndef _MBSTATE_T_DECLARED
781558Srgrimestypedef	__mbstate_t	mbstate_t;
7923678Speter#define	_MBSTATE_T_DECLARED
8023678Speter#endif
8123678Speter
8223678Speter#ifndef _SIZE_T_DECLARED
8323678Spetertypedef	__size_t	size_t;
84123268Strhodes#define	_SIZE_T_DECLARED
8525301Smsmith#endif
8623678Speter
871558Srgrimes#ifndef	__cplusplus
883202Sache#ifndef _WCHAR_T_DECLARED
893202Sachetypedef	__wchar_t	wchar_t;
903202Sache#define	_WCHAR_T_DECLARED
913202Sache#endif
923202Sache#endif
933202Sache
941558Srgrimes#ifndef _WINT_T_DECLARED
953202Sachetypedef	__wint_t	wint_t;
961558Srgrimes#define	_WINT_T_DECLARED
9737425Scharnier#endif
981558Srgrimes
994065Swollman#ifndef WEOF
1001558Srgrimes#define	WEOF 	((wint_t)-1)
1014065Swollman#endif
1021558Srgrimes
1034065Swollmanstruct __sFILE;
10423678Speterstruct tm;
1051558Srgrimes
1064065Swollman__BEGIN_DECLS
1071558Srgrimeswint_t	btowc(int);
1081558Srgrimeswint_t	fgetwc(struct __sFILE *);
1091558Srgrimeswchar_t	*
1101558Srgrimes	fgetws(wchar_t * __restrict, int, struct __sFILE * __restrict);
11152055Sphkwint_t	fputwc(wchar_t, struct __sFILE *);
11252055Sphkint	fputws(const wchar_t * __restrict, struct __sFILE * __restrict);
11352055Sphkint	fwide(struct __sFILE *, int);
11452055Sphkwint_t	getwc(struct __sFILE *);
11552055Sphkwint_t	getwchar(void);
11652055Sphksize_t	mbrlen(const char * __restrict, size_t, mbstate_t * __restrict);
11752055Sphksize_t	mbrtowc(wchar_t * __restrict, const char * __restrict, size_t,
11852055Sphk	    mbstate_t * __restrict);
11952055Sphkint	mbsinit(const mbstate_t *);
12052055Sphksize_t	mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
12152055Sphk	    mbstate_t * __restrict);
12252055Sphkwint_t	putwc(wchar_t, struct __sFILE *);
12352055Sphkwint_t	putwchar(wchar_t);
12452055Sphkwint_t	ungetwc(wint_t, struct __sFILE *);
12552055Sphksize_t	wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict);
12652055Sphkwchar_t	*wcscat(wchar_t * __restrict, const wchar_t * __restrict);
12752055Sphkwchar_t	*wcschr(const wchar_t *, wchar_t);
12852055Sphkint	wcscmp(const wchar_t *, const wchar_t *);
12952055Sphkwchar_t	*wcscpy(wchar_t * __restrict, const wchar_t * __restrict);
13052055Sphksize_t	wcscspn(const wchar_t *, const wchar_t *);
13152055Sphksize_t	wcsftime(wchar_t * __restrict, size_t, const wchar_t * __restrict,
13252055Sphk	    const struct tm * __restrict);
13352055Sphksize_t	wcslen(const wchar_t *);
13452055Sphkwchar_t	*wcsncat(wchar_t * __restrict, const wchar_t * __restrict,
13552055Sphk	    size_t);
13652055Sphkint	wcsncmp(const wchar_t *, const wchar_t *, size_t);
13752055Sphkwchar_t	*wcsncpy(wchar_t * __restrict , const wchar_t * __restrict, size_t);
13852055Sphkwchar_t	*wcspbrk(const wchar_t *, const wchar_t *);
13952055Sphkwchar_t	*wcsrchr(const wchar_t *, wchar_t);
14052055Sphksize_t	wcsrtombs(char * __restrict, const wchar_t ** __restrict, size_t,
14152055Sphk	    mbstate_t * __restrict);
14252055Sphksize_t	wcsspn(const wchar_t *, const wchar_t *);
14352055Sphkwchar_t	*wcsstr(const wchar_t * __restrict, const wchar_t * __restrict);
14452055Sphkint	wctob(wint_t);
14552055Sphkdouble	wcstod(const wchar_t * __restrict, wchar_t ** __restrict);
14652055Sphkwchar_t	*wcstok(wchar_t * __restrict, const wchar_t * __restrict,
147	    wchar_t ** __restrict);
148long	 wcstol(const wchar_t * __restrict, wchar_t ** __restrict, int);
149unsigned long
150	 wcstoul(const wchar_t * __restrict, wchar_t ** __restrict, int);
151wchar_t	*wmemchr(const wchar_t *, wchar_t, size_t);
152int	wmemcmp(const wchar_t *, const wchar_t *, size_t);
153wchar_t	*wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);
154wchar_t	*wmemmove(wchar_t *, const wchar_t *, size_t);
155wchar_t	*wmemset(wchar_t *, wchar_t, size_t);
156
157#if __XSI_VISIBLE
158int	wcswidth(const wchar_t *, size_t);
159int	wcwidth(wchar_t);
160#endif
161
162#if __BSD_VISIBLE
163size_t	wcslcat(wchar_t *, const wchar_t *, size_t);
164size_t	wcslcpy(wchar_t *, const wchar_t *, size_t);
165#endif
166__END_DECLS
167
168#define	getwc(fp)	fgetwc(fp)
169#define	getwchar()	fgetwc(stdin)
170#define	putwc(wc, fp)	fputwc((wc), (fp))
171#define	putwchar(wc)	fputwc((wc), stdout)
172
173#endif /* !_WCHAR_H_ */
174