|
|
1.1 root 1: /***
2: *stdio.h - definitions/declarations for standard I/O routines
3: *
1.1.1.2 root 4: * Copyright (c) 1985-1992, Microsoft Corporation. All rights reserved.
1.1 root 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:
1.1.1.3 ! root 20: /*
! 21: * Conditional macro definition for function calling type and variable type
! 22: * qualifiers.
! 23: */
! 24: #if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
! 25:
! 26: /*
! 27: * Definitions for MS C8-32 (386/486) compiler
! 28: */
! 29: #define _CRTAPI1 __cdecl
! 30: #define _CRTAPI2 __cdecl
! 31:
! 32: #elif ( _MSC_VER == 600 )
! 33:
! 34: /*
! 35: * Definitions for old MS C6-386 compiler
! 36: */
! 37: #define _CRTAPI1 _cdecl
! 38: #define _CRTAPI2 _cdecl
! 39: #define _M_IX86 300
! 40:
! 41: #else
! 42:
! 43: /*
! 44: * Other compilers (e.g., MIPS)
! 45: */
! 46: #define _CRTAPI1
! 47: #define _CRTAPI2
! 48:
1.1.1.2 root 49: #endif
1.1 root 50:
1.1.1.3 ! root 51:
1.1 root 52: #ifndef _SIZE_T_DEFINED
53: typedef unsigned int size_t;
54: #define _SIZE_T_DEFINED
55: #endif
56:
1.1.1.2 root 57: #ifndef _WCHAR_T_DEFINED
58: typedef unsigned short wchar_t;
59: #define _WCHAR_T_DEFINED
60: #endif
61:
1.1 root 62: #ifndef _VA_LIST_DEFINED
63: typedef char * va_list;
64: #define _VA_LIST_DEFINED
65: #endif
66:
67:
68: /* buffered I/O macros */
69:
70: #define BUFSIZ 512
1.1.1.2 root 71:
72: /*
73: * Number of supported streams. _NFILE is confusing and obsolete, but
74: * supported anyway for backwards compatibility.
75: */
76: #define _NFILE _NSTREAM_
1.1 root 77: #ifdef _MT
1.1.1.2 root 78: #define _NSTREAM_ 40
1.1 root 79: #else
1.1.1.2 root 80: #define _NSTREAM_ 20
1.1 root 81: #endif
1.1.1.2 root 82:
83:
1.1 root 84: #define EOF (-1)
85:
86: #ifndef _FILE_DEFINED
87: struct _iobuf {
88: char *_ptr;
89: int _cnt;
90: char *_base;
91: int _flag;
92: int _file;
93: int _charbuf;
94: int _bufsiz;
1.1.1.2 root 95: char *_tmpfname;
1.1 root 96: };
97: typedef struct _iobuf FILE;
98: #define _FILE_DEFINED
99: #endif
100:
1.1.1.2 root 101: /* Directory where temporary files may be created. */
1.1.1.3 ! root 102:
! 103: #define _P_tmpdir "/"
! 104:
1.1.1.2 root 105:
106: /* L_tmpnam = size of P_tmpdir
1.1.1.3 ! root 107: * + 1 (in case P_tmpdir does not end in "/")
1.1.1.2 root 108: * + 12 (for the filename string)
109: * + 1 (for the null terminator)
1.1 root 110: */
1.1.1.2 root 111: #define L_tmpnam sizeof(_P_tmpdir)+12
1.1 root 112:
113:
1.1.1.3 ! root 114: #ifdef _POSIX_
! 115: #define L_ctermid 9
! 116: #endif
! 117:
1.1 root 118: #define SEEK_CUR 1
119: #define SEEK_END 2
120: #define SEEK_SET 0
121:
122: #define FILENAME_MAX 63
123: #define FOPEN_MAX 20
124: #define _SYS_OPEN 20
125: #define TMP_MAX 32767
126:
127:
128: /* define NULL pointer value */
129:
130: #ifndef NULL
131: #ifdef __cplusplus
132: #define NULL 0
133: #else
134: #define NULL ((void *)0)
135: #endif
136: #endif
137:
138:
139: /* declare _iob[] array */
140:
141: #ifndef _STDIO_DEFINED
1.1.1.2 root 142: #ifdef _DLL
143: extern FILE * _iob;
144: #else
1.1 root 145: extern FILE _iob[];
146: #endif
1.1.1.2 root 147: #endif
1.1 root 148:
149:
150: /* define file position type */
151:
152: #ifndef _FPOS_T_DEFINED
153: typedef long fpos_t;
154: #define _FPOS_T_DEFINED
155: #endif
156:
157:
158: #define stdin (&_iob[0])
159: #define stdout (&_iob[1])
160: #define stderr (&_iob[2])
161:
162:
163: #define _IOREAD 0x0001
164: #define _IOWRT 0x0002
165:
166: #define _IOFBF 0x0000
167: #define _IOLBF 0x0040
168: #define _IONBF 0x0004
169:
170: #define _IOMYBUF 0x0008
171: #define _IOEOF 0x0010
172: #define _IOERR 0x0020
173: #define _IOSTRG 0x0040
174: #define _IORW 0x0080
1.1.1.2 root 175: #ifdef _POSIX_
176: #define _IOAPPEND 0x0100
177: #endif
1.1 root 178:
179: /* function prototypes */
180:
181: #ifndef _STDIO_DEFINED
1.1.1.3 ! root 182: int _CRTAPI1 _filbuf(FILE *);
! 183: int _CRTAPI1 _flsbuf(int, FILE *);
1.1.1.2 root 184:
185: #ifdef _POSIX_
1.1.1.3 ! root 186: FILE * _CRTAPI1 _fsopen(const char *, const char *);
1.1.1.2 root 187: #else
1.1.1.3 ! root 188: FILE * _CRTAPI1 _fsopen(const char *, const char *, int);
1.1.1.2 root 189: #endif
190:
1.1.1.3 ! root 191: void _CRTAPI1 clearerr(FILE *);
! 192: int _CRTAPI1 fclose(FILE *);
! 193: int _CRTAPI1 _fcloseall(void);
1.1.1.2 root 194: #ifdef _POSIX_
1.1.1.3 ! root 195: FILE * _CRTAPI1 fdopen(int, const char *);
1.1.1.2 root 196: #else
1.1.1.3 ! root 197: FILE * _CRTAPI1 _fdopen(int, const char *);
1.1.1.2 root 198: #endif
1.1.1.3 ! root 199: int _CRTAPI1 feof(FILE *);
! 200: int _CRTAPI1 ferror(FILE *);
! 201: int _CRTAPI1 fflush(FILE *);
! 202: int _CRTAPI1 fgetc(FILE *);
! 203: int _CRTAPI1 _fgetchar(void);
! 204: int _CRTAPI1 fgetpos(FILE *, fpos_t *);
! 205: char * _CRTAPI1 fgets(char *, int, FILE *);
1.1.1.2 root 206: #ifdef _POSIX_
1.1.1.3 ! root 207: int _CRTAPI1 fileno(FILE *);
1.1.1.2 root 208: #else
1.1.1.3 ! root 209: int _CRTAPI1 _fileno(FILE *);
1.1.1.2 root 210: #endif
1.1.1.3 ! root 211: int _CRTAPI1 _flushall(void);
! 212: FILE * _CRTAPI1 fopen(const char *, const char *);
! 213: int _CRTAPI2 fprintf(FILE *, const char *, ...);
! 214: int _CRTAPI1 fputc(int, FILE *);
! 215: int _CRTAPI1 _fputchar(int);
! 216: int _CRTAPI1 fputs(const char *, FILE *);
! 217: size_t _CRTAPI1 fread(void *, size_t, size_t, FILE *);
! 218: FILE * _CRTAPI1 freopen(const char *, const char *, FILE *);
! 219: int _CRTAPI2 fscanf(FILE *, const char *, ...);
! 220: int _CRTAPI1 fsetpos(FILE *, const fpos_t *);
! 221: int _CRTAPI1 fseek(FILE *, long, int);
! 222: long _CRTAPI1 ftell(FILE *);
! 223: size_t _CRTAPI1 fwrite(const void *, size_t, size_t, FILE *);
! 224: int _CRTAPI1 getc(FILE *);
! 225: int _CRTAPI1 getchar(void);
! 226: char * _CRTAPI1 gets(char *);
! 227: int _CRTAPI1 _getw(FILE *);
! 228: void _CRTAPI1 perror(const char *);
! 229: int _CRTAPI1 _pclose(FILE *);
! 230: FILE * _CRTAPI1 _popen(const char *, const char *);
! 231: int _CRTAPI2 printf(const char *, ...);
! 232: int _CRTAPI1 putc(int, FILE *);
! 233: int _CRTAPI1 putchar(int);
! 234: int _CRTAPI1 puts(const char *);
! 235: int _CRTAPI1 _putw(int, FILE *);
! 236: int _CRTAPI1 remove(const char *);
! 237: int _CRTAPI1 rename(const char *, const char *);
! 238: void _CRTAPI1 rewind(FILE *);
! 239: int _CRTAPI1 _rmtmp(void);
! 240: int _CRTAPI2 scanf(const char *, ...);
! 241: void _CRTAPI1 setbuf(FILE *, char *);
! 242: int _CRTAPI1 setvbuf(FILE *, char *, int, size_t);
! 243: int _CRTAPI2 _snprintf(char *, size_t, const char *, ...);
! 244: int _CRTAPI2 sprintf(char *, const char *, ...);
! 245: int _CRTAPI2 sscanf(const char *, const char *, ...);
! 246: char * _CRTAPI1 _tempnam(char *, char *);
! 247: FILE * _CRTAPI1 tmpfile(void);
! 248: char * _CRTAPI1 tmpnam(char *);
! 249: int _CRTAPI1 ungetc(int, FILE *);
! 250: int _CRTAPI1 _unlink(const char *);
! 251: int _CRTAPI1 vfprintf(FILE *, const char *, va_list);
! 252: int _CRTAPI1 vprintf(const char *, va_list);
! 253: int _CRTAPI1 _vsnprintf(char *, size_t, const char *, va_list);
! 254: int _CRTAPI1 vsprintf(char *, const char *, va_list);
1.1.1.2 root 255: #ifndef __STDC__
256: #ifndef _WSTDIO_DEFINED
257: /* declared in wchar.h, officially */
1.1.1.3 ! root 258: int _CRTAPI2 fwprintf(FILE *, const wchar_t *, ...);
! 259: int _CRTAPI2 wprintf(const wchar_t *, ...);
! 260: int _CRTAPI2 _snwprintf(wchar_t *, size_t, const wchar_t *, ...);
! 261: int _CRTAPI2 swprintf(wchar_t *, const wchar_t *, ...);
! 262: int _CRTAPI1 vfwprintf(FILE *, const wchar_t *, va_list);
! 263: int _CRTAPI1 vwprintf(const wchar_t *, va_list);
! 264: int _CRTAPI1 _vsnwprintf(wchar_t *, size_t, const wchar_t *, va_list);
! 265: int _CRTAPI1 vswprintf(wchar_t *, const wchar_t *, va_list);
! 266: int _CRTAPI2 fwscanf(FILE *, const wchar_t *, ...);
! 267: int _CRTAPI2 swscanf(const wchar_t *, const wchar_t *, ...);
! 268: int _CRTAPI2 wscanf(const wchar_t *, ...);
1.1.1.2 root 269: #define _WSTDIO_DEFINED
270: #endif
271: #endif /* !__STDC__ */
1.1 root 272: #define _STDIO_DEFINED
273: #endif
274:
275:
276: /* macro definitions */
277:
278: #define feof(_stream) ((_stream)->_flag & _IOEOF)
279: #define ferror(_stream) ((_stream)->_flag & _IOERR)
280: #define _fileno(_stream) ((_stream)->_file)
281: #define getc(_stream) (--(_stream)->_cnt >= 0 ? 0xff & *(_stream)->_ptr++ \
282: : _filbuf(_stream))
283: #define putc(_c,_stream) (--(_stream)->_cnt >= 0 \
284: ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) : _flsbuf((_c),(_stream)))
285: #define getchar() getc(stdin)
286: #define putchar(_c) putc((_c),stdout)
287:
288: #ifdef _MT
289: #undef getc
290: #undef putc
291: #undef getchar
292: #undef putchar
293: #endif
294:
1.1.1.2 root 295: #if !__STDC__ && !defined(_POSIX_)
1.1 root 296: /* Non-ANSI names for compatibility */
297:
298: #define P_tmpdir _P_tmpdir
299: #define SYS_OPEN _SYS_OPEN
300:
301: #define fcloseall _fcloseall
302: #define fdopen _fdopen
303: #define fgetchar _fgetchar
304: #define fileno _fileno
305: #define flushall _flushall
306: #define fputchar _fputchar
307: #define getw _getw
308: #define putw _putw
309: #define rmtmp _rmtmp
310: #define tempnam _tempnam
311: #define unlink _unlink
312:
313: #endif /* __STDC__ */
314:
315: #ifdef __cplusplus
316: }
317: #endif
318:
319: #define _INC_STDIO
320: #endif /* _INC_STDIO */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.