2 * Copyright (c)1999 Citrus Project,
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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
26 * $FreeBSD: src/include/wchar.h,v 1.45 2004/08/12 12:19:10 tjr Exp $
28 * © Portions copyright (c) 2006 Nokia Corporation. All rights reserved.
29 * © Portions copyright (c) 2007 Symbian Software Ltd. All rights reserved.
33 * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
34 * All rights reserved.
36 * This code is derived from software contributed to The NetBSD Foundation
39 * Redistribution and use in source and binary forms, with or without
40 * modification, are permitted provided that the following conditions
42 * 1. Redistributions of source code must retain the above copyright
43 * notice, this list of conditions and the following disclaimer.
44 * 2. Redistributions in binary form must reproduce the above copyright
45 * notice, this list of conditions and the following disclaimer in the
46 * documentation and/or other materials provided with the distribution.
47 * 4. Neither the name of The NetBSD Foundation nor the names of its
48 * contributors may be used to endorse or promote products derived
49 * from this software without specific prior written permission.
51 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
52 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
53 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
54 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
55 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
56 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
57 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
58 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
59 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
60 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
61 * POSSIBILITY OF SUCH DAMAGE.
63 * $NetBSD: wchar.h,v 1.8 2000/12/22 05:31:42 itojun Exp $
74 #include <sys/cdefs.h>
75 #include <sys/_null.h>
76 #include <sys/_types.h>
78 #include <machine/_limits.h>
82 #include <sys/dirent.h>
85 #endif //__SYMBIAN32__
87 #ifndef _MBSTATE_T_DECLARED
88 typedef __mbstate_t mbstate_t;
89 #define _MBSTATE_T_DECLARED
92 #ifndef _SIZE_T_DECLARED
93 typedef __size_t size_t;
94 #define _SIZE_T_DECLARED
99 #ifndef _WCHAR_T_DECLARED
100 typedef __wchar_t wchar_t;
101 #define _WCHAR_T_DECLARED
102 #endif //_WCHAR_T_DECLARED
104 #else //__SYMBIAN32__
105 //C++ built-in wchar data type which doesn't clash with the definition of wchar
106 #if !defined _WCHAR_T_DECLARED && defined __cplusplus && defined __WINSCW__
107 #if __option(wchar_type)
108 #define _WCHAR_T_DECLARED
109 #endif //__option (wchar_type)
112 #if !defined _WCHAR_T_DECLARED && !defined __wchar_t_defined
113 #if defined __cplusplus
114 #if defined __WINSCW__
115 typedef unsigned short int wchar_t;
116 #define _WCHAR_T_DECLARED
119 typedef unsigned short int wchar_t;
120 #define _WCHAR_T_DECLARED
121 #endif // __cplusplus
122 #endif // __wchar_t_defined
123 #endif //__SYMBIAN32__
125 #ifndef _WINT_T_DECLARED
126 typedef __wint_t wint_t;
127 #define _WINT_T_DECLARED
131 #define WCHAR_MIN (wchar_t)__INT_MIN
132 #define WCHAR_MAX (wchar_t)__INT_MAX
136 #define WEOF ((wint_t)-1)
143 IMPORT_C wint_t btowc(int);
144 IMPORT_C wint_t fgetwc(struct __sFILE *);
146 fgetws(wchar_t * __restrict, int, struct __sFILE * __restrict);
147 IMPORT_C wint_t fputwc(wchar_t, struct __sFILE *);
148 IMPORT_C int fputws(const wchar_t * __restrict, struct __sFILE * __restrict);
149 IMPORT_C int fwide(struct __sFILE *, int);
150 IMPORT_C int fwprintf(struct __sFILE * __restrict, const wchar_t * __restrict, ...);
151 IMPORT_C int fwscanf(struct __sFILE * __restrict, const wchar_t * __restrict, ...);
152 IMPORT_C wint_t getwc(struct __sFILE *);
153 IMPORT_C wint_t getwchar(void);
154 IMPORT_C size_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict);
155 IMPORT_C size_t mbrtowc(wchar_t * __restrict, const char * __restrict, size_t,
156 mbstate_t * __restrict);
157 IMPORT_C int mbsinit(const mbstate_t *);
158 IMPORT_C size_t mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
159 mbstate_t * __restrict);
160 IMPORT_C wint_t putwc(wchar_t, struct __sFILE *);
161 IMPORT_C wint_t putwchar(wchar_t);
162 IMPORT_C int swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
164 IMPORT_C int swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...);
165 IMPORT_C wint_t ungetwc(wint_t, struct __sFILE *);
166 IMPORT_C int vfwprintf(struct __sFILE * __restrict, const wchar_t * __restrict,
168 IMPORT_C int vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
170 IMPORT_C int vwprintf(const wchar_t * __restrict, va_list);
171 IMPORT_C size_t wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict);
172 IMPORT_C wchar_t *wcscat(wchar_t * __restrict, const wchar_t * __restrict);
173 IMPORT_C wchar_t *wcschr(const wchar_t *, wchar_t) __pure;
174 IMPORT_C int wcscmp(const wchar_t *, const wchar_t *) __pure;
175 IMPORT_C int wcscoll(const wchar_t *, const wchar_t *);
176 IMPORT_C wchar_t *wcscpy(wchar_t * __restrict, const wchar_t * __restrict);
177 IMPORT_C size_t wcscspn(const wchar_t *, const wchar_t *) __pure;
178 IMPORT_C size_t wcsftime(wchar_t * __restrict, size_t, const wchar_t * __restrict,
179 const struct tm * __restrict);
180 IMPORT_C size_t wcslen(const wchar_t *) __pure;
181 IMPORT_C wchar_t *wcsncat(wchar_t * __restrict, const wchar_t * __restrict,
183 IMPORT_C int wcsncmp(const wchar_t *, const wchar_t *, size_t) __pure;
184 IMPORT_C wchar_t *wcsncpy(wchar_t * __restrict , const wchar_t * __restrict, size_t);
185 IMPORT_C wchar_t *wcspbrk(const wchar_t *, const wchar_t *) __pure;
186 IMPORT_C wchar_t *wcsrchr(const wchar_t *, wchar_t) __pure;
187 IMPORT_C size_t wcsrtombs(char * __restrict, const wchar_t ** __restrict, size_t,
188 mbstate_t * __restrict);
189 IMPORT_C size_t wcsspn(const wchar_t *, const wchar_t *) __pure;
190 IMPORT_C wchar_t *wcsstr(const wchar_t * __restrict, const wchar_t * __restrict)
192 IMPORT_C size_t wcsxfrm(wchar_t * __restrict, const wchar_t * __restrict, size_t);
193 IMPORT_C int wctob(wint_t);
194 IMPORT_C double wcstod(const wchar_t * __restrict, wchar_t ** __restrict);
195 IMPORT_C wchar_t *wcstok(wchar_t * __restrict, const wchar_t * __restrict,
196 wchar_t ** __restrict);
197 IMPORT_C long wcstol(const wchar_t * __restrict, wchar_t ** __restrict, int);
198 IMPORT_C unsigned long
199 wcstoul(const wchar_t * __restrict, wchar_t ** __restrict, int);
200 IMPORT_C wchar_t *wmemchr(const wchar_t *, wchar_t, size_t) __pure;
201 IMPORT_C int wmemcmp(const wchar_t *, const wchar_t *, size_t) __pure;
202 IMPORT_C wchar_t *wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);
203 IMPORT_C wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t);
204 IMPORT_C wchar_t *wmemset(wchar_t *, wchar_t, size_t);
205 IMPORT_C int wprintf(const wchar_t * __restrict, ...);
206 IMPORT_C int wscanf(const wchar_t * __restrict, ...);
208 IMPORT_C long long wcstoq(const wchar_t * __restrict, wchar_t ** __restrict, int);
209 IMPORT_C unsigned long long wcstouq(const wchar_t * __restrict, wchar_t ** __restrict, int);
210 IMPORT_C wchar_t *wcswcs(const wchar_t * __restrict s, const wchar_t * __restrict find);
211 IMPORT_C int wpopen3 (const wchar_t* file, const wchar_t* cmd, wchar_t** env, int fids[3]);
212 #endif //__SYMBIAN32__
214 #ifndef _STDSTREAM_DECLARED
215 extern struct __sFILE *__stdinp;
216 extern struct __sFILE *__stdoutp;
217 extern struct __sFILE *__stderrp;
218 #define _STDSTREAM_DECLARED
221 #ifndef __SYMBIAN32__
222 #define getwc(fp) fgetwc(fp)
223 #define getwchar() fgetwc(__stdinp)
224 #define putwc(wc, fp) fputwc(wc, fp)
225 #define putwchar(wc) fputwc(wc, __stdoutp)
226 #else //__SYMBIAN32__
227 IMPORT_C wint_t getwc(struct __sFILE *);
228 IMPORT_C wint_t getwchar(void);
229 IMPORT_C wint_t putwc(wchar_t, struct __sFILE *);
230 IMPORT_C wint_t putwchar(wchar_t);
231 #endif //__SYMBIAN32__
234 #if __ISO_C_VISIBLE >= 1999
235 IMPORT_C int vfwscanf(struct __sFILE * __restrict, const wchar_t * __restrict,
237 IMPORT_C int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict,
239 IMPORT_C int vwscanf(const wchar_t * __restrict, va_list);
240 IMPORT_C float wcstof(const wchar_t * __restrict, wchar_t ** __restrict);
242 wcstold(const wchar_t * __restrict, wchar_t ** __restrict);
243 #ifdef __LONG_LONG_SUPPORTED
246 wcstoll(const wchar_t * __restrict, wchar_t ** __restrict, int);
248 IMPORT_C unsigned long long
249 wcstoull(const wchar_t * __restrict, wchar_t ** __restrict, int);
251 #endif /* __ISO_C_VISIBLE >= 1999 */
254 IMPORT_C int wcswidth(const wchar_t *, size_t);
255 IMPORT_C int wcwidth(wchar_t);
256 #ifndef __SYMBIAN32__
257 #define wcwidth(_c) __wcwidth(_c)
258 #endif //__SYMBIAN32__
263 #ifdef __SYMBIAN_COMPILE_UNUSED__
264 wchar_t *fgetwln(struct __sFILE * __restrict, size_t * __restrict);
267 IMPORT_C size_t mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
268 size_t, mbstate_t * __restrict);
269 IMPORT_C size_t wcsnrtombs(char * __restrict, const wchar_t ** __restrict, size_t,
270 size_t, mbstate_t * __restrict);
273 IMPORT_C wchar_t *wcpcpy(wchar_t *dst, const wchar_t *src);
274 IMPORT_C wchar_t *wcpncpy(wchar_t * dst, const wchar_t * src, size_t n);
275 IMPORT_C int wcscasecmp(const wchar_t *s1, const wchar_t *s2);
276 IMPORT_C wchar_t *wcsdup (const wchar_t *srcwcs);
277 IMPORT_C int wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n);
278 IMPORT_C size_t wcsnlen(const wchar_t *s, size_t maxlen);
280 IMPORT_C wchar_t* wrealpath (const wchar_t* , wchar_t* );
281 IMPORT_C int wrmdir (const wchar_t *);
282 IMPORT_C int wstat (const wchar_t *name, struct stat *st);
283 IMPORT_C int wsystem (const wchar_t* );
284 IMPORT_C int wunlink (const wchar_t *);
285 IMPORT_C FILE* wpopen( const wchar_t* command, const wchar_t* mode );
287 IMPORT_C int wopen(const wchar_t *, int, ...);
288 IMPORT_C FILE *wfopen(const wchar_t * __restrict, const wchar_t * __restrict);
289 IMPORT_C int wrename (const wchar_t *oldpath, const wchar_t *newpath);
290 IMPORT_C int wchdir (const wchar_t *_path);
291 IMPORT_C int wchmod (const wchar_t *_path, mode_t _mode);
292 IMPORT_C wchar_t* wgetcwd (wchar_t *_buf, size_t _size);
293 IMPORT_C int wmkdir (const wchar_t *_path, mode_t _mode);
294 IMPORT_C int wclosedir (WDIR *dp);
295 IMPORT_C struct wdirent *wreaddir (WDIR *dp);
296 IMPORT_C void wrewinddir (WDIR *dp);
297 IMPORT_C int waccess(const wchar_t *fn, int flags);
298 IMPORT_C int wcreat(const wchar_t* file, mode_t mode);
299 IMPORT_C void wseekdir(WDIR *dp,off_t index);
300 IMPORT_C off_t wtelldir(const WDIR *dp);
301 IMPORT_C WDIR *wopendir (const wchar_t *_path);
303 #define _wcsupr(wcs) wcsupr(wcs)
304 #define _wcslwr(wcs) wcslwr(wcs)
305 #define _wcsset(wcs, wc) wcsset(wcs,wc)
306 #define _wcsnset(wcs, wc, size) wcsnset(wcs, wc, size)
307 #define _wcsrev(wcs) wcsrev(wcs)
308 #define _wcsicmp(wcs1, wcs2) wcsicmp(wcs1, wcs2)
309 #define _wstrdate(datestr) wstrdate(datestr)
310 #define _wstrtime(timestr) wstrtime(timestr)
312 IMPORT_C wchar_t* wcsupr(wchar_t *wcs);
313 IMPORT_C wchar_t* wcslwr(wchar_t *wcs);
314 IMPORT_C wchar_t* wcsset (wchar_t* wcs, wchar_t wc);
315 IMPORT_C wchar_t* wcsnset (wchar_t* wcs, wchar_t wc, size_t maxSize);
316 IMPORT_C wchar_t* wcsrev(wchar_t *wcs);
317 IMPORT_C int wcsicmp(const wchar_t* wcs1,const wchar_t * wcs2);
318 IMPORT_C wchar_t* wstrdate( const wchar_t *dateStr );
319 IMPORT_C wchar_t* wstrtime(const wchar_t *timeStr);
320 IMPORT_C FILE * wfdopen (int fd, const wchar_t *mode);
321 IMPORT_C FILE * wfreopen(const wchar_t * file,const wchar_t * mode,FILE *fp);
322 IMPORT_C wchar_t* getws(wchar_t* str);
323 IMPORT_C int wremove(const wchar_t *file);
324 IMPORT_C int putws(wchar_t* str);
329 time_t time_create; /* -1 for symbian */
330 time_t time_access; /* -1 for symbian*/
336 #define _A_ARCH 0x0020 //Archive. Set whenever the file is changed and cleared by the BACKUP command. Value: 0x20.
337 #define _A_HIDDEN 0x0002 //Hidden file. Not normally seen with the DIR command, unless the /AH option is used. Returns information about normal files and files with this attribute. Value: 0x02.
338 #define _A_NORMAL 0x0000 //Normal. File has no other attributes set and can be read or written to without restriction. Value: 0x00.
339 #define _A_RDONLY 0x0001 //Read-only. File cannot be opened for writing and a file with the same name cannot be created. Value: 0x01.
340 #define _A_SYSTEM 0x0004 //System file. Not normally seen with the DIR command, unless the /A or /A:S option is used
342 IMPORT_C size_t wcslcat(wchar_t *, const wchar_t *, size_t);
343 IMPORT_C size_t wcslcpy(wchar_t *, const wchar_t *, size_t);
344 IMPORT_C wchar_t *wasctime(const struct tm *);
345 IMPORT_C wchar_t *wctime(const time_t *);
346 IMPORT_C wchar_t *wsetlocale(int, const wchar_t *);
347 IMPORT_C void wperror(const wchar_t *);
348 IMPORT_C wchar_t* wcserror(int num);
349 IMPORT_C int wfindnext(intptr_t, struct _wfinddata_t *);
350 IMPORT_C intptr_t wfindfirst(const wchar_t* , struct _wfinddata_t* );
351 IMPORT_C int findclose( intptr_t handle);
353 #define snwprintf swprintf
354 #define vsnwprintf vswprintf
356 IMPORT_C int wcsnicmp (const wchar_t *wcs1, const wchar_t *wcs2, size_t n);
357 IMPORT_C int wcsicoll(const wchar_t *wcs1, const wchar_t *wcs2);
358 IMPORT_C int wcsncoll(const wchar_t* wcs1, const wchar_t* wcs2, size_t n);
359 IMPORT_C int wcsnicoll(const wchar_t* wcs1, const wchar_t* wcs2, size_t n);
360 IMPORT_C wchar_t* wtmpnam(wchar_t *s);
362 #endif //__SYMBIAN32__
368 #endif /* !_WCHAR_H_ */