sdk-core
v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Toggle main menu visibility
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
17
#ifndef __CTYPE_H__
18
#define __CTYPE_H__
19
20
#ifdef __cplusplus
21
extern
"C"
{
22
#endif
23
24
extern
unsigned
char
look_ctype_table(
char
character);
25
extern
void
*get_ctype_table();
26
27
/* These functions are non-standardized (char instead of int) */
28
extern
char
_toupper(
char
c);
29
extern
char
_tolower(
char
c);
30
31
#define isascii(c) ((unsigned int)(c) <= 127)
32
#define toascii(c) ((unsigned char)(c) & 127)
33
34
#define isblank(c) ((c == ' ') || (c == '\t'))
35
36
#ifdef USE_IOP_CTYPE_MACRO
37
38
#define islower(c) ((c >= 'a') && (c <= 'z'))
39
#define isupper(c) ((c >= 'A') && (c <= 'Z'))
40
#define isdigit(c) ((c >= '0') && (c <= '9'))
41
#define iscntrl(c) ((c >= 0) && (c < 32))
42
#define isprint(c) ((c >= 32) && (c <= 127))
43
44
#define isspace(c) (isblank(c) || (c == '\f') || (c == '\n') || (c == '\r') || (c == '\v'))
45
#define isxdigit(c) (isdigit(c) || ((c >= 'A') && (c <= 'F')))
46
47
#define isalnum(c) (isalpha(c) || isdigit(c))
48
#define isalpha(c) (isupper(c) || islower(c))
49
#define isgraph(c) (isprint(c) && !isspace(c))
50
#define ispunct(c) (isprint(c) && !(isspace(c) || isalnum(c)))
51
52
#define toupper(c) ((unsigned char)(c) + ('a' - 'A'))
53
#define tolower(c) ((unsigned char)(c) - ('a' - 'A'))
54
55
#else
56
58
#define _U 0x01
60
#define _L 0x02
62
#define _N 0x04
64
#define _S 0x08
66
#define _P 0x10
68
#define _C 0x20
70
#define _X 0x40
72
#define _B 0x80
73
74
#define isalpha(c) (look_ctype_table((unsigned int)(c)) & (_U|_L))
75
#define isupper(c) (look_ctype_table((unsigned int)(c)) & (_U))
76
#define islower(c) (look_ctype_table((unsigned int)(c)) & (_L))
77
#define isdigit(c) (look_ctype_table((unsigned int)(c)) & (_N))
78
#define isxdigit(c) (look_ctype_table((unsigned int)(c)) & (_X|_N))
79
#define isspace(c) (look_ctype_table((unsigned int)(c)) & (_S))
80
#define ispunct(c) (look_ctype_table((unsigned int)(c)) & (_P))
81
#define isalnum(c) (look_ctype_table((unsigned int)(c)) & (_U|_L|_N))
82
#define isprint(c) (look_ctype_table((unsigned int)(c)) & (_P|_U|_L|_N|_B))
83
#define isgraph(c) (look_ctype_table((unsigned int)(c)) & (_P|_U|_L|_N))
84
#define iscntrl(c) (look_ctype_table((unsigned int)(c)) & (_C))
85
86
#if __GNUC__ > 3
87
#undef toupper
88
#endif
89
#ifndef toupper
90
#define toupper(c) _toupper(c)
91
#endif
92
93
#if __GNUC__ > 3
94
#undef tolower
95
#endif
96
#ifndef tolower
97
#define tolower(c) _tolower(c)
98
#endif
99
100
#endif
101
102
#ifdef __cplusplus
103
}
104
#endif
105
106
#endif
/* __CTYPE_H__ */
core
sysclib
include
ctype.h
Generated by
1.18.0