xref: /titanic_50/usr/src/head/iso/string_iso.h (revision 35a5a3587fd94b666239c157d3722745250ccbd7)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*	Copyright (c) 1988 AT&T	*/
23 /*	  All Rights Reserved  	*/
24 
25 
26 /*
27  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 
31 /*
32  * An application should not include this header directly.  Instead it
33  * should be included only through the inclusion of other Sun headers.
34  *
35  * The contents of this header is limited to identifiers specified in the
36  * C Standard.  Any new identifiers specified in future amendments to the
37  * C Standard must be placed in this header.  If these new identifiers
38  * are required to also be in the C++ Standard "std" namespace, then for
39  * anything other than macro definitions, corresponding "using" directives
40  * must also be added to <string.h>.
41  */
42 
43 #ifndef _ISO_STRING_ISO_H
44 #define	_ISO_STRING_ISO_H
45 
46 #pragma ident	"%Z%%M%	%I%	%E% SMI"
47 
48 #include <sys/feature_tests.h>
49 
50 #ifdef	__cplusplus
51 extern "C" {
52 #endif
53 
54 #if __cplusplus >= 199711L
55 namespace std {
56 #endif
57 
58 #if !defined(_SIZE_T) || __cplusplus >= 199711L
59 #define	_SIZE_T
60 #if defined(_LP64) || defined(_I32LPx)
61 typedef unsigned long	size_t;		/* size of something in bytes */
62 #else
63 typedef unsigned int	size_t;		/* (historical version) */
64 #endif
65 #endif	/* !_SIZE_T */
66 
67 #ifndef	NULL
68 #if defined(_LP64)
69 #define	NULL	0L
70 #else
71 #define	NULL	0
72 #endif
73 #endif
74 
75 #if defined(__STDC__)
76 
77 extern int memcmp(const void *, const void *, size_t);
78 extern void *memcpy(void *_RESTRICT_KYWD, const void *_RESTRICT_KYWD, size_t);
79 extern void *memmove(void *, const void *, size_t);
80 extern void *memset(void *, int, size_t);
81 extern char *strcat(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
82 extern int strcmp(const char *, const char *);
83 extern char *strcpy(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
84 extern int strcoll(const char *, const char *);
85 extern size_t strcspn(const char *, const char *);
86 extern char *strerror(int);
87 extern size_t strlen(const char *);
88 extern char *strncat(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t);
89 extern int strncmp(const char *, const char *, size_t);
90 extern char *strncpy(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t);
91 extern size_t strspn(const char *, const char *);
92 extern char *strtok(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
93 extern size_t strxfrm(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t);
94 
95 /*
96  * The C++ Standard (ISO/IEC 14882:1998) specifies that each of the
97  * function signatures for the following functions be replaced by
98  * two declarations, both of which have the same behavior.
99  */
100 #if __cplusplus >= 199711L
101 extern const void *memchr(const void *, int, size_t);
102 #ifndef	_MEMCHR_INLINE
103 #define	_MEMCHR_INLINE
104 extern "C++" {
105 	inline void *memchr(void * __s, int __c, size_t __n) {
106 		return (void *)memchr((const void *)__s, __c, __n);
107 	}
108 }
109 #endif  /* _MEMCHR_INLINE */
110 extern const char *strchr(const char *, int);
111 #ifndef _STRCHR_INLINE
112 #define	_STRCHR_INLINE
113 extern "C++" {
114 	inline char *strchr(char *__s, int __c) {
115 		return (char *)strchr((const char *)__s, __c);
116 	}
117 }
118 #endif	/* _STRCHR_INLINE */
119 extern const char *strpbrk(const char *, const char *);
120 #ifndef _STRPBRK_INLINE
121 #define	_STRPBRK_INLINE
122 extern "C++" {
123 	inline char *strpbrk(char *__s1, const char *__s2) {
124 		return (char *)strpbrk((const char *)__s1, __s2);
125 	}
126 }
127 #endif	/* _STRPBRK_INLINE */
128 extern const char *strrchr(const char *, int);
129 #ifndef _STRRCHR_INLINE
130 #define	_STRRCHR_INLINE
131 extern "C++" {
132 	inline char *strrchr(char *__s, int __c) {
133 		return (char *)strrchr((const char *)__s, __c);
134 	}
135 }
136 #endif	/* _STRRCHR_INLINE */
137 extern const char *strstr(const char *, const char *);
138 #ifndef _STRSTR_INLINE
139 #define	_STRSTR_INLINE
140 extern "C++" {
141 	inline char *strstr(char *__s1, const char *__s2) {
142 		return (char *)strstr((const char *)__s1, __s2);
143 	}
144 }
145 #endif	/* _STRSTR_INLINE */
146 #else /* __cplusplus >= 199711L */
147 extern void *memchr(const void *, int, size_t);
148 extern char *strchr(const char *, int);
149 extern char *strpbrk(const char *, const char *);
150 extern char *strrchr(const char *, int);
151 extern char *strstr(const char *, const char *);
152 #endif /* __cplusplus >= 199711L */
153 
154 #else	/* __STDC__ */
155 
156 extern void *memchr();
157 extern int memcmp();
158 extern void *memcpy();
159 extern void *memmove();
160 extern void *memset();
161 extern char *strcat();
162 extern char *strchr();
163 extern int strcmp();
164 extern int strcoll();
165 extern char *strcpy();
166 extern size_t strcspn();
167 extern char *strerror();
168 extern size_t strlen();
169 extern char *strncat();
170 extern int strncmp();
171 extern char *strncpy();
172 extern char *strpbrk();
173 extern char *strrchr();
174 extern size_t strspn();
175 extern char *strstr();
176 extern char *strtok();
177 extern size_t strxfrm();
178 
179 #endif	/* __STDC__ */
180 
181 #if __cplusplus >= 199711L
182 }
183 #endif /* end of namespace std */
184 
185 #ifdef	__cplusplus
186 }
187 #endif
188 
189 #endif	/* _ISO_STRING_ISO_H */
190