xref: /illumos-gate/usr/src/head/iso/ctype_iso.h (revision b4203d75)
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  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
27  *
28  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
29  * Use is subject to license terms.
30  */
31 
32 /*
33  * An application should not include this header directly.  Instead it
34  * should be included only through the inclusion of other Sun headers.
35  *
36  * The contents of this header is limited to identifiers specified in the
37  * C Standard.  Any new identifiers specified in future amendments to the
38  * C Standard must be placed in this header.  If these new identifiers
39  * are required to also be in the C++ Standard "std" namespace, then for
40  * anything other than macro definitions, corresponding "using" directives
41  * must also be added to <ctype.h>.
42  */
43 
44 #ifndef _ISO_CTYPE_ISO_H
45 #define	_ISO_CTYPE_ISO_H
46 
47 #include <sys/feature_tests.h>
48 
49 #ifdef	__cplusplus
50 extern "C" {
51 #endif
52 
53 #define	_U	0x00000001	/* Upper case */
54 #define	_L	0x00000002	/* Lower case */
55 #define	_N	0x00000004	/* Numeral (digit) */
56 #define	_S	0x00000008	/* Spacing character */
57 #define	_P	0x00000010	/* Punctuation */
58 #define	_C	0x00000020	/* Control character */
59 #define	_B	0x00000040	/* Blank */
60 #define	_X	0x00000080	/* heXadecimal digit */
61 
62 #define	_ISUPPER	_U
63 #define	_ISLOWER	_L
64 #define	_ISDIGIT	_N
65 #define	_ISSPACE	_S
66 #define	_ISPUNCT	_P
67 #define	_ISCNTRL	_C
68 #define	_ISBLANK	_B
69 #define	_ISXDIGIT	_X
70 #define	_ISGRAPH	0x00002000
71 #define	_ISALPHA	0x00004000
72 #define	_ISPRINT	0x00008000
73 #define	_ISALNUM	(_ISALPHA | _ISDIGIT)
74 
75 extern unsigned char	__ctype[];
76 extern unsigned int	*__ctype_mask;
77 extern int		*__trans_upper;
78 extern int		*__trans_lower;
79 
80 #if __cplusplus >= 199711L
81 namespace std {
82 #endif
83 
84 /*
85  * These used to be macros, which while more efficient, precludes operation
86  * with thread specific locales.  The old macros will still work, but new
87  * code compiles to use functions.  This is specifically permitted by the
88  * various standards.  Only _tolower and _toupper were required to be
89  * delivered in macro form.
90  */
91 extern int isalnum(int);
92 extern int isalpha(int);
93 extern int iscntrl(int);
94 extern int isdigit(int);
95 extern int isgraph(int);
96 extern int islower(int);
97 extern int isprint(int);
98 extern int ispunct(int);
99 extern int isspace(int);
100 extern int isupper(int);
101 extern int isxdigit(int);
102 #if defined(_XPG6) || defined(_STDC_C99) || !defined(_STRICT_SYMBOLS)
103 extern int isblank(int);
104 #endif
105 
106 extern int tolower(int);
107 extern int toupper(int);
108 
109 #if __cplusplus >= 199711L
110 } /* end of namespace std */
111 #endif
112 
113 #ifdef	__cplusplus
114 }
115 #endif
116 
117 #endif	/* _ISO_CTYPE_ISO_H */
118