Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

810 lines
25 KiB

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