• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * This file has no copyright assigned and is placed in the Public Domain.
3  * This file is part of the mingw-w64 runtime package.
4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5  */
6 #ifndef _INC_CONIO
7 #define _INC_CONIO
8 
9 #include <crtdefs.h>
10 
11 #if !defined(_UCRTBASE_STDIO_DEFINED) && defined(_UCRT)
12 #define _UCRTBASE_STDIO_DEFINED
13 
14 #define UCRTBASE_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION (0x0001)
15 #define UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR      (0x0002)
16 #define UCRTBASE_PRINTF_LEGACY_WIDE_SPECIFIERS           (0x0004)
17 #define UCRTBASE_PRINTF_LEGACY_MSVCRT_COMPATIBILITY      (0x0008)
18 #define UCRTBASE_PRINTF_LEGACY_THREE_DIGIT_EXPONENTS     (0x0010)
19 
20 #define UCRTBASE_SCANF_SECURECRT                         (0x0001)
21 #define UCRTBASE_SCANF_LEGACY_WIDE_SPECIFIERS            (0x0002)
22 #define UCRTBASE_SCANF_LEGACY_MSVCRT_COMPATIBILITY       (0x0004)
23 
24 // Default wide printfs and scanfs to the legacy wide mode. Only code built
25 // with -D__USE_MINGW_ANSI_STDIO=1 will expect the standard behaviour.
26 #ifndef UCRTBASE_PRINTF_DEFAULT_WIDE
27 #define UCRTBASE_PRINTF_DEFAULT_WIDE UCRTBASE_PRINTF_LEGACY_WIDE_SPECIFIERS
28 #endif
29 #ifndef UCRTBASE_SCANF_DEFAULT_WIDE
30 #define UCRTBASE_SCANF_DEFAULT_WIDE UCRTBASE_SCANF_LEGACY_WIDE_SPECIFIERS
31 #endif
32 #endif
33 
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39   _CRTIMP char *_cgets(char *_Buffer) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
40   _CRTIMP int __cdecl _cputs(const char *_Str);
41   _CRTIMP int __cdecl _getch(void);
42   _CRTIMP int __cdecl _getche(void);
43   _CRTIMP int __cdecl _kbhit(void);
44 
45 #ifdef _UCRT
46   int __cdecl __conio_common_vcprintf(unsigned __int64 _Options, const char *_Format, _locale_t _Locale, va_list _ArgList);
47   int __cdecl __conio_common_vcprintf_p(unsigned __int64 _Options, const char *_Format, _locale_t _Locale, va_list _ArgList);
48   int __cdecl __conio_common_vcprintf_s(unsigned __int64 _Options, const char *_Format, _locale_t _Locale, va_list _ArgList);
49   int __cdecl __conio_common_vcscanf(unsigned __int64 _Options, const char *_Format, _locale_t _Locale, va_list _ArgList);
50 
_vcprintf(const char * __restrict__ _Format,va_list _ArgList)51   __mingw_ovr int __cdecl _vcprintf(const char * __restrict__ _Format,va_list _ArgList)
52   {
53     return __conio_common_vcprintf(0, _Format, NULL, _ArgList);
54   }
_cprintf(const char * __restrict__ _Format,...)55   __mingw_ovr int __cdecl _cprintf(const char * __restrict__ _Format,...)
56   {
57     __builtin_va_list _ArgList;
58     int _Ret;
59     __builtin_va_start(_ArgList, _Format);
60     _Ret = _vcprintf(_Format, _ArgList);
61     __builtin_va_end(_ArgList);
62     return _Ret;
63   }
_cscanf(const char * __restrict__ _Format,...)64   __mingw_ovr int __cdecl _cscanf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN
65   {
66     __builtin_va_list _ArgList;
67     int _Ret;
68     __builtin_va_start(_ArgList, _Format);
69     _Ret = __conio_common_vcscanf(0, _Format, NULL, _ArgList);
70     __builtin_va_end(_ArgList);
71     return _Ret;
72   }
_cscanf_l(const char * __restrict__ _Format,_locale_t _Locale,...)73   __mingw_ovr int __cdecl _cscanf_l(const char * __restrict__ _Format,_locale_t _Locale,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN
74   {
75     __builtin_va_list _ArgList;
76     int _Ret;
77     __builtin_va_start(_ArgList, _Locale);
78     _Ret = __conio_common_vcscanf(0, _Format, _Locale, _ArgList);
79     __builtin_va_end(_ArgList);
80     return _Ret;
81   }
82 
_vcprintf_p(const char * __restrict__ _Format,va_list _ArgList)83   __mingw_ovr int __cdecl _vcprintf_p(const char * __restrict__ _Format,va_list _ArgList)
84   {
85     return __conio_common_vcprintf_p(0, _Format, NULL, _ArgList);
86   }
_cprintf_p(const char * __restrict__ _Format,...)87   __mingw_ovr int __cdecl _cprintf_p(const char * __restrict__ _Format,...)
88   {
89     __builtin_va_list _ArgList;
90     int _Ret;
91     __builtin_va_start(_ArgList, _Format);
92     _Ret = _vcprintf_p(_Format, _ArgList);
93     __builtin_va_end(_ArgList);
94     return _Ret;
95   }
_vcprintf_l(const char * __restrict__ _Format,_locale_t _Locale,va_list _ArgList)96   __mingw_ovr int __cdecl _vcprintf_l(const char * __restrict__ _Format,_locale_t _Locale,va_list _ArgList)
97   {
98     return __conio_common_vcprintf(0, _Format, _Locale, _ArgList);
99   }
_cprintf_l(const char * __restrict__ _Format,_locale_t _Locale,...)100   __mingw_ovr int __cdecl _cprintf_l(const char * __restrict__ _Format,_locale_t _Locale,...)
101   {
102     __builtin_va_list _ArgList;
103     int _Ret;
104     __builtin_va_start(_ArgList, _Locale);
105     _Ret = _vcprintf_l(_Format, _Locale, _ArgList);
106     __builtin_va_end(_ArgList);
107     return _Ret;
108   }
_vcprintf_p_l(const char * __restrict__ _Format,_locale_t _Locale,va_list _ArgList)109   __mingw_ovr int __cdecl _vcprintf_p_l(const char * __restrict__ _Format,_locale_t _Locale,va_list _ArgList)
110   {
111     return __conio_common_vcprintf_p(0, _Format, _Locale, _ArgList);
112   }
_cprintf_p_l(const char * __restrict__ _Format,_locale_t _Locale,...)113   __mingw_ovr int __cdecl _cprintf_p_l(const char * __restrict__ _Format,_locale_t _Locale,...)
114   {
115     __builtin_va_list _ArgList;
116     int _Ret;
117     __builtin_va_start(_ArgList, _Locale);
118     _Ret = _vcprintf_p_l(_Format, _Locale, _ArgList);
119     __builtin_va_end(_ArgList);
120     return _Ret;
121   }
122 #else
123   _CRTIMP int __cdecl _cprintf(const char * __restrict__ _Format,...);
124   _CRTIMP int __cdecl _cscanf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
125   _CRTIMP int __cdecl _cscanf_l(const char * __restrict__ _Format,_locale_t _Locale,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
126 
127   _CRTIMP int __cdecl _vcprintf(const char * __restrict__ _Format,va_list _ArgList);
128   _CRTIMP int __cdecl _cprintf_p(const char * __restrict__ _Format,...);
129   _CRTIMP int __cdecl _vcprintf_p(const char * __restrict__ _Format,va_list _ArgList);
130   _CRTIMP int __cdecl _cprintf_l(const char * __restrict__ _Format,_locale_t _Locale,...);
131   _CRTIMP int __cdecl _vcprintf_l(const char * __restrict__ _Format,_locale_t _Locale,va_list _ArgList);
132   _CRTIMP int __cdecl _cprintf_p_l(const char * __restrict__ _Format,_locale_t _Locale,...);
133   _CRTIMP int __cdecl _vcprintf_p_l(const char * __restrict__ _Format,_locale_t _Locale,va_list _ArgList);
134 #endif
135 
136 #if defined(_X86_) && !defined(__x86_64)
137   int __cdecl _inp(unsigned short);
138   unsigned short __cdecl _inpw(unsigned short);
139   unsigned long __cdecl _inpd(unsigned short);
140   int __cdecl _outp(unsigned short,int);
141   unsigned short __cdecl _outpw(unsigned short,unsigned short);
142   unsigned long __cdecl _outpd(unsigned short,unsigned long);
143 #endif
144 
145   _CRTIMP int __cdecl _putch(int _Ch);
146   _CRTIMP int __cdecl _ungetch(int _Ch);
147   _CRTIMP int __cdecl _getch_nolock(void);
148   _CRTIMP int __cdecl _getche_nolock(void);
149   _CRTIMP int __cdecl _putch_nolock(int _Ch);
150   _CRTIMP int __cdecl _ungetch_nolock(int _Ch);
151 
152 #ifndef _WCONIO_DEFINED
153 #define _WCONIO_DEFINED
154 
155 #ifndef WEOF
156 #define WEOF (wint_t)(0xFFFF)
157 #endif
158 
159   _CRTIMP wchar_t *_cgetws(wchar_t *_Buffer) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
160   _CRTIMP wint_t __cdecl _getwch(void);
161   _CRTIMP wint_t __cdecl _getwche(void);
162   _CRTIMP wint_t __cdecl _putwch(wchar_t _WCh);
163   _CRTIMP wint_t __cdecl _ungetwch(wint_t _WCh);
164   _CRTIMP int __cdecl _cputws(const wchar_t *_String);
165 #ifdef _UCRT
166   int __cdecl __conio_common_vcwprintf(unsigned __int64 _Options, const wchar_t *_Format, _locale_t _Locale, va_list _ArgList);
167   int __cdecl __conio_common_vcwprintf_p(unsigned __int64 _Options, const wchar_t *_Format, _locale_t _Locale, va_list _ArgList);
168   int __cdecl __conio_common_vcwprintf_s(unsigned __int64 _Options, const wchar_t *_Format, _locale_t _Locale, va_list _ArgList);
169   int __cdecl __conio_common_vcwscanf(unsigned __int64 _Options, const wchar_t *_Format, _locale_t _Locale, va_list _ArgList);
170 
_vcwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList)171   __mingw_ovr int __cdecl _vcwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList)
172   {
173     return __conio_common_vcwprintf(UCRTBASE_PRINTF_DEFAULT_WIDE, _Format, NULL, _ArgList);
174   }
_cwprintf(const wchar_t * __restrict__ _Format,...)175   __mingw_ovr int __cdecl _cwprintf(const wchar_t * __restrict__ _Format,...)
176   {
177     __builtin_va_list _ArgList;
178     int _Ret;
179     __builtin_va_start(_ArgList, _Format);
180     _Ret = _vcwprintf(_Format, _ArgList);
181     __builtin_va_end(_ArgList);
182     return _Ret;
183   }
_cwscanf(const wchar_t * __restrict__ _Format,...)184   __mingw_ovr int __cdecl _cwscanf(const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN
185   {
186     __builtin_va_list _ArgList;
187     int _Ret;
188     __builtin_va_start(_ArgList, _Format);
189     _Ret = __conio_common_vcwscanf(UCRTBASE_SCANF_DEFAULT_WIDE, _Format, NULL, _ArgList);
190     __builtin_va_end(_ArgList);
191     return _Ret;
192   }
_cwscanf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...)193   __mingw_ovr int __cdecl _cwscanf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN
194   {
195     __builtin_va_list _ArgList;
196     int _Ret;
197     __builtin_va_start(_ArgList, _Locale);
198     _Ret = __conio_common_vcwscanf(UCRTBASE_SCANF_DEFAULT_WIDE, _Format, _Locale, _ArgList);
199     __builtin_va_end(_ArgList);
200     return _Ret;
201   }
_vcwprintf_p(const wchar_t * __restrict__ _Format,va_list _ArgList)202   __mingw_ovr int __cdecl _vcwprintf_p(const wchar_t * __restrict__ _Format,va_list _ArgList)
203   {
204     return __conio_common_vcwprintf_p(UCRTBASE_PRINTF_DEFAULT_WIDE, _Format, NULL, _ArgList);
205   }
_cwprintf_p(const wchar_t * __restrict__ _Format,...)206   __mingw_ovr int __cdecl _cwprintf_p(const wchar_t * __restrict__ _Format,...)
207   {
208     __builtin_va_list _ArgList;
209     int _Ret;
210     __builtin_va_start(_ArgList, _Format);
211     _Ret = _vcwprintf_p(_Format, _ArgList);
212     __builtin_va_end(_ArgList);
213     return _Ret;
214   }
_vcwprintf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,va_list _ArgList)215   __mingw_ovr int __cdecl _vcwprintf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,va_list _ArgList)
216   {
217     return __conio_common_vcwprintf(UCRTBASE_PRINTF_DEFAULT_WIDE, _Format, _Locale, _ArgList);
218   }
_cwprintf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...)219   __mingw_ovr int __cdecl _cwprintf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...)
220   {
221     __builtin_va_list _ArgList;
222     int _Ret;
223     __builtin_va_start(_ArgList, _Locale);
224     _Ret = _vcwprintf_l(_Format, _Locale, _ArgList);
225     __builtin_va_end(_ArgList);
226     return _Ret;
227   }
_vcwprintf_p_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,va_list _ArgList)228   __mingw_ovr int __cdecl _vcwprintf_p_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,va_list _ArgList)
229   {
230     return __conio_common_vcwprintf_p(UCRTBASE_PRINTF_DEFAULT_WIDE, _Format, _Locale, _ArgList);
231   }
_cwprintf_p_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...)232   __mingw_ovr int __cdecl _cwprintf_p_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...)
233   {
234     __builtin_va_list _ArgList;
235     int _Ret;
236     __builtin_va_start(_ArgList, _Locale);
237     _Ret = _vcwprintf_p_l(_Format, _Locale, _ArgList);
238     __builtin_va_end(_ArgList);
239     return _Ret;
240   }
241 #else
242   _CRTIMP int __cdecl _cwprintf(const wchar_t * __restrict__ _Format,...);
243   _CRTIMP int __cdecl _cwscanf(const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
244   _CRTIMP int __cdecl _cwscanf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
245   _CRTIMP int __cdecl _vcwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList);
246   _CRTIMP int __cdecl _cwprintf_p(const wchar_t * __restrict__ _Format,...);
247   _CRTIMP int __cdecl _vcwprintf_p(const wchar_t * __restrict__ _Format,va_list _ArgList);
248   _CRTIMP int __cdecl _cwprintf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...);
249   _CRTIMP int __cdecl _vcwprintf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,va_list _ArgList);
250   _CRTIMP int __cdecl _cwprintf_p_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...);
251   _CRTIMP int __cdecl _vcwprintf_p_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,va_list _ArgList);
252 #endif
253   _CRTIMP wint_t __cdecl _putwch_nolock(wchar_t _WCh);
254   _CRTIMP wint_t __cdecl _getwch_nolock(void);
255   _CRTIMP wint_t __cdecl _getwche_nolock(void);
256   _CRTIMP wint_t __cdecl _ungetwch_nolock(wint_t _WCh);
257 #endif
258 
259 #ifndef	NO_OLDNAMES
260   char *__cdecl cgets(char *_Buffer) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
261 
262 #ifdef _UCRT
cprintf(const char * __restrict__ _Format,...)263   __mingw_ovr int __cdecl cprintf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005
264   {
265     __builtin_va_list _ArgList;
266     int _Ret;
267     __builtin_va_start(_ArgList, _Format);
268     _Ret = _vcprintf(_Format, _ArgList);
269     __builtin_va_end(_ArgList);
270     return _Ret;
271   }
cscanf(const char * __restrict__ _Format,...)272   __mingw_ovr int __cdecl cscanf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005
273   {
274     __builtin_va_list _ArgList;
275     int _Ret;
276     __builtin_va_start(_ArgList, _Format);
277     _Ret = __conio_common_vcscanf(0, _Format, NULL, _ArgList);
278     __builtin_va_end(_ArgList);
279     return _Ret;
280   }
281 #else
282   int __cdecl cprintf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
283   int __cdecl cscanf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
284 #endif
285   int __cdecl cputs(const char *_Str) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
286   int __cdecl getch(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
287   int __cdecl getche(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
288   int __cdecl kbhit(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
289   int __cdecl putch(int _Ch) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
290   int __cdecl ungetch(int _Ch) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
291 
292 #if (defined(_X86_) && !defined(__x86_64))
293   int __cdecl inp(unsigned short) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
294   unsigned short __cdecl inpw(unsigned short) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
295   int __cdecl outp(unsigned short,int) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
296   unsigned short __cdecl outpw(unsigned short,unsigned short) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
297 #endif
298 
299     /* __cpuid moved to intrin.h per msdn */
300     /* __inbyte moved to intrin.h per msdn */
301     /* __inbytestring moved to intrin.h per msdn */
302     /* __indword moved to intrin.h per msdn */
303     /* __indwordstring moved to intrin.h per msdn */
304     /* __inword moved to intrin.h per msdn */
305     /* __inwordstring moved to intrin.h per msdn */
306     /* __outbyte moved to intrin.h per msdn */
307     /* __outbytestring moved to intrin.h per msdn */
308     /* __outdword moved to intrin.h per msdn */
309     /* __outdwordstring moved to intrin.h per msdn */
310     /* __outword moved to intrin.h per msdn */
311     /* __outwordstring moved to intrin.h per msdn */
312     /* __readcr0 moved to intrin.h per msdn */
313     /* __readcr2 moved to intrin.h per msdn */
314     /* __readcr3 moved to intrin.h per msdn */
315     /* __readcr4 moved to intrin.h per msdn */
316     /* __readcr8 moved to intrin.h per msdn */
317     /* __readmsr moved to intrin.h per msdn */
318     /* __writecr0 moved to intrin.h per msdn */
319     /* __writecr2 moved to intrin.h per msdn */
320     /* __writecr3 moved to intrin.h per msdn */
321     /* __writecr4 moved to intrin.h per msdn */
322     /* __writecr8 moved to intrin.h per msdn */
323     /* __writemsr moved to intrin.h per msdn */
324 #endif
325 
326 #ifdef __cplusplus
327 }
328 #endif
329 
330 #include <sec_api/conio_s.h>
331 
332 #endif
333