1 /*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1989, 1993 5 * The Regents of the University of California. All rights reserved. 6 * (c) UNIX System Laboratories, Inc. 7 * All or some portions of this file are derived from material licensed 8 * to the University of California by American Telephone and Telegraph 9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 10 * the permission of UNIX System Laboratories, Inc. 11 * 12 * This code is derived from software contributed to Berkeley by 13 * Paul Borman at Krystal Technologies. 14 * 15 * Redistribution and use in source and binary forms, with or without 16 * modification, are permitted provided that the following conditions 17 * are met: 18 * 1. Redistributions of source code must retain the above copyright 19 * notice, this list of conditions and the following disclaimer. 20 * 2. Redistributions in binary form must reproduce the above copyright 21 * notice, this list of conditions and the following disclaimer in the 22 * documentation and/or other materials provided with the distribution. 23 * 3. Neither the name of the University nor the names of its contributors 24 * may be used to endorse or promote products derived from this software 25 * without specific prior written permission. 26 * 27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 */ 39 40 #include <wctype.h> 41 42 #undef iswalnum 43 int 44 iswalnum(wint_t wc) 45 { 46 return (__istype(wc, _CTYPE_A|_CTYPE_N)); 47 } 48 49 #undef iswalpha 50 int 51 iswalpha(wint_t wc) 52 { 53 return (__istype(wc, _CTYPE_A)); 54 } 55 56 #undef iswascii 57 int 58 iswascii(wint_t wc) 59 { 60 return ((wc & ~0x7F) == 0); 61 } 62 63 #undef iswblank 64 int 65 iswblank(wint_t wc) 66 { 67 return (__istype(wc, _CTYPE_B)); 68 } 69 70 #undef iswcntrl 71 int 72 iswcntrl(wint_t wc) 73 { 74 return (__istype(wc, _CTYPE_C)); 75 } 76 77 #undef iswdigit 78 int 79 iswdigit(wint_t wc) 80 { 81 return (__istype(wc, _CTYPE_D)); 82 } 83 84 #undef iswgraph 85 int 86 iswgraph(wint_t wc) 87 { 88 return (__istype(wc, _CTYPE_G)); 89 } 90 91 #undef iswhexnumber 92 int 93 iswhexnumber(wint_t wc) 94 { 95 return (__istype(wc, _CTYPE_X)); 96 } 97 98 #undef iswideogram 99 int 100 iswideogram(wint_t wc) 101 { 102 return (__istype(wc, _CTYPE_I)); 103 } 104 105 #undef iswlower 106 int 107 iswlower(wint_t wc) 108 { 109 return (__istype(wc, _CTYPE_L)); 110 } 111 112 #undef iswnumber 113 int 114 iswnumber(wint_t wc) 115 { 116 return (__istype(wc, _CTYPE_N)); 117 } 118 119 #undef iswphonogram 120 int 121 iswphonogram(wint_t wc) 122 { 123 return (__istype(wc, _CTYPE_Q)); 124 } 125 126 #undef iswprint 127 int 128 iswprint(wint_t wc) 129 { 130 return (__istype(wc, _CTYPE_R)); 131 } 132 133 #undef iswpunct 134 int 135 iswpunct(wint_t wc) 136 { 137 return (__istype(wc, _CTYPE_P)); 138 } 139 140 #undef iswrune 141 int 142 iswrune(wint_t wc) 143 { 144 return (__istype(wc, 0xFFFFFF00L)); 145 } 146 147 #undef iswspace 148 int 149 iswspace(wint_t wc) 150 { 151 return (__istype(wc, _CTYPE_S)); 152 } 153 154 #undef iswspecial 155 int 156 iswspecial(wint_t wc) 157 { 158 return (__istype(wc, _CTYPE_T)); 159 } 160 161 #undef iswupper 162 int 163 iswupper(wint_t wc) 164 { 165 return (__istype(wc, _CTYPE_U)); 166 } 167 168 #undef iswxdigit 169 int 170 iswxdigit(wint_t wc) 171 { 172 return (__istype(wc, _CTYPE_X)); 173 } 174 175 #undef towlower 176 wint_t 177 towlower(wint_t wc) 178 { 179 return (__tolower(wc)); 180 } 181 182 #undef towupper 183 wint_t 184 towupper(wint_t wc) 185 { 186 return (__toupper(wc)); 187 } 188 189