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.

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