Fix compilation errors on FreeBSD.
[wine] / include / msvcrt / stdio.h
1 /*
2  * Standard I/O definitions.
3  *
4  * Derived from the mingw header written by Colin Peters.
5  * Modified for Wine use by Jon Griffiths and Francois Gouget.
6  * This file is in the public domain.
7  */
8 #ifndef __WINE_STDIO_H
9 #define __WINE_STDIO_H
10 #define __WINE_USE_MSVCRT
11
12 #ifndef RC_INVOKED
13 #include <stdarg.h>
14 #endif
15 #include "msvcrt/wctype.h"         /* For wint_t */
16
17
18 /* file._flag flags */
19 #ifndef USE_MSVCRT_PREFIX
20 #define _IOREAD          0x0001
21 #define _IOWRT           0x0002
22 #define _IOMYBUF         0x0008
23 #define _IOEOF           0x0010
24 #define _IOERR           0x0020
25 #define _IOSTRG          0x0040
26 #define _IORW            0x0080
27 #define _IOAPPEND        0x0200
28 #else
29 #define MSVCRT__IOREAD   0x0001 
30 #define MSVCRT__IOWRT    0x0002 
31 #define MSVCRT__IOMYBUF  0x0008 
32 #define MSVCRT__IOEOF    0x0010 
33 #define MSVCRT__IOERR    0x0020 
34 #define MSVCRT__IOSTRG   0x0040 
35 #define MSVCRT__IORW     0x0080 
36 #define MSVCRT__IOAPPEND 0x0200 
37 #endif /* USE_MSVCRT_PREFIX */
38
39
40 #ifndef USE_MSVCRT_PREFIX
41
42 #define STDIN_FILENO  0
43 #define STDOUT_FILENO 1
44 #define STDERR_FILENO 2
45
46 /* more file._flag flags, but these conflict with Unix */
47 #define _IOFBF    0x0000
48 #define _IONBF    0x0004
49 #define _IOLBF    0x0040
50
51 #define EOF       (-1)
52 #define FILENAME_MAX 260
53 #define FOPEN_MAX 20
54 #define L_tmpnam  260
55
56 #define BUFSIZ    512
57
58 #ifndef SEEK_SET
59 #define SEEK_SET  0
60 #define SEEK_CUR  1
61 #define SEEK_END  2
62 #endif
63
64 #else
65
66 /* more file._flag flags, but these conflict with Unix */
67 #define MSVCRT__IOFBF    0x0000
68 #define MSVCRT__IONBF    0x0004
69 #define MSVCRT__IOLBF    0x0040
70
71 #define MSVCRT_FILENAME_MAX 260
72
73 #define MSVCRT_EOF       (-1)
74
75 #endif /* USE_MSVCRT_PREFIX */
76
77 typedef struct MSVCRT(_iobuf)
78 {
79   char* _ptr;
80   int   _cnt;
81   char* _base;
82   int   _flag;
83   int   _file;
84   int   _charbuf;
85   int   _bufsiz;
86   char* _tmpfname;
87 } MSVCRT(FILE);
88
89 typedef long MSVCRT(fpos_t);
90
91 #ifndef MSVCRT_SIZE_T_DEFINED
92 typedef unsigned int MSVCRT(size_t);
93 #define MSVCRT_SIZE_T_DEFINED
94 #endif
95
96
97 #ifdef __cplusplus
98 extern "C" {
99 #endif
100
101 MSVCRT(FILE)*        MSVCRT(__p__iob)(void);
102 #define _iob               (__p__iob())
103 #ifndef USE_MSVCRT_PREFIX
104 #define stdin              (_iob+STDIN_FILENO)
105 #define stdout             (_iob+STDOUT_FILENO)
106 #define stderr             (_iob+STDERR_FILENO)
107 #elif !defined(__WINE__)
108 #define MSVCRT_stdin       (_iob+STDIN_FILENO)
109 #define MSVCRT_stdout      (_iob+STDOUT_FILENO)
110 #define MSVCRT_stderr      (_iob+STDERR_FILENO)
111 #endif /* USE_MSVCRT_PREFIX, __WINE__ */
112
113
114 int         _fcloseall(void);
115 MSVCRT(FILE)* _fdopen(int,const char*);
116 int         _fgetchar(void);
117 int         _filbuf(MSVCRT(FILE*));
118 int         _fileno(MSVCRT(FILE)*);
119 int         _flsbuf(int,MSVCRT(FILE)*);
120 int         _flushall(void);
121 int         _fputchar(int);
122 MSVCRT(FILE)* _fsopen(const char*,const char*,int);
123 int         _getmaxstdio(void);
124 int         _getw(MSVCRT(FILE)*);
125 int         _pclose(MSVCRT(FILE)*);
126 MSVCRT(FILE)* _popen(const char*,const char*);
127 int         _putw(int,MSVCRT(FILE)*);
128 int         _rmtmp(void);
129 int         _setmaxstdio(int);
130 int         _snprintf(char*,MSVCRT(size_t),const char*,...);
131 char*       _tempnam(const char*,const char*);
132 int         _unlink(const char*);
133 int         _vsnprintf(char*,MSVCRT(size_t),const char*,va_list);
134
135 void        MSVCRT(clearerr)(MSVCRT(FILE)*);
136 int         MSVCRT(fclose)(MSVCRT(FILE)*);
137 int         MSVCRT(feof)(MSVCRT(FILE)*);
138 int         MSVCRT(ferror)(MSVCRT(FILE)*);
139 int         MSVCRT(fflush)(MSVCRT(FILE)*);
140 int         MSVCRT(fgetc)(MSVCRT(FILE)*);
141 int         MSVCRT(fgetpos)(MSVCRT(FILE)*,MSVCRT(fpos_t)*);
142 char*       MSVCRT(fgets)(char*,int,MSVCRT(FILE)*);
143 MSVCRT(FILE)* MSVCRT(fopen)(const char*,const char*);
144 int         MSVCRT(fprintf)(MSVCRT(FILE)*,const char*,...);
145 int         MSVCRT(fputc)(int,MSVCRT(FILE)*);
146 int         MSVCRT(fputs)(const char*,MSVCRT(FILE)*);
147 MSVCRT(size_t) MSVCRT(fread)(void*,MSVCRT(size_t),MSVCRT(size_t),MSVCRT(FILE)*);
148 MSVCRT(FILE)* MSVCRT(freopen)(const char*,const char*,MSVCRT(FILE)*);
149 int         MSVCRT(fscanf)(MSVCRT(FILE)*,const char*,...);
150 int         MSVCRT(fseek)(MSVCRT(FILE)*,long,int);
151 int         MSVCRT(fsetpos)(MSVCRT(FILE)*,MSVCRT(fpos_t)*);
152 long        MSVCRT(ftell)(MSVCRT(FILE)*);
153 MSVCRT(size_t) MSVCRT(fwrite)(const void*,MSVCRT(size_t),MSVCRT(size_t),MSVCRT(FILE)*);
154 int         MSVCRT(getc)(MSVCRT(FILE)*);
155 int         MSVCRT(getchar)(void);
156 char*       MSVCRT(gets)(char*);
157 void        MSVCRT(perror)(const char*);
158 int         MSVCRT(printf)(const char*,...);
159 int         MSVCRT(putc)(int,MSVCRT(FILE)*);
160 int         MSVCRT(putchar)(int);
161 int         MSVCRT(puts)(const char*);
162 int         MSVCRT(remove)(const char*);
163 int         MSVCRT(rename)(const char*,const char*);
164 void        MSVCRT(rewind)(MSVCRT(FILE)*);
165 int         MSVCRT(scanf)(const char*,...);
166 void        MSVCRT(setbuf)(MSVCRT(FILE)*,char*);
167 int         MSVCRT(setvbuf)(MSVCRT(FILE)*,char*,int,MSVCRT(size_t));
168 int         MSVCRT(sprintf)(char*,const char*,...);
169 int         MSVCRT(sscanf)(const char*,const char*,...);
170 MSVCRT(FILE)* MSVCRT(tmpfile)(void);
171 char*       MSVCRT(tmpnam)(char*);
172 int         MSVCRT(ungetc)(int,MSVCRT(FILE)*);
173 int         MSVCRT(vfprintf)(MSVCRT(FILE)*,const char*,va_list);
174 int         MSVCRT(vprintf)(const char*,va_list);
175 int         MSVCRT(vsprintf)(char*,const char*,va_list);
176
177 MSVCRT(wint_t) _fgetwchar(void);
178 MSVCRT(wint_t) _fputwchar(MSVCRT(wint_t));
179 WCHAR*      _getws(WCHAR*);
180 int         _putws(const WCHAR*);
181 int         _snwprintf(WCHAR*,MSVCRT(size_t),const WCHAR*,...);
182 int         _vsnwprintf(WCHAR*,MSVCRT(size_t),const WCHAR*,va_list);
183 MSVCRT(FILE)* _wfdopen(int,const WCHAR*);
184 MSVCRT(FILE)* _wfopen(const WCHAR*,const WCHAR*);
185 MSVCRT(FILE)* _wfreopen(const WCHAR*,const WCHAR*,MSVCRT(FILE)*);
186 MSVCRT(FILE)* _wfsopen(const WCHAR*,const WCHAR*,int);
187 void        _wperror(const WCHAR*);
188 MSVCRT(FILE)* _wpopen(const WCHAR*,const WCHAR*);
189 int         _wremove(const WCHAR*);
190 WCHAR*      _wtempnam(const WCHAR*,const WCHAR*);
191 WCHAR*      _wtmpnam(WCHAR*);
192
193 MSVCRT(wint_t) MSVCRT(fgetwc)(MSVCRT(FILE)*);
194 WCHAR*      MSVCRT(fgetws)(WCHAR*,int,MSVCRT(FILE)*);
195 MSVCRT(wint_t) MSVCRT(fputwc)(MSVCRT(wint_t),MSVCRT(FILE)*);
196 int         MSVCRT(fputws)(const WCHAR*,MSVCRT(FILE)*);
197 int         MSVCRT(fwprintf)(MSVCRT(FILE)*,const WCHAR*,...);
198 int         MSVCRT(fputws)(const WCHAR*,MSVCRT(FILE)*);
199 int         MSVCRT(fwscanf)(MSVCRT(FILE)*,const WCHAR*,...);
200 MSVCRT(wint_t) MSVCRT(getwc)(MSVCRT(FILE)*);
201 MSVCRT(wint_t) MSVCRT(getwchar)(void);
202 WCHAR*      MSVCRT(getws)(WCHAR*);
203 MSVCRT(wint_t) MSVCRT(putwc)(MSVCRT(wint_t),MSVCRT(FILE)*);
204 MSVCRT(wint_t) MSVCRT(putwchar)(MSVCRT(wint_t));
205 int         MSVCRT(putws)(const WCHAR*);
206 int         MSVCRT(swprintf)(WCHAR*,const WCHAR*,...);
207 int         MSVCRT(swscanf)(WCHAR*,const WCHAR*,...);
208 MSVCRT(wint_t) MSVCRT(ungetwc)(MSVCRT(wint_t),MSVCRT(FILE)*);
209 int         MSVCRT(vfwprintf)(MSVCRT(FILE)*,const WCHAR*,va_list);
210 int         MSVCRT(vswprintf)(WCHAR*,const WCHAR*,va_list);
211 int         MSVCRT(vwprintf)(const WCHAR*,va_list);
212 int         MSVCRT(wprintf)(const WCHAR*,...);
213 int         MSVCRT(wscanf)(const WCHAR*,...);
214
215 #ifdef __cplusplus
216 }
217 #endif
218
219
220 #ifndef USE_MSVCRT_PREFIX
221 #define fdopen   _fdopen
222 #define fgetchar _fgetchar
223 #define fileno   _fileno
224 #define fputchar _fputchar
225 #define pclose   _pclose
226 #define popen    _popen
227 #define tempnam  _tempnam
228 #define unlink _unlink
229
230 #define fgetwchar _fgetwchar
231 #define fputwchar _fputwchar
232 #define getw     _getw
233 #define putw     _putw
234 #define wpopen   _wpopen
235 #endif /* USE_MSVCRT_PREFIX */
236
237 #endif /* __WINE_STDIO_H */