|
|
1.1 root 1: /***
2: *stdio.h - definitions/declarations for standard I/O routines
3: *
4: * Copyright (c) 1985-1990, 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:
14: /* ensure proper alignment of struct fields */
15:
16: #pragma pack(4)
17:
18:
19: #ifndef _SIZE_T_DEFINED
20: typedef unsigned int size_t;
21: #define _SIZE_T_DEFINED
22: #endif
23:
24: #ifndef _VA_LIST_DEFINED
25: typedef char *va_list;
26: #define _VA_LIST_DEFINED
27: #endif
28:
29:
30: /* buffered I/O macros */
31:
32: #define BUFSIZ 512
33: #ifdef _MT
34: #define _NFILE 40
35: #else
36: #define _NFILE 20
37: #endif
38: #define EOF (-1)
39:
40: #ifndef _FILE_DEFINED
41: struct _iobuf {
42: char *_ptr;
43: int _cnt;
44: char *_base;
45: int _flag;
46: int _file;
47: int _charbuf;
48: int _bufsiz;
49: int __tmpnum;
50: };
51: typedef struct _iobuf FILE;
52: #define _FILE_DEFINED
53: #endif
54:
55: /* P_tmpnam: Directory where temporary files may be created.
56: * L_tmpnam size = size of P_tmpdir
57: * + 1 (in case P_tmpdir does not end in "\\")
58: * + 6 (for the temp number string)
59: * + 1 (for the null terminator)
60: */
61:
62: #define P_tmpdir "\\"
63: #define L_tmpnam sizeof(P_tmpdir)+8
64:
65: #define SEEK_CUR 1
66: #define SEEK_END 2
67: #define SEEK_SET 0
68:
69: #define FILENAME_MAX 63
70: #define FOPEN_MAX 20
71: #define SYS_OPEN 20
72: #define TMP_MAX 32767
73:
74:
75: /* define NULL pointer value */
76:
77: #define NULL 0
78:
79:
80: /* declare _iob[] array */
81:
82: #ifndef _STDIO_DEFINED
83: extern FILE _cdecl _iob[];
84: #endif
85:
86:
87: /* define file position type */
88:
89: #ifndef _FPOS_T_DEFINED
90: typedef long fpos_t;
91: #define _FPOS_T_DEFINED
92: #endif
93:
94:
95: #define stdin (&_iob[0])
96: #define stdout (&_iob[1])
97: #define stderr (&_iob[2])
98:
99:
100: #define _IOREAD 0x0001
101: #define _IOWRT 0x0002
102:
103: #define _IOFBF 0x0000
104: #define _IOLBF 0x0040
105: #define _IONBF 0x0004
106:
107: #define _IOMYBUF 0x0008
108: #define _IOEOF 0x0010
109: #define _IOERR 0x0020
110: #define _IOSTRG 0x0040
111: #define _IORW 0x0080
112:
113:
114: /* function prototypes */
115:
116: #ifndef _STDIO_DEFINED
117: int _cdecl _filbuf(FILE *);
118: int _cdecl _flsbuf(int, FILE *);
119: FILE * _cdecl _fsopen(const char *, const char *, int);
120: void _cdecl clearerr(FILE *);
121: int _cdecl fclose(FILE *);
122: int _cdecl fcloseall(void);
123: FILE * _cdecl fdopen(int, const char *);
124: int _cdecl feof(FILE *);
125: int _cdecl ferror(FILE *);
126: int _cdecl fflush(FILE *);
127: int _cdecl fgetc(FILE *);
128: int _cdecl fgetchar(void);
129: int _cdecl fgetpos(FILE *, fpos_t *);
130: char * _cdecl fgets(char *, int, FILE *);
131: int _cdecl fileno(FILE *);
132: int _cdecl flushall(void);
133: FILE * _cdecl fopen(const char *, const char *);
134: int _cdecl fprintf(FILE *, const char *, ...);
135: int _cdecl fputc(int, FILE *);
136: int _cdecl fputchar(int);
137: int _cdecl fputs(const char *, FILE *);
138: size_t _cdecl fread(void *, size_t, size_t, FILE *);
139: FILE * _cdecl freopen(const char *, const char *, FILE *);
140: int _cdecl fscanf(FILE *, const char *, ...);
141: int _cdecl fsetpos(FILE *, const fpos_t *);
142: int _cdecl fseek(FILE *, long, int);
143: long _cdecl ftell(FILE *);
144: size_t _cdecl fwrite(const void *, size_t, size_t, FILE *);
145: int _cdecl getc(FILE *);
146: int _cdecl getchar(void);
147: char * _cdecl gets(char *);
148: int _cdecl getw(FILE *);
149: void _cdecl perror(const char *);
150: int _cdecl _pclose(FILE *);
151: FILE * _cdecl _popen(const char *, const char *);
152: int _cdecl printf(const char *, ...);
153: int _cdecl putc(int, FILE *);
154: int _cdecl putchar(int);
155: int _cdecl puts(const char *);
156: int _cdecl putw(int, FILE *);
157: int _cdecl remove(const char *);
158: int _cdecl rename(const char *, const char *);
159: void _cdecl rewind(FILE *);
160: int _cdecl rmtmp(void);
161: int _cdecl scanf(const char *, ...);
162: void _cdecl setbuf(FILE *, char *);
163: int _cdecl setvbuf(FILE *, char *, int, size_t);
164: int _cdecl sprintf(char *, const char *, ...);
165: int _cdecl sscanf(const char *, const char *, ...);
166: char * _cdecl tempnam(char *, char *);
167: FILE * _cdecl tmpfile(void);
168: char * _cdecl tmpnam(char *);
169: int _cdecl ungetc(int, FILE *);
170: int _cdecl unlink(const char *);
171: int _cdecl vfprintf(FILE *, const char *, va_list);
172: int _cdecl vprintf(const char *, va_list);
173: int _cdecl vsprintf(char *, const char *, va_list);
174: #define _STDIO_DEFINED
175: #endif
176:
177:
178: /* macro definitions */
179:
180: #define feof(_stream) ((_stream)->_flag & _IOEOF)
181: #define ferror(_stream) ((_stream)->_flag & _IOERR)
182: #define fileno(_stream) ((_stream)->_file)
183: #define getc(_stream) (--(_stream)->_cnt >= 0 ? 0xff & *(_stream)->_ptr++ \
184: : _filbuf(_stream))
185: #define putc(_c,_stream) (--(_stream)->_cnt >= 0 \
186: ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) : _flsbuf((_c),(_stream)))
187: #define getchar() getc(stdin)
188: #define putchar(_c) putc((_c),stdout)
189:
190: #ifdef _MT
191: #undef getc
192: #undef putc
193: #undef getchar
194: #undef putchar
195: #endif
196:
197:
198: /* restore default alignment */
199:
200: #pragma pack()
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.