Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

308 lines
12 KiB

  1. /***
  2. *string.h - declarations for string manipulation functions
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This file contains the function declarations for the string
  8. * manipulation functions.
  9. * [ANSI/System V]
  10. *
  11. * [Public]
  12. *
  13. *Revision History:
  14. * 10/20/87 JCR Removed "MSC40_ONLY" entries
  15. * 12-11-87 JCR Added "_loadds" functionality
  16. * 12-18-87 JCR Added _FAR_ to declarations
  17. * 02-10-88 JCR Cleaned up white space
  18. * 08-19-88 GJF Modified to also work for the 386 (small model only)
  19. * 03-22-88 JCR Added strcoll and strxfrm
  20. * 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
  21. * 08-03-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
  22. * 10-30-89 GJF Fixed copyright, removed dummy args from strcoll and
  23. * strxfrm
  24. * 11-02-89 JCR Changed "DLL" to "_DLL"
  25. * 11-17-89 GJF Added const to appropriate arg types for memccpy(),
  26. * memicmp() and _strerror().
  27. * 02-27-90 GJF Added #ifndef _INC_STRING, #include <cruntime.h>
  28. * and _CALLTYPE1 stuff. Also, some cleanup.
  29. * 03-21-90 GJF Got rid of movedata() prototype.
  30. * 08-14-90 SBM Added NULL definition for ANSI compliance
  31. * 11-12-90 GJF Changed NULL to (void *)0.
  32. * 01-18-91 GJF ANSI naming.
  33. * 02-12-91 GJF Only #define NULL if it isn't #define-d.
  34. * 03-21-91 KRS Added wchar_t type, also in stdlib.h and stddef.h.
  35. * 08-20-91 JCR C++ and ANSI naming
  36. * 09-28-91 JCR ANSI names: DOSX32=prototypes, WIN32=#defines for now
  37. * 10-07-91 ETC Prototypes for wcs functions and _stricoll under _INTL.
  38. * 04-06-92 KRS Rip out _INTL switches again.
  39. * 06-23-92 GJF // is non-ANSI comment limiter.
  40. * 08-05-92 GJF Function calling type and variable type macros.
  41. * 08-18-92 KRS Activate wcstok.
  42. * 08-21-92 GJF Merged last two changes.
  43. * 01-21-93 GJF Removed support for C6-386's _cdecl.
  44. * 04-07-93 SKS Add _CRTIMP keyword for CRT DLL model
  45. * Use link-time aliases for old names, not #define's
  46. * Intrinsic functions cannot use __declspec(dllimport)
  47. * 10-06-93 GJF Merged NT SDK and Cuda versions.
  48. * 11-22-93 CFW wcsxxx defines in SDK, prototypes in !SDK.
  49. * 12-07-93 CFW Move wide defs outside __STDC__ check.
  50. * 01-14-94 CFW Add _strnicoll, _wcsnicoll.
  51. * 04-11-94 CFW Add _NLSCMPERROR.
  52. * 05-17-94 GJF Compiler for DEC Alpha provides implementation of
  53. * memmove as an intrinsic. Thus, Alpha version of
  54. * prototype cannot be _CRTIMP.
  55. * 05-26-94 CFW Add _strncoll, _wcsncoll.
  56. * 12-28-94 JCF Merged with mac header.
  57. * 02-11-95 CFW Add _CRTBLD to avoid users getting wrong headers.
  58. * 02-14-95 CFW Clean up Mac merge.
  59. * 03-01-95 SAH add _CRTIMP to MIPS intrinsics
  60. * 12-14-95 JWM Add "#pragma once".
  61. * 02-05-97 GJF Cleaned out obsolete support for _CRTAPI* and _NTSDK.
  62. * 09-30-97 JWM Restored not-so-obsolete _CRTAPI1 support.
  63. * 10-07-97 RDL Added IA64.
  64. * 08-27-98 GJF Added __ascii_memicmp, __ascii_stricmp and
  65. * __ascii_strnicmp.
  66. * 12-15-98 GJF Changes for 64-bit size_t.
  67. * 05-13-99 PML Remove _CRTAPI1
  68. * 05-17-99 PML Remove all Macintosh support.
  69. * 10-06-99 PML Add _W64 modifier to types which are 32 bits in Win32,
  70. * 64 bits in Win64.
  71. * 10-27-99 PML unsigned int -> size_t in memccpy, memicmp
  72. * 11-30-99 GB Add _wcserror and __wcserror
  73. * 05-01-01 PML memmove isn't _CRTIMP on IA64
  74. *
  75. ****/
  76. #if _MSC_VER > 1000 /*IFSTRIP=IGN*/
  77. #pragma once
  78. #endif
  79. #ifndef _INC_STRING
  80. #define _INC_STRING
  81. #if !defined(_WIN32)
  82. #error ERROR: Only Win32 target supported!
  83. #endif
  84. #ifndef _CRTBLD
  85. /* This version of the header files is NOT for user programs.
  86. * It is intended for use when building the C runtimes ONLY.
  87. * The version intended for public use will not have this message.
  88. */
  89. #error ERROR: Use of C runtime library internal header file.
  90. #endif /* _CRTBLD */
  91. #ifdef __cplusplus
  92. extern "C" {
  93. #endif
  94. #ifndef _INTERNAL_IFSTRIP_
  95. #include <cruntime.h>
  96. #endif /* _INTERNAL_IFSTRIP_ */
  97. #if !defined(_W64)
  98. #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 /*IFSTRIP=IGN*/
  99. #define _W64 __w64
  100. #else
  101. #define _W64
  102. #endif
  103. #endif
  104. /* Define _CRTIMP */
  105. #ifndef _CRTIMP
  106. #ifdef CRTDLL
  107. #define _CRTIMP __declspec(dllexport)
  108. #else /* ndef CRTDLL */
  109. #ifdef _DLL
  110. #define _CRTIMP __declspec(dllimport)
  111. #else /* ndef _DLL */
  112. #define _CRTIMP
  113. #endif /* _DLL */
  114. #endif /* CRTDLL */
  115. #endif /* _CRTIMP */
  116. /* Define __cdecl for non-Microsoft compilers */
  117. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  118. #define __cdecl
  119. #endif
  120. #ifndef _SIZE_T_DEFINED
  121. #ifdef _WIN64
  122. typedef unsigned __int64 size_t;
  123. #else
  124. typedef _W64 unsigned int size_t;
  125. #endif
  126. #define _SIZE_T_DEFINED
  127. #endif
  128. #ifndef _WCHAR_T_DEFINED
  129. typedef unsigned short wchar_t;
  130. #define _WCHAR_T_DEFINED
  131. #endif
  132. #ifndef _NLSCMP_DEFINED
  133. #define _NLSCMPERROR 2147483647 /* currently == INT_MAX */
  134. #define _NLSCMP_DEFINED
  135. #endif
  136. /* Define NULL pointer value */
  137. #ifndef NULL
  138. #ifdef __cplusplus
  139. #define NULL 0
  140. #else
  141. #define NULL ((void *)0)
  142. #endif
  143. #endif
  144. /* Function prototypes */
  145. #ifdef _M_MRX000
  146. _CRTIMP void * __cdecl memcpy(void *, const void *, size_t);
  147. _CRTIMP int __cdecl memcmp(const void *, const void *, size_t);
  148. _CRTIMP void * __cdecl memset(void *, int, size_t);
  149. _CRTIMP char * __cdecl _strset(char *, int);
  150. _CRTIMP char * __cdecl strcpy(char *, const char *);
  151. _CRTIMP char * __cdecl strcat(char *, const char *);
  152. _CRTIMP int __cdecl strcmp(const char *, const char *);
  153. _CRTIMP size_t __cdecl strlen(const char *);
  154. #else
  155. void * __cdecl memcpy(void *, const void *, size_t);
  156. int __cdecl memcmp(const void *, const void *, size_t);
  157. void * __cdecl memset(void *, int, size_t);
  158. char * __cdecl _strset(char *, int);
  159. char * __cdecl strcpy(char *, const char *);
  160. char * __cdecl strcat(char *, const char *);
  161. int __cdecl strcmp(const char *, const char *);
  162. size_t __cdecl strlen(const char *);
  163. #endif
  164. _CRTIMP void * __cdecl _memccpy(void *, const void *, int, size_t);
  165. _CRTIMP void * __cdecl memchr(const void *, int, size_t);
  166. _CRTIMP int __cdecl _memicmp(const void *, const void *, size_t);
  167. #if defined(_M_IA64) || defined(_M_ALPHA)
  168. void * __cdecl memmove(void *, const void *, size_t);
  169. #else
  170. _CRTIMP void * __cdecl memmove(void *, const void *, size_t);
  171. #endif
  172. _CRTIMP char * __cdecl strchr(const char *, int);
  173. _CRTIMP int __cdecl _strcmpi(const char *, const char *);
  174. _CRTIMP int __cdecl _stricmp(const char *, const char *);
  175. _CRTIMP int __cdecl strcoll(const char *, const char *);
  176. _CRTIMP int __cdecl _stricoll(const char *, const char *);
  177. _CRTIMP int __cdecl _strncoll(const char *, const char *, size_t);
  178. _CRTIMP int __cdecl _strnicoll(const char *, const char *, size_t);
  179. _CRTIMP size_t __cdecl strcspn(const char *, const char *);
  180. _CRTIMP char * __cdecl _strdup(const char *);
  181. _CRTIMP char * __cdecl _strerror(const char *);
  182. _CRTIMP char * __cdecl strerror(int);
  183. _CRTIMP char * __cdecl _strlwr(char *);
  184. _CRTIMP char * __cdecl strncat(char *, const char *, size_t);
  185. _CRTIMP int __cdecl strncmp(const char *, const char *, size_t);
  186. _CRTIMP int __cdecl _strnicmp(const char *, const char *, size_t);
  187. _CRTIMP char * __cdecl strncpy(char *, const char *, size_t);
  188. _CRTIMP char * __cdecl _strnset(char *, int, size_t);
  189. _CRTIMP char * __cdecl strpbrk(const char *, const char *);
  190. _CRTIMP char * __cdecl strrchr(const char *, int);
  191. _CRTIMP char * __cdecl _strrev(char *);
  192. _CRTIMP size_t __cdecl strspn(const char *, const char *);
  193. _CRTIMP char * __cdecl strstr(const char *, const char *);
  194. _CRTIMP char * __cdecl strtok(char *, const char *);
  195. _CRTIMP char * __cdecl _strupr(char *);
  196. _CRTIMP size_t __cdecl strxfrm (char *, const char *, size_t);
  197. #if !__STDC__
  198. /* prototypes for oldnames.lib functions */
  199. _CRTIMP void * __cdecl memccpy(void *, const void *, int, size_t);
  200. _CRTIMP int __cdecl memicmp(const void *, const void *, size_t);
  201. _CRTIMP int __cdecl strcmpi(const char *, const char *);
  202. _CRTIMP int __cdecl stricmp(const char *, const char *);
  203. _CRTIMP char * __cdecl strdup(const char *);
  204. _CRTIMP char * __cdecl strlwr(char *);
  205. _CRTIMP int __cdecl strnicmp(const char *, const char *, size_t);
  206. _CRTIMP char * __cdecl strnset(char *, int, size_t);
  207. _CRTIMP char * __cdecl strrev(char *);
  208. char * __cdecl strset(char *, int);
  209. _CRTIMP char * __cdecl strupr(char *);
  210. #endif /* !__STDC__ */
  211. #ifndef _WSTRING_DEFINED
  212. /* wide function prototypes, also declared in wchar.h */
  213. _CRTIMP wchar_t * __cdecl wcscat(wchar_t *, const wchar_t *);
  214. _CRTIMP wchar_t * __cdecl wcschr(const wchar_t *, wchar_t);
  215. _CRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *);
  216. _CRTIMP wchar_t * __cdecl wcscpy(wchar_t *, const wchar_t *);
  217. _CRTIMP size_t __cdecl wcscspn(const wchar_t *, const wchar_t *);
  218. _CRTIMP size_t __cdecl wcslen(const wchar_t *);
  219. _CRTIMP wchar_t * __cdecl wcsncat(wchar_t *, const wchar_t *, size_t);
  220. _CRTIMP int __cdecl wcsncmp(const wchar_t *, const wchar_t *, size_t);
  221. _CRTIMP wchar_t * __cdecl wcsncpy(wchar_t *, const wchar_t *, size_t);
  222. _CRTIMP wchar_t * __cdecl wcspbrk(const wchar_t *, const wchar_t *);
  223. _CRTIMP wchar_t * __cdecl wcsrchr(const wchar_t *, wchar_t);
  224. _CRTIMP size_t __cdecl wcsspn(const wchar_t *, const wchar_t *);
  225. _CRTIMP wchar_t * __cdecl wcsstr(const wchar_t *, const wchar_t *);
  226. _CRTIMP wchar_t * __cdecl wcstok(wchar_t *, const wchar_t *);
  227. _CRTIMP wchar_t * __cdecl _wcserror(int);
  228. _CRTIMP wchar_t * __cdecl __wcserror(const wchar_t *);
  229. _CRTIMP wchar_t * __cdecl _wcsdup(const wchar_t *);
  230. _CRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *);
  231. _CRTIMP int __cdecl _wcsnicmp(const wchar_t *, const wchar_t *, size_t);
  232. _CRTIMP wchar_t * __cdecl _wcsnset(wchar_t *, wchar_t, size_t);
  233. _CRTIMP wchar_t * __cdecl _wcsrev(wchar_t *);
  234. _CRTIMP wchar_t * __cdecl _wcsset(wchar_t *, wchar_t);
  235. _CRTIMP wchar_t * __cdecl _wcslwr(wchar_t *);
  236. _CRTIMP wchar_t * __cdecl _wcsupr(wchar_t *);
  237. _CRTIMP size_t __cdecl wcsxfrm(wchar_t *, const wchar_t *, size_t);
  238. _CRTIMP int __cdecl wcscoll(const wchar_t *, const wchar_t *);
  239. _CRTIMP int __cdecl _wcsicoll(const wchar_t *, const wchar_t *);
  240. _CRTIMP int __cdecl _wcsncoll(const wchar_t *, const wchar_t *, size_t);
  241. _CRTIMP int __cdecl _wcsnicoll(const wchar_t *, const wchar_t *, size_t);
  242. #if !__STDC__
  243. /* old names */
  244. #define wcswcs wcsstr
  245. /* prototypes for oldnames.lib functions */
  246. _CRTIMP wchar_t * __cdecl wcsdup(const wchar_t *);
  247. _CRTIMP int __cdecl wcsicmp(const wchar_t *, const wchar_t *);
  248. _CRTIMP int __cdecl wcsnicmp(const wchar_t *, const wchar_t *, size_t);
  249. _CRTIMP wchar_t * __cdecl wcsnset(wchar_t *, wchar_t, size_t);
  250. _CRTIMP wchar_t * __cdecl wcsrev(wchar_t *);
  251. _CRTIMP wchar_t * __cdecl wcsset(wchar_t *, wchar_t);
  252. _CRTIMP wchar_t * __cdecl wcslwr(wchar_t *);
  253. _CRTIMP wchar_t * __cdecl wcsupr(wchar_t *);
  254. _CRTIMP int __cdecl wcsicoll(const wchar_t *, const wchar_t *);
  255. #endif /* !__STDC__ */
  256. #define _WSTRING_DEFINED
  257. #endif
  258. #ifndef _INTERNAL_IFSTRIP_
  259. int __cdecl __ascii_memicmp(const void *, const void *, size_t);
  260. int __cdecl __ascii_stricmp(const char *, const char *);
  261. int __cdecl __ascii_strnicmp(const char *, const char *, size_t);
  262. #endif /* _INTERNAL_IFSTRIP_ */
  263. #ifdef __cplusplus
  264. }
  265. #endif
  266. #endif /* _INC_STRING */