source: Daodan/MinGW/include/strings.h@ 1141

Last change on this file since 1141 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 4.0 KB
Line 
1/*
2 * strings.h
3 *
4 * API declarations for POSIX.1-2008 string functions supported by MinGW.
5 *
6 * $Id: strings.h,v 9d7609141132 2016/02/18 21:12:32 keithmarshall $
7 *
8 * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
9 * Copyright (C) 2015, 2016, MinGW.org Project.
10 *
11 *
12 * Permission is hereby granted, free of charge, to any person obtaining a
13 * copy of this software and associated documentation files (the "Software"),
14 * to deal in the Software without restriction, including without limitation
15 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 * and/or sell copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following conditions:
18 *
19 * The above copyright notice, this permission notice, and the following
20 * disclaimer shall be included in all copies or substantial portions of
21 * the Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER
29 * DEALINGS IN THE SOFTWARE.
30 *
31 */
32#ifndef _STRINGS_H
33#pragma GCC system_header
34
35/* In addition to the POSIX strcasecmp() and strncasecmp() functions,
36 * this header declares the prototypes for the MSVC specific stricmp()
37 * and strincmp() functions, which MSVC expects to find in <string.h>;
38 * thus, we support selective partial inclusion by <string.h>, to make
39 * this pair of function prototypes available as MSVC expects...
40 */
41#ifndef __STRING_H_SOURCED__
42/* ...and we define the _STRINGS_H guard macro only when NOT included
43 * in this partial fashion.
44 */
45#define _STRINGS_H
46
47/* All MinGW system headers must include <_mingw.h>; if we had been
48 * sourced by <string.h>, we could safely assume that it had already
49 * done this, but since that doesn't apply in this case, we must do
50 * it ourselves.
51 */
52#include <_mingw.h>
53
54#ifndef RC_INVOKED
55/* POSIX.1-2008 requires this header to expose the typedef for size_t; to
56 * ensure consistency, we import this from GCC's own <stddef.h> header.
57 */
58#define __need_size_t
59#include <stddef.h>
60
61_BEGIN_C_DECLS
62
63int __cdecl __MINGW_NOTHROW strcasecmp( const char *, const char * );
64int __cdecl __MINGW_NOTHROW strncasecmp( const char *, const char *, size_t );
65
66#endif /* ! RC_INVOKED */
67#endif /* !__STRING_H_SOURCED__ */
68
69#if ! (defined _STRINGS_H && defined __NO_INLINE__)
70/* These are the MSVCRT.DLL equivalents for POSIX.1's strcasecmp() and
71 * strncasecmp() functions, for which we provide in-line implementations
72 * in <strings.h> respectively; MSVC expects to find these prototypes in
73 * <string.h>, but we also need them here, in <strings.h>, to facilitate
74 * the in-line function implementations; we declare them here, and allow
75 * <string.h> to include them selectively.
76 */
77_CRTIMP __cdecl __MINGW_NOTHROW int _stricmp( const char *, const char * );
78_CRTIMP __cdecl __MINGW_NOTHROW int _strnicmp( const char *, const char *, size_t );
79#endif /* !(_STRINGS_H && __NO_INLINE__) */
80
81#if defined _STRINGS_H && ! defined RC_INVOKED
82#ifndef __NO_INLINE__
83/* Provide in-line implementations for strcasecmp(), and strncasecmp(),
84 * effectively aliasing them to the respective MSVCRT.DLL (non-standard)
85 * equivalents, as prototyped above.
86 */
87__CRT_ALIAS __JMPSTUB__(( FUNCTION = strcasecmp, REMAPPED = _stricmp ))
88 int strcasecmp( const char *__s1, const char *__s2 )
89 { return _stricmp( __s1, __s2 ); }
90
91__CRT_ALIAS __JMPSTUB__(( FUNCTION = strncasecmp, REMAPPED = _strnicmp ))
92 int strncasecmp( const char *__s1, const char *__s2, size_t __n )
93 { return _strnicmp( __s1, __s2, __n ); }
94
95#endif /* !__NO_INLINE__ */
96
97_END_C_DECLS
98
99#endif /* _STRINGS_H && ! RC_INVOKED */
100#endif /* !_STRINGS_H: $RCSfile: strings.h,v $: end of file */
Note: See TracBrowser for help on using the repository browser.