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