conio.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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. #include <crtdefs.h>
  9. #include <corecrt_stdio_config.h>
  10. #include <stddef.h>
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. _CRTIMP char *_cgets(char *_Buffer) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
  15. _CRTIMP int __cdecl _cputs(const char *_Str);
  16. _CRTIMP int __cdecl _getch(void);
  17. _CRTIMP int __cdecl _getche(void);
  18. _CRTIMP int __cdecl _kbhit(void);
  19. #ifdef _UCRT
  20. int __cdecl __conio_common_vcprintf(unsigned __int64 _Options, const char *_Format, _locale_t _Locale, va_list _ArgList);
  21. int __cdecl __conio_common_vcprintf_p(unsigned __int64 _Options, const char *_Format, _locale_t _Locale, va_list _ArgList);
  22. int __cdecl __conio_common_vcprintf_s(unsigned __int64 _Options, const char *_Format, _locale_t _Locale, va_list _ArgList);
  23. int __cdecl __conio_common_vcscanf(unsigned __int64 _Options, const char *_Format, _locale_t _Locale, va_list _ArgList);
  24. __mingw_ovr int __cdecl _vcprintf(const char * __restrict__ _Format,va_list _ArgList)
  25. {
  26. return __conio_common_vcprintf(0, _Format, NULL, _ArgList);
  27. }
  28. __mingw_ovr int __cdecl _cprintf(const char * __restrict__ _Format,...)
  29. {
  30. __builtin_va_list _ArgList;
  31. int _Ret;
  32. __builtin_va_start(_ArgList, _Format);
  33. _Ret = _vcprintf(_Format, _ArgList);
  34. __builtin_va_end(_ArgList);
  35. return _Ret;
  36. }
  37. __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN
  38. int __cdecl _cscanf(const char * __restrict__ _Format,...)
  39. {
  40. __builtin_va_list _ArgList;
  41. int _Ret;
  42. __builtin_va_start(_ArgList, _Format);
  43. _Ret = __conio_common_vcscanf(0, _Format, NULL, _ArgList);
  44. __builtin_va_end(_ArgList);
  45. return _Ret;
  46. }
  47. __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN
  48. int __cdecl _cscanf_l(const char * __restrict__ _Format,_locale_t _Locale,...)
  49. {
  50. __builtin_va_list _ArgList;
  51. int _Ret;
  52. __builtin_va_start(_ArgList, _Locale);
  53. _Ret = __conio_common_vcscanf(0, _Format, _Locale, _ArgList);
  54. __builtin_va_end(_ArgList);
  55. return _Ret;
  56. }
  57. __mingw_ovr int __cdecl _vcprintf_p(const char * __restrict__ _Format,va_list _ArgList)
  58. {
  59. return __conio_common_vcprintf_p(0, _Format, NULL, _ArgList);
  60. }
  61. __mingw_ovr int __cdecl _cprintf_p(const char * __restrict__ _Format,...)
  62. {
  63. __builtin_va_list _ArgList;
  64. int _Ret;
  65. __builtin_va_start(_ArgList, _Format);
  66. _Ret = _vcprintf_p(_Format, _ArgList);
  67. __builtin_va_end(_ArgList);
  68. return _Ret;
  69. }
  70. __mingw_ovr int __cdecl _vcprintf_l(const char * __restrict__ _Format,_locale_t _Locale,va_list _ArgList)
  71. {
  72. return __conio_common_vcprintf(0, _Format, _Locale, _ArgList);
  73. }
  74. __mingw_ovr int __cdecl _cprintf_l(const char * __restrict__ _Format,_locale_t _Locale,...)
  75. {
  76. __builtin_va_list _ArgList;
  77. int _Ret;
  78. __builtin_va_start(_ArgList, _Locale);
  79. _Ret = _vcprintf_l(_Format, _Locale, _ArgList);
  80. __builtin_va_end(_ArgList);
  81. return _Ret;
  82. }
  83. __mingw_ovr int __cdecl _vcprintf_p_l(const char * __restrict__ _Format,_locale_t _Locale,va_list _ArgList)
  84. {
  85. return __conio_common_vcprintf_p(0, _Format, _Locale, _ArgList);
  86. }
  87. __mingw_ovr int __cdecl _cprintf_p_l(const char * __restrict__ _Format,_locale_t _Locale,...)
  88. {
  89. __builtin_va_list _ArgList;
  90. int _Ret;
  91. __builtin_va_start(_ArgList, _Locale);
  92. _Ret = _vcprintf_p_l(_Format, _Locale, _ArgList);
  93. __builtin_va_end(_ArgList);
  94. return _Ret;
  95. }
  96. #else
  97. _CRTIMP int __cdecl _cprintf(const char * __restrict__ _Format,...);
  98. _CRTIMP int __cdecl _cscanf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
  99. _CRTIMP int __cdecl _cscanf_l(const char * __restrict__ _Format,_locale_t _Locale,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
  100. _CRTIMP int __cdecl _vcprintf(const char * __restrict__ _Format,va_list _ArgList);
  101. _CRTIMP int __cdecl _cprintf_p(const char * __restrict__ _Format,...);
  102. _CRTIMP int __cdecl _vcprintf_p(const char * __restrict__ _Format,va_list _ArgList);
  103. _CRTIMP int __cdecl _cprintf_l(const char * __restrict__ _Format,_locale_t _Locale,...);
  104. _CRTIMP int __cdecl _vcprintf_l(const char * __restrict__ _Format,_locale_t _Locale,va_list _ArgList);
  105. _CRTIMP int __cdecl _cprintf_p_l(const char * __restrict__ _Format,_locale_t _Locale,...);
  106. _CRTIMP int __cdecl _vcprintf_p_l(const char * __restrict__ _Format,_locale_t _Locale,va_list _ArgList);
  107. #endif
  108. #if defined(_X86_) && !defined(__x86_64)
  109. int __cdecl _inp(unsigned short);
  110. unsigned short __cdecl _inpw(unsigned short);
  111. unsigned long __cdecl _inpd(unsigned short);
  112. int __cdecl _outp(unsigned short,int);
  113. unsigned short __cdecl _outpw(unsigned short,unsigned short);
  114. unsigned long __cdecl _outpd(unsigned short,unsigned long);
  115. #endif
  116. _CRTIMP int __cdecl _putch(int _Ch);
  117. _CRTIMP int __cdecl _ungetch(int _Ch);
  118. #if __MSVCRT_VERSION__ >= 0x800
  119. _CRTIMP int __cdecl _getch_nolock(void);
  120. _CRTIMP int __cdecl _getche_nolock(void);
  121. _CRTIMP int __cdecl _putch_nolock(int _Ch);
  122. _CRTIMP int __cdecl _ungetch_nolock(int _Ch);
  123. #endif
  124. #ifndef _WCONIO_DEFINED
  125. #define _WCONIO_DEFINED
  126. #ifndef WEOF
  127. #define WEOF (wint_t)(0xFFFF)
  128. #endif
  129. _CRTIMP wchar_t *_cgetws(wchar_t *_Buffer) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
  130. _CRTIMP wint_t __cdecl _getwch(void);
  131. _CRTIMP wint_t __cdecl _getwche(void);
  132. _CRTIMP wint_t __cdecl _putwch(wchar_t _WCh);
  133. _CRTIMP wint_t __cdecl _ungetwch(wint_t _WCh);
  134. _CRTIMP int __cdecl _cputws(const wchar_t *_String);
  135. #ifdef _UCRT
  136. int __cdecl __conio_common_vcwprintf(unsigned __int64 _Options, const wchar_t *_Format, _locale_t _Locale, va_list _ArgList);
  137. int __cdecl __conio_common_vcwprintf_p(unsigned __int64 _Options, const wchar_t *_Format, _locale_t _Locale, va_list _ArgList);
  138. int __cdecl __conio_common_vcwprintf_s(unsigned __int64 _Options, const wchar_t *_Format, _locale_t _Locale, va_list _ArgList);
  139. int __cdecl __conio_common_vcwscanf(unsigned __int64 _Options, const wchar_t *_Format, _locale_t _Locale, va_list _ArgList);
  140. __mingw_ovr int __cdecl _vcwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList)
  141. {
  142. return __conio_common_vcwprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _Format, NULL, _ArgList);
  143. }
  144. __mingw_ovr int __cdecl _cwprintf(const wchar_t * __restrict__ _Format,...)
  145. {
  146. __builtin_va_list _ArgList;
  147. int _Ret;
  148. __builtin_va_start(_ArgList, _Format);
  149. _Ret = _vcwprintf(_Format, _ArgList);
  150. __builtin_va_end(_ArgList);
  151. return _Ret;
  152. }
  153. __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN
  154. int __cdecl _cwscanf(const wchar_t * __restrict__ _Format,...)
  155. {
  156. __builtin_va_list _ArgList;
  157. int _Ret;
  158. __builtin_va_start(_ArgList, _Format);
  159. _Ret = __conio_common_vcwscanf(_CRT_INTERNAL_LOCAL_SCANF_OPTIONS, _Format, NULL, _ArgList);
  160. __builtin_va_end(_ArgList);
  161. return _Ret;
  162. }
  163. __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN
  164. int __cdecl _cwscanf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...)
  165. {
  166. __builtin_va_list _ArgList;
  167. int _Ret;
  168. __builtin_va_start(_ArgList, _Locale);
  169. _Ret = __conio_common_vcwscanf(_CRT_INTERNAL_LOCAL_SCANF_OPTIONS, _Format, _Locale, _ArgList);
  170. __builtin_va_end(_ArgList);
  171. return _Ret;
  172. }
  173. __mingw_ovr int __cdecl _vcwprintf_p(const wchar_t * __restrict__ _Format,va_list _ArgList)
  174. {
  175. return __conio_common_vcwprintf_p(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _Format, NULL, _ArgList);
  176. }
  177. __mingw_ovr int __cdecl _cwprintf_p(const wchar_t * __restrict__ _Format,...)
  178. {
  179. __builtin_va_list _ArgList;
  180. int _Ret;
  181. __builtin_va_start(_ArgList, _Format);
  182. _Ret = _vcwprintf_p(_Format, _ArgList);
  183. __builtin_va_end(_ArgList);
  184. return _Ret;
  185. }
  186. __mingw_ovr int __cdecl _vcwprintf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,va_list _ArgList)
  187. {
  188. return __conio_common_vcwprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _Format, _Locale, _ArgList);
  189. }
  190. __mingw_ovr int __cdecl _cwprintf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...)
  191. {
  192. __builtin_va_list _ArgList;
  193. int _Ret;
  194. __builtin_va_start(_ArgList, _Locale);
  195. _Ret = _vcwprintf_l(_Format, _Locale, _ArgList);
  196. __builtin_va_end(_ArgList);
  197. return _Ret;
  198. }
  199. __mingw_ovr int __cdecl _vcwprintf_p_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,va_list _ArgList)
  200. {
  201. return __conio_common_vcwprintf_p(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _Format, _Locale, _ArgList);
  202. }
  203. __mingw_ovr int __cdecl _cwprintf_p_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...)
  204. {
  205. __builtin_va_list _ArgList;
  206. int _Ret;
  207. __builtin_va_start(_ArgList, _Locale);
  208. _Ret = _vcwprintf_p_l(_Format, _Locale, _ArgList);
  209. __builtin_va_end(_ArgList);
  210. return _Ret;
  211. }
  212. #else
  213. _CRTIMP int __cdecl _cwprintf(const wchar_t * __restrict__ _Format,...);
  214. _CRTIMP int __cdecl _cwscanf(const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
  215. _CRTIMP int __cdecl _cwscanf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
  216. _CRTIMP int __cdecl _vcwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList);
  217. _CRTIMP int __cdecl _cwprintf_p(const wchar_t * __restrict__ _Format,...);
  218. _CRTIMP int __cdecl _vcwprintf_p(const wchar_t * __restrict__ _Format,va_list _ArgList);
  219. _CRTIMP int __cdecl _cwprintf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...);
  220. _CRTIMP int __cdecl _vcwprintf_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,va_list _ArgList);
  221. _CRTIMP int __cdecl _cwprintf_p_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,...);
  222. _CRTIMP int __cdecl _vcwprintf_p_l(const wchar_t * __restrict__ _Format,_locale_t _Locale,va_list _ArgList);
  223. #endif
  224. #if __MSVCRT_VERSION__ >= 0x800
  225. _CRTIMP wint_t __cdecl _putwch_nolock(wchar_t _WCh);
  226. _CRTIMP wint_t __cdecl _getwch_nolock(void);
  227. _CRTIMP wint_t __cdecl _getwche_nolock(void);
  228. _CRTIMP wint_t __cdecl _ungetwch_nolock(wint_t _WCh);
  229. #endif
  230. #endif
  231. #ifndef NO_OLDNAMES
  232. char *__cdecl cgets(char *_Buffer) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
  233. #ifdef _UCRT
  234. __mingw_ovr int __cdecl cprintf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005
  235. {
  236. __builtin_va_list _ArgList;
  237. int _Ret;
  238. __builtin_va_start(_ArgList, _Format);
  239. _Ret = _vcprintf(_Format, _ArgList);
  240. __builtin_va_end(_ArgList);
  241. return _Ret;
  242. }
  243. __mingw_ovr int __cdecl cscanf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005
  244. {
  245. __builtin_va_list _ArgList;
  246. int _Ret;
  247. __builtin_va_start(_ArgList, _Format);
  248. _Ret = __conio_common_vcscanf(0, _Format, NULL, _ArgList);
  249. __builtin_va_end(_ArgList);
  250. return _Ret;
  251. }
  252. #else
  253. int __cdecl cprintf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
  254. int __cdecl cscanf(const char * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
  255. #endif
  256. int __cdecl cputs(const char *_Str) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
  257. int __cdecl getch(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
  258. int __cdecl getche(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
  259. int __cdecl kbhit(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
  260. int __cdecl putch(int _Ch) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
  261. int __cdecl ungetch(int _Ch) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
  262. #if (defined(_X86_) && !defined(__x86_64))
  263. int __cdecl inp(unsigned short) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
  264. unsigned short __cdecl inpw(unsigned short) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
  265. int __cdecl outp(unsigned short,int) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
  266. unsigned short __cdecl outpw(unsigned short,unsigned short) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
  267. #endif
  268. /* __cpuid moved to intrin.h per msdn */
  269. /* __inbyte moved to intrin.h per msdn */
  270. /* __inbytestring moved to intrin.h per msdn */
  271. /* __indword moved to intrin.h per msdn */
  272. /* __indwordstring moved to intrin.h per msdn */
  273. /* __inword moved to intrin.h per msdn */
  274. /* __inwordstring moved to intrin.h per msdn */
  275. /* __outbyte moved to intrin.h per msdn */
  276. /* __outbytestring moved to intrin.h per msdn */
  277. /* __outdword moved to intrin.h per msdn */
  278. /* __outdwordstring moved to intrin.h per msdn */
  279. /* __outword moved to intrin.h per msdn */
  280. /* __outwordstring moved to intrin.h per msdn */
  281. /* __readcr0 moved to intrin.h per msdn */
  282. /* __readcr2 moved to intrin.h per msdn */
  283. /* __readcr3 moved to intrin.h per msdn */
  284. /* __readcr4 moved to intrin.h per msdn */
  285. /* __readcr8 moved to intrin.h per msdn */
  286. /* __readmsr moved to intrin.h per msdn */
  287. /* __writecr0 moved to intrin.h per msdn */
  288. /* __writecr2 moved to intrin.h per msdn */
  289. /* __writecr3 moved to intrin.h per msdn */
  290. /* __writecr4 moved to intrin.h per msdn */
  291. /* __writecr8 moved to intrin.h per msdn */
  292. /* __writemsr moved to intrin.h per msdn */
  293. #endif
  294. #ifdef __cplusplus
  295. }
  296. #endif
  297. #include <sec_api/conio_s.h>
  298. #endif