home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2001 May / SGI Freeware 2001 May - Disc 1.iso / dist / fw_mysql.idb / usr / freeware / include / mysql / m_string.h.z / m_string.h
Encoding:
C/C++ Source or Header  |  1999-10-18  |  5.9 KB  |  206 lines

  1. /* Copyright (C) 1996  TCX DataKonsult AB & Monty Program KB & Detron HB
  2.    For a more info consult the file COPYRIGHT distributed with this file */
  3.  
  4. /* There may be prolems include all of theese. Try to test in
  5.    configure with ones are needed? */
  6.  
  7. /*  This is needed for the definitions of strchr... on solaris */
  8.  
  9. #ifndef _m_string_h
  10. #define _m_string_h
  11. #if defined(HAVE_STRING_H)
  12. #include <string.h>
  13. #endif
  14.  
  15. /* Correct some things for UNIXWARE7 */
  16. #ifdef HAVE_UNIXWARE7_THREADS
  17. #undef HAVE_STRINGS_H
  18. #undef HAVE_MEMORY_H
  19. #define HAVE_MEMCPY
  20. #ifndef HAVE_MEMMOVE
  21. #define HAVE_MEMMOVE
  22. #endif
  23. #undef HAVE_BCMP
  24. #undef bcopy
  25. #undef bcmp
  26. #undef bzero
  27. #endif /* HAVE_UNIXWARE7_THREADS */
  28. #ifdef _AIX
  29. #undef HAVE_BCMP
  30. #endif
  31.  
  32. /*  This is needed for the definitions of bzero... on solaris */
  33. #if defined(HAVE_STRINGS_H) && !defined(HAVE_mit_thread)
  34. #include <strings.h>
  35. #endif
  36.  
  37. /*  This is needed for the definitions of memcpy... on solaris */
  38. #if defined(HAVE_MEMORY_H) && !defined(__cplusplus)
  39. #include <memory.h>
  40. #endif
  41.  
  42. #if !defined(HAVE_MEMCPY) && !defined(HAVE_MEMMOVE)
  43. # define memcpy(d, s, n)    bcopy ((s), (d), (n))
  44. # define memset(A,C,B)        bfill((A),(B),(C))
  45. # define memmove(d, s, n)    bmove ((s), (d), (n))
  46. #elif defined(HAVE_MEMMOVE)
  47. # define bmove(d, s, n)        memmove((d), (s), (n))
  48. #else
  49. # define memmove(d, s, n)    bmove((d), (s), (n)) /* our bmove */
  50. #endif
  51.  
  52. /* Unixware 7 */
  53. #if !defined(HAVE_BFILL)
  54. # define bfill(A,B,C)           memset((A),(C),(B))
  55. # define bmove_allign(A,B,C)    memcpy((A),(B),(C))
  56. #endif
  57.  
  58. #if !defined(HAVE_BCMP)
  59. # define bcopy(s, d, n)        memcpy((d), (s), (n))
  60. # define bcmp(A,B,C)        memcmp((A),(B),(C))
  61. # define bzero(A,B)        memset((A),0,(B))
  62. # define bmove_allign(A,B,C)    memcpy((A),(B),(C))
  63. #endif
  64.  
  65. #ifdef    __cplusplus
  66. extern "C" {
  67. #endif
  68.  
  69. extern char NEAR _dig_vec[];        /* Declared in int2str() */
  70.  
  71. #ifdef BAD_STRING_COMPILER
  72. #define strmov(A,B)  (memccpy(A,B,0,INT_MAX)-1)
  73. #else
  74. #define strmov_overlapp(A,B) strmov(A,B)
  75. #define strmake_overlapp(A,B,C) strmake(A,B,C)
  76. #endif
  77.  
  78. #ifdef MSDOS
  79. #undef bmove_allign
  80. #define bmove512(A,B,C) bmove_allign(A,B,C)
  81. #define my_itoa(A,B,C) itoa(A,B,C)
  82. #define my_ltoa(A,B,C) ltoa(A,B,C)
  83. extern    void bmove_allign(gptr dst,const gptr src,uint len);
  84. #endif
  85.  
  86. #if (!defined(USE_BMOVE512) || defined(HAVE_purify)) && !defined(bmove512)
  87. #define bmove512(A,B,C) memcpy(A,B,C)
  88. #endif
  89.  
  90.     /* Prototypes for string functions */
  91.  
  92. #if !defined(bfill) && !defined(HAVE_BFILL)
  93. extern    void bfill(gptr dst,uint len,pchar fill);
  94. #endif
  95.  
  96. #if !defined(bzero) && !defined(HAVE_BZERO)
  97. extern    void bzero(gptr dst,uint len);
  98. #endif
  99.  
  100. #if !defined(bcmp) && !defined(HAVE_BCMP)
  101. extern    int bcmp(const char *s1,const char *s2,uint len);
  102. #ifdef HAVE_purify
  103. extern    int my_bcmp(const char *s1,const char *s2,uint len);
  104. #define bcmp(A,B,C) my_bcmp((A),(B),(C))
  105. #endif
  106. #endif
  107.  
  108. #ifndef bmove512
  109. extern    void bmove512(gptr dst,const gptr src,uint len);
  110. #endif
  111.  
  112. #if !defined(HAVE_BMOVE) && !defined(bmove)
  113. extern    void bmove(gptr dst,const char *src,uint len);
  114. #endif
  115.  
  116. extern    void bmove_upp(char *dst,const char *src,uint len);
  117. extern    void bchange(char *dst,uint old_len,const char *src,
  118.              uint new_len,uint tot_len);
  119. extern    void strappend(char *s,uint len,pchar fill);
  120. extern    char *strend(const char *s);
  121. extern char *strcend(const char *, pchar);
  122. extern    char *strfield(char *src,int fields,int chars,int blanks,
  123.                int tabch);
  124. extern    char *strfill(my_string s,uint len,pchar fill);
  125. extern    uint strinstr(const char *str,const char *search);
  126. extern    char *strkey(char *dst,char *head,char *tail,char *flags);
  127. extern    char *strmake(char *dst,const char *src,uint length);
  128. #ifndef strmake_overlapp
  129. extern    char *strmake_overlapp(char *dst,const char *src, uint length);
  130. #endif
  131.  
  132. #ifndef strmov
  133. extern    char *strmov(char *dst,const char *src);
  134. #endif
  135. extern    uint strnlen(const char *s,uint n);
  136. extern    char *strnmov(char *dst,const char *src,uint n);
  137. extern    char *strsuff(const char *src,const char *suffix);
  138. extern    char *strcont(const char *src,const char *set);
  139. extern    char *strxcat _VARARGS((char *dst,const char *src, ...));
  140. extern    char *strxmov _VARARGS((char *dst,const char *src, ...));
  141. extern    char *strxcpy _VARARGS((char *dst,const char *src, ...));
  142. extern    char *strxncat _VARARGS((char *dst,uint len, const char *src, ...));
  143. extern    char *strxnmov _VARARGS((char *dst,uint len, const char *src, ...));
  144. extern    char *strxncpy _VARARGS((char *dst,uint len, const char *src, ...));
  145.  
  146. /* Prototypes of normal stringfunctions (with may ours) */
  147.  
  148. #ifdef WANT_STRING_PROTOTYPES
  149. extern char *strcat(char *, const char *);
  150. extern char *strchr(const char *, pchar);
  151. extern char *strrchr(const char *, pchar);
  152. extern char *strcpy(char *, const char *);
  153. extern int strcmp(const char *, const char *);
  154. #ifndef __GNUC__
  155. extern size_t strlen(const char *);
  156. #endif
  157. #endif
  158.  
  159. #if !defined(__cplusplus)
  160. #ifndef HAVE_STRPBRK
  161. extern char *strpbrk(const char *, const char *);
  162. #endif
  163. #ifndef HAVE_STRSTR
  164. extern char *strstr(const char *, const char *);
  165. #endif
  166. #endif
  167. extern qsort_cmp get_ptr_compare(uint);
  168. extern int is_prefix(const char *, const char *);
  169.  
  170. /* Conversion rutins */
  171.  
  172. #ifdef USE_MY_ITOA
  173. extern char *my_itoa(int val,char *dst,int radix);
  174. extern char *my_ltoa(long val,char *dst,int radix);
  175. #endif
  176.  
  177. #ifndef HAVE_STRTOUL
  178. extern long strtol(const char *str, char **ptr, int base);
  179. extern ulong strtoul(const char *str, char **ptr, int base);
  180. #endif
  181.  
  182. extern char *int2str(long val,char *dst,int radix);
  183. extern char *str2int(const char *src,int radix,long lower,long upper,
  184.              long *val);
  185. #if SIZEOF_LONG == SIZEOF_LONG_LONG
  186. #define longlong2str(A,B,C) int2str((A),(B),(C))
  187. #define strtoll(A,B,C) strtol((A),(B),(C))
  188. #define strtoull(A,B,C) strtoul((A),(B),(C))
  189. #ifndef HAVE_STRTOULL
  190. #define HAVE_STRTOULL
  191. #endif
  192. #else
  193. #ifdef HAVE_LONG_LONG
  194. extern char *longlong2str(longlong val,char *dst,int radix);
  195. #if !defined(HAVE_STRTOULL) || defined(HAVE_mit_thread)
  196. extern longlong strtoll(const char *str, char **ptr, int base);
  197. extern ulonglong strtoull(const char *str, char **ptr, int base);
  198. #endif
  199. #endif
  200. #endif
  201.  
  202. #ifdef    __cplusplus
  203. }
  204. #endif
  205. #endif
  206.