PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
ctype.h
Go to the documentation of this file.
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
7# Licenced under Academic Free License version 2.0
8# Review ps2sdk README & LICENSE files for further details.
9*/
10
16#ifndef __CTYPE_H__
17#define __CTYPE_H__
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23#define isascii(c) ((unsigned int)(c) <= 127)
24#define toascii(c) ((unsigned char)(c) & 127)
25
26#define isblank(c) ((c == ' ') || (c == '\t'))
27
28#ifdef USE_IOP_CTYPE_MACRO
29
30#define islower(c) ((c >= 'a') && (c <= 'z'))
31#define isupper(c) ((c >= 'A') && (c <= 'Z'))
32#define isdigit(c) ((c >= '0') && (c <= '9'))
33#define iscntrl(c) ((c >= 0) && (c < 32))
34#define isprint(c) ((c >= 32) && (c <= 127))
35
36#define isspace(c) (isblank(c) || (c == '\f') || (c == '\n') || (c == '\r') || (c == '\v'))
37#define isxdigit(c) (isdigit(c) || ((c >= 'A') && (c <= 'F')))
38
39#define isalnum(c) (isalpha(c) || isdigit(c))
40#define isalpha(c) (isupper(c) || islower(c))
41#define isgraph(c) (isprint(c) && !isspace(c))
42#define ispunct(c) (isprint(c) && !(isspace(c) || isalnum(c)))
43
44#define toupper(c) ((unsigned char)(c) + ('a' - 'A'))
45#define tolower(c) ((unsigned char)(c) - ('a' - 'A'))
46
47#else
48
50#define _U 0x01
52#define _L 0x02
54#define _N 0x04
56#define _S 0x08
58#define _P 0x10
60#define _C 0x20
62#define _X 0x40
64#define _B 0x80
65
66#define isalpha(c) (look_ctype_table((unsigned int)(c)) & (_U|_L))
67#define isupper(c) (look_ctype_table((unsigned int)(c)) & (_U))
68#define islower(c) (look_ctype_table((unsigned int)(c)) & (_L))
69#define isdigit(c) (look_ctype_table((unsigned int)(c)) & (_N))
70#define isxdigit(c) (look_ctype_table((unsigned int)(c)) & (_X|_N))
71#define isspace(c) (look_ctype_table((unsigned int)(c)) & (_S))
72#define ispunct(c) (look_ctype_table((unsigned int)(c)) & (_P))
73#define isalnum(c) (look_ctype_table((unsigned int)(c)) & (_U|_L|_N))
74#define isprint(c) (look_ctype_table((unsigned int)(c)) & (_P|_U|_L|_N|_B))
75#define isgraph(c) (look_ctype_table((unsigned int)(c)) & (_P|_U|_L|_N))
76#define iscntrl(c) (look_ctype_table((unsigned int)(c)) & (_C))
77
78#if __GNUC__ > 3
79#undef toupper
80#endif
81#ifndef toupper
82#define toupper(c) _toupper(c)
83#endif
84
85#if __GNUC__ > 3
86#undef tolower
87#endif
88#ifndef tolower
89#define tolower(c) _tolower(c)
90#endif
91
92#endif
93
94#ifdef __cplusplus
95}
96#endif
97
98#endif /* __CTYPE_H__ */