OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uC-libc/] [include/] [ctype.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/*
2
 *      ctype.h         Character classification and conversion
3
 */
4
 
5
#ifndef __CTYPE_H
6
#define __CTYPE_H
7
 
8
extern  unsigned char   __ctype[];
9
 
10
#define __CT_d  0x01            /* numeric digit */
11
#define __CT_u  0x02            /* upper case */
12
#define __CT_l  0x04            /* lower case */
13
#define __CT_c  0x08            /* control character */
14
#define __CT_s  0x10            /* whitespace */
15
#define __CT_p  0x20            /* punctuation */
16
#define __CT_x  0x40            /* hexadecimal */
17
 
18
#define toupper(c)      (islower(c) ? (c)^0x20 : (c))
19
#define tolower(c)      (isupper(c) ? (c)^0x20 : (c))
20
#define _toupper(c)     ((c)^0x20)
21
#define _tolower(c)     ((c)^0x20)
22
#define toascii(c)      ((c)&0x7F)
23
 
24
/* Note the '!!' is a cast to 'bool' and even BCC deletes it in an if()  */
25
#define isalnum(c)      (!!(__ctype[(int) c]&(__CT_u|__CT_l|__CT_d)))
26
#define isalpha(c)      (!!(__ctype[(int) c]&(__CT_u|__CT_l)))
27
#define isascii(c)      (!((c)&~0x7F))
28
#define iscntrl(c)      (!!(__ctype[(int) c]&__CT_c))
29
#define isdigit(c)      (!!(__ctype[(int) c]&__CT_d))
30
#define isgraph(c)      (!(__ctype[(int) c]&(__CT_c|__CT_s)))
31
#define islower(c)      (!!(__ctype[(int) c]&__CT_l))
32
#define isprint(c)      (!(__ctype[(int) c]&__CT_c))
33
#define ispunct(c)      (!!(__ctype[(int) c]&__CT_p))
34
#define isspace(c)      (!!(__ctype[(int) c]&__CT_s))
35
#define isupper(c)      (!!(__ctype[(int) c]&__CT_u))
36
#define isxdigit(c)     (!!(__ctype[(int) c]&__CT_x))
37
 
38
#endif /* __CTYPE_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.