add a missing section header table index conversion
[tangerine.git] / compiler / clib / include / stdio.h
blob05016559ff88969ea3d43fbb7e186ae24ec7054a
1 #ifndef _STDIO_H_
2 #define _STDIO_H_
4 /*
5 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
6 $Id$
8 Desc: ANSI-C header file stdio.h
9 Lang: english
11 #include <sys/_types.h>
12 #include <sys/cdefs.h>
13 #include <sys/arosc.h>
15 #define __need_size_t
16 #define __need_NULL
17 #include <stddef.h>
19 typedef __off_t fpos_t;
22 We are supposed to declare it, without including the file.
23 This is too compiler specific to handle at the moment.
25 #if __XSI_VISIBLE
26 #include <stdarg.h>
27 #endif
29 /* Need to protect against standard Amiga includes */
30 #ifndef EOF
31 # define EOF (-1)
32 #endif
34 /* Buffering methods that can be specified with setvbuf() */
35 #define _IOFBF 0 /* Fully buffered. */
36 #define _IOLBF 1 /* Line buffered. */
37 #define _IONBF 2 /* Not buffered. */
39 #ifndef BUFSIZ
40 # define BUFSIZ 1024
41 #endif
42 #define FILENAME_MAX 256 /* Amiga files are 256 */
43 #define FOPEN_MAX 16 /* Must be > 8 */
44 #define TMP_MAX 10240 /* Must be > 10000 */
45 #define L_tmpnam FILENAME_MAX /* Max temporary filename */
47 #if !defined(_ANSI_SOURCE)
48 #define L_ctermid FILENAME_MAX /* Max filename for controlling tty */
49 #endif
51 #if __XSI_VISIBLE
52 #define P_tmpdir "T:" /* Default temporary path */
53 #endif
55 #ifndef __typedef_FILE
56 # define __typedef_FILE
57 /* I need a named struct for FILE, so that I can use it in wchar.h> */
58 typedef struct __sFILE
60 int fd;
61 int flags;
62 } FILE;
64 # define _STDIO_EOF 0x0001L
65 # define _STDIO_ERROR 0x0002L
66 # define _STDIO_WRITE 0x0004L
67 # define _STDIO_READ 0x0008L
68 # define _STDIO_RDWR _STDIO_WRITE | _STDIO_READ
69 # define _STDIO_APPEND 0x0010L
70 #endif
72 #define SEEK_SET 0
73 #define SEEK_CUR 1
74 #define SEEK_END 2
76 #define stdin (__get_arosc_userdata()->acud_stdin)
77 #define stdout (__get_arosc_userdata()->acud_stdout)
78 #define stderr (__get_arosc_userdata()->acud_stderr)
80 __BEGIN_DECLS
83 int remove(const char *filename);
84 int rename(const char *from, const char *to);
85 FILE *tmpfile(void);
86 char *tmpnam(char *s);
87 char *tempnam(const char *dir, const char *pfx);
88 int fclose(FILE *stream);
89 int fflush(FILE *stream);
90 FILE *fopen(const char * restrict filename, const char * restrict mode);
91 FILE *freopen(const char * restrict filename, const char * restrict mode,
92 FILE * restrict stream);
93 void setbuf(FILE * restrict stream, char * restrict buf);
94 int setvbuf(FILE * restrict stream, char * restrict buf, int mode,
95 size_t size);
96 int fprintf(FILE * restrict stream, const char * restrict format, ...);
97 int fscanf(FILE * restrict stream, const char * restrict format, ...);
98 int printf(const char * restrict format, ...);
99 int scanf(const char * restrict format, ...);
100 int snprintf(char * restrict s, size_t n, const char * restrict format, ...);
101 int sprintf(char * restrict s, const char * restrict format, ...);
102 int sscanf(const char * restrict s, const char * restrict format, ...);
103 int vfprintf(FILE * restrict stream, const char * restrict format,
104 va_list arg);
105 int vfscanf(FILE * restrict stream, const char * restrict format,
106 va_list arg);
107 int vprintf(const char * restrict format, va_list arg);
108 int vscanf(const char * restrict format, va_list arg);
109 int vsnprintf(char * restrict s, size_t n, const char * restrict format,
110 va_list arg);
111 int vsprintf(char * restrict s, const char * restrict format,
112 va_list arg);
113 int vsscanf(const char * restrict s, const char * restrict format,
114 va_list arg);
115 int fgetc(FILE *stream);
116 char *fgets(char * restrict s, int n, FILE * restrict stream);
117 int fputc(int c, FILE *stream);
118 int fputs(const char * restrict s, FILE * restrict stream);
119 int getc(FILE *stream);
120 int getchar(void);
121 char *gets(char *s);
122 int putc(int c, FILE *stream);
123 int putchar(int c);
124 int puts(const char *s);
125 int ungetc(int c, FILE *stream);
126 size_t fread(void * restrict ptr, size_t size, size_t nmemb,
127 FILE * restrict stream);
128 size_t fwrite(const void * restrict ptr, size_t size, size_t nmemb,
129 FILE * restrict stream);
130 int fgetpos(FILE * restrict stream, fpos_t * restrict pos);
131 int fseek(FILE *stream, long int offset, int whence);
132 int fsetpos(FILE *stream, const fpos_t *pos);
133 long int ftell(FILE *stream);
134 void rewind(FILE *stream);
135 void clearerr(FILE *stream);
136 int feof(FILE *stream);
137 int ferror(FILE *stream);
138 void perror(const char *s);
140 /* Internal functions */
141 int __vcformat (void * data, int (*outc)(int, void *),
142 const char * format, va_list args);
143 int __vcscan (void * data, int (*getc)(void *),
144 int (*ungetc)(int, void *),
145 const char * format, va_list args);
147 /* AROS specific function to synchronise to keep DOS Input and Output in sync
148 * with the C stdin, stdout and stderr
150 void updatestdio(void);
152 #define putc(c, stream) fputc(c, stream)
153 #define getc(stream) fgetc(stream)
154 #define getchar() getc(stdin)
155 #define gets(s) fgets(s, BUFSIZ, stdin)
157 #if !defined(_ANSI_SOURCE)
158 /* Unix Specific */
159 FILE *fdopen (int filedes, const char *mode);
160 int fileno(FILE *);
161 int pclose(FILE *);
162 FILE *popen(const char *, const char *);
163 FILE *tmpfile(void);
164 char *tmpnam(char *);
165 #endif /* !_ANSI_SOURCE */
167 #if __BSD_VISIBLE
168 void setlinebuf(FILE *stream);
169 #endif
171 #if __XSI_VISIBLE
172 /* NOTIMPL char *tempnam(const char *, const char *); */
173 #endif
175 #if __POSIX_VISIBLE
176 /* NOTIMPL char *ctermid(char *); */
177 /* NOTIMPL char *ctermid_r(char *); */
178 #endif
180 #if __POSIX_VISIBLE >= 200112
181 /* NOTIMPL void flockfile(FILE *); */
182 /* NOTIMPL int ftrylockfile(FILE *); */
183 /* NOTIMPL void funlockfile(FILE *); */
185 /* NOTIMPL int getc_unlocked(FILE *); */
186 /* NOTIMPL int getchar_unlocked(void); */
187 /* NOTIMPL int putc_unlocked(int, FILE *); */
188 /* NOTIMPL int putchar_unlocked(int); */
189 #endif
191 #if __BSD_VISIBLE || __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600
192 int getw(FILE *stream);
193 int putw(int word, FILE *stream);
194 #endif
196 __END_DECLS
198 #endif /* _STDIO_H_ */