comparison packages/language/c/libc/string/current/include/stringsupp.hxx @ 115:6ed91473a1cd ecos-sw-2000-08-21

Merge from eCos master repository on 2000-08-21-22:40:54-BST
author jlarmour
date Fri, 25 Aug 2000 17:32:38 +0000
parents
children e0c0827131d1
comparison
equal deleted inserted replaced
114:5ad2b71d525e 115:6ed91473a1cd
1 #ifndef CYGONCE_LIBC_STRING_STRINGSUPP_HXX
2 #define CYGONCE_LIBC_STRING_STRINGSUPP_HXX
3 //===========================================================================
4 //
5 // stringsupp.hxx
6 //
7 // Support for the ANSI standard string functions
8 //
9 //===========================================================================
10 //####COPYRIGHTBEGIN####
11 //
12 // -------------------------------------------
13 // The contents of this file are subject to the Red Hat eCos Public License
14 // Version 1.1 (the "License"); you may not use this file except in
15 // compliance with the License. You may obtain a copy of the License at
16 // http://www.redhat.com/
17 //
18 // Software distributed under the License is distributed on an "AS IS"
19 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
20 // License for the specific language governing rights and limitations under
21 // the License.
22 //
23 // The Original Code is eCos - Embedded Configurable Operating System,
24 // released September 30, 1998.
25 //
26 // The Initial Developer of the Original Code is Red Hat.
27 // Portions created by Red Hat are
28 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
29 // All Rights Reserved.
30 // -------------------------------------------
31 //
32 //####COPYRIGHTEND####
33 //===========================================================================
34 //#####DESCRIPTIONBEGIN####
35 //
36 // Author(s): jlarmour
37 // Contributors: jlarmour
38 // Date: 2000-04-14
39 // Purpose: Internal support for the libc string function implementations
40 // Description:
41 // Usage:
42 //
43 //####DESCRIPTIONEND####
44 //
45 //===========================================================================
46
47 // CONFIGURATION
48
49 #include <pkgconf/libc_string.h> // Configuration header
50
51 // INCLUDES
52
53 #include <cyg/infra/cyg_type.h> // Common type definitions
54 #include <stddef.h> // Compiler definitions such as
55 // size_t, NULL etc.
56
57 // CONSTANTS
58
59 #ifndef CYGIMP_LIBC_STRING_PREFER_SMALL_TO_FAST
60
61 // Masks for CYG_LIBC_STR_DETECTNULL below
62 externC const cyg_uint64 Cyg_libc_str_null_mask_1;
63 externC const cyg_uint64 Cyg_libc_str_null_mask_2;
64
65 #endif
66
67 // MACROS
68
69 // Nonzero if X is not aligned on a word boundary.
70 #define CYG_LIBC_STR_UNALIGNED(X) ((CYG_WORD)(X) & (sizeof (CYG_WORD) - 1))
71
72 // Nonzero if either X or Y is not aligned on a word boundary.
73 #define CYG_LIBC_STR_UNALIGNED2(X , Y) \
74 (((CYG_WORD)(X) & (sizeof (CYG_WORD) - 1)) | \
75 ((CYG_WORD)(Y) & (sizeof (CYG_WORD) - 1)))
76
77 // Nonzero if any byte of X contains a NULL.
78 #define CYG_LIBC_STR_DETECTNULL(X) \
79 (((X) - (CYG_WORD)Cyg_libc_str_null_mask_1) & \
80 ~(X) & (CYG_WORD)Cyg_libc_str_null_mask_2)
81
82 // How many bytes are copied each iteration of the 4X unrolled loop in the
83 // optimised string implementations
84 #define CYG_LIBC_STR_OPT_BIGBLOCKSIZE (sizeof(CYG_WORD) << 2)
85
86 // How many bytes are copied each iteration of the word copy loop in the
87 // optimised string implementations
88 #define CYG_LIBC_STR_OPT_LITTLEBLOCKSIZE (sizeof (CYG_WORD))
89
90 // Threshold for punting to the byte copier in the optimised string
91 // implementations
92 #define CYG_LIBC_STR_OPT_TOO_SMALL(LEN) \
93 ((LEN) < CYG_LIBC_STR_OPT_LITTLEBLOCKSIZE)
94
95
96 // FUNCTION PROTOTYPES
97
98 // These are function prototypes for the aliased functions that actually
99 // implement the string functions
100
101 //===========================================================================
102
103 // 7.11.2 Copying functions
104
105 externC void *
106 __memmove( void *, const void *, size_t );
107
108
109 externC char *
110 __strcpy( char *, const char * );
111
112
113 externC char *
114 __strncpy( char *, const char *, size_t );
115
116
117 //===========================================================================
118
119 // 7.11.3 Concatenation functions
120
121
122 externC char *
123 __strcat( char *, const char * );
124
125
126 externC char *
127 __strncat( char *, const char *, size_t );
128
129
130 //===========================================================================
131
132 // 7.11.4 Comparison functions
133
134 externC int
135 __memcmp( const void *, const void *, size_t );
136
137
138 externC int
139 __strcmp( const char *, const char * );
140
141
142 externC int
143 __strcoll( const char *, const char * );
144
145
146 externC int
147 __strncmp( const char *, const char *, size_t );
148
149
150 externC size_t
151 __strxfrm( char *, const char *, size_t );
152
153
154 //===========================================================================
155
156 // 7.11.5 Search functions
157
158
159 externC void *
160 __memchr( const void *, int , size_t );
161
162
163 externC char *
164 __strchr( const char *, int );
165
166
167 externC size_t
168 __strcspn( const char *, const char * );
169
170
171 externC char *
172 __strpbrk( const char *, const char * );
173
174
175 externC char *
176 __strrchr( const char *, int );
177
178
179 externC size_t
180 __strspn( const char *, const char * );
181
182
183 externC char *
184 __strstr( const char *, const char * );
185
186
187 externC char *
188 __strtok( char *, const char * );
189
190 // For POSIX 1003.1 section 8.3.3 strtok_r()
191
192 externC char *
193 __strtok_r( char *, const char *, char ** );
194
195
196 //===========================================================================
197
198 // 7.11.6 Miscellaneous functions
199
200 externC size_t
201 __strlen( const char * );
202
203 #endif // CYGONCE_LIBC_STRING_STRINGSUPP_HXX multiple inclusion protection
204
205 // EOF stringsupp.hxx