forked from KolibriOS/kolibrios
4e4a78fb2d
- Added files for developing programs with kolibri-libc git-svn-id: svn://kolibrios.org@8685 a494cfbc-eb01-0410-851d-a64ba20cac60
45 lines
1.4 KiB
C
45 lines
1.4 KiB
C
#ifndef _CTYPE_H_
|
|
#define _CTYPE_H_
|
|
/*
|
|
** All character classification functions except isascii().
|
|
** Integer argument (c) must be in ASCII range (0-127) for
|
|
** dependable answers.
|
|
*/
|
|
|
|
#define __ALNUM 1
|
|
#define __ALPHA 2
|
|
#define __CNTRL 4
|
|
#define __DIGIT 8
|
|
#define __GRAPH 16
|
|
#define __LOWER 32
|
|
#define __PRINT 64
|
|
#define __PUNCT 128
|
|
#define __BLANK 256
|
|
#define __UPPER 512
|
|
#define __XDIGIT 1024
|
|
|
|
#ifdef _KOLIBRI_LIBC_OBJ
|
|
extern unsigned short __is[129];
|
|
#else
|
|
extern unsigned short *__is;
|
|
#endif
|
|
|
|
#define isalnum(c)(__is[c+1] & __ALNUM ) /* 'a'-'z', 'A'-'Z', '0'-'9' */
|
|
#define isalpha(c)(__is[c+1] & __ALPHA ) /* 'a'-'z', 'A'-'Z' */
|
|
#define iscntrl(c)(__is[c+1] & __CNTRL ) /* 0-31, 127 */
|
|
#define isdigit(c)(__is[c+1] & __DIGIT ) /* '0'-'9' */
|
|
#define isgraph(c)(__is[c+1] & __GRAPH ) /* '!'-'~' */
|
|
#define islower(c)(__is[c+1] & __LOWER ) /* 'a'-'z' */
|
|
#define isprint(c)(__is[c+1] & __PRINT ) /* ' '-'~' */
|
|
#define ispunct(c)(__is[c+1] & __PUNCT ) /* !alnum && !cntrl && !space */
|
|
#define isspace(c)(__is[c+1] & __BLANK ) /* HT, LF, VT, FF, CR, ' ' */
|
|
#define isupper(c)(__is[c+1] & __UPPER ) /* 'A'-'Z' */
|
|
#define isxdigit(c)(__is[c+1] & __XDIGIT) /* '0'-'9', 'a'-'f', 'A'-'F' */
|
|
|
|
#define isascii(c) (!((c)&(~0x7f)))
|
|
#define toascii(c) ((c)&0x7f)
|
|
|
|
extern unsigned char tolower(unsigned char c);
|
|
extern unsigned char toupper(unsigned char c);
|
|
|
|
#endif |