ok() does not support '%S'. Store the Ansi version, convert to Unicode
[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
16 #ifndef MSVCRT
17 # ifdef USE_MSVCRT_PREFIX
18 #  define MSVCRT(x)    MSVCRT_##x
19 # else
20 #  define MSVCRT(x)    x
21 # endif
22 #endif
23
24 /* file._flag flags */
25 #ifndef USE_MSVCRT_PREFIX
26 #define _IOREAD          0x0001
27 #define _IOWRT           0x0002
28 #define _IOMYBUF         0x0008
29 #define _IOEOF           0x0010
30 #define _IOERR           0x0020
31 #define _IOSTRG          0x0040
32 #define _IORW            0x0080
33 #define _IOAPPEND        0x0200
34 #else
35 #define MSVCRT__IOREAD   0x0001
36 #define MSVCRT__IOWRT    0x0002
37 #define MSVCRT__IOMYBUF  0x0008
38 #define MSVCRT__IOEOF    0x0010
39 #define MSVCRT__IOERR    0x0020
40 #define MSVCRT__IOSTRG   0x0040
41 #define MSVCRT__IORW     0x0080
42 #define MSVCRT__IOAPPEND 0x0200
43 #endif /* USE_MSVCRT_PREFIX */
44
45 #ifndef NULL
46 #ifdef  __cplusplus
47 #define NULL  0
48 #else
49 #define NULL  ((void *)0)
50 #endif
51 #endif
52
53 #ifndef USE_MSVCRT_PREFIX
54
55 #define STDIN_FILENO  0
56 #define STDOUT_FILENO 1
57 #define STDERR_FILENO 2
58
59 /* more file._flag flags, but these conflict with Unix */
60 #define _IOFBF    0x0000
61 #define _IONBF    0x0004
62 #define _IOLBF    0x0040
63
64 #define EOF       (-1)
65 #define FILENAME_MAX 260
66 #define FOPEN_MAX 20
67 #define L_tmpnam  260
68
69 #define BUFSIZ    512
70
71 #ifndef SEEK_SET
72 #define SEEK_SET  0
73 #define SEEK_CUR  1
74 #define SEEK_END  2
75 #endif
76
77 #else
78
79 /* more file._flag flags, but these conflict with Unix */
80 #define MSVCRT__IOFBF    0x0000
81 #define MSVCRT__IONBF    0x0004
82 #define MSVCRT__IOLBF    0x0040
83
84 #define MSVCRT_FILENAME_MAX 260
85
86 #define MSVCRT_EOF       (-1)
87
88 #define MSVCRT_BUFSIZ    512
89
90 #endif /* USE_MSVCRT_PREFIX */
91
92 #ifndef MSVCRT_FILE_DEFINED
93 #define MSVCRT_FILE_DEFINED
94 typedef struct MSVCRT(_iobuf)
95 {
96   char* _ptr;
97   int   _cnt;
98   char* _base;
99   int   _flag;
100   int   _file;
101   int   _charbuf;
102   int   _bufsiz;
103   char* _tmpfname;
104 } MSVCRT(FILE);
105 #endif  /* MSVCRT_FILE_DEFINED */
106
107 #ifndef MSVCRT_FPOS_T_DEFINED
108 typedef long MSVCRT(fpos_t);
109 #define MSVCRT_FPOS_T_DEFINED
110 #endif
111
112 #ifndef MSVCRT_SIZE_T_DEFINED
113 typedef unsigned int MSVCRT(size_t);
114 #define MSVCRT_SIZE_T_DEFINED
115 #endif
116
117 #ifndef MSVCRT_WCHAR_T_DEFINED
118 #define MSVCRT_WCHAR_T_DEFINED
119 #ifndef __cplusplus
120 typedef unsigned short MSVCRT(wchar_t);
121 #endif
122 #endif
123
124 #ifndef MSVCRT_WCTYPE_T_DEFINED
125 typedef MSVCRT(wchar_t) MSVCRT(wint_t);
126 typedef MSVCRT(wchar_t) MSVCRT(wctype_t);
127 #define MSVCRT_WCTYPE_T_DEFINED
128 #endif
129
130 #ifdef __cplusplus
131 extern "C" {
132 #endif
133
134 #ifndef MSVCRT_STDIO_DEFINED
135 MSVCRT(FILE)*        MSVCRT(__p__iob)(void);
136 #define _iob               (__p__iob())
137 #endif /* MSVCRT_STDIO_DEFINED */
138
139 #ifndef USE_MSVCRT_PREFIX
140 #define stdin              (_iob+STDIN_FILENO)
141 #define stdout             (_iob+STDOUT_FILENO)
142 #define stderr             (_iob+STDERR_FILENO)
143 #endif /* USE_MSVCRT_PREFIX */
144
145 #ifndef MSVCRT_STDIO_DEFINED
146 #define MSVCRT_STDIO_DEFINED
147 int         _fcloseall(void);
148 MSVCRT(FILE)* _fdopen(int,const char*);
149 int         _fgetchar(void);
150 int         _filbuf(MSVCRT(FILE*));
151 int         _fileno(MSVCRT(FILE)*);
152 int         _flsbuf(int,MSVCRT(FILE)*);
153 int         _flushall(void);
154 int         _fputchar(int);
155 MSVCRT(FILE)* _fsopen(const char*,const char*,int);
156 int         _getmaxstdio(void);
157 int         _getw(MSVCRT(FILE)*);
158 int         _pclose(MSVCRT(FILE)*);
159 MSVCRT(FILE)* _popen(const char*,const char*);
160 int         _putw(int,MSVCRT(FILE)*);
161 int         _rmtmp(void);
162 int         _setmaxstdio(int);
163 int         _snprintf(char*,MSVCRT(size_t),const char*,...);
164 char*       _tempnam(const char*,const char*);
165 int         _unlink(const char*);
166 int         _vsnprintf(char*,MSVCRT(size_t),const char*,va_list);
167
168 void        MSVCRT(clearerr)(MSVCRT(FILE)*);
169 int         MSVCRT(fclose)(MSVCRT(FILE)*);
170 int         MSVCRT(feof)(MSVCRT(FILE)*);
171 int         MSVCRT(ferror)(MSVCRT(FILE)*);
172 int         MSVCRT(fflush)(MSVCRT(FILE)*);
173 int         MSVCRT(fgetc)(MSVCRT(FILE)*);
174 int         MSVCRT(fgetpos)(MSVCRT(FILE)*,MSVCRT(fpos_t)*);
175 char*       MSVCRT(fgets)(char*,int,MSVCRT(FILE)*);
176 MSVCRT(FILE)* MSVCRT(fopen)(const char*,const char*);
177 int         MSVCRT(fprintf)(MSVCRT(FILE)*,const char*,...);
178 int         MSVCRT(fputc)(int,MSVCRT(FILE)*);
179 int         MSVCRT(fputs)(const char*,MSVCRT(FILE)*);
180 MSVCRT(size_t) MSVCRT(fread)(void*,MSVCRT(size_t),MSVCRT(size_t),MSVCRT(FILE)*);
181 MSVCRT(FILE)* MSVCRT(freopen)(const char*,const char*,MSVCRT(FILE)*);
182 int         MSVCRT(fscanf)(MSVCRT(FILE)*,const char*,...);
183 int         MSVCRT(fseek)(MSVCRT(FILE)*,long,int);
184 int         MSVCRT(fsetpos)(MSVCRT(FILE)*,MSVCRT(fpos_t)*);
185 long        MSVCRT(ftell)(MSVCRT(FILE)*);
186 MSVCRT(size_t) MSVCRT(fwrite)(const void*,MSVCRT(size_t),MSVCRT(size_t),MSVCRT(FILE)*);
187 int         MSVCRT(getc)(MSVCRT(FILE)*);
188 int         MSVCRT(getchar)(void);
189 char*       MSVCRT(gets)(char*);
190 void        MSVCRT(perror)(const char*);
191 int         MSVCRT(printf)(const char*,...);
192 int         MSVCRT(putc)(int,MSVCRT(FILE)*);
193 int         MSVCRT(putchar)(int);
194 int         MSVCRT(puts)(const char*);
195 int         MSVCRT(remove)(const char*);
196 int         MSVCRT(rename)(const char*,const char*);
197 void        MSVCRT(rewind)(MSVCRT(FILE)*);
198 int         MSVCRT(scanf)(const char*,...);
199 void        MSVCRT(setbuf)(MSVCRT(FILE)*,char*);
200 int         MSVCRT(setvbuf)(MSVCRT(FILE)*,char*,int,MSVCRT(size_t));
201 int         MSVCRT(sprintf)(char*,const char*,...);
202 int         MSVCRT(sscanf)(const char*,const char*,...);
203 MSVCRT(FILE)* MSVCRT(tmpfile)(void);
204 char*       MSVCRT(tmpnam)(char*);
205 int         MSVCRT(ungetc)(int,MSVCRT(FILE)*);
206 int         MSVCRT(vfprintf)(MSVCRT(FILE)*,const char*,va_list);
207 int         MSVCRT(vprintf)(const char*,va_list);
208 int         MSVCRT(vsprintf)(char*,const char*,va_list);
209
210 #ifndef MSVCRT_WSTDIO_DEFINED
211 #define MSVCRT_WSTDIO_DEFINED
212 MSVCRT(wint_t)  _fgetwchar(void);
213 MSVCRT(wint_t)  _fputwchar(MSVCRT(wint_t));
214 MSVCRT(wchar_t)*_getws(MSVCRT(wchar_t)*);
215 int             _putws(const MSVCRT(wchar_t)*);
216 int             _snwprintf(MSVCRT(wchar_t)*,MSVCRT(size_t),const MSVCRT(wchar_t)*,...);
217 int             _vsnwprintf(MSVCRT(wchar_t)*,MSVCRT(size_t),const MSVCRT(wchar_t)*,va_list);
218 MSVCRT(FILE)*   _wfdopen(int,const MSVCRT(wchar_t)*);
219 MSVCRT(FILE)*   _wfopen(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
220 MSVCRT(FILE)*   _wfreopen(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,MSVCRT(FILE)*);
221 MSVCRT(FILE)*   _wfsopen(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,int);
222 void            _wperror(const MSVCRT(wchar_t)*);
223 MSVCRT(FILE)*   _wpopen(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
224 int             _wremove(const MSVCRT(wchar_t)*);
225 MSVCRT(wchar_t)*_wtempnam(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
226 MSVCRT(wchar_t)*_wtmpnam(MSVCRT(wchar_t)*);
227
228 MSVCRT(wint_t)  MSVCRT(fgetwc)(MSVCRT(FILE)*);
229 MSVCRT(wchar_t)*MSVCRT(fgetws)(MSVCRT(wchar_t)*,int,MSVCRT(FILE)*);
230 MSVCRT(wint_t)  MSVCRT(fputwc)(MSVCRT(wint_t),MSVCRT(FILE)*);
231 int             MSVCRT(fputws)(const MSVCRT(wchar_t)*,MSVCRT(FILE)*);
232 int             MSVCRT(fwprintf)(MSVCRT(FILE)*,const MSVCRT(wchar_t)*,...);
233 int             MSVCRT(fputws)(const MSVCRT(wchar_t)*,MSVCRT(FILE)*);
234 int             MSVCRT(fwscanf)(MSVCRT(FILE)*,const MSVCRT(wchar_t)*,...);
235 MSVCRT(wint_t)  MSVCRT(getwc)(MSVCRT(FILE)*);
236 MSVCRT(wint_t)  MSVCRT(getwchar)(void);
237 MSVCRT(wchar_t)*MSVCRT(getws)(MSVCRT(wchar_t)*);
238 MSVCRT(wint_t)  MSVCRT(putwc)(MSVCRT(wint_t),MSVCRT(FILE)*);
239 MSVCRT(wint_t)  MSVCRT(putwchar)(MSVCRT(wint_t));
240 int             MSVCRT(putws)(const MSVCRT(wchar_t)*);
241 int             MSVCRT(swprintf)(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
242 int             MSVCRT(swscanf)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
243 MSVCRT(wint_t)  MSVCRT(ungetwc)(MSVCRT(wint_t),MSVCRT(FILE)*);
244 int             MSVCRT(vfwprintf)(MSVCRT(FILE)*,const MSVCRT(wchar_t)*,va_list);
245 int             MSVCRT(vswprintf)(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,va_list);
246 int             MSVCRT(vwprintf)(const MSVCRT(wchar_t)*,va_list);
247 int             MSVCRT(wprintf)(const MSVCRT(wchar_t)*,...);
248 int             MSVCRT(wscanf)(const MSVCRT(wchar_t)*,...);
249 #endif /* MSVCRT_WSTDIO_DEFINED */
250
251 #endif /* MSVCRT_STDIO_DEFINED */
252
253 #ifdef __cplusplus
254 }
255 #endif
256
257
258 #ifndef USE_MSVCRT_PREFIX
259 #define fdopen   _fdopen
260 #define fgetchar _fgetchar
261 #define fileno   _fileno
262 #define fputchar _fputchar
263 #define pclose   _pclose
264 #define popen    _popen
265 #define tempnam  _tempnam
266 #ifndef MSVCRT_UNLINK_DEFINED
267 static inline int unlink(const char* path) { return _unlink(path); }
268 #define MSVCRT_UNLINK_DEFINED
269 #endif
270
271 #define fgetwchar _fgetwchar
272 #define fputwchar _fputwchar
273 #define getw     _getw
274 #define putw     _putw
275 #define wpopen   _wpopen
276 #endif /* USE_MSVCRT_PREFIX */
277
278 #endif /* __WINE_STDIO_H */