2001-05-15 19:35:57 +00:00
|
|
|
/*-
|
2017-12-08 15:57:29 +00:00
|
|
|
* SPDX-License-Identifier: (BSD-2-Clause AND BSD-2-Clause-NetBSD)
|
2017-11-25 17:09:43 +00:00
|
|
|
*
|
2001-05-15 19:35:57 +00:00
|
|
|
* Copyright (c)1999 Citrus Project,
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* $FreeBSD$
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*-
|
|
|
|
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Julian Coleman.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
2001-07-10 17:50:46 +00:00
|
|
|
*
|
|
|
|
* $NetBSD: wchar.h,v 1.8 2000/12/22 05:31:42 itojun Exp $
|
2001-05-15 19:35:57 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _WCHAR_H_
|
|
|
|
#define _WCHAR_H_
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
2003-12-07 21:10:06 +00:00
|
|
|
#include <sys/_null.h>
|
2002-08-21 16:20:02 +00:00
|
|
|
#include <sys/_types.h>
|
2003-04-28 22:40:05 +00:00
|
|
|
#include <machine/_limits.h>
|
2004-08-12 12:19:11 +00:00
|
|
|
#include <_ctype.h>
|
2002-08-13 09:30:41 +00:00
|
|
|
|
2002-08-21 16:20:02 +00:00
|
|
|
#ifndef _MBSTATE_T_DECLARED
|
|
|
|
typedef __mbstate_t mbstate_t;
|
|
|
|
#define _MBSTATE_T_DECLARED
|
2002-08-06 05:19:33 +00:00
|
|
|
#endif
|
|
|
|
|
2002-08-21 16:20:02 +00:00
|
|
|
#ifndef _SIZE_T_DECLARED
|
|
|
|
typedef __size_t size_t;
|
|
|
|
#define _SIZE_T_DECLARED
|
2002-08-06 05:19:33 +00:00
|
|
|
#endif
|
|
|
|
|
2016-05-30 16:26:34 +00:00
|
|
|
#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE
|
|
|
|
#ifndef _VA_LIST_DECLARED
|
|
|
|
typedef __va_list va_list;
|
|
|
|
#define _VA_LIST_DECLARED
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2002-07-09 05:13:30 +00:00
|
|
|
#ifndef __cplusplus
|
2002-08-21 16:20:02 +00:00
|
|
|
#ifndef _WCHAR_T_DECLARED
|
2014-04-01 14:46:11 +00:00
|
|
|
typedef ___wchar_t wchar_t;
|
2002-08-21 16:20:02 +00:00
|
|
|
#define _WCHAR_T_DECLARED
|
2001-05-15 19:35:57 +00:00
|
|
|
#endif
|
2002-07-09 05:13:30 +00:00
|
|
|
#endif
|
2001-05-15 19:35:57 +00:00
|
|
|
|
2002-08-21 16:20:02 +00:00
|
|
|
#ifndef _WINT_T_DECLARED
|
|
|
|
typedef __wint_t wint_t;
|
|
|
|
#define _WINT_T_DECLARED
|
2001-05-15 19:35:57 +00:00
|
|
|
#endif
|
|
|
|
|
2012-06-24 04:15:58 +00:00
|
|
|
#define WCHAR_MIN __WCHAR_MIN
|
|
|
|
#define WCHAR_MAX __WCHAR_MAX
|
2003-04-28 22:40:05 +00:00
|
|
|
|
2001-05-15 19:35:57 +00:00
|
|
|
#ifndef WEOF
|
|
|
|
#define WEOF ((wint_t)-1)
|
|
|
|
#endif
|
|
|
|
|
2011-11-13 16:18:48 +00:00
|
|
|
#ifndef _STDFILE_DECLARED
|
|
|
|
#define _STDFILE_DECLARED
|
|
|
|
typedef struct __sFILE FILE;
|
|
|
|
#endif
|
2002-09-11 08:57:11 +00:00
|
|
|
struct tm;
|
2002-09-10 09:43:28 +00:00
|
|
|
|
2001-05-15 19:35:57 +00:00
|
|
|
__BEGIN_DECLS
|
2002-08-06 06:26:06 +00:00
|
|
|
wint_t btowc(int);
|
2011-11-13 16:18:48 +00:00
|
|
|
wint_t fgetwc(FILE *);
|
2002-08-13 09:30:41 +00:00
|
|
|
wchar_t *
|
2011-11-13 16:18:48 +00:00
|
|
|
fgetws(wchar_t * __restrict, int, FILE * __restrict);
|
|
|
|
wint_t fputwc(wchar_t, FILE *);
|
|
|
|
int fputws(const wchar_t * __restrict, FILE * __restrict);
|
|
|
|
int fwide(FILE *, int);
|
|
|
|
int fwprintf(FILE * __restrict, const wchar_t * __restrict, ...);
|
|
|
|
int fwscanf(FILE * __restrict, const wchar_t * __restrict, ...);
|
|
|
|
wint_t getwc(FILE *);
|
2002-08-13 09:30:41 +00:00
|
|
|
wint_t getwchar(void);
|
2002-03-23 17:24:55 +00:00
|
|
|
size_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict);
|
|
|
|
size_t mbrtowc(wchar_t * __restrict, const char * __restrict, size_t,
|
|
|
|
mbstate_t * __restrict);
|
|
|
|
int mbsinit(const mbstate_t *);
|
|
|
|
size_t mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
|
|
|
|
mbstate_t * __restrict);
|
2011-11-13 16:18:48 +00:00
|
|
|
wint_t putwc(wchar_t, FILE *);
|
2002-08-13 09:30:41 +00:00
|
|
|
wint_t putwchar(wchar_t);
|
2002-09-21 13:00:30 +00:00
|
|
|
int swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
|
|
|
|
...);
|
2002-09-23 12:40:06 +00:00
|
|
|
int swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...);
|
2011-11-13 16:18:48 +00:00
|
|
|
wint_t ungetwc(wint_t, FILE *);
|
|
|
|
int vfwprintf(FILE * __restrict, const wchar_t * __restrict,
|
2002-09-21 13:00:30 +00:00
|
|
|
__va_list);
|
|
|
|
int vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
|
|
|
|
__va_list);
|
|
|
|
int vwprintf(const wchar_t * __restrict, __va_list);
|
2002-03-23 17:24:55 +00:00
|
|
|
size_t wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict);
|
|
|
|
wchar_t *wcscat(wchar_t * __restrict, const wchar_t * __restrict);
|
2004-07-23 02:29:37 +00:00
|
|
|
wchar_t *wcschr(const wchar_t *, wchar_t) __pure;
|
|
|
|
int wcscmp(const wchar_t *, const wchar_t *) __pure;
|
2002-10-04 03:18:26 +00:00
|
|
|
int wcscoll(const wchar_t *, const wchar_t *);
|
2002-03-23 17:24:55 +00:00
|
|
|
wchar_t *wcscpy(wchar_t * __restrict, const wchar_t * __restrict);
|
2004-07-23 02:29:37 +00:00
|
|
|
size_t wcscspn(const wchar_t *, const wchar_t *) __pure;
|
2002-09-11 08:57:11 +00:00
|
|
|
size_t wcsftime(wchar_t * __restrict, size_t, const wchar_t * __restrict,
|
|
|
|
const struct tm * __restrict);
|
2004-07-23 02:29:37 +00:00
|
|
|
size_t wcslen(const wchar_t *) __pure;
|
2002-03-23 17:24:55 +00:00
|
|
|
wchar_t *wcsncat(wchar_t * __restrict, const wchar_t * __restrict,
|
|
|
|
size_t);
|
2004-07-23 02:29:37 +00:00
|
|
|
int wcsncmp(const wchar_t *, const wchar_t *, size_t) __pure;
|
2002-03-23 17:24:55 +00:00
|
|
|
wchar_t *wcsncpy(wchar_t * __restrict , const wchar_t * __restrict, size_t);
|
2004-07-23 02:29:37 +00:00
|
|
|
wchar_t *wcspbrk(const wchar_t *, const wchar_t *) __pure;
|
|
|
|
wchar_t *wcsrchr(const wchar_t *, wchar_t) __pure;
|
2002-03-23 17:24:55 +00:00
|
|
|
size_t wcsrtombs(char * __restrict, const wchar_t ** __restrict, size_t,
|
|
|
|
mbstate_t * __restrict);
|
2004-07-23 02:29:37 +00:00
|
|
|
size_t wcsspn(const wchar_t *, const wchar_t *) __pure;
|
|
|
|
wchar_t *wcsstr(const wchar_t * __restrict, const wchar_t * __restrict)
|
|
|
|
__pure;
|
2002-10-04 03:18:26 +00:00
|
|
|
size_t wcsxfrm(wchar_t * __restrict, const wchar_t * __restrict, size_t);
|
2002-08-03 13:49:55 +00:00
|
|
|
int wctob(wint_t);
|
2002-09-15 08:38:51 +00:00
|
|
|
double wcstod(const wchar_t * __restrict, wchar_t ** __restrict);
|
2002-09-07 08:16:57 +00:00
|
|
|
wchar_t *wcstok(wchar_t * __restrict, const wchar_t * __restrict,
|
|
|
|
wchar_t ** __restrict);
|
2002-09-08 13:27:26 +00:00
|
|
|
long wcstol(const wchar_t * __restrict, wchar_t ** __restrict, int);
|
|
|
|
unsigned long
|
|
|
|
wcstoul(const wchar_t * __restrict, wchar_t ** __restrict, int);
|
2004-07-23 02:29:37 +00:00
|
|
|
wchar_t *wmemchr(const wchar_t *, wchar_t, size_t) __pure;
|
|
|
|
int wmemcmp(const wchar_t *, const wchar_t *, size_t) __pure;
|
2002-08-06 06:26:06 +00:00
|
|
|
wchar_t *wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);
|
|
|
|
wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t);
|
|
|
|
wchar_t *wmemset(wchar_t *, wchar_t, size_t);
|
2002-09-21 13:00:30 +00:00
|
|
|
int wprintf(const wchar_t * __restrict, ...);
|
2002-09-23 12:40:06 +00:00
|
|
|
int wscanf(const wchar_t * __restrict, ...);
|
2002-08-20 22:44:40 +00:00
|
|
|
|
2004-05-27 10:08:44 +00:00
|
|
|
#ifndef _STDSTREAM_DECLARED
|
2011-11-13 16:18:48 +00:00
|
|
|
extern FILE *__stdinp;
|
|
|
|
extern FILE *__stdoutp;
|
|
|
|
extern FILE *__stderrp;
|
2004-05-27 10:08:44 +00:00
|
|
|
#define _STDSTREAM_DECLARED
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define getwc(fp) fgetwc(fp)
|
|
|
|
#define getwchar() fgetwc(__stdinp)
|
2004-06-07 10:31:10 +00:00
|
|
|
#define putwc(wc, fp) fputwc(wc, fp)
|
2004-05-27 10:08:44 +00:00
|
|
|
#define putwchar(wc) fputwc(wc, __stdoutp)
|
|
|
|
|
2002-10-27 11:30:36 +00:00
|
|
|
#if __ISO_C_VISIBLE >= 1999
|
2011-11-13 16:18:48 +00:00
|
|
|
int vfwscanf(FILE * __restrict, const wchar_t * __restrict,
|
2002-10-27 11:30:36 +00:00
|
|
|
__va_list);
|
|
|
|
int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict,
|
|
|
|
__va_list);
|
|
|
|
int vwscanf(const wchar_t * __restrict, __va_list);
|
2003-03-13 06:29:53 +00:00
|
|
|
float wcstof(const wchar_t * __restrict, wchar_t ** __restrict);
|
|
|
|
long double
|
|
|
|
wcstold(const wchar_t * __restrict, wchar_t ** __restrict);
|
2002-10-27 11:30:36 +00:00
|
|
|
#ifdef __LONG_LONG_SUPPORTED
|
|
|
|
/* LONGLONG */
|
|
|
|
long long
|
|
|
|
wcstoll(const wchar_t * __restrict, wchar_t ** __restrict, int);
|
|
|
|
/* LONGLONG */
|
|
|
|
unsigned long long
|
|
|
|
wcstoull(const wchar_t * __restrict, wchar_t ** __restrict, int);
|
|
|
|
#endif
|
|
|
|
#endif /* __ISO_C_VISIBLE >= 1999 */
|
|
|
|
|
2002-08-20 22:44:40 +00:00
|
|
|
#if __XSI_VISIBLE
|
|
|
|
int wcswidth(const wchar_t *, size_t);
|
|
|
|
int wcwidth(wchar_t);
|
2004-08-12 12:19:11 +00:00
|
|
|
#define wcwidth(_c) __wcwidth(_c)
|
2002-08-20 22:44:40 +00:00
|
|
|
#endif
|
2002-09-21 08:55:16 +00:00
|
|
|
|
2014-05-11 13:48:21 +00:00
|
|
|
#if __POSIX_VISIBLE >= 200809
|
2004-07-21 10:54:57 +00:00
|
|
|
size_t mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
|
|
|
|
size_t, mbstate_t * __restrict);
|
2013-02-27 19:50:46 +00:00
|
|
|
FILE *open_wmemstream(wchar_t **, size_t *);
|
2009-03-04 15:45:34 +00:00
|
|
|
wchar_t *wcpcpy(wchar_t * __restrict, const wchar_t * __restrict);
|
|
|
|
wchar_t *wcpncpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);
|
2009-01-31 18:27:02 +00:00
|
|
|
wchar_t *wcsdup(const wchar_t *) __malloc_like;
|
2009-02-28 06:00:58 +00:00
|
|
|
int wcscasecmp(const wchar_t *, const wchar_t *);
|
|
|
|
int wcsncasecmp(const wchar_t *, const wchar_t *, size_t n);
|
|
|
|
size_t wcsnlen(const wchar_t *, size_t) __pure;
|
2004-07-21 10:54:57 +00:00
|
|
|
size_t wcsnrtombs(char * __restrict, const wchar_t ** __restrict, size_t,
|
|
|
|
size_t, mbstate_t * __restrict);
|
2009-02-28 06:00:58 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if __BSD_VISIBLE
|
2011-11-13 16:18:48 +00:00
|
|
|
wchar_t *fgetwln(FILE * __restrict, size_t * __restrict);
|
2002-09-21 08:55:16 +00:00
|
|
|
size_t wcslcat(wchar_t *, const wchar_t *, size_t);
|
|
|
|
size_t wcslcpy(wchar_t *, const wchar_t *, size_t);
|
|
|
|
#endif
|
2012-03-04 15:31:13 +00:00
|
|
|
|
2012-03-28 12:11:54 +00:00
|
|
|
#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
|
2012-03-04 15:31:13 +00:00
|
|
|
#include <xlocale/_wchar.h>
|
|
|
|
#endif
|
2001-05-15 19:35:57 +00:00
|
|
|
__END_DECLS
|
|
|
|
|
|
|
|
#endif /* !_WCHAR_H_ */
|