ctype.h revision 133559
1195595Smp/* 2195595Smp * Copyright (c) 1989, 1993 3195595Smp * The Regents of the University of California. All rights reserved. 4195595Smp * (c) UNIX System Laboratories, Inc. 5195595Smp * All or some portions of this file are derived from material licensed 6195595Smp * to the University of California by American Telephone and Telegraph 7195595Smp * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8195595Smp * the permission of UNIX System Laboratories, Inc. 9195595Smp * 10195595Smp * This code is derived from software contributed to Berkeley by 11195595Smp * Paul Borman at Krystal Technologies. 12195595Smp * 13195595Smp * Redistribution and use in source and binary forms, with or without 14195595Smp * modification, are permitted provided that the following conditions 15195595Smp * are met: 16195595Smp * 1. Redistributions of source code must retain the above copyright 17195595Smp * notice, this list of conditions and the following disclaimer. 18195595Smp * 2. Redistributions in binary form must reproduce the above copyright 19195595Smp * notice, this list of conditions and the following disclaimer in the 20195595Smp * documentation and/or other materials provided with the distribution. 21195595Smp * 3. All advertising materials mentioning features or use of this software 22195595Smp * must display the following acknowledgement: 23195595Smp * This product includes software developed by the University of 24195595Smp * California, Berkeley and its contributors. 25195595Smp * 4. Neither the name of the University nor the names of its contributors 26195595Smp * may be used to endorse or promote products derived from this software 27195595Smp * without specific prior written permission. 28195595Smp * 29195595Smp * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 30195595Smp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 31195595Smp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 32195595Smp * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 33195595Smp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 34195595Smp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 35195595Smp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 36195595Smp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 37195595Smp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 38195595Smp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 39195595Smp * SUCH DAMAGE. 40195595Smp * 41195595Smp * @(#)ctype.h 8.4 (Berkeley) 1/21/94 42195595Smp * $FreeBSD: head/include/ctype.h 133559 2004-08-12 09:33:47Z tjr $ 43195595Smp */ 44195595Smp 45195595Smp#ifndef _CTYPE_H_ 46195595Smp#define _CTYPE_H_ 47195595Smp 48195595Smp#include <sys/cdefs.h> 49195595Smp#include <sys/_types.h> 50195595Smp#include <_ctype.h> 51195595Smp 52195595Smp__BEGIN_DECLS 53195595Smpint isalnum(int); 54195595Smpint isalpha(int); 55195595Smpint iscntrl(int); 56195595Smpint isdigit(int); 57195595Smpint isgraph(int); 58195595Smpint islower(int); 59195595Smpint isprint(int); 60195595Smpint ispunct(int); 61195595Smpint isspace(int); 62195595Smpint isupper(int); 63195595Smpint isxdigit(int); 64195595Smpint tolower(int); 65195595Smpint toupper(int); 66195595Smp 67195595Smp#if __XSI_VISIBLE 68195595Smpint _tolower(int); 69195595Smpint _toupper(int); 70195595Smpint isascii(int); 71195595Smpint toascii(int); 72195595Smp#endif 73195595Smp 74195595Smp#if __ISO_C_VISIBLE >= 1999 75195595Smpint isblank(int); 76195595Smp#endif 77195595Smp 78195595Smp#if __BSD_VISIBLE 79195595Smpint digittoint(int); 80195595Smpint ishexnumber(int); 81195595Smpint isideogram(int); 82195595Smpint isnumber(int); 83195595Smpint isphonogram(int); 84195595Smpint isrune(int); 85195595Smpint isspecial(int); 86195595Smp#endif 87195595Smp__END_DECLS 88195595Smp 89195595Smp#define isalnum(c) __istype((c), _CTYPE_A|_CTYPE_D) 90195595Smp#define isalpha(c) __istype((c), _CTYPE_A) 91195595Smp#define iscntrl(c) __istype((c), _CTYPE_C) 92195595Smp#define isdigit(c) __isctype((c), _CTYPE_D) /* ANSI -- locale independent */ 93195595Smp#define isgraph(c) __istype((c), _CTYPE_G) 94195595Smp#define islower(c) __istype((c), _CTYPE_L) 95195595Smp#define isprint(c) __istype((c), _CTYPE_R) 96195595Smp#define ispunct(c) __istype((c), _CTYPE_P) 97195595Smp#define isspace(c) __istype((c), _CTYPE_S) 98195595Smp#define isupper(c) __istype((c), _CTYPE_U) 99195595Smp#define isxdigit(c) __isctype((c), _CTYPE_X) /* ANSI -- locale independent */ 100195595Smp#define tolower(c) __tolower(c) 101195595Smp#define toupper(c) __toupper(c) 102195595Smp 103195595Smp#if __XSI_VISIBLE 104195595Smp/* 105195595Smp * POSIX.1-2001 specifies _tolower() and _toupper() to be macros equivalent to 106195595Smp * tolower() and toupper() respectively, minus extra checking to ensure that 107195595Smp * the argument is a lower or uppercase letter respectively. We've chosen to 108195595Smp * implement these macros with the same error checking as tolower() and 109195595Smp * toupper() since this doesn't violate the specification itself, only its 110195595Smp * intent. We purposely leave _tolower() and _toupper() undocumented to 111195595Smp * discourage their use. 112195595Smp * 113195595Smp * XXX isascii() and toascii() should similarly be undocumented. 114195595Smp */ 115195595Smp#define _tolower(c) __tolower(c) 116195595Smp#define _toupper(c) __toupper(c) 117195595Smp#define isascii(c) (((c) & ~0x7F) == 0) 118195595Smp#define toascii(c) ((c) & 0x7F) 119195595Smp#endif 120195595Smp 121195595Smp#if __ISO_C_VISIBLE >= 1999 122195595Smp#define isblank(c) __istype((c), _CTYPE_B) 123195595Smp#endif 124195595Smp 125195595Smp#if __BSD_VISIBLE 126195595Smp#define digittoint(c) __maskrune((c), 0xFF) 127195595Smp#define ishexnumber(c) __istype((c), _CTYPE_X) 128195595Smp#define isideogram(c) __istype((c), _CTYPE_I) 129195595Smp#define isnumber(c) __istype((c), _CTYPE_D) 130195595Smp#define isphonogram(c) __istype((c), _CTYPE_Q) 131195595Smp#define isrune(c) __istype((c), 0xFFFFFF00L) 132195595Smp#define isspecial(c) __istype((c), _CTYPE_T) 133195595Smp#endif 134195595Smp 135195595Smp#endif /* !_CTYPE_H_ */ 136195595Smp