]> git.saurik.com Git - apple/libc.git/blob - include/wchar.h
917c30354d74558054f8fe2b3976807fc47f0cf7
[apple/libc.git] / include / wchar.h
1 /*
2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /*-
24 * Copyright (c)1999 Citrus Project,
25 * All rights reserved.
26 *
27 * Redistribution and use in source and binary forms, with or without
28 * modification, are permitted provided that the following conditions
29 * are met:
30 * 1. Redistributions of source code must retain the above copyright
31 * notice, this list of conditions and the following disclaimer.
32 * 2. Redistributions in binary form must reproduce the above copyright
33 * notice, this list of conditions and the following disclaimer in the
34 * documentation and/or other materials provided with the distribution.
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
37 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
39 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
40 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
41 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
42 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
43 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
44 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
45 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46 * SUCH DAMAGE.
47 *
48 * $FreeBSD: /repoman/r/ncvs/src/include/wchar.h,v 1.34 2003/03/13 06:29:53 tjr Exp $
49 */
50
51 /*-
52 * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
53 * All rights reserved.
54 *
55 * This code is derived from software contributed to The NetBSD Foundation
56 * by Julian Coleman.
57 *
58 * Redistribution and use in source and binary forms, with or without
59 * modification, are permitted provided that the following conditions
60 * are met:
61 * 1. Redistributions of source code must retain the above copyright
62 * notice, this list of conditions and the following disclaimer.
63 * 2. Redistributions in binary form must reproduce the above copyright
64 * notice, this list of conditions and the following disclaimer in the
65 * documentation and/or other materials provided with the distribution.
66 * 3. All advertising materials mentioning features or use of this software
67 * must display the following acknowledgement:
68 * This product includes software developed by the NetBSD
69 * Foundation, Inc. and its contributors.
70 * 4. Neither the name of The NetBSD Foundation nor the names of its
71 * contributors may be used to endorse or promote products derived
72 * from this software without specific prior written permission.
73 *
74 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
75 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
76 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
77 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
78 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
79 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
80 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
81 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
82 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
83 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
84 * POSSIBILITY OF SUCH DAMAGE.
85 *
86 * $NetBSD: wchar.h,v 1.8 2000/12/22 05:31:42 itojun Exp $
87 */
88
89 #ifndef _WCHAR_H_
90 #define _WCHAR_H_
91
92 #include <sys/cdefs.h>
93 #include <sys/types.h>
94 #include <stdarg.h>
95
96 #ifndef NULL
97 #define NULL 0
98 #endif
99
100 #ifndef _BSD_SIZE_T_DEFINED_
101 #define _BSD_SIZE_T_DEFINED_
102 typedef _BSD_SIZE_T_ size_t;
103 #endif
104
105 #ifndef _BSD_MBSTATE_T_DEFINED_
106 #define _BSD_MBSTATE_T_DEFINED_
107 typedef _BSD_MBSTATE_T_ mbstate_t;
108 #endif
109
110 #ifndef _BSD_CT_RUNE_T_DEFINED_
111 #define _BSD_CT_RUNE_T_DEFINED_
112 typedef _BSD_CT_RUNE_T_ ct_rune_t;
113 #endif
114
115 #ifndef _BSD_RUNE_T_DEFINED_
116 #define _BSD_RUNE_T_DEFINED_
117 typedef _BSD_RUNE_T_ rune_t;
118 #endif
119
120 #ifndef __cplusplus
121 #ifndef _BSD_WCHAR_T_DEFINED_
122 #define _BSD_WCHAR_T_DEFINED_
123 #ifdef __WCHAR_TYPE__
124 typedef __WCHAR_TYPE__ wchar_t;
125 #else /* ! __WCHAR_TYPE__ */
126 typedef _BSD_WCHAR_T_ wchar_t;
127 #endif /* __WCHAR_TYPE__ */
128 #endif /* _BSD_WCHAR_T_DEFINED_ */
129 #endif /* __cplusplus */
130
131 #ifndef _BSD_WINT_T_DEFINED_
132 #define _BSD_WINT_T_DEFINED_
133 typedef _BSD_WINT_T_ wint_t;
134 #endif
135
136 #ifndef WEOF
137 #define WEOF ((wint_t)-1)
138 #endif
139
140 #ifndef WCHAR_MIN
141 #define WCHAR_MIN 0
142 #endif
143
144 #ifndef WCHAR_MAX
145 #ifdef __WCHAR_MAX__
146 #define WCHAR_MAX __WCHAR_MAX__
147 #else /* ! __WCHAR_MAX__ */
148 #define WCHAR_MAX 0x7fffffff
149 #endif /* __WCHAR_MAX__ */
150 #endif
151
152 struct __sFILE;
153 struct tm;
154
155 __BEGIN_DECLS
156 wint_t btowc(int);
157 wint_t fgetwc(struct __sFILE *);
158 wchar_t *fgetws(wchar_t * __restrict, int, struct __sFILE * __restrict);
159 wint_t fputwc(wchar_t, struct __sFILE *);
160 int fputws(const wchar_t * __restrict, struct __sFILE * __restrict);
161 int fwide(struct __sFILE *, int);
162 int fwprintf(struct __sFILE * __restrict, const wchar_t * __restrict, ...);
163 int fwscanf(struct __sFILE * __restrict, const wchar_t * __restrict, ...);
164 wint_t getwc(struct __sFILE *);
165 wint_t getwchar(void);
166 size_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict);
167 size_t mbrtowc(wchar_t * __restrict, const char * __restrict, size_t,
168 mbstate_t * __restrict);
169 int mbsinit(const mbstate_t *);
170 size_t mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
171 mbstate_t * __restrict);
172 wint_t putwc(wchar_t, struct __sFILE *);
173 wint_t putwchar(wchar_t);
174 int swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
175 ...);
176 int swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...);
177 wint_t ungetwc(wint_t, struct __sFILE *);
178 int vfwprintf(struct __sFILE * __restrict, const wchar_t * __restrict,
179 _BSD_VA_LIST_);
180 int vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
181 _BSD_VA_LIST_);
182 int vwprintf(const wchar_t * __restrict, _BSD_VA_LIST_);
183 size_t wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict);
184 wchar_t *wcscat(wchar_t * __restrict, const wchar_t * __restrict);
185 wchar_t *wcschr(const wchar_t *, wchar_t);
186 int wcscmp(const wchar_t *, const wchar_t *);
187 int wcscoll(const wchar_t *, const wchar_t *);
188 wchar_t *wcscpy(wchar_t * __restrict, const wchar_t * __restrict);
189 size_t wcscspn(const wchar_t *, const wchar_t *);
190 size_t wcsftime(wchar_t * __restrict, size_t, const wchar_t * __restrict,
191 const struct tm * __restrict);
192 size_t wcslen(const wchar_t *);
193 wchar_t *wcsncat(wchar_t * __restrict, const wchar_t * __restrict, size_t);
194 int wcsncmp(const wchar_t *, const wchar_t *, size_t);
195 wchar_t *wcsncpy(wchar_t * __restrict , const wchar_t * __restrict, size_t);
196 wchar_t *wcspbrk(const wchar_t *, const wchar_t *);
197 wchar_t *wcsrchr(const wchar_t *, wchar_t);
198 size_t wcsrtombs(char * __restrict, const wchar_t ** __restrict, size_t,
199 mbstate_t * __restrict);
200 size_t wcsspn(const wchar_t *, const wchar_t *);
201 wchar_t *wcsstr(const wchar_t * __restrict, const wchar_t * __restrict);
202 size_t wcsxfrm(wchar_t * __restrict, const wchar_t * __restrict, size_t);
203 int wctob(wint_t);
204 double wcstod(const wchar_t * __restrict, wchar_t ** __restrict);
205 wchar_t *wcstok(wchar_t * __restrict, const wchar_t * __restrict,
206 wchar_t ** __restrict);
207 long wcstol(const wchar_t * __restrict, wchar_t ** __restrict, int);
208 unsigned long
209 wcstoul(const wchar_t * __restrict, wchar_t ** __restrict, int);
210 wchar_t *wmemchr(const wchar_t *, wchar_t, size_t);
211 int wmemcmp(const wchar_t *, const wchar_t *, size_t);
212 wchar_t *wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);
213 wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t);
214 wchar_t *wmemset(wchar_t *, wchar_t, size_t);
215 int wprintf(const wchar_t * __restrict, ...);
216 int wscanf(const wchar_t * __restrict, ...);
217
218 #if !defined(_ANSI_SOURCE)
219 int vfwscanf(struct __sFILE * __restrict, const wchar_t * __restrict,
220 _BSD_VA_LIST_);
221 int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict,
222 _BSD_VA_LIST_);
223 int vwscanf(const wchar_t * __restrict, _BSD_VA_LIST_);
224 float wcstof(const wchar_t * __restrict, wchar_t ** __restrict);
225 long double
226 wcstold(const wchar_t * __restrict, wchar_t ** __restrict);
227 long long
228 wcstoll(const wchar_t * __restrict, wchar_t ** __restrict, int);
229 unsigned long long
230 wcstoull(const wchar_t * __restrict, wchar_t ** __restrict, int);
231 int wcswidth(const wchar_t *, size_t);
232 int wcwidth(wchar_t);
233 size_t wcslcat(wchar_t *, const wchar_t *, size_t);
234 size_t wcslcpy(wchar_t *, const wchar_t *, size_t);
235 #endif /* !defined(_ANSI_SOURCE) */
236 __END_DECLS
237
238 #endif /* !_WCHAR_H_ */