home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c031 / 4.ddi / INCLUDE / STDIO.H$ / STDIO
Encoding:
Text File  |  1992-01-15  |  7.3 KB  |  339 lines

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