home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / wchar.h < prev    next >
C/C++ Source or Header  |  1998-06-16  |  23KB  |  730 lines

  1. /***
  2. *wchar.h - declarations for wide character functions
  3. *
  4. *       Copyright (c) 1992-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       This file contains the types, macros and function declarations for
  8. *       all wide character-related functions.  They may also be declared in
  9. *       individual header files on a functional basis.
  10. *       [ISO]
  11. *
  12. *       Note: keep in sync with ctype.h, stdio.h, stdlib.h, string.h, time.h.
  13. *
  14. *       [Public]
  15. *
  16. ****/
  17.  
  18. #if     _MSC_VER > 1000
  19. #pragma once
  20. #endif
  21.  
  22. #ifndef _MAC
  23.  
  24.  
  25. #ifndef _INC_WCHAR
  26. #define _INC_WCHAR
  27.  
  28. #if     !defined(_WIN32) && !defined(_MAC)
  29. #error ERROR: Only Mac or Win32 targets supported!
  30. #endif
  31.  
  32.  
  33. #ifdef  _MSC_VER
  34. #pragma pack(push,8)
  35. #endif  /* _MSC_VER */
  36.  
  37. #ifdef  __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41.  
  42. /* Define _CRTIMP */
  43.  
  44. #ifndef _CRTIMP
  45. #ifdef  _DLL
  46. #define _CRTIMP __declspec(dllimport)
  47. #else   /* ndef _DLL */
  48. #define _CRTIMP
  49. #endif  /* _DLL */
  50. #endif  /* _CRTIMP */
  51.  
  52. /* Define _CRTIMP */
  53. #ifndef _CRTIMP
  54. #ifdef  _DLL
  55. #define _CRTIMP __declspec(dllimport)
  56. #else   /* ndef _DLL */
  57. #define _CRTIMP
  58. #endif  /* _DLL */
  59. #endif  /* _CRTIMP */
  60.  
  61. /* Define __cdecl for non-Microsoft compilers */
  62.  
  63. #if     ( !defined(_MSC_VER) && !defined(__cdecl) )
  64. #define __cdecl
  65. #endif
  66.  
  67. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  68.  
  69. #ifndef _CRTAPI1
  70. #if    _MSC_VER >= 800 && _M_IX86 >= 300
  71. #define _CRTAPI1 __cdecl
  72. #else
  73. #define _CRTAPI1
  74. #endif
  75. #endif
  76.  
  77.  
  78. #ifndef _SIZE_T_DEFINED
  79. typedef unsigned int size_t;
  80. #define _SIZE_T_DEFINED
  81. #endif
  82.  
  83. #ifndef _TIME_T_DEFINED
  84. typedef long time_t;
  85. #define _TIME_T_DEFINED
  86. #endif
  87.  
  88. #ifndef _WCHAR_T_DEFINED
  89. typedef unsigned short wchar_t;
  90. #define _WCHAR_T_DEFINED
  91. #endif
  92.  
  93. #define WCHAR_MIN       0
  94. #define WCHAR_MAX       ((wchar_t)-1)
  95.  
  96. #ifndef _WCTYPE_T_DEFINED
  97. typedef wchar_t wint_t;
  98. typedef wchar_t wctype_t;
  99. #define _WCTYPE_T_DEFINED
  100. #endif
  101.  
  102.  
  103. #ifndef _VA_LIST_DEFINED
  104. #ifdef  _M_ALPHA
  105. typedef struct {
  106.         char *a0;   /* pointer to first homed integer argument */
  107.         int offset; /* byte offset of next parameter */
  108. } va_list;
  109. #else
  110. typedef char *  va_list;
  111. #endif
  112. #define _VA_LIST_DEFINED
  113. #endif
  114.  
  115. #ifndef WEOF
  116. #define WEOF (wint_t)(0xFFFF)
  117. #endif
  118.  
  119. #ifndef _FILE_DEFINED
  120. struct _iobuf {
  121.         char *_ptr;
  122.         int   _cnt;
  123.         char *_base;
  124.         int   _flag;
  125.         int   _file;
  126.         int   _charbuf;
  127.         int   _bufsiz;
  128.         char *_tmpfname;
  129.         };
  130. typedef struct _iobuf FILE;
  131. #define _FILE_DEFINED
  132. #endif
  133.  
  134. /* Declare _iob[] array */
  135.  
  136. #ifndef _STDIO_DEFINED
  137. _CRTIMP extern FILE _iob[];
  138. #endif  /* _STDIO_DEFINED */
  139.  
  140. #ifndef _FSIZE_T_DEFINED
  141. typedef unsigned long _fsize_t; /* Could be 64 bits for Win32 */
  142. #define _FSIZE_T_DEFINED
  143. #endif
  144.  
  145. #ifndef _WFINDDATA_T_DEFINED
  146.  
  147. struct _wfinddata_t {
  148.         unsigned attrib;
  149.         time_t   time_create;   /* -1 for FAT file systems */
  150.         time_t   time_access;   /* -1 for FAT file systems */
  151.         time_t   time_write;
  152.         _fsize_t size;
  153.         wchar_t  name[260];
  154. };
  155.  
  156. #ifndef _MAC
  157. #if     _INTEGRAL_MAX_BITS >= 64
  158. struct _wfinddatai64_t {
  159.         unsigned attrib;
  160.         time_t   time_create;   /* -1 for FAT file systems */
  161.         time_t   time_access;   /* -1 for FAT file systems */
  162.         time_t   time_write;
  163.         __int64  size;
  164.         wchar_t  name[260];
  165. };
  166. #endif
  167. #endif
  168.  
  169. #define _WFINDDATA_T_DEFINED
  170. #endif
  171.  
  172. /* define NULL pointer value */
  173.  
  174. #ifndef NULL
  175. #ifdef  __cplusplus
  176. #define NULL    0
  177. #else
  178. #define NULL    ((void *)0)
  179. #endif
  180. #endif
  181.  
  182.  
  183. #ifndef _CTYPE_DISABLE_MACROS
  184. _CRTIMP extern unsigned short _ctype[];
  185. _CRTIMP extern unsigned short *_pctype;
  186. #ifndef _MAC
  187. _CRTIMP extern wctype_t *_pwctype;
  188. #endif  /* ndef _MAC */
  189. #endif  /* _CTYPE_DISABLE_MACROS */
  190.  
  191.  
  192. /* set bit masks for the possible character types */
  193.  
  194. #define _UPPER          0x1     /* upper case letter */
  195. #define _LOWER          0x2     /* lower case letter */
  196. #define _DIGIT          0x4     /* digit[0-9] */
  197. #define _SPACE          0x8     /* tab, carriage return, newline, */
  198.                                 /* vertical tab or form feed */
  199. #define _PUNCT          0x10    /* punctuation character */
  200. #define _CONTROL        0x20    /* control character */
  201. #define _BLANK          0x40    /* space char */
  202. #define _HEX            0x80    /* hexadecimal digit */
  203.  
  204. #define _LEADBYTE       0x8000                  /* multibyte leadbyte */
  205. #define _ALPHA          (0x0100|_UPPER|_LOWER)  /* alphabetic character */
  206.  
  207.  
  208. /* Function prototypes */
  209.  
  210. #ifndef _WCTYPE_DEFINED
  211.  
  212. /* Character classification function prototypes */
  213. /* also declared in ctype.h */
  214.  
  215. _CRTIMP int __cdecl iswalpha(wint_t);
  216. _CRTIMP int __cdecl iswupper(wint_t);
  217. _CRTIMP int __cdecl iswlower(wint_t);
  218. _CRTIMP int __cdecl iswdigit(wint_t);
  219. _CRTIMP int __cdecl iswxdigit(wint_t);
  220. _CRTIMP int __cdecl iswspace(wint_t);
  221. _CRTIMP int __cdecl iswpunct(wint_t);
  222. _CRTIMP int __cdecl iswalnum(wint_t);
  223. _CRTIMP int __cdecl iswprint(wint_t);
  224. _CRTIMP int __cdecl iswgraph(wint_t);
  225. _CRTIMP int __cdecl iswcntrl(wint_t);
  226. _CRTIMP int __cdecl iswascii(wint_t);
  227. _CRTIMP int __cdecl isleadbyte(int);
  228.  
  229. _CRTIMP wchar_t __cdecl towupper(wchar_t);
  230. _CRTIMP wchar_t __cdecl towlower(wchar_t);
  231.  
  232. _CRTIMP int __cdecl iswctype(wint_t, wctype_t);
  233.  
  234. /* --------- The following functions are OBSOLETE --------- */
  235. _CRTIMP int __cdecl is_wctype(wint_t, wctype_t);
  236. /*  --------- The preceding functions are OBSOLETE --------- */
  237.  
  238. #define _WCTYPE_DEFINED
  239. #endif
  240.  
  241. #ifndef _WDIRECT_DEFINED
  242.  
  243. /* also declared in direct.h */
  244.  
  245. _CRTIMP int __cdecl _wchdir(const wchar_t *);
  246. _CRTIMP wchar_t * __cdecl _wgetcwd(wchar_t *, int);
  247. _CRTIMP wchar_t * __cdecl _wgetdcwd(int, wchar_t *, int);
  248. _CRTIMP int __cdecl _wmkdir(const wchar_t *);
  249. _CRTIMP int __cdecl _wrmdir(const wchar_t *);
  250.  
  251. #define _WDIRECT_DEFINED
  252. #endif
  253.  
  254. #ifndef _WIO_DEFINED
  255.  
  256. /* also declared in io.h */
  257.  
  258. _CRTIMP int __cdecl _waccess(const wchar_t *, int);
  259. _CRTIMP int __cdecl _wchmod(const wchar_t *, int);
  260. _CRTIMP int __cdecl _wcreat(const wchar_t *, int);
  261. _CRTIMP long __cdecl _wfindfirst(wchar_t *, struct _wfinddata_t *);
  262. _CRTIMP int __cdecl _wfindnext(long, struct _wfinddata_t *);
  263. _CRTIMP int __cdecl _wunlink(const wchar_t *);
  264. _CRTIMP int __cdecl _wrename(const wchar_t *, const wchar_t *);
  265. _CRTIMP int __cdecl _wopen(const wchar_t *, int, ...);
  266. _CRTIMP int __cdecl _wsopen(const wchar_t *, int, int, ...);
  267. _CRTIMP wchar_t * __cdecl _wmktemp(wchar_t *);
  268.  
  269. #if     _INTEGRAL_MAX_BITS >= 64
  270. _CRTIMP long __cdecl _wfindfirsti64(wchar_t *, struct _wfinddatai64_t *);
  271. _CRTIMP int __cdecl _wfindnexti64(long, struct _wfinddatai64_t *);
  272. #endif
  273.  
  274. #define _WIO_DEFINED
  275. #endif
  276.  
  277. #ifndef _WLOCALE_DEFINED
  278.  
  279. /* wide function prototypes, also declared in wchar.h  */
  280.  
  281. _CRTIMP wchar_t * __cdecl _wsetlocale(int, const wchar_t *);
  282.  
  283. #define _WLOCALE_DEFINED
  284. #endif
  285.  
  286. #ifndef _WPROCESS_DEFINED
  287.  
  288. /* also declared in process.h */
  289.  
  290. _CRTIMP int __cdecl _wexecl(const wchar_t *, const wchar_t *, ...);
  291. _CRTIMP int __cdecl _wexecle(const wchar_t *, const wchar_t *, ...);
  292. _CRTIMP int __cdecl _wexeclp(const wchar_t *, const wchar_t *, ...);
  293. _CRTIMP int __cdecl _wexeclpe(const wchar_t *, const wchar_t *, ...);
  294. _CRTIMP int __cdecl _wexecv(const wchar_t *, const wchar_t * const *);
  295. _CRTIMP int __cdecl _wexecve(const wchar_t *, const wchar_t * const *, const wchar_t * const *);
  296. _CRTIMP int __cdecl _wexecvp(const wchar_t *, const wchar_t * const *);
  297. _CRTIMP int __cdecl _wexecvpe(const wchar_t *, const wchar_t * const *, const wchar_t * const *);
  298. _CRTIMP int __cdecl _wspawnl(int, const wchar_t *, const wchar_t *, ...);
  299. _CRTIMP int __cdecl _wspawnle(int, const wchar_t *, const wchar_t *, ...);
  300. _CRTIMP int __cdecl _wspawnlp(int, const wchar_t *, const wchar_t *, ...);
  301. _CRTIMP int __cdecl _wspawnlpe(int, const wchar_t *, const wchar_t *, ...);
  302. _CRTIMP int __cdecl _wspawnv(int, const wchar_t *, const wchar_t * const *);
  303. _CRTIMP int __cdecl _wspawnve(int, const wchar_t *, const wchar_t * const *,
  304.         const wchar_t * const *);
  305. _CRTIMP int __cdecl _wspawnvp(int, const wchar_t *, const wchar_t * const *);
  306. _CRTIMP int __cdecl _wspawnvpe(int, const wchar_t *, const wchar_t * const *,
  307.         const wchar_t * const *);
  308. _CRTIMP int __cdecl _wsystem(const wchar_t *);
  309.  
  310. #define _WPROCESS_DEFINED
  311. #endif
  312.  
  313. #ifndef _WCTYPE_INLINE_DEFINED
  314. #ifndef __cplusplus
  315. #define iswalpha(_c)    ( iswctype(_c,_ALPHA) )
  316. #define iswupper(_c)    ( iswctype(_c,_UPPER) )
  317. #define iswlower(_c)    ( iswctype(_c,_LOWER) )
  318. #define iswdigit(_c)    ( iswctype(_c,_DIGIT) )
  319. #define iswxdigit(_c)   ( iswctype(_c,_HEX) )
  320. #define iswspace(_c)    ( iswctype(_c,_SPACE) )
  321. #define iswpunct(_c)    ( iswctype(_c,_PUNCT) )
  322. #define iswalnum(_c)    ( iswctype(_c,_ALPHA|_DIGIT) )
  323. #define iswprint(_c)    ( iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT) )
  324. #define iswgraph(_c)    ( iswctype(_c,_PUNCT|_ALPHA|_DIGIT) )
  325. #define iswcntrl(_c)    ( iswctype(_c,_CONTROL) )
  326. #define iswascii(_c)    ( (unsigned)(_c) < 0x80 )
  327.  
  328. #ifndef _CTYPE_DISABLE_MACROS
  329. #define isleadbyte(_c)  (_pctype[(unsigned char)(_c)] & _LEADBYTE)
  330. #endif  /* _CTYPE_DISABLE_MACROS */
  331.  
  332. #else   /* __cplusplus */
  333. inline int __cdecl iswalpha(wint_t _C) {return (iswctype(_C,_ALPHA)); }
  334. inline int __cdecl iswupper(wint_t _C) {return (iswctype(_C,_UPPER)); }
  335. inline int __cdecl iswlower(wint_t _C) {return (iswctype(_C,_LOWER)); }
  336. inline int __cdecl iswdigit(wint_t _C) {return (iswctype(_C,_DIGIT)); }
  337. inline int __cdecl iswxdigit(wint_t _C) {return (iswctype(_C,_HEX)); }
  338. inline int __cdecl iswspace(wint_t _C) {return (iswctype(_C,_SPACE)); }
  339. inline int __cdecl iswpunct(wint_t _C) {return (iswctype(_C,_PUNCT)); }
  340. inline int __cdecl iswalnum(wint_t _C) {return (iswctype(_C,_ALPHA|_DIGIT)); }
  341. inline int __cdecl iswprint(wint_t _C)
  342.         {return (iswctype(_C,_BLANK|_PUNCT|_ALPHA|_DIGIT)); }
  343. inline int __cdecl iswgraph(wint_t _C)
  344.         {return (iswctype(_C,_PUNCT|_ALPHA|_DIGIT)); }
  345. inline int __cdecl iswcntrl(wint_t _C) {return (iswctype(_C,_CONTROL)); }
  346. inline int __cdecl iswascii(wint_t _C) {return ((unsigned)(_C) < 0x80); }
  347.  
  348. #ifndef _CTYPE_DISABLE_MACROS
  349. inline int __cdecl isleadbyte(int _C)
  350.         {return (_pctype[(unsigned char)(_C)] & _LEADBYTE); }
  351. #endif  /* _CTYPE_DISABLE_MACROS */
  352. #endif  /* __cplusplus */
  353. #define _WCTYPE_INLINE_DEFINED
  354. #endif  /* _WCTYPE_INLINE_DEFINED */
  355.  
  356.  
  357. #ifndef _POSIX_
  358.  
  359. /* define structure for returning status information */
  360.  
  361. #ifndef _INO_T_DEFINED
  362. typedef unsigned short _ino_t;      /* i-node number (not used on DOS) */
  363. #if     !__STDC__
  364. /* Non-ANSI name for compatibility */
  365. typedef unsigned short ino_t;
  366. #endif
  367. #define _INO_T_DEFINED
  368. #endif
  369.  
  370. #ifndef _DEV_T_DEFINED
  371. typedef unsigned int _dev_t;        /* device code */
  372. #if     !__STDC__
  373. /* Non-ANSI name for compatibility */
  374. typedef unsigned int dev_t;
  375. #endif
  376. #define _DEV_T_DEFINED
  377. #endif
  378.  
  379. #ifndef _OFF_T_DEFINED
  380. typedef long _off_t;                /* file offset value */
  381. #if     !__STDC__
  382. /* Non-ANSI name for compatibility */
  383. typedef long off_t;
  384. #endif
  385. #define _OFF_T_DEFINED
  386. #endif
  387.  
  388. #ifndef _STAT_DEFINED
  389.  
  390. struct _stat {
  391.         _dev_t st_dev;
  392.         _ino_t st_ino;
  393.         unsigned short st_mode;
  394.         short st_nlink;
  395.         short st_uid;
  396.         short st_gid;
  397.         _dev_t st_rdev;
  398.         _off_t st_size;
  399.         time_t st_atime;
  400.         time_t st_mtime;
  401.         time_t st_ctime;
  402.         };
  403.  
  404. #if     !__STDC__
  405. /* Non-ANSI names for compatibility */
  406. struct stat {
  407.         _dev_t st_dev;
  408.         _ino_t st_ino;
  409.         unsigned short st_mode;
  410.         short st_nlink;
  411.         short st_uid;
  412.         short st_gid;
  413.         _dev_t st_rdev;
  414.         _off_t st_size;
  415.         time_t st_atime;
  416.         time_t st_mtime;
  417.         time_t st_ctime;
  418.         };
  419. #endif  /* __STDC__ */
  420.  
  421. #if     _INTEGRAL_MAX_BITS >= 64
  422. struct _stati64 {
  423.         _dev_t st_dev;
  424.         _ino_t st_ino;
  425.         unsigned short st_mode;
  426.         short st_nlink;
  427.         short st_uid;
  428.         short st_gid;
  429.         _dev_t st_rdev;
  430.         __int64 st_size;
  431.         time_t st_atime;
  432.         time_t st_mtime;
  433.         time_t st_ctime;
  434.         };
  435. #endif
  436.  
  437. #define _STAT_DEFINED
  438. #endif
  439.  
  440.  
  441. #ifndef _WSTAT_DEFINED
  442.  
  443. /* also declared in stat.h */
  444.  
  445. _CRTIMP int __cdecl _wstat(const wchar_t *, struct _stat *);
  446.  
  447. #if     _INTEGRAL_MAX_BITS >= 64
  448. _CRTIMP int __cdecl _wstati64(const wchar_t *, struct _stati64 *);
  449. #endif
  450.  
  451. #define _WSTAT_DEFINED
  452. #endif
  453.  
  454. #endif  /* !_POSIX_ */
  455.  
  456.  
  457. #ifndef _WSTDIO_DEFINED
  458.  
  459. /* also declared in stdio.h */
  460.  
  461. #ifdef  _POSIX_
  462. _CRTIMP FILE * __cdecl _wfsopen(const wchar_t *, const wchar_t *);
  463. #else
  464. _CRTIMP FILE * __cdecl _wfsopen(const wchar_t *, const wchar_t *, int);
  465. #endif
  466.  
  467. _CRTIMP wint_t __cdecl fgetwc(FILE *);
  468. _CRTIMP wint_t __cdecl _fgetwchar(void);
  469. _CRTIMP wint_t __cdecl fputwc(wint_t, FILE *);
  470. _CRTIMP wint_t __cdecl _fputwchar(wint_t);
  471. _CRTIMP wint_t __cdecl getwc(FILE *);
  472. _CRTIMP wint_t __cdecl getwchar(void);
  473. _CRTIMP wint_t __cdecl putwc(wint_t, FILE *);
  474. _CRTIMP wint_t __cdecl putwchar(wint_t);
  475. _CRTIMP wint_t __cdecl ungetwc(wint_t, FILE *);
  476. _CRTIMP wchar_t * __cdecl fgetws(wchar_t *, int, FILE *);
  477. _CRTIMP int __cdecl fputws(const wchar_t *, FILE *);
  478. _CRTIMP wchar_t * __cdecl _getws(wchar_t *);
  479. _CRTIMP int __cdecl _putws(const wchar_t *);
  480. _CRTIMP int __cdecl fwprintf(FILE *, const wchar_t *, ...);
  481. _CRTIMP int __cdecl wprintf(const wchar_t *, ...);
  482. _CRTIMP int __cdecl _snwprintf(wchar_t *, size_t, const wchar_t *, ...);
  483. _CRTIMP int __cdecl swprintf(wchar_t *, const wchar_t *, ...);
  484. _CRTIMP int __cdecl vfwprintf(FILE *, const wchar_t *, va_list);
  485. _CRTIMP int __cdecl vwprintf(const wchar_t *, va_list);
  486. _CRTIMP int __cdecl _vsnwprintf(wchar_t *, size_t, const wchar_t *, va_list);
  487. _CRTIMP int __cdecl vswprintf(wchar_t *, const wchar_t *, va_list);
  488. _CRTIMP int __cdecl fwscanf(FILE *, const wchar_t *, ...);
  489. _CRTIMP int __cdecl swscanf(const wchar_t *, const wchar_t *, ...);
  490. _CRTIMP int __cdecl wscanf(const wchar_t *, ...);
  491.  
  492. #ifndef __cplusplus
  493. #define getwchar()      fgetwc(stdin)
  494. #define putwchar(_c)    fputwc((_c),stdout)
  495. #else   /* __cplusplus */
  496. inline wint_t __cdecl getwchar()
  497.         {return (fgetwc(&_iob[0])); }   // stdin
  498. inline wint_t __cdecl putwchar(wchar_t _C)
  499.         {return (fputwc(_C, &_iob[1])); }       // stdout
  500. #endif  /* __cplusplus */
  501.  
  502. #define getwc(_stm)     fgetwc(_stm)
  503. #define putwc(_c,_stm)  fputwc(_c,_stm)
  504.  
  505. _CRTIMP FILE * __cdecl _wfdopen(int, const wchar_t *);
  506. _CRTIMP FILE * __cdecl _wfopen(const wchar_t *, const wchar_t *);
  507. _CRTIMP FILE * __cdecl _wfreopen(const wchar_t *, const wchar_t *, FILE *);
  508. _CRTIMP void __cdecl _wperror(const wchar_t *);
  509. _CRTIMP FILE * __cdecl _wpopen(const wchar_t *, const wchar_t *);
  510. _CRTIMP int __cdecl _wremove(const wchar_t *);
  511. _CRTIMP wchar_t * __cdecl _wtempnam(const wchar_t *, const wchar_t *);
  512. _CRTIMP wchar_t * __cdecl _wtmpnam(wchar_t *);
  513.  
  514. #define _WSTDIO_DEFINED
  515. #endif
  516.  
  517.  
  518. #ifndef _WSTDLIB_DEFINED
  519.  
  520. /* also declared in stdlib.h */
  521.  
  522. _CRTIMP wchar_t * __cdecl _itow (int, wchar_t *, int);
  523. _CRTIMP wchar_t * __cdecl _ltow (long, wchar_t *, int);
  524. _CRTIMP wchar_t * __cdecl _ultow (unsigned long, wchar_t *, int);
  525. _CRTIMP double __cdecl wcstod(const wchar_t *, wchar_t **);
  526. _CRTIMP long   __cdecl wcstol(const wchar_t *, wchar_t **, int);
  527. _CRTIMP unsigned long __cdecl wcstoul(const wchar_t *, wchar_t **, int);
  528. _CRTIMP wchar_t * __cdecl _wgetenv(const wchar_t *);
  529. _CRTIMP int    __cdecl _wsystem(const wchar_t *);
  530. _CRTIMP int __cdecl _wtoi(const wchar_t *);
  531. _CRTIMP long __cdecl _wtol(const wchar_t *);
  532.  
  533. #if     _INTEGRAL_MAX_BITS >= 64
  534. _CRTIMP wchar_t * __cdecl _i64tow(__int64, wchar_t *, int);
  535. _CRTIMP wchar_t * __cdecl _ui64tow(unsigned __int64, wchar_t *, int);
  536. _CRTIMP __int64   __cdecl _wtoi64(const wchar_t *);
  537. #endif
  538.  
  539. #define _WSTDLIB_DEFINED
  540. #endif
  541.  
  542. #ifndef _POSIX_
  543.  
  544. #ifndef _WSTDLIBP_DEFINED
  545.  
  546. /* also declared in stdlib.h  */
  547.  
  548. _CRTIMP wchar_t * __cdecl _wfullpath(wchar_t *, const wchar_t *, size_t);
  549. _CRTIMP void   __cdecl _wmakepath(wchar_t *, const wchar_t *, const wchar_t *, const wchar_t *,
  550.         const wchar_t *);
  551. _CRTIMP void   __cdecl _wperror(const wchar_t *);
  552. _CRTIMP int    __cdecl _wputenv(const wchar_t *);
  553. _CRTIMP void   __cdecl _wsearchenv(const wchar_t *, const wchar_t *, wchar_t *);
  554. _CRTIMP void   __cdecl _wsplitpath(const wchar_t *, wchar_t *, wchar_t *, wchar_t *, wchar_t *);
  555.  
  556. #define _WSTDLIBP_DEFINED
  557. #endif
  558.  
  559. #endif  /* _POSIX_ */
  560.  
  561.  
  562. #ifndef _WSTRING_DEFINED
  563.  
  564. /* also declared in string.h */
  565.  
  566. #ifdef  __cplusplus
  567.         #define _WConst_return  const
  568. #else
  569.         #define _WConst_return
  570. #endif
  571.  
  572. _CRTIMP wchar_t * __cdecl wcscat(wchar_t *, const wchar_t *);
  573. _CRTIMP _WConst_return wchar_t * __cdecl wcschr(const wchar_t *, wchar_t);
  574. _CRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *);
  575. _CRTIMP wchar_t * __cdecl wcscpy(wchar_t *, const wchar_t *);
  576. _CRTIMP size_t __cdecl wcscspn(const wchar_t *, const wchar_t *);
  577. _CRTIMP size_t __cdecl wcslen(const wchar_t *);
  578. _CRTIMP wchar_t * __cdecl wcsncat(wchar_t *, const wchar_t *, size_t);
  579. _CRTIMP int __cdecl wcsncmp(const wchar_t *, const wchar_t *, size_t);
  580. _CRTIMP wchar_t * __cdecl wcsncpy(wchar_t *, const wchar_t *, size_t);
  581. _CRTIMP _WConst_return wchar_t * __cdecl wcspbrk(const wchar_t *, const wchar_t *);
  582. _CRTIMP _WConst_return wchar_t * __cdecl wcsrchr(const wchar_t *, wchar_t);
  583. _CRTIMP size_t __cdecl wcsspn(const wchar_t *, const wchar_t *);
  584. _CRTIMP _WConst_return wchar_t * __cdecl wcsstr(const wchar_t *, const wchar_t *);
  585. _CRTIMP wchar_t * __cdecl wcstok(wchar_t *, const wchar_t *);
  586. _CRTIMP wchar_t * __cdecl _wcsdup(const wchar_t *);
  587. _CRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *);
  588. _CRTIMP int __cdecl _wcsnicmp(const wchar_t *, const wchar_t *, size_t);
  589. _CRTIMP wchar_t * __cdecl _wcsnset(wchar_t *, wchar_t, size_t);
  590. _CRTIMP wchar_t * __cdecl _wcsrev(wchar_t *);
  591. _CRTIMP wchar_t * __cdecl _wcsset(wchar_t *, wchar_t);
  592. _CRTIMP wchar_t * __cdecl _wcslwr(wchar_t *);
  593. _CRTIMP wchar_t * __cdecl _wcsupr(wchar_t *);
  594. _CRTIMP size_t __cdecl wcsxfrm(wchar_t *, const wchar_t *, size_t);
  595. _CRTIMP int __cdecl wcscoll(const wchar_t *, const wchar_t *);
  596. _CRTIMP int __cdecl _wcsicoll(const wchar_t *, const wchar_t *);
  597. _CRTIMP int __cdecl _wcsncoll(const wchar_t *, const wchar_t *, size_t);
  598. _CRTIMP int __cdecl _wcsnicoll(const wchar_t *, const wchar_t *, size_t);
  599.  
  600. /* Old names */
  601. #define wcswcs wcsstr
  602.  
  603. #if     !__STDC__
  604.  
  605. /* prototypes for oldnames.lib functions */
  606. _CRTIMP wchar_t * __cdecl wcsdup(const wchar_t *);
  607. _CRTIMP int __cdecl wcsicmp(const wchar_t *, const wchar_t *);
  608. _CRTIMP int __cdecl wcsnicmp(const wchar_t *, const wchar_t *, size_t);
  609. _CRTIMP wchar_t * __cdecl wcsnset(wchar_t *, wchar_t, size_t);
  610. _CRTIMP wchar_t * __cdecl wcsrev(wchar_t *);
  611. _CRTIMP wchar_t * __cdecl wcsset(wchar_t *, wchar_t);
  612. _CRTIMP wchar_t * __cdecl wcslwr(wchar_t *);
  613. _CRTIMP wchar_t * __cdecl wcsupr(wchar_t *);
  614. _CRTIMP int __cdecl wcsicoll(const wchar_t *, const wchar_t *);
  615.  
  616. #endif  /* !__STDC__ */
  617.  
  618. #define _WSTRING_DEFINED
  619. #endif
  620.  
  621. #ifndef _TM_DEFINED
  622. struct tm {
  623.         int tm_sec;     /* seconds after the minute - [0,59] */
  624.         int tm_min;     /* minutes after the hour - [0,59] */
  625.         int tm_hour;    /* hours since midnight - [0,23] */
  626.         int tm_mday;    /* day of the month - [1,31] */
  627.         int tm_mon;     /* months since January - [0,11] */
  628.         int tm_year;    /* years since 1900 */
  629.         int tm_wday;    /* days since Sunday - [0,6] */
  630.         int tm_yday;    /* days since January 1 - [0,365] */
  631.         int tm_isdst;   /* daylight savings time flag */
  632.         };
  633. #define _TM_DEFINED
  634. #endif
  635.  
  636. #ifndef _WTIME_DEFINED
  637.  
  638. /* also declared in time.h */
  639.  
  640. _CRTIMP wchar_t * __cdecl _wasctime(const struct tm *);
  641. _CRTIMP wchar_t * __cdecl _wctime(const time_t *);
  642. _CRTIMP size_t __cdecl wcsftime(wchar_t *, size_t, const wchar_t *,
  643.         const struct tm *);
  644. _CRTIMP wchar_t * __cdecl _wstrdate(wchar_t *);
  645. _CRTIMP wchar_t * __cdecl _wstrtime(wchar_t *);
  646.  
  647. #define _WTIME_DEFINED
  648. #endif
  649.  
  650.  
  651.  
  652. typedef int mbstate_t;
  653. typedef wchar_t _Wint_t;
  654.  
  655. _CRTIMP wint_t __cdecl btowc(int);
  656. _CRTIMP size_t __cdecl mbrlen(const char *, size_t, mbstate_t *);
  657. _CRTIMP size_t __cdecl mbrtowc(wchar_t *, const char *, size_t, mbstate_t *);
  658. _CRTIMP size_t __cdecl mbsrtowcs(wchar_t *, const char **, size_t, mbstate_t *);
  659.  
  660. _CRTIMP size_t __cdecl wcrtomb(char *, wchar_t, mbstate_t *);
  661. _CRTIMP size_t __cdecl wcsrtombs(char *, const wchar_t **, size_t, mbstate_t *);
  662. _CRTIMP int __cdecl wctob(wint_t);
  663.  
  664. #ifdef  __cplusplus
  665. inline int fwide(FILE *, int _M)
  666.         {return (_M); }
  667. inline int mbsinit(const mbstate_t *)
  668.         {return (1); }
  669. inline const wchar_t *wmemchr(const wchar_t *_S, wchar_t _C, size_t _N)
  670.         {for (; 0 < _N; ++_S, --_N)
  671.                 if (*_S == _C)
  672.                         return (_S);
  673.         return (0); }
  674. inline int wmemcmp(const wchar_t *_S1, const wchar_t *_S2, size_t _N)
  675.         {for (; 0 < _N; ++_S1, ++_S2, --_N)
  676.                 if (*_S1 != *_S2)
  677.                         return (*_S1 < *_S2 ? -1 : +1);
  678.         return (0); }
  679. inline wchar_t *wmemcpy(wchar_t *_S1, const wchar_t *_S2, size_t _N)
  680.         {wchar_t *_Su1 = _S1;
  681.         for (; 0 < _N; ++_Su1, ++_S2, --_N)
  682.                 *_Su1 = *_S2;
  683.         return (_S1); }
  684. inline wchar_t *wmemmove(wchar_t *_S1, const wchar_t *_S2, size_t _N)
  685.         {wchar_t *_Su1 = _S1;
  686.         if (_S2 < _Su1 && _Su1 < _S2 + _N)
  687.                 for (_Su1 += _N, _S2 += _N; 0 < _N; --_N)
  688.                         *--_Su1 = *--_S2;
  689.         else
  690.                 for (; 0 < _N; --_N)
  691.                         *_Su1++ = *_S2++;
  692.         return (_S1); }
  693. inline wchar_t *wmemset(wchar_t *_S, wchar_t _C, size_t _N)
  694.         {wchar_t *_Su = _S;
  695.         for (; 0 < _N; ++_Su, --_N)
  696.                 *_Su = _C;
  697.         return (_S); }
  698. }       /* end of extern "C" */
  699. inline wchar_t *wmemchr(wchar_t *_S, wchar_t _C, size_t _N)
  700.         {return ((wchar_t *)wmemchr((const wchar_t *)_S, _C, _N)); }
  701. inline wchar_t *wcschr(wchar_t *_S, wchar_t _C)
  702.         {return ((wchar_t *)wcschr((const wchar_t *)_S, _C)); }
  703. inline wchar_t *wcspbrk(wchar_t *_S, const wchar_t *_P)
  704.         {return ((wchar_t *)wcspbrk((const wchar_t *)_S, _P)); }
  705. inline wchar_t *wcsrchr(wchar_t *_S, wchar_t _C)
  706.         {return ((wchar_t *)wcsrchr((const wchar_t *)_S, _C)); }
  707. inline wchar_t *wcsstr(wchar_t *_S, const wchar_t *_P)
  708.         {return ((wchar_t *)wcsstr((const wchar_t *)_S, _P)); }
  709. #endif
  710.  
  711. #ifdef  _MSC_VER
  712. #pragma pack(pop)
  713. #endif  /* _MSC_VER */
  714.  
  715. #endif  /* _INC_WCHAR */
  716.  
  717.  
  718. #else   /* ndef _MAC */
  719.  
  720.  
  721. /*
  722.  * These definitions are needed on the _MAC as well as _WIN32
  723.  */
  724.  
  725. typedef int mbstate_t;
  726. typedef wchar_t _Wint_t;
  727.  
  728.  
  729. #endif  /* _MAC */
  730.