home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 14.ddi / GENINC.PAK / STRING.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  13.5 KB  |  307 lines

  1. /*  string.h
  2.  
  3.     Definitions for memory and string functions.
  4.  
  5. */
  6.  
  7. /*
  8.  *      C/C++ Run Time Library - Version 6.0
  9.  *
  10.  *      Copyright (c) 1987, 1993 by Borland International
  11.  *      All Rights Reserved.
  12.  *
  13.  */
  14.  
  15. #ifndef __STRING_H
  16. #define __STRING_H
  17.  
  18. #if !defined(___DEFS_H)
  19. #include <_defs.h>
  20. #endif
  21.  
  22. #ifndef NULL
  23. #include <_null.h>
  24. #endif
  25.  
  26. #ifndef __OS2__
  27.  
  28. #ifndef __STDC__
  29.  
  30. #if !defined(__LOCALE_H)
  31. #include <locale.h>
  32. #endif
  33.  
  34. #endif  /* !__STDC__ */
  35.  
  36. #endif  /* __OS2__ */
  37.  
  38. #ifndef _SIZE_T
  39. #define _SIZE_T
  40. typedef unsigned size_t;
  41. #endif
  42.  
  43. #if !defined(__FLAT__)
  44.  
  45. #ifdef __cplusplus
  46. extern "C" {
  47. #endif
  48. int         _RTLENTRY  _EXPFUNC memcmp(const void _FAR *__s1,
  49.                           const void _FAR *__s2, size_t __n);
  50. void _FAR * _RTLENTRY  _EXPFUNC memcpy(void _FAR *__dest, const void _FAR *__src,
  51.                           size_t __n);
  52. void _FAR * _RTLENTRYF _EXPFUNC memmove(void _FAR *__dest, const void _FAR *__src,
  53.                            size_t __n);
  54. void _FAR * _RTLENTRYF _EXPFUNC memset(void _FAR *__s, int __c, size_t __n);
  55. char _FAR * _RTLENTRYF _EXPFUNC strcat(char _FAR *__dest, const char _FAR *__src);
  56. int         _RTLENTRYF _EXPFUNC strcmp(const char _FAR *__s1, const char _FAR *__s2);
  57. int         _RTLENTRYF  strcoll(const char _FAR *__s1, const char _FAR *__s2);
  58. int         _RTLENTRYF _EXPFUNC _lstrcoll(const char _FAR *__s1, const char _FAR *__s2);
  59. char _FAR * _RTLENTRYF _EXPFUNC strcpy(char _FAR *__dest, const char _FAR *__src);
  60. size_t      _RTLENTRY  _EXPFUNC strcspn(const char _FAR *__s1, const char _FAR *__s2);
  61. char _FAR * _RTLENTRY  _EXPFUNC strerror(int __errnum);
  62. size_t      _RTLENTRYF _EXPFUNC strlen(const char _FAR *__s);
  63. char _FAR * _RTLENTRYF _EXPFUNC strncat(char _FAR *__dest, const char _FAR *__src,
  64.                         size_t __maxlen);
  65. int         _RTLENTRYF _EXPFUNC strncmp(const char _FAR *__s1, const char _FAR *__s2,
  66.                         size_t __maxlen);
  67. char _FAR * _RTLENTRYF _EXPFUNC strncpy(char _FAR *__dest, const char _FAR *__src,
  68.                            size_t __maxlen);
  69. size_t      _RTLENTRY  _EXPFUNC strspn(const char _FAR *__s1, const char _FAR *__s2);
  70. char _FAR * _RTLENTRYF _EXPFUNC strtok(char _FAR *__s1, const char _FAR *__s2);
  71. size_t      _RTLENTRYF strxfrm(char _FAR *__s1, const char _FAR *__s2,
  72.                         size_t __n );
  73. size_t      _RTLENTRYF _EXPFUNC _lstrxfrm(char _FAR *__s1, const char _FAR *__s2,
  74.                         size_t __n );
  75. char _FAR * _RTLENTRY  _EXPFUNC _strerror(const char _FAR *__s);
  76.  
  77.  
  78. #if !__STDC__
  79. /* compatibility with other compilers */
  80. #define strcmpi(s1,s2)      stricmp(s1,s2)
  81. #define strncmpi(s1,s2,n)   strnicmp(s1,s2,n)
  82.  
  83. void _FAR * _RTLENTRY  _EXPFUNC memccpy(void _FAR *__dest, const void _FAR *__src,
  84.                         int __c, size_t __n);
  85. int         _RTLENTRY  _EXPFUNC memicmp(const void _FAR *__s1, const void _FAR *__s2,
  86.                            size_t __n);
  87. void        _RTLENTRY  _EXPFUNC movedata(unsigned __srcseg,unsigned __srcoff,
  88.                             unsigned __dstseg,unsigned __dstoff, size_t __n);
  89. char _FAR * _RTLENTRYF stpcpy(char _FAR *__dest, const char _FAR *__src);
  90. char _FAR * _RTLENTRY  _stpcpy(char _FAR *__dest, const char _FAR *__src);
  91. char _FAR * _RTLENTRY  _EXPFUNC strdup(const char _FAR *__s);
  92. int         _RTLENTRYF _EXPFUNC stricmp(const char _FAR *__s1, const char _FAR *__s2);
  93. char _FAR * _RTLENTRYF _EXPFUNC strlwr(char _FAR *__s);
  94. char _FAR * _RTLENTRYF _EXPFUNC _lstrlwr(char _FAR *__s);
  95. int         _RTLENTRYF _EXPFUNC strnicmp(const char _FAR *__s1, const char _FAR *__s2,
  96.                         size_t __maxlen);
  97. char _FAR * _RTLENTRY  _EXPFUNC strnset(char _FAR *__s, int __ch, size_t __n);
  98. char _FAR * _RTLENTRY  _EXPFUNC strrev(char _FAR *__s);
  99. char _FAR * _RTLENTRY  _EXPFUNC strset(char _FAR *__s, int __ch);
  100. char _FAR * _RTLENTRYF _EXPFUNC strupr(char _FAR *__s);
  101. char _FAR * _RTLENTRYF _EXPFUNC _lstrupr(char _FAR *__s);
  102.  
  103. void  far * _RTLENTRY _FARCALL _fmemccpy(void far *__dest, const void far *__src,
  104.                         int c, size_t __n);
  105. void  far * _RTLENTRY _FARCALL _fmemchr(const void far *__s, int c, size_t __n);
  106. int         _RTLENTRY _FARCALL _fmemcmp(const void far *__s1, const void far *__s2,
  107.                         size_t __n);
  108. void  far * _RTLENTRY _FARCALL _fmemcpy(void far *__dest, const void far *__src,
  109.                         size_t __n);
  110. int         _RTLENTRY _FARCALL _fmemicmp(const void far *__s1, const void far *__s2,
  111.                         size_t __n);
  112. void  far * _RTLENTRY _FARCALL _fmemmove(void far *__dest, const void far *__src,
  113.                         size_t __n);
  114. void  far * _RTLENTRY _FARCALL _fmemset(void far *__s, int c, size_t __n);
  115. void        _RTLENTRY _FARCALL _fmovmem(const void far *__src, void far *__dest,
  116.                         unsigned __length);
  117. void        _RTLENTRY _FARCALL _fsetmem(void far *__dest,unsigned __length,
  118.                         char __value);
  119.  
  120. char  far * _RTLENTRY _FARCALL _fstrcat(char far *__dest, const char far *__src);
  121. char  far * _RTLENTRY _FARCALL _fstrchr(const char far *__s, int c);
  122. int         _RTLENTRY _FARCALL _fstrcmp(const char far *__s1, const char far *__s2);
  123. char  far * _RTLENTRY _FARCALL _fstrcpy(char far *__dest, const char far *__src);
  124. size_t      _RTLENTRY _FARCALL _fstrcspn(const char far *__s1, const char far *__s2);
  125. char  far * _RTLENTRY _FARCALL _fstrdup(const char far *__s);
  126. int         _RTLENTRY _FARCALL _fstricmp(const char far *__s1, const char far *__s2);
  127. size_t      _RTLENTRY _FARCALL _fstrlen(const char far *__s);
  128. char  far * _RTLENTRY _FARCALL _fstrlwr(char far *__s);
  129. char  far * _RTLENTRY _FARCALL _fstrncat(char far *__dest, const char far *__src,
  130.              size_t maxlen);
  131. int         _RTLENTRY _FARCALL _fstrncmp(const char far *__s1, const char far *__s2,
  132.              size_t maxlen);
  133. char  far * _RTLENTRY _FARCALL _fstrncpy(char far *__dest, const char far *__src,
  134.              size_t maxlen);
  135. int         _RTLENTRY _FARCALL _fstrnicmp(const char far *__s1, const char far *__s2,
  136.               size_t maxlen);
  137. char  far * _RTLENTRY _FARCALL _fstrnset(char far *__s, int ch, size_t __n);
  138. char  far * _RTLENTRY _FARCALL _fstrpbrk(const char far *__s1, const char far *__s2);
  139. char  far * _RTLENTRY _FARCALL _fstrrchr(const char far *__s, int c);
  140. char  far * _RTLENTRY _FARCALL _fstrrev(char far *__s);
  141. char  far * _RTLENTRY _FARCALL _fstrset(char far *__s, int ch);
  142. size_t      _RTLENTRY _FARCALL _fstrspn(const char far *__s1, const char far *__s2);
  143. char  far * _RTLENTRY _FARCALL _fstrstr(const char far *__s1, const char far *__s2);
  144. char  far * _RTLENTRY _FARCALL _fstrtok(char far *__s1, const char far *__s2);
  145. char  far * _RTLENTRY _FARCALL _fstrupr(char far *__s);
  146.  
  147.  
  148. #ifdef __MSC
  149. #define _stricmp(s1,s2) stricmp(s1,s2)
  150. #define _strdup(s1)     strdup(s1)
  151. #define _strupr(s1)     strupr(s1)
  152. #define _strlwr(s1)     strlwr(s1)
  153. #define _strrev(s1)     strrev(s1)
  154. #endif
  155.  
  156. #endif  /* ! __STDC__ */
  157.  
  158. #ifdef __cplusplus
  159. }
  160. #endif
  161.  
  162. #if defined( __USELOCALES__ )
  163.  
  164. #define  strupr   _lstrupr
  165. #define  strlwr   _lstrlwr
  166. #define  _fstrupr _lstrupr
  167. #define  _fstrlwr _lstrlwr
  168. #define  strcoll  _lstrcoll
  169. #define  strxfrm  _lstrxfrm
  170.  
  171. #endif
  172.  
  173. #else    /* defined __FLAT__ */
  174.  
  175. #ifdef __cplusplus
  176. extern "C" {
  177. #endif
  178. int    _RTLENTRY  _EXPFUNC memcmp(const void * __s1,
  179.                                   const void * __s2, size_t __n);
  180. void * _RTLENTRY  _EXPFUNC memcpy(void * __dest, const void * __src,
  181.                                   size_t __n);
  182. void * _RTLENTRYF _EXPFUNC memmove(void * __dest, const void * __src,
  183.                                    size_t __n);
  184. void * _RTLENTRYF _EXPFUNC memset(void * __s, int __c, size_t __n);
  185. char * _RTLENTRYF _EXPFUNC strcat(char * __dest, const char * __src);
  186. int    _RTLENTRYF _EXPFUNC strcmp(const char * __s1, const char * __s2);
  187. int    _RTLENTRY  _EXPFUNC strcoll(const char * __s1, const char * __s2);
  188. int    _RTLENTRY  _EXPFUNC _lstrcoll(const char * __s1, const char * __s2);
  189. char * _RTLENTRYF _EXPFUNC strcpy(char * __dest, const char * __src);
  190. size_t _RTLENTRY  _EXPFUNC strcspn(const char * __s1, const char * __s2);
  191. char * _RTLENTRY  _EXPFUNC strerror(int __errnum);
  192. size_t _RTLENTRYF _EXPFUNC strlen(const char * __s);
  193. char * _RTLENTRYF _EXPFUNC strncat(char * __dest, const char * __src,
  194.                                    size_t __maxlen);
  195. int    _RTLENTRYF _EXPFUNC strncmp(const char * __s1, const char * __s2,
  196.                                    size_t __maxlen);
  197. char * _RTLENTRYF _EXPFUNC strncpy(char * __dest, const char * __src,
  198.                                    size_t __maxlen);
  199. size_t _RTLENTRY  _EXPFUNC strspn(const char * __s1, const char * __s2);
  200. char * _RTLENTRYF _EXPFUNC strtok(char * __s1, const char * __s2);
  201. size_t _RTLENTRY  _EXPFUNC strxfrm(char * __s1, const char * __s2,
  202.                                    size_t __n );
  203. size_t _RTLENTRY  _EXPFUNC _lstrxfrm(char * __s1, const char * __s2,
  204.                                    size_t __n );
  205. char * _RTLENTRY  _EXPFUNC _strerror(const char * __s);
  206.  
  207.  
  208. #if !__STDC__
  209. /* compatibility with other compilers */
  210. #define strcmpi(s1,s2)      stricmp(s1,s2)
  211. #define strncmpi(s1,s2,n)   strnicmp(s1,s2,n)
  212.  
  213. void * _RTLENTRY _EXPFUNC memccpy(void * __dest, const void * __src,
  214.                                   int __c, size_t __n);
  215. int    _RTLENTRY _EXPFUNC memicmp(const void * __s1, const void * __s2,
  216.                                   size_t __n);
  217. char * _RTLENTRYF _EXPFUNC stpcpy(char * __dest, const char * __src);
  218. char * _RTLENTRY  _EXPFUNC _stpcpy(char * __dest, const char * __src);
  219. char * _RTLENTRY  _EXPFUNC strdup(const char * __s);
  220. int    _RTLENTRYF _EXPFUNC stricmp(const char * __s1, const char * __s2);
  221. char * _RTLENTRYF _EXPFUNC strlwr(char * __s);
  222. char * _RTLENTRYF _EXPFUNC _lstrlwr(char * __s);
  223. int    _RTLENTRYF _EXPFUNC strnicmp(const char * __s1, const char * __s2,
  224.                                     size_t __maxlen);
  225. char * _RTLENTRY  _EXPFUNC strnset(char * __s, int __ch, size_t __n);
  226. char * _RTLENTRY  _EXPFUNC strrev(char * __s);
  227. char * _RTLENTRY  _EXPFUNC strset(char * __s, int __ch);
  228. char * _RTLENTRYF _EXPFUNC strupr(char * __s);
  229. char * _RTLENTRYF _EXPFUNC _lstrupr(char * __s);
  230.  
  231. #endif  /* ! __STDC__ */
  232.  
  233. #ifdef __cplusplus
  234. }
  235. #endif
  236.  
  237. #if defined( __USELOCALES__ )
  238.  
  239. #define  strupr   _lstrupr
  240. #define  strlwr   _lstrlwr
  241. #define  _fstrupr _lstrupr
  242. #define  _fstrlwr _lstrlwr
  243. #define  strcoll  _lstrcoll
  244. #define  strxfrm  _lstrxfrm
  245.  
  246. #endif
  247.  
  248. #endif  /* __FLAT__ */
  249.  
  250. #if defined(__cplusplus)
  251. extern "C++" {
  252.       void _FAR * _RTLENTRY  _EXPFUNC32 memchr(void _FAR *__s, int __c, size_t __n);
  253. const void _FAR * _RTLENTRY  _EXPFUNC32 memchr(const void _FAR *__s, int __c, size_t __n);
  254.       char _FAR * _RTLENTRYF _EXPFUNC   strchr(char _FAR * __s, int __c);
  255. const char _FAR * _RTLENTRYF _EXPFUNC   strchr(const char _FAR * __s, int __c);
  256.       char _FAR * _RTLENTRYF _EXPFUNC   strrchr(char _FAR *__s, int __c);
  257. const char _FAR * _RTLENTRYF _EXPFUNC   strrchr(const char _FAR *__s, int __c);
  258.       char _FAR * _RTLENTRYF _EXPFUNC   strpbrk(char _FAR *__s1, const char _FAR *__s2);
  259. const char _FAR * _RTLENTRYF _EXPFUNC   strpbrk(const char _FAR *__s1, const char _FAR *__s2);
  260.       char _FAR * _RTLENTRY  _EXPFUNC   strstr(char _FAR *__s1, const char _FAR *__s2);
  261. const char _FAR * _RTLENTRY  _EXPFUNC   strstr(const char _FAR *__s1, const char _FAR *__s2);
  262. }
  263. #else
  264. void _FAR * _RTLENTRY  _EXPFUNC32 memchr(const void _FAR *__s, int __c, size_t __n);
  265. char _FAR * _RTLENTRYF _EXPFUNC   strchr(const char _FAR * __s, int __c);
  266. char _FAR * _RTLENTRYF _EXPFUNC   strrchr(const char _FAR *__s, int __c);
  267. char _FAR * _RTLENTRYF _EXPFUNC   strpbrk(const char _FAR *__s1, const char _FAR *__s2);
  268. char _FAR * _RTLENTRY  _EXPFUNC   strstr(const char _FAR *__s1, const char _FAR *__s2);
  269. #endif
  270.  
  271. #ifdef __cplusplus
  272. extern "C" {
  273. #endif
  274.  
  275. /* Intrinsic functions */
  276.  
  277. #if !defined(__MEM_H)
  278. void _FAR * _RTLENTRY  _EXPFUNC16 __memchr__  (const void _FAR *__s, int __c, size_t __n);
  279. int         _RTLENTRY  _EXPFUNC16 __memcmp__(const void _FAR *__s1,
  280.                                     const void _FAR *__s2, size_t __n);
  281. void _FAR * _RTLENTRY  _EXPFUNC16 __memcpy__(void _FAR *__dest, const void _FAR *__src,
  282.                                     size_t __n);
  283. void _FAR * _RTLENTRYF _EXPFUNC16 __memset__(void _FAR *__s, int __c, size_t __n);
  284. #endif
  285.  
  286. char _FAR * _RTLENTRY             __stpcpy__(char _FAR *__dest, const char _FAR *__src);
  287. char _FAR * _RTLENTRYF _EXPFUNC16 __strcat__(char _FAR *__dest, const char _FAR *__src);
  288. char _FAR * _RTLENTRY  _EXPFUNC16 __strchr__(const char _FAR *__s, int __c);
  289. int         _RTLENTRYF _EXPFUNC16 __strcmp__(const char _FAR *__s1, const char _FAR *__s2);
  290. char _FAR * _RTLENTRYF _EXPFUNC16 __strcpy__(char _FAR *__dest, const char _FAR *__src);
  291. size_t      _RTLENTRYF _EXPFUNC16 __strlen__(const char _FAR *__s);
  292. char _FAR * _RTLENTRY  _EXPFUNC16 __strncat__(char _FAR *__dest, const char _FAR *__src,
  293.                                     size_t __maxlen);
  294. int         _RTLENTRY  _EXPFUNC16 __strncmp__(const char _FAR *__s1, const char _FAR *__s2,
  295.                                     size_t __maxlen);
  296. char _FAR * _RTLENTRYF _EXPFUNC16 __strncpy__(char _FAR *__dest, const char _FAR *__src,
  297.                                     size_t __maxlen);
  298. char _FAR * _RTLENTRY  _EXPFUNC16 __strnset__(char _FAR *__s, int __ch, size_t __n);
  299. char _FAR * _RTLENTRYF _EXPFUNC16 __strrchr__(const char _FAR *__s, int __c);
  300. char _FAR * _RTLENTRY  _EXPFUNC16 __strset__(char _FAR *__s, int __ch);
  301.  
  302. #ifdef __cplusplus
  303. }
  304. #endif
  305.  
  306. #endif  /* __STRING_H */
  307.