-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathctype.c
More file actions
49 lines (45 loc) · 2.06 KB
/
ctype.c
File metadata and controls
49 lines (45 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* @由于个人水平有限, 难免有些错误, 还请指点:
* @Author: cpu_code
* @Date: 2020-08-12 19:19:54
* @LastEditTime: 2020-08-19 17:43:15
* @FilePath: \Linux_0_11\lib\ctype.c
* @Gitee: [https://gitee.com/cpu_code](https://gitee.com/cpu_code)
* @Github: [https://github.com/CPU-Code](https://github.com/CPU-Code)
* @CSDN: [https://blog.csdn.net/qq_44226094](https://blog.csdn.net/qq_44226094)
* @Gitbook: [https://923992029.gitbook.io/cpucode/](https://923992029.gitbook.io/cpucode/)
*/
/*
* linux/lib/ctype.c
*
* (C) 1991 Linus Torvalds
*/
#include <ctype.h> // 字符类型头文件。定义了一些有关字符类型判断和转换的宏。
char _ctmp; // 一个临时字符变量,供 ctype.h 文件中转换字符宏函数使用
// 字符特性数组(表),定义了各个字符对应的属性,这些属性类型(如_C 等)在 ctype.h 中定义。
// 用于判断 字符是控制字符(_C)、大写字符(_U)、小写字符(_L)等所属类型。
unsigned char _ctype[] = {0x00, /* EOF */
_C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */
_C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */
_C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */
_C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */
_S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */
_P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */
_D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */
_D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */
_P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */
_U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */
_U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */
_U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */
_P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */
_L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */
_L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */
_L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 160-175 */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 176-191 */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 192-207 */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 208-223 */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 224-239 */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /* 240-255 */