VirtualBox

source: vbox/trunk/include/iprt/nocrt/string.h@ 104212

Last change on this file since 104212 was 98103, checked in by vboxsync, 23 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 10.9 KB
Line 
1/** @file
2 * IPRT / No-CRT - string.h.
3 */
4
5/*
6 * Copyright (C) 2006-2023 Oracle and/or its affiliates.
7 *
8 * This file is part of VirtualBox base platform packages, as
9 * available from https://www.virtualbox.org.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation, in version 3 of the
14 * License.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <https://www.gnu.org/licenses>.
23 *
24 * The contents of this file may alternatively be used under the terms
25 * of the Common Development and Distribution License Version 1.0
26 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
27 * in the VirtualBox distribution, in which case the provisions of the
28 * CDDL are applicable instead of those of the GPL.
29 *
30 * You may elect to license modified versions of this file under the
31 * terms and conditions of either the GPL or the CDDL or both.
32 *
33 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
34 */
35
36#ifndef IPRT_INCLUDED_nocrt_string_h
37#define IPRT_INCLUDED_nocrt_string_h
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42#include <iprt/types.h>
43
44/* Dummy for now, fix when/if needed. */
45typedef struct RT_NOCRT(mbstate_t)
46{
47 unsigned long whatever;
48} RT_NOCRT(mbstate_t);
49
50
51RT_C_DECLS_BEGIN
52
53void *RT_NOCRT(memchr)(const void *pv, int ch, size_t cb);
54int RT_NOCRT(memcmp)(const void *pv1, const void *pv2, size_t cb);
55void *RT_NOCRT(memcpy)(void *pvDst, const void *pvSrc, size_t cb);
56void *RT_NOCRT(mempcpy)(void *pvDst, const void *pvSrc, size_t cb);
57void *RT_NOCRT(memrchr)(const void *pv, int ch, size_t cb);
58void *RT_NOCRT(memmove)(void *pvDst, const void *pvSrc, size_t cb);
59void *RT_NOCRT(memset)(void *pvDst, int ch, size_t cb);
60
61char *RT_NOCRT(strcat)(char *pszDst, const char *pszSrc);
62char *RT_NOCRT(strncat)(char *pszDst, const char *pszSrc, size_t cch);
63char *RT_NOCRT(strchr)(const char *psz, int ch);
64char *RT_NOCRT(strrchr)(const char *psz, int ch);
65int RT_NOCRT(strcmp)(const char *psz1, const char *psz2);
66int RT_NOCRT(strncmp)(const char *psz1, const char *psz2, size_t cch);
67int RT_NOCRT(stricmp)(const char *psz1, const char *psz2);
68int RT_NOCRT(strnicmp)(const char *psz1, const char *psz2, size_t cch);
69int RT_NOCRT(strcmpcase)(const char *psz1, const char *psz2, size_t cch);
70int RT_NOCRT(strcoll)(const char *psz1, const char *psz2);
71char *RT_NOCRT(strcpy)(char *pszDst, const char *pszSrc);
72char *RT_NOCRT(strncpy)(char *pszDst, const char *pszSrc, size_t cch);
73char *RT_NOCRT(strcat)(char *pszDst, const char *pszSrc);
74char *RT_NOCRT(strncat)(char *pszDst, const char *pszSrc, size_t cch);
75size_t RT_NOCRT(strlen)(const char *psz);
76size_t RT_NOCRT(strnlen)(const char *psz, size_t cch);
77size_t RT_NOCRT(strspn)(const char *psz, const char *pszBreakChars);
78size_t RT_NOCRT(strcspn)(const char *psz, const char *pszBreakChars);
79char *RT_NOCRT(strpbrk)(const char *psz, const char *pszBreakChars);
80char *RT_NOCRT(strstr)(const char *psz, const char *pszSub);
81char *RT_NOCRT(strtok)(char *psz, const char *pszDelim);
82char *RT_NOCRT(strtok_r)(char *psz, const char *pszDelim, char **ppszSave);
83#if 0 /* C++11: */
84char *RT_NOCRT(strtok_s)(char *psz, /*rsize_t*/ size_t cchMax, const char *pszDelim, char **ppszSave);
85#else /* Microsoft: */
86char *RT_NOCRT(strtok_s)(char *psz, const char *pszDelim, char **ppszSave);
87#endif
88size_t RT_NOCRT(strxfrm)(char *pszDst, const char *pszSrc, size_t cch);
89
90size_t RT_NOCRT(wcslen)(const wchar_t *pwsz);
91wchar_t *RT_NOCRT(wcscat)(wchar_t *pwszDst, const wchar_t *pwszSrc);
92wchar_t *RT_NOCRT(wcschr)(const wchar_t *pwsz, wchar_t wc);
93wchar_t *RT_NOCRT(wcscpy)(wchar_t *pwszDst, const wchar_t *pwszSrc);
94int RT_NOCRT(wcsicmp)(const wchar_t *pwsz1, const wchar_t *pwsz2);
95size_t RT_NOCRT(wcstombs)(char *pszDst, const wchar_t *pszSrc, size_t cbDst);
96
97
98/* Underscored versions for MSC compatibility (mesa #defines regular to _regular
99 a lot, which is why we really need these prototypes). */
100void *RT_NOCRT(_memchr)(const void *pv, int ch, size_t cb);
101int RT_NOCRT(_memcmp)(const void *pv1, const void *pv2, size_t cb);
102void *RT_NOCRT(_memcpy)(void *pvDst, const void *pvSrc, size_t cb);
103void *RT_NOCRT(_mempcpy)(void *pvDst, const void *pvSrc, size_t cb);
104void *RT_NOCRT(_memrchr)(const void *pv, int ch, size_t cb);
105void *RT_NOCRT(_memmove)(void *pvDst, const void *pvSrc, size_t cb);
106void *RT_NOCRT(_memset)(void *pvDst, int ch, size_t cb);
107
108char *RT_NOCRT(_strcat)(char *pszDst, const char *pszSrc);
109char *RT_NOCRT(_strncat)(char *pszDst, const char *pszSrc, size_t cch);
110char *RT_NOCRT(_strchr)(const char *psz, int ch);
111char *RT_NOCRT(_strrchr)(const char *psz, int ch);
112int RT_NOCRT(_strcmp)(const char *psz1, const char *psz2);
113int RT_NOCRT(_strncmp)(const char *psz1, const char *psz2, size_t cch);
114int RT_NOCRT(_stricmp)(const char *psz1, const char *psz2);
115int RT_NOCRT(_strnicmp)(const char *psz1, const char *psz2, size_t cch);
116int RT_NOCRT(_strcmpcase)(const char *psz1, const char *psz2, size_t cch);
117int RT_NOCRT(_strcoll)(const char *psz1, const char *psz2);
118char *RT_NOCRT(_strcpy)(char *pszDst, const char *pszSrc);
119char *RT_NOCRT(_strncpy)(char *pszDst, const char *pszSrc, size_t cch);
120char *RT_NOCRT(_strcat)(char *pszDst, const char *pszSrc);
121char *RT_NOCRT(_strncat)(char *pszDst, const char *pszSrc, size_t cch);
122size_t RT_NOCRT(_strlen)(const char *psz);
123size_t RT_NOCRT(_strnlen)(const char *psz, size_t cch);
124size_t RT_NOCRT(_strspn)(const char *psz, const char *pszBreakChars);
125size_t RT_NOCRT(_strcspn)(const char *psz, const char *pszBreakChars);
126char *RT_NOCRT(_strpbrk)(const char *psz, const char *pszBreakChars);
127char *RT_NOCRT(_strstr)(const char *psz, const char *pszSub);
128char *RT_NOCRT(_strtok)(char *psz, const char *pszDelim);
129char *RT_NOCRT(_strtok_r)(char *psz, const char *pszDelim, char **ppszSave);
130#if 0 /* C++11: */
131char *RT_NOCRT(_strtok_s)(char *psz, /*rsize_t*/ size_t cchMax, const char *pszDelim, char **ppszSave);
132#else /* Microsoft: */
133char *RT_NOCRT(_strtok_s)(char *psz, const char *pszDelim, char **ppszSave);
134#endif
135size_t RT_NOCRT(_strxfrm)(char *pszDst, const char *pszSrc, size_t cch);
136
137size_t RT_NOCRT(_wcslen)(const wchar_t *pwsz);
138wchar_t *RT_NOCRT(_wcscat)(wchar_t *pwszDst, const wchar_t *pwszSrc);
139wchar_t *RT_NOCRT(_wcschr)(const wchar_t *pwsz, wchar_t wc);
140wchar_t *RT_NOCRT(_wcscpy)(wchar_t *pwszDst, const wchar_t *pwszSrc);
141int RT_NOCRT(_wcsicmp)(const wchar_t *pwsz1, const wchar_t *pwsz2);
142size_t RT_NOCRT(_wcstombs)(char *pszDst, const wchar_t *pszSrc, size_t cbDst);
143
144
145#if !defined(RT_WITHOUT_NOCRT_WRAPPERS) && !defined(RT_WITHOUT_NOCRT_WRAPPER_ALIASES)
146# define memchr RT_NOCRT(memchr)
147# define memcmp RT_NOCRT(memcmp)
148# define memcpy RT_NOCRT(memcpy)
149# define mempcpy RT_NOCRT(mempcpy)
150# define memrchr RT_NOCRT(memrchr)
151# define memmove RT_NOCRT(memmove)
152# define memset RT_NOCRT(memset)
153
154# define strcat RT_NOCRT(strcat)
155# define strncat RT_NOCRT(strncat)
156# define strchr RT_NOCRT(strchr)
157# define strrchr RT_NOCRT(strrchr)
158# define strcmp RT_NOCRT(strcmp)
159# define strncmp RT_NOCRT(strncmp)
160# define stricmp RT_NOCRT(stricmp)
161# define strnicmp RT_NOCRT(strnicmp)
162# define strcmpcase RT_NOCRT(strcmpcase)
163# define strcoll RT_NOCRT(strcoll)
164# define strcpy RT_NOCRT(strcpy)
165# define strncpy RT_NOCRT(strncpy)
166# define strcat RT_NOCRT(strcat)
167# define strncat RT_NOCRT(strncat)
168# define strlen RT_NOCRT(strlen)
169# define strnlen RT_NOCRT(strnlen)
170# define strspn RT_NOCRT(strspn)
171# define strcspn RT_NOCRT(strcspn)
172# define strpbrk RT_NOCRT(strpbrk)
173# define strstr RT_NOCRT(strstr)
174# define strtok RT_NOCRT(strtok)
175# define strtok_r RT_NOCRT(strtok_r)
176# define strtok_s RT_NOCRT(strtok_s)
177# define strxfrm RT_NOCRT(strxfrm)
178
179# define wcslen RT_NOCRT(wcslen)
180# define wcscat RT_NOCRT(wcscat)
181# define wcschr RT_NOCRT(wcschr)
182# define wcscpy RT_NOCRT(wcscpy)
183# define wcsicmp RT_NOCRT(wcsicmp)
184# define wcstombs RT_NOCRT(wcstombs)
185
186/* Underscored: */
187# define _memchr RT_NOCRT(memchr)
188# define _memcmp RT_NOCRT(memcmp)
189# define _memcpy RT_NOCRT(memcpy)
190# define _mempcpy RT_NOCRT(mempcpy)
191# define _memrchr RT_NOCRT(memrchr)
192# define _memmove RT_NOCRT(memmove)
193# define _memset RT_NOCRT(memset)
194
195# define _strcat RT_NOCRT(strcat)
196# define _strncat RT_NOCRT(strncat)
197# define _strchr RT_NOCRT(strchr)
198# define _strrchr RT_NOCRT(strrchr)
199# define _strcmp RT_NOCRT(strcmp)
200# define _strncmp RT_NOCRT(strncmp)
201# define _stricmp RT_NOCRT(stricmp)
202# define _strnicmp RT_NOCRT(strnicmp)
203# define _strcmpcase RT_NOCRT(strcmpcase)
204# define _strcoll RT_NOCRT(strcoll)
205# define _strcpy RT_NOCRT(strcpy)
206# define _strncpy RT_NOCRT(strncpy)
207# define _strcat RT_NOCRT(strcat)
208# define _strncat RT_NOCRT(strncat)
209# define _strlen RT_NOCRT(strlen)
210# define _strnlen RT_NOCRT(strnlen)
211# define _strspn RT_NOCRT(strspn)
212# define _strcspn RT_NOCRT(strcspn)
213# define _strpbrk RT_NOCRT(strpbrk)
214# define _strstr RT_NOCRT(strstr)
215# define _strtok RT_NOCRT(strtok)
216# define _strtok_r RT_NOCRT(strtok_r)
217# define _strtok_s RT_NOCRT(strtok_s)
218# define _strxfrm RT_NOCRT(strxfrm)
219
220# define _wcslen RT_NOCRT(wcslen)
221# define _wcscat RT_NOCRT(wcscat)
222# define _wcschr RT_NOCRT(wcschr)
223# define _wcscpy RT_NOCRT(wcscpy)
224# define _wcsicmp RT_NOCRT(wcsicmp)
225# define _wcstombs RT_NOCRT(wcstombs)
226#endif
227
228
229#ifdef IPRT_NO_CRT_FOR_3RD_PARTY
230/*
231 * Only for external libraries and such.
232 */
233
234const char *RT_NOCRT(strerror)(int iErrNo);
235char *RT_NOCRT(strdup)(const char *pszSrc);
236
237/* Underscored: */
238const char *RT_NOCRT(_strerror)(int iErrNo);
239char *RT_NOCRT(_strdup)(const char *pszSrc);
240
241# if !defined(RT_WITHOUT_NOCRT_WRAPPERS) && !defined(RT_WITHOUT_NOCRT_WRAPPER_ALIASES)
242# define strerror RT_NOCRT(strerror)
243# define strdup RT_NOCRT(strdup)
244
245/* Underscored: */
246# define _strerror RT_NOCRT(strerror)
247# define _strdup RT_NOCRT(strdup)
248# endif
249
250#endif /* IPRT_NO_CRT_FOR_3RD_PARTY */
251
252RT_C_DECLS_END
253
254#endif /* !IPRT_INCLUDED_nocrt_string_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette