home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / DEV.Z / STRING.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-08  |  9.4 KB  |  307 lines

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