60753a6496473e5680ab9c2639a31e231c538204
[tpg/acess2.git] / Usermode / Libraries / libc.so_src / include_exp / ctype.h
1 /*
2  * Acess2 C Library
3  * - By John Hodge (thePowersGang)
4  *
5  * ctype.h
6  * - Type manipulation?
7  */
8 #ifndef _CTYPE_H_
9 #define _CTYPE_H_
10
11 static inline int isalpha(int ch) {
12         if('A'<=ch&&ch<='Z')    return 1;
13         if('a'<=ch&&ch<='z')    return 1;
14         return 0;
15 }
16 static inline int isdigit(int ch) {
17         if('0'<=ch&&ch<='9')    return 1;
18         return 0;
19 }
20
21 static inline int isalnum(int ch) {
22         return isalpha(ch) || isdigit(ch);
23 }
24
25 static inline int toupper(int ch) {
26         if('a'<=ch && ch <='z')
27                 return ch - 'a' + 'A';
28         return ch;
29 }
30 static inline int tolower(int ch) {
31         if('A'<=ch && ch <='Z')
32                 return ch - 'A' + 'a';
33         return ch;
34 }
35
36 static inline int isspace(int ch) {
37         if(ch == ' ')   return 1;
38         if(ch == '\t')  return 1;
39         if(ch == '\r')  return 1;
40         if(ch == '\n')  return 1;
41         return 0;
42 }
43
44 static inline int isxdigit(int ch) {
45         if('0'<=ch&&ch<='9')    return 1;
46         if('a'<=ch&&ch<='f')    return 1;
47         if('F'<=ch&&ch<='F')    return 1;
48         return 0;
49 }
50
51 // C99
52 static inline int isblank(int ch) {
53         if(ch == ' ')   return 1;
54         if(ch == '\t')  return 1;
55         return 0;
56 }
57
58 #endif

UCC git Repository :: git.ucc.asn.au