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