msvcrt: Remove MSVCRT_ prefix from wcs.c functions.
[wine.git] / include / msvcrt / corecrt_wstdio.h
blob63f411e02db8467542f15f77bd7b66690905c9ed
1 /**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the Wine project.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
7 #ifndef _WSTDIO_DEFINED
8 #define _WSTDIO_DEFINED
10 #include <corecrt.h>
11 #include <corecrt_stdio_config.h>
13 #ifndef RC_INVOKED
14 #include <stdarg.h>
15 #endif
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
21 #include <pshpack8.h>
23 #ifndef _FILE_DEFINED
24 #define _FILE_DEFINED
25 #include <pshpack8.h>
26 typedef struct _iobuf
28 char* _ptr;
29 int _cnt;
30 char* _base;
31 int _flag;
32 int _file;
33 int _charbuf;
34 int _bufsiz;
35 char* _tmpfname;
36 } FILE;
37 #include <poppack.h>
38 #endif /* _FILE_DEFINED */
40 #ifndef WEOF
41 #define WEOF (wint_t)(0xFFFF)
42 #endif
44 _ACRTIMP FILE *__cdecl __acrt_iob_func(unsigned index);
46 #define stdin (__acrt_iob_func(0))
47 #define stdout (__acrt_iob_func(1))
48 #define stderr (__acrt_iob_func(2))
50 _ACRTIMP wint_t __cdecl _fgetwc_nolock(FILE*);
51 _ACRTIMP wint_t __cdecl _fgetwchar(void);
52 _ACRTIMP wint_t __cdecl _fputwc_nolock(wint_t,FILE*);
53 _ACRTIMP wint_t __cdecl _fputwchar(wint_t);
54 _ACRTIMP wint_t __cdecl _getwc_nolock(FILE*);
55 _ACRTIMP wchar_t* __cdecl _getws(wchar_t*);
56 _ACRTIMP wint_t __cdecl _putwc_nolock(wint_t,FILE*);
57 _ACRTIMP int __cdecl _putws(const wchar_t*);
58 _ACRTIMP wint_t __cdecl _ungetwc_nolock(wint_t,FILE*);
59 _ACRTIMP FILE* __cdecl _wfdopen(int,const wchar_t*);
60 _ACRTIMP FILE* __cdecl _wfopen(const wchar_t*,const wchar_t*);
61 _ACRTIMP errno_t __cdecl _wfopen_s(FILE**,const wchar_t*,const wchar_t*);
62 _ACRTIMP FILE* __cdecl _wfreopen(const wchar_t*,const wchar_t*,FILE*);
63 _ACRTIMP FILE* __cdecl _wfsopen(const wchar_t*,const wchar_t*,int);
64 _ACRTIMP void __cdecl _wperror(const wchar_t*);
65 _ACRTIMP FILE* __cdecl _wpopen(const wchar_t*,const wchar_t*);
66 _ACRTIMP int __cdecl _wremove(const wchar_t*);
67 _ACRTIMP wchar_t* __cdecl _wtempnam(const wchar_t*,const wchar_t*);
68 _ACRTIMP wchar_t* __cdecl _wtmpnam(wchar_t*);
70 _ACRTIMP wint_t __cdecl fgetwc(FILE*);
71 _ACRTIMP wchar_t* __cdecl fgetws(wchar_t*,int,FILE*);
72 _ACRTIMP wint_t __cdecl fputwc(wint_t,FILE*);
73 _ACRTIMP int __cdecl fputws(const wchar_t*,FILE*);
74 _ACRTIMP int __cdecl fputws(const wchar_t*,FILE*);
75 _ACRTIMP wint_t __cdecl getwc(FILE*);
76 _ACRTIMP wint_t __cdecl getwchar(void);
77 _ACRTIMP wchar_t* __cdecl getws(wchar_t*);
78 _ACRTIMP wint_t __cdecl putwc(wint_t,FILE*);
79 _ACRTIMP wint_t __cdecl putwchar(wint_t);
80 _ACRTIMP int __cdecl putws(const wchar_t*);
81 _ACRTIMP wint_t __cdecl ungetwc(wint_t,FILE*);
83 #ifdef _UCRT
85 _ACRTIMP int __cdecl __stdio_common_vfwprintf(unsigned __int64,FILE*,const wchar_t*,_locale_t,__ms_va_list);
86 _ACRTIMP int __cdecl __stdio_common_vfwprintf_s(unsigned __int64,FILE*,const wchar_t*,_locale_t,__ms_va_list);
87 _ACRTIMP int __cdecl __stdio_common_vsnwprintf_s(unsigned __int64,wchar_t*,size_t,size_t,const wchar_t*,_locale_t,__ms_va_list);
88 _ACRTIMP int __cdecl __stdio_common_vswprintf(unsigned __int64,wchar_t*,size_t,const wchar_t*,_locale_t,__ms_va_list);
89 _ACRTIMP int __cdecl __stdio_common_vswprintf_p(unsigned __int64,wchar_t*,size_t,const wchar_t*,_locale_t,__ms_va_list);
90 _ACRTIMP int __cdecl __stdio_common_vswprintf_s(unsigned __int64,wchar_t*,size_t,const wchar_t*,_locale_t,__ms_va_list);
92 _ACRTIMP int __cdecl __stdio_common_vfwscanf(unsigned __int64,FILE*,const wchar_t*,_locale_t,__ms_va_list);
93 _ACRTIMP int __cdecl __stdio_common_vswscanf(unsigned __int64,const wchar_t*,size_t,const wchar_t*,_locale_t,__ms_va_list);
95 #endif /* _UCRT */
97 #if defined(_UCRT) && !defined(_NO_CRT_STDIO_INLINE)
99 static inline int __cdecl _vsnwprintf(wchar_t *buffer, size_t size, const wchar_t *format, __ms_va_list args)
101 int ret = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, buffer, size, format, NULL, args);
102 return ret < 0 ? -1 : ret;
105 static inline int WINAPIV _snwprintf(wchar_t *buffer, size_t size, const wchar_t* format, ...)
107 int ret;
108 __ms_va_list args;
110 __ms_va_start(args, format);
111 ret = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, buffer, size, format, NULL, args);
112 __ms_va_end(args);
113 return ret;
116 static inline int __cdecl _vsnwprintf_s(wchar_t *buffer, size_t size, size_t count, const wchar_t *format, __ms_va_list args)
118 int ret = __stdio_common_vsnwprintf_s(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, buffer, size, count, format, NULL, args);
119 return ret < 0 ? -1 : ret;
122 static inline int WINAPIV _snwprintf_s(wchar_t *buffer, size_t size, size_t count, const wchar_t *format, ...)
124 int ret;
125 __ms_va_list args;
127 __ms_va_start(args, format);
128 ret = __stdio_common_vsnwprintf_s(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, buffer, size, count, format, NULL, args);
129 __ms_va_end(args);
130 return ret;
133 static inline int WINAPIV vswprintf(wchar_t *buffer, size_t size, const wchar_t *format, __ms_va_list args)
135 int ret = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, buffer, size, format, NULL, args);
136 return ret < 0 ? -1 : ret;
139 static inline int WINAPIV swprintf(wchar_t *buffer, size_t size, const wchar_t *format, ...)
141 int ret;
142 __ms_va_list args;
144 __ms_va_start(args, format);
145 ret = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, buffer, size, format, NULL, args);
146 __ms_va_end(args);
147 return ret;
150 static inline int WINAPIV _vswprintf(wchar_t *buffer, const wchar_t *format, __ms_va_list args)
152 int ret = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, buffer, -1, format, NULL, args);
153 return ret < 0 ? -1 : ret;
156 static inline int WINAPIV _swprintf(wchar_t *buffer, const wchar_t *format, ...)
158 int ret;
159 __ms_va_list args;
161 __ms_va_start(args, format);
162 ret = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, buffer, -1, format, NULL, args);
163 __ms_va_end(args);
164 return ret < 0 ? -1 : ret;
167 static inline int WINAPIV vswprintf_s(wchar_t *buffer, size_t size, const wchar_t *format, __ms_va_list args)
169 int ret = __stdio_common_vswprintf_s(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, buffer, size, format, NULL, args);
170 return ret < 0 ? -1 : ret;
173 static inline int WINAPIV swprintf_s(wchar_t *buffer, size_t size, const wchar_t* format, ...)
175 int ret;
176 __ms_va_list args;
178 __ms_va_start(args, format);
179 ret = __stdio_common_vswprintf_s(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, buffer, size, format, NULL, args);
180 __ms_va_end(args);
181 return ret;
184 static inline int __cdecl _vscwprintf(const wchar_t *format, __ms_va_list args)
186 int ret = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR,
187 NULL, 0, format, NULL, args);
188 return ret < 0 ? -1 : ret;
191 static inline int __cdecl _vswprintf_p_l(wchar_t *buffer, size_t size, const wchar_t *format, _locale_t locale, __ms_va_list args)
193 int ret = __stdio_common_vswprintf_p(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, buffer, size, format, locale, args);
194 return ret < 0 ? -1 : ret;
197 static inline int __cdecl _vscwprintf_p_l(const wchar_t *format, _locale_t locale, __ms_va_list args)
199 int ret = __stdio_common_vswprintf_p(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR,
200 NULL, 0, format, locale, args);
201 return ret < 0 ? -1 : ret;
204 static inline int WINAPIV _scwprintf(const wchar_t *format, ...)
206 int ret;
207 __ms_va_list args;
209 __ms_va_start(args, format);
210 ret = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR,
211 NULL, 0, format, NULL, args);
212 __ms_va_end(args);
213 return ret;
216 static inline int __cdecl vfwprintf(FILE *file, const wchar_t *format, __ms_va_list args)
218 return __stdio_common_vfwprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, file, format, NULL, args);
221 static inline int WINAPIV fwprintf(FILE *file, const wchar_t *format, ...)
223 int ret;
224 __ms_va_list args;
226 __ms_va_start(args, format);
227 ret = __stdio_common_vfwprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, file, format, NULL, args);
228 __ms_va_end(args);
229 return ret;
232 static inline int vfwprintf_s(FILE *file, const wchar_t *format, __ms_va_list args)
234 return __stdio_common_vfwprintf_s(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, file, format, NULL, args);
237 static inline int WINAPIV fwprintf_s(FILE *file, const wchar_t *format, ...)
239 int ret;
240 __ms_va_list args;
242 __ms_va_start(args, format);
243 ret = vfwprintf_s(file, format, args);
244 __ms_va_end(args);
245 return ret;
248 static inline int __cdecl vwprintf(const wchar_t *format, __ms_va_list args)
250 return __stdio_common_vfwprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, stdout, format, NULL, args);
253 static inline int WINAPIV wprintf(const wchar_t *format, ...)
255 int ret;
256 __ms_va_list args;
258 __ms_va_start(args, format);
259 ret = __stdio_common_vfwprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, stdout, format, NULL, args);
260 __ms_va_end(args);
261 return ret;
264 static inline int vwprintf_s(const wchar_t *format, __ms_va_list args)
266 return __stdio_common_vfwprintf_s(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, stdout, format, NULL, args);
269 static inline int WINAPIV wprintf_s(const wchar_t *format, ...)
271 int ret;
272 __ms_va_list args;
274 __ms_va_start(args, format);
275 ret = vfwprintf_s(stdout, format, args);
276 __ms_va_end(args);
277 return ret;
280 static inline int WINAPIV swscanf(const wchar_t *buffer, const wchar_t *format, ...)
282 int ret;
283 __ms_va_list args;
285 __ms_va_start(args, format);
286 ret = __stdio_common_vswscanf(_CRT_INTERNAL_LOCAL_SCANF_OPTIONS, buffer, -1, format, NULL, args);
287 __ms_va_end(args);
288 return ret;
291 static inline int WINAPIV swscanf_s(const wchar_t *buffer, const wchar_t *format, ...)
293 int ret;
294 __ms_va_list args;
296 __ms_va_start(args, format);
297 ret = __stdio_common_vswscanf(_CRT_INTERNAL_LOCAL_SCANF_OPTIONS | _CRT_INTERNAL_SCANF_SECURECRT, buffer, -1, format, NULL, args);
298 __ms_va_end(args);
299 return ret;
302 static inline int WINAPIV fwscanf(FILE *file, const wchar_t *format, ...)
304 int ret;
305 __ms_va_list args;
307 __ms_va_start(args, format);
308 ret = __stdio_common_vfwscanf(_CRT_INTERNAL_LOCAL_SCANF_OPTIONS, file, format, NULL, args);
309 __ms_va_end(args);
310 return ret;
313 static inline int WINAPIV fwscanf_s(FILE *file, const wchar_t *format, ...)
315 int ret;
316 __ms_va_list args;
318 __ms_va_start(args, format);
319 ret = __stdio_common_vfwscanf(_CRT_INTERNAL_LOCAL_SCANF_OPTIONS | _CRT_INTERNAL_SCANF_SECURECRT, file, format, NULL, args);
320 __ms_va_end(args);
321 return ret;
324 static inline int WINAPIV wscanf(FILE *file, const wchar_t *format, ...)
326 int ret;
327 __ms_va_list args;
329 __ms_va_start(args, format);
330 ret = __stdio_common_vfwscanf(_CRT_INTERNAL_LOCAL_SCANF_OPTIONS, stdin, format, NULL, args);
331 __ms_va_end(args);
332 return ret;
335 static inline int WINAPIV wscanf_s(FILE *file, const wchar_t *format, ...)
337 int ret;
338 __ms_va_list args;
340 __ms_va_start(args, format);
341 ret = __stdio_common_vfwscanf(_CRT_INTERNAL_LOCAL_SCANF_OPTIONS | _CRT_INTERNAL_SCANF_SECURECRT, stdin, format, NULL, args);
342 __ms_va_end(args);
343 return ret;
346 #else /* _UCRT && !_NO_CRT_STDIO_INLINE */
348 _ACRTIMP int WINAPIV _scwprintf(const wchar_t*,...);
349 _ACRTIMP int WINAPIV _snwprintf(wchar_t*,size_t,const wchar_t*,...);
350 _ACRTIMP int WINAPIV _snwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,...);
351 _ACRTIMP int __cdecl _vscwprintf(const wchar_t*,__ms_va_list);
352 _ACRTIMP int __cdecl _vscwprintf_p_l(const wchar_t*,_locale_t,__ms_va_list);
353 _ACRTIMP int __cdecl _vsnwprintf(wchar_t*,size_t,const wchar_t*,__ms_va_list);
354 _ACRTIMP int __cdecl _vsnwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,__ms_va_list);
355 _ACRTIMP int __cdecl _vswprintf_p_l(wchar_t*,size_t,const wchar_t*,_locale_t,__ms_va_list);
356 _ACRTIMP int WINAPIV fwprintf(FILE*,const wchar_t*,...);
357 _ACRTIMP int WINAPIV fwprintf_s(FILE*,const wchar_t*,...);
358 _ACRTIMP int WINAPIV swprintf_s(wchar_t*,size_t,const wchar_t*,...);
359 _ACRTIMP int __cdecl vfwprintf(FILE*,const wchar_t*,__ms_va_list);
360 _ACRTIMP int __cdecl vfwprintf_s(FILE*,const wchar_t*,__ms_va_list);
361 _ACRTIMP int __cdecl vswprintf_s(wchar_t*,size_t,const wchar_t*,__ms_va_list);
362 _ACRTIMP int __cdecl vwprintf(const wchar_t*,__ms_va_list);
363 _ACRTIMP int __cdecl vwprintf_s(const wchar_t*,__ms_va_list);
364 _ACRTIMP int WINAPIV wprintf(const wchar_t*,...);
365 _ACRTIMP int WINAPIV wprintf_s(const wchar_t*,...);
367 #ifdef _CRT_NON_CONFORMING_SWPRINTFS
368 _ACRTIMP int WINAPIV swprintf(wchar_t*,const wchar_t*,...);
369 _ACRTIMP int __cdecl vswprintf(wchar_t*,const wchar_t*,__ms_va_list);
370 #elif !defined(_NO_CRT_STDIO_INLINE)
371 static inline int vswprintf(wchar_t *buffer, size_t size, const wchar_t *format, __ms_va_list args) { return _vsnwprintf(buffer,size,format,args); }
372 static inline int WINAPIV swprintf(wchar_t *buffer, size_t size, const wchar_t *format, ...)
374 int ret;
375 __ms_va_list args;
377 __ms_va_start(args, format);
378 ret = _vsnwprintf(buffer, size, format, args);
379 __ms_va_end(args);
380 return ret;
382 #else
383 _ACRTIMP int vswprintf(wchar_t*,size_t,const wchar_t*,__ms_va_list);
384 _ACRTIMP int WINAPIV swprintf(wchar_t*,size_t,const wchar_t*,...);
385 #endif /* _CRT_NON_CONFORMING_SWPRINTFS */
387 _ACRTIMP int WINAPIV fwscanf(FILE*,const wchar_t*,...);
388 _ACRTIMP int WINAPIV fwscanf_s(FILE*,const wchar_t*,...);
389 _ACRTIMP int WINAPIV swscanf(const wchar_t*,const wchar_t*,...);
390 _ACRTIMP int WINAPIV swscanf_s(const wchar_t*,const wchar_t*,...);
391 _ACRTIMP int WINAPIV wscanf(const wchar_t*,...);
392 _ACRTIMP int WINAPIV wscanf_s(const wchar_t*,...);
394 #endif /* _UCRT && !_NO_CRT_STDIO_INLINE */
396 #ifdef __cplusplus
398 #endif
400 #include <poppack.h>
402 #endif /* _WSTDIO_DEFINED */