| 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 | #include <corecrt_stdio_config.h> |
| 11 | #include <corecrt_wconio.h> |
| 12 | #include <stddef.h> |
| 13 | |
| 14 | #ifdef __cplusplus |
| 15 | extern "C" { |
| 16 | #endif |
| 17 | |
| 18 | /** |
| 19 | * Functions to read/write strings from/to console. |
| 20 | */ |
| 21 | |
| 22 | _CRTIMP char *__cdecl _cgets(char *_Buffer) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 23 | _CRTIMP int __cdecl _cputs(const char *_Str); |
| 24 | |
| 25 | #ifndef	NO_OLDNAMES |
| 26 | char *__cdecl cgets(char *_Buffer) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 27 | int __cdecl cputs(const char *_Str) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 28 | #endif |
| 29 | |
| 30 | /** |
| 31 | * Functions to read/write single characters from/to console. |
| 32 | */ |
| 33 | |
| 34 | _CRTIMP int __cdecl _kbhit(void); |
| 35 | _CRTIMP int __cdecl _getch(void); |
| 36 | _CRTIMP int __cdecl _getche(void); |
| 37 | _CRTIMP int __cdecl _putch(int _Ch); |
| 38 | _CRTIMP int __cdecl _ungetch(int _Ch); |
| 39 | |
| 40 | #ifndef	NO_OLDNAMES |
| 41 | int __cdecl kbhit(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 42 | int __cdecl getch(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 43 | int __cdecl getche(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 44 | int __cdecl putch(int _Ch) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 45 | int __cdecl ungetch(int _Ch) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 46 | #endif |
| 47 | |
| 48 | #if __MSVCRT_VERSION__ >= 0x800 |
| 49 | _CRTIMP int __cdecl _getch_nolock(void); |
| 50 | _CRTIMP int __cdecl _getche_nolock(void); |
| 51 | _CRTIMP int __cdecl _putch_nolock(int _Ch); |
| 52 | _CRTIMP int __cdecl _ungetch_nolock(int _Ch); |
| 53 | #endif |
| 54 | |
| 55 | /** |
| 56 | * Formatted console I/O functions. |
| 57 | */ |
| 58 | |
| 59 | #ifdef _UCRT |
| 60 | int __cdecl __conio_common_vcprintf(unsigned __int64 _Options, const char *_Format, _locale_t _Locale, va_list _ArgList); |
| 61 | int __cdecl __conio_common_vcprintf_p(unsigned __int64 _Options, const char *_Format, _locale_t _Locale, va_list _ArgList); |
| 62 | int __cdecl __conio_common_vcprintf_s(unsigned __int64 _Options, const char *_Format, _locale_t _Locale, va_list _ArgList); |
| 63 | int __cdecl __conio_common_vcscanf(unsigned __int64 _Options, const char *_Format, _locale_t _Locale, va_list _ArgList); |
| 64 | |
| 65 | __mingw_ovr int __cdecl _vcprintf(const char * __restrict__ _Format,va_list _ArgList) |
| 66 | { |
| 67 | return __conio_common_vcprintf(0, _Format, NULL, _ArgList); |
| 68 | } |
| 69 | __mingw_ovr int __cdecl _cprintf(const char * __restrict__ _Format,...) |
| 70 | { |
| 71 | __builtin_va_list _ArgList; |
| 72 | int _Ret; |
| 73 | __builtin_va_start(_ArgList, _Format); |
| 74 | _Ret = _vcprintf(_Format, _ArgList); |
| 75 | __builtin_va_end(_ArgList); |
| 76 | return _Ret; |
| 77 | } |
| 78 | __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN |
| 79 | int __cdecl _cscanf(const char * __restrict__ _Format,...) |
| 80 | { |
| 81 | __builtin_va_list _ArgList; |
| 82 | int _Ret; |
| 83 | __builtin_va_start(_ArgList, _Format); |
| 84 | _Ret = __conio_common_vcscanf(0, _Format, NULL, _ArgList); |
| 85 | __builtin_va_end(_ArgList); |
| 86 | return _Ret; |
| 87 | } |
| 88 | __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN |
| 89 | int __cdecl _cscanf_l(const char * __restrict__ _Format,_locale_t _Locale,...) |
| 90 | { |
| 91 | __builtin_va_list _ArgList; |
| 92 | int _Ret; |
| 93 | __builtin_va_start(_ArgList, _Locale); |
| 94 | _Ret = __conio_common_vcscanf(0, _Format, _Locale, _ArgList); |
| 95 | __builtin_va_end(_ArgList); |
| 96 | return _Ret; |
| 97 | } |
| 98 | __mingw_ovr int __cdecl _vcprintf_p(const char * __restrict__ _Format,va_list _ArgList) |
| 99 | { |
| 100 | return __conio_common_vcprintf_p(0, _Format, NULL, _ArgList); |
| 101 | } |
| 102 | __mingw_ovr int __cdecl _cprintf_p(const char * __restrict__ _Format,...) |
| 103 | { |
| 104 | __builtin_va_list _ArgList; |
| 105 | int _Ret; |
| 106 | __builtin_va_start(_ArgList, _Format); |
| 107 | _Ret = _vcprintf_p(_Format, _ArgList); |
| 108 | __builtin_va_end(_ArgList); |
| 109 | return _Ret; |
| 110 | } |
| 111 | __mingw_ovr int __cdecl _vcprintf_l(const char * __restrict__ _Format,_locale_t _Locale,va_list _ArgList) |
| 112 | { |
| 113 | return __conio_common_vcprintf(0, _Format, _Locale, _ArgList); |
| 114 | } |
| 115 | __mingw_ovr int __cdecl _cprintf_l(const char * __restrict__ _Format,_locale_t _Locale,...) |
| 116 | { |
| 117 | __builtin_va_list _ArgList; |
| 118 | int _Ret; |
| 119 | __builtin_va_start(_ArgList, _Locale); |
| 120 | _Ret = _vcprintf_l(_Format, _Locale, _ArgList); |
| 121 | __builtin_va_end(_ArgList); |
| 122 | return _Ret; |
| 123 | } |
| 124 | __mingw_ovr int __cdecl _vcprintf_p_l(const char * __restrict__ _Format,_locale_t _Locale,va_list _ArgList) |
| 125 | { |
| 126 | return __conio_common_vcprintf_p(0, _Format, _Locale, _ArgList); |
| 127 | } |
| 128 | __mingw_ovr int __cdecl _cprintf_p_l(const char * __restrict__ _Format,_locale_t _Locale,...) |
| 129 | { |
| 130 | __builtin_va_list _ArgList; |
| 131 | int _Ret; |
| 132 | __builtin_va_start(_ArgList, _Locale); |
| 133 | _Ret = _vcprintf_p_l(_Format, _Locale, _ArgList); |
| 134 | __builtin_va_end(_ArgList); |
| 135 | return _Ret; |
| 136 | } |
| 137 | #ifndef	NO_OLDNAMES |
| 138 | __mingw_ovr int __cdecl cprintf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005 |
| 139 | { |
| 140 | __builtin_va_list _ArgList; |
| 141 | int _Ret; |
| 142 | __builtin_va_start(_ArgList, _Format); |
| 143 | _Ret = _vcprintf(_Format, _ArgList); |
| 144 | __builtin_va_end(_ArgList); |
| 145 | return _Ret; |
| 146 | } |
| 147 | __mingw_ovr int __cdecl cscanf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005 |
| 148 | { |
| 149 | __builtin_va_list _ArgList; |
| 150 | int _Ret; |
| 151 | __builtin_va_start(_ArgList, _Format); |
| 152 | _Ret = __conio_common_vcscanf(0, _Format, NULL, _ArgList); |
| 153 | __builtin_va_end(_ArgList); |
| 154 | return _Ret; |
| 155 | } |
| 156 | #endif /* NO_OLDNAMES */ |
| 157 | #else /* !_UCRT */ |
| 158 | _CRTIMP int __cdecl _cprintf(const char * __restrict__ _Format,...); |
| 159 | _CRTIMP int __cdecl _cprintf_l(const char * __restrict__ _Format,_locale_t _Locale,...); |
| 160 | _CRTIMP int __cdecl _cprintf_p(const char * __restrict__ _Format,...); |
| 161 | _CRTIMP int __cdecl _cprintf_p_l(const char * __restrict__ _Format,_locale_t _Locale,...); |
| 162 | _CRTIMP int __cdecl _vcprintf(const char * __restrict__ _Format,va_list _ArgList); |
| 163 | _CRTIMP int __cdecl _vcprintf_l(const char * __restrict__ _Format,_locale_t _Locale,va_list _ArgList); |
| 164 | _CRTIMP int __cdecl _vcprintf_p(const char * __restrict__ _Format,va_list _ArgList); |
| 165 | _CRTIMP int __cdecl _vcprintf_p_l(const char * __restrict__ _Format,_locale_t _Locale,va_list _ArgList); |
| 166 | _CRTIMP int __cdecl _cscanf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 167 | _CRTIMP int __cdecl _cscanf_l(const char * __restrict__ _Format,_locale_t _Locale,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; |
| 168 | #ifndef	NO_OLDNAMES |
| 169 | int __cdecl cprintf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 170 | int __cdecl cscanf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 171 | #endif /* NO_OLDNAMES */ |
| 172 | #endif /* _UCRT */ |
| 173 | |
| 174 | /** |
| 175 | * Port I/O functions. |
| 176 | * |
| 177 | * These functions were removed from CRT in msvcr80.dll. |
| 178 | * They are still available in i386 system versions of msvcrt.dll. |
| 179 | */ |
| 180 | |
| 181 | #if (__MSVCRT_VERSION__ >= 0x0400 && __MSVCRT_VERSION__ < 0x0800) && defined(_M_IX86) |
| 182 | int __cdecl _inp(unsigned short); |
| 183 | unsigned short __cdecl _inpw(unsigned short); |
| 184 | unsigned long __cdecl _inpd(unsigned short); |
| 185 | int __cdecl _outp(unsigned short,int); |
| 186 | unsigned short __cdecl _outpw(unsigned short,unsigned short); |
| 187 | unsigned long __cdecl _outpd(unsigned short,unsigned long); |
| 188 | #ifndef	NO_OLDNAMES |
| 189 | int __cdecl inp(unsigned short) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 190 | unsigned short __cdecl inpw(unsigned short) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 191 | int __cdecl outp(unsigned short,int) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 192 | unsigned short __cdecl outpw(unsigned short,unsigned short) __MINGW_ATTRIB_DEPRECATED_MSVC2005; |
| 193 | #endif /* NO_OLDNAMES */ |
| 194 | #endif |
| 195 | |
| 196 | #ifdef __cplusplus |
| 197 | } |
| 198 | #endif |
| 199 | |
| 200 | #include <sec_api/conio_s.h> |
| 201 | |
| 202 | #endif |