Leaked source code of windows server 2003
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.

298 lines
11 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. * 07-15-01 PML Remove all ALPHA, MIPS, and PPC code
  75. *
  76. ****/
  77. #if _MSC_VER > 1000 /*IFSTRIP=IGN*/
  78. #pragma once
  79. #endif
  80. #ifndef _INC_STRING
  81. #define _INC_STRING
  82. #if !defined(_WIN32)
  83. #error ERROR: Only Win32 target supported!
  84. #endif
  85. #ifndef _CRTBLD
  86. /* This version of the header files is NOT for user programs.
  87. * It is intended for use when building the C runtimes ONLY.
  88. * The version intended for public use will not have this message.
  89. */
  90. #error ERROR: Use of C runtime library internal header file.
  91. #endif /* _CRTBLD */
  92. #ifdef __cplusplus
  93. extern "C" {
  94. #endif
  95. #ifndef _INTERNAL_IFSTRIP_
  96. #include <cruntime.h>
  97. #endif /* _INTERNAL_IFSTRIP_ */
  98. #if !defined(_W64)
  99. #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 /*IFSTRIP=IGN*/
  100. #define _W64 __w64
  101. #else
  102. #define _W64
  103. #endif
  104. #endif
  105. /* Define _CRTIMP */
  106. #ifndef _CRTIMP
  107. #ifdef CRTDLL
  108. #define _CRTIMP __declspec(dllexport)
  109. #else /* ndef CRTDLL */
  110. #ifdef _DLL
  111. #define _CRTIMP __declspec(dllimport)
  112. #else /* ndef _DLL */
  113. #define _CRTIMP
  114. #endif /* _DLL */
  115. #endif /* CRTDLL */
  116. #endif /* _CRTIMP */
  117. /* Define __cdecl for non-Microsoft compilers */
  118. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  119. #define __cdecl
  120. #endif
  121. #ifndef _SIZE_T_DEFINED
  122. #ifdef _WIN64
  123. typedef unsigned __int64 size_t;
  124. #else
  125. typedef _W64 unsigned int size_t;
  126. #endif
  127. #define _SIZE_T_DEFINED
  128. #endif
  129. #ifndef _WCHAR_T_DEFINED
  130. typedef unsigned short wchar_t;
  131. #define _WCHAR_T_DEFINED
  132. #endif
  133. #ifndef _NLSCMP_DEFINED
  134. #define _NLSCMPERROR 2147483647 /* currently == INT_MAX */
  135. #define _NLSCMP_DEFINED
  136. #endif
  137. /* Define NULL pointer value */
  138. #ifndef NULL
  139. #ifdef __cplusplus
  140. #define NULL 0
  141. #else
  142. #define NULL ((void *)0)
  143. #endif
  144. #endif
  145. /* Function prototypes */
  146. void * __cdecl memcpy(void *, const void *, size_t);
  147. int __cdecl memcmp(const void *, const void *, size_t);
  148. void * __cdecl memset(void *, int, size_t);
  149. char * __cdecl _strset(char *, int);
  150. char * __cdecl strcpy(char *, const char *);
  151. char * __cdecl strcat(char *, const char *);
  152. int __cdecl strcmp(const char *, const char *);
  153. size_t __cdecl strlen(const char *);
  154. _CRTIMP void * __cdecl _memccpy(void *, const void *, int, size_t);
  155. _CRTIMP void * __cdecl memchr(const void *, int, size_t);
  156. _CRTIMP int __cdecl _memicmp(const void *, const void *, size_t);
  157. #if defined(_M_IA64)
  158. void * __cdecl memmove(void *, const void *, size_t);
  159. #else
  160. _CRTIMP void * __cdecl memmove(void *, const void *, size_t);
  161. #endif
  162. _CRTIMP char * __cdecl strchr(const char *, int);
  163. _CRTIMP int __cdecl _strcmpi(const char *, const char *);
  164. _CRTIMP int __cdecl _stricmp(const char *, const char *);
  165. _CRTIMP int __cdecl strcoll(const char *, const char *);
  166. _CRTIMP int __cdecl _stricoll(const char *, const char *);
  167. _CRTIMP int __cdecl _strncoll(const char *, const char *, size_t);
  168. _CRTIMP int __cdecl _strnicoll(const char *, const char *, size_t);
  169. _CRTIMP size_t __cdecl strcspn(const char *, const char *);
  170. _CRTIMP char * __cdecl _strdup(const char *);
  171. _CRTIMP char * __cdecl _strerror(const char *);
  172. _CRTIMP char * __cdecl strerror(int);
  173. _CRTIMP char * __cdecl _strlwr(char *);
  174. _CRTIMP char * __cdecl strncat(char *, const char *, size_t);
  175. _CRTIMP int __cdecl strncmp(const char *, const char *, size_t);
  176. _CRTIMP int __cdecl _strnicmp(const char *, const char *, size_t);
  177. _CRTIMP char * __cdecl strncpy(char *, const char *, size_t);
  178. _CRTIMP char * __cdecl _strnset(char *, int, size_t);
  179. _CRTIMP char * __cdecl strpbrk(const char *, const char *);
  180. _CRTIMP char * __cdecl strrchr(const char *, int);
  181. _CRTIMP char * __cdecl _strrev(char *);
  182. _CRTIMP size_t __cdecl strspn(const char *, const char *);
  183. _CRTIMP char * __cdecl strstr(const char *, const char *);
  184. _CRTIMP char * __cdecl strtok(char *, const char *);
  185. _CRTIMP char * __cdecl _strupr(char *);
  186. _CRTIMP size_t __cdecl strxfrm (char *, const char *, size_t);
  187. #if !__STDC__
  188. /* prototypes for oldnames.lib functions */
  189. _CRTIMP void * __cdecl memccpy(void *, const void *, int, size_t);
  190. _CRTIMP int __cdecl memicmp(const void *, const void *, size_t);
  191. _CRTIMP int __cdecl strcmpi(const char *, const char *);
  192. _CRTIMP int __cdecl stricmp(const char *, const char *);
  193. _CRTIMP char * __cdecl strdup(const char *);
  194. _CRTIMP char * __cdecl strlwr(char *);
  195. _CRTIMP int __cdecl strnicmp(const char *, const char *, size_t);
  196. _CRTIMP char * __cdecl strnset(char *, int, size_t);
  197. _CRTIMP char * __cdecl strrev(char *);
  198. char * __cdecl strset(char *, int);
  199. _CRTIMP char * __cdecl strupr(char *);
  200. #endif /* !__STDC__ */
  201. #ifndef _WSTRING_DEFINED
  202. /* wide function prototypes, also declared in wchar.h */
  203. _CRTIMP wchar_t * __cdecl wcscat(wchar_t *, const wchar_t *);
  204. _CRTIMP wchar_t * __cdecl wcschr(const wchar_t *, wchar_t);
  205. _CRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *);
  206. _CRTIMP wchar_t * __cdecl wcscpy(wchar_t *, const wchar_t *);
  207. _CRTIMP size_t __cdecl wcscspn(const wchar_t *, const wchar_t *);
  208. _CRTIMP size_t __cdecl wcslen(const wchar_t *);
  209. _CRTIMP wchar_t * __cdecl wcsncat(wchar_t *, const wchar_t *, size_t);
  210. _CRTIMP int __cdecl wcsncmp(const wchar_t *, const wchar_t *, size_t);
  211. _CRTIMP wchar_t * __cdecl wcsncpy(wchar_t *, const wchar_t *, size_t);
  212. _CRTIMP wchar_t * __cdecl wcspbrk(const wchar_t *, const wchar_t *);
  213. _CRTIMP wchar_t * __cdecl wcsrchr(const wchar_t *, wchar_t);
  214. _CRTIMP size_t __cdecl wcsspn(const wchar_t *, const wchar_t *);
  215. _CRTIMP wchar_t * __cdecl wcsstr(const wchar_t *, const wchar_t *);
  216. _CRTIMP wchar_t * __cdecl wcstok(wchar_t *, const wchar_t *);
  217. _CRTIMP wchar_t * __cdecl _wcserror(int);
  218. _CRTIMP wchar_t * __cdecl __wcserror(const wchar_t *);
  219. _CRTIMP wchar_t * __cdecl _wcsdup(const wchar_t *);
  220. _CRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *);
  221. _CRTIMP int __cdecl _wcsnicmp(const wchar_t *, const wchar_t *, size_t);
  222. _CRTIMP wchar_t * __cdecl _wcsnset(wchar_t *, wchar_t, size_t);
  223. _CRTIMP wchar_t * __cdecl _wcsrev(wchar_t *);
  224. _CRTIMP wchar_t * __cdecl _wcsset(wchar_t *, wchar_t);
  225. _CRTIMP wchar_t * __cdecl _wcslwr(wchar_t *);
  226. _CRTIMP wchar_t * __cdecl _wcsupr(wchar_t *);
  227. _CRTIMP size_t __cdecl wcsxfrm(wchar_t *, const wchar_t *, size_t);
  228. _CRTIMP int __cdecl wcscoll(const wchar_t *, const wchar_t *);
  229. _CRTIMP int __cdecl _wcsicoll(const wchar_t *, const wchar_t *);
  230. _CRTIMP int __cdecl _wcsncoll(const wchar_t *, const wchar_t *, size_t);
  231. _CRTIMP int __cdecl _wcsnicoll(const wchar_t *, const wchar_t *, size_t);
  232. #if !__STDC__
  233. /* old names */
  234. #define wcswcs wcsstr
  235. /* prototypes for oldnames.lib functions */
  236. _CRTIMP wchar_t * __cdecl wcsdup(const wchar_t *);
  237. _CRTIMP int __cdecl wcsicmp(const wchar_t *, const wchar_t *);
  238. _CRTIMP int __cdecl wcsnicmp(const wchar_t *, const wchar_t *, size_t);
  239. _CRTIMP wchar_t * __cdecl wcsnset(wchar_t *, wchar_t, size_t);
  240. _CRTIMP wchar_t * __cdecl wcsrev(wchar_t *);
  241. _CRTIMP wchar_t * __cdecl wcsset(wchar_t *, wchar_t);
  242. _CRTIMP wchar_t * __cdecl wcslwr(wchar_t *);
  243. _CRTIMP wchar_t * __cdecl wcsupr(wchar_t *);
  244. _CRTIMP int __cdecl wcsicoll(const wchar_t *, const wchar_t *);
  245. #endif /* !__STDC__ */
  246. #define _WSTRING_DEFINED
  247. #endif
  248. #ifndef _INTERNAL_IFSTRIP_
  249. int __cdecl __ascii_memicmp(const void *, const void *, size_t);
  250. int __cdecl __ascii_stricmp(const char *, const char *);
  251. int __cdecl __ascii_strnicmp(const char *, const char *, size_t);
  252. #endif /* _INTERNAL_IFSTRIP_ */
  253. #ifdef __cplusplus
  254. }
  255. #endif
  256. #endif /* _INC_STRING */