update for HEAD-2003091401
[reactos.git] / include / msvcrt / 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  *  DISCLAIMED. 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
35 /*
36  * Define size_t, wchar_t and NULL
37  */
38 #define __need_size_t
39 #define __need_wchar_t
40 #define __need_NULL
41 #include <msvcrt/stddef.h>
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46
47 char * ___strtok; /* removed extern specifier 02-06-98, BD */
48
49 /*
50  * Prototypes of the ANSI Standard C library string functions.
51  */
52 void*   memchr(const void* p, int cSearchFor, size_t sizeSearch);
53 int     memcmp(const void* p1, const void* p2, size_t sizeSearch);
54 void*   memcpy(void* pCopyTo, const void* pSource, size_t sizeSource);
55 void*   memmove(void* pMoveTo, const void* pSource, size_t sizeSource);
56 void*   memset(void* p, int cFill, size_t sizeRepeatCount);
57 char*   strcat(char* szAddTo, const char* szAdd);
58 char*   strchr(const char* szSearch, int cFor);
59 int     strcmp(const char* sz1, const char* sz2);
60 int     strcoll(const char* sz1, const char* sz2); /* Compare using locale */
61 char*   strcpy(char* szCopyTo, const char* szSource);
62 size_t  strcspn(const char* szGetPrefix, const char* szNotIncluding);
63 char*   strerror(int nError); /* NOTE: NOT an old name wrapper. */
64 char *  _strerror(const char *s);
65 size_t  strlen(const char* sz);
66 size_t  strnlen(const char* sz, size_t count); /* not exported */
67 char*   strncat(char* szAddTo, const char* szAdd, size_t sizeMaxAdd);
68 int     strncmp(const char* sz1, const char* sz2, size_t sizeMaxCompare);
69 char*   strncpy(char* szCopyTo, const char* szSource, size_t sizeMaxCopy);
70 char*   strpbrk(const char* szSearch, const char* szAnyOf);
71 char*   strrchr(const char* szSearch, int cFor);
72 size_t  strspn(const char* szGetPrefix, const char *szIncluding);
73 char*   strstr(const char* szSearch, const char *szFor);
74 char*   strtok(char* szTokenize, const char* szDelimiters);
75 size_t  strxfrm(char* szTransformed, const char *szSource, 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, size_t sizeMaxCopy);
82 int     _memicmp(const void* p1, const void* p2, size_t sizeSearch);
83 char*   _strdup(const char *szDuplicate);
84 int     _strcmpi(const char* sz1, const char* sz2);
85 int     _stricmp(const char* sz1, const char* sz2);
86 int     _stricoll(const char* sz1, const char* sz2);
87 char*   _strlwr(char* szToConvert);
88 int     _strnicmp(const char* sz1, const char* sz2, size_t sizeMaxCompare);
89 char*   _strnset(char* szToFill, int cFill, size_t sizeMaxFill);
90 char*   _strrev(char* szToReverse);
91 char*   _strset(char* szToFill, int cFill);
92 char*   _strupr(char* szToConvert);
93
94 #endif  /* Not __STRICT_ANSI__ */
95
96
97 /*
98  * Unicode versions of the standard calls.
99  */
100 wchar_t* wcscat(wchar_t* wsAddTo, const wchar_t* wsAdd);
101 wchar_t* wcschr(const wchar_t* wsSearch, wchar_t wcFor);
102 int      wcscmp(const wchar_t* ws1, const wchar_t* ws2);
103 int      wcscoll(const wchar_t* ws1, const wchar_t* ws2);
104 wchar_t* wcscpy(wchar_t* wsCopyTo, const wchar_t* wsSource);
105 size_t   wcscspn(const wchar_t* wsGetPrefix, const wchar_t* wsNotIncluding);
106 /* Note: No wcserror in CRTDLL. */
107 size_t   wcslen(const wchar_t* ws);
108 wchar_t* wcsncat(wchar_t* wsAddTo, const wchar_t* wsAdd, size_t sizeMaxAdd);
109 int      wcsncmp(const wchar_t* ws1, const wchar_t* ws2, size_t sizeMaxCompare);
110 wchar_t* wcsncpy(wchar_t* wsCopyTo, const wchar_t* wsSource, size_t sizeMaxCopy);
111 wchar_t* wcspbrk(const wchar_t* wsSearch, const wchar_t* wsAnyOf);
112 wchar_t* wcsrchr(const wchar_t* wsSearch, wchar_t wcFor);
113 size_t   wcsspn(const wchar_t* wsGetPrefix, const wchar_t* wsIncluding);
114 wchar_t* wcsstr(const wchar_t* wsSearch, const wchar_t* wsFor);
115 wchar_t* wcstok(wchar_t* wsTokenize, const wchar_t* wsDelimiters);
116 size_t   wcsxfrm(wchar_t* wsTransformed, const wchar_t *wsSource, size_t sizeTransform);
117
118
119 #ifndef __STRICT_ANSI__
120 /*
121  * Unicode versions of non-ANSI functions provided by CRTDLL.
122  */
123
124 /* NOTE: _wcscmpi not provided by CRTDLL, this define is for portability */
125 #define _wcscmpi _wcsicmp
126
127 wchar_t* _wcsdup(const wchar_t* wsToDuplicate);
128 int      _wcsicmp(const wchar_t* ws1, const wchar_t* ws2);
129 int      _wcsicoll(const wchar_t* ws1, const wchar_t* ws2);
130 int      _wcsncoll(const wchar_t *s1, const wchar_t *s2, size_t c);
131 int      _wcsnicoll(const wchar_t *s1, const wchar_t *s2, size_t c);
132 wchar_t* _wcslwr(wchar_t* wsToConvert);
133 int      _wcsnicmp(const wchar_t* ws1, const wchar_t* ws2, size_t sizeMaxCompare);
134 wchar_t* _wcsnset(wchar_t* wsToFill, wchar_t wcFill, size_t sizeMaxFill);
135 wchar_t* _wcsrev(wchar_t* wsToReverse);
136 wchar_t* _wcsset(wchar_t* wsToFill, wchar_t wcToFill);
137 wchar_t* _wcsupr(wchar_t* wsToConvert);
138
139 #endif  /* Not __STRICT_ANSI__ */
140
141
142 #ifndef __STRICT_ANSI__
143 #ifndef _NO_OLDNAMES
144
145 /*
146  * Non-underscored versions of non-ANSI functions. They live in liboldnames.a
147  * and provide a little extra portability. Also a few extra UNIX-isms like
148  * strcasecmp.
149  */
150
151 void*   memccpy(void* pCopyTo, const void* pSource, int cTerminator, size_t sizeMaxCopy);
152 int memicmp(const void* p1, const void* p2, size_t sizeSearch);
153 #define strdup(szDuplicate) _strdup(szDuplicate)
154 int strcmpi(const char* sz1, const char* sz2);
155 int stricmp(const char* sz1, const char* sz2);
156 int strcasecmp(const char* sz1, const char* sz2);
157 int stricoll(const char* sz1, const char* sz2);
158 char*   strlwr(char* szToConvert);
159 int strnicmp(const char* sz1, const char* sz2, size_t sizeMaxCompare);
160 int strncasecmp(const char* sz1, const char* sz2, size_t sizeMaxCompare);
161 char*   strnset(char* szToFill, int cFill, size_t sizeMaxFill);
162 char*   strrev(char* szToReverse);
163 char*   strset(char* szToFill, int cFill);
164 char*   strupr(char* szToConvert);
165
166
167 /* NOTE: There is no _wcscmpi, but this is for compatibility. */
168 int wcscmpi(const wchar_t* ws1, const wchar_t* ws2);
169 wchar_t* wcsdup(const wchar_t* wsToDuplicate);
170 int wcsicmp(const wchar_t* ws1, const wchar_t* ws2);
171 int wcsicoll(const wchar_t* ws1, const wchar_t* ws2);
172 wchar_t* wcslwr(wchar_t* wsToConvert);
173 int wcsnicmp(const wchar_t* ws1, const wchar_t* ws2, size_t sizeMaxCompare);
174 wchar_t* wcsnset(wchar_t* wsToFill, wchar_t wcFill, size_t sizeMaxFill);
175 wchar_t* wcsrev(wchar_t* wsToReverse);
176 wchar_t* wcsset(wchar_t* wsToFill, wchar_t wcToFill);
177 wchar_t* wcsupr(wchar_t* wsToConvert);
178
179 #endif  /* Not _NO_OLDNAMES */
180 #endif  /* Not strict ANSI */
181
182
183 #ifdef __cplusplus
184 }
185 #endif
186
187 #endif  /* Not _STRING_H_ */
188