source: SVN/cambria/redboot/packages/language/c/libc/string/current/include/stringsupp.hxx @ 1

Last change on this file since 1 was 1, checked in by Tim Harvey, 2 years ago

restored latest version of files from server backup

Signed-off-by: Tim Harvey <tharvey@…>

File size: 5.9 KB
Line 
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//####ECOSGPLCOPYRIGHTBEGIN####
11// -------------------------------------------
12// This file is part of eCos, the Embedded Configurable Operating System.
13// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
14//
15// eCos is free software; you can redistribute it and/or modify it under
16// the terms of the GNU General Public License as published by the Free
17// Software Foundation; either version 2 or (at your option) any later version.
18//
19// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
20// WARRANTY; without even the implied warranty of MERCHANTABILITY or
21// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
22// for more details.
23//
24// You should have received a copy of the GNU General Public License along
25// with eCos; if not, write to the Free Software Foundation, Inc.,
26// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
27//
28// As a special exception, if other files instantiate templates or use macros
29// or inline functions from this file, or you compile this file and link it
30// with other works to produce a work based on this file, this file does not
31// by itself cause the resulting work to be covered by the GNU General Public
32// License. However the source code for this file must still be made available
33// in accordance with section (3) of the GNU General Public License.
34//
35// This exception does not invalidate any other reasons why a work based on
36// this file might be covered by the GNU General Public License.
37//
38// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
39// at http://sources.redhat.com/ecos/ecos-license/
40// -------------------------------------------
41//####ECOSGPLCOPYRIGHTEND####
42//===========================================================================
43//#####DESCRIPTIONBEGIN####
44//
45// Author(s):     jlarmour
46// Contributors:  jlarmour
47// Date:          2000-04-14
48// Purpose:       Internal support for the libc string function implementations
49// Description:
50// Usage:       
51//
52//####DESCRIPTIONEND####
53//
54//===========================================================================
55
56// CONFIGURATION
57
58#include <pkgconf/libc_string.h>   // Configuration header
59
60// INCLUDES
61
62#include <cyg/infra/cyg_type.h> // Common type definitions
63#include <stddef.h>             // Compiler definitions such as
64                                // size_t, NULL etc.
65
66// CONSTANTS
67
68#ifndef CYGIMP_LIBC_STRING_PREFER_SMALL_TO_FAST
69
70// Masks for CYG_LIBC_STR_DETECTNULL below
71__externC const cyg_uint64 Cyg_libc_str_null_mask_1;
72__externC const cyg_uint64 Cyg_libc_str_null_mask_2;
73
74#endif
75
76// MACROS
77
78// Nonzero if X is not aligned on a word boundary.
79#define CYG_LIBC_STR_UNALIGNED(X) ((CYG_WORD)(X) & (sizeof (CYG_WORD) - 1))
80
81// Nonzero if either X or Y is not aligned on a word boundary.
82#define CYG_LIBC_STR_UNALIGNED2(X , Y) \
83    (((CYG_WORD)(X) & (sizeof (CYG_WORD) - 1)) | \
84     ((CYG_WORD)(Y) & (sizeof (CYG_WORD) - 1)))
85
86// Nonzero if any byte of X contains a NULL.
87#define CYG_LIBC_STR_DETECTNULL(X) \
88    (((X) - (CYG_WORD)Cyg_libc_str_null_mask_1) & \
89     ~(X) & (CYG_WORD)Cyg_libc_str_null_mask_2)
90
91// How many bytes are copied each iteration of the 4X unrolled loop in the
92// optimised string implementations
93#define CYG_LIBC_STR_OPT_BIGBLOCKSIZE     (sizeof(CYG_WORD) << 2)
94
95// How many bytes are copied each iteration of the word copy loop in the
96// optimised string implementations
97#define CYG_LIBC_STR_OPT_LITTLEBLOCKSIZE  (sizeof (CYG_WORD))
98
99// Threshold for punting to the byte copier in the optimised string
100// implementations
101#define CYG_LIBC_STR_OPT_TOO_SMALL(LEN) \
102    ((LEN) < CYG_LIBC_STR_OPT_LITTLEBLOCKSIZE)
103
104
105// FUNCTION PROTOTYPES
106
107// These are function prototypes for the aliased functions that actually
108// implement the string functions
109
110//===========================================================================
111
112// 7.11.2 Copying functions
113
114__externC void *
115__memmove( void *, const void *, size_t );
116
117
118__externC char *
119__strcpy( char *, const char * );
120
121
122__externC char *
123__strncpy( char *, const char *, size_t );
124
125
126//===========================================================================
127
128// 7.11.3 Concatenation functions
129
130
131__externC char *
132__strcat( char *, const char * );
133
134
135__externC char *
136__strncat( char *, const char *, size_t );
137
138
139//===========================================================================
140
141// 7.11.4 Comparison functions
142
143__externC int
144__memcmp( const void *, const void *, size_t );
145
146
147__externC int
148__strcmp( const char *, const char * );
149
150
151__externC int
152__strcoll( const char *, const char * );
153
154
155__externC int
156__strncmp( const char *, const char *, size_t );
157
158
159__externC size_t
160__strxfrm( char *, const char *, size_t );
161
162
163//===========================================================================
164
165// 7.11.5 Search functions
166
167
168__externC void *
169__memchr( const void *, int , size_t );
170
171
172__externC char *
173__strchr( const char *, int );
174
175
176__externC size_t
177__strcspn( const char *, const char * );
178
179
180__externC char *
181__strpbrk( const char *, const char * );
182
183
184__externC char *
185__strrchr( const char *, int );
186
187
188__externC size_t
189__strspn( const char *, const char * );
190
191
192__externC char *
193__strstr( const char *, const char * );
194
195
196__externC char *
197__strtok( char *, const char * );
198
199// For POSIX 1003.1 section 8.3.3 strtok_r()
200
201__externC char *
202__strtok_r( char *, const char *, char ** );
203
204
205//===========================================================================
206
207// 7.11.6 Miscellaneous functions
208
209__externC size_t
210__strlen( const char * );
211
212// NB This is a BSD function
213__externC char *
214__strdup( const char * );
215
216#endif // CYGONCE_LIBC_STRING_STRINGSUPP_HXX multiple inclusion protection
217
218// EOF stringsupp.hxx
Note: See TracBrowser for help on using the repository browser.