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.

338 lines
7.0 KiB

  1. /***
  2. *stdio.h - definitions/declarations for standard I/O routines
  3. *
  4. * Copyright (c) 1985-1992, 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. ****/
  12. #ifndef _INC_STDIO
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. #if (_MSC_VER <= 600)
  17. #define __cdecl _cdecl
  18. #define __far _far
  19. #define __near _near
  20. #endif
  21. #ifndef _SIZE_T_DEFINED
  22. typedef unsigned int size_t;
  23. #define _SIZE_T_DEFINED
  24. #endif
  25. #ifndef _VA_LIST_DEFINED
  26. typedef char *va_list;
  27. #define _VA_LIST_DEFINED
  28. #endif
  29. /* buffered I/O macros */
  30. #define BUFSIZ 512
  31. #define _NFILE 20
  32. #define EOF (-1)
  33. #ifndef _FILE_DEFINED
  34. #pragma pack(2)
  35. struct _iobuf {
  36. char *_ptr;
  37. int _cnt;
  38. char *_base;
  39. char _flag;
  40. char _file;
  41. };
  42. typedef struct _iobuf FILE;
  43. #pragma pack()
  44. #define _FILE_DEFINED
  45. #endif
  46. /* _P_tmpnam: Directory where temporary files may be created.
  47. * L_tmpnam size = size of _P_tmpdir
  48. * + 1 (in case _P_tmpdir does not end in "\\")
  49. * + 6 (for the temp number string)
  50. * + 1 (for the null terminator)
  51. */
  52. #define _P_tmpdir "\\"
  53. #define L_tmpnam sizeof(_P_tmpdir)+8
  54. /* fseek constants */
  55. #define SEEK_CUR 1
  56. #define SEEK_END 2
  57. #define SEEK_SET 0
  58. /* minimum guaranteed filename length, open file count, and unique
  59. * tmpnam filenames.
  60. */
  61. #define FILENAME_MAX 63
  62. #define FOPEN_MAX 18
  63. #define TMP_MAX 32767
  64. #define _SYS_OPEN 20
  65. /* define NULL pointer value */
  66. #ifndef NULL
  67. #ifdef __cplusplus
  68. #define NULL 0
  69. #else
  70. #define NULL ((void *)0)
  71. #endif
  72. #endif
  73. /* declare _iob[] array */
  74. #ifndef _STDIO_DEFINED
  75. extern FILE __near __cdecl _iob[];
  76. #endif
  77. /* define file position type */
  78. #ifndef _FPOS_T_DEFINED
  79. typedef long fpos_t;
  80. #define _FPOS_T_DEFINED
  81. #endif
  82. /* standard file pointers */
  83. #ifndef _WINDLL
  84. #define stdin (&_iob[0])
  85. #define stdout (&_iob[1])
  86. #define stderr (&_iob[2])
  87. #endif
  88. #ifndef _WINDOWS
  89. #define _stdaux (&_iob[3])
  90. #define _stdprn (&_iob[4])
  91. #endif
  92. #define _IOREAD 0x01
  93. #define _IOWRT 0x02
  94. #define _IOFBF 0x0
  95. #define _IOLBF 0x40
  96. #define _IONBF 0x04
  97. #define _IOMYBUF 0x08
  98. #define _IOEOF 0x10
  99. #define _IOERR 0x20
  100. #define _IOSTRG 0x40
  101. #define _IORW 0x80
  102. #ifdef _WINDOWS
  103. #ifndef _WINDLL
  104. #ifndef _WINFO_DEFINED
  105. /* interface version number */
  106. #define _QWINVER 0
  107. /* max number of windows */
  108. #define _WFILE 20
  109. /* values for windows screen buffer size */
  110. #define _WINBUFINF 0
  111. #define _WINBUFDEF -1
  112. /* size/move settings */
  113. #define _WINSIZEMIN 1
  114. #define _WINSIZEMAX 2
  115. #define _WINSIZERESTORE 3
  116. #define _WINSIZECHAR 4
  117. /* size/move query types */
  118. #define _WINMAXREQ 100
  119. #define _WINCURRREQ 101
  120. /* values for closing window */
  121. #define _WINPERSIST 1
  122. #define _WINNOPERSIST 0
  123. /* pseudo file handle for frame window */
  124. #define _WINFRAMEHAND -1
  125. /* menu items */
  126. #define _WINSTATBAR 1
  127. #define _WINTILE 2
  128. #define _WINCASCADE 3
  129. #define _WINARRANGE 4
  130. /* quickwin exit options */
  131. #define _WINEXITPROMPT 1
  132. #define _WINEXITNOPERSIST 2
  133. #define _WINEXITPERSIST 3
  134. /* open structure */
  135. #pragma pack(2)
  136. struct _wopeninfo {
  137. unsigned int _version;
  138. const char __far * _title;
  139. long _wbufsize;
  140. };
  141. #pragma pack()
  142. /* size/move structure */
  143. struct _wsizeinfo {
  144. unsigned int _version;
  145. unsigned int _type;
  146. unsigned int _x;
  147. unsigned int _y;
  148. unsigned int _h;
  149. unsigned int _w;
  150. };
  151. #define _WINFO_DEFINED
  152. #endif
  153. #endif
  154. #endif
  155. /* function prototypes */
  156. #ifndef _STDIO_DEFINED
  157. int __cdecl _filbuf(FILE *);
  158. int __cdecl _flsbuf(int, FILE *);
  159. FILE * __cdecl _fsopen(const char *,
  160. const char *, int);
  161. void __cdecl clearerr(FILE *);
  162. int __cdecl fclose(FILE *);
  163. int __cdecl _fcloseall(void);
  164. FILE * __cdecl _fdopen(int, const char *);
  165. int __cdecl feof(FILE *);
  166. int __cdecl ferror(FILE *);
  167. int __cdecl fflush(FILE *);
  168. int __cdecl fgetc(FILE *);
  169. #ifndef _WINDLL
  170. int __cdecl _fgetchar(void);
  171. #endif
  172. int __cdecl fgetpos(FILE *, fpos_t *);
  173. char * __cdecl fgets(char *, int, FILE *);
  174. int __cdecl _fileno(FILE *);
  175. int __cdecl _flushall(void);
  176. FILE * __cdecl fopen(const char *,
  177. const char *);
  178. int __cdecl fprintf(FILE *, const char *, ...);
  179. int __cdecl fputc(int, FILE *);
  180. #ifndef _WINDLL
  181. int __cdecl _fputchar(int);
  182. #endif
  183. int __cdecl fputs(const char *, FILE *);
  184. size_t __cdecl fread(void *, size_t, size_t, FILE *);
  185. FILE * __cdecl freopen(const char *,
  186. const char *, FILE *);
  187. #ifndef _WINDLL
  188. int __cdecl fscanf(FILE *, const char *, ...);
  189. #endif
  190. int __cdecl fsetpos(FILE *, const fpos_t *);
  191. int __cdecl fseek(FILE *, long, int);
  192. long __cdecl ftell(FILE *);
  193. #ifdef _WINDOWS
  194. #ifndef _WINDLL
  195. FILE * __cdecl _fwopen(struct _wopeninfo *, struct _wsizeinfo *, const char *);
  196. #endif
  197. #endif
  198. size_t __cdecl fwrite(const void *, size_t, size_t,
  199. FILE *);
  200. int __cdecl getc(FILE *);
  201. #ifndef _WINDLL
  202. int __cdecl getchar(void);
  203. char * __cdecl gets(char *);
  204. #endif
  205. int __cdecl _getw(FILE *);
  206. #ifndef _WINDLL
  207. void __cdecl perror(const char *);
  208. #endif
  209. int __cdecl printf(const char *, ...);
  210. int __cdecl putc(int, FILE *);
  211. #ifndef _WINDLL
  212. int __cdecl putchar(int);
  213. int __cdecl puts(const char *);
  214. #endif
  215. int __cdecl _putw(int, FILE *);
  216. int __cdecl remove(const char *);
  217. int __cdecl rename(const char *, const char *);
  218. void __cdecl rewind(FILE *);
  219. int __cdecl _rmtmp(void);
  220. #ifndef _WINDLL
  221. int __cdecl scanf(const char *, ...);
  222. #endif
  223. void __cdecl setbuf(FILE *, char *);
  224. int __cdecl setvbuf(FILE *, char *, int, size_t);
  225. int __cdecl _snprintf(char *, size_t, const char *, ...);
  226. int __cdecl sprintf(char *, const char *, ...);
  227. #ifndef _WINDLL
  228. int __cdecl sscanf(const char *, const char *, ...);
  229. #endif
  230. char * __cdecl _tempnam(char *, char *);
  231. FILE * __cdecl tmpfile(void);
  232. char * __cdecl tmpnam(char *);
  233. int __cdecl ungetc(int, FILE *);
  234. int __cdecl _unlink(const char *);
  235. int __cdecl vfprintf(FILE *, const char *, va_list);
  236. int __cdecl vprintf(const char *, va_list);
  237. int __cdecl _vsnprintf(char *, size_t, const char *, va_list);
  238. int __cdecl vsprintf(char *, const char *, va_list);
  239. #define _STDIO_DEFINED
  240. #endif
  241. /* macro definitions */
  242. #define feof(_stream) ((_stream)->_flag & _IOEOF)
  243. #define ferror(_stream) ((_stream)->_flag & _IOERR)
  244. #define _fileno(_stream) ((int)(unsigned char)(_stream)->_file)
  245. #define getc(_stream) (--(_stream)->_cnt >= 0 ? 0xff & *(_stream)->_ptr++ \
  246. : _filbuf(_stream))
  247. #define putc(_c,_stream) (--(_stream)->_cnt >= 0 \
  248. ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) : _flsbuf((_c),(_stream)))
  249. #ifndef _WINDLL
  250. #define getchar() getc(stdin)
  251. #define putchar(_c) putc((_c),stdout)
  252. #endif
  253. #ifndef __STDC__
  254. /* Non-ANSI names for compatibility */
  255. #define P_tmpdir _P_tmpdir
  256. #define SYS_OPEN _SYS_OPEN
  257. #ifndef _WINDOWS
  258. #define stdaux _stdaux
  259. #define stdprn _stdprn
  260. #endif
  261. int __cdecl fcloseall(void);
  262. FILE * __cdecl fdopen(int, const char *);
  263. #ifndef _WINDLL
  264. int __cdecl fgetchar(void);
  265. #endif
  266. int __cdecl fileno(FILE *);
  267. int __cdecl flushall(void);
  268. #ifndef _WINDLL
  269. int __cdecl fputchar(int);
  270. #endif
  271. int __cdecl getw(FILE *);
  272. int __cdecl putw(int, FILE *);
  273. int __cdecl rmtmp(void);
  274. char * __cdecl tempnam(char *, char *);
  275. int __cdecl unlink(const char *);
  276. #endif /* __STDC__ */
  277. #ifdef __cplusplus
  278. }
  279. #endif
  280. #define _INC_STDIO
  281. #endif /* _INC_STDIO */