home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 June / Chip_2002-06_cd1.bin / zkuste / cecko / install / devcpp4920.exe / include / wchar.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-09-17  |  8.2 KB  |  282 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.  *  DISCLAMED. This includes but is not limited to warranties of
  19.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  20.  *
  21.  * $Revision: 1.5 $
  22.  * $Author: cgf $
  23.  * $Date: 2000/02/05 04:04:59 $
  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(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    vfwprintf (FILE*, const wchar_t*, va_list);
  109. int    vwprintf (const wchar_t*, va_list);
  110. int    vswprintf (wchar_t*, const wchar_t*, va_list);
  111. int    fwscanf (FILE*, const wchar_t*, ...);
  112. int    wscanf (const wchar_t*, ...);
  113. int    swscanf (const wchar_t*, const wchar_t*, ...);
  114. wint_t    fgetwc (FILE*);
  115. wint_t    fputwc (wchar_t, FILE*);
  116. wint_t    ungetwc (wchar_t, FILE*);
  117.  
  118. #ifdef __MSVCRT__ 
  119. wchar_t*    fgetws (wchar_t*, int, FILE*);
  120. int         fputws (const wchar_t*, FILE*);
  121. wint_t        getwc (FILE*);
  122. wint_t        getwchar (void);
  123. wchar_t*    _getws (wchar_t*);
  124. wint_t        putwc (wint_t, FILE*);
  125. int         _putws (const wchar_t*);
  126. wint_t        putwchar (wint_t);
  127.  
  128. FILE*    _wfopen (const wchar_t*, const wchar_t*);
  129. FILE*    _wfreopen (const wchar_t*, const wchar_t*, FILE*);
  130. FILE*   _wfsopen(const wchar_t*, const wchar_t*, int);
  131. wchar_t*    _wtmpnam (wchar_t*);
  132. wchar_t*    _wtempnam (const wchar_t*, const wchar_t*);
  133. int     _wrename(const wchar_t*, const wchar_t*);
  134. int     _wremove (const wchar_t*)
  135.  
  136. FILE*  _wpopen(const wchar_t*, const wchar_t*)
  137. void  _wperror(const wchar_t*);
  138. #endif    /* __MSVCRT__ */
  139. #define _WSTDIO_DEFINED
  140. #endif /* _WSTDIO_DEFINED */
  141.  
  142. #ifndef _WDIRECT_DEFINED
  143. /* Also in direct.h */
  144. #ifdef __MSVCRT__ 
  145. int _wchdir(const wchar_t*);
  146. wchar_t* _wgetcwd(wchar_t*, int);
  147. wchar_t* _wgetdcwd(int, wchar_t*, int);
  148. int _wmkdir(const wchar_t*);
  149. int _wrmdir(const wchar_t*);
  150. #endif    /* __MSVCRT__ */
  151. #define _WDIRECT_DEFINED
  152. #endif /* _WDIRECT_DEFINED */
  153.  
  154. #ifndef _STAT_DEFINED
  155. /*
  156.  * The structure manipulated and returned by stat and fstat.
  157.  *
  158.  * NOTE: If called on a directory the values in the time fields are not only
  159.  * invalid, they will cause localtime et. al. to return NULL. And calling
  160.  * asctime with a NULL pointer causes an Invalid Page Fault. So watch it!
  161.  */
  162. struct _stat
  163. {
  164.     _dev_t    st_dev;        /* Equivalent to drive number 0=A 1=B ... */
  165.     _ino_t    st_ino;        /* Always zero ? */
  166.     _mode_t    st_mode;    /* See above constants */
  167.     short    st_nlink;    /* Number of links. */
  168.     short    st_uid;        /* User: Maybe significant on NT ? */
  169.     short    st_gid;        /* Group: Ditto */
  170.     _dev_t    st_rdev;    /* Seems useless (not even filled in) */
  171.     _off_t    st_size;    /* File size in bytes */
  172.     time_t    st_atime;    /* Accessed date (always 00:00 hrs local
  173.                  * on FAT) */
  174.     time_t    st_mtime;    /* Modified time */
  175.     time_t    st_ctime;    /* Creation time */
  176. };
  177.  
  178. struct stat
  179. {
  180.     _dev_t    st_dev;        /* Equivalent to drive number 0=A 1=B ... */
  181.     _ino_t    st_ino;        /* Always zero ? */
  182.     _mode_t    st_mode;    /* See above constants */
  183.     short    st_nlink;    /* Number of links. */
  184.     short    st_uid;        /* User: Maybe significant on NT ? */
  185.     short    st_gid;        /* Group: Ditto */
  186.     _dev_t    st_rdev;    /* Seems useless (not even filled in) */
  187.     _off_t    st_size;    /* File size in bytes */
  188.     time_t    st_atime;    /* Accessed date (always 00:00 hrs local
  189.                  * on FAT) */
  190.     time_t    st_mtime;    /* Modified time */
  191.     time_t    st_ctime;    /* Creation time */
  192. };
  193. #if defined (__MSVCRT__)
  194. struct _stati64 {
  195.     _dev_t st_dev;
  196.     _ino_t st_ino;
  197.     unsigned short st_mode;
  198.     short st_nlink;
  199.     short st_uid;
  200.     short st_gid;
  201.     _dev_t st_rdev;
  202.     __int64 st_size;
  203.     time_t st_atime;
  204.     time_t st_mtime;
  205.     time_t st_ctime;
  206.     };
  207. #endif  /* __MSVCRT__ */
  208. #define _STAT_DEFINED
  209. #endif /* _STAT_DEFINED */
  210.  
  211. #if !defined ( _WSTAT_DEFINED)
  212. /* also declared in sys/stat.h */
  213. #if defined __MSVCRT__
  214. int    _wstat(const wchar_t*, struct _stat*);
  215. int    _wstati64 (const wchar_t*, struct _stati64*);
  216. #endif  /* __MSVCRT__ */
  217. #define _WSTAT_DEFINED
  218. #endif /* ! _WSTAT_DEFIND  */
  219.  
  220. #ifndef _WTIME_DEFINED
  221. #ifdef __MSVCRT__
  222. /* wide function prototypes, also declared in time.h */
  223. wchar_t *    _wasctime(const struct tm*);
  224. wchar_t *    _wctime(const time_t*);
  225. wchar_t*    _wstrdate(wchar_t*);
  226. wchar_t*    _wstrtime(wchar_t*);
  227. #endif /* __MSVCRT__ */
  228. size_t        wcsftime(wchar_t*, size_t, const wchar_t*, const struct tm*);
  229. #define _WTIME_DEFINED
  230. #endif /* _WTIME_DEFINED */ 
  231.  
  232. #ifndef _WLOCALE_DEFINED  /* also declared in locale.h */
  233. wchar_t* _wsetlocale(int, const wchar_t*);
  234. #define _WLOCALE_DEFINED
  235. #endif
  236.  
  237.  
  238. #ifndef    _NO_OLDNAMES
  239.  
  240. /* Wide character versions. Also declared in io.h. */
  241. /* CHECK: Are these in the oldnames???  NO! */
  242. #if (0)
  243. int         waccess(const wchar_t *, int);
  244. int         wchmod(const wchar_t *, int);
  245. int         wcreat(const wchar_t *, int);
  246. long         wfindfirst(wchar_t *, struct _wfinddata_t *);
  247. int         wfindnext(long, struct _wfinddata_t *);
  248. int         wunlink(const wchar_t *);
  249. int         wrename(const wchar_t *, const wchar_t *);
  250. int         wremove (const wchar_t *);
  251. int         wopen(const wchar_t *, int, ...);
  252. int         wsopen(const wchar_t *, int, int, ...);
  253. wchar_t *     wmktemp(wchar_t *);
  254. #endif
  255. #endif /* _NO_OLDNAMES */
  256.  
  257. #endif /* not __STRICT_ANSI__ */
  258.  
  259. /* These are resolved by -lmsvcp60 */
  260. /* If you don't have msvcp60.dll in your windows system directory, you can
  261.    easily obtain it with a search from your favorite search engine. */
  262. typedef int mbstate_t;
  263. typedef wchar_t _Wint_t;
  264.  
  265. wint_t  btowc(int);
  266. size_t  mbrlen(const char *, size_t, mbstate_t *);
  267. size_t  mbrtowc(wchar_t *, const char *, size_t, mbstate_t *);
  268. size_t  mbsrtowcs(wchar_t *, const char **, size_t, mbstate_t *);
  269.  
  270. size_t  wcrtomb(char *, wchar_t, mbstate_t *);
  271. size_t  wcsrtombs(char *, const wchar_t **, size_t, mbstate_t *);
  272. int      wctob(wint_t);
  273.  
  274. #ifdef __cplusplus
  275. }    /* end of extern "C" */
  276. #endif
  277.  
  278. #endif /* Not RC_INVOKED */
  279.  
  280. #endif /* not _WCHAR_H_ */
  281.  
  282.