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 /* 23 * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 28 /* All Rights Reserved */ 29 30 #ifndef _SA_CTYPE_H 31 #define _SA_CTYPE_H 32 33 #pragma ident "%Z%%M% %I% %E% SMI" 34 35 /* 36 * Exported interfaces for standalone's subset of libc's <ctype.h>. 37 * All standalone code *must* use this header rather than libc's. 38 */ 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif 43 44 #define _U 0x00000001 /* Upper case */ 45 #define _L 0x00000002 /* Lower case */ 46 #define _N 0x00000004 /* Numeral (digit) */ 47 #define _S 0x00000008 /* Spacing character */ 48 #define _P 0x00000010 /* Punctuation */ 49 #define _C 0x00000020 /* Control character */ 50 #define _B 0x00000040 /* Blank */ 51 #define _X 0x00000080 /* heXadecimal digit */ 52 53 #define isalpha(c) ((__ctype + 1)[c] & (_U | _L)) 54 #define isupper(c) ((__ctype + 1)[c] & _U) 55 #define islower(c) ((__ctype + 1)[c] & _L) 56 #define isdigit(c) ((__ctype + 1)[c] & _N) 57 #define isxdigit(c) ((__ctype + 1)[c] & _X) 58 #define isalnum(c) ((__ctype + 1)[c] & (_U | _L | _N)) 59 #define isspace(c) ((__ctype + 1)[c] & _S) 60 #define ispunct(c) ((__ctype + 1)[c] & _P) 61 #define isprint(c) ((__ctype + 1)[c] & (_P | _U | _L | _N | _B)) 62 #define isgraph(c) ((__ctype + 1)[c] & (_P | _U | _L | _N)) 63 #define iscntrl(c) ((__ctype + 1)[c] & _C) 64 #define isascii(c) (!((c) & ~0177)) 65 66 extern unsigned char __ctype[]; 67 68 /* 69 * Some header files define their own macros for tolower/toupper which mangle 70 * our prototypes -- thus only provide ours if no macros have been defined. 71 */ 72 #ifndef tolower 73 extern int tolower(int); 74 #endif 75 #ifndef toupper 76 extern int toupper(int); 77 #endif 78 79 #ifdef __cplusplus 80 } 81 #endif 82 83 #endif /* _SA_CTYPE_H */ 84