00001 /* 00002 * Copyright (c) 1989 The Regents of the University of California. 00003 * All rights reserved. 00004 * (c) UNIX System Laboratories, Inc. 00005 * All or some portions of this file are derived from material licensed 00006 * to the University of California by American Telephone and Telegraph 00007 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 00008 * the permission of UNIX System Laboratories, Inc. 00009 * 00010 * Redistribution and use in source and binary forms, with or without 00011 * modification, are permitted provided that the following conditions 00012 * are met: 00013 * 1. Redistributions of source code must retain the above copyright 00014 * notice, this list of conditions and the following disclaimer. 00015 * 2. Redistributions in binary form must reproduce the above copyright 00016 * notice, this list of conditions and the following disclaimer in the 00017 * documentation and/or other materials provided with the distribution. 00018 * 3. All advertising materials mentioning features or use of this software 00019 * must display the following acknowledgement: 00020 * This product includes software developed by the University of 00021 * California, Berkeley and its contributors. 00022 * 4. Neither the name of the University nor the names of its contributors 00023 * may be used to endorse or promote products derived from this software 00024 * without specific prior written permission. 00025 * 00026 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 00027 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00028 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00029 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 00030 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00031 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00032 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00033 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00034 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00035 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00036 * SUCH DAMAGE. 00037 * 00038 * @(#)ctype.h 5.3 (Berkeley) 4/3/91 00039 */ 00040 00041 #ifndef _CTYPE_H_ 00042 #define _CTYPE_H_ 00043 00044 00045 #define _U 0x01 00046 #define _L 0x02 00047 #define _N 0x04 00048 #define _S 0x08 00049 #define _P 0x10 00050 #define _C 0x20 00051 #define _X 0x40 00052 #define _B 0x80 00053 00054 extern const unsigned char *_ctype_; 00055 extern const short *_tolower_tab_; 00056 extern const short *_toupper_tab_; 00057 00058 00059 #define isdigit(c) ((int)((_ctype_ + 1)[(int)(c)] & _N)) 00060 #define islower(c) ((int)((_ctype_ + 1)[(int)(c)] & _L)) 00061 #define isspace(c) ((int)((_ctype_ + 1)[(int)(c)] & _S)) 00062 #define ispunct(c) ((int)((_ctype_ + 1)[(int)(c)] & _P)) 00063 #define isupper(c) ((int)((_ctype_ + 1)[(int)(c)] & _U)) 00064 #define isalpha(c) ((int)((_ctype_ + 1)[(int)(c)] & (_U|_L))) 00065 #define isxdigit(c) ((int)((_ctype_ + 1)[(int)(c)] & (_N|_X))) 00066 #define isalnum(c) ((int)((_ctype_ + 1)[(int)(c)] & (_U|_L|_N))) 00067 #define isprint(c) ((int)((_ctype_ + 1)[(int)(c)] & (_P|_U|_L|_N|_B))) 00068 #define isgraph(c) ((int)((_ctype_ + 1)[(int)(c)] & (_P|_U|_L|_N))) 00069 #define iscntrl(c) ((int)((_ctype_ + 1)[(int)(c)] & _C)) 00070 #define tolower(c) ((int)((_tolower_tab_ + 1)[(int)(c)])) 00071 #define toupper(c) ((int)((_toupper_tab_ + 1)[(int)(c)])) 00072 00073 #define isascii(c) ((unsigned)(c) <= 0177) 00074 #define toascii(c) ((c) & 0177) 00075 #define _tolower(c) ((c) - 'A' + 'a') 00076 #define _toupper(c) ((c) - 'a' + 'A') 00077 00078 #define _CTYPE_NUM_CHARS (1 << CHAR_BIT) 00079 00080 #endif /* !_CTYPE_H_ */