source: trunk/src/emx/include/stdio.h@ 119

Last change on this file since 119 was 18, checked in by bird, 22 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 5.7 KB
Line 
1/* stdio.h (emx+gcc) */
2
3#ifndef _STDIO_H
4#define _STDIO_H
5
6#if defined (__cplusplus)
7extern "C" {
8#endif
9
10#if !defined (_SIZE_T)
11#define _SIZE_T
12typedef 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
30struct _file2;
31struct _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
49typedef struct _FILE FILE;
50
51extern 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
103typedef 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
114typedef char *va_list;
115#endif
116
117void clearerr (FILE *);
118int fclose (FILE *);
119int feof (FILE *);
120int ferror (FILE *);
121int fflush (FILE *);
122int fgetc (FILE *);
123int fgetpos (FILE *, fpos_t *);
124char *fgets (char *, int, FILE *);
125FILE *fopen (__const__ char *, __const__ char *);
126int fprintf (FILE *, __const__ char *, ...);
127int fputc (int, FILE *);
128int fputs (__const__ char *, FILE *);
129size_t fread (void *, size_t, size_t, FILE *);
130FILE *freopen (__const__ char *, __const__ char *, FILE *);
131int fscanf (FILE *, __const__ char *, ...);
132int fseek (FILE *, long, int);
133int fsetpos (FILE *, __const__ fpos_t *);
134long ftell (FILE *);
135size_t fwrite (__const__ void *, size_t, size_t, FILE *);
136int getchar (void);
137char *gets (char *);
138void perror (__const__ char *);
139int printf (__const__ char *, ...);
140int putchar (int);
141int puts (__const__ char *);
142int remove (__const__ char *);
143int rename (__const__ char *, __const__ char *);
144void rewind (FILE *);
145int scanf (__const__ char *, ...);
146int setbuf (FILE *, char *);
147int setvbuf (FILE *, char *, int, size_t);
148int sprintf (char *, __const__ char *, ...);
149int sscanf (__const__ char *, __const__ char *, ...);
150FILE *tmpfile (void);
151char *tmpnam (char *);
152int ungetc (int, FILE *);
153int vfprintf (FILE *, __const__ char *, va_list);
154int vprintf (__const__ char *, va_list);
155int vsprintf (char *, __const__ char *, va_list);
156
157int _fill (FILE *);
158int _flush (int, FILE *);
159int _rmtmp (void);
160
161int _getc_inline (FILE *);
162int _putc_inline (int, FILE *);
163
164extern __inline__ int feof (FILE *_s)
165{
166 return (_s->_flags & _IOEOF ? 1 : 0);
167}
168
169extern __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
176extern __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
185extern __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
204extern __inline__ int getchar (void) { return getc (stdin); }
205extern __inline__ int putchar (int _c) { return putc (_c, stdout); }
206
207
208#if !defined (__STRICT_ANSI__)
209
210/* POSIX.1 */
211
212/* ctermid() */
213FILE *fdopen (int, __const__ char *);
214int fileno (FILE *);
215
216extern __inline__ int fileno (FILE *_s) { return _s->_handle; }
217
218#endif
219
220
221#if !defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)
222
223char *cuserid (char *);
224int getw (FILE *);
225int fcloseall (void);
226int fgetchar (void);
227int flushall (void);
228int fputchar (int);
229int pclose (FILE *);
230FILE *popen (__const__ char *, __const__ char *);
231int putw (int, FILE *);
232int setbuffer (FILE *, char *, size_t);
233int snprintf (char *, size_t, __const__ char *, ...);
234char *tempnam (__const__ char *, __const__ char *);
235int vfscanf (FILE *, __const__ char *, va_list);
236int vscanf (__const__ char *, va_list);
237int vsnprintf (char *, size_t, __const__ char *, va_list);
238int 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
246int _fcloseall (void);
247FILE *_fassign (FILE *, FILE *);
248FILE *_fdopen (int, __const__ char *);
249int _fgetchar (void);
250int _flushall (void);
251int _fputchar (int);
252int _fseek_hdr (FILE *);
253int _fsetmode (FILE *, __const__ char *);
254FILE *_fsopen (__const__ char *, __const__ char *, int);
255int _getw (FILE *);
256char *_mfclose (FILE *);
257FILE *_mfopen (char *, __const__ char *, size_t, int);
258int _pclose (FILE *);
259FILE *_popen (__const__ char *, __const__ char *);
260int _putw (int, FILE *);
261int _setbuffer (FILE *, char *, size_t);
262int _snprintf (char *, size_t, __const__ char *, ...);
263char *_tempnam (__const__ char *, __const__ char *);
264int _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 */
Note: See TracBrowser for help on using the repository browser.