2 * Standard I/O definitions.
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.
10 #ifndef __WINE_USE_MSVCRT
11 #define __WINE_USE_MSVCRT
19 # ifdef USE_MSVCRT_PREFIX
20 # define MSVCRT(x) MSVCRT_##x
26 /* file._flag flags */
27 #ifndef USE_MSVCRT_PREFIX
28 #define _IOREAD 0x0001
30 #define _IOMYBUF 0x0008
33 #define _IOSTRG 0x0040
36 #define MSVCRT__IOREAD 0x0001
37 #define MSVCRT__IOWRT 0x0002
38 #define MSVCRT__IOMYBUF 0x0008
39 #define MSVCRT__IOEOF 0x0010
40 #define MSVCRT__IOERR 0x0020
41 #define MSVCRT__IOSTRG 0x0040
42 #define MSVCRT__IORW 0x0080
43 #endif /* USE_MSVCRT_PREFIX */
49 #define NULL ((void *)0)
53 #ifndef USE_MSVCRT_PREFIX
55 #define STDIN_FILENO 0
56 #define STDOUT_FILENO 1
57 #define STDERR_FILENO 2
59 /* more file._flag flags, but these conflict with Unix */
65 #define FILENAME_MAX 260
66 #define TMP_MAX 0x7fff
80 #define MSVCRT_STDIN_FILENO 0
81 #define MSVCRT_STDOUT_FILENO 1
82 #define MSVCRT_STDERR_FILENO 2
84 /* more file._flag flags, but these conflict with Unix */
85 #define MSVCRT__IOFBF 0x0000
86 #define MSVCRT__IONBF 0x0004
87 #define MSVCRT__IOLBF 0x0040
89 #define MSVCRT_FILENAME_MAX 260
90 #define MSVCRT_TMP_MAX 0x7fff
92 #define MSVCRT_EOF (-1)
94 #define MSVCRT_BUFSIZ 512
96 #endif /* USE_MSVCRT_PREFIX */
98 #ifndef MSVCRT_FILE_DEFINED
99 #define MSVCRT_FILE_DEFINED
100 typedef struct MSVCRT(_iobuf
)
111 #endif /* MSVCRT_FILE_DEFINED */
113 #ifndef MSVCRT_FPOS_T_DEFINED
114 typedef long MSVCRT(fpos_t);
115 #define MSVCRT_FPOS_T_DEFINED
118 #ifndef MSVCRT_SIZE_T_DEFINED
119 typedef unsigned int MSVCRT(size_t);
120 #define MSVCRT_SIZE_T_DEFINED
123 #ifndef MSVCRT_WCHAR_T_DEFINED
124 #define MSVCRT_WCHAR_T_DEFINED
126 typedef unsigned short MSVCRT(wchar_t);
130 #ifndef _WCTYPE_T_DEFINED
131 typedef unsigned short MSVCRT(wint_t);
132 typedef unsigned short MSVCRT(wctype_t);
133 #define _WCTYPE_T_DEFINED
140 #ifndef MSVCRT_STDIO_DEFINED
141 MSVCRT(FILE)* MSVCRT(__p__iob
)(void);
142 #define _iob (__p__iob())
143 #endif /* MSVCRT_STDIO_DEFINED */
145 #ifndef USE_MSVCRT_PREFIX
146 #define stdin (_iob+STDIN_FILENO)
147 #define stdout (_iob+STDOUT_FILENO)
148 #define stderr (_iob+STDERR_FILENO)
150 #define MSVCRT_stdin (MSVCRT__iob+MSVCRT_STDIN_FILENO)
151 #define MSVCRT_stdout (MSVCRT__iob+MSVCRT_STDOUT_FILENO)
152 #define MSVCRT_stderr (MSVCRT__iob+MSVCRT_STDERR_FILENO)
153 #endif /* USE_MSVCRT_PREFIX */
155 #ifndef MSVCRT_STDIO_DEFINED
156 #define MSVCRT_STDIO_DEFINED
157 int MSVCRT(_fcloseall
)(void);
158 MSVCRT(FILE)* MSVCRT(_fdopen
)(int,const char*);
160 int MSVCRT(_filbuf
)(MSVCRT(FILE*));
161 int MSVCRT(_fileno
)(MSVCRT(FILE)*);
162 int MSVCRT(_flsbuf
)(int,MSVCRT(FILE)*);
165 MSVCRT(FILE)* _fsopen(const char*,const char*,int);
166 int _getmaxstdio(void);
167 int MSVCRT(_getw
)(MSVCRT(FILE)*);
168 int MSVCRT(_pclose
)(MSVCRT(FILE)*);
169 MSVCRT(FILE)* MSVCRT(_popen
)(const char*,const char*);
170 int MSVCRT(_putw
)(int,MSVCRT(FILE)*);
172 int _setmaxstdio(int);
173 int _snprintf(char*,MSVCRT(size_t),const char*,...);
174 char* _tempnam(const char*,const char*);
175 int _unlink(const char*);
176 int _vsnprintf(char*,MSVCRT(size_t),const char*,va_list);
178 void MSVCRT(clearerr
)(MSVCRT(FILE)*);
179 int MSVCRT(fclose
)(MSVCRT(FILE)*);
180 int MSVCRT(feof
)(MSVCRT(FILE)*);
181 int MSVCRT(ferror
)(MSVCRT(FILE)*);
182 int MSVCRT(fflush
)(MSVCRT(FILE)*);
183 int MSVCRT(fgetc
)(MSVCRT(FILE)*);
184 int MSVCRT(fgetpos
)(MSVCRT(FILE)*,MSVCRT(fpos_t)*);
185 char* MSVCRT(fgets
)(char*,int,MSVCRT(FILE)*);
186 MSVCRT(FILE)* MSVCRT(fopen
)(const char*,const char*);
187 int MSVCRT(fprintf
)(MSVCRT(FILE)*,const char*,...);
188 int MSVCRT(fputc
)(int,MSVCRT(FILE)*);
189 int MSVCRT(fputs
)(const char*,MSVCRT(FILE)*);
190 MSVCRT(size_t) MSVCRT(fread
)(void*,MSVCRT(size_t),MSVCRT(size_t),MSVCRT(FILE)*);
191 MSVCRT(FILE)* MSVCRT(freopen
)(const char*,const char*,MSVCRT(FILE)*);
192 int MSVCRT(fscanf
)(MSVCRT(FILE)*,const char*,...);
193 int MSVCRT(fseek
)(MSVCRT(FILE)*,long,int);
194 int MSVCRT(fsetpos
)(MSVCRT(FILE)*,MSVCRT(fpos_t)*);
195 long MSVCRT(ftell
)(MSVCRT(FILE)*);
196 MSVCRT(size_t) MSVCRT(fwrite
)(const void*,MSVCRT(size_t),MSVCRT(size_t),MSVCRT(FILE)*);
197 int MSVCRT(getc
)(MSVCRT(FILE)*);
198 int MSVCRT(getchar
)(void);
199 char* MSVCRT(gets
)(char*);
200 void MSVCRT(perror
)(const char*);
201 int MSVCRT(printf
)(const char*,...);
202 int MSVCRT(putc
)(int,MSVCRT(FILE)*);
203 int MSVCRT(putchar
)(int);
204 int MSVCRT(puts
)(const char*);
205 int MSVCRT(remove
)(const char*);
206 int MSVCRT(rename
)(const char*,const char*);
207 void MSVCRT(rewind
)(MSVCRT(FILE)*);
208 int MSVCRT(scanf
)(const char*,...);
209 void MSVCRT(setbuf
)(MSVCRT(FILE)*,char*);
210 int MSVCRT(setvbuf
)(MSVCRT(FILE)*,char*,int,MSVCRT(size_t));
211 int MSVCRT(sprintf
)(char*,const char*,...);
212 int MSVCRT(sscanf
)(const char*,const char*,...);
213 MSVCRT(FILE)* MSVCRT(tmpfile
)(void);
214 char* MSVCRT(tmpnam
)(char*);
215 int MSVCRT(ungetc
)(int,MSVCRT(FILE)*);
216 int MSVCRT(vfprintf
)(MSVCRT(FILE)*,const char*,va_list);
217 int MSVCRT(vprintf
)(const char*,va_list);
218 int MSVCRT(vsprintf
)(char*,const char*,va_list);
220 #ifndef MSVCRT_WSTDIO_DEFINED
221 #define MSVCRT_WSTDIO_DEFINED
222 MSVCRT(wint_t) _fgetwchar(void);
223 MSVCRT(wint_t) _fputwchar(MSVCRT(wint_t));
224 MSVCRT(wchar_t)*_getws(MSVCRT(wchar_t)*);
225 int _putws(const MSVCRT(wchar_t)*);
226 int _snwprintf(MSVCRT(wchar_t)*,MSVCRT(size_t),const MSVCRT(wchar_t)*,...);
227 int _vsnwprintf(MSVCRT(wchar_t)*,MSVCRT(size_t),const MSVCRT(wchar_t)*,va_list);
228 MSVCRT(FILE)* MSVCRT(_wfdopen
)(int,const MSVCRT(wchar_t)*);
229 MSVCRT(FILE)* MSVCRT(_wfopen
)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
230 MSVCRT(FILE)* MSVCRT(_wfreopen
)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,MSVCRT(FILE)*);
231 MSVCRT(FILE)* MSVCRT(_wfsopen
)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,int);
232 void _wperror(const MSVCRT(wchar_t)*);
233 MSVCRT(FILE)* MSVCRT(_wpopen
)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
234 int _wremove(const MSVCRT(wchar_t)*);
235 MSVCRT(wchar_t)*_wtempnam(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
236 MSVCRT(wchar_t)*_wtmpnam(MSVCRT(wchar_t)*);
238 MSVCRT(wint_t) MSVCRT(fgetwc
)(MSVCRT(FILE)*);
239 MSVCRT(wchar_t)*MSVCRT(fgetws
)(MSVCRT(wchar_t)*,int,MSVCRT(FILE)*);
240 MSVCRT(wint_t) MSVCRT(fputwc
)(MSVCRT(wint_t),MSVCRT(FILE)*);
241 int MSVCRT(fputws
)(const MSVCRT(wchar_t)*,MSVCRT(FILE)*);
242 int MSVCRT(fwprintf
)(MSVCRT(FILE)*,const MSVCRT(wchar_t)*,...);
243 int MSVCRT(fputws
)(const MSVCRT(wchar_t)*,MSVCRT(FILE)*);
244 int MSVCRT(fwscanf
)(MSVCRT(FILE)*,const MSVCRT(wchar_t)*,...);
245 MSVCRT(wint_t) MSVCRT(getwc
)(MSVCRT(FILE)*);
246 MSVCRT(wint_t) MSVCRT(getwchar
)(void);
247 MSVCRT(wchar_t)*MSVCRT(getws
)(MSVCRT(wchar_t)*);
248 MSVCRT(wint_t) MSVCRT(putwc
)(MSVCRT(wint_t),MSVCRT(FILE)*);
249 MSVCRT(wint_t) MSVCRT(putwchar
)(MSVCRT(wint_t));
250 int MSVCRT(putws
)(const MSVCRT(wchar_t)*);
251 int MSVCRT(swprintf
)(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
252 int MSVCRT(swscanf
)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
253 MSVCRT(wint_t) MSVCRT(ungetwc
)(MSVCRT(wint_t),MSVCRT(FILE)*);
254 int MSVCRT(vfwprintf
)(MSVCRT(FILE)*,const MSVCRT(wchar_t)*,va_list);
255 int MSVCRT(vswprintf
)(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,va_list);
256 int MSVCRT(vwprintf
)(const MSVCRT(wchar_t)*,va_list);
257 int MSVCRT(wprintf
)(const MSVCRT(wchar_t)*,...);
258 int MSVCRT(wscanf
)(const MSVCRT(wchar_t)*,...);
259 #endif /* MSVCRT_WSTDIO_DEFINED */
261 #endif /* MSVCRT_STDIO_DEFINED */
268 #ifndef USE_MSVCRT_PREFIX
269 static inline MSVCRT(FILE)* fdopen(int fd
, const char *mode
) { return _fdopen(fd
, mode
); }
270 static inline int fgetchar(void) { return _fgetchar(); }
271 static inline int fileno(MSVCRT(FILE)* file
) { return _fileno(file
); }
272 static inline int fputchar(int c
) { return _fputchar(c
); }
273 static inline int pclose(MSVCRT(FILE)* file
) { return _pclose(file
); }
274 static inline MSVCRT(FILE)* popen(const char* command
, const char* mode
) { return _popen(command
, mode
); }
275 static inline char* tempnam(const char *dir
, const char *prefix
) { return _tempnam(dir
, prefix
); }
276 #ifndef MSVCRT_UNLINK_DEFINED
277 static inline int unlink(const char* path
) { return _unlink(path
); }
278 #define MSVCRT_UNLINK_DEFINED
280 static inline int vsnprintf(char *buffer
, size_t size
, const char *format
, va_list args
) { return _vsnprintf(buffer
,size
,format
,args
); }
282 static inline MSVCRT(wint_t) fgetwchar(void) { return _fgetwchar(); }
283 static inline MSVCRT(wint_t) fputwchar(MSVCRT(wint_t) wc
) { return _fputwchar(wc
); }
284 static inline int getw(MSVCRT(FILE)* file
) { return _getw(file
); }
285 static inline int putw(int val
, MSVCRT(FILE)* file
) { return _putw(val
, file
); }
286 static inline MSVCRT(FILE)* wpopen(const MSVCRT(wchar_t)* command
,const MSVCRT(wchar_t)* mode
) { return _wpopen(command
, mode
); }
287 #endif /* USE_MSVCRT_PREFIX */
289 #endif /* __WINE_STDIO_H */