+2016-02-18 Keith Marshall <keithmarshall@users.sourceforge.net>
+
+ Refactor to make <parts/time.h> and <parts/wchar.h> redundant.
+
+ * include/string.h: Tidy layout.
+ (__STRING_H_SOURCED__): New macro; define it at start; delete at end.
+ (_stricmp, _strnicmp): Include their prototypes, selectively from...
+ * include/strings.h [__STRING_H_SOURCED__]: ...here, reproduce them...
+ * include/parts/strings.h: ...from here; file is obsolete; delete it.
+
+ * include/string.h (_wcscmpi): Define alias.
+ (wcscat, wcschr, wcscmp, wcscoll, wcscpy, wcscspn, wcslen, wcsncat)
+ (wcsncmp, wcsncpy, wcspbrk, wcsrchr, wcsspn, wcsstr, wcstok, wcsxfrm)
+ (_wcsdup, _wcsicmp, _wcsicoll, _wcslwr, _wcsnicmp, _wcsnset, _wcsrev)
+ (_wcsset, _wcsupr, _wcsncoll, _wcsnicoll, _wcserror, __wcserror)
+ (wcscmpi, wcscmpi, wcsdup, wcsicmp, wcsicoll, wcslwr, wcsnicmp)
+ (wcsnset, wcsrev, wcsset, wcsupr): Selectively include prototypes...
+ * include/wchar.h [__STRING_H_SOURCED__]: ...from here; reproduce...
+ * include/parts/wchar.h: ...from here; file is obsolete; delete it.
+
+ * include/strings.h (_STRINGS_H): Do not define it, when...
+ [__STRING_H_SOURCED__]: ...selectively included by <string.h>.
+ * include/wchar.h (_WCHAR_H) [__STRING_H_SOURCED__]: Likewise.
+
2016-02-16 Keith Marshall <keithmarshall@users.sourceforge.net>
Refactor to make <parts/time.h> redundant.
* pseudo-reloc.c: Some minor layout adjustments.
(WIN32_LEAN_AND_MEAN): Define it; we don't need the windows baggage.
[typedef ptrdiff_t]: Do not assume this is gratuitously defined;
- include <stdint.h> to guarantee it.
+ include <stddef.h> to guarantee it.
2016-01-29 Keith Marshall <keithmarshall@users.sourceforge.net>
+++ /dev/null
-/*
- * parts/strings.h
- *
- * Internal header file, declaring function prototypes which we require
- * to be declared in our POSIX.1 conforming <strings.h> header, but for
- * which MSVC expects to find declarations in <string.h>.
- *
- * $Id$
- *
- * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
- * Copyright (C) 2015, 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.
- *
- */
-#if _FAKE_STRINGS_H_SOURCED
-/*
- * Since we expect this part-header to be sourced exclusively by other
- * system headers, (nominally <strings.h>), we don't apply any conventional
- * multiple inclusion guard; rather, we rely on the guard within <strings.h>
- * itself, but allow other headers to fake it for one-shot inclusion...
- */
-# undef _FAKE_STRINGS_H_SOURCED
-
-#elif ! defined _STRINGS_H
-/*
- * ...otherwise, we fail if the <strings.h> guard is not in place.
- */
-# error "Never include <parts/strings.h> directly; use <strings.h> instead"
-#endif
-
-/* These are the MSVCRT.DLL equivalents for POSIX.1's strcasecmp() and
- * strncasecmp() functions, for which we provide in-line implementations
- * in <strings.h> respectively; MSVC expects to find these prototypes in
- * <string.h>, but we also need them in <strings.h>.
- */
-_CRTIMP int __cdecl __MINGW_NOTHROW _stricmp( const char *, const char * );
-_CRTIMP int __cdecl __MINGW_NOTHROW _strnicmp( const char *, const char *, size_t );
-
-/* $RCSfile$: end of file */
+++ /dev/null
-/*
- * parts/wchar.h
- *
- * Internal header file, declaring types and structures which nominally
- * originate from <wchar.h>, but which POSIX, or MSVC, require to be made
- * visible on inclusion of certain other headers, without inclusion of
- * <wchar.h> itself.
- *
- * $Id$
- *
- * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
- * Copyright (C) 2015, 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.
- *
- */
-#if _FAKE_WCHAR_H_SOURCED
-/*
- * Since we expect this part-header to be sourced exclusively by other
- * system headers, (nominally <wchar.h>), we don't apply any conventional
- * multiple inclusion guard; rather, we rely on the guard within <wchar.h>
- * itself, but allow other headers to fake it for one-shot inclusion...
- */
-# undef _FAKE_WCHAR_H_SOURCED
-
-#elif ! defined _WCHAR_H
-/*
- * ...otherwise, we fail if the <wchar.h> guard is not in place.
- */
-# error "Never include <parts/wchar.h> directly; use <wchar.h> instead"
-#endif
-
-#if defined _WCHAR_H || defined __need_wstring_function_prototypes
-/*
- * Wide character versions of the ISO-C standard string functions.
- */
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW wcscat (wchar_t *, const wchar_t *);
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW wcschr (const wchar_t *, wchar_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW wcscmp (const wchar_t *, const wchar_t *);
-_CRTIMP int __cdecl __MINGW_NOTHROW wcscoll (const wchar_t *, const wchar_t *);
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW wcscpy (wchar_t *, const wchar_t *);
-_CRTIMP size_t __cdecl __MINGW_NOTHROW wcscspn (const wchar_t *, const wchar_t *);
-_CRTIMP size_t __cdecl __MINGW_NOTHROW wcslen (const wchar_t *);
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW wcsncat (wchar_t *, const wchar_t *, size_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW wcsncmp (const wchar_t *, const wchar_t *, size_t);
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW wcsncpy (wchar_t *, const wchar_t *, size_t);
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW wcspbrk (const wchar_t *, const wchar_t *);
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW wcsrchr (const wchar_t *, wchar_t);
-_CRTIMP size_t __cdecl __MINGW_NOTHROW wcsspn (const wchar_t *, const wchar_t *);
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW wcsstr (const wchar_t *, const wchar_t *);
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW wcstok (wchar_t *, const wchar_t *);
-_CRTIMP size_t __cdecl __MINGW_NOTHROW wcsxfrm (wchar_t *, const wchar_t *, size_t);
-
-#ifndef __STRICT_ANSI__
-/* UTF-16LE versions of non-ANSI string functions provided by CRTDLL.
- */
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW _wcsdup (const wchar_t *);
-_CRTIMP int __cdecl __MINGW_NOTHROW _wcsicmp (const wchar_t *, const wchar_t *);
-_CRTIMP int __cdecl __MINGW_NOTHROW _wcsicoll (const wchar_t *, const wchar_t *);
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW _wcslwr (wchar_t*);
-_CRTIMP int __cdecl __MINGW_NOTHROW _wcsnicmp (const wchar_t *, const wchar_t *, size_t);
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW _wcsnset (wchar_t *, wchar_t, size_t);
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW _wcsrev (wchar_t *);
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW _wcsset (wchar_t *, wchar_t);
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW _wcsupr (wchar_t *);
-
-#ifdef __MSVCRT__
-_CRTIMP int __cdecl __MINGW_NOTHROW _wcsncoll (const wchar_t *, const wchar_t *, size_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW _wcsnicoll (const wchar_t *, const wchar_t *, size_t);
-
-/* A wide character counterpart to the strerror() API was introduced in
- * MSVCR70.DLL, and subsequently back-ported to MSVCRT.DLL in WinXP.
- */
-#if __MSVCRT_VERSION__ >= __MSVCR70_DLL || NTDDI_VERSION >= NTDDI_WINXP
- /*
- * These are are the wide character counterparts to the strerror()
- * function itself, and the _strerror() function, respectively.
- */
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW _wcserror (int);
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW __wcserror (const wchar_t *);
-
-#endif /* MSVCR70.DLL / WinXP */
-#endif /* __MSVCRT__ */
-
-/* MSVCRT.DLL provides neither _wcscmpi() nor wcscmpi(); the heritage
- * is uncertain, but for the convenience, (and portability), of legacy
- * applications which assume wcscmpi() should be available:
- */
-#define _wcscmpi _wcsicmp
-int __cdecl __MINGW_NOTHROW wcscmpi (const wchar_t *, const wchar_t *);
-
-#if ! defined __NO_INLINE__ && ! defined __have_wcscmpi
-__CRT_ALIAS __JMPSTUB__(( FUNCTION = wcscmpi, REMAPPED = _wcsicmp ))
- int wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2)
- { return _wcsicmp (__ws1, __ws2); }
-
-# define __have_wcscmpi
-#endif
-
-#ifndef _NO_OLDNAMES
- /* Older CRTDLL versions may have provided these alternatively named
- * functions; we continue to support them, via the OLDNAME libraries:
- */
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW wcsdup (const wchar_t*);
-_CRTIMP int __cdecl __MINGW_NOTHROW wcsicmp (const wchar_t*, const wchar_t*);
-_CRTIMP int __cdecl __MINGW_NOTHROW wcsicoll (const wchar_t*, const wchar_t*);
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW wcslwr (wchar_t*);
-_CRTIMP int __cdecl __MINGW_NOTHROW wcsnicmp (const wchar_t*, const wchar_t*, size_t);
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW wcsnset (wchar_t*, wchar_t, size_t);
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW wcsrev (wchar_t*);
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW wcsset (wchar_t*, wchar_t);
-_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW wcsupr (wchar_t*);
-
-#endif /* ! _NO_OLDNAMES */
-
-#endif /* ! __STRICT_ANSI__ */
-#endif /* __need_wstring_function_prototypes */
-
-/* $RCSfile$: end of file */
* $Id$
*
* Written by Rob Savoye <rob@cygnus.com>
- * Copyright (C) 1997-2000, 2002-2004, 2007, 2009, 2015, MinGW.org Project.
+ * Copyright (C) 1997-2000, 2002-2004, 2007, 2009, 2015, 2016,
+ * MinGW.org Project.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
*
*/
#ifndef _STRING_H
+#pragma GCC system_header
#define _STRING_H
/* All MinGW system headers must include this...
_BEGIN_C_DECLS
+#define __STRING_H_SOURCED__
/* Prototypes for the ISO-C Standard library string functions.
*/
-_CRTIMP void * __cdecl __MINGW_NOTHROW memchr (const void*, int, size_t) __MINGW_ATTRIB_PURE;
-_CRTIMP int __cdecl __MINGW_NOTHROW memcmp (const void*, const void*, size_t) __MINGW_ATTRIB_PURE;
-_CRTIMP void * __cdecl __MINGW_NOTHROW memcpy (void*, const void*, size_t);
-_CRTIMP void * __cdecl __MINGW_NOTHROW memmove (void*, const void*, size_t);
-_CRTIMP void * __cdecl __MINGW_NOTHROW memset (void*, int, size_t);
-_CRTIMP char * __cdecl __MINGW_NOTHROW strcat (char*, const char*);
-_CRTIMP char * __cdecl __MINGW_NOTHROW strchr (const char*, int) __MINGW_ATTRIB_PURE;
-_CRTIMP int __cdecl __MINGW_NOTHROW strcmp (const char*, const char*) __MINGW_ATTRIB_PURE;
-_CRTIMP int __cdecl __MINGW_NOTHROW strcoll (const char*, const char*); /* Compare using locale */
-_CRTIMP char * __cdecl __MINGW_NOTHROW strcpy (char*, const char*);
-_CRTIMP size_t __cdecl __MINGW_NOTHROW strcspn (const char*, const char*) __MINGW_ATTRIB_PURE;
-_CRTIMP char * __cdecl __MINGW_NOTHROW strerror (int); /* NOTE: NOT an old name wrapper. */
+_CRTIMP __cdecl __MINGW_NOTHROW void *memchr (const void *, int, size_t) __MINGW_ATTRIB_PURE;
+_CRTIMP __cdecl __MINGW_NOTHROW int memcmp (const void *, const void *, size_t) __MINGW_ATTRIB_PURE;
+_CRTIMP __cdecl __MINGW_NOTHROW void *memcpy (void *, const void *, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW void *memmove (void *, const void *, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW void *memset (void *, int, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW char *strcat (char *, const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW char *strchr (const char *, int) __MINGW_ATTRIB_PURE;
+_CRTIMP __cdecl __MINGW_NOTHROW int strcmp (const char *, const char *) __MINGW_ATTRIB_PURE;
+_CRTIMP __cdecl __MINGW_NOTHROW int strcoll (const char *, const char *); /* Compare using locale */
+_CRTIMP __cdecl __MINGW_NOTHROW char *strcpy (char *, const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW size_t strcspn (const char *, const char *) __MINGW_ATTRIB_PURE;
+_CRTIMP __cdecl __MINGW_NOTHROW char *strerror (int); /* NOTE: NOT an old name wrapper. */
-_CRTIMP size_t __cdecl __MINGW_NOTHROW strlen (const char*) __MINGW_ATTRIB_PURE;
-_CRTIMP char * __cdecl __MINGW_NOTHROW strncat (char*, const char*, size_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW strncmp (const char*, const char*, size_t) __MINGW_ATTRIB_PURE;
-_CRTIMP char * __cdecl __MINGW_NOTHROW strncpy (char*, const char*, size_t);
-_CRTIMP char * __cdecl __MINGW_NOTHROW strpbrk (const char*, const char*) __MINGW_ATTRIB_PURE;
-_CRTIMP char * __cdecl __MINGW_NOTHROW strrchr (const char*, int) __MINGW_ATTRIB_PURE;
-_CRTIMP size_t __cdecl __MINGW_NOTHROW strspn (const char*, const char*) __MINGW_ATTRIB_PURE;
-_CRTIMP char * __cdecl __MINGW_NOTHROW strstr (const char*, const char*) __MINGW_ATTRIB_PURE;
-_CRTIMP char * __cdecl __MINGW_NOTHROW strtok (char*, const char*);
-_CRTIMP size_t __cdecl __MINGW_NOTHROW strxfrm (char*, const char*, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW size_t strlen (const char *) __MINGW_ATTRIB_PURE;
+_CRTIMP __cdecl __MINGW_NOTHROW char *strncat (char *, const char *, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW int strncmp (const char *, const char *, size_t) __MINGW_ATTRIB_PURE;
+_CRTIMP __cdecl __MINGW_NOTHROW char *strncpy (char *, const char *, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW char *strpbrk (const char *, const char *) __MINGW_ATTRIB_PURE;
+_CRTIMP __cdecl __MINGW_NOTHROW char *strrchr (const char *, int) __MINGW_ATTRIB_PURE;
+_CRTIMP __cdecl __MINGW_NOTHROW size_t strspn (const char *, const char *) __MINGW_ATTRIB_PURE;
+_CRTIMP __cdecl __MINGW_NOTHROW char *strstr (const char *, const char *) __MINGW_ATTRIB_PURE;
+_CRTIMP __cdecl __MINGW_NOTHROW char *strtok (char *, const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW size_t strxfrm (char *, const char *, size_t);
#ifndef __STRICT_ANSI__
/*
* Extra non-ANSI functions provided by the CRTDLL library
*/
-_CRTIMP char * __cdecl __MINGW_NOTHROW _strerror (const char *);
-_CRTIMP void * __cdecl __MINGW_NOTHROW _memccpy (void*, const void*, int, size_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW _memicmp (const void*, const void*, size_t);
-_CRTIMP char * __cdecl __MINGW_NOTHROW _strdup (const char*) __MINGW_ATTRIB_MALLOC;
-_CRTIMP int __cdecl __MINGW_NOTHROW _strcmpi (const char*, const char*);
-_CRTIMP int __cdecl __MINGW_NOTHROW _stricoll (const char*, const char*);
-_CRTIMP char * __cdecl __MINGW_NOTHROW _strlwr (char*);
-_CRTIMP char * __cdecl __MINGW_NOTHROW _strnset (char*, int, size_t);
-_CRTIMP char * __cdecl __MINGW_NOTHROW _strrev (char*);
-_CRTIMP char * __cdecl __MINGW_NOTHROW _strset (char*, int);
-_CRTIMP char * __cdecl __MINGW_NOTHROW _strupr (char*);
-_CRTIMP void __cdecl __MINGW_NOTHROW _swab (const char*, char*, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW char *_strerror (const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW void *_memccpy (void *, const void *, int, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW int _memicmp (const void *, const void *, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW char *_strdup (const char *) __MINGW_ATTRIB_MALLOC;
+_CRTIMP __cdecl __MINGW_NOTHROW int _strcmpi (const char *, const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW int _stricoll (const char *, const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW char *_strlwr (char *);
+_CRTIMP __cdecl __MINGW_NOTHROW char *_strnset (char *, int, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW char *_strrev (char *);
+_CRTIMP __cdecl __MINGW_NOTHROW char *_strset (char *, int);
+_CRTIMP __cdecl __MINGW_NOTHROW char *_strupr (char *);
+_CRTIMP __cdecl __MINGW_NOTHROW void _swab (const char *, char *, size_t);
/* MSVC's non-ANSI _stricmp() and _strnicmp() functions must also be
* prototyped here, but we need to share them with <strings.h>, where
- * we declare their POSIX strcasecmp() and strncasecmp() equivalents.
+ * we declare their POSIX strcasecmp() and strncasecmp() equivalents;
+ * get the requisite prototypes by selective <strings.h> inclusion.
*/
-#define _FAKE_STRINGS_H_SOURCED 1
-#include <parts/strings.h>
+#include <strings.h>
# ifdef __MSVCRT__
/* These were not present in the CRTDLL prior to the first release of
* MSVCRT.DLL, but are available in all versions of that library.
*/
-_CRTIMP int __cdecl __MINGW_NOTHROW _strncoll(const char*, const char*, size_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW _strnicoll(const char*, const char*, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW int _strncoll(const char *, const char *, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW int _strnicoll(const char *, const char *, size_t);
# endif
# ifndef _NO_OLDNAMES
/* Non-underscore decorated versions of non-ANSI functions. They live in the
* OLDNAMES libraries, whence they provide a little extra portability.
*/
-_CRTIMP void * __cdecl __MINGW_NOTHROW memccpy (void*, const void*, int, size_t);
-_CRTIMP int __cdecl __MINGW_NOTHROW memicmp (const void*, const void*, size_t);
-_CRTIMP char * __cdecl __MINGW_NOTHROW strdup (const char*) __MINGW_ATTRIB_MALLOC;
-_CRTIMP int __cdecl __MINGW_NOTHROW strcmpi (const char*, const char*);
-_CRTIMP int __cdecl __MINGW_NOTHROW stricmp (const char*, const char*);
-_CRTIMP int __cdecl __MINGW_NOTHROW stricoll (const char*, const char*);
-_CRTIMP char * __cdecl __MINGW_NOTHROW strlwr (char*);
-_CRTIMP int __cdecl __MINGW_NOTHROW strnicmp (const char*, const char*, size_t);
-_CRTIMP char * __cdecl __MINGW_NOTHROW strnset (char*, int, size_t);
-_CRTIMP char * __cdecl __MINGW_NOTHROW strrev (char*);
-_CRTIMP char * __cdecl __MINGW_NOTHROW strset (char*, int);
-_CRTIMP char * __cdecl __MINGW_NOTHROW strupr (char*);
+_CRTIMP __cdecl __MINGW_NOTHROW void *memccpy (void *, const void *, int, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW int memicmp (const void *, const void *, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW char *strdup (const char *) __MINGW_ATTRIB_MALLOC;
+_CRTIMP __cdecl __MINGW_NOTHROW int strcmpi (const char *, const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW int stricmp (const char *, const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW int stricoll (const char *, const char *);
+_CRTIMP __cdecl __MINGW_NOTHROW char *strlwr (char *);
+_CRTIMP __cdecl __MINGW_NOTHROW int strnicmp (const char *, const char *, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW char *strnset (char *, int, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW char *strrev (char *);
+_CRTIMP __cdecl __MINGW_NOTHROW char *strset (char *, int);
+_CRTIMP __cdecl __MINGW_NOTHROW char *strupr (char *);
# ifndef _UWIN
/* FIXME: Do we really care that UWin doesn't support this? We are
* under no obligation to support UWin.
*/
-_CRTIMP void __cdecl __MINGW_NOTHROW swab (const char*, char*, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW void swab (const char *, char *, size_t);
# endif /* ! _UWIN */
# endif /* ! _NO_OLDNAMES */
-# define _FAKE_WCHAR_H_SOURCED 1
-# define __need_wstring_function_prototypes
- /* This inclusion of <wchar.h> string function prototypes is required for
- * MSVC <string.h> compatibility. Strictly conforming ISO-C applications
- * should include <wchar.h>; they should not rely on this anomaly.
- */
-# include <parts/wchar.h>
+/* MSVC also expects <string.h> to declare duplicates of the wchar_t
+ * string functions which are nominally declared in <wchar.h>, (which
+ * is where ISO-C specifies that they should be declared). For the
+ * convenience of applications which rely on this Microsoft anomaly,
+ * inclusion of <wchar.h>, within the current __STRING_H_SOURCED__
+ * scope, will selectively expose the required function prototypes;
+ * however, strictly ISO-C conforming applications should include
+ * <wchar.h> directly; they should not rely on this MSVC specific
+ * anomalous behaviour.
+ */
+#include <wchar.h>
#endif /* ! __STRICT_ANSI__ */
+#undef __STRING_H_SOURCED__
_END_C_DECLS
-#endif /* ! RC_INVOKED */
-#endif /* ! _STRING_H: $RCSfile$: end of file */
+#endif /* ! RC_INVOKED */
+#endif /* !_STRING_H: $RCSfile$: end of file */
* $Id$
*
* Written by Keith Marshall <keithmarshall@users.sourceforge.net>
- * Copyright (C) 2015, MinGW.org Project.
+ * Copyright (C) 2015, 2016, MinGW.org Project.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
*
*/
#ifndef _STRINGS_H
-#define _STRINGS_H
#pragma GCC system_header
-/* All MinGW system headers must include this...
+/* In addition to the POSIX strcasecmp() and strncasecmp() functions,
+ * this header declares the prototypes for the MSVC specific stricmp()
+ * and strincmp() functions, which MSVC expects to find in <string.h>;
+ * thus, we support selective partial inclusion by <string.h>, to make
+ * this pair of function prototypes available as MSVC expects...
+ */
+#ifndef __STRING_H_SOURCED__
+/* ...and we define the _STRINGS_H guard macro only when NOT included
+ * in this partial fashion.
+ */
+#define _STRINGS_H
+
+/* All MinGW system headers must include <_mingw.h>; if we had been
+ * sourced by <string.h>, we could safely assume that it had already
+ * done this, but since that doesn't apply in this case, we must do
+ * it ourselves.
*/
#include <_mingw.h>
int __cdecl __MINGW_NOTHROW strcasecmp( const char *, const char * );
int __cdecl __MINGW_NOTHROW strncasecmp( const char *, const char *, size_t );
-#ifndef __NO_INLINE__
-/* Provide in-line implementations for each of the preceding two functions,
- * effectively aliasing them to their MSVCRT.DLL (non-standard) equivalents,
- * (for which we maintain prototypes in <parts/strings.h>).
+#endif /* ! RC_INVOKED */
+#endif /* !__STRING_H_SOURCED__ */
+
+#if ! (defined _STRINGS_H && defined __NO_INLINE__)
+/* These are the MSVCRT.DLL equivalents for POSIX.1's strcasecmp() and
+ * strncasecmp() functions, for which we provide in-line implementations
+ * in <strings.h> respectively; MSVC expects to find these prototypes in
+ * <string.h>, but we also need them here, in <strings.h>, to facilitate
+ * the in-line function implementations; we declare them here, and allow
+ * <string.h> to include them selectively.
*/
-#include <parts/strings.h>
+_CRTIMP __cdecl __MINGW_NOTHROW int _stricmp( const char *, const char * );
+_CRTIMP __cdecl __MINGW_NOTHROW int _strnicmp( const char *, const char *, size_t );
+#endif /* !(_STRINGS_H && __NO_INLINE__) */
+#if defined _STRINGS_H && ! defined RC_INVOKED
+#ifndef __NO_INLINE__
+/* Provide in-line implementations for strcasecmp(), and strncasecmp(),
+ * effectively aliasing them to the respective MSVCRT.DLL (non-standard)
+ * equivalents, as prototyped above.
+ */
__CRT_ALIAS __JMPSTUB__(( FUNCTION = strcasecmp, REMAPPED = _stricmp ))
int strcasecmp( const char *__s1, const char *__s2 )
{ return _stricmp( __s1, __s2 ); }
int strncasecmp( const char *__s1, const char *__s2, size_t __n )
{ return _strnicmp( __s1, __s2, __n ); }
-#endif /* ! __NO_INLINE__ */
+#endif /* !__NO_INLINE__ */
_END_C_DECLS
-#endif /* ! RC_INVOKED */
-#endif /* ! _STRINGS_H: $RCSfile$: end of file */
+#endif /* _STRINGS_H && ! RC_INVOKED */
+#endif /* !_STRINGS_H: $RCSfile$: end of file */
*
*/
#ifndef _WCHAR_H
-#define _WCHAR_H
#pragma GCC system_header
-/* All the headers include this file.
+/* This header declares prototypes for wchar_t string functions, as are
+ * prescribed by ISO-C, but which MSVC also expects, (in contravention of
+ * ISO-C prescriptions), to find in <string.h>. To accommodate this MSVC
+ * anomaly, we make provision for <string.h> to include a selected subset
+ * of <wchar.h>; thus, we do not immediately define _WCHAR_T...
+ */
+#ifndef __STRING_H_SOURCED__
+/* ...but defer it until we have confirmed that this is NOT inclusion for
+ * only this subset of <wchar.h> declarations.
+ */
+#define _WCHAR_H
+
+/* All MinGW headers are required to include <_mingw.h>; in the case of
+ * selective inclusion by <string.h>, we expect it to have already done
+ * so, but since that doesn't apply here, we must do it ourselves.
*/
#include <_mingw.h>
#ifndef __STRICT_ANSI__
- /* MSDN says that isw* char classifications are in wchar.h and wctype.h.
- * Although the wctype names are ANSI, their exposure in this header is
- * not; nevertheless, we replicate them here, for MSDN conformity.
+ /* MSDN says that isw* char classifications appear in both <wchar.h>,
+ * and in <wctype.h>. Although these <wctype.h> classifications are as
+ * prescribed by ISO-C, their exposure in <wchar.h> is not; nonetheless,
+ * we replicate them here, for MSDN conformity.
*/
# include <wctype.h>
* replacement library function.
*
*/
-
+_BEGIN_C_DECLS
/* Wide character string functions must be specified here, as required
* by the ISO-C Standard; however, MSVC contravenes this standard by also
- * requiring them to appear in <string.h>, so we specify them in a shared
- * <parts/wchar.h> header, which we may include both here and in <string.h>
+ * requiring them to appear in <string.h>. We declare them here, where
+ * they rightfully belong, but we also arrange for them to be available
+ * for selective inclusion by <string.h>; to facilitate this, we must
+ * change the declarative condition...
*/
-#include <parts/wchar.h>
+#endif /* ! RC_INVOKED */
+#endif /* !__STRING_H_SOURCED__ */
+#if ! (defined RC_INVOKED || (defined _WCHAR_H && defined _STRING_H))
+/* ...such that these declarations are exposed when either _WCHAR_H, or
+ * _STRING_H is defined, (but not both, since that would indicate that
+ * these declarations have already been processed).
+ *
+ *
+ * Wide character versions of the ISO-C standard string functions.
+ */
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *wcscat (wchar_t *, const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *wcschr (const wchar_t *, wchar_t);
+_CRTIMP __cdecl __MINGW_NOTHROW int wcscmp (const wchar_t *, const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW int wcscoll (const wchar_t *, const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *wcscpy (wchar_t *, const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW size_t wcscspn (const wchar_t *, const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW size_t wcslen (const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *wcsncat (wchar_t *, const wchar_t *, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW int wcsncmp (const wchar_t *, const wchar_t *, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *wcsncpy (wchar_t *, const wchar_t *, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *wcspbrk (const wchar_t *, const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *wcsrchr (const wchar_t *, wchar_t);
+_CRTIMP __cdecl __MINGW_NOTHROW size_t wcsspn (const wchar_t *, const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *wcsstr (const wchar_t *, const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *wcstok (wchar_t *, const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW size_t wcsxfrm (wchar_t *, const wchar_t *, size_t);
+#ifndef __STRICT_ANSI__
+/* UTF-16LE versions of non-ANSI string functions provided by CRTDLL.DLL
+ */
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *_wcsdup (const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW int _wcsicmp (const wchar_t *, const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW int _wcsicoll (const wchar_t *, const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *_wcslwr (wchar_t*);
+_CRTIMP __cdecl __MINGW_NOTHROW int _wcsnicmp (const wchar_t *, const wchar_t *, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *_wcsnset (wchar_t *, wchar_t, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *_wcsrev (wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *_wcsset (wchar_t *, wchar_t);
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *_wcsupr (wchar_t *);
+
+#ifdef __MSVCRT__
+_CRTIMP __cdecl __MINGW_NOTHROW int _wcsncoll (const wchar_t *, const wchar_t *, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW int _wcsnicoll (const wchar_t *, const wchar_t *, size_t);
+
+/* A wide character counterpart to the strerror() API was introduced in
+ * MSVCR70.DLL, and subsequently back-ported to MSVCRT.DLL in WinXP.
+ */
+#if __MSVCRT_VERSION__ >= __MSVCR70_DLL || NTDDI_VERSION >= NTDDI_WINXP
+ /*
+ * These are are the wide character counterparts to the strerror()
+ * function itself, and the _strerror() function, respectively.
+ */
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *_wcserror (int);
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *__wcserror (const wchar_t *);
+
+#endif /* MSVCR70.DLL || WinXP */
+#endif /* __MSVCRT__ */
+
+/* MSVCRT.DLL provides neither _wcscmpi() nor wcscmpi(); the heritage
+ * is uncertain, but for the convenience, (and portability), of legacy
+ * applications which assume wcscmpi() should be available:
+ */
+#define _wcscmpi _wcsicmp
+int __cdecl __MINGW_NOTHROW wcscmpi (const wchar_t *, const wchar_t *);
+
+#ifndef __NO_INLINE__
+__CRT_ALIAS __JMPSTUB__(( FUNCTION = wcscmpi, REMAPPED = _wcsicmp ))
+ int wcscmpi (const wchar_t *__ws1, const wchar_t *__ws2)
+ { return _wcsicmp (__ws1, __ws2); }
+#endif /* __NO_INLINE__ */
+
+#ifndef _NO_OLDNAMES
+/* Older CRTDLL.DLL versions may have provided these alternatively named
+ * functions; we continue to support them, via the OLDNAME libraries:
+ */
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *wcsdup (const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW int wcsicmp (const wchar_t *, const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW int wcsicoll (const wchar_t *, const wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *wcslwr (wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW int wcsnicmp (const wchar_t *, const wchar_t *, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *wcsnset (wchar_t *, wchar_t, size_t);
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *wcsrev (wchar_t *);
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *wcsset (wchar_t *, wchar_t);
+_CRTIMP __cdecl __MINGW_NOTHROW wchar_t *wcsupr (wchar_t *);
+
+#endif /* !_NO_OLDNAMES */
+#endif /* !__STRICT_ANSI__ */
+
+/* This completes the set of declarations which are to be duplicated by
+ * inclusion of <string.h>; revert the declarative condition, to make it
+ * specific to <wchar.h> alone.
+ */
+#endif /* !(RC_INVOKED || (_WCHAR_H && _STRING_H)) */
+#if defined _WCHAR_H && ! defined RC_INVOKED
/* These are resolved by -lmingwex. Alternatively, they can be resolved by
adding -lmsvcp60 to your command line, which will give you the VC++
#define _WPROCESS_DEFINED
#endif
-#endif /* ! __STRICT_ANSI__ */
+#endif /* ! __STRICT_ANSI__ */
_END_C_DECLS
#undef __WCHAR_H_SOURCED__
-#endif /* ! RC_INVOKED */
-#endif /* ! _WCHAR_H */
+#endif /* _WCHAR_H && ! RC_INVOKED */
+#endif /* !_WCHAR_H: $RCSfile$: end of file */