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 /* wctype.h 1.13 89/11/02 SMI; JLE */ 23 /* from AT&T JAE 2.1 */ 24 /* definitions for international functions */ 25 26 /* 27 * Copyright 2014 Garrett D'Amore <garrett@damore.org> 28 * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 29 * Use is subject to license terms. 30 */ 31 32 #ifndef _WCTYPE_H 33 #define _WCTYPE_H 34 35 #include <sys/feature_tests.h> 36 #include <iso/wctype_iso.h> 37 #ifndef _STRICT_SYMBOLS 38 #include <ctype.h> 39 #include <wchar.h> 40 #endif 41 42 /* 43 * Allow global visibility for symbols defined in 44 * C++ "std" namespace in <iso/wctype_iso.h>. 45 */ 46 #if __cplusplus >= 199711L 47 using std::wint_t; 48 using std::wctrans_t; 49 using std::iswalnum; 50 using std::iswalpha; 51 using std::iswcntrl; 52 using std::iswdigit; 53 using std::iswgraph; 54 using std::iswlower; 55 using std::iswprint; 56 using std::iswpunct; 57 using std::iswspace; 58 using std::iswupper; 59 using std::iswxdigit; 60 using std::towlower; 61 using std::towupper; 62 using std::wctrans; 63 using std::towctrans; 64 using std::iswctype; 65 using std::wctype; 66 #if __cplusplus >= 201103L 67 using std::iswblank; 68 #endif 69 #endif 70 71 #ifdef __cplusplus 72 extern "C" { 73 #endif 74 75 /* do not allow any of the following in a strictly conforming application */ 76 #ifndef _STRICT_SYMBOLS 77 78 /* 79 * data structure for supplementary code set 80 * for character class and conversion 81 */ 82 struct _wctype { 83 wchar_t tmin; /* minimum code for wctype */ 84 wchar_t tmax; /* maximum code for wctype */ 85 unsigned char *index; /* class index */ 86 unsigned int *type; /* class type */ 87 wchar_t cmin; /* minimum code for conversion */ 88 wchar_t cmax; /* maximum code for conversion */ 89 wchar_t *code; /* conversion code */ 90 }; 91 92 93 #ifdef _ILLUMOS_PRIVATE 94 extern int __iswrune(wint_t); 95 extern wint_t __nextwctype(wint_t, wctype_t); 96 #define iswrune(c) __iswrune(c) 97 #define nextwctype(c, t) __nextwctype(c, t) 98 #endif 99 100 /* character classification functions */ 101 102 /* iswascii is still a macro */ 103 #define iswascii(c) isascii(c) 104 105 /* isw*, except iswascii(), are not macros any more. They become functions */ 106 #ifdef __STDC__ 107 108 /* is* also become functions */ 109 extern int isphonogram(wint_t); 110 extern int isideogram(wint_t); 111 extern int isenglish(wint_t); 112 extern int isnumber(wint_t); 113 extern int isspecial(wint_t); 114 /* From BSD/MacOS */ 115 extern int iswideogram(wint_t); 116 extern int iswphonogram(wint_t); 117 extern int iswnumber(wint_t); 118 extern int iswspecial(wint_t); 119 120 #else /* __STDC__ */ 121 122 /* is* also become functions */ 123 extern int isphonogram(); 124 extern int isideogram(); 125 extern int isenglish(); 126 extern int isnumber(); 127 extern int isspecial(); 128 /* From BSD/MacOS */ 129 extern int iswideogram(); 130 extern int iswphonogram(); 131 extern int iswnumber(); 132 extern int iswspecial(); 133 #endif 134 135 #define iscodeset0(c) isascii(c) 136 #define iscodeset1(c) (((c) & WCHAR_CSMASK) == WCHAR_CS1) 137 #define iscodeset2(c) (((c) & WCHAR_CSMASK) == WCHAR_CS2) 138 #define iscodeset3(c) (((c) & WCHAR_CSMASK) == WCHAR_CS3) 139 140 #endif /* !defined(_STRICT_SYMBOLS)... */ 141 142 143 /* XPG7 extended locale support */ 144 #if defined(_XPG7) || !defined(_STRICT_SYMBOLS) 145 146 #ifndef _LOCALE_T 147 #define _LOCALE_T 148 typedef struct locale *locale_t; 149 #endif 150 151 #if defined(__STDC__) 152 extern wint_t towlower_l(wint_t, locale_t); 153 extern wint_t towupper_l(wint_t, locale_t); 154 extern wint_t towctrans_l(wint_t, wctrans_t, locale_t); 155 extern int iswctype_l(wint_t, wctype_t, locale_t); 156 extern int iswalnum_l(wint_t, locale_t); 157 extern int iswalpha_l(wint_t, locale_t); 158 extern int iswcntrl_l(wint_t, locale_t); 159 extern int iswdigit_l(wint_t, locale_t); 160 extern int iswgraph_l(wint_t, locale_t); 161 extern int iswlower_l(wint_t, locale_t); 162 extern int iswprint_l(wint_t, locale_t); 163 extern int iswpunct_l(wint_t, locale_t); 164 extern int iswspace_l(wint_t, locale_t); 165 extern int iswupper_l(wint_t, locale_t); 166 extern int iswxdigit_l(wint_t, locale_t); 167 extern wctrans_t wctrans_l(const char *, locale_t); 168 extern wctype_t wctype_l(const char *, locale_t); 169 #else /* __STDC__ */ 170 extern wint_t towlower_l(); 171 extern wint_t towupper_l(); 172 extern wint_t towctrans_l(); 173 extern int iswctype_l(); 174 extern int iswalnum_l(); 175 extern int iswalpha_l(); 176 extern int iswcntrl_l(); 177 extern int iswdigit_l(); 178 extern int iswgraph_l(); 179 extern int iswlower_l(); 180 extern int iswprint_l(); 181 extern int iswpunct_l(); 182 extern int iswspace_l(); 183 extern int iswupper_l(); 184 extern int iswxdigit_l(); 185 extern wctrans_t wctrans_l(); 186 extern wctype_t wctype_l(); 187 #endif /* __STDC__ */ 188 #endif /* defined(_XPG7) || !defined(_STRICT_SYMBOLS) */ 189 190 #ifdef __cplusplus 191 } 192 #endif 193 194 #endif /* _WCTYPE_H */