This commit was manufactured by cvs2svn to create branch 'captive'.
[reactos.git] / include / crtdll / string.h
1 /*
2  * string.h
3  *
4  * Definitions for memory and string functions.
5  *
6  * This file is part of the Mingw32 package.
7  *
8  * Contributors:
9  *  Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
10  *
11  *  THIS SOFTWARE IS NOT COPYRIGHTED
12  *
13  *  This source code is offered for use in the public domain. You may
14  *  use, modify or distribute it freely.
15  *
16  *  This code is distributed in the hope that it will be useful but
17  *  WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18  *  DISCLAMED. This includes but is not limited to warranties of
19  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  * $Revision$
22  * $Author$
23  * $Date$
24  *
25  */
26 /* Appropriated for Reactos Crtdll by Ariadne */
27 /* changed prototype for _strerror */
28 /* moved prototype for swab from string.h to stdlib.h */
29
30
31 #ifndef _STRING_H_
32 #define _STRING_H_
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 /*
39  * Define size_t, wchar_t and NULL
40  */
41 #define __need_size_t
42 #define __need_wchar_t
43 #define __need_NULL
44 #include <crtdll/stddef.h>
45
46 char * ___strtok; // removed extern specifier 02-06-98, BD
47
48 /*
49  * Prototypes of the ANSI Standard C library string functions.
50  */
51 void*   memchr (const void* p, int cSearchFor, size_t sizeSearch);
52 int     memcmp (const void* p1, const void* p2, size_t sizeSearch);
53 void*   memcpy (void* pCopyTo, const void* pSource, size_t sizeSource);
54 void*   memmove (void* pMoveTo, const void* pSource, size_t sizeSource);
55 void*   memset (void* p, int cFill, size_t sizeRepeatCount);
56 char*   strcat (char* szAddTo, const char* szAdd);
57 char*   strchr (const char* szSearch, int cFor);
58 int     strcmp (const char* sz1, const char* sz2);
59 int     strcoll (const char* sz1, const char* sz2); /* Compare using locale */
60 char*   strcpy (char* szCopyTo, const char* szSource);
61 size_t  strcspn (const char* szGetPrefix, const char* szNotIncluding);
62 char*   strerror (int nError); /* NOTE: NOT an old name wrapper. */
63 char *  _strerror(const char *s);
64 size_t  strlen (const char* sz);
65 size_t  strnlen (const char* sz, size_t count); // not exported
66 char*   strncat (char* szAddTo, const char* szAdd, size_t sizeMaxAdd);
67 int     strncmp (const char* sz1, const char* sz2, size_t sizeMaxCompare);
68 char*   strncpy (char* szCopyTo, const char* szSource, size_t sizeMaxCopy);
69 char*   strpbrk (const char* szSearch, const char* szAnyOf);
70 char*   strrchr (const char* szSearch, int cFor);
71 size_t  strspn (const char* szGetPrefix, const char *szIncluding);
72 char*   strstr (const char* szSearch, const char *szFor);
73 char*   strtok (char* szTokenize, const char* szDelimiters);
74 size_t  strxfrm (char* szTransformed, const char *szSource,
75                  size_t sizeTransform);
76
77 #ifndef __STRICT_ANSI__
78 /*
79  * Extra non-ANSI functions provided by the CRTDLL library
80  */
81 void*   _memccpy (void* pCopyTo, const void* pSource, int cTerminator,
82                   size_t sizeMaxCopy);
83 int     _memicmp (const void* p1, const void* p2, size_t sizeSearch);
84 char*   _strdup (const char *szDuplicate);
85 int     _strcmpi (const char* sz1, const char* sz2);
86 int     _stricmp (const char* sz1, const char* sz2);
87 int     _stricoll (const char* sz1, const char* sz2);
88 char*   _strlwr (char* szToConvert);
89 int     _strnicmp (const char* sz1, const char* sz2,
90                    size_t sizeMaxCompare);
91 char*   _strnset (char* szToFill, int cFill, size_t sizeMaxFill);
92 char*   _strrev (char* szToReverse);
93 char*   _strset (char* szToFill, int cFill);
94 char*   _strupr (char* szToConvert);
95
96
97 #endif  /* Not __STRICT_ANSI__ */
98
99
100 /*
101  * Unicode versions of the standard calls.
102  */
103 wchar_t* wcscat (wchar_t* wsAddTo, const wchar_t* wsAdd);
104 wchar_t* wcschr (const wchar_t* wsSearch, wchar_t wcFor);
105 int     wcscmp (const wchar_t* ws1, const wchar_t* ws2);
106 int     wcscoll (const wchar_t* ws1, const wchar_t* ws2);
107 wchar_t* wcscpy (wchar_t* wsCopyTo, const wchar_t* wsSource);
108 size_t  wcscspn (const wchar_t* wsGetPrefix, const wchar_t* wsNotIncluding);
109 /* Note: No wcserror in CRTDLL. */
110 size_t  wcslen (const wchar_t* ws);
111 wchar_t* wcsncat (wchar_t* wsAddTo, const wchar_t* wsAdd, size_t sizeMaxAdd);
112 int     wcsncmp(const wchar_t* ws1, const wchar_t* ws2, size_t sizeMaxCompare);
113 wchar_t* wcsncpy(wchar_t* wsCopyTo, const wchar_t* wsSource,
114                  size_t sizeMaxCopy);
115 wchar_t* wcspbrk(const wchar_t* wsSearch, const wchar_t* wsAnyOf);
116 wchar_t* wcsrchr(const wchar_t* wsSearch, wchar_t wcFor);
117 size_t  wcsspn(const wchar_t* wsGetPrefix, const wchar_t* wsIncluding);
118 wchar_t* wcsstr(const wchar_t* wsSearch, const wchar_t* wsFor);
119 wchar_t* wcstok(wchar_t* wsTokenize, const wchar_t* wsDelimiters);
120 size_t  wcsxfrm(wchar_t* wsTransformed, const wchar_t *wsSource,
121                 size_t sizeTransform);
122
123
124 #ifndef __STRICT_ANSI__
125 /*
126  * Unicode versions of non-ANSI functions provided by CRTDLL.
127  */
128
129 /* NOTE: _wcscmpi not provided by CRTDLL, this define is for portability */
130 #define         _wcscmpi        _wcsicmp
131
132 wchar_t* _wcsdup (const wchar_t* wsToDuplicate);
133 int     _wcsicmp (const wchar_t* ws1, const wchar_t* ws2);
134 int     _wcsicoll (const wchar_t* ws1, const wchar_t* ws2);
135 wchar_t* _wcslwr (wchar_t* wsToConvert);
136 int     _wcsnicmp (const wchar_t* ws1, const wchar_t* ws2,
137                    size_t sizeMaxCompare);
138 wchar_t* _wcsnset (wchar_t* wsToFill, wchar_t wcFill, size_t sizeMaxFill);
139 wchar_t* _wcsrev (wchar_t* wsToReverse);
140 wchar_t* _wcsset (wchar_t* wsToFill, wchar_t wcToFill);
141 wchar_t* _wcsupr (wchar_t* wsToConvert);
142
143 #endif  /* Not __STRICT_ANSI__ */
144
145
146 #ifndef __STRICT_ANSI__
147 #ifndef _NO_OLDNAMES
148
149 /*
150  * Non-underscored versions of non-ANSI functions. They live in liboldnames.a
151  * and provide a little extra portability. Also a few extra UNIX-isms like
152  * strcasecmp.
153  */
154
155 void*   memccpy (void* pCopyTo, const void* pSource, int cTerminator,
156                  size_t sizeMaxCopy);
157 int     memicmp (const void* p1, const void* p2, size_t sizeSearch);
158 #define strdup(szDuplicate)     _strdup(szDuplicate)
159 int     strcmpi (const char* sz1, const char* sz2);
160 int     stricmp (const char* sz1, const char* sz2);
161 int     strcasecmp (const char* sz1, const char* sz2);
162 int     stricoll (const char* sz1, const char* sz2);
163 char*   strlwr (char* szToConvert);
164 int     strnicmp (const char* sz1, const char* sz2, size_t sizeMaxCompare);
165 int     strncasecmp (const char* sz1, const char* sz2, size_t sizeMaxCompare);
166 char*   strnset (char* szToFill, int cFill, size_t sizeMaxFill);
167 char*   strrev (char* szToReverse);
168 char*   strset (char* szToFill, int cFill);
169 char*   strupr (char* szToConvert);
170
171
172 /* NOTE: There is no _wcscmpi, but this is for compatibility. */
173 int     wcscmpi (const wchar_t* ws1, const wchar_t* ws2);
174 wchar_t* wcsdup (const wchar_t* wsToDuplicate);
175 int     wcsicmp (const wchar_t* ws1, const wchar_t* ws2);
176 int     wcsicoll (const wchar_t* ws1, const wchar_t* ws2);
177 wchar_t* wcslwr (wchar_t* wsToConvert);
178 int     wcsnicmp (const wchar_t* ws1, const wchar_t* ws2,
179                   size_t sizeMaxCompare);
180 wchar_t* wcsnset (wchar_t* wsToFill, wchar_t wcFill, size_t sizeMaxFill);
181 wchar_t* wcsrev (wchar_t* wsToReverse);
182 wchar_t* wcsset (wchar_t* wsToFill, wchar_t wcToFill);
183 wchar_t* wcsupr (wchar_t* wsToConvert);
184
185 #endif  /* Not _NO_OLDNAMES */
186 #endif  /* Not strict ANSI */
187
188 #endif
189
190 #ifdef __cplusplus
191 }; /* extern "c" */
192 #endif