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