wchar.h revision 132242
181084Sjake/*- 281084Sjake * Copyright (c)1999 Citrus Project, 381084Sjake * All rights reserved. 481084Sjake * 581084Sjake * Redistribution and use in source and binary forms, with or without 681084Sjake * modification, are permitted provided that the following conditions 781084Sjake * are met: 881084Sjake * 1. Redistributions of source code must retain the above copyright 981084Sjake * notice, this list of conditions and the following disclaimer. 10147272Smarius * 2. Redistributions in binary form must reproduce the above copyright 11298429Semaste * notice, this list of conditions and the following disclaimer in the 12147272Smarius * documentation and/or other materials provided with the distribution. 13147272Smarius * 14147272Smarius * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15163890Smarius * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16298429Semaste * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17163890Smarius * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18163890Smarius * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19163890Smarius * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20146419Smarius * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21298429Semaste * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22146419Smarius * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23146419Smarius * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24146419Smarius * SUCH DAMAGE. 25233578Speter * 26207154Smarius * $FreeBSD: head/include/wchar.h 132242 2004-07-16 06:06:09Z tjr $ 27252356Sdavide */ 28147272Smarius 29147272Smarius/*- 30147272Smarius * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. 31147272Smarius * All rights reserved. 32147272Smarius * 33147272Smarius * This code is derived from software contributed to The NetBSD Foundation 34147272Smarius * by Julian Coleman. 35152862Sru * 36130294Sscottl * Redistribution and use in source and binary forms, with or without 37119382Sjake * modification, are permitted provided that the following conditions 38271112Semaste * are met: 39119382Sjake * 1. Redistributions of source code must retain the above copyright 40170840Smarius * notice, this list of conditions and the following disclaimer. 41146483Smarius * 2. Redistributions in binary form must reproduce the above copyright 42147191Sjkoshy * notice, this list of conditions and the following disclaimer in the 43166144Smarius * documentation and/or other materials provided with the distribution. 44155151Smarius * 3. All advertising materials mentioning features or use of this software 45166144Smarius * must display the following acknowledgement: 46133589Smarius * This product includes software developed by the NetBSD 47152683Smarius * Foundation, Inc. and its contributors. 48207154Smarius * 4. Neither the name of The NetBSD Foundation nor the names of its 49207154Smarius * contributors may be used to endorse or promote products derived 50186347Snwhitehorn * from this software without specific prior written permission. 5186148Stmm * 52105399Stmm * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 53116584Sjake * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 54152686Smarius * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 55151805Sjoerg * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 56152862Sru * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 57152862Sru * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 58119382Sjake * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 59186681Sed * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 60119382Sjake * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 61119816Smarcel * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 62262861Sjhb * POSSIBILITY OF SUCH DAMAGE. 63262861Sjhb * 64210601Smav * $NetBSD: wchar.h,v 1.8 2000/12/22 05:31:42 itojun Exp $ 65237433Skib */ 6693122Stmm 67124516Sdes#ifndef _WCHAR_H_ 68124481Sdes#define _WCHAR_H_ 69124481Sdes 70124481Sdes#include <sys/cdefs.h> 71289818Savg#include <sys/_null.h> 72189170Sed#include <sys/_types.h> 73111072Sjake#include <machine/_limits.h> 74100399Speter 75202006Smarius#ifndef _MBSTATE_T_DECLARED 76182057Smariustypedef __mbstate_t mbstate_t; 77111072Sjake#define _MBSTATE_T_DECLARED 7886235Stmm#endif 79136944Syongari 80152862Sru#ifndef _SIZE_T_DECLARED 81128758Smariustypedef __size_t size_t; 82202010Smarius#define _SIZE_T_DECLARED 83292789Smarius#endif 84129051Smarius 85129051Smarius#ifndef __cplusplus 86129051Smarius#ifndef _WCHAR_T_DECLARED 87220038Smariustypedef __wchar_t wchar_t; 8886235Stmm#define _WCHAR_T_DECLARED 89207154Smarius#endif 90183423Smarius#endif 91146392Smarius 9290623Stmm#ifndef _WINT_T_DECLARED 93146392Smariustypedef __wint_t wint_t; 94249083Smav#define _WINT_T_DECLARED 9581084Sjake#endif 9686235Stmm 9786235Stmm#ifndef WCHAR_MIN 98228022Smarius#define WCHAR_MIN __INT_MIN 99112399Sjake#define WCHAR_MAX __INT_MAX 10081084Sjake#endif 10190623Stmm 10290623Stmm#ifndef WEOF 10390623Stmm#define WEOF ((wint_t)-1) 10490623Stmm#endif 10590623Stmm 106105531Stmmstruct __sFILE; 10781084Sjakestruct tm; 108183202Smarius 109183202Smarius__BEGIN_DECLS 110152862Sruwint_t btowc(int); 111152862Sruwint_t fgetwc(struct __sFILE *); 112131951Smarcelwchar_t * 11384202Sjake fgetws(wchar_t * __restrict, int, struct __sFILE * __restrict); 114220885Sbzwint_t fputwc(wchar_t, struct __sFILE *); 115183202Smariusint fputws(const wchar_t * __restrict, struct __sFILE * __restrict); 116183202Smariusint fwide(struct __sFILE *, int); 11781390Sjakeint fwprintf(struct __sFILE * __restrict, const wchar_t * __restrict, ...); 11886235Stmmint fwscanf(struct __sFILE * __restrict, const wchar_t * __restrict, ...); 119182918Smariuswint_t getwc(struct __sFILE *); 120111684Sruwint_t getwchar(void); 12181084Sjakesize_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict); 122132956Smarkmsize_t mbrtowc(wchar_t * __restrict, const char * __restrict, size_t, 123183202Smarius mbstate_t * __restrict); 124183202Smariusint mbsinit(const mbstate_t *); 125101070Sjakesize_t mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t, 12689053Sjake mbstate_t * __restrict); 12786235Stmmwint_t putwc(wchar_t, struct __sFILE *); 12886235Stmmwint_t putwchar(wchar_t); 12981084Sjakeint swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict, 130100844Sjake ...); 131152862Sruint swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...); 13282914Sjakewint_t ungetwc(wint_t, struct __sFILE *); 133119382Sjakeint vfwprintf(struct __sFILE * __restrict, const wchar_t * __restrict, 134182918Smarius __va_list); 135112399Sjakeint vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict, 136203845Smarius __va_list); 137174195Srwatsonint vwprintf(const wchar_t * __restrict, __va_list); 138183202Smariussize_t wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict); 139183202Smariuswchar_t *wcscat(wchar_t * __restrict, const wchar_t * __restrict); 14081084Sjakewchar_t *wcschr(const wchar_t *, wchar_t); 141101070Sjakeint wcscmp(const wchar_t *, const wchar_t *); 14281390Sjakeint wcscoll(const wchar_t *, const wchar_t *); 14396998Sjakewchar_t *wcscpy(wchar_t * __restrict, const wchar_t * __restrict); 14481084Sjakesize_t wcscspn(const wchar_t *, const wchar_t *); 14581084Sjakesize_t wcsftime(wchar_t * __restrict, size_t, const wchar_t * __restrict, 146127297Salc const struct tm * __restrict); 147166060Smariussize_t wcslen(const wchar_t *); 14881084Sjakewchar_t *wcsncat(wchar_t * __restrict, const wchar_t * __restrict, 149207537Smarius size_t); 150int wcsncmp(const wchar_t *, const wchar_t *, size_t); 151wchar_t *wcsncpy(wchar_t * __restrict , const wchar_t * __restrict, size_t); 152wchar_t *wcspbrk(const wchar_t *, const wchar_t *); 153wchar_t *wcsrchr(const wchar_t *, wchar_t); 154size_t wcsrtombs(char * __restrict, const wchar_t ** __restrict, size_t, 155 mbstate_t * __restrict); 156size_t wcsspn(const wchar_t *, const wchar_t *); 157wchar_t *wcsstr(const wchar_t * __restrict, const wchar_t * __restrict); 158size_t wcsxfrm(wchar_t * __restrict, const wchar_t * __restrict, size_t); 159int wctob(wint_t); 160double wcstod(const wchar_t * __restrict, wchar_t ** __restrict); 161wchar_t *wcstok(wchar_t * __restrict, const wchar_t * __restrict, 162 wchar_t ** __restrict); 163long wcstol(const wchar_t * __restrict, wchar_t ** __restrict, int); 164unsigned long 165 wcstoul(const wchar_t * __restrict, wchar_t ** __restrict, int); 166wchar_t *wmemchr(const wchar_t *, wchar_t, size_t); 167int wmemcmp(const wchar_t *, const wchar_t *, size_t); 168wchar_t *wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t); 169wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t); 170wchar_t *wmemset(wchar_t *, wchar_t, size_t); 171int wprintf(const wchar_t * __restrict, ...); 172int wscanf(const wchar_t * __restrict, ...); 173 174#ifndef _STDSTREAM_DECLARED 175extern struct __sFILE *__stdinp; 176extern struct __sFILE *__stdoutp; 177extern struct __sFILE *__stderrp; 178#define _STDSTREAM_DECLARED 179#endif 180 181#define getwc(fp) fgetwc(fp) 182#define getwchar() fgetwc(__stdinp) 183#define putwc(wc, fp) fputwc(wc, fp) 184#define putwchar(wc) fputwc(wc, __stdoutp) 185 186#if __ISO_C_VISIBLE >= 1999 187int vfwscanf(struct __sFILE * __restrict, const wchar_t * __restrict, 188 __va_list); 189int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict, 190 __va_list); 191int vwscanf(const wchar_t * __restrict, __va_list); 192float wcstof(const wchar_t * __restrict, wchar_t ** __restrict); 193long double 194 wcstold(const wchar_t * __restrict, wchar_t ** __restrict); 195#ifdef __LONG_LONG_SUPPORTED 196/* LONGLONG */ 197long long 198 wcstoll(const wchar_t * __restrict, wchar_t ** __restrict, int); 199/* LONGLONG */ 200unsigned long long 201 wcstoull(const wchar_t * __restrict, wchar_t ** __restrict, int); 202#endif 203#endif /* __ISO_C_VISIBLE >= 1999 */ 204 205#if __XSI_VISIBLE 206int wcswidth(const wchar_t *, size_t); 207int wcwidth(wchar_t); 208#endif 209 210#if __BSD_VISIBLE 211wchar_t *fgetwln(struct __sFILE * __restrict, size_t * __restrict); 212size_t wcslcat(wchar_t *, const wchar_t *, size_t); 213size_t wcslcpy(wchar_t *, const wchar_t *, size_t); 214#endif 215__END_DECLS 216 217#endif /* !_WCHAR_H_ */ 218