make includes fix from trunk
[minix.git] / include / wchar.h
blobb40962c93f9e048bfca2a0cc686734e79817051c
1 /*-
2 * Copyright (c)1999 Citrus Project,
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
27 /*-
28 * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
29 * All rights reserved.
31 * This code is derived from software contributed to The NetBSD Foundation
32 * by Julian Coleman.
34 * Redistribution and use in source and binary forms, with or without
35 * modification, are permitted provided that the following conditions
36 * are met:
37 * 1. Redistributions of source code must retain the above copyright
38 * notice, this list of conditions and the following disclaimer.
39 * 2. Redistributions in binary form must reproduce the above copyright
40 * notice, this list of conditions and the following disclaimer in the
41 * documentation and/or other materials provided with the distribution.
43 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
44 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
45 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
46 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
47 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
48 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
49 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
50 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
51 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
52 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
53 * POSSIBILITY OF SUCH DAMAGE.
56 #ifndef _WCHAR_H_
57 #define _WCHAR_H_
59 #include <ansi.h>
60 #include <stdarg.h>
62 #include <stdio.h> /* for FILE* */
64 /* mbstate_t is an opaque object to keep conversion state in wide-char
65 * conversion. Do not refer to the contents in user programs.
66 * (Based on NETBSD implementation.)
68 typedef union {
69 long int __mbstateL; /* For alignment. NETBSD uses int64_t. */
70 char __mbstate8[128];
71 } __mbstate_t;
73 #ifndef _WCHAR_T
74 #define _WCHAR_T
75 typedef int wchar_t;
76 #endif
78 #ifndef _MBSTATE_T
79 #define _MBSTATE_T
80 typedef __mbstate_t mbstate_t;
81 #define _GLIBCXX_HAVE_MBSTATE_T 1
82 #endif
84 #ifndef _WINT_T
85 #define _WINT_T
86 typedef int wint_t;
87 #endif
90 #ifndef _SIZE_T
91 #define _SIZE_T
92 typedef unsigned int size_t; /* type returned by sizeof */
93 #endif
95 struct tm;
97 #ifdef __ACK__
98 #define __restrict
99 #endif
101 wint_t btowc(int);
102 size_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict);
103 size_t mbrtowc(wchar_t * __restrict, const char * __restrict, size_t,
104 mbstate_t * __restrict);
105 int mbsinit(const mbstate_t *);
106 size_t mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
107 mbstate_t * __restrict);
108 size_t wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict);
109 wchar_t *wcscat(wchar_t * __restrict, const wchar_t * __restrict);
110 wchar_t *wcschr(const wchar_t *, wchar_t);
111 int wcscmp(const wchar_t *, const wchar_t *);
112 int wcscoll(const wchar_t *, const wchar_t *);
113 wchar_t *wcscpy(wchar_t * __restrict, const wchar_t * __restrict);
114 size_t wcscspn(const wchar_t *, const wchar_t *);
115 size_t wcsftime(wchar_t * __restrict, size_t, const wchar_t * __restrict,
116 const struct tm * __restrict);
117 size_t wcslen(const wchar_t *);
118 wchar_t *wcsncat(wchar_t * __restrict, const wchar_t * __restrict, size_t);
119 int wcsncmp(const wchar_t *, const wchar_t *, size_t);
120 wchar_t *wcsncpy(wchar_t * __restrict , const wchar_t * __restrict, size_t);
121 wchar_t *wcspbrk(const wchar_t *, const wchar_t *);
122 wchar_t *wcsrchr(const wchar_t *, wchar_t);
123 size_t wcsrtombs(char * __restrict, const wchar_t ** __restrict, size_t,
124 mbstate_t * __restrict);
125 size_t wcsspn(const wchar_t *, const wchar_t *);
126 wchar_t *wcsstr(const wchar_t *, const wchar_t *);
127 wchar_t *wcstok(wchar_t * __restrict, const wchar_t * __restrict,
128 wchar_t ** __restrict);
129 size_t wcsxfrm(wchar_t *, const wchar_t *, size_t);
130 wchar_t *wcswcs(const wchar_t *, const wchar_t *);
131 wchar_t *wmemchr(const wchar_t *, wchar_t, size_t);
132 int wmemcmp(const wchar_t *, const wchar_t *, size_t);
133 wchar_t *wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);
134 wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t);
135 wchar_t *wmemset(wchar_t *, wchar_t, size_t);
137 size_t wcslcat(wchar_t *, const wchar_t *, size_t);
138 size_t wcslcpy(wchar_t *, const wchar_t *, size_t);
139 int wcswidth(const wchar_t *, size_t);
140 int wctob(wint_t);
141 int wcwidth(wchar_t);
143 unsigned long int wcstoul(const wchar_t * __restrict,
144 wchar_t ** __restrict, int);
145 long int wcstol(const wchar_t * __restrict,
146 wchar_t ** __restrict, int);
147 double wcstod(const wchar_t * __restrict, wchar_t ** __restrict);
149 #if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) > 199901L || \
150 defined(_NETBSD_SOURCE)
151 float wcstof(const wchar_t * __restrict, wchar_t ** __restrict);
152 long double wcstold(const wchar_t * __restrict, wchar_t ** __restrict);
154 /* LONGLONG */
155 long long int wcstoll(const wchar_t * __restrict,
156 wchar_t ** __restrict, int);
157 /* LONGLONG */
158 unsigned long long int wcstoull(const wchar_t * __restrict,
159 wchar_t ** __restrict, int);
160 #endif
162 wint_t ungetwc(wint_t, FILE *);
163 wint_t fgetwc(FILE *);
164 wchar_t *fgetws(wchar_t * __restrict, int, FILE * __restrict);
165 wint_t getwc(FILE *);
166 wint_t getwchar(void);
167 wint_t fputwc(wchar_t, FILE *);
168 int fputws(const wchar_t * __restrict, FILE * __restrict);
169 wint_t putwc(wchar_t, FILE *);
170 wint_t putwchar(wchar_t);
172 int fwide(FILE *, int);
174 wchar_t *fgetwln(FILE * __restrict, size_t * __restrict);
175 int fwprintf(FILE * __restrict, const wchar_t * __restrict, ...);
176 int fwscanf(FILE * __restrict, const wchar_t * __restrict, ...);
177 int swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict, ...);
178 int swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...);
179 int vfwprintf(FILE * __restrict, const wchar_t * __restrict, va_list);
180 int vswprintf(wchar_t * __restrict, size_t, const wchar_t * __restrict,
181 va_list);
182 int vwprintf(const wchar_t * __restrict, va_list);
183 int wprintf(const wchar_t * __restrict, ...);
184 int wscanf(const wchar_t * __restrict, ...);
185 #if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) > 199901L || \
186 defined(_NETBSD_SOURCE)
187 int vfwscanf(FILE * __restrict, const wchar_t * __restrict, va_list);
188 int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict,
189 va_list);
190 int vwscanf(const wchar_t * __restrict, va_list);
191 #endif
192 #if defined(_NETBSD_SOURCE)
193 struct tinfo;
194 int t_putws(struct tinfo *, const wchar_t *, int, void (*)(wchar_t, void *),
195 void *);
196 wchar_t *wcsdup (const wchar_t *);
197 int wcsncasecmp (const wchar_t *, const wchar_t *, size_t);
198 int wcscasecmp(const wchar_t *, const wchar_t *);
199 #endif
201 #ifndef WEOF
202 #define WEOF ((wint_t)-1)
203 #endif
205 #define getwc(f) fgetwc(f)
206 #define getwchar() getwc(stdin)
207 #define putwc(wc, f) fputwc((wc), (f))
208 #define putwchar(wc) putwc((wc), stdout)
210 #endif /* !_WCHAR_H_ */