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 | #define MSVCRT_BUFSIZ 512
|
---|
76 |
|
---|
77 | #endif /* USE_MSVCRT_PREFIX */
|
---|
78 |
|
---|
79 | typedef struct MSVCRT(_iobuf)
|
---|
80 | {
|
---|
81 | char* _ptr;
|
---|
82 | int _cnt;
|
---|
83 | char* _base;
|
---|
84 | int _flag;
|
---|
85 | int _file;
|
---|
86 | int _charbuf;
|
---|
87 | int _bufsiz;
|
---|
88 | char* _tmpfname;
|
---|
89 | } MSVCRT(FILE);
|
---|
90 |
|
---|
91 | typedef long MSVCRT(fpos_t);
|
---|
92 |
|
---|
93 | #ifndef MSVCRT_SIZE_T_DEFINED
|
---|
94 | typedef unsigned int MSVCRT(size_t);
|
---|
95 | #define MSVCRT_SIZE_T_DEFINED
|
---|
96 | #endif
|
---|
97 |
|
---|
98 |
|
---|
99 | #ifdef __cplusplus
|
---|
100 | extern "C" {
|
---|
101 | #endif
|
---|
102 |
|
---|
103 | MSVCRT(FILE)* MSVCRT(__p__iob)(void);
|
---|
104 | #define _iob (__p__iob())
|
---|
105 | #ifndef USE_MSVCRT_PREFIX
|
---|
106 | #define stdin (_iob+STDIN_FILENO)
|
---|
107 | #define stdout (_iob+STDOUT_FILENO)
|
---|
108 | #define stderr (_iob+STDERR_FILENO)
|
---|
109 | #elif !defined(__WINE__)
|
---|
110 | #define MSVCRT_stdin (_iob+STDIN_FILENO)
|
---|
111 | #define MSVCRT_stdout (_iob+STDOUT_FILENO)
|
---|
112 | #define MSVCRT_stderr (_iob+STDERR_FILENO)
|
---|
113 | #endif /* USE_MSVCRT_PREFIX, __WINE__ */
|
---|
114 |
|
---|
115 |
|
---|
116 | int _fcloseall(void);
|
---|
117 | MSVCRT(FILE)* _fdopen(int,const char*);
|
---|
118 | int _fgetchar(void);
|
---|
119 | int _filbuf(MSVCRT(FILE*));
|
---|
120 | int _fileno(MSVCRT(FILE)*);
|
---|
121 | int _flsbuf(int,MSVCRT(FILE)*);
|
---|
122 | int _flushall(void);
|
---|
123 | int _fputchar(int);
|
---|
124 | MSVCRT(FILE)* _fsopen(const char*,const char*,int);
|
---|
125 | int _getmaxstdio(void);
|
---|
126 | int _getw(MSVCRT(FILE)*);
|
---|
127 | int _pclose(MSVCRT(FILE)*);
|
---|
128 | MSVCRT(FILE)* _popen(const char*,const char*);
|
---|
129 | int _putw(int,MSVCRT(FILE)*);
|
---|
130 | int _rmtmp(void);
|
---|
131 | int _setmaxstdio(int);
|
---|
132 | int _snprintf(char*,MSVCRT(size_t),const char*,...);
|
---|
133 | char* _tempnam(const char*,const char*);
|
---|
134 | int _unlink(const char*);
|
---|
135 | int _vsnprintf(char*,MSVCRT(size_t),const char*,va_list);
|
---|
136 |
|
---|
137 | void MSVCRT(clearerr)(MSVCRT(FILE)*);
|
---|
138 | int MSVCRT(fclose)(MSVCRT(FILE)*);
|
---|
139 | int MSVCRT(feof)(MSVCRT(FILE)*);
|
---|
140 | int MSVCRT(ferror)(MSVCRT(FILE)*);
|
---|
141 | int MSVCRT(fflush)(MSVCRT(FILE)*);
|
---|
142 | int MSVCRT(fgetc)(MSVCRT(FILE)*);
|
---|
143 | int MSVCRT(fgetpos)(MSVCRT(FILE)*,MSVCRT(fpos_t)*);
|
---|
144 | char* MSVCRT(fgets)(char*,int,MSVCRT(FILE)*);
|
---|
145 | MSVCRT(FILE)* MSVCRT(fopen)(const char*,const char*);
|
---|
146 | int MSVCRT(fprintf)(MSVCRT(FILE)*,const char*,...);
|
---|
147 | int MSVCRT(fputc)(int,MSVCRT(FILE)*);
|
---|
148 | int MSVCRT(fputs)(const char*,MSVCRT(FILE)*);
|
---|
149 | MSVCRT(size_t) MSVCRT(fread)(void*,MSVCRT(size_t),MSVCRT(size_t),MSVCRT(FILE)*);
|
---|
150 | MSVCRT(FILE)* MSVCRT(freopen)(const char*,const char*,MSVCRT(FILE)*);
|
---|
151 | int MSVCRT(fscanf)(MSVCRT(FILE)*,const char*,...);
|
---|
152 | int MSVCRT(fseek)(MSVCRT(FILE)*,long,int);
|
---|
153 | int MSVCRT(fsetpos)(MSVCRT(FILE)*,MSVCRT(fpos_t)*);
|
---|
154 | long MSVCRT(ftell)(MSVCRT(FILE)*);
|
---|
155 | MSVCRT(size_t) MSVCRT(fwrite)(const void*,MSVCRT(size_t),MSVCRT(size_t),MSVCRT(FILE)*);
|
---|
156 | int MSVCRT(getc)(MSVCRT(FILE)*);
|
---|
157 | int MSVCRT(getchar)(void);
|
---|
158 | char* MSVCRT(gets)(char*);
|
---|
159 | void MSVCRT(perror)(const char*);
|
---|
160 | int MSVCRT(printf)(const char*,...);
|
---|
161 | int MSVCRT(putc)(int,MSVCRT(FILE)*);
|
---|
162 | int MSVCRT(putchar)(int);
|
---|
163 | int MSVCRT(puts)(const char*);
|
---|
164 | int MSVCRT(remove)(const char*);
|
---|
165 | int MSVCRT(rename)(const char*,const char*);
|
---|
166 | void MSVCRT(rewind)(MSVCRT(FILE)*);
|
---|
167 | int MSVCRT(scanf)(const char*,...);
|
---|
168 | void MSVCRT(setbuf)(MSVCRT(FILE)*,char*);
|
---|
169 | int MSVCRT(setvbuf)(MSVCRT(FILE)*,char*,int,MSVCRT(size_t));
|
---|
170 | int MSVCRT(sprintf)(char*,const char*,...);
|
---|
171 | int MSVCRT(sscanf)(const char*,const char*,...);
|
---|
172 | MSVCRT(FILE)* MSVCRT(tmpfile)(void);
|
---|
173 | char* MSVCRT(tmpnam)(char*);
|
---|
174 | int MSVCRT(ungetc)(int,MSVCRT(FILE)*);
|
---|
175 | int MSVCRT(vfprintf)(MSVCRT(FILE)*,const char*,va_list);
|
---|
176 | int MSVCRT(vprintf)(const char*,va_list);
|
---|
177 | int MSVCRT(vsprintf)(char*,const char*,va_list);
|
---|
178 |
|
---|
179 | MSVCRT(wint_t) _fgetwchar(void);
|
---|
180 | MSVCRT(wint_t) _fputwchar(MSVCRT(wint_t));
|
---|
181 | WCHAR* _getws(WCHAR*);
|
---|
182 | int _putws(const WCHAR*);
|
---|
183 | int _snwprintf(WCHAR*,MSVCRT(size_t),const WCHAR*,...);
|
---|
184 | int _vsnwprintf(WCHAR*,MSVCRT(size_t),const WCHAR*,va_list);
|
---|
185 | MSVCRT(FILE)* _wfdopen(int,const WCHAR*);
|
---|
186 | MSVCRT(FILE)* _wfopen(const WCHAR*,const WCHAR*);
|
---|
187 | MSVCRT(FILE)* _wfreopen(const WCHAR*,const WCHAR*,MSVCRT(FILE)*);
|
---|
188 | MSVCRT(FILE)* _wfsopen(const WCHAR*,const WCHAR*,int);
|
---|
189 | void _wperror(const WCHAR*);
|
---|
190 | MSVCRT(FILE)* _wpopen(const WCHAR*,const WCHAR*);
|
---|
191 | int _wremove(const WCHAR*);
|
---|
192 | WCHAR* _wtempnam(const WCHAR*,const WCHAR*);
|
---|
193 | WCHAR* _wtmpnam(WCHAR*);
|
---|
194 |
|
---|
195 | MSVCRT(wint_t) MSVCRT(fgetwc)(MSVCRT(FILE)*);
|
---|
196 | WCHAR* MSVCRT(fgetws)(WCHAR*,int,MSVCRT(FILE)*);
|
---|
197 | MSVCRT(wint_t) MSVCRT(fputwc)(MSVCRT(wint_t),MSVCRT(FILE)*);
|
---|
198 | int MSVCRT(fputws)(const WCHAR*,MSVCRT(FILE)*);
|
---|
199 | int MSVCRT(fwprintf)(MSVCRT(FILE)*,const WCHAR*,...);
|
---|
200 | int MSVCRT(fputws)(const WCHAR*,MSVCRT(FILE)*);
|
---|
201 | int MSVCRT(fwscanf)(MSVCRT(FILE)*,const WCHAR*,...);
|
---|
202 | MSVCRT(wint_t) MSVCRT(getwc)(MSVCRT(FILE)*);
|
---|
203 | MSVCRT(wint_t) MSVCRT(getwchar)(void);
|
---|
204 | WCHAR* MSVCRT(getws)(WCHAR*);
|
---|
205 | MSVCRT(wint_t) MSVCRT(putwc)(MSVCRT(wint_t),MSVCRT(FILE)*);
|
---|
206 | MSVCRT(wint_t) MSVCRT(putwchar)(MSVCRT(wint_t));
|
---|
207 | int MSVCRT(putws)(const WCHAR*);
|
---|
208 | int MSVCRT(swprintf)(WCHAR*,const WCHAR*,...);
|
---|
209 | int MSVCRT(swscanf)(WCHAR*,const WCHAR*,...);
|
---|
210 | MSVCRT(wint_t) MSVCRT(ungetwc)(MSVCRT(wint_t),MSVCRT(FILE)*);
|
---|
211 | int MSVCRT(vfwprintf)(MSVCRT(FILE)*,const WCHAR*,va_list);
|
---|
212 | int MSVCRT(vswprintf)(WCHAR*,const WCHAR*,va_list);
|
---|
213 | int MSVCRT(vwprintf)(const WCHAR*,va_list);
|
---|
214 | int MSVCRT(wprintf)(const WCHAR*,...);
|
---|
215 | int MSVCRT(wscanf)(const WCHAR*,...);
|
---|
216 |
|
---|
217 | #ifdef __cplusplus
|
---|
218 | }
|
---|
219 | #endif
|
---|
220 |
|
---|
221 |
|
---|
222 | #ifndef USE_MSVCRT_PREFIX
|
---|
223 | #define fdopen _fdopen
|
---|
224 | #define fgetchar _fgetchar
|
---|
225 | #define fileno _fileno
|
---|
226 | #define fputchar _fputchar
|
---|
227 | #define pclose _pclose
|
---|
228 | #define popen _popen
|
---|
229 | #define tempnam _tempnam
|
---|
230 | #define unlink _unlink
|
---|
231 |
|
---|
232 | #define fgetwchar _fgetwchar
|
---|
233 | #define fputwchar _fputwchar
|
---|
234 | #define getw _getw
|
---|
235 | #define putw _putw
|
---|
236 | #define wpopen _wpopen
|
---|
237 | #endif /* USE_MSVCRT_PREFIX */
|
---|
238 |
|
---|
239 | #endif /* __WINE_STDIO_H */
|
---|