Source code of Windows XP (NT5)
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.

654 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. *
  154. ****/
  155. #if _MSC_VER > 1000 /*IFSTRIP=IGN*/
  156. #pragma once
  157. #endif
  158. #ifndef _INC_STDIO
  159. #define _INC_STDIO
  160. #if !defined(_WIN32)
  161. #error ERROR: Only Win32 target supported!
  162. #endif
  163. #ifndef _CRTBLD
  164. /* This version of the header files is NOT for user programs.
  165. * It is intended for use when building the C runtimes ONLY.
  166. * The version intended for public use will not have this message.
  167. */
  168. #error ERROR: Use of C runtime library internal header file.
  169. #endif /* _CRTBLD */
  170. #ifdef _MSC_VER
  171. /*
  172. * Currently, all MS C compilers for Win32 platforms default to 8 byte
  173. * alignment.
  174. */
  175. #pragma pack(push,8)
  176. #endif /* _MSC_VER */
  177. #ifdef __cplusplus
  178. extern "C" {
  179. #endif
  180. #ifndef _INTERNAL_IFSTRIP_
  181. #include <cruntime.h>
  182. #endif /* _INTERNAL_IFSTRIP_ */
  183. #if !defined(_W64)
  184. #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 /*IFSTRIP=IGN*/
  185. #define _W64 __w64
  186. #else
  187. #define _W64
  188. #endif
  189. #endif
  190. /* Define _CRTIMP */
  191. #ifndef _CRTIMP
  192. #ifdef CRTDLL
  193. #define _CRTIMP __declspec(dllexport)
  194. #else /* ndef CRTDLL */
  195. #ifdef _DLL
  196. #define _CRTIMP __declspec(dllimport)
  197. #else /* ndef _DLL */
  198. #define _CRTIMP
  199. #endif /* _DLL */
  200. #endif /* CRTDLL */
  201. #endif /* _CRTIMP */
  202. /* Define __cdecl for non-Microsoft compilers */
  203. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  204. #define __cdecl
  205. #endif
  206. #ifndef _SIZE_T_DEFINED
  207. #ifdef _WIN64
  208. typedef unsigned __int64 size_t;
  209. #else
  210. typedef _W64 unsigned int size_t;
  211. #endif
  212. #define _SIZE_T_DEFINED
  213. #endif
  214. #ifndef _WCHAR_T_DEFINED
  215. typedef unsigned short wchar_t;
  216. #define _WCHAR_T_DEFINED
  217. #endif
  218. #ifndef _WCTYPE_T_DEFINED
  219. typedef unsigned short wint_t;
  220. typedef unsigned short wctype_t;
  221. #define _WCTYPE_T_DEFINED
  222. #endif
  223. #ifndef _VA_LIST_DEFINED
  224. #ifdef _M_ALPHA
  225. typedef struct {
  226. char *a0; /* pointer to first homed integer argument */
  227. int offset; /* byte offset of next parameter */
  228. } va_list;
  229. #else
  230. typedef char * va_list;
  231. #endif
  232. #define _VA_LIST_DEFINED
  233. #endif
  234. /* Buffered I/O macros */
  235. #define BUFSIZ 512
  236. #ifndef _INTERNAL_IFSTRIP_
  237. /*
  238. * Real default size for stdio buffers
  239. */
  240. #define _INTERNAL_BUFSIZ 4096
  241. #define _SMALL_BUFSIZ 512
  242. #endif /* _INTERNAL_IFSTRIP_ */
  243. /*
  244. * Default number of supported streams. _NFILE is confusing and obsolete, but
  245. * supported anyway for backwards compatibility.
  246. */
  247. #define _NFILE _NSTREAM_
  248. #define _NSTREAM_ 512
  249. /*
  250. * Number of entries in _iob[] (declared below). Note that _NSTREAM_ must be
  251. * greater than or equal to _IOB_ENTRIES.
  252. */
  253. #define _IOB_ENTRIES 20
  254. #define EOF (-1)
  255. #ifndef _FILE_DEFINED
  256. struct _iobuf {
  257. char *_ptr;
  258. int _cnt;
  259. char *_base;
  260. int _flag;
  261. int _file;
  262. int _charbuf;
  263. int _bufsiz;
  264. char *_tmpfname;
  265. };
  266. typedef struct _iobuf FILE;
  267. #define _FILE_DEFINED
  268. #endif
  269. /* Directory where temporary files may be created. */
  270. #ifdef _POSIX_
  271. #define _P_tmpdir "/"
  272. #define _wP_tmpdir L"/"
  273. #else
  274. #define _P_tmpdir "\\"
  275. #define _wP_tmpdir L"\\"
  276. #endif
  277. /* L_tmpnam = length of string _P_tmpdir
  278. * + 1 if _P_tmpdir does not end in "/" or "\", else 0
  279. * + 12 (for the filename string)
  280. * + 1 (for the null terminator)
  281. */
  282. #define L_tmpnam sizeof(_P_tmpdir)+12
  283. #ifdef _POSIX_
  284. #define L_ctermid 9
  285. #define L_cuserid 32
  286. #endif
  287. /* Seek method constants */
  288. #define SEEK_CUR 1
  289. #define SEEK_END 2
  290. #define SEEK_SET 0
  291. #define FILENAME_MAX 260
  292. #define FOPEN_MAX 20
  293. #define _SYS_OPEN 20
  294. #define TMP_MAX 32767
  295. /* Define NULL pointer value */
  296. #ifndef NULL
  297. #ifdef __cplusplus
  298. #define NULL 0
  299. #else
  300. #define NULL ((void *)0)
  301. #endif
  302. #endif
  303. /* Declare _iob[] array */
  304. #ifndef _STDIO_DEFINED
  305. #ifndef _INTERNAL_IFSTRIP_
  306. /* These functions are for enabling STATIC_CPPLIB functionality */
  307. _CRTIMP FILE * __cdecl __iob_func(void);
  308. #if defined(_DLL) && defined(_M_IX86)
  309. /* Retained for compatibility with VC++ 5.0 and earlier versions */
  310. _CRTIMP extern FILE * __cdecl __p__iob(void);
  311. #endif
  312. #endif /* _INTERNAL_IFSTRIP_ */
  313. _CRTIMP extern FILE _iob[];
  314. #endif /* _STDIO_DEFINED */
  315. /* Define file position type */
  316. #ifndef _FPOS_T_DEFINED
  317. #undef _FPOSOFF
  318. #if defined (_POSIX_)
  319. typedef long fpos_t;
  320. #define _FPOSOFF(fp) ((long)(fp))
  321. #else /* _POSIX_ */
  322. #if !__STDC__ && _INTEGRAL_MAX_BITS >= 64 /*IFSTRIP=IGN*/
  323. typedef __int64 fpos_t;
  324. #define _FPOSOFF(fp) ((long)(fp))
  325. #else
  326. typedef struct fpos_t {
  327. unsigned int lopart;
  328. int hipart;
  329. } fpos_t;
  330. #define _FPOSOFF(fp) ((long)(fp).lopart)
  331. #endif
  332. #endif /* _POSIX_ */
  333. #define _FPOS_T_DEFINED
  334. #endif
  335. #define stdin (&_iob[0])
  336. #define stdout (&_iob[1])
  337. #define stderr (&_iob[2])
  338. #define _IOREAD 0x0001
  339. #define _IOWRT 0x0002
  340. #define _IOFBF 0x0000
  341. #define _IOLBF 0x0040
  342. #define _IONBF 0x0004
  343. #define _IOMYBUF 0x0008
  344. #define _IOEOF 0x0010
  345. #define _IOERR 0x0020
  346. #define _IOSTRG 0x0040
  347. #define _IORW 0x0080
  348. #ifdef _POSIX_
  349. #define _IOAPPEND 0x0200
  350. #endif
  351. /* Function prototypes */
  352. #ifndef _STDIO_DEFINED
  353. _CRTIMP int __cdecl _filbuf(FILE *);
  354. _CRTIMP int __cdecl _flsbuf(int, FILE *);
  355. #ifdef _POSIX_
  356. _CRTIMP FILE * __cdecl _fsopen(const char *, const char *);
  357. #else
  358. _CRTIMP FILE * __cdecl _fsopen(const char *, const char *, int);
  359. #endif
  360. _CRTIMP void __cdecl clearerr(FILE *);
  361. _CRTIMP int __cdecl fclose(FILE *);
  362. _CRTIMP int __cdecl _fcloseall(void);
  363. #ifdef _POSIX_
  364. _CRTIMP FILE * __cdecl fdopen(int, const char *);
  365. #else
  366. _CRTIMP FILE * __cdecl _fdopen(int, const char *);
  367. #endif
  368. _CRTIMP int __cdecl feof(FILE *);
  369. _CRTIMP int __cdecl ferror(FILE *);
  370. _CRTIMP int __cdecl fflush(FILE *);
  371. _CRTIMP int __cdecl fgetc(FILE *);
  372. _CRTIMP int __cdecl _fgetchar(void);
  373. _CRTIMP int __cdecl fgetpos(FILE *, fpos_t *);
  374. _CRTIMP char * __cdecl fgets(char *, int, FILE *);
  375. #ifdef _POSIX_
  376. _CRTIMP int __cdecl fileno(FILE *);
  377. #else
  378. _CRTIMP int __cdecl _fileno(FILE *);
  379. #endif
  380. _CRTIMP int __cdecl _flushall(void);
  381. _CRTIMP FILE * __cdecl fopen(const char *, const char *);
  382. _CRTIMP int __cdecl fprintf(FILE *, const char *, ...);
  383. _CRTIMP int __cdecl fputc(int, FILE *);
  384. _CRTIMP int __cdecl _fputchar(int);
  385. _CRTIMP int __cdecl fputs(const char *, FILE *);
  386. _CRTIMP size_t __cdecl fread(void *, size_t, size_t, FILE *);
  387. _CRTIMP FILE * __cdecl freopen(const char *, const char *, FILE *);
  388. _CRTIMP int __cdecl fscanf(FILE *, const char *, ...);
  389. _CRTIMP int __cdecl fsetpos(FILE *, const fpos_t *);
  390. _CRTIMP int __cdecl fseek(FILE *, long, int);
  391. _CRTIMP long __cdecl ftell(FILE *);
  392. _CRTIMP size_t __cdecl fwrite(const void *, size_t, size_t, FILE *);
  393. _CRTIMP int __cdecl getc(FILE *);
  394. _CRTIMP int __cdecl getchar(void);
  395. _CRTIMP int __cdecl _getmaxstdio(void);
  396. _CRTIMP char * __cdecl gets(char *);
  397. _CRTIMP int __cdecl _getw(FILE *);
  398. _CRTIMP void __cdecl perror(const char *);
  399. _CRTIMP int __cdecl _pclose(FILE *);
  400. _CRTIMP FILE * __cdecl _popen(const char *, const char *);
  401. _CRTIMP int __cdecl printf(const char *, ...);
  402. _CRTIMP int __cdecl putc(int, FILE *);
  403. _CRTIMP int __cdecl putchar(int);
  404. _CRTIMP int __cdecl puts(const char *);
  405. _CRTIMP int __cdecl _putw(int, FILE *);
  406. _CRTIMP int __cdecl remove(const char *);
  407. _CRTIMP int __cdecl rename(const char *, const char *);
  408. _CRTIMP void __cdecl rewind(FILE *);
  409. _CRTIMP int __cdecl _rmtmp(void);
  410. _CRTIMP int __cdecl scanf(const char *, ...);
  411. _CRTIMP void __cdecl setbuf(FILE *, char *);
  412. _CRTIMP int __cdecl _setmaxstdio(int);
  413. _CRTIMP int __cdecl setvbuf(FILE *, char *, int, size_t);
  414. _CRTIMP int __cdecl _snprintf(char *, size_t, const char *, ...);
  415. _CRTIMP int __cdecl sprintf(char *, const char *, ...);
  416. _CRTIMP int __cdecl _scprintf(const char *, ...);
  417. _CRTIMP int __cdecl sscanf(const char *, const char *, ...);
  418. _CRTIMP int __cdecl _snscanf(const char *, size_t, const char *, ...);
  419. _CRTIMP char * __cdecl _tempnam(const char *, const char *);
  420. _CRTIMP FILE * __cdecl tmpfile(void);
  421. _CRTIMP char * __cdecl tmpnam(char *);
  422. _CRTIMP int __cdecl ungetc(int, FILE *);
  423. _CRTIMP int __cdecl _unlink(const char *);
  424. _CRTIMP int __cdecl vfprintf(FILE *, const char *, va_list);
  425. _CRTIMP int __cdecl vprintf(const char *, va_list);
  426. _CRTIMP int __cdecl _vsnprintf(char *, size_t, const char *, va_list);
  427. _CRTIMP int __cdecl vsprintf(char *, const char *, va_list);
  428. _CRTIMP int __cdecl _vscprintf(const char *, va_list);
  429. #ifndef _WSTDIO_DEFINED
  430. /* wide function prototypes, also declared in wchar.h */
  431. #ifndef WEOF
  432. #define WEOF (wint_t)(0xFFFF)
  433. #endif
  434. #ifdef _POSIX_
  435. _CRTIMP FILE * __cdecl _wfsopen(const wchar_t *, const wchar_t *);
  436. #else
  437. _CRTIMP FILE * __cdecl _wfsopen(const wchar_t *, const wchar_t *, int);
  438. #endif
  439. _CRTIMP wint_t __cdecl fgetwc(FILE *);
  440. _CRTIMP wint_t __cdecl _fgetwchar(void);
  441. _CRTIMP wint_t __cdecl fputwc(wchar_t, FILE *);
  442. _CRTIMP wint_t __cdecl _fputwchar(wchar_t);
  443. _CRTIMP wint_t __cdecl getwc(FILE *);
  444. _CRTIMP wint_t __cdecl getwchar(void);
  445. _CRTIMP wint_t __cdecl putwc(wchar_t, FILE *);
  446. _CRTIMP wint_t __cdecl putwchar(wchar_t);
  447. _CRTIMP wint_t __cdecl ungetwc(wint_t, FILE *);
  448. _CRTIMP wchar_t * __cdecl fgetws(wchar_t *, int, FILE *);
  449. _CRTIMP int __cdecl fputws(const wchar_t *, FILE *);
  450. _CRTIMP wchar_t * __cdecl _getws(wchar_t *);
  451. _CRTIMP int __cdecl _putws(const wchar_t *);
  452. _CRTIMP int __cdecl fwprintf(FILE *, const wchar_t *, ...);
  453. _CRTIMP int __cdecl wprintf(const wchar_t *, ...);
  454. _CRTIMP int __cdecl _snwprintf(wchar_t *, size_t, const wchar_t *, ...);
  455. _CRTIMP int __cdecl swprintf(wchar_t *, const wchar_t *, ...);
  456. _CRTIMP int __cdecl _scwprintf(const wchar_t *, ...);
  457. _CRTIMP int __cdecl vfwprintf(FILE *, const wchar_t *, va_list);
  458. _CRTIMP int __cdecl vwprintf(const wchar_t *, va_list);
  459. _CRTIMP int __cdecl _vsnwprintf(wchar_t *, size_t, const wchar_t *, va_list);
  460. _CRTIMP int __cdecl vswprintf(wchar_t *, const wchar_t *, va_list);
  461. _CRTIMP int __cdecl _vscwprintf(const wchar_t *, va_list);
  462. _CRTIMP int __cdecl fwscanf(FILE *, const wchar_t *, ...);
  463. _CRTIMP int __cdecl swscanf(const wchar_t *, const wchar_t *, ...);
  464. _CRTIMP int __cdecl _snwscanf(const wchar_t *, size_t, const wchar_t *, ...);
  465. _CRTIMP int __cdecl wscanf(const wchar_t *, ...);
  466. #define getwchar() fgetwc(stdin)
  467. #define putwchar(_c) fputwc((_c),stdout)
  468. #define getwc(_stm) fgetwc(_stm)
  469. #define putwc(_c,_stm) fputwc(_c,_stm)
  470. _CRTIMP FILE * __cdecl _wfdopen(int, const wchar_t *);
  471. _CRTIMP FILE * __cdecl _wfopen(const wchar_t *, const wchar_t *);
  472. _CRTIMP FILE * __cdecl _wfreopen(const wchar_t *, const wchar_t *, FILE *);
  473. _CRTIMP void __cdecl _wperror(const wchar_t *);
  474. _CRTIMP FILE * __cdecl _wpopen(const wchar_t *, const wchar_t *);
  475. _CRTIMP int __cdecl _wremove(const wchar_t *);
  476. _CRTIMP wchar_t * __cdecl _wtempnam(const wchar_t *, const wchar_t *);
  477. _CRTIMP wchar_t * __cdecl _wtmpnam(wchar_t *);
  478. #ifdef _MT /* _MTHREAD_ONLY */
  479. wint_t __cdecl _getwc_lk(FILE *); /* _MTHREAD_ONLY */
  480. wint_t __cdecl _putwc_lk(wchar_t, FILE *); /* _MTHREAD_ONLY */
  481. wint_t __cdecl _ungetwc_lk(wint_t, FILE *); /* _MTHREAD_ONLY */
  482. char * __cdecl _wtmpnam_lk(char *); /* _MTHREAD_ONLY */
  483. #else /* ndef _MT */ /* _MTHREAD_ONLY */
  484. #define _getwc_lk(_stm) fgetwc(_stm) /* _MTHREAD_ONLY */
  485. #define _putwc_lk(_c,_stm) fputwc(_c,_stm) /* _MTHREAD_ONLY */
  486. #define _ungetwc_lk(_c,_stm) ungetwc(_c,_stm) /* _MTHREAD_ONLY */
  487. #define _wtmpnam_lk(_string) _wtmpnam(_string) /* _MTHREAD_ONLY */
  488. #endif /* _MT */ /* _MTHREAD_ONLY */
  489. #define _WSTDIO_DEFINED
  490. #endif /* _WSTDIO_DEFINED */
  491. #define _STDIO_DEFINED
  492. #endif /* _STDIO_DEFINED */
  493. /* Macro definitions */
  494. #define feof(_stream) ((_stream)->_flag & _IOEOF)
  495. #define ferror(_stream) ((_stream)->_flag & _IOERR)
  496. #define _fileno(_stream) ((_stream)->_file)
  497. #define getc(_stream) (--(_stream)->_cnt >= 0 \
  498. ? 0xff & *(_stream)->_ptr++ : _filbuf(_stream))
  499. #define putc(_c,_stream) (--(_stream)->_cnt >= 0 \
  500. ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) : _flsbuf((_c),(_stream)))
  501. #define getchar() getc(stdin)
  502. #define putchar(_c) putc((_c),stdout)
  503. #define _getc_lk(_stream) (--(_stream)->_cnt >= 0 ? 0xff & *(_stream)->_ptr++ : _filbuf(_stream)) /* _MTHREAD_ONLY */
  504. #define _putc_lk(_c,_stream) (--(_stream)->_cnt >= 0 ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) : _flsbuf((_c),(_stream))) /* _MTHREAD_ONLY */
  505. #define _getchar_lk() _getc_lk(stdin) /* _MTHREAD_ONLY */
  506. #define _putchar_lk(_c) _putc_lk((_c),stdout) /* _MTHREAD_ONLY */
  507. #define _getwchar_lk() _getwc_lk(stdin) /* _MTHREAD_ONLY */
  508. #define _putwchar_lk(_c) _putwc_lk((_c),stdout) /* _MTHREAD_ONLY */
  509. #ifdef _MT
  510. #undef getc
  511. #undef putc
  512. #undef getchar
  513. #undef putchar
  514. #endif
  515. #ifdef _MT /* _MTHREAD_ONLY */
  516. int __cdecl _fclose_lk(FILE *); /* _MTHREAD_ONLY */
  517. int __cdecl _fflush_lk(FILE *); /* _MTHREAD_ONLY */
  518. size_t __cdecl _fread_lk(void *, size_t, size_t, FILE *); /* _MTHREAD_ONLY */
  519. int __cdecl _fseek_lk(FILE *, long, int); /* _MTHREAD_ONLY */
  520. long __cdecl _ftell_lk(FILE *); /* _MTHREAD_ONLY */
  521. size_t __cdecl _fwrite_lk(const void *, size_t, size_t, FILE *); /* _MTHREAD_ONLY */
  522. char * __cdecl _tmpnam_lk(char *); /* _MTHREAD_ONLY */
  523. int __cdecl _ungetc_lk(int, FILE *); /* _MTHREAD_ONLY */
  524. #else /* not _MT */ /* _MTHREAD_ONLY */
  525. #define _fclose_lk(_stm) fclose(_stm) /* _MTHREAD_ONLY */
  526. #define _fflush_lk(_stm) fflush(_stm) /* _MTHREAD_ONLY */
  527. #define _fread_lk(_buf,_siz,_cnt,_stm) fread(_buf,_siz,_cnt,_stm) /* _MTHREAD_ONLY */
  528. #define _fseek_lk(_stm,_offset,_origin) fseek(_stm,_offset,_origin) /* _MTHREAD_ONLY */
  529. #define _ftell_lk(_stm) ftell(_stm) /* _MTHREAD_ONLY */
  530. #define _fwrite_lk(_buf,_siz,_cnt,_stm) fwrite(_buf,_siz,_cnt,_stm) /* _MTHREAD_ONLY */
  531. #define _tmpnam_lk(_string) tmpnam(_string) /* _MTHREAD_ONLY */
  532. #define _ungetc_lk(_c,_stm) ungetc(_c,_stm) /* _MTHREAD_ONLY */
  533. #endif /* _MTHREAD_ONLY */
  534. #if !__STDC__ && !defined(_POSIX_)
  535. /* Non-ANSI names for compatibility */
  536. #define P_tmpdir _P_tmpdir
  537. #define SYS_OPEN _SYS_OPEN
  538. _CRTIMP int __cdecl fcloseall(void);
  539. _CRTIMP FILE * __cdecl fdopen(int, const char *);
  540. _CRTIMP int __cdecl fgetchar(void);
  541. _CRTIMP int __cdecl fileno(FILE *);
  542. _CRTIMP int __cdecl flushall(void);
  543. _CRTIMP int __cdecl fputchar(int);
  544. _CRTIMP int __cdecl getw(FILE *);
  545. _CRTIMP int __cdecl putw(int, FILE *);
  546. _CRTIMP int __cdecl rmtmp(void);
  547. _CRTIMP char * __cdecl tempnam(const char *, const char *);
  548. _CRTIMP int __cdecl unlink(const char *);
  549. #endif /* __STDC__ */
  550. #ifdef __cplusplus
  551. }
  552. #endif
  553. #ifdef _MSC_VER
  554. #pragma pack(pop)
  555. #endif /* _MSC_VER */
  556. #endif /* _INC_STDIO */