1 /*=============================================================================
4 Copyright © 2008 Bruno Santos <nayart3@gmail.com>
5 =============================================================================*/
10 ///////////////////////////////////////////////////////////////////////////////
13 ///////////////////////////////////////////////////////////////////////////////
16 ///////////////////////////////////////////////////////////////////////////////
17 enum tcrt_ctype_flags
{
18 tcrt_ctype_flag_upper
= 0x01,
19 tcrt_ctype_flag_lower
= 0x02,
20 tcrt_ctype_flag_cntrl
= 0x04,
21 tcrt_ctype_flag_digit
= 0x08,
22 tcrt_ctype_flag_punct
= 0x10,
23 tcrt_ctype_flag_xdigit
= 0x20,
24 tcrt_ctype_flag_space
= 0x40,
25 tcrt_ctype_flag_alpha
= (tcrt_ctype_flag_upper
| tcrt_ctype_flag_lower
),
26 tcrt_ctype_flag_alnum
= (tcrt_ctype_flag_alpha
| tcrt_ctype_flag_digit
),
27 tcrt_ctype_flag_graph
= (tcrt_ctype_flag_alnum
| tcrt_ctype_flag_punct
),
28 tcrt_ctype_flag_print
= (tcrt_ctype_flag_space
| tcrt_ctype_flag_graph
),
31 ///////////////////////////////////////////////////////////////////////////////
46 ///////////////////////////////////////////////////////////////////////////////
49 int tcrt_ctype(int c
);
51 ///////////////////////////////////////////////////////////////////////////////
52 static __inline
int isalpha(int c
)
54 return (tcrt_ctype(c
) & tcrt_ctype_flag_alpha
);
57 static __inline
int isdigit(int c
)
59 return (tcrt_ctype(c
) & tcrt_ctype_flag_digit
);
62 static __inline
int isalnum(int c
)
64 return (tcrt_ctype(c
) & tcrt_ctype_flag_alnum
);
67 static __inline
int isxdigit(int c
)
69 return (tcrt_ctype(c
) & tcrt_ctype_flag_xdigit
);
72 static __inline
int iscntrl(int c
)
74 return (tcrt_ctype(c
) & tcrt_ctype_flag_cntrl
);
77 static __inline
int isgraph(int c
)
79 return (tcrt_ctype(c
) & tcrt_ctype_flag_graph
);
82 static __inline
int isprint(int c
)
84 return (tcrt_ctype(c
) & tcrt_ctype_flag_print
);
87 static __inline
int ispunct(int c
)
89 return (tcrt_ctype(c
) & tcrt_ctype_flag_punct
);
92 static __inline
int isspace(int c
)
94 return (tcrt_ctype(c
) & tcrt_ctype_flag_space
);
97 static __inline
int islower(int c
)
99 return (tcrt_ctype(c
) & tcrt_ctype_flag_lower
);
102 static __inline
int isupper(int c
)
104 return (tcrt_ctype(c
) & tcrt_ctype_flag_upper
);
107 ///////////////////////////////////////////////////////////////////////////////
110 // EOF ////////////////////////////////////////////////////////////////////////
111 #endif /* TCRT_CTYPE__H_ */