1 | /* stdio.h (emx+gcc) */
|
---|
2 |
|
---|
3 | #ifndef _STDIO_H
|
---|
4 | #define _STDIO_H
|
---|
5 |
|
---|
6 | #if defined (__cplusplus)
|
---|
7 | extern "C" {
|
---|
8 | #endif
|
---|
9 |
|
---|
10 | #if !defined (_SIZE_T)
|
---|
11 | #define _SIZE_T
|
---|
12 | typedef unsigned long size_t;
|
---|
13 | #endif
|
---|
14 |
|
---|
15 | #if !defined (NULL)
|
---|
16 | #if defined (__cplusplus)
|
---|
17 | #define NULL 0
|
---|
18 | #else
|
---|
19 | #define NULL ((void *)0)
|
---|
20 | #endif
|
---|
21 | #endif
|
---|
22 |
|
---|
23 | #if !defined (BUFSIZ)
|
---|
24 | #define BUFSIZ 5120
|
---|
25 | #endif
|
---|
26 |
|
---|
27 | #if !defined (_FILE_T)
|
---|
28 | #define _FILE_T
|
---|
29 | #define _FILE_MEMBERS_HAVE_UNDERSCORE
|
---|
30 | struct _file2;
|
---|
31 | struct _FILE
|
---|
32 | {
|
---|
33 | char * _ptr;
|
---|
34 | char * _buffer;
|
---|
35 | int _rcount;
|
---|
36 | int _wcount;
|
---|
37 | int _handle;
|
---|
38 | int _flags;
|
---|
39 | int _buf_size;
|
---|
40 | int _tmpidx;
|
---|
41 | int _pid;
|
---|
42 | char _char_buf;
|
---|
43 | unsigned char _ungetc_count;
|
---|
44 | short _mbstate;
|
---|
45 | int (*_flush)(struct _FILE *, int);
|
---|
46 | struct _file2 *_more;
|
---|
47 | };
|
---|
48 |
|
---|
49 | typedef struct _FILE FILE;
|
---|
50 |
|
---|
51 | extern FILE _streamv[];
|
---|
52 |
|
---|
53 | #define stdin (&_streamv[0])
|
---|
54 | #define stdout (&_streamv[1])
|
---|
55 | #define stderr (&_streamv[2])
|
---|
56 |
|
---|
57 | #endif
|
---|
58 |
|
---|
59 | #if !defined (SEEK_SET)
|
---|
60 | #define SEEK_SET 0
|
---|
61 | #define SEEK_CUR 1
|
---|
62 | #define SEEK_END 2
|
---|
63 | #endif
|
---|
64 |
|
---|
65 | #if !defined (EOF)
|
---|
66 | #define EOF (-1)
|
---|
67 | #endif
|
---|
68 |
|
---|
69 | #if !defined (_IOREAD)
|
---|
70 | #define _IOREAD 0x01
|
---|
71 | #define _IOWRT 0x02
|
---|
72 | #define _IORW 0x04
|
---|
73 | #define _IOEOF 0x08
|
---|
74 | #define _IOERR 0x10
|
---|
75 | #define _IOFBF 0x00
|
---|
76 | #define _IOLBF 0x20
|
---|
77 | #define _IONBF 0x40
|
---|
78 | #endif
|
---|
79 |
|
---|
80 | #if !defined (FOPEN_MAX)
|
---|
81 | #define FOPEN_MAX 14
|
---|
82 | #endif
|
---|
83 |
|
---|
84 | #if !defined (FILENAME_MAX)
|
---|
85 | #define FILENAME_MAX 260
|
---|
86 | #endif
|
---|
87 |
|
---|
88 | #if !defined (TMP_MAX)
|
---|
89 | #define TMP_MAX 1000
|
---|
90 | #endif
|
---|
91 |
|
---|
92 | #if !defined (P_tmpdir)
|
---|
93 | #define P_tmpdir "."
|
---|
94 | #define L_tmpnam (sizeof (P_tmpdir) + 13)
|
---|
95 | #endif
|
---|
96 |
|
---|
97 | #if !defined (L_cuserid)
|
---|
98 | #define L_cuserid 9
|
---|
99 | #endif
|
---|
100 |
|
---|
101 | #if !defined (_FPOS_T)
|
---|
102 | #define _FPOS_T
|
---|
103 | typedef struct
|
---|
104 | {
|
---|
105 | long _pos;
|
---|
106 | long _reserved1;
|
---|
107 | short _mbstate;
|
---|
108 | short _reserved2;
|
---|
109 | } fpos_t;
|
---|
110 | #endif
|
---|
111 |
|
---|
112 | #if !defined (_VA_LIST)
|
---|
113 | #define _VA_LIST
|
---|
114 | typedef char *va_list;
|
---|
115 | #endif
|
---|
116 |
|
---|
117 | void clearerr (FILE *);
|
---|
118 | int fclose (FILE *);
|
---|
119 | int feof (FILE *);
|
---|
120 | int ferror (FILE *);
|
---|
121 | int fflush (FILE *);
|
---|
122 | int fgetc (FILE *);
|
---|
123 | int fgetpos (FILE *, fpos_t *);
|
---|
124 | char *fgets (char *, int, FILE *);
|
---|
125 | FILE *fopen (__const__ char *, __const__ char *);
|
---|
126 | int fprintf (FILE *, __const__ char *, ...);
|
---|
127 | int fputc (int, FILE *);
|
---|
128 | int fputs (__const__ char *, FILE *);
|
---|
129 | size_t fread (void *, size_t, size_t, FILE *);
|
---|
130 | FILE *freopen (__const__ char *, __const__ char *, FILE *);
|
---|
131 | int fscanf (FILE *, __const__ char *, ...);
|
---|
132 | int fseek (FILE *, long, int);
|
---|
133 | int fsetpos (FILE *, __const__ fpos_t *);
|
---|
134 | long ftell (FILE *);
|
---|
135 | size_t fwrite (__const__ void *, size_t, size_t, FILE *);
|
---|
136 | int getchar (void);
|
---|
137 | char *gets (char *);
|
---|
138 | void perror (__const__ char *);
|
---|
139 | int printf (__const__ char *, ...);
|
---|
140 | int putchar (int);
|
---|
141 | int puts (__const__ char *);
|
---|
142 | int remove (__const__ char *);
|
---|
143 | int rename (__const__ char *, __const__ char *);
|
---|
144 | void rewind (FILE *);
|
---|
145 | int scanf (__const__ char *, ...);
|
---|
146 | int setbuf (FILE *, char *);
|
---|
147 | int setvbuf (FILE *, char *, int, size_t);
|
---|
148 | int sprintf (char *, __const__ char *, ...);
|
---|
149 | int sscanf (__const__ char *, __const__ char *, ...);
|
---|
150 | FILE *tmpfile (void);
|
---|
151 | char *tmpnam (char *);
|
---|
152 | int ungetc (int, FILE *);
|
---|
153 | int vfprintf (FILE *, __const__ char *, va_list);
|
---|
154 | int vprintf (__const__ char *, va_list);
|
---|
155 | int vsprintf (char *, __const__ char *, va_list);
|
---|
156 |
|
---|
157 | int _fill (FILE *);
|
---|
158 | int _flush (int, FILE *);
|
---|
159 | int _rmtmp (void);
|
---|
160 |
|
---|
161 | int _getc_inline (FILE *);
|
---|
162 | int _putc_inline (int, FILE *);
|
---|
163 |
|
---|
164 | extern __inline__ int feof (FILE *_s)
|
---|
165 | {
|
---|
166 | return (_s->_flags & _IOEOF ? 1 : 0);
|
---|
167 | }
|
---|
168 |
|
---|
169 | extern __inline__ int ferror (FILE *_s)
|
---|
170 | {
|
---|
171 | return (_s->_flags & _IOERR ? 1 : 0);
|
---|
172 | }
|
---|
173 |
|
---|
174 | /* Do not use this function in application programs! */
|
---|
175 |
|
---|
176 | extern __inline__ int _getc_inline (FILE *_s)
|
---|
177 | {
|
---|
178 | return (--_s->_rcount >= 0
|
---|
179 | ? (unsigned char)*_s->_ptr++
|
---|
180 | : _fill (_s));
|
---|
181 | }
|
---|
182 |
|
---|
183 | /* Do not use this function in application programs! */
|
---|
184 |
|
---|
185 | extern __inline__ int _putc_inline (int _c, FILE *_s)
|
---|
186 | {
|
---|
187 | return (--_s->_wcount >= 0 && (_c != '\n' || !(_s->_flags & _IOLBF))
|
---|
188 | ? (unsigned char)(*_s->_ptr++ = (char)_c)
|
---|
189 | : _flush (_c, _s));
|
---|
190 | }
|
---|
191 |
|
---|
192 | #if defined (__MT__)
|
---|
193 |
|
---|
194 | #define getc(s) fgetc(s)
|
---|
195 | #define putc(c,s) fputc(c,s)
|
---|
196 |
|
---|
197 | #else
|
---|
198 |
|
---|
199 | #define getc(s) _getc_inline(s)
|
---|
200 | #define putc(c,s) _putc_inline(c,s)
|
---|
201 |
|
---|
202 | #endif
|
---|
203 |
|
---|
204 | extern __inline__ int getchar (void) { return getc (stdin); }
|
---|
205 | extern __inline__ int putchar (int _c) { return putc (_c, stdout); }
|
---|
206 |
|
---|
207 |
|
---|
208 | #if !defined (__STRICT_ANSI__)
|
---|
209 |
|
---|
210 | /* POSIX.1 */
|
---|
211 |
|
---|
212 | /* ctermid() */
|
---|
213 | FILE *fdopen (int, __const__ char *);
|
---|
214 | int fileno (FILE *);
|
---|
215 |
|
---|
216 | extern __inline__ int fileno (FILE *_s) { return _s->_handle; }
|
---|
217 |
|
---|
218 | #endif
|
---|
219 |
|
---|
220 |
|
---|
221 | #if !defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)
|
---|
222 |
|
---|
223 | char *cuserid (char *);
|
---|
224 | int getw (FILE *);
|
---|
225 | int fcloseall (void);
|
---|
226 | int fgetchar (void);
|
---|
227 | int flushall (void);
|
---|
228 | int fputchar (int);
|
---|
229 | int pclose (FILE *);
|
---|
230 | FILE *popen (__const__ char *, __const__ char *);
|
---|
231 | int putw (int, FILE *);
|
---|
232 | int setbuffer (FILE *, char *, size_t);
|
---|
233 | int snprintf (char *, size_t, __const__ char *, ...);
|
---|
234 | char *tempnam (__const__ char *, __const__ char *);
|
---|
235 | int vfscanf (FILE *, __const__ char *, va_list);
|
---|
236 | int vscanf (__const__ char *, va_list);
|
---|
237 | int vsnprintf (char *, size_t, __const__ char *, va_list);
|
---|
238 | int vsscanf (__const__ char *, __const__ char *, va_list);
|
---|
239 |
|
---|
240 | #endif
|
---|
241 |
|
---|
242 |
|
---|
243 | #if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) \
|
---|
244 | || defined (_WITH_UNDERSCORE)
|
---|
245 |
|
---|
246 | int _fcloseall (void);
|
---|
247 | FILE *_fassign (FILE *, FILE *);
|
---|
248 | FILE *_fdopen (int, __const__ char *);
|
---|
249 | int _fgetchar (void);
|
---|
250 | int _flushall (void);
|
---|
251 | int _fputchar (int);
|
---|
252 | int _fseek_hdr (FILE *);
|
---|
253 | int _fsetmode (FILE *, __const__ char *);
|
---|
254 | FILE *_fsopen (__const__ char *, __const__ char *, int);
|
---|
255 | int _getw (FILE *);
|
---|
256 | char *_mfclose (FILE *);
|
---|
257 | FILE *_mfopen (char *, __const__ char *, size_t, int);
|
---|
258 | int _pclose (FILE *);
|
---|
259 | FILE *_popen (__const__ char *, __const__ char *);
|
---|
260 | int _putw (int, FILE *);
|
---|
261 | int _setbuffer (FILE *, char *, size_t);
|
---|
262 | int _snprintf (char *, size_t, __const__ char *, ...);
|
---|
263 | char *_tempnam (__const__ char *, __const__ char *);
|
---|
264 | int _vsnprintf (char *, size_t, __const__ char *, va_list);
|
---|
265 |
|
---|
266 | #endif
|
---|
267 |
|
---|
268 |
|
---|
269 | #if defined (__cplusplus)
|
---|
270 | }
|
---|
271 | #endif
|
---|
272 |
|
---|
273 | #endif /* not _STDIO_H */
|
---|