OSDN Git Service

7e279103ba7e99aa5b952e087c8d3bbb790949c4
[mingw/mingw-org-wsl.git] / mingwrt / include / conio.h
1 /*
2  * conio.h
3  *
4  * Low level console I/O functions.  Pretty please try to use the ANSI
5  * standard ones if you are writing new code.
6  *
7  * $Id$
8  *
9  * Written by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
10  * Copyright (C) 1997, 1999-2001, 2003, 2004, 2007, 2018, MinGW.org Project.
11  *
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a
14  * copy of this software and associated documentation files (the "Software"),
15  * to deal in the Software without restriction, including without limitation
16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  * and/or sell copies of the Software, and to permit persons to whom the
18  * Software is furnished to do so, subject to the following conditions:
19  *
20  * The above copyright notice, this permission notice, and the following
21  * disclaimer shall be included in all copies or substantial portions of
22  * the Software.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
27  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER
30  * DEALINGS IN THE SOFTWARE.
31  *
32  */
33 #ifndef _CONIO_H
34 #pragma GCC system_header
35
36 /* When including <wchar.h>, some of the definitions and declarations
37  * which are nominally provided in <conio.h> must be duplicated.  Rather
38  * than require duplicated maintenance effort, we provide for partial
39  * inclusion of <conio.h> by <wchar.h>; only when not included in
40  * this partial fashion...
41  */
42 #ifndef __WCHAR_H_SOURCED__
43  /* ...which is exclusive to <wchar.h>, do we assert the multiple
44   * inclusion guard for <conio.h> itself.
45   */
46 #define _CONIO_H
47
48 /* All MinGW.org headers are expected to include <_mingw.h>; when
49  * selectively included by <wchar.h>, that responsibility has already
50  * been addressed, but for free-standing inclusion we do so now.
51  */
52 #include <_mingw.h>
53 #endif  /* !__WCHAR_H_SOURCED__ */
54
55 #ifndef RC_INVOKED
56 /* There is nothing here which is useful to the resource compiler;
57  * for any other form of compilation, and regardless of the scope in
58  * which <conio.h> is included, we need definitions for wchar_t, and
59  * wint_t; get them by selective inclusion of <stddef.h>.
60  */
61 #define __need_wint_t
62 #define __need_wchar_t
63 #include <stddef.h>
64
65 _BEGIN_C_DECLS
66
67 #ifdef _CONIO_H
68 /* The following declarations are to be exposed only on free-standing
69  * inclusion of <conio.h>
70  */
71 _CRTIMP __cdecl __MINGW_NOTHROW  char *_cgets (char*);
72 _CRTIMP __cdecl __MINGW_NOTHROW  int   _cprintf (const char*, ...);
73 _CRTIMP __cdecl __MINGW_NOTHROW  int   _cputs (const char*);
74 _CRTIMP __cdecl __MINGW_NOTHROW  int   _cscanf (char*, ...);
75
76 _CRTIMP __cdecl __MINGW_NOTHROW  int   _getch (void);
77 _CRTIMP __cdecl __MINGW_NOTHROW  int   _getche (void);
78 _CRTIMP __cdecl __MINGW_NOTHROW  int   _kbhit (void);
79 _CRTIMP __cdecl __MINGW_NOTHROW  int   _putch (int);
80 _CRTIMP __cdecl __MINGW_NOTHROW  int   _ungetch (int);
81
82 #if _WIN32_WINNT >= _WIN32_WINNT_WINXP || __MSVCRT_VERSION__ >= __MSVCR70_DLL
83 /* Wide character variants of the console I/O functions were first
84  * introduced in non-free MSVCR70.DLL, and subsequently supported by
85  * MSVCRT.DLL from WinXP onwards.  Some are declared in <wchar.t> in
86  * addition to <conio.h>; the following are exclusive to <conio.h>
87  */
88 _CRTIMP __cdecl __MINGW_NOTHROW  wint_t  _putwch (wchar_t);
89
90 #if __MSVCRT_VERSION__ >= __MSVCR80_DLL
91 /* Variants which do not perform thread locking require non-free
92  * MSVCR80.DLL, or later; they are not supported by MSVCRT.DLL
93  */
94 _CRTIMP __cdecl __MINGW_NOTHROW  int     _getch_nolock (void);
95 _CRTIMP __cdecl __MINGW_NOTHROW  int     _getche_nolock (void);
96 _CRTIMP __cdecl __MINGW_NOTHROW  int     _putch_nolock (int);
97 _CRTIMP __cdecl __MINGW_NOTHROW  wint_t  _putwch_nolock (wchar_t);
98 _CRTIMP __cdecl __MINGW_NOTHROW  int     _ungetch_nolock (int);
99
100 #endif  /* MSVCR80.DLL or later */
101 #endif  /* WinXP, MSVCR70.DLL, or later */
102
103 #ifndef _NO_OLDNAMES
104 /* Early versions of the Microsoft runtime library provided a subset
105  * of the above functions, named without the ugly initial underscore;
106  * these remain supported, and should be used when coding to support
107  * legacy Windows platforms.
108  */
109 _CRTIMP __cdecl __MINGW_NOTHROW  int  getch (void);
110 _CRTIMP __cdecl __MINGW_NOTHROW  int  getche (void);
111 _CRTIMP __cdecl __MINGW_NOTHROW  int  kbhit (void);
112 _CRTIMP __cdecl __MINGW_NOTHROW  int  putch (int);
113 _CRTIMP __cdecl __MINGW_NOTHROW  int  ungetch (int);
114
115 #endif  /* !_NO_OLDNAMES */
116 #endif  /* _CONIO_H */
117
118 #if ! (defined _CONIO_H && defined _WCHAR_H)
119 /* The following are to be exposed either on free-standing inclusion
120  * of <conio.h>, or on selective inclusion by <wchar.h>, but if both
121  * guards are defined, then this is free-standing inclusion, and we
122  * have already declared these by selective inclusion; there is no
123  * need to declare them a second time.
124  */
125 #if _WIN32_WINNT >= _WIN32_WINNT_WINXP || __MSVCRT_VERSION__ >= __MSVCR70_DLL
126 /* Wide character variants of the console I/O functions, in this group,
127  * were first introduced in non-free Microsoft runtimes, from MSVCR70.DLL
128  * onwards; they were not supported by MSVCRT.DLL prior to WinXP.
129  */
130 _CRTIMP __cdecl __MINGW_NOTHROW  wint_t  _getwch (void);
131 _CRTIMP __cdecl __MINGW_NOTHROW  wint_t  _getwche (void);
132 _CRTIMP __cdecl __MINGW_NOTHROW  wint_t  _ungetwch (wint_t);
133
134 #if __MSVCRT_VERSION__ >= __MSVCR80_DLL
135 /* Variants which do not perform thread locking require non-free
136  * MSVCR80.DLL, or later; they are not supported by MSVCRT.DLL
137  */
138 _CRTIMP __cdecl __MINGW_NOTHROW  wint_t  _getwch_nolock (void);
139 _CRTIMP __cdecl __MINGW_NOTHROW  wint_t  _getwche_nolock (void);
140 _CRTIMP __cdecl __MINGW_NOTHROW  wint_t  _ungetwch_nolock (wint_t);
141
142 #endif  /* MSVCR80.DLL or later */
143 #endif  /* WinXP, MSVCR70.DLL, or later */
144 #endif  /* ! (_CONIO_H && _WCHAR_H) */
145
146 _END_C_DECLS
147
148 #endif  /* ! RC_INVOKED */
149 #endif  /* !_CONIO_H: $RCSfile$: end of file */