home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 14 / hacker14.iso / programacao / cwin / c.exe / $INSTDIR / include / wchar.h < prev    next >
Encoding:
C/C++ Source or Header  |  2003-12-15  |  9.6 KB  |  320 lines

  1. /*
  2.  * wchar.h
  3.  *
  4.  * Defines of all functions for supporting wide characters. Actually it
  5.  * just includes all those headers, which is not a good thing to do from a
  6.  * processing time point of view, but it does mean that everything will be
  7.  * in sync.
  8.  *
  9.  * This file is part of the Mingw32 package.
  10.  *
  11.  *  THIS SOFTWARE IS NOT COPYRIGHTED
  12.  *
  13.  *  This source code is offered for use in the public domain. You may
  14.  *  use, modify or distribute it freely.
  15.  *
  16.  *  This code is distributed in the hope that it will be useful but
  17.  *  WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
  18.  *  DISCLAIMED. This includes but is not limited to warranties of
  19.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  20.  *
  21.  * $Revision: 1.8 $
  22.  * $Author: earnie $
  23.  * $Date: 2002/12/20 13:35:27 $
  24.  *
  25.  */
  26.  
  27. #ifndef    _WCHAR_H_
  28. #define    _WCHAR_H_
  29.  
  30. /* All the headers include this file. */
  31. #include <_mingw.h>
  32.  
  33. #include <ctype.h>
  34. #include <stdio.h>
  35. #include <stdlib.h>
  36. #include <string.h>
  37. #include <time.h>
  38. #include <sys/types.h>
  39.  
  40. #define __need_size_t
  41. #define __need_wint_t
  42. #define __need_wchar_t
  43. #ifndef RC_INVOKED
  44. #include <stddef.h>
  45. #endif /* Not RC_INVOKED */
  46.  
  47. #define WCHAR_MIN    0
  48. #define WCHAR_MAX    ((wchar_t)-1)
  49.  
  50. #ifndef RC_INVOKED
  51.  
  52. #ifdef __cplusplus 
  53. extern "C" {
  54. #endif
  55.  
  56. #ifndef    __STRICT_ANSI__
  57.  
  58. #ifndef    _FSIZE_T_DEFINED
  59. typedef    unsigned long    _fsize_t;
  60. #define _FSIZE_T_DEFINED
  61. #endif
  62.  
  63. #ifndef _WFINDDATA_T_DEFINED
  64. struct _wfinddata_t {
  65.         unsigned    attrib;
  66.         time_t        time_create;    /* -1 for FAT file systems */
  67.         time_t        time_access;    /* -1 for FAT file systems */
  68.         time_t        time_write;
  69.         _fsize_t    size;
  70.         wchar_t        name[FILENAME_MAX];    /* may include spaces. */
  71. };
  72. struct _wfinddatai64_t {
  73.     unsigned    attrib;
  74.     time_t      time_create;
  75.     time_t      time_access;
  76.     time_t      time_write;
  77.     __int64     size;
  78.     wchar_t     name[FILENAME_MAX];
  79. };
  80. #define _WFINDDATA_T_DEFINED
  81. #endif
  82.  
  83. /* Wide character versions. Also defined in io.h. */
  84. /* CHECK: I believe these only exist in MSVCRT, and not in CRTDLL. Also
  85.    applies to other wide character versions? */
  86. #if !defined (_WIO_DEFINED)
  87. #if defined (__MSVCRT__)
  88. int     _waccess (const wchar_t*, int);
  89. int    _wchmod (const wchar_t*, int);
  90. int    _wcreat (const wchar_t*, int);
  91. long    _wfindfirst (const wchar_t*, struct _wfinddata_t *);
  92. int    _wfindnext (long, struct _wfinddata_t *);
  93. int    _wunlink (const wchar_t*);
  94. int    _wopen (const wchar_t*, int, ...);
  95. int    _wsopen (const wchar_t*, int, int, ...);
  96. wchar_t* _wmktemp (wchar_t*);
  97. long    _wfindfirsti64 (const wchar_t*, struct _wfinddatai64_t*);
  98. int     _wfindnexti64 (long, struct _wfinddatai64_t*);
  99. #endif /* defined (__MSVCRT__) */
  100. #define _WIO_DEFINED
  101. #endif /* _WIO_DEFINED */
  102.  
  103. #ifndef _WSTDIO_DEFINED
  104. /* also in stdio.h - keep in sync */
  105. int    fwprintf (FILE*, const wchar_t*, ...);
  106. int    wprintf (const wchar_t*, ...);
  107. int    swprintf (wchar_t*, const wchar_t*, ...);
  108. int    _snwprintf (wchar_t*, size_t, const wchar_t*, ...);
  109. int    vfwprintf (FILE*, const wchar_t*, va_list);
  110. int    vwprintf (const wchar_t*, va_list);
  111. int    vswprintf (wchar_t*, const wchar_t*, va_list);
  112. int    _vsnwprintf (wchar_t*, size_t, const wchar_t*, va_list);
  113. int    fwscanf (FILE*, const wchar_t*, ...);
  114. int    wscanf (const wchar_t*, ...);
  115. int    swscanf (const wchar_t*, const wchar_t*, ...);
  116. wint_t    fgetwc (FILE*);
  117. wint_t    fputwc (wchar_t, FILE*);
  118. wint_t    ungetwc (wchar_t, FILE*);
  119.  
  120. #ifndef __NO_ISOCEXT  /* externs in libmingwex.a */
  121. int snwprintf(wchar_t* s, size_t n, const wchar_t*  format, ...);
  122. extern __inline__ int vsnwprintf (wchar_t* s, size_t n, const wchar_t* format,
  123.                va_list arg)
  124.   { return _vsnwprintf ( s, n, format, arg); }
  125. #endif
  126.  
  127. #ifdef __MSVCRT__ 
  128. wchar_t* fgetws (wchar_t*, int, FILE*);
  129. int    fputws (const wchar_t*, FILE*);
  130. wint_t    getwc (FILE*);
  131. wint_t  getwchar (void);
  132. wchar_t* _getws (wchar_t*);
  133. wint_t    putwc (wint_t, FILE*);
  134. int    _putws (const wchar_t*);
  135. wint_t    putwchar (wint_t);
  136. FILE*    _wfdopen(int, wchar_t *);
  137. FILE*    _wfopen (const wchar_t*, const wchar_t*);
  138. FILE*    _wfreopen (const wchar_t*, const wchar_t*, FILE*);
  139. FILE*   _wfsopen (const wchar_t*, const wchar_t*, int);
  140. wchar_t* _wtmpnam (wchar_t*);
  141. wchar_t* _wtempnam (const wchar_t*, const wchar_t*);
  142. int     _wrename (const wchar_t*, const wchar_t*);
  143. int    _wremove (const wchar_t*)
  144.  
  145. FILE*      _wpopen (const wchar_t*, const wchar_t*)
  146. void      _wperror (const wchar_t*);
  147. #endif    /* __MSVCRT__ */
  148. #define _WSTDIO_DEFINED
  149. #endif /* _WSTDIO_DEFINED */
  150.  
  151. #ifndef _WDIRECT_DEFINED
  152. /* Also in direct.h */
  153. #ifdef __MSVCRT__ 
  154. int      _wchdir (const wchar_t*);
  155. wchar_t*  _wgetcwd (wchar_t*, int);
  156. wchar_t*  _wgetdcwd (int, wchar_t*, int);
  157. int      _wmkdir (const wchar_t*);
  158. int      _wrmdir (const wchar_t*);
  159. #endif    /* __MSVCRT__ */
  160. #define _WDIRECT_DEFINED
  161. #endif /* _WDIRECT_DEFINED */
  162.  
  163. #ifndef _STAT_DEFINED
  164. /*
  165.  * The structure manipulated and returned by stat and fstat.
  166.  *
  167.  * NOTE: If called on a directory the values in the time fields are not only
  168.  * invalid, they will cause localtime et. al. to return NULL. And calling
  169.  * asctime with a NULL pointer causes an Invalid Page Fault. So watch it!
  170.  */
  171. struct _stat
  172. {
  173.     _dev_t    st_dev;        /* Equivalent to drive number 0=A 1=B ... */
  174.     _ino_t    st_ino;        /* Always zero ? */
  175.     _mode_t    st_mode;    /* See above constants */
  176.     short    st_nlink;    /* Number of links. */
  177.     short    st_uid;        /* User: Maybe significant on NT ? */
  178.     short    st_gid;        /* Group: Ditto */
  179.     _dev_t    st_rdev;    /* Seems useless (not even filled in) */
  180.     _off_t    st_size;    /* File size in bytes */
  181.     time_t    st_atime;    /* Accessed date (always 00:00 hrs local
  182.                  * on FAT) */
  183.     time_t    st_mtime;    /* Modified time */
  184.     time_t    st_ctime;    /* Creation time */
  185. };
  186.  
  187. struct stat
  188. {
  189.     _dev_t    st_dev;        /* Equivalent to drive number 0=A 1=B ... */
  190.     _ino_t    st_ino;        /* Always zero ? */
  191.     _mode_t    st_mode;    /* See above constants */
  192.     short    st_nlink;    /* Number of links. */
  193.     short    st_uid;        /* User: Maybe significant on NT ? */
  194.     short    st_gid;        /* Group: Ditto */
  195.     _dev_t    st_rdev;    /* Seems useless (not even filled in) */
  196.     _off_t    st_size;    /* File size in bytes */
  197.     time_t    st_atime;    /* Accessed date (always 00:00 hrs local
  198.                  * on FAT) */
  199.     time_t    st_mtime;    /* Modified time */
  200.     time_t    st_ctime;    /* Creation time */
  201. };
  202. #if defined (__MSVCRT__)
  203. struct _stati64 {
  204.     _dev_t st_dev;
  205.     _ino_t st_ino;
  206.     unsigned short st_mode;
  207.     short st_nlink;
  208.     short st_uid;
  209.     short st_gid;
  210.     _dev_t st_rdev;
  211.     __int64 st_size;
  212.     time_t st_atime;
  213.     time_t st_mtime;
  214.     time_t st_ctime;
  215.     };
  216. #endif  /* __MSVCRT__ */
  217. #define _STAT_DEFINED
  218. #endif /* _STAT_DEFINED */
  219.  
  220. #if !defined ( _WSTAT_DEFINED)
  221. /* also declared in sys/stat.h */
  222. #if defined __MSVCRT__
  223. int    _wstat (const wchar_t*, struct _stat*);
  224. int    _wstati64 (const wchar_t*, struct _stati64*);
  225. #endif  /* __MSVCRT__ */
  226. #define _WSTAT_DEFINED
  227. #endif /* ! _WSTAT_DEFIND  */
  228.  
  229. #ifndef _WTIME_DEFINED
  230. #ifdef __MSVCRT__
  231. /* wide function prototypes, also declared in time.h */
  232. wchar_t*    _wasctime (const struct tm*);
  233. wchar_t*    _wctime (const time_t*);
  234. wchar_t*    _wstrdate (wchar_t*);
  235. wchar_t*    _wstrtime (wchar_t*);
  236. #endif /* __MSVCRT__ */
  237. size_t        wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*);
  238. #define _WTIME_DEFINED
  239. #endif /* _WTIME_DEFINED */ 
  240.  
  241. #ifndef _WLOCALE_DEFINED  /* also declared in locale.h */
  242. wchar_t* _wsetlocale (int, const wchar_t*);
  243. #define _WLOCALE_DEFINED
  244. #endif
  245.  
  246. #ifndef _WSTDLIB_DEFINED /* also declared in stdlib.h */
  247. long    wcstol    (const wchar_t*, wchar_t**, int);
  248. unsigned long    wcstoul (const wchar_t*, wchar_t**, int);
  249. double    wcstod    (const wchar_t*, wchar_t**);
  250. #if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */
  251. extern __inline__ float wcstof( const wchar_t *nptr, wchar_t **endptr)
  252. {  return (wcstod(nptr, endptr)); }
  253. long double wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__);
  254. #endif /* __NO_ISOCEXT */
  255. #define  _WSTDLIB_DEFINED
  256. #endif
  257.  
  258.  
  259. #ifndef    _NO_OLDNAMES
  260.  
  261. /* Wide character versions. Also declared in io.h. */
  262. /* CHECK: Are these in the oldnames???  NO! */
  263. #if (0)
  264. int        waccess (const wchar_t *, int);
  265. int        wchmod (const wchar_t *, int);
  266. int        wcreat (const wchar_t *, int);
  267. long        wfindfirst (wchar_t *, struct _wfinddata_t *);
  268. int        wfindnext (long, struct _wfinddata_t *);
  269. int        wunlink (const wchar_t *);
  270. int        wrename (const wchar_t *, const wchar_t *);
  271. int        wremove (const wchar_t *);
  272. int        wopen (const wchar_t *, int, ...);
  273. int        wsopen (const wchar_t *, int, int, ...);
  274. wchar_t*    wmktemp (wchar_t *);
  275. #endif
  276. #endif /* _NO_OLDNAMES */
  277.  
  278. #endif /* not __STRICT_ANSI__ */
  279.  
  280. /* These are resolved by -lmsvcp60 */
  281. /* If you don't have msvcp60.dll in your windows system directory, you can
  282.    easily obtain it with a search from your favorite search engine. */
  283. typedef int mbstate_t;
  284. typedef wchar_t _Wint_t;
  285.  
  286. wint_t  btowc(int);
  287. size_t  mbrlen(const char *, size_t, mbstate_t *);
  288. size_t  mbrtowc(wchar_t *, const char *, size_t, mbstate_t *);
  289. size_t  mbsrtowcs(wchar_t *, const char **, size_t, mbstate_t *);
  290.  
  291. size_t  wcrtomb(char *, wchar_t, mbstate_t *);
  292. size_t  wcsrtombs(char *, const wchar_t **, size_t, mbstate_t *);
  293. int      wctob(wint_t);
  294.  
  295. #ifndef __NO_ISOCEXT /* these need static lib libmingwex.a */
  296. extern __inline__ int fwide(FILE* stream, int mode) {return -1;} /* limited to byte orientation */ 
  297. extern __inline__ int mbsinit(const mbstate_t* ps) {return 1;}
  298. wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n);
  299. wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n);
  300. int wmemcmp(const wchar_t* s1, const wchar_t * s2, size_t n);
  301. wchar_t* wmemcpy(wchar_t* __restrict__ s1, const wchar_t* __restrict__ s2,
  302.          size_t n);
  303. wchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n);
  304. long long wcstoll(const wchar_t* __restrict__ nptr,
  305.           wchar_t** __restrict__ endptr, int base);
  306. unsigned long long wcstoull(const wchar_t* __restrict__ nptr,
  307.                 wchar_t ** __restrict__ endptr, int base);
  308.  
  309. #endif /* __NO_ISOCEXT */
  310.  
  311.  
  312. #ifdef __cplusplus
  313. }    /* end of extern "C" */
  314. #endif
  315.  
  316. #endif /* Not RC_INVOKED */
  317.  
  318. #endif /* not _WCHAR_H_ */
  319.  
  320.