wchar.h revision 247411
1254721Semaste/*- 2254721Semaste * Copyright (c)1999 Citrus Project, 3254721Semaste * All rights reserved. 4254721Semaste * 5254721Semaste * Redistribution and use in source and binary forms, with or without 6254721Semaste * modification, are permitted provided that the following conditions 7254721Semaste * are met: 8254721Semaste * 1. Redistributions of source code must retain the above copyright 9254721Semaste * notice, this list of conditions and the following disclaimer. 10254721Semaste * 2. Redistributions in binary form must reproduce the above copyright 11254721Semaste * notice, this list of conditions and the following disclaimer in the 12254721Semaste * documentation and/or other materials provided with the distribution. 13254721Semaste * 14254721Semaste * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15254721Semaste * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16254721Semaste * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17254721Semaste * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18254721Semaste * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19254721Semaste * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20254721Semaste * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21254721Semaste * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22254721Semaste * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23254721Semaste * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24254721Semaste * SUCH DAMAGE. 25254721Semaste * 26254721Semaste * $FreeBSD: head/include/wchar.h 247411 2013-02-27 19:50:46Z jhb $ 27254721Semaste */ 28254721Semaste 29254721Semaste/*- 30254721Semaste * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. 31254721Semaste * All rights reserved. 32254721Semaste * 33254721Semaste * This code is derived from software contributed to The NetBSD Foundation 34254721Semaste * by Julian Coleman. 35254721Semaste * 36254721Semaste * Redistribution and use in source and binary forms, with or without 37254721Semaste * modification, are permitted provided that the following conditions 38254721Semaste * are met: 39254721Semaste * 1. Redistributions of source code must retain the above copyright 40254721Semaste * notice, this list of conditions and the following disclaimer. 41254721Semaste * 2. Redistributions in binary form must reproduce the above copyright 42254721Semaste * notice, this list of conditions and the following disclaimer in the 43254721Semaste * documentation and/or other materials provided with the distribution. 44254721Semaste * 45254721Semaste * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 46254721Semaste * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 47254721Semaste * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 48254721Semaste * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 49254721Semaste * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 50254721Semaste * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 51254721Semaste * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 52254721Semaste * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 53254721Semaste * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 54254721Semaste * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 55254721Semaste * POSSIBILITY OF SUCH DAMAGE. 56254721Semaste * 57254721Semaste * $NetBSD: wchar.h,v 1.8 2000/12/22 05:31:42 itojun Exp $ 58254721Semaste */ 59254721Semaste 60254721Semaste#ifndef _WCHAR_H_ 61254721Semaste#define _WCHAR_H_ 62254721Semaste 63254721Semaste#include <sys/cdefs.h> 64254721Semaste#include <sys/_null.h> 65254721Semaste#include <sys/_types.h> 66254721Semaste#include <machine/_limits.h> 67254721Semaste#include <_ctype.h> 68254721Semaste 69254721Semaste#ifndef _MBSTATE_T_DECLARED 70254721Semastetypedef __mbstate_t mbstate_t; 71254721Semaste#define _MBSTATE_T_DECLARED 72254721Semaste#endif 73254721Semaste 74254721Semaste#ifndef _SIZE_T_DECLARED 75254721Semastetypedef __size_t size_t; 76254721Semaste#define _SIZE_T_DECLARED 77254721Semaste#endif 78254721Semaste 79254721Semaste#ifndef __cplusplus 80254721Semaste#ifndef _WCHAR_T_DECLARED 81254721Semastetypedef __wchar_t wchar_t; 82254721Semaste#define _WCHAR_T_DECLARED 83254721Semaste#endif 84254721Semaste#endif 85254721Semaste 86254721Semaste#ifndef _WINT_T_DECLARED 87254721Semastetypedef __wint_t wint_t; 88254721Semaste#define _WINT_T_DECLARED 89254721Semaste#endif 90254721Semaste 91254721Semaste#define WCHAR_MIN __WCHAR_MIN 92254721Semaste#define WCHAR_MAX __WCHAR_MAX 93254721Semaste 94254721Semaste#ifndef WEOF 95254721Semaste#define WEOF ((wint_t)-1) 96254721Semaste#endif 97254721Semaste 98254721Semaste#ifndef _STDFILE_DECLARED 99254721Semaste#define _STDFILE_DECLARED 100254721Semastetypedef struct __sFILE FILE; 101254721Semaste#endif 102254721Semastestruct tm; 103254721Semaste 104254721Semaste__BEGIN_DECLS 105254721Semastewint_t btowc(int); 106254721Semastewint_t fgetwc(FILE *); 107254721Semastewchar_t * 108254721Semaste fgetws(wchar_t * __restrict, int, FILE * __restrict); 109254721Semastewint_t fputwc(wchar_t, FILE *); 110254721Semasteint fputws(const wchar_t * __restrict, FILE * __restrict); 111254721Semasteint fwide(FILE *, int); 112254721Semasteint fwprintf(FILE * __restrict, const wchar_t * __restrict, ...); 113254721Semasteint fwscanf(FILE * __restrict, const wchar_t * __restrict, ...); 114254721Semastewint_t getwc(FILE *); 115254721Semastewint_t getwchar(void); 116254721Semastesize_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict); 117254721Semastesize_t mbrtowc(wchar_t * __restrict, const char * __restrict, size_t, 118254721Semaste mbstate_t * __restrict); 119254721Semasteint mbsinit(const mbstate_t *); 120254721Semastesize_t mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t, 121254721Semaste mbstate_t * __restrict); 122254721Semastewint_t putwc(wchar_t, FILE *); 123254721Semastewint_t putwchar(wchar_t); 124254721Semasteint swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict, 125254721Semaste ...); 126254721Semasteint swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...); 127254721Semastewint_t ungetwc(wint_t, FILE *); 128254721Semasteint vfwprintf(FILE * __restrict, const wchar_t * __restrict, 129254721Semaste __va_list); 130254721Semasteint vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict, 131254721Semaste __va_list); 132254721Semasteint vwprintf(const wchar_t * __restrict, __va_list); 133254721Semastesize_t wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict); 134254721Semastewchar_t *wcscat(wchar_t * __restrict, const wchar_t * __restrict); 135254721Semastewchar_t *wcschr(const wchar_t *, wchar_t) __pure; 136254721Semasteint wcscmp(const wchar_t *, const wchar_t *) __pure; 137254721Semasteint wcscoll(const wchar_t *, const wchar_t *); 138254721Semastewchar_t *wcscpy(wchar_t * __restrict, const wchar_t * __restrict); 139254721Semastesize_t wcscspn(const wchar_t *, const wchar_t *) __pure; 140254721Semastesize_t wcsftime(wchar_t * __restrict, size_t, const wchar_t * __restrict, 141254721Semaste const struct tm * __restrict); 142254721Semastesize_t wcslen(const wchar_t *) __pure; 143254721Semastewchar_t *wcsncat(wchar_t * __restrict, const wchar_t * __restrict, 144254721Semaste size_t); 145254721Semasteint wcsncmp(const wchar_t *, const wchar_t *, size_t) __pure; 146254721Semastewchar_t *wcsncpy(wchar_t * __restrict , const wchar_t * __restrict, size_t); 147254721Semastewchar_t *wcspbrk(const wchar_t *, const wchar_t *) __pure; 148254721Semastewchar_t *wcsrchr(const wchar_t *, wchar_t) __pure; 149254721Semastesize_t wcsrtombs(char * __restrict, const wchar_t ** __restrict, size_t, 150254721Semaste mbstate_t * __restrict); 151254721Semastesize_t wcsspn(const wchar_t *, const wchar_t *) __pure; 152254721Semastewchar_t *wcsstr(const wchar_t * __restrict, const wchar_t * __restrict) 153254721Semaste __pure; 154254721Semastesize_t wcsxfrm(wchar_t * __restrict, const wchar_t * __restrict, size_t); 155254721Semasteint wctob(wint_t); 156254721Semastedouble wcstod(const wchar_t * __restrict, wchar_t ** __restrict); 157254721Semastewchar_t *wcstok(wchar_t * __restrict, const wchar_t * __restrict, 158254721Semaste wchar_t ** __restrict); 159254721Semastelong wcstol(const wchar_t * __restrict, wchar_t ** __restrict, int); 160254721Semasteunsigned long 161254721Semaste wcstoul(const wchar_t * __restrict, wchar_t ** __restrict, int); 162254721Semastewchar_t *wmemchr(const wchar_t *, wchar_t, size_t) __pure; 163254721Semasteint wmemcmp(const wchar_t *, const wchar_t *, size_t) __pure; 164254721Semastewchar_t *wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t); 165254721Semastewchar_t *wmemmove(wchar_t *, const wchar_t *, size_t); 166254721Semastewchar_t *wmemset(wchar_t *, wchar_t, size_t); 167254721Semasteint wprintf(const wchar_t * __restrict, ...); 168254721Semasteint wscanf(const wchar_t * __restrict, ...); 169254721Semaste 170254721Semaste#ifndef _STDSTREAM_DECLARED 171254721Semasteextern FILE *__stdinp; 172254721Semasteextern FILE *__stdoutp; 173254721Semasteextern FILE *__stderrp; 174254721Semaste#define _STDSTREAM_DECLARED 175254721Semaste#endif 176254721Semaste 177254721Semaste#define getwc(fp) fgetwc(fp) 178254721Semaste#define getwchar() fgetwc(__stdinp) 179254721Semaste#define putwc(wc, fp) fputwc(wc, fp) 180254721Semaste#define putwchar(wc) fputwc(wc, __stdoutp) 181254721Semaste 182254721Semaste#if __ISO_C_VISIBLE >= 1999 183254721Semasteint vfwscanf(FILE * __restrict, const wchar_t * __restrict, 184254721Semaste __va_list); 185254721Semasteint vswscanf(const wchar_t * __restrict, const wchar_t * __restrict, 186254721Semaste __va_list); 187254721Semasteint vwscanf(const wchar_t * __restrict, __va_list); 188254721Semastefloat wcstof(const wchar_t * __restrict, wchar_t ** __restrict); 189254721Semastelong double 190254721Semaste wcstold(const wchar_t * __restrict, wchar_t ** __restrict); 191254721Semaste#ifdef __LONG_LONG_SUPPORTED 192254721Semaste/* LONGLONG */ 193254721Semastelong long 194254721Semaste wcstoll(const wchar_t * __restrict, wchar_t ** __restrict, int); 195254721Semaste/* LONGLONG */ 196254721Semasteunsigned long long 197254721Semaste wcstoull(const wchar_t * __restrict, wchar_t ** __restrict, int); 198254721Semaste#endif 199254721Semaste#endif /* __ISO_C_VISIBLE >= 1999 */ 200254721Semaste 201254721Semaste#if __XSI_VISIBLE 202254721Semasteint wcswidth(const wchar_t *, size_t); 203254721Semasteint wcwidth(wchar_t); 204254721Semaste#define wcwidth(_c) __wcwidth(_c) 205254721Semaste#endif 206254721Semaste 207254721Semaste#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE 208254721Semastesize_t mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t, 209254721Semaste size_t, mbstate_t * __restrict); 210254721SemasteFILE *open_wmemstream(wchar_t **, size_t *); 211254721Semastewchar_t *wcpcpy(wchar_t * __restrict, const wchar_t * __restrict); 212254721Semastewchar_t *wcpncpy(wchar_t * __restrict, const wchar_t * __restrict, size_t); 213254721Semastewchar_t *wcsdup(const wchar_t *) __malloc_like; 214254721Semasteint wcscasecmp(const wchar_t *, const wchar_t *); 215254721Semasteint wcsncasecmp(const wchar_t *, const wchar_t *, size_t n); 216254721Semastesize_t wcsnlen(const wchar_t *, size_t) __pure; 217254721Semastesize_t wcsnrtombs(char * __restrict, const wchar_t ** __restrict, size_t, 218254721Semaste size_t, mbstate_t * __restrict); 219254721Semaste#endif 220254721Semaste 221254721Semaste#if __BSD_VISIBLE 222254721Semastewchar_t *fgetwln(FILE * __restrict, size_t * __restrict); 223254721Semastesize_t wcslcat(wchar_t *, const wchar_t *, size_t); 224254721Semastesize_t wcslcpy(wchar_t *, const wchar_t *, size_t); 225254721Semaste#endif 226254721Semaste 227254721Semaste#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_) 228254721Semaste#include <xlocale/_wchar.h> 229254721Semaste#endif 230254721Semaste__END_DECLS 231254721Semaste 232254721Semaste#endif /* !_WCHAR_H_ */ 233254721Semaste