home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / string.h < prev    next >
C/C++ Source or Header  |  1998-06-16  |  8KB  |  239 lines

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