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.

648 lines
24 KiB

  1. /***
  2. *stdio.h - definitions/declarations for standard I/O routines
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This file defines the structures, values, macros, and functions
  8. * used by the level 2 I/O ("standard I/O") routines.
  9. * [ANSI/System V]
  10. *
  11. * [Public]
  12. *
  13. *Revision History:
  14. * 06-24-87 JMB Added char cast to putc macro
  15. * 07-20-87 SKS Fixed declaration of _flsbuf
  16. * 08-10-87 JCR Modified P_tmpdir/L_tmpdir
  17. * 08-17-87 PHG Fixed prototype for puts to take const char * per ANSI.
  18. * 10-02-87 JCR Changed NULL from #else to #elif (C || L || H)
  19. * 10/20/87 JCR Removed "MSC40_ONLY" entries
  20. * 11/09/87 JCR Multi-thread support
  21. * 12-11-87 JCR Added "_loadds" functionality
  22. * 12-17-87 JCR Added _MTHREAD_ONLY comments
  23. * 12-18-87 JCR Added _FAR_ to declarations
  24. * 01-07-88 JCR _NFILE = 40 for mthread includes
  25. * 01-13-88 JCR Removed mthread _fileno_lk/_feof_lk/_ferror_lk declarations
  26. * 01-15-88 JCR DLL versions of stdin/stdout/stderr
  27. * 01-18-88 SKS Change _stdio() to __iob()
  28. * 01-20-88 SKS Change __iob() to _stdin(), _stdout(), _stderr()
  29. * 02-10-88 JCR Cleaned up white space
  30. * 04-21-88 WAJ Added _FAR_ to tempnam/_tmpnam_lk
  31. * 05-31-88 SKS Add FILENAME_MAX and FOPEN_MAX
  32. * 06-01-88 JCR Removed clearerr_lk macro
  33. * 07-28-88 GJF Added casts to fileno() so the file handle is zero
  34. * extended instead of sign extended
  35. * 08-18-88 GJF Revised to also work with the 386 (in small model only).
  36. * 11-14-88 GJF Added _fsopen()
  37. * 12-07-88 JCR DLL _iob[] references are now direct
  38. * 03-27-89 GJF Brought into sync with CRT\H\STDIO.H
  39. * 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
  40. * 07-24-89 GJF Changed FILE and fpos_t to be type names rather than
  41. * macros (ANSI requirement). Same as 04-06-89 change in
  42. * CRT
  43. * 07-25-89 GJF Cleanup. Alignment of struct fields is now protected
  44. * by pack pragmas. Now specific to 386.
  45. * 10-30-89 GJF Fixed copyright, removed dummy args from prototypes
  46. * 11-02-89 JCR Changed "DLL" to "_DLL"
  47. * 11-17-89 GJF Added const to appropriate arg type for fdopen() and
  48. * _popen().
  49. * 02-16-90 GJF _iob[], _iob2[] merge
  50. * 03-02-90 GJF Added #ifndef _INC_STDIO and #include <cruntime.h>
  51. * stuff. Also, removed some (now) useless preprocessor
  52. * directives and pragmas.
  53. * 03-21-90 GJF Replaced _cdecl with _CALLTYPE1 or _CALLTYPE2 in
  54. * prototypes.
  55. * 04-10-90 GJF Made _iob[] _VARTYPE1.
  56. * 10-30-90 GJF Moved actual type for va_list into cruntime.h
  57. * 11-12-90 GJF Changed NULL to (void *)0.
  58. * 01-21-91 GJF ANSI naming.
  59. * 02-12-91 GJF Only #define NULL if it isn't #define-d.
  60. * 08-01-91 GJF No _popen(), _pclose() for Dosx32.
  61. * 08-20-91 JCR C++ and ANSI naming
  62. * 09-24-91 JCR Added _snprintf, _vsnprintf
  63. * 09-28-91 JCR ANSI names: DOSX32=prototypes, WIN32=#defines for now
  64. * 01-22-92 GJF Changed definition of _iob for users of crtdll.dll.
  65. * 02-14-92 GJF Replaced _NFILE by _NSTREAM_ for Win32. _NFILE is
  66. * still supported for now, for backwards compatibility.
  67. * 03-17-92 GJF Replaced __tmpnum field in _iobuf structure with
  68. * _tmpfname, altered L_tmpnam definition for Win32.
  69. * 03-30-92 DJM POSIX support.
  70. * 06-02-92 KRS Added Unicode printf versions.
  71. * 08-05-92 GJF Fun. calling type and var. type macro.
  72. * 08-20-92 GJF Some small changes for POSIX.
  73. * 08-20-92 GJF Some small changes for POSIX.
  74. * 09-04-92 GJF Merged changes from 8-5-92 on.
  75. * 11-05-92 GJF Replaced #ifndef __STDC__ with #if !__STDC__. Also,
  76. * undid my ill-advised change to _P_tmpdir.
  77. * 12-12-92 SRW Add L_cuserid constant for _POSIX_
  78. * 01-03-93 SRW Fold in ALPHA changes
  79. * 01-09-93 SRW Remove usage of MIPS and ALPHA to conform to ANSI
  80. * Use _MIPS_ and _ALPHA_ instead.
  81. * 01-21-93 GJF Removed support for C6-386's _cdecl.
  82. * 01-25-93 GJF Cosmetic change to va_list definition.
  83. * 02-01-93 GJF Made FILENAME_MAX 260.
  84. * 04-06-93 SKS Replace _CRTAPI1/2 with __cdecl, _CRTVAR1 with nothing
  85. * 04-07-93 SKS Add _CRTIMP keyword for CRT DLL model
  86. * Use link-time aliases for old names, not #define's
  87. * 04-29-93 CFW Add wide char get/put support.
  88. * 04-30-93 CFW Fixed wide char get/put support.
  89. * 05-04-93 CFW Remove uneeded _filwbuf, _flswbuf protos.
  90. * 05-11-93 GJF Added _INTERNAL_BUFSIZ.
  91. * 05-24-93 GJF Added _SMALL_BUFSIZ.
  92. * 06-02-93 CFW Wide get/put use wint_t.
  93. * 09-15-93 CFW Removed bogus _getc_lk/_putc_lk macros.
  94. * 09-17-93 GJF Merged Cuda and NT SDK versions.
  95. * 10-04-93 SRW Fix ifdefs for MIPS and ALPHA to only check for
  96. * _M_?????? defines
  97. * 10-12-93 GJF Re-merged.
  98. * 12-07-93 CFW Move wide defs outside __STDC__ check.
  99. * 02-04-94 CFW Add _getwchar_lk and _putwchar_lk macros.
  100. * 04-13-94 GJF Made _iob into a deference of a function return for
  101. * _DLL (for compatibility with the Win32s version of
  102. * msvcrt*.dll). Also, added conditional include for
  103. * win32s.h.
  104. * 05-03-94 GJF Made declaration of _iob for _DLL also conditional
  105. * on _M_IX86.
  106. * 06-06-94 SKS Change if def(_MT) to if def(_MT) || def(_DLL)
  107. * This will support single-thread apps using MSVCRT*.DLL
  108. * 11-03-94 GJF Ensure 8 byte alignment.
  109. * 12-14-94 SKS Increase FILE * stream limit for MSVCRT30.DLL
  110. * 12-23-94 GJF Define fpos_t to be 64-bits (__int64).
  111. * 01-04-95 GJF Changed definition of fpos_t slightly as suggested by
  112. * Richard Shupak.
  113. * 01-05-95 GJF Temporarily commented out 12-23-94 change due to bugs
  114. * in MFC and IDE.
  115. * 01-06-95 GJF -Za doesn't like C++ style comments so I deleted the
  116. * 12-23-94 change altogether.
  117. * 01-24-95 GJF Restored 64-bit fpos_t.
  118. * 02-11-95 CFW Add _CRTBLD to avoid users getting wrong headers.
  119. * 02-14-95 CFW Clean up Mac merge.
  120. * 03-03-95 GJF Changes to manage streams via __piob[], rather than
  121. * _iob[].
  122. * 03-10-95 CFW Make _[w]tempnam() parameters const.
  123. * 08-04-95 JWM BUFSIZ increased to 4096 for PMac only.
  124. * 12-14-95 JWM Add "#pragma once".
  125. * 12-22-95 GJF Added _getmaxstdio prototype.
  126. * 02-22-96 JWM Merge in PlumHall mods.
  127. * 04-18-96 JWM Inlines removed: getwchar(), putwchar(), etc.
  128. * 04-19-96 SKS Removed incorrect and inappropriate _CRTIMP on internal
  129. * only routines _getwc_lk, _putwc_lk, and _ungetwc_lk.
  130. * 06-27-96 SKS Use __int64 for fpos_t on MAC as well as WIN32
  131. * 01-20-97 GJF Cleaned out obsolete support for Win32s, _NTSDK and
  132. * _CRTAPI*.
  133. * 08-13-97 GJF Strip __p__iob prototype from release version.
  134. * 09-26-97 BWT Fix POSIX
  135. * 09-30-97 JWM Restored not-so-obsolete _CRTAPI1 support.
  136. * 10-07-97 RDL Added IA64.
  137. * 12-15-98 GJF Changes for 64-bit size_t.
  138. * 05-13-99 PML Remove _CRTAPI1
  139. * 05-17-99 PML Remove all Macintosh support.
  140. * 10-06-99 PML Add _W64 modifier to types which are 32 bits in Win32,
  141. * 64 bits in Win64.
  142. * 11-03-99 PML Add va_list definition for _M_CEE.
  143. * 11-08-99 PML wctype_t is unsigned short, not wchar_t - it's a set
  144. * of bitflags, not a wide char.
  145. * 07-20-00 GB typedefed wint_t to unsigned short
  146. * 09-07-00 PML Remove va_list definition for _M_CEE (vs7#159777)
  147. * 09-08-00 GB Added _snscanf and _snwscanf
  148. * 11-22-00 PML Wide-char *putwc* functions take a wchar_t, not wint_t.
  149. * 12-10-00 PML Define _FPOSOFF for _POSIX_ (vs7#122990)
  150. * 12-10-00 PML Fix comments about L_tmpnam (vs7#5416)
  151. * 01-29-01 GB Added _func function version of data variable used in
  152. * msvcprt.lib to work with STATIC_CPPLIB
  153. * 07-15-01 PML Remove all ALPHA, MIPS, and PPC code
  154. *
  155. ****/
  156. #if _MSC_VER > 1000 /*IFSTRIP=IGN*/
  157. #pragma once
  158. #endif
  159. #ifndef _INC_STDIO
  160. #define _INC_STDIO
  161. #if !defined(_WIN32)
  162. #error ERROR: Only Win32 target supported!
  163. #endif
  164. #ifndef _CRTBLD
  165. /* This version of the header files is NOT for user programs.
  166. * It is intended for use when building the C runtimes ONLY.
  167. * The version intended for public use will not have this message.
  168. */
  169. #error ERROR: Use of C runtime library internal header file.
  170. #endif /* _CRTBLD */
  171. #ifdef _MSC_VER
  172. /*
  173. * Currently, all MS C compilers for Win32 platforms default to 8 byte
  174. * alignment.
  175. */
  176. #pragma pack(push,8)
  177. #endif /* _MSC_VER */
  178. #ifdef __cplusplus
  179. extern "C" {
  180. #endif
  181. #ifndef _INTERNAL_IFSTRIP_
  182. #include <cruntime.h>
  183. #endif /* _INTERNAL_IFSTRIP_ */
  184. #if !defined(_W64)
  185. #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 /*IFSTRIP=IGN*/
  186. #define _W64 __w64
  187. #else
  188. #define _W64
  189. #endif
  190. #endif
  191. /* Define _CRTIMP */
  192. #ifndef _CRTIMP
  193. #ifdef CRTDLL
  194. #define _CRTIMP __declspec(dllexport)
  195. #else /* ndef CRTDLL */
  196. #ifdef _DLL
  197. #define _CRTIMP __declspec(dllimport)
  198. #else /* ndef _DLL */
  199. #define _CRTIMP
  200. #endif /* _DLL */
  201. #endif /* CRTDLL */
  202. #endif /* _CRTIMP */
  203. /* Define __cdecl for non-Microsoft compilers */
  204. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  205. #define __cdecl
  206. #endif
  207. #ifndef _SIZE_T_DEFINED
  208. #ifdef _WIN64
  209. typedef unsigned __int64 size_t;
  210. #else
  211. typedef _W64 unsigned int size_t;
  212. #endif
  213. #define _SIZE_T_DEFINED
  214. #endif
  215. #ifndef _WCHAR_T_DEFINED
  216. typedef unsigned short wchar_t;
  217. #define _WCHAR_T_DEFINED
  218. #endif
  219. #ifndef _WCTYPE_T_DEFINED
  220. typedef unsigned short wint_t;
  221. typedef unsigned short wctype_t;
  222. #define _WCTYPE_T_DEFINED
  223. #endif
  224. #ifndef _VA_LIST_DEFINED
  225. typedef char * va_list;
  226. #define _VA_LIST_DEFINED
  227. #endif
  228. /* Buffered I/O macros */
  229. #define BUFSIZ 512
  230. #ifndef _INTERNAL_IFSTRIP_
  231. /*
  232. * Real default size for stdio buffers
  233. */
  234. #define _INTERNAL_BUFSIZ 4096
  235. #define _SMALL_BUFSIZ 512
  236. #endif /* _INTERNAL_IFSTRIP_ */
  237. /*
  238. * Default number of supported streams. _NFILE is confusing and obsolete, but
  239. * supported anyway for backwards compatibility.
  240. */
  241. #define _NFILE _NSTREAM_
  242. #define _NSTREAM_ 512
  243. /*
  244. * Number of entries in _iob[] (declared below). Note that _NSTREAM_ must be
  245. * greater than or equal to _IOB_ENTRIES.
  246. */
  247. #define _IOB_ENTRIES 20
  248. #define EOF (-1)
  249. #ifndef _FILE_DEFINED
  250. struct _iobuf {
  251. char *_ptr;
  252. int _cnt;
  253. char *_base;
  254. int _flag;
  255. int _file;
  256. int _charbuf;
  257. int _bufsiz;
  258. char *_tmpfname;
  259. };
  260. typedef struct _iobuf FILE;
  261. #define _FILE_DEFINED
  262. #endif
  263. /* Directory where temporary files may be created. */
  264. #ifdef _POSIX_
  265. #define _P_tmpdir "/"
  266. #define _wP_tmpdir L"/"
  267. #else
  268. #define _P_tmpdir "\\"
  269. #define _wP_tmpdir L"\\"
  270. #endif
  271. /* L_tmpnam = length of string _P_tmpdir
  272. * + 1 if _P_tmpdir does not end in "/" or "\", else 0
  273. * + 12 (for the filename string)
  274. * + 1 (for the null terminator)
  275. */
  276. #define L_tmpnam sizeof(_P_tmpdir)+12
  277. #ifdef _POSIX_
  278. #define L_ctermid 9
  279. #define L_cuserid 32
  280. #endif
  281. /* Seek method constants */
  282. #define SEEK_CUR 1
  283. #define SEEK_END 2
  284. #define SEEK_SET 0
  285. #define FILENAME_MAX 260
  286. #define FOPEN_MAX 20
  287. #define _SYS_OPEN 20
  288. #define TMP_MAX 32767
  289. /* Define NULL pointer value */
  290. #ifndef NULL
  291. #ifdef __cplusplus
  292. #define NULL 0
  293. #else
  294. #define NULL ((void *)0)
  295. #endif
  296. #endif
  297. /* Declare _iob[] array */
  298. #ifndef _STDIO_DEFINED
  299. #ifndef _INTERNAL_IFSTRIP_
  300. /* These functions are for enabling STATIC_CPPLIB functionality */
  301. _CRTIMP FILE * __cdecl __iob_func(void);
  302. #if defined(_DLL) && defined(_M_IX86)
  303. /* Retained for compatibility with VC++ 5.0 and earlier versions */
  304. _CRTIMP extern FILE * __cdecl __p__iob(void);
  305. #endif
  306. #endif /* _INTERNAL_IFSTRIP_ */
  307. _CRTIMP extern FILE _iob[];
  308. #endif /* _STDIO_DEFINED */
  309. /* Define file position type */
  310. #ifndef _FPOS_T_DEFINED
  311. #undef _FPOSOFF
  312. #if defined (_POSIX_)
  313. typedef long fpos_t;
  314. #define _FPOSOFF(fp) ((long)(fp))
  315. #else /* _POSIX_ */
  316. #if !__STDC__ && _INTEGRAL_MAX_BITS >= 64 /*IFSTRIP=IGN*/
  317. typedef __int64 fpos_t;
  318. #define _FPOSOFF(fp) ((long)(fp))
  319. #else
  320. typedef struct fpos_t {
  321. unsigned int lopart;
  322. int hipart;
  323. } fpos_t;
  324. #define _FPOSOFF(fp) ((long)(fp).lopart)
  325. #endif
  326. #endif /* _POSIX_ */
  327. #define _FPOS_T_DEFINED
  328. #endif
  329. #define stdin (&_iob[0])
  330. #define stdout (&_iob[1])
  331. #define stderr (&_iob[2])
  332. #define _IOREAD 0x0001
  333. #define _IOWRT 0x0002
  334. #define _IOFBF 0x0000
  335. #define _IOLBF 0x0040
  336. #define _IONBF 0x0004
  337. #define _IOMYBUF 0x0008
  338. #define _IOEOF 0x0010
  339. #define _IOERR 0x0020
  340. #define _IOSTRG 0x0040
  341. #define _IORW 0x0080
  342. #ifdef _POSIX_
  343. #define _IOAPPEND 0x0200
  344. #endif
  345. /* Function prototypes */
  346. #ifndef _STDIO_DEFINED
  347. _CRTIMP int __cdecl _filbuf(FILE *);
  348. _CRTIMP int __cdecl _flsbuf(int, FILE *);
  349. #ifdef _POSIX_
  350. _CRTIMP FILE * __cdecl _fsopen(const char *, const char *);
  351. #else
  352. _CRTIMP FILE * __cdecl _fsopen(const char *, const char *, int);
  353. #endif
  354. _CRTIMP void __cdecl clearerr(FILE *);
  355. _CRTIMP int __cdecl fclose(FILE *);
  356. _CRTIMP int __cdecl _fcloseall(void);
  357. #ifdef _POSIX_
  358. _CRTIMP FILE * __cdecl fdopen(int, const char *);
  359. #else
  360. _CRTIMP FILE * __cdecl _fdopen(int, const char *);
  361. #endif
  362. _CRTIMP int __cdecl feof(FILE *);
  363. _CRTIMP int __cdecl ferror(FILE *);
  364. _CRTIMP int __cdecl fflush(FILE *);
  365. _CRTIMP int __cdecl fgetc(FILE *);
  366. _CRTIMP int __cdecl _fgetchar(void);
  367. _CRTIMP int __cdecl fgetpos(FILE *, fpos_t *);
  368. _CRTIMP char * __cdecl fgets(char *, int, FILE *);
  369. #ifdef _POSIX_
  370. _CRTIMP int __cdecl fileno(FILE *);
  371. #else
  372. _CRTIMP int __cdecl _fileno(FILE *);
  373. #endif
  374. _CRTIMP int __cdecl _flushall(void);
  375. _CRTIMP FILE * __cdecl fopen(const char *, const char *);
  376. _CRTIMP int __cdecl fprintf(FILE *, const char *, ...);
  377. _CRTIMP int __cdecl fputc(int, FILE *);
  378. _CRTIMP int __cdecl _fputchar(int);
  379. _CRTIMP int __cdecl fputs(const char *, FILE *);
  380. _CRTIMP size_t __cdecl fread(void *, size_t, size_t, FILE *);
  381. _CRTIMP FILE * __cdecl freopen(const char *, const char *, FILE *);
  382. _CRTIMP int __cdecl fscanf(FILE *, const char *, ...);
  383. _CRTIMP int __cdecl fsetpos(FILE *, const fpos_t *);
  384. _CRTIMP int __cdecl fseek(FILE *, long, int);
  385. _CRTIMP long __cdecl ftell(FILE *);
  386. _CRTIMP size_t __cdecl fwrite(const void *, size_t, size_t, FILE *);
  387. _CRTIMP int __cdecl getc(FILE *);
  388. _CRTIMP int __cdecl getchar(void);
  389. _CRTIMP int __cdecl _getmaxstdio(void);
  390. _CRTIMP char * __cdecl gets(char *);
  391. _CRTIMP int __cdecl _getw(FILE *);
  392. _CRTIMP void __cdecl perror(const char *);
  393. _CRTIMP int __cdecl _pclose(FILE *);
  394. _CRTIMP FILE * __cdecl _popen(const char *, const char *);
  395. _CRTIMP int __cdecl printf(const char *, ...);
  396. _CRTIMP int __cdecl putc(int, FILE *);
  397. _CRTIMP int __cdecl putchar(int);
  398. _CRTIMP int __cdecl puts(const char *);
  399. _CRTIMP int __cdecl _putw(int, FILE *);
  400. _CRTIMP int __cdecl remove(const char *);
  401. _CRTIMP int __cdecl rename(const char *, const char *);
  402. _CRTIMP void __cdecl rewind(FILE *);
  403. _CRTIMP int __cdecl _rmtmp(void);
  404. _CRTIMP int __cdecl scanf(const char *, ...);
  405. _CRTIMP void __cdecl setbuf(FILE *, char *);
  406. _CRTIMP int __cdecl _setmaxstdio(int);
  407. _CRTIMP int __cdecl setvbuf(FILE *, char *, int, size_t);
  408. _CRTIMP int __cdecl _snprintf(char *, size_t, const char *, ...);
  409. _CRTIMP int __cdecl sprintf(char *, const char *, ...);
  410. _CRTIMP int __cdecl _scprintf(const char *, ...);
  411. _CRTIMP int __cdecl sscanf(const char *, const char *, ...);
  412. _CRTIMP int __cdecl _snscanf(const char *, size_t, const char *, ...);
  413. _CRTIMP char * __cdecl _tempnam(const char *, const char *);
  414. _CRTIMP FILE * __cdecl tmpfile(void);
  415. _CRTIMP char * __cdecl tmpnam(char *);
  416. _CRTIMP int __cdecl ungetc(int, FILE *);
  417. _CRTIMP int __cdecl _unlink(const char *);
  418. _CRTIMP int __cdecl vfprintf(FILE *, const char *, va_list);
  419. _CRTIMP int __cdecl vprintf(const char *, va_list);
  420. _CRTIMP int __cdecl _vsnprintf(char *, size_t, const char *, va_list);
  421. _CRTIMP int __cdecl vsprintf(char *, const char *, va_list);
  422. _CRTIMP int __cdecl _vscprintf(const char *, va_list);
  423. #ifndef _WSTDIO_DEFINED
  424. /* wide function prototypes, also declared in wchar.h */
  425. #ifndef WEOF
  426. #define WEOF (wint_t)(0xFFFF)
  427. #endif
  428. #ifdef _POSIX_
  429. _CRTIMP FILE * __cdecl _wfsopen(const wchar_t *, const wchar_t *);
  430. #else
  431. _CRTIMP FILE * __cdecl _wfsopen(const wchar_t *, const wchar_t *, int);
  432. #endif
  433. _CRTIMP wint_t __cdecl fgetwc(FILE *);
  434. _CRTIMP wint_t __cdecl _fgetwchar(void);
  435. _CRTIMP wint_t __cdecl fputwc(wchar_t, FILE *);
  436. _CRTIMP wint_t __cdecl _fputwchar(wchar_t);
  437. _CRTIMP wint_t __cdecl getwc(FILE *);
  438. _CRTIMP wint_t __cdecl getwchar(void);
  439. _CRTIMP wint_t __cdecl putwc(wchar_t, FILE *);
  440. _CRTIMP wint_t __cdecl putwchar(wchar_t);
  441. _CRTIMP wint_t __cdecl ungetwc(wint_t, FILE *);
  442. _CRTIMP wchar_t * __cdecl fgetws(wchar_t *, int, FILE *);
  443. _CRTIMP int __cdecl fputws(const wchar_t *, FILE *);
  444. _CRTIMP wchar_t * __cdecl _getws(wchar_t *);
  445. _CRTIMP int __cdecl _putws(const wchar_t *);
  446. _CRTIMP int __cdecl fwprintf(FILE *, const wchar_t *, ...);
  447. _CRTIMP int __cdecl wprintf(const wchar_t *, ...);
  448. _CRTIMP int __cdecl _snwprintf(wchar_t *, size_t, const wchar_t *, ...);
  449. _CRTIMP int __cdecl swprintf(wchar_t *, const wchar_t *, ...);
  450. _CRTIMP int __cdecl _scwprintf(const wchar_t *, ...);
  451. _CRTIMP int __cdecl vfwprintf(FILE *, const wchar_t *, va_list);
  452. _CRTIMP int __cdecl vwprintf(const wchar_t *, va_list);
  453. _CRTIMP int __cdecl _vsnwprintf(wchar_t *, size_t, const wchar_t *, va_list);
  454. _CRTIMP int __cdecl vswprintf(wchar_t *, const wchar_t *, va_list);
  455. _CRTIMP int __cdecl _vscwprintf(const wchar_t *, va_list);
  456. _CRTIMP int __cdecl fwscanf(FILE *, const wchar_t *, ...);
  457. _CRTIMP int __cdecl swscanf(const wchar_t *, const wchar_t *, ...);
  458. _CRTIMP int __cdecl _snwscanf(const wchar_t *, size_t, const wchar_t *, ...);
  459. _CRTIMP int __cdecl wscanf(const wchar_t *, ...);
  460. #define getwchar() fgetwc(stdin)
  461. #define putwchar(_c) fputwc((_c),stdout)
  462. #define getwc(_stm) fgetwc(_stm)
  463. #define putwc(_c,_stm) fputwc(_c,_stm)
  464. _CRTIMP FILE * __cdecl _wfdopen(int, const wchar_t *);
  465. _CRTIMP FILE * __cdecl _wfopen(const wchar_t *, const wchar_t *);
  466. _CRTIMP FILE * __cdecl _wfreopen(const wchar_t *, const wchar_t *, FILE *);
  467. _CRTIMP void __cdecl _wperror(const wchar_t *);
  468. _CRTIMP FILE * __cdecl _wpopen(const wchar_t *, const wchar_t *);
  469. _CRTIMP int __cdecl _wremove(const wchar_t *);
  470. _CRTIMP wchar_t * __cdecl _wtempnam(const wchar_t *, const wchar_t *);
  471. _CRTIMP wchar_t * __cdecl _wtmpnam(wchar_t *);
  472. #ifdef _MT /* _MTHREAD_ONLY */
  473. wint_t __cdecl _getwc_lk(FILE *); /* _MTHREAD_ONLY */
  474. wint_t __cdecl _putwc_lk(wchar_t, FILE *); /* _MTHREAD_ONLY */
  475. wint_t __cdecl _ungetwc_lk(wint_t, FILE *); /* _MTHREAD_ONLY */
  476. char * __cdecl _wtmpnam_lk(char *); /* _MTHREAD_ONLY */
  477. #else /* ndef _MT */ /* _MTHREAD_ONLY */
  478. #define _getwc_lk(_stm) fgetwc(_stm) /* _MTHREAD_ONLY */
  479. #define _putwc_lk(_c,_stm) fputwc(_c,_stm) /* _MTHREAD_ONLY */
  480. #define _ungetwc_lk(_c,_stm) ungetwc(_c,_stm) /* _MTHREAD_ONLY */
  481. #define _wtmpnam_lk(_string) _wtmpnam(_string) /* _MTHREAD_ONLY */
  482. #endif /* _MT */ /* _MTHREAD_ONLY */
  483. #define _WSTDIO_DEFINED
  484. #endif /* _WSTDIO_DEFINED */
  485. #define _STDIO_DEFINED
  486. #endif /* _STDIO_DEFINED */
  487. /* Macro definitions */
  488. #define feof(_stream) ((_stream)->_flag & _IOEOF)
  489. #define ferror(_stream) ((_stream)->_flag & _IOERR)
  490. #define _fileno(_stream) ((_stream)->_file)
  491. #define getc(_stream) (--(_stream)->_cnt >= 0 \
  492. ? 0xff & *(_stream)->_ptr++ : _filbuf(_stream))
  493. #define putc(_c,_stream) (--(_stream)->_cnt >= 0 \
  494. ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) : _flsbuf((_c),(_stream)))
  495. #define getchar() getc(stdin)
  496. #define putchar(_c) putc((_c),stdout)
  497. #define _getc_lk(_stream) (--(_stream)->_cnt >= 0 ? 0xff & *(_stream)->_ptr++ : _filbuf(_stream)) /* _MTHREAD_ONLY */
  498. #define _putc_lk(_c,_stream) (--(_stream)->_cnt >= 0 ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) : _flsbuf((_c),(_stream))) /* _MTHREAD_ONLY */
  499. #define _getchar_lk() _getc_lk(stdin) /* _MTHREAD_ONLY */
  500. #define _putchar_lk(_c) _putc_lk((_c),stdout) /* _MTHREAD_ONLY */
  501. #define _getwchar_lk() _getwc_lk(stdin) /* _MTHREAD_ONLY */
  502. #define _putwchar_lk(_c) _putwc_lk((_c),stdout) /* _MTHREAD_ONLY */
  503. #ifdef _MT
  504. #undef getc
  505. #undef putc
  506. #undef getchar
  507. #undef putchar
  508. #endif
  509. #ifdef _MT /* _MTHREAD_ONLY */
  510. int __cdecl _fclose_lk(FILE *); /* _MTHREAD_ONLY */
  511. int __cdecl _fflush_lk(FILE *); /* _MTHREAD_ONLY */
  512. size_t __cdecl _fread_lk(void *, size_t, size_t, FILE *); /* _MTHREAD_ONLY */
  513. int __cdecl _fseek_lk(FILE *, long, int); /* _MTHREAD_ONLY */
  514. long __cdecl _ftell_lk(FILE *); /* _MTHREAD_ONLY */
  515. size_t __cdecl _fwrite_lk(const void *, size_t, size_t, FILE *); /* _MTHREAD_ONLY */
  516. char * __cdecl _tmpnam_lk(char *); /* _MTHREAD_ONLY */
  517. int __cdecl _ungetc_lk(int, FILE *); /* _MTHREAD_ONLY */
  518. #else /* not _MT */ /* _MTHREAD_ONLY */
  519. #define _fclose_lk(_stm) fclose(_stm) /* _MTHREAD_ONLY */
  520. #define _fflush_lk(_stm) fflush(_stm) /* _MTHREAD_ONLY */
  521. #define _fread_lk(_buf,_siz,_cnt,_stm) fread(_buf,_siz,_cnt,_stm) /* _MTHREAD_ONLY */
  522. #define _fseek_lk(_stm,_offset,_origin) fseek(_stm,_offset,_origin) /* _MTHREAD_ONLY */
  523. #define _ftell_lk(_stm) ftell(_stm) /* _MTHREAD_ONLY */
  524. #define _fwrite_lk(_buf,_siz,_cnt,_stm) fwrite(_buf,_siz,_cnt,_stm) /* _MTHREAD_ONLY */
  525. #define _tmpnam_lk(_string) tmpnam(_string) /* _MTHREAD_ONLY */
  526. #define _ungetc_lk(_c,_stm) ungetc(_c,_stm) /* _MTHREAD_ONLY */
  527. #endif /* _MTHREAD_ONLY */
  528. #if !__STDC__ && !defined(_POSIX_)
  529. /* Non-ANSI names for compatibility */
  530. #define P_tmpdir _P_tmpdir
  531. #define SYS_OPEN _SYS_OPEN
  532. _CRTIMP int __cdecl fcloseall(void);
  533. _CRTIMP FILE * __cdecl fdopen(int, const char *);
  534. _CRTIMP int __cdecl fgetchar(void);
  535. _CRTIMP int __cdecl fileno(FILE *);
  536. _CRTIMP int __cdecl flushall(void);
  537. _CRTIMP int __cdecl fputchar(int);
  538. _CRTIMP int __cdecl getw(FILE *);
  539. _CRTIMP int __cdecl putw(int, FILE *);
  540. _CRTIMP int __cdecl rmtmp(void);
  541. _CRTIMP char * __cdecl tempnam(const char *, const char *);
  542. _CRTIMP int __cdecl unlink(const char *);
  543. #endif /* __STDC__ */
  544. #ifdef __cplusplus
  545. }
  546. #endif
  547. #ifdef _MSC_VER
  548. #pragma pack(pop)
  549. #endif /* _MSC_VER */
  550. #endif /* _INC_STDIO */