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