* loop.c (libcall_other_regs): Make extern.
[official-gcc.git] / libio / stdio / stdio.h
blob30065ac8714913b1b06050002c62a276698b89be
1 /* This is part of the iostream/stdio library, providing -*- C -*- I/O.
2 Define ANSI C stdio on top of C++ iostreams.
3 Copyright (C) 1991, 1994 Free Software Foundation
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 * ANSI Standard: 4.9 INPUT/OUTPUT <stdio.h>
25 #ifndef _STDIO_H
26 #define _STDIO_H
27 #define _STDIO_USES_IOSTREAM
29 #include <libio.h>
31 #ifndef NULL
32 #ifdef __cplusplus
33 #define NULL 0
34 #else
35 #define NULL (void*)0
36 #endif
37 #endif
39 #ifndef EOF
40 #define EOF (-1)
41 #endif
42 #ifndef BUFSIZ
43 #define BUFSIZ 1024
44 #endif
46 #define _IOFBF 0 /* Fully buffered. */
47 #define _IOLBF 1 /* Line buffered. */
48 #define _IONBF 2 /* No buffering. */
50 #define SEEK_SET 0
51 #define SEEK_CUR 1
52 #define SEEK_END 2
54 /* define size_t. Crud in case <sys/types.h> has defined it. */
55 #if !defined(_SIZE_T) && !defined(_T_SIZE_) && !defined(_T_SIZE)
56 #if !defined(__SIZE_T) && !defined(_SIZE_T_) && !defined(___int_size_t_h)
57 #if !defined(_GCC_SIZE_T) && !defined(_SIZET_)
58 #define _SIZE_T
59 #define _T_SIZE_
60 #define _T_SIZE
61 #define __SIZE_T
62 #define _SIZE_T_
63 #define ___int_size_t_h
64 #define _GCC_SIZE_T
65 #define _SIZET_
66 typedef _IO_size_t size_t;
67 #endif
68 #endif
69 #endif
71 typedef struct _IO_FILE FILE;
72 typedef _IO_fpos_t fpos_t;
74 #define FOPEN_MAX _G_FOPEN_MAX
75 #define FILENAME_MAX _G_FILENAME_MAX
76 #ifndef TMP_MAX
77 #define TMP_MAX 999 /* Only limited by filename length */
78 #endif
80 #define L_ctermid 9
81 #define L_cuserid 9
82 #define P_tmpdir "/tmp"
83 #define L_tmpnam 20
85 /* For use by debuggers. These are linked in if printf or fprintf are used. */
86 extern FILE *stdin, *stdout, *stderr; /* TODO */
88 #define stdin _IO_stdin
89 #define stdout _IO_stdout
90 #define stderr _IO_stderr
92 #ifdef __cplusplus
93 extern "C" {
94 #endif
96 #ifndef __P
97 #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
98 #define __P(args) args
99 #else
100 #define __P(args) ()
101 #endif
102 #endif /*!__P*/
104 extern void clearerr __P((FILE*));
105 extern int fclose __P((FILE*));
106 extern int feof __P((FILE*));
107 extern int ferror __P((FILE*));
108 extern int fflush __P((FILE*));
109 extern int fgetc __P((FILE *));
110 extern int fgetpos __P((FILE* fp, fpos_t *pos));
111 extern char* fgets __P((char*, int, FILE*));
112 extern FILE* fopen __P((const char*, const char*));
113 extern int fprintf __P((FILE*, const char* format, ...));
114 extern int fputc __P((int, FILE*));
115 extern int fputs __P((const char *str, FILE *fp));
116 extern size_t fread __P((void*, size_t, size_t, FILE*));
117 extern FILE* freopen __P((const char*, const char*, FILE*));
118 extern int fscanf __P((FILE *fp, const char* format, ...));
119 extern int fseek __P((FILE* fp, long int offset, int whence));
120 extern int fsetpos __P((FILE* fp, const fpos_t *pos));
121 extern long int ftell __P((FILE* fp));
122 extern size_t fwrite __P((const void*, size_t, size_t, FILE*));
123 extern int getc __P((FILE *));
124 extern int getchar __P((void));
125 extern char* gets __P((char*));
126 extern void perror __P((const char *));
127 extern int printf __P((const char* format, ...));
128 extern int putc __P((int, FILE *));
129 extern int putchar __P((int));
130 extern int puts __P((const char *str));
131 extern int remove __P((const char*));
132 extern int rename __P((const char* _old, const char* _new));
133 extern void rewind __P((FILE*));
134 extern int scanf __P((const char* format, ...));
135 extern void setbuf __P((FILE*, char*));
136 extern void setlinebuf __P((FILE*));
137 extern void setbuffer __P((FILE*, char*, int));
138 extern int setvbuf __P((FILE*, char*, int mode, size_t size));
139 extern int sprintf __P((char*, const char* format, ...));
140 extern int sscanf __P((const char* string, const char* format, ...));
141 extern FILE* tmpfile __P((void));
142 extern char* tmpnam __P((char*));
143 extern int ungetc __P((int c, FILE* fp));
144 extern int vfprintf __P((FILE *fp, char const *fmt0, _IO_va_list));
145 extern int vprintf __P((char const *fmt, _IO_va_list));
146 extern int vsprintf __P((char* string, const char* format, _IO_va_list));
148 #ifndef __STRICT_ANSI__
149 extern int vfscanf __P((FILE*, const char *, _IO_va_list));
150 extern int vscanf __P((const char *, _IO_va_list));
151 extern int vsscanf __P((const char *, const char *, _IO_va_list));
152 #endif
154 #if !defined(__STRICT_ANSI__) || defined(_POSIX_SOURCE)
155 extern FILE *fdopen __P((int, const char *));
156 extern int fileno __P((FILE*));
157 extern FILE* popen __P((const char*, const char*));
158 extern int pclose __P((FILE*));
159 #endif
161 #ifdef __USE_GNU
162 extern _IO_ssize_t getdelim __P ((char **, size_t *, int, FILE*));
163 extern _IO_ssize_t getline __P ((char **, size_t *, FILE *));
165 extern int snprintf __P ((char *, size_t, const char *, ...));
166 extern int vsnprintf __P ((char *, size_t, const char *, _IO_va_list));
167 #endif
169 extern int __underflow __P((struct _IO_FILE*));
170 extern int __overflow __P((struct _IO_FILE*, int));
172 /* Handle locking of streams. */
173 #if defined _REENTRANT || defined _THREAD_SAFE
174 extern void clearerr_locked __P ((FILE *));
175 extern void clearerr_unlocked __P ((FILE *));
176 extern int feof_locked __P ((FILE *));
177 extern int feof_unlocked __P ((FILE *));
178 extern int ferror_locked __P ((FILE*));
179 extern int ferror_unlocked __P ((FILE*));
180 extern int fileno_locked __P ((FILE *));
181 extern int fileno_unlocked __P ((FILE *));
182 extern void flockfile __P ((FILE *));
183 extern void funlockfile __P ((FILE *));
184 extern int ftrylockfile __P ((FILE *));
185 extern int fclose_unlocked __P ((FILE *));
186 extern int fflush_locked __P ((FILE *));
187 extern int fflush_unlocked __P ((FILE *));
188 extern size_t fread_unlocked __P ((void *, size_t, size_t, FILE *));
189 extern size_t fwrite_unlocked __P ((const void *, size_t, size_t, FILE *));
191 extern int fputc_locked __P ((int, FILE*));
192 extern int fputc_unlocked __P ((int, FILE*));
193 extern int getc_locked __P ((FILE *));
194 extern int getc_unlocked __P ((FILE *));
195 extern int getchar_locked __P ((void));
196 extern int getchar_unlocked __P ((void));
197 extern int putc_locked __P ((int, FILE *));
198 extern int putc_unlocked __P ((int, FILE *));
199 extern int putchar_locked __P ((int));
200 extern int putchar_unlocked __P ((int));
202 # define getc_unlocked(fp) _IO_getc_unlocked (fp)
203 # define getc_locked(fp) _IO_getc (fp)
204 # define getchar_unlocked() _IO_getc_unlocked (stdin)
205 # define getchar_locked() _IO_getc (stdin)
206 # define putchar_unlocked(c) _IO_putc_unlocked (c, stdout)
207 # define putchar_locked(c) _IO_putc (c, stdout)
208 #endif /* __USE_REENTRANT */
210 #define getc(fp) _IO_getc(fp)
211 #define putc(c, fp) _IO_putc(c, fp)
212 #define putchar(c) _IO_putc(c, stdout)
213 #define getchar() _IO_getc(stdin)
215 #ifdef __cplusplus
217 #endif
219 #endif /*!_STDIO_H*/