xref: /illumos-gate/usr/src/head/ctype.h (revision 7c478bd9)
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 #ifndef _CTYPE_H
32 #define	_CTYPE_H
33 
34 #pragma ident	"%Z%%M%	%I%	%E% SMI"
35 
36 #include <iso/ctype_iso.h>
37 #include <iso/ctype_c99.h>
38 
39 /*
40  * Allow global visibility for symbols defined in
41  * C++ "std" namespace in <iso/ctype_iso.h>.
42  */
43 #if __cplusplus >= 199711L
44 using std::isalnum;
45 using std::isalpha;
46 using std::iscntrl;
47 using std::isdigit;
48 using std::isgraph;
49 using std::islower;
50 using std::isprint;
51 using std::ispunct;
52 using std::isspace;
53 using std::isupper;
54 using std::isxdigit;
55 using std::tolower;
56 using std::toupper;
57 #endif
58 
59 #ifdef	__cplusplus
60 extern "C" {
61 #endif
62 
63 #if defined(__STDC__)
64 
65 #if defined(__EXTENSIONS__) || \
66 	((!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \
67 	defined(_XOPEN_SOURCE))
68 
69 extern int isascii(int);
70 extern int toascii(int);
71 extern int _tolower(int);
72 extern int _toupper(int);
73 
74 #endif /* defined(__EXTENSIONS__) || ((!defined(_STRICT_STDC) ... */
75 
76 #if !defined(__lint)
77 
78 #if defined(__EXTENSIONS__) || \
79 	((!defined(_STRICT_STDC) && !defined(_POSIX_C_SOURCE)) || \
80 	defined(_XOPEN_SOURCE)) || defined(__XPG4_CHAR_CLASS__)
81 #define	isascii(c)	(!(((int)(c)) & ~0177))
82 #define	toascii(c)	(((int)(c)) & 0177)
83 #if defined(__XPG4_CHAR_CLASS__) || defined(_XPG4)
84 #define	_toupper(c)	(__trans_upper[(int)(c)])
85 #define	_tolower(c)	(__trans_lower[(int)(c)])
86 #else
87 #define	_toupper(c)	((__ctype + 258)[(int)(c)])
88 #define	_tolower(c)	((__ctype + 258)[(int)(c)])
89 #endif /* defined(__XPG4_CHAR_CLASS__) || defined(_XPG4) */
90 
91 #endif /* defined(__EXTENSIONS__) || ((!defined(_STRICT_STDC) ... */
92 
93 #endif	/* !defined(__lint) */
94 
95 #else	/* defined(__STDC__) */
96 
97 #if !defined(__lint)
98 
99 #define	isascii(c)	(!(((int)(c)) & ~0177))
100 #define	_toupper(c)	((_ctype + 258)[(int)(c)])
101 #define	_tolower(c)	((_ctype + 258)[(int)(c)])
102 #define	toascii(c)	(((int)(c)) & 0177)
103 
104 #endif	/* !defined(__lint) */
105 
106 #endif	/* defined(__STDC__) */
107 
108 #ifdef	__cplusplus
109 }
110 #endif
111 
112 #endif	/* _CTYPE_H */
113