1 /**
2 * @file string.h
3 * Copyright 2012, 2013 MinGW.org project
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24 #ifndef _STRING_H
25 #define _STRING_H
26 #ifndef __CRT_TESTING__
27 #pragma GCC system_header
28 #endif
29 #include <_mingw.h>
30
31 /*
32 * Define size_t, wchar_t and NULL
33 */
34 #define __need_size_t
35 #define __need_wchar_t
36 #define __need_NULL
37
38 #ifndef RC_INVOKED
39 #include <stddef.h>
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
45 /*
46 * Prototypes of the ANSI Standard C library string functions.
47 */
48 _CRTIMP void* __cdecl __MINGW_NOTHROW memchr (const void*, int, size_t) __MINGW_ATTRIB_PURE;
49 _CRTIMP int __cdecl __MINGW_NOTHROW memcmp (const void*, const void*, size_t) __MINGW_ATTRIB_PURE;
50 _CRTIMP void* __cdecl __MINGW_NOTHROW memcpy (void*, const void*, size_t);
51 _CRTIMP void* __cdecl __MINGW_NOTHROW memmove (void*, const void*, size_t);
52 _CRTIMP void* __cdecl __MINGW_NOTHROW memset (void*, int, size_t);
53 _CRTIMP char* __cdecl __MINGW_NOTHROW strcat (char*, const char*);
54 _CRTIMP char* __cdecl __MINGW_NOTHROW strchr (const char*, int) __MINGW_ATTRIB_PURE;
55 _CRTIMP int __cdecl __MINGW_NOTHROW strcmp (const char*, const char*) __MINGW_ATTRIB_PURE;
56 _CRTIMP int __cdecl __MINGW_NOTHROW strcoll (const char*, const char*); /* Compare using locale */
57 _CRTIMP char* __cdecl __MINGW_NOTHROW strcpy (char*, const char*);
58 _CRTIMP size_t __cdecl __MINGW_NOTHROW strcspn (const char*, const char*) __MINGW_ATTRIB_PURE;
59 _CRTIMP char* __cdecl __MINGW_NOTHROW strerror (int); /* NOTE: NOT an old name wrapper. */
60
61 _CRTIMP size_t __cdecl __MINGW_NOTHROW strlen (const char*) __MINGW_ATTRIB_PURE;
62 _CRTIMP char* __cdecl __MINGW_NOTHROW strncat (char*, const char*, size_t);
63 _CRTIMP int __cdecl __MINGW_NOTHROW strncmp (const char*, const char*, size_t) __MINGW_ATTRIB_PURE;
64 _CRTIMP char* __cdecl __MINGW_NOTHROW strncpy (char*, const char*, size_t);
65 _CRTIMP char* __cdecl __MINGW_NOTHROW strpbrk (const char*, const char*) __MINGW_ATTRIB_PURE;
66 _CRTIMP char* __cdecl __MINGW_NOTHROW strrchr (const char*, int) __MINGW_ATTRIB_PURE;
67 _CRTIMP size_t __cdecl __MINGW_NOTHROW strspn (const char*, const char*) __MINGW_ATTRIB_PURE;
68 _CRTIMP char* __cdecl __MINGW_NOTHROW strstr (const char*, const char*) __MINGW_ATTRIB_PURE;
69 _CRTIMP char* __cdecl __MINGW_NOTHROW strtok (char*, const char*);
70 _CRTIMP size_t __cdecl __MINGW_NOTHROW strxfrm (char*, const char*, size_t);
71
72 #ifndef __STRICT_ANSI__
73 /*
74 * Extra non-ANSI functions provided by the runtime library
75 */
76 _CRTIMP char* __cdecl __MINGW_NOTHROW _strerror (const char *);
77 _CRTIMP void* __cdecl __MINGW_NOTHROW _memccpy (void*, const void*, int, size_t);
78 _CRTIMP int __cdecl __MINGW_NOTHROW _memicmp (const void*, const void*, size_t);
79 _CRTIMP char* __cdecl __MINGW_NOTHROW _strdup (const char*) __MINGW_ATTRIB_MALLOC;
80 _CRTIMP int __cdecl __MINGW_NOTHROW _strcmpi (const char*, const char*);
81 _CRTIMP int __cdecl __MINGW_NOTHROW _stricmp (const char*, const char*);
82 _CRTIMP int __cdecl __MINGW_NOTHROW _stricoll (const char*, const char*);
83 _CRTIMP char* __cdecl __MINGW_NOTHROW _strlwr (char*);
84 _CRTIMP int __cdecl __MINGW_NOTHROW _strnicmp (const char*, const char*, size_t);
85 _CRTIMP char* __cdecl __MINGW_NOTHROW _strnset (char*, int, size_t);
86 _CRTIMP char* __cdecl __MINGW_NOTHROW _strrev (char*);
87 _CRTIMP char* __cdecl __MINGW_NOTHROW _strset (char*, int);
88 _CRTIMP char* __cdecl __MINGW_NOTHROW _strupr (char*);
89 _CRTIMP void __cdecl __MINGW_NOTHROW _swab (const char*, char*, size_t);
90
91 _CRTIMP int __cdecl __MINGW_NOTHROW _strncoll(const char*, const char*, size_t);
92 _CRTIMP int __cdecl __MINGW_NOTHROW _strnicoll(const char*, const char*, size_t);
93
94 #ifndef _NO_OLDNAMES
95 /*
96 * Non-underscored versions of non-ANSI functions. They live in liboldnames.a
97 * and provide a little extra portability. Also a few extra UNIX-isms like
98 * strcasecmp.
99 */
100 _CRTIMP void* __cdecl __MINGW_NOTHROW memccpy (void*, const void*, int, size_t);
101 _CRTIMP int __cdecl __MINGW_NOTHROW memicmp (const void*, const void*, size_t);
102 _CRTIMP char* __cdecl __MINGW_NOTHROW strdup (const char*) __MINGW_ATTRIB_MALLOC;
103 _CRTIMP int __cdecl __MINGW_NOTHROW strcmpi (const char*, const char*);
104 _CRTIMP int __cdecl __MINGW_NOTHROW stricmp (const char*, const char*);
105 int __cdecl __MINGW_NOTHROW strcasecmp (const char*, const char *);
106
107 #ifndef __NO_INLINE__
108 __CRT_INLINE int __cdecl __MINGW_NOTHROW
strcasecmp(const char * __sz1,const char * __sz2)109 strcasecmp (const char * __sz1, const char * __sz2)
110 {return _stricmp (__sz1, __sz2);}
111 #else
112 #define strcasecmp _stricmp
113 #endif
114
115 _CRTIMP int __cdecl __MINGW_NOTHROW stricoll (const char*, const char*);
116 _CRTIMP char* __cdecl __MINGW_NOTHROW strlwr (char*);
117 _CRTIMP int __cdecl __MINGW_NOTHROW strnicmp (const char*, const char*, size_t);
118 int __cdecl __MINGW_NOTHROW strncasecmp (const char *, const char *, size_t);
119
120 #ifndef __NO_INLINE__
121 __CRT_INLINE int __cdecl __MINGW_NOTHROW
strncasecmp(const char * __sz1,const char * __sz2,size_t __sizeMaxCompare)122 strncasecmp (const char * __sz1, const char * __sz2, size_t __sizeMaxCompare)
123 {return _strnicmp (__sz1, __sz2, __sizeMaxCompare);}
124 #else
125 #define strncasecmp _strnicmp
126 #endif
127
128 _CRTIMP char* __cdecl __MINGW_NOTHROW strnset (char*, int, size_t);
129 _CRTIMP char* __cdecl __MINGW_NOTHROW strrev (char*);
130 _CRTIMP char* __cdecl __MINGW_NOTHROW strset (char*, int);
131 _CRTIMP char* __cdecl __MINGW_NOTHROW strupr (char*);
132 _CRTIMP void __cdecl __MINGW_NOTHROW swab (const char*, char*, size_t);
133 #endif /* _NO_OLDNAMES */
134
135 #endif /* Not __STRICT_ANSI__ */
136
137 #ifndef _WSTRING_DEFINED
138 /*
139 * Unicode versions of the standard calls.
140 * Also in wchar.h, where they belong according to ISO standard.
141 */
142 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcscat (wchar_t*, const wchar_t*);
143 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcschr (const wchar_t*, wchar_t);
144 _CRTIMP int __cdecl __MINGW_NOTHROW wcscmp (const wchar_t*, const wchar_t*);
145 _CRTIMP int __cdecl __MINGW_NOTHROW wcscoll (const wchar_t*, const wchar_t*);
146 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcscpy (wchar_t*, const wchar_t*);
147 _CRTIMP size_t __cdecl __MINGW_NOTHROW wcscspn (const wchar_t*, const wchar_t*);
148 /* Note: _wcserror requires __MSVCRT_VERSION__ >= 0x0700. */
149 _CRTIMP size_t __cdecl __MINGW_NOTHROW wcslen (const wchar_t*);
150 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsncat (wchar_t*, const wchar_t*, size_t);
151 _CRTIMP int __cdecl __MINGW_NOTHROW wcsncmp(const wchar_t*, const wchar_t*, size_t);
152 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsncpy(wchar_t*, const wchar_t*, size_t);
153 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcspbrk(const wchar_t*, const wchar_t*);
154 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsrchr(const wchar_t*, wchar_t);
155 _CRTIMP size_t __cdecl __MINGW_NOTHROW wcsspn(const wchar_t*, const wchar_t*);
156 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsstr(const wchar_t*, const wchar_t*);
157 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcstok(wchar_t*, const wchar_t*);
158 _CRTIMP size_t __cdecl __MINGW_NOTHROW wcsxfrm(wchar_t*, const wchar_t*, size_t);
159
160 #ifndef __STRICT_ANSI__
161
162 /* NOTE: _wcscmpi not provided by MSVCRT.DLL, this define is for portability */
163 #define _wcscmpi _wcsicmp
164
165 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsdup (const wchar_t*);
166 _CRTIMP int __cdecl __MINGW_NOTHROW _wcsicmp (const wchar_t*, const wchar_t*);
167 _CRTIMP int __cdecl __MINGW_NOTHROW _wcsicoll (const wchar_t*, const wchar_t*);
168 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcslwr (wchar_t*);
169 _CRTIMP int __cdecl __MINGW_NOTHROW _wcsnicmp (const wchar_t*, const wchar_t*, size_t);
170 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsnset (wchar_t*, wchar_t, size_t);
171 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsrev (wchar_t*);
172 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsset (wchar_t*, wchar_t);
173 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsupr (wchar_t*);
174
175 _CRTIMP int __cdecl __MINGW_NOTHROW _wcsncoll(const wchar_t*, const wchar_t*, size_t);
176 _CRTIMP int __cdecl __MINGW_NOTHROW _wcsnicoll(const wchar_t*, const wchar_t*, size_t);
177 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcserror(int);
178 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW __wcserror(const wchar_t*);
179
180 #ifndef _NO_OLDNAMES
181 /* NOTE: There is no _wcscmpi, but this is for compatibility. */
182 int __cdecl __MINGW_NOTHROW wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2);
183
184 #ifndef __NO_INLINE__
185 __CRT_INLINE int __cdecl __MINGW_NOTHROW
wcscmpi(const wchar_t * __ws1,const wchar_t * __ws2)186 wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2)
187 {return _wcsicmp (__ws1, __ws2);}
188 #endif
189
190 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsdup (const wchar_t*);
191 _CRTIMP int __cdecl __MINGW_NOTHROW wcsicmp (const wchar_t*, const wchar_t*);
192 _CRTIMP int __cdecl __MINGW_NOTHROW wcsicoll (const wchar_t*, const wchar_t*);
193 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcslwr (wchar_t*);
194 _CRTIMP int __cdecl __MINGW_NOTHROW wcsnicmp (const wchar_t*, const wchar_t*, size_t);
195 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsnset (wchar_t*, wchar_t, size_t);
196 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsrev (wchar_t*);
197 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsset (wchar_t*, wchar_t);
198 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsupr (wchar_t*);
199 #endif /* Not _NO_OLDNAMES */
200
201 #endif /* Not strict ANSI */
202
203 #define _WSTRING_DEFINED
204 #endif /* _WSTRING_DEFINED */
205
206 #ifdef __cplusplus
207 }
208 #endif
209
210 #endif /* Not RC_INVOKED */
211
212 #endif /* Not _STRING_H */
213