Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
8687 turbocat 1
#ifndef _CTYPE_H_
2
#define _CTYPE_H_
3
/*
4
** All character classification functions except isascii().
5
** Integer argument (c) must be in ASCII range (0-127) for
6
** dependable answers.
7
*/
8
 
9
#define __ALNUM     1
10
#define __ALPHA     2
11
#define __CNTRL     4
12
#define __DIGIT     8
13
#define __GRAPH    16
14
#define __LOWER    32
15
#define __PRINT    64
16
#define __PUNCT   128
17
#define __BLANK   256
18
#define __UPPER   512
19
#define __XDIGIT 1024
20
 
21
#ifdef _KOLIBRI_LIBC_OBJ
22
extern unsigned short __is[129];
23
#else
24
extern unsigned short *__is;
25
#endif
26
 
27
#define isalnum(c)(__is[c+1] & __ALNUM ) /* 'a'-'z', 'A'-'Z', '0'-'9' */
28
#define isalpha(c)(__is[c+1] & __ALPHA ) /* 'a'-'z', 'A'-'Z' */
29
#define iscntrl(c)(__is[c+1] & __CNTRL ) /* 0-31, 127 */
30
#define isdigit(c)(__is[c+1] & __DIGIT ) /* '0'-'9' */
31
#define isgraph(c)(__is[c+1] & __GRAPH ) /* '!'-'~' */
32
#define islower(c)(__is[c+1] & __LOWER ) /* 'a'-'z' */
33
#define isprint(c)(__is[c+1] & __PRINT ) /* ' '-'~' */
34
#define ispunct(c)(__is[c+1] & __PUNCT ) /* !alnum && !cntrl && !space */
35
#define isspace(c)(__is[c+1] & __BLANK ) /* HT, LF, VT, FF, CR, ' ' */
36
#define isupper(c)(__is[c+1] & __UPPER ) /* 'A'-'Z' */
37
#define isxdigit(c)(__is[c+1] & __XDIGIT) /* '0'-'9', 'a'-'f', 'A'-'F' */
38
 
39
#define isascii(c) (!((c)&(~0x7f)))
40
#define toascii(c) ((c)&0x7f)
41
 
42
extern unsigned char tolower(unsigned char c);
43
extern unsigned char toupper(unsigned char c);
44
 
45
#endif