From: Keith Marshall Date: Sun, 21 Oct 2018 15:39:35 +0000 (+0100) Subject: Update and header files. X-Git-Tag: wsl-5.2-release~17 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=e56d5bbf33383f58f1ef17a53e7cbb2b8945da38;p=mingw%2Fmingw-org-wsl.git Update and header files. --- diff --git a/mingwrt/ChangeLog b/mingwrt/ChangeLog index 899e62b..5562610 100644 --- a/mingwrt/ChangeLog +++ b/mingwrt/ChangeLog @@ -1,3 +1,25 @@ +2018-10-21 Keith Marshall + + Update and header files. + + * include/conio.h: Tidy layout; assert copyright. + [_CONIO_H_]: Rename multiple inclusion guard macro, to conform to... + [_CONIO_H]: ...this preferred convention; do not define when... + [__WCHAR_H_SOURCED__]: ...this selective inclusion condition applies. + [__need_wint_t, __need_wchar_t]: Define them; include ... + (wint_t, wchar_t): ...for these corresponding data type definitions. + [_WIN32_WINNT >= WINXP || __MSVCRT_VERSION__ >= __MSVCR70_DLL] + (_getwch, _getwche, _ungetwch, _putwch): Declare function prototypes. + [__MSVCRT_VERSION__>=__MSVCR80_DLL] (_getch_nolock, _getche_nolock) + (_ungetch_nolock, _putch_nolock, _getwch_nolock, _getwche_nolock) + (_ungetwch_nolock, _putwch_nolock): Likewise. + [_BEGIN_C_DECLS, _END_C_DECLS]: Use them. + + * include/wchar.h: Selectively include , for... + (_getwch, _getwche, _ungetwch): ...these function prototypes, and... + [__MSVCRT_VERSION__>=__MSCVCR80_DLL] (_getwch_nolock) + (_getwche_nolock, _ungetwch_nolock): ...these. + 2018-10-18 Keith Marshall Map compile-time constant references for POSIX clocks. diff --git a/mingwrt/include/conio.h b/mingwrt/include/conio.h index 8a821cb..7e27910 100644 --- a/mingwrt/include/conio.h +++ b/mingwrt/include/conio.h @@ -1,53 +1,149 @@ /* * conio.h - * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. * - * Low level console I/O functions. Pretty please try to use the ANSI + * Low level console I/O functions. Pretty please try to use the ANSI * standard ones if you are writing new code. * + * $Id$ + * + * Written by Colin Peters + * Copyright (C) 1997, 1999-2001, 2003, 2004, 2007, 2018, MinGW.org Project. + * + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice, this permission notice, and the following + * disclaimer shall be included in all copies or substantial portions of + * the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER + * DEALINGS IN THE SOFTWARE. + * */ +#ifndef _CONIO_H +#pragma GCC system_header -#ifndef _CONIO_H_ -#define _CONIO_H_ +/* When including , some of the definitions and declarations + * which are nominally provided in must be duplicated. Rather + * than require duplicated maintenance effort, we provide for partial + * inclusion of by ; only when not included in + * this partial fashion... + */ +#ifndef __WCHAR_H_SOURCED__ + /* ...which is exclusive to , do we assert the multiple + * inclusion guard for itself. + */ +#define _CONIO_H -/* All the headers include this file. */ +/* All MinGW.org headers are expected to include <_mingw.h>; when + * selectively included by , that responsibility has already + * been addressed, but for free-standing inclusion we do so now. + */ #include <_mingw.h> +#endif /* !__WCHAR_H_SOURCED__ */ #ifndef RC_INVOKED +/* There is nothing here which is useful to the resource compiler; + * for any other form of compilation, and regardless of the scope in + * which is included, we need definitions for wchar_t, and + * wint_t; get them by selective inclusion of . + */ +#define __need_wint_t +#define __need_wchar_t +#include -#ifdef __cplusplus -extern "C" { -#endif +_BEGIN_C_DECLS -_CRTIMP char* __cdecl __MINGW_NOTHROW _cgets (char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _cprintf (const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW _cputs (const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _cscanf (char*, ...); +#ifdef _CONIO_H +/* The following declarations are to be exposed only on free-standing + * inclusion of + */ +_CRTIMP __cdecl __MINGW_NOTHROW char *_cgets (char*); +_CRTIMP __cdecl __MINGW_NOTHROW int _cprintf (const char*, ...); +_CRTIMP __cdecl __MINGW_NOTHROW int _cputs (const char*); +_CRTIMP __cdecl __MINGW_NOTHROW int _cscanf (char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW _getch (void); -_CRTIMP int __cdecl __MINGW_NOTHROW _getche (void); -_CRTIMP int __cdecl __MINGW_NOTHROW _kbhit (void); -_CRTIMP int __cdecl __MINGW_NOTHROW _putch (int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ungetch (int); +_CRTIMP __cdecl __MINGW_NOTHROW int _getch (void); +_CRTIMP __cdecl __MINGW_NOTHROW int _getche (void); +_CRTIMP __cdecl __MINGW_NOTHROW int _kbhit (void); +_CRTIMP __cdecl __MINGW_NOTHROW int _putch (int); +_CRTIMP __cdecl __MINGW_NOTHROW int _ungetch (int); +#if _WIN32_WINNT >= _WIN32_WINNT_WINXP || __MSVCRT_VERSION__ >= __MSVCR70_DLL +/* Wide character variants of the console I/O functions were first + * introduced in non-free MSVCR70.DLL, and subsequently supported by + * MSVCRT.DLL from WinXP onwards. Some are declared in in + * addition to ; the following are exclusive to + */ +_CRTIMP __cdecl __MINGW_NOTHROW wint_t _putwch (wchar_t); -#ifndef _NO_OLDNAMES +#if __MSVCRT_VERSION__ >= __MSVCR80_DLL +/* Variants which do not perform thread locking require non-free + * MSVCR80.DLL, or later; they are not supported by MSVCRT.DLL + */ +_CRTIMP __cdecl __MINGW_NOTHROW int _getch_nolock (void); +_CRTIMP __cdecl __MINGW_NOTHROW int _getche_nolock (void); +_CRTIMP __cdecl __MINGW_NOTHROW int _putch_nolock (int); +_CRTIMP __cdecl __MINGW_NOTHROW wint_t _putwch_nolock (wchar_t); +_CRTIMP __cdecl __MINGW_NOTHROW int _ungetch_nolock (int); -_CRTIMP int __cdecl __MINGW_NOTHROW getch (void); -_CRTIMP int __cdecl __MINGW_NOTHROW getche (void); -_CRTIMP int __cdecl __MINGW_NOTHROW kbhit (void); -_CRTIMP int __cdecl __MINGW_NOTHROW putch (int); -_CRTIMP int __cdecl __MINGW_NOTHROW ungetch (int); +#endif /* MSVCR80.DLL or later */ +#endif /* WinXP, MSVCR70.DLL, or later */ + +#ifndef _NO_OLDNAMES +/* Early versions of the Microsoft runtime library provided a subset + * of the above functions, named without the ugly initial underscore; + * these remain supported, and should be used when coding to support + * legacy Windows platforms. + */ +_CRTIMP __cdecl __MINGW_NOTHROW int getch (void); +_CRTIMP __cdecl __MINGW_NOTHROW int getche (void); +_CRTIMP __cdecl __MINGW_NOTHROW int kbhit (void); +_CRTIMP __cdecl __MINGW_NOTHROW int putch (int); +_CRTIMP __cdecl __MINGW_NOTHROW int ungetch (int); -#endif /* Not _NO_OLDNAMES */ +#endif /* !_NO_OLDNAMES */ +#endif /* _CONIO_H */ +#if ! (defined _CONIO_H && defined _WCHAR_H) +/* The following are to be exposed either on free-standing inclusion + * of , or on selective inclusion by , but if both + * guards are defined, then this is free-standing inclusion, and we + * have already declared these by selective inclusion; there is no + * need to declare them a second time. + */ +#if _WIN32_WINNT >= _WIN32_WINNT_WINXP || __MSVCRT_VERSION__ >= __MSVCR70_DLL +/* Wide character variants of the console I/O functions, in this group, + * were first introduced in non-free Microsoft runtimes, from MSVCR70.DLL + * onwards; they were not supported by MSVCRT.DLL prior to WinXP. + */ +_CRTIMP __cdecl __MINGW_NOTHROW wint_t _getwch (void); +_CRTIMP __cdecl __MINGW_NOTHROW wint_t _getwche (void); +_CRTIMP __cdecl __MINGW_NOTHROW wint_t _ungetwch (wint_t); + +#if __MSVCRT_VERSION__ >= __MSVCR80_DLL +/* Variants which do not perform thread locking require non-free + * MSVCR80.DLL, or later; they are not supported by MSVCRT.DLL + */ +_CRTIMP __cdecl __MINGW_NOTHROW wint_t _getwch_nolock (void); +_CRTIMP __cdecl __MINGW_NOTHROW wint_t _getwche_nolock (void); +_CRTIMP __cdecl __MINGW_NOTHROW wint_t _ungetwch_nolock (wint_t); -#ifdef __cplusplus -} -#endif +#endif /* MSVCR80.DLL or later */ +#endif /* WinXP, MSVCR70.DLL, or later */ +#endif /* ! (_CONIO_H && _WCHAR_H) */ -#endif /* Not RC_INVOKED */ +_END_C_DECLS -#endif /* Not _CONIO_H_ */ +#endif /* ! RC_INVOKED */ +#endif /* !_CONIO_H: $RCSfile$: end of file */ diff --git a/mingwrt/include/wchar.h b/mingwrt/include/wchar.h index a10fb20..7ea78a7 100644 --- a/mingwrt/include/wchar.h +++ b/mingwrt/include/wchar.h @@ -8,7 +8,7 @@ * * Unattributed original source. * Adapted by Rob Savoye - * Copyright (C) 1997, 1999-2009, 2011, 2015, 2016, MinGW.org Project. + * Copyright (C) 1997, 1999-2009, 2011, 2015, 2016, 2018, MinGW.org Project. * * * Permission is hereby granted, free of charge, to any person obtaining a @@ -232,6 +232,23 @@ * int _wstat64i32 (const wchar_t *, struct _stat64i32 *); * * + * from... + */ +#include "conio.h" +/* ...we obtain, depending on active MSVCRT.DLL version conformity, + * or non-free run-time version selection, an appropriate subset of: + * + * wint_t _getwch (void); + * wint_t _getwche (void); + * wint_t _ungetwch (wint_t); + * + * ...and for non-free run-times from MSVCR80.DLL onwards only: + * + * wint_t _getwch_nolock (void); + * wint_t _getwche_nolock (void); + * wint_t _ungetwch_nolock (wint_t); + * + * * and from... */ #include "io.h"