64 lines · 2.0 KB · C
RawDownload
/*  * This file is part of the UCB release of Plan 9. It is subject to the license * terms in the LICENSE file found in the top-level directory of this * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No * part of the UCB release of Plan 9, including this file, may be copied, * modified, propagated, or distributed except according to the terms contained * in the LICENSE file. */ #ifndef __CTYPE#define __CTYPE#pragma lib "/$M/lib/ape/libap.a" #ifdef __cplusplusextern "C" {#endif extern int isalnum(int);extern int isalpha(int);extern int iscntrl(int);extern int isdigit(int);extern int isgraph(int);extern int islower(int);extern int isprint(int);extern int ispunct(int);extern int isspace(int);extern int isupper(int);extern int isxdigit(int);extern int tolower(int);extern int toupper(int); #ifdef __cplusplus}#endifenum{  _ISupper = 01,	/* UPPERCASE.  */  _ISlower = 02,	/* lowercase.  */  _ISdigit = 04,	/* Numeric.  */  _ISspace = 010,	/* Whitespace.  */  _ISpunct = 020,	/* Punctuation.  */  _IScntrl = 040,	/* Control character.  */  _ISblank = 0100,	/* Blank (usually SPC and TAB).  */  _ISxdigit = 0200,	/* Hexadecimal numeric.  */}; extern unsigned char _ctype[];#define	isalnum(c)	(_ctype[(unsigned char)(c)]&(_ISupper|_ISlower|_ISdigit))#define	isalpha(c)	(_ctype[(unsigned char)(c)]&(_ISupper|_ISlower))#define	iscntrl(c)	(_ctype[(unsigned char)(c)]&_IScntrl)#define	isdigit(c)	(_ctype[(unsigned char)(c)]&_ISdigit)#define	isgraph(c)	(_ctype[(unsigned char)(c)]&(_ISpunct|_ISupper|_ISlower|_ISdigit))#define	islower(c)	(_ctype[(unsigned char)(c)]&_ISlower)#define	isprint(c)	(_ctype[(unsigned char)(c)]&(_ISpunct|_ISupper|_ISlower|_ISdigit|_ISblank))#define	ispunct(c)	(_ctype[(unsigned char)(c)]&_ISpunct)#define	isspace(c)	(_ctype[(unsigned char)(c)]&_ISspace)#define	isupper(c)	(_ctype[(unsigned char)(c)]&_ISupper)#define	isxdigit(c)	(_ctype[(unsigned char)(c)]&_ISxdigit) #ifdef _BSD_EXTENSION#define	isascii(c) (((unsigned int)(c))<0x80)#endif #endif /* __CTYPE */