source: trunk/include/string.h@ 2244

Last change on this file since 2244 was 2071, checked in by sandervl, 26 years ago

Removed odincrt dependency

File size: 11.1 KB
Line 
1#if (defined(__IBMC__) || defined(__IBMCPP__))
2#pragma info( none )
3#ifndef __CHKHDR__
4 #pragma info( none )
5#endif
6#pragma info( restore )
7#endif
8
9#ifndef __string_h
10 #define __string_h
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 #ifndef _LNK_CONV
17 #ifdef _M_I386
18 #define _LNK_CONV _Optlink
19 #else
20 #define _LNK_CONV
21 #endif
22 #endif
23
24 #ifndef _IMPORT
25 #ifdef __IMPORTLIB__
26 #define _IMPORT _Import
27 #else
28 #define _IMPORT
29 #endif
30 #endif
31
32 #ifndef __size_t
33 #define __size_t
34 typedef unsigned int size_t;
35 #endif
36
37 #ifndef NULL
38 #if (defined(__EXTENDED__) || defined( __cplusplus ))
39 #define NULL 0
40 #else
41 #define NULL ((void *)0)
42 #endif
43 #endif
44
45 #ifdef _M_I386
46 char * _Builtin __strcat( char *, const char * );
47 char * _Builtin __strchr( const char *, int );
48 int _Builtin __strcmp( const char *, const char * );
49 char * _Builtin __strcpy( char*, const char * );
50 size_t _Builtin __strlen( const char * );
51 char * _Builtin __strncat( char *, const char *, size_t );
52 int _Builtin __strncmp( const char *, const char *, size_t );
53#ifndef PE2LX
54 char * _LNK_CONV __strncpy( char *, const char *, size_t );
55#else
56 char * _Builtin __strncpy( char *, const char *, size_t );
57#endif
58 char * _Builtin __strrchr( const char *, int );
59 #endif
60
61 int _IMPORT _LNK_CONV strcoll( const char *, const char * );
62 size_t _IMPORT _LNK_CONV strcspn( const char *, const char * );
63 char * _IMPORT _LNK_CONV strerror( int );
64 char * _IMPORT _LNK_CONV strpbrk( const char *, const char * );
65 size_t _IMPORT _LNK_CONV strspn( const char *, const char * );
66 char * _IMPORT _LNK_CONV strstr( const char *, const char * );
67 char * _IMPORT _LNK_CONV strtok( char*, const char * );
68 size_t _IMPORT _LNK_CONV strxfrm( char *, const char *, size_t );
69
70 #ifdef _M_I386
71 #ifdef __cplusplus
72 inline char * _LNK_CONV strcat( char * s1, const char * s2 )
73 { return __strcat( s1, s2 ); }
74 inline char * _LNK_CONV strchr( const char * s, int ch )
75 { return __strchr( s, ch ); }
76 inline int _LNK_CONV strcmp( const char * s1, const char * s2 )
77 { return __strcmp( s1, s2 ); }
78 inline char * _LNK_CONV strcpy( char * s1, const char * s2 )
79 { return __strcpy( s1, s2 ); }
80 inline size_t _LNK_CONV strlen( const char * s )
81 { return __strlen( s ); }
82 inline char * _LNK_CONV strncat( char * s1, const char * s2, size_t len )
83 { return __strncat( s1, s2, len ); }
84 inline int _LNK_CONV strncmp( const char * s1, const char * s2, size_t len )
85 { return __strncmp( s1, s2, len ); }
86 inline char * _LNK_CONV strncpy( char * s1, const char * s2, size_t len )
87 { return __strncpy( s1, s2, len ); }
88 inline char * _LNK_CONV strrchr( const char * s1, int ch )
89 { return __strrchr( s1, ch ); }
90 #else
91 char * _IMPORT _LNK_CONV strcat( char *, const char * );
92 char * _IMPORT _LNK_CONV strchr( const char *, int );
93 int _IMPORT _LNK_CONV strcmp( const char *, const char * );
94 char * _IMPORT _LNK_CONV strcpy( char *, const char * );
95 size_t _IMPORT _LNK_CONV strlen( const char * );
96 char * _IMPORT _LNK_CONV strncat( char *, const char *, size_t );
97 int _IMPORT _LNK_CONV strncmp( const char *, const char *, size_t );
98 char * _IMPORT _LNK_CONV strncpy( char *, const char *, size_t );
99 char * _IMPORT _LNK_CONV strrchr( const char *, int );
100
101 #pragma info( none )
102 #define strcat( x, y ) __strcat( (x), (y) )
103 #define strchr( x, y ) __strchr( (x), (y) )
104 #define strcmp( x, y ) __strcmp( (x), (y) )
105 #define strcpy( x, y ) __strcpy( (x), (y) )
106 #define strlen( x ) __strlen( (x) )
107 #define strncat( x, y, z ) __strncat( (x), (y), (z) )
108 #define strncmp( x, y, z ) __strncmp( (x), (y), (z) )
109 #define strncpy( x, y, z ) __strncpy( (x), (y), (z) )
110 #define strrchr( x, y ) __strrchr( (x), (y) )
111 #pragma info( restore )
112 #endif
113 #endif
114
115#ifdef __THW_PPC__
116 char * strcat( char *, const char * );
117 char * strchr( const char *, int );
118 int strcmp( const char *, const char * );
119 char * strcpy( char *, const char * );
120 size_t strlen( const char * );
121 char * strncat( char *, const char *, size_t );
122 int strncmp( const char *, const char *, size_t );
123 char * strncpy( char *, const char *, size_t );
124 char * strrchr( const char *, int );
125#endif
126
127 #ifndef __memory_h
128 #define __memory_h
129
130 #ifdef _M_I386
131 void * _Builtin __memcpy( void *, const void *, size_t );
132 void * _Builtin __memchr( const void *, int, size_t );
133 int _Builtin __memcmp( const void *, const void *, size_t );
134 void * _Builtin __memset( void *, int, size_t );
135 void * _Builtin __memmove( void *, const void *, size_t );
136 #endif
137
138 #ifdef _M_I386
139 #ifdef __cplusplus
140 inline void * _LNK_CONV memcpy( void * m1, const void * m2, size_t len )
141 { return __memcpy( m1, m2, len ); }
142 inline void * _LNK_CONV memchr( const void * m, int ch, size_t len )
143 { return __memchr( m, ch, len ); }
144 inline int _LNK_CONV memcmp( const void * m1, const void * m2, size_t len )
145 { return __memcmp( m1, m2, len ); }
146 inline void * _LNK_CONV memset( void * m, int ch, size_t len )
147 { return __memset( m, ch, len ); }
148 inline void * _LNK_CONV memmove( void * m1, const void * m2, size_t len )
149 { return __memmove( m1, m2, len ); }
150 #else
151 void * _IMPORT _LNK_CONV memcpy( void *, const void *, size_t );
152 void * _IMPORT _LNK_CONV memchr( const void *, int, size_t );
153 int _IMPORT _LNK_CONV memcmp( const void *, const void *, size_t );
154 void * _IMPORT _LNK_CONV memset( void *, int, size_t );
155 void * _IMPORT _LNK_CONV memmove( void *, const void *, size_t );
156
157 #pragma info( none )
158 #define memcpy( x, y, z ) __memcpy( (x), (y), (z) )
159 #define memchr( x, y, z ) __memchr( (x), (y), (z) )
160 #define memcmp( x, y, z ) __memcmp( (x), (y), (z) )
161 #define memset( x, y, z ) __memset( (x), (y), (z) )
162 #define memmove( x, y, z ) __memmove( (x), (y), (z) )
163 #pragma info( restore )
164 #endif
165 #endif
166
167 #ifdef __THW_PPC__
168 void * memcpy( void *, const void *, size_t );
169 void * memchr( const void *, int, size_t );
170 int memcmp( const void *, const void *, size_t );
171 void * memset( void *, int, size_t );
172 void * memmove( void *, const void *, size_t );
173 #endif
174
175 #if defined( __EXTENDED__ )
176
177 void * _IMPORT _LNK_CONV memccpy( void *, void *, int, unsigned int );
178 int _IMPORT _LNK_CONV memicmp( void *, void *, unsigned int );
179
180 #define _fmemcpy( x, y, z ) memcpy( (x), (y), (z) )
181 #define _fmemchr( x, y, z ) memchr( (x), (y), (z) )
182 #define _fmemcmp( x, y, z ) memcmp( (x), (y), (z) )
183 #define _fmemset( x, y, z ) memset( (x), (y), (z) )
184 #define _fmemccpy( w, x, y, z ) memccpy( (w), (x), (y), (z) )
185 #define _fmemicmp( x, y, z ) memicmp( (x), (y), (z) )
186
187 #endif
188
189 #endif
190
191 #if (defined(__EXTENDED__) || defined(__MW_EXT_ANSI__))
192
193 char * _IMPORT _LNK_CONV strdup( const char * );
194 int _IMPORT _LNK_CONV stricmp( const char *, const char * );
195 char * _IMPORT _LNK_CONV strlwr( char * );
196 int _IMPORT _LNK_CONV strnicmp( const char *, const char *, size_t );
197 char * _IMPORT _LNK_CONV strupr( char * );
198
199 int _IMPORT _LNK_CONV strcmpi( const char *, const char * );
200 char * _IMPORT _LNK_CONV strrev( char * );
201 char * _IMPORT _LNK_CONV strset( char *, int );
202 char * _IMPORT _LNK_CONV strnset( char *, int, size_t );
203 char * _IMPORT _LNK_CONV _strerror( char * );
204
205 #define _fmemmove( x, y, z ) memmove( (x), (y), (z) )
206 #define _fstrcat( x, y ) strcat( (x), (y) )
207 #define _fstrchr( x, y ) strchr( (x), (y) )
208 #define _fstrcmp( x, y ) strcmp( (x), (y) )
209 #define _fstrcpy( x, y ) strcpy( (x), (y) )
210 #define _fstrlen( x ) strlen( (x) )
211 #define _fstrncat( x, y, z ) strncat( (x), (y), (z) )
212 #define _fstrncmp( x, y, z ) strncmp( (x), (y), (z) )
213 #define _fstrncpy( x, y, z ) strncpy( (x), (y), (z) )
214 #define _fstrrchr( x, y ) strrchr( (x), (y) )
215
216 size_t _IMPORT _LNK_CONV _fstrcspn( const char *, const char * );
217 char * _IMPORT _LNK_CONV _fstrdup( const char * );
218 char * _IMPORT _LNK_CONV _nstrdup( const char * );
219 int _IMPORT _LNK_CONV _fstricmp( const char *, const char * );
220 char * _IMPORT _LNK_CONV _fstrlwr( char * );
221 int _IMPORT _LNK_CONV _fstrnicmp( const char *, const char *, size_t );
222 char * _IMPORT _LNK_CONV _fstrnset( char *, int, size_t );
223 char * _IMPORT _LNK_CONV _fstrpbrk( const char *, const char * );
224 char * _IMPORT _LNK_CONV _fstrrev( char * );
225 char * _IMPORT _LNK_CONV _fstrset( char *, int );
226 size_t _IMPORT _LNK_CONV _fstrspn( const char *, const char * );
227 char * _IMPORT _LNK_CONV _fstrstr( const char *, const char * );
228 char * _IMPORT _LNK_CONV _fstrtok( char*, const char * );
229 char * _IMPORT _LNK_CONV _fstrupr( char * );
230
231 #if (defined(__IBMC__) || defined(__IBMCPP__))
232 #pragma map( _fstrcspn , "strcspn" )
233 #pragma map( _fstrdup , "strdup" )
234 #pragma map( _nstrdup , "strdup" )
235 #pragma map( _fstricmp , "stricmp" )
236 #pragma map( _fstrlwr , "strlwr" )
237 #pragma map( _fstrnicmp, "strnicmp" )
238 #pragma map( _fstrnset , "strnset" )
239 #pragma map( _fstrpbrk , "strpbrk" )
240 #pragma map( _fstrrev , "strrev" )
241 #pragma map( _fstrset , "strset" )
242 #pragma map( _fstrspn , "strspn" )
243 #pragma map( _fstrstr , "strstr" )
244 #pragma map( _fstrtok , "strtok" )
245 #pragma map( _fstrupr , "strupr" )
246 #else
247 #pragma Alias( _fstrcspn , "strcspn" )
248 #pragma Alias( _fstrdup , "strdup" )
249 #pragma Alias( _nstrdup , "strdup" )
250 #pragma Alias( _fstricmp , "stricmp" )
251 #pragma Alias( _fstrlwr , "strlwr" )
252 #pragma Alias( _fstrnicmp, "strnicmp" )
253 #pragma Alias( _fstrnset , "strnset" )
254 #pragma Alias( _fstrpbrk , "strpbrk" )
255 #pragma Alias( _fstrrev , "strrev" )
256 #pragma Alias( _fstrset , "strset" )
257 #pragma Alias( _fstrspn , "strspn" )
258 #pragma Alias( _fstrstr , "strstr" )
259 #pragma Alias( _fstrtok , "strtok" )
260 #pragma Alias( _fstrupr , "strupr" )
261 #endif
262
263 #endif
264
265 #ifdef __cplusplus
266 }
267 #endif
268
269#endif
270
271#if (defined(__IBMC__) || defined(__IBMCPP__))
272#pragma info( none )
273#ifndef __CHKHDR__
274 #pragma info( restore )
275#endif
276#pragma info( restore )
277#endif
Note: See TracBrowser for help on using the repository browser.