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