wchar.h

Go to the documentation of this file.
00001 /*-
00002  * Copyright (c)1999 Citrus Project,
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  *
00014  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
00015  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00016  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00017  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
00018  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00019  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00020  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00021  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00022  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00023  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00024  * SUCH DAMAGE.
00025  *
00026  * $FreeBSD: src/include/wchar.h,v 1.45 2004/08/12 12:19:10 tjr Exp $
00027  *
00028  * © Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
00029  * © Portions copyright (c) 2007 Symbian Software Ltd. All rights reserved.
00030  */
00031 
00032 /*-
00033  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
00034  * All rights reserved.
00035  *
00036  * This code is derived from software contributed to The NetBSD Foundation
00037  * by Julian Coleman.
00038  *
00039  * Redistribution and use in source and binary forms, with or without
00040  * modification, are permitted provided that the following conditions
00041  * are met:
00042  * 1. Redistributions of source code must retain the above copyright
00043  *    notice, this list of conditions and the following disclaimer.
00044  * 2. Redistributions in binary form must reproduce the above copyright
00045  *    notice, this list of conditions and the following disclaimer in the
00046  *    documentation and/or other materials provided with the distribution.
00047  * 3. All advertising materials mentioning features or use of this software
00048  *    must display the following acknowledgement:
00049  *        This product includes software developed by the NetBSD
00050  *        Foundation, Inc. and its contributors.
00051  * 4. Neither the name of The NetBSD Foundation nor the names of its
00052  *    contributors may be used to endorse or promote products derived
00053  *    from this software without specific prior written permission.
00054  *
00055  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
00056  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
00057  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00058  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
00059  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00060  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00061  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00062  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00063  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00064  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00065  * POSSIBILITY OF SUCH DAMAGE.
00066  *
00067  *      $NetBSD: wchar.h,v 1.8 2000/12/22 05:31:42 itojun Exp $
00068  */
00069 
00070 #ifndef _WCHAR_H_
00071 #define _WCHAR_H_
00072 
00073 #ifdef __cplusplus
00074 extern "C"
00075 {
00076 //__cplusplus
00077 #endif
00078 
00079 #include <sys/cdefs.h>
00080 #include <sys/_null.h>
00081 #include <sys/_types.h>
00082 #include <sys/stat.h>
00083 #include <machine/_limits.h>
00084 #include <_ctype.h>
00085 #include <_ansi.h>
00086 #include <stdio.h>
00087 #include <sys/dirent.h>
00088 #ifdef __SYMBIAN32__
00089 #include <stdarg.h>
00090 //__SYMBIAN32__
00091 #endif
00092 
00093 #ifndef _MBSTATE_T_DECLARED
00094 typedef __mbstate_t     mbstate_t;
00095 #define _MBSTATE_T_DECLARED
00096 #endif
00097 
00098 #ifndef _SIZE_T_DECLARED
00099 typedef __size_t        size_t;
00100 #define _SIZE_T_DECLARED
00101 #endif
00102 
00103 #ifndef __SYMBIAN32__
00104 #ifndef __cplusplus
00105 #ifndef _WCHAR_T_DECLARED
00106 typedef __wchar_t       wchar_t;
00107 #define _WCHAR_T_DECLARED
00108 //_WCHAR_T_DECLARED
00109 #endif
00110 //__cplusplus
00111 #endif
00112 #else //__SYMBIAN32__
00113 #if !defined _WCHAR_T_DECLARED && !defined __wchar_t_defined
00114 typedef unsigned short int wchar_t;
00115 #define _WCHAR_T_DECLARED
00116 //__wchar_t_defined
00117 #endif
00118 //__SYMBIAN32__
00119 #endif
00120 
00121 #ifndef _WINT_T_DECLARED
00122 typedef __wint_t        wint_t;
00123 #define _WINT_T_DECLARED
00124 #endif
00125 
00126 #ifndef WCHAR_MIN 
00127 #define WCHAR_MIN       (wchar_t)__INT_MIN
00128 #define WCHAR_MAX       (wchar_t)__INT_MAX
00129 #endif
00130 
00131 #ifndef WEOF
00132 #define WEOF    ((wint_t)-1)
00133 #endif
00134 
00135 struct __sFILE;
00136 struct tm;
00137 
00138 __BEGIN_DECLS
00139 IMPORT_C wint_t btowc(int);
00140 IMPORT_C wint_t fgetwc(struct __sFILE *);
00141 IMPORT_C wchar_t        *
00142         fgetws(wchar_t * __restrict, int, struct __sFILE * __restrict);
00143 IMPORT_C wint_t fputwc(wchar_t, struct __sFILE *);
00144 IMPORT_C int    fputws(const wchar_t * __restrict, struct __sFILE * __restrict);
00145 IMPORT_C int    fwide(struct __sFILE *, int);
00146 IMPORT_C int    fwprintf(struct __sFILE * __restrict, const wchar_t * __restrict, ...);
00147 IMPORT_C int    fwscanf(struct __sFILE * __restrict, const wchar_t * __restrict, ...);
00148 IMPORT_C wint_t getwc(struct __sFILE *);
00149 IMPORT_C wint_t getwchar(void);
00150 IMPORT_C size_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict);
00151 IMPORT_C size_t mbrtowc(wchar_t * __restrict, const char * __restrict, size_t,
00152             mbstate_t * __restrict);
00153 IMPORT_C int    mbsinit(const mbstate_t *);
00154 IMPORT_C size_t mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
00155             mbstate_t * __restrict);
00156 IMPORT_C wint_t putwc(wchar_t, struct __sFILE *);
00157 IMPORT_C wint_t putwchar(wchar_t);
00158 IMPORT_C int    swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
00159             ...);
00160 IMPORT_C int    swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...);
00161 IMPORT_C wint_t ungetwc(wint_t, struct __sFILE *);
00162 IMPORT_C int    vfwprintf(struct __sFILE * __restrict, const wchar_t * __restrict,
00163             va_list);
00164 IMPORT_C int    vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
00165             va_list);
00166 IMPORT_C int    vwprintf(const wchar_t * __restrict, va_list);
00167 IMPORT_C size_t wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict);
00168 IMPORT_C wchar_t        *wcscat(wchar_t * __restrict, const wchar_t * __restrict);
00169 IMPORT_C wchar_t        *wcschr(const wchar_t *, wchar_t) __pure;
00170 IMPORT_C int    wcscmp(const wchar_t *, const wchar_t *) __pure;
00171 IMPORT_C int    wcscoll(const wchar_t *, const wchar_t *);
00172 IMPORT_C wchar_t        *wcscpy(wchar_t * __restrict, const wchar_t * __restrict);
00173 IMPORT_C size_t wcscspn(const wchar_t *, const wchar_t *) __pure;
00174 IMPORT_C size_t wcsftime(wchar_t * __restrict, size_t, const wchar_t * __restrict,
00175             const struct tm * __restrict);
00176 IMPORT_C size_t wcslen(const wchar_t *) __pure;
00177 IMPORT_C wchar_t        *wcsncat(wchar_t * __restrict, const wchar_t * __restrict,
00178             size_t);
00179 IMPORT_C int    wcsncmp(const wchar_t *, const wchar_t *, size_t) __pure;
00180 IMPORT_C wchar_t        *wcsncpy(wchar_t * __restrict , const wchar_t * __restrict, size_t);
00181 IMPORT_C wchar_t        *wcspbrk(const wchar_t *, const wchar_t *) __pure;
00182 IMPORT_C wchar_t        *wcsrchr(const wchar_t *, wchar_t) __pure;
00183 IMPORT_C size_t wcsrtombs(char * __restrict, const wchar_t ** __restrict, size_t,
00184             mbstate_t * __restrict);
00185 IMPORT_C size_t wcsspn(const wchar_t *, const wchar_t *) __pure;
00186 IMPORT_C wchar_t        *wcsstr(const wchar_t * __restrict, const wchar_t * __restrict)
00187             __pure;
00188 IMPORT_C size_t wcsxfrm(wchar_t * __restrict, const wchar_t * __restrict, size_t);
00189 IMPORT_C int    wctob(wint_t);
00190 IMPORT_C double wcstod(const wchar_t * __restrict, wchar_t ** __restrict);
00191 IMPORT_C wchar_t        *wcstok(wchar_t * __restrict, const wchar_t * __restrict,
00192             wchar_t ** __restrict);
00193 IMPORT_C long    wcstol(const wchar_t * __restrict, wchar_t ** __restrict, int);
00194 IMPORT_C unsigned long
00195          wcstoul(const wchar_t * __restrict, wchar_t ** __restrict, int);
00196 IMPORT_C wchar_t        *wmemchr(const wchar_t *, wchar_t, size_t) __pure;
00197 IMPORT_C int    wmemcmp(const wchar_t *, const wchar_t *, size_t) __pure;
00198 IMPORT_C wchar_t        *wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);
00199 IMPORT_C wchar_t        *wmemmove(wchar_t *, const wchar_t *, size_t);
00200 IMPORT_C wchar_t        *wmemset(wchar_t *, wchar_t, size_t);
00201 IMPORT_C int    wprintf(const wchar_t * __restrict, ...);
00202 IMPORT_C int    wscanf(const wchar_t * __restrict, ...);
00203 #ifdef __SYMBIAN32__
00204 IMPORT_C long long       wcstoq(const wchar_t * __restrict, wchar_t ** __restrict, int);
00205 IMPORT_C unsigned long long wcstouq(const wchar_t * __restrict, wchar_t ** __restrict, int);
00206 IMPORT_C wchar_t *wcswcs(const wchar_t * __restrict s, const wchar_t * __restrict find);
00207 IMPORT_C int wpopen3 (const wchar_t* file, const wchar_t* cmd, wchar_t** env, int fids[3]);
00208 //__SYMBIAN32__
00209 #endif
00210 
00211 #ifndef _STDSTREAM_DECLARED
00212 extern struct __sFILE *__stdinp;
00213 extern struct __sFILE *__stdoutp;
00214 extern struct __sFILE *__stderrp;
00215 #define _STDSTREAM_DECLARED
00216 #endif
00217 
00218 #ifndef __SYMBIAN32__
00219 #define getwc(fp)       fgetwc(fp)
00220 #define getwchar()      fgetwc(__stdinp)
00221 #define putwc(wc, fp)   fputwc(wc, fp)
00222 #define putwchar(wc)    fputwc(wc, __stdoutp)
00223 #else //__SYMBIAN32__
00224 IMPORT_C wint_t getwc(struct __sFILE *);
00225 IMPORT_C wint_t getwchar(void);
00226 IMPORT_C wint_t putwc(wchar_t, struct __sFILE *);
00227 IMPORT_C wint_t putwchar(wchar_t);
00228 //__SYMBIAN32__
00229 #endif
00230 
00231 
00232 #if __ISO_C_VISIBLE >= 1999
00233 IMPORT_C int    vfwscanf(struct __sFILE * __restrict, const wchar_t * __restrict,
00234             va_list);
00235 IMPORT_C int    vswscanf(const wchar_t * __restrict, const wchar_t * __restrict,
00236             va_list);
00237 IMPORT_C int    vwscanf(const wchar_t * __restrict, va_list);
00238 IMPORT_C float  wcstof(const wchar_t * __restrict, wchar_t ** __restrict);
00239 IMPORT_C long double
00240         wcstold(const wchar_t * __restrict, wchar_t ** __restrict);
00241 #ifdef __LONG_LONG_SUPPORTED
00242 /* LONGLONG */
00243 IMPORT_C long long
00244         wcstoll(const wchar_t * __restrict, wchar_t ** __restrict, int);
00245 /* LONGLONG */
00246 IMPORT_C unsigned long long
00247          wcstoull(const wchar_t * __restrict, wchar_t ** __restrict, int);
00248 #endif
00249 #endif  /* __ISO_C_VISIBLE >= 1999 */
00250 
00251 #if __XSI_VISIBLE
00252 IMPORT_C int    wcswidth(const wchar_t *, size_t);
00253 IMPORT_C int    wcwidth(wchar_t);
00254 #ifndef __SYMBIAN32__
00255 #define wcwidth(_c)     __wcwidth(_c)
00256 //__SYMBIAN32__
00257 #endif
00258 #endif
00259 
00260 #if __BSD_VISIBLE
00261 
00262 #ifdef __SYMBIAN_COMPILE_UNUSED__
00263 wchar_t *fgetwln(struct __sFILE * __restrict, size_t * __restrict);
00264 #endif
00265 
00266 IMPORT_C size_t mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
00267             size_t, mbstate_t * __restrict);
00268 IMPORT_C size_t wcsnrtombs(char * __restrict, const wchar_t ** __restrict, size_t,
00269             size_t, mbstate_t * __restrict);
00270 #endif
00271 #ifdef __SYMBIAN32__
00272 IMPORT_C wchar_t *wcpcpy(wchar_t *dst, const wchar_t *src);
00273 IMPORT_C wchar_t *wcpncpy(wchar_t * dst, const wchar_t * src, size_t n);
00274 IMPORT_C int wcscasecmp(const wchar_t *s1, const wchar_t *s2);
00275 IMPORT_C wchar_t *wcsdup (const wchar_t *srcwcs);
00276 IMPORT_C int wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n);
00277 IMPORT_C size_t wcsnlen(const wchar_t *s, size_t maxlen);
00278 
00279 IMPORT_C wchar_t* wrealpath (const wchar_t* , wchar_t* );
00280 IMPORT_C int wrmdir (const wchar_t *);
00281 IMPORT_C int wstat (const wchar_t *name, struct stat *st);
00282 IMPORT_C int wsystem (const wchar_t* );
00283 IMPORT_C int wunlink (const wchar_t *);
00284 IMPORT_C FILE* wpopen( const wchar_t* command, const wchar_t* mode );
00285 
00286 IMPORT_C int wopen(const wchar_t *, int, ...);
00287 IMPORT_C FILE   *wfopen(const wchar_t * __restrict,     const wchar_t * __restrict);
00288 IMPORT_C int wrename (const wchar_t *oldpath, const wchar_t *newpath);
00289 IMPORT_C int wchdir (const wchar_t *_path);
00290 IMPORT_C int wchmod (const wchar_t *_path, mode_t _mode);
00291 IMPORT_C  wchar_t* wgetcwd (wchar_t *_buf, size_t _size);
00292 IMPORT_C int wmkdir (const wchar_t *_path, mode_t _mode);
00293 IMPORT_C int wclosedir (WDIR *dp);
00294 IMPORT_C struct wdirent *wreaddir (WDIR *dp);
00295 IMPORT_C void wrewinddir (WDIR *dp);
00296 IMPORT_C int waccess(const wchar_t *fn, int flags);
00297 IMPORT_C int wcreat(const wchar_t* file, mode_t mode);
00298 IMPORT_C void wseekdir(WDIR *dp,off_t index);
00299 IMPORT_C  off_t wtelldir(const WDIR *dp);
00300 IMPORT_C WDIR *wopendir (const wchar_t *_path);
00301 
00302 #define _wcsupr(wcs)                                            wcsupr(wcs)
00303 #define _wcslwr(wcs)                                            wcslwr(wcs)
00304 #define _wcsset(wcs, wc)                                wcsset(wcs,wc)
00305 #define _wcsnset(wcs, wc, size)         wcsnset(wcs, wc, size)
00306 #define _wcsrev(wcs)                                            wcsrev(wcs)
00307 #define _wcsicmp(wcs1, wcs2)            wcsicmp(wcs1, wcs2)
00308 #define _wstrdate(datestr)                      wstrdate(datestr)
00309 #define _wstrtime(timestr)                      wstrtime(timestr)
00310 
00311 IMPORT_C wchar_t* wcsupr(wchar_t *wcs);
00312 IMPORT_C wchar_t* wcslwr(wchar_t *wcs);
00313 IMPORT_C wchar_t* wcsset (wchar_t* wcs, wchar_t wc);
00314 IMPORT_C wchar_t* wcsnset (wchar_t* wcs, wchar_t wc, size_t maxSize);
00315 IMPORT_C wchar_t* wcsrev(wchar_t *wcs);
00316 IMPORT_C int wcsicmp(const wchar_t* wcs1,const wchar_t * wcs2);
00317 IMPORT_C wchar_t* wstrdate( const wchar_t *dateStr );
00318 IMPORT_C wchar_t* wstrtime(const wchar_t *timeStr);
00319 IMPORT_C FILE * wfdopen (int fd, const wchar_t *mode);
00320 IMPORT_C FILE * wfreopen(const wchar_t * file,const wchar_t * mode,FILE *fp);   
00321 IMPORT_C wchar_t* getws(wchar_t* str);
00322 IMPORT_C int wremove(const wchar_t *file);
00323 IMPORT_C int putws(wchar_t* str);
00324 
00325 struct _wfinddata_t 
00326 {
00327     unsigned    attrib;
00328     time_t      time_create;    /* -1 for symbian */
00329     time_t      time_access;    /* -1 for symbian*/
00330     time_t      time_write;
00331     size_t      size;
00332     wchar_t     name[260];
00333 };
00334 
00335 #define _A_ARCH   0x0020                //Archive. Set whenever the file is changed and cleared by the BACKUP command. Value: 0x20.
00336 #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.
00337 #define _A_NORMAL 0x0000        //Normal. File has no other attributes set and can be read or written to without restriction. Value: 0x00.
00338 #define _A_RDONLY 0x0001                //Read-only. File cannot be opened for writing and a file with the same name cannot be created. Value: 0x01.
00339 #define _A_SYSTEM  0x0004               //System file. Not normally seen with the DIR command, unless the /A or /A:S option is used
00340 
00341 IMPORT_C size_t wcslcat(wchar_t *, const wchar_t *, size_t);
00342 IMPORT_C size_t  wcslcpy(wchar_t *, const wchar_t *, size_t);
00343 IMPORT_C wchar_t *wasctime(const struct tm *);
00344 IMPORT_C wchar_t *wctime(const time_t *);
00345 IMPORT_C wchar_t *wsetlocale(int, const wchar_t *);
00346 IMPORT_C void wperror(const wchar_t *);
00347 IMPORT_C wchar_t*       wcserror(int num);
00348 IMPORT_C int wfindnext(intptr_t, struct _wfinddata_t *); 
00349 IMPORT_C intptr_t wfindfirst(const wchar_t* , struct _wfinddata_t* );
00350 IMPORT_C        int findclose( intptr_t handle);
00351 
00352 #define snwprintf swprintf
00353 #define vsnwprintf vswprintf
00354 
00355 IMPORT_C int wcsnicmp (const wchar_t *wcs1, const wchar_t *wcs2, size_t n);
00356 IMPORT_C int wcsicoll(const wchar_t *wcs1, const wchar_t *wcs2);
00357 IMPORT_C int wcsncoll(const wchar_t* wcs1, const wchar_t* wcs2, size_t n);
00358 IMPORT_C int wcsnicoll(const wchar_t* wcs1, const wchar_t* wcs2, size_t n);
00359 IMPORT_C wchar_t* wtmpnam(wchar_t *s);
00360 
00361 //__SYMBIAN32__
00362 #endif
00363 __END_DECLS
00364 
00365 #ifdef __cplusplus
00366 }
00367 //__cplusplus
00368 #endif
00369 #endif /* !_WCHAR_H_ */

Copyright © Nokia Corporation 2001-2008
Back to top