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.

288 lines
8.6 KiB

  1. /***
  2. *string.h - declarations for string manipulation functions
  3. *
  4. * Copyright (c) 1985-1995, 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. ****/
  14. #ifndef _INC_STRING
  15. #define _INC_STRING
  16. #if !defined(_WIN32) && !defined(_MAC)
  17. #error ERROR: Only Mac or Win32 targets supported!
  18. #endif
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  23. #ifndef _CRTAPI1
  24. #if _MSC_VER >= 800 && _M_IX86 >= 300
  25. #define _CRTAPI1 __cdecl
  26. #else
  27. #define _CRTAPI1
  28. #endif
  29. #endif
  30. /* Define _CRTAPI2 (for compatibility with the NT SDK) */
  31. #ifndef _CRTAPI2
  32. #if _MSC_VER >= 800 && _M_IX86 >= 300
  33. #define _CRTAPI2 __cdecl
  34. #else
  35. #define _CRTAPI2
  36. #endif
  37. #endif
  38. /* Define _CRTIMP */
  39. #ifndef _CRTIMP
  40. #ifdef _NTSDK
  41. /* definition compatible with NT SDK */
  42. #define _CRTIMP
  43. #else /* ndef _NTSDK */
  44. /* current definition */
  45. #ifdef _DLL
  46. #define _CRTIMP __declspec(dllimport)
  47. #else /* ndef _DLL */
  48. #define _CRTIMP
  49. #endif /* _DLL */
  50. #endif /* _NTSDK */
  51. #endif /* _CRTIMP */
  52. /* Define __cdecl for non-Microsoft compilers */
  53. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  54. #define __cdecl
  55. #endif
  56. #ifndef _SIZE_T_DEFINED
  57. typedef unsigned int size_t;
  58. #define _SIZE_T_DEFINED
  59. #endif
  60. #ifndef _MAC
  61. #ifndef _WCHAR_T_DEFINED
  62. typedef unsigned short wchar_t;
  63. #define _WCHAR_T_DEFINED
  64. #endif
  65. #endif /* ndef _MAC */
  66. #ifndef _NLSCMP_DEFINED
  67. #define _NLSCMPERROR 2147483647 /* currently == INT_MAX */
  68. #define _NLSCMP_DEFINED
  69. #endif
  70. /* Define NULL pointer value */
  71. #ifndef NULL
  72. #ifdef __cplusplus
  73. #define NULL 0
  74. #else
  75. #define NULL ((void *)0)
  76. #endif
  77. #endif
  78. /* Function prototypes */
  79. #ifdef _M_MRX000
  80. _CRTIMP void * __cdecl memcpy(void *, const void *, size_t);
  81. _CRTIMP int __cdecl memcmp(const void *, const void *, size_t);
  82. _CRTIMP void * __cdecl memset(void *, int, size_t);
  83. _CRTIMP char * __cdecl _strset(char *, int);
  84. _CRTIMP char * __cdecl strcpy(char *, const char *);
  85. _CRTIMP char * __cdecl strcat(char *, const char *);
  86. _CRTIMP int __cdecl strcmp(const char *, const char *);
  87. _CRTIMP size_t __cdecl strlen(const char *);
  88. #else
  89. void * __cdecl memcpy(void *, const void *, size_t);
  90. int __cdecl memcmp(const void *, const void *, size_t);
  91. void * __cdecl memset(void *, int, size_t);
  92. char * __cdecl _strset(char *, int);
  93. char * __cdecl strcpy(char *, const char *);
  94. char * __cdecl strcat(char *, const char *);
  95. int __cdecl strcmp(const char *, const char *);
  96. size_t __cdecl strlen(const char *);
  97. #endif
  98. _CRTIMP void * __cdecl _memccpy(void *, const void *, int, unsigned int);
  99. _CRTIMP void * __cdecl memchr(const void *, int, size_t);
  100. _CRTIMP int __cdecl _memicmp(const void *, const void *, unsigned int);
  101. #ifdef _M_ALPHA
  102. /* memmove is available as an intrinsic in the Alpha compiler */
  103. void * __cdecl memmove(void *, const void *, size_t);
  104. #else
  105. _CRTIMP void * __cdecl memmove(void *, const void *, size_t);
  106. #endif
  107. _CRTIMP char * __cdecl strchr(const char *, int);
  108. _CRTIMP int __cdecl _strcmpi(const char *, const char *);
  109. _CRTIMP int __cdecl _stricmp(const char *, const char *);
  110. _CRTIMP int __cdecl strcoll(const char *, const char *);
  111. _CRTIMP int __cdecl _stricoll(const char *, const char *);
  112. _CRTIMP int __cdecl _strncoll(const char *, const char *, size_t);
  113. _CRTIMP int __cdecl _strnicoll(const char *, const char *, size_t);
  114. _CRTIMP size_t __cdecl strcspn(const char *, const char *);
  115. _CRTIMP char * __cdecl _strdup(const char *);
  116. _CRTIMP char * __cdecl _strerror(const char *);
  117. _CRTIMP char * __cdecl strerror(int);
  118. _CRTIMP char * __cdecl _strlwr(char *);
  119. _CRTIMP char * __cdecl strncat(char *, const char *, size_t);
  120. _CRTIMP int __cdecl strncmp(const char *, const char *, size_t);
  121. _CRTIMP int __cdecl _strnicmp(const char *, const char *, size_t);
  122. _CRTIMP char * __cdecl strncpy(char *, const char *, size_t);
  123. _CRTIMP char * __cdecl _strnset(char *, int, size_t);
  124. _CRTIMP char * __cdecl strpbrk(const char *, const char *);
  125. _CRTIMP char * __cdecl strrchr(const char *, int);
  126. _CRTIMP char * __cdecl _strrev(char *);
  127. _CRTIMP size_t __cdecl strspn(const char *, const char *);
  128. _CRTIMP char * __cdecl strstr(const char *, const char *);
  129. _CRTIMP char * __cdecl strtok(char *, const char *);
  130. _CRTIMP char * __cdecl _strupr(char *);
  131. _CRTIMP size_t __cdecl strxfrm (char *, const char *, size_t);
  132. #if defined(_M_MPPC) || defined(_M_M68K)
  133. unsigned char * __cdecl _c2pstr(char *);
  134. char * __cdecl _p2cstr(unsigned char *);
  135. #if !__STDC__
  136. __inline unsigned char * __cdecl c2pstr(char *sz) { return _c2pstr(sz);};
  137. __inline char * __cdecl p2cstr(unsigned char *sz) { return _p2cstr(sz);};
  138. #endif
  139. #endif
  140. #if !__STDC__
  141. #ifdef _NTSDK
  142. /* Non-ANSI names for compatibility */
  143. #define memccpy _memccpy
  144. #define memicmp _memicmp
  145. #define strcmpi _strcmpi
  146. #define stricmp _stricmp
  147. #define strdup _strdup
  148. #define strlwr _strlwr
  149. #define strnicmp _strnicmp
  150. #define strnset _strnset
  151. #define strrev _strrev
  152. #define strset _strset
  153. #define strupr _strupr
  154. #define stricoll _stricoll
  155. #else /* ndef _NTSDK */
  156. /* prototypes for oldnames.lib functions */
  157. _CRTIMP void * __cdecl memccpy(void *, const void *, int, unsigned int);
  158. _CRTIMP int __cdecl memicmp(const void *, const void *, unsigned int);
  159. _CRTIMP int __cdecl strcmpi(const char *, const char *);
  160. _CRTIMP int __cdecl stricmp(const char *, const char *);
  161. _CRTIMP char * __cdecl strdup(const char *);
  162. _CRTIMP char * __cdecl strlwr(char *);
  163. _CRTIMP int __cdecl strnicmp(const char *, const char *, size_t);
  164. _CRTIMP char * __cdecl strnset(char *, int, size_t);
  165. _CRTIMP char * __cdecl strrev(char *);
  166. char * __cdecl strset(char *, int);
  167. _CRTIMP char * __cdecl strupr(char *);
  168. #endif /* ndef _NTSDK */
  169. #endif /* !__STDC__ */
  170. #ifndef _MAC
  171. #ifndef _WSTRING_DEFINED
  172. /* wide function prototypes, also declared in wchar.h */
  173. _CRTIMP wchar_t * __cdecl wcscat(wchar_t *, const wchar_t *);
  174. _CRTIMP wchar_t * __cdecl wcschr(const wchar_t *, wchar_t);
  175. _CRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *);
  176. _CRTIMP wchar_t * __cdecl wcscpy(wchar_t *, const wchar_t *);
  177. _CRTIMP size_t __cdecl wcscspn(const wchar_t *, const wchar_t *);
  178. _CRTIMP size_t __cdecl wcslen(const wchar_t *);
  179. _CRTIMP wchar_t * __cdecl wcsncat(wchar_t *, const wchar_t *, size_t);
  180. _CRTIMP int __cdecl wcsncmp(const wchar_t *, const wchar_t *, size_t);
  181. _CRTIMP wchar_t * __cdecl wcsncpy(wchar_t *, const wchar_t *, size_t);
  182. _CRTIMP wchar_t * __cdecl wcspbrk(const wchar_t *, const wchar_t *);
  183. _CRTIMP wchar_t * __cdecl wcsrchr(const wchar_t *, wchar_t);
  184. _CRTIMP size_t __cdecl wcsspn(const wchar_t *, const wchar_t *);
  185. _CRTIMP wchar_t * __cdecl wcsstr(const wchar_t *, const wchar_t *);
  186. _CRTIMP wchar_t * __cdecl wcstok(wchar_t *, const wchar_t *);
  187. _CRTIMP wchar_t * __cdecl _wcsdup(const wchar_t *);
  188. _CRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *);
  189. _CRTIMP int __cdecl _wcsnicmp(const wchar_t *, const wchar_t *, size_t);
  190. _CRTIMP wchar_t * __cdecl _wcsnset(wchar_t *, wchar_t, size_t);
  191. _CRTIMP wchar_t * __cdecl _wcsrev(wchar_t *);
  192. _CRTIMP wchar_t * __cdecl _wcsset(wchar_t *, wchar_t);
  193. _CRTIMP wchar_t * __cdecl _wcslwr(wchar_t *);
  194. _CRTIMP wchar_t * __cdecl _wcsupr(wchar_t *);
  195. _CRTIMP size_t __cdecl wcsxfrm(wchar_t *, const wchar_t *, size_t);
  196. _CRTIMP int __cdecl wcscoll(const wchar_t *, const wchar_t *);
  197. _CRTIMP int __cdecl _wcsicoll(const wchar_t *, const wchar_t *);
  198. _CRTIMP int __cdecl _wcsncoll(const wchar_t *, const wchar_t *, size_t);
  199. _CRTIMP int __cdecl _wcsnicoll(const wchar_t *, const wchar_t *, size_t);
  200. #if !__STDC__
  201. /* old names */
  202. #define wcswcs wcsstr
  203. #ifdef _NTSDK
  204. /* Non-ANSI names for compatibility */
  205. #define wcsdup _wcsdup
  206. #define wcsicmp _wcsicmp
  207. #define wcsnicmp _wcsnicmp
  208. #define wcsnset _wcsnset
  209. #define wcsrev _wcsrev
  210. #define wcsset _wcsset
  211. #define wcslwr _wcslwr
  212. #define wcsupr _wcsupr
  213. #define wcsicoll _wcsicoll
  214. #else /* ndef _NTSDK */
  215. /* prototypes for oldnames.lib functions */
  216. _CRTIMP wchar_t * __cdecl wcsdup(const wchar_t *);
  217. _CRTIMP int __cdecl wcsicmp(const wchar_t *, const wchar_t *);
  218. _CRTIMP int __cdecl wcsnicmp(const wchar_t *, const wchar_t *, size_t);
  219. _CRTIMP wchar_t * __cdecl wcsnset(wchar_t *, wchar_t, size_t);
  220. _CRTIMP wchar_t * __cdecl wcsrev(wchar_t *);
  221. _CRTIMP wchar_t * __cdecl wcsset(wchar_t *, wchar_t);
  222. _CRTIMP wchar_t * __cdecl wcslwr(wchar_t *);
  223. _CRTIMP wchar_t * __cdecl wcsupr(wchar_t *);
  224. _CRTIMP int __cdecl wcsicoll(const wchar_t *, const wchar_t *);
  225. #endif /* ndef _NTSDK */
  226. #endif /* !__STDC__ */
  227. #define _WSTRING_DEFINED
  228. #endif
  229. #endif /* ndef _MAC */
  230. #ifdef __cplusplus
  231. }
  232. #endif
  233. #endif /* _INC_STRING */