summaryrefslogtreecommitdiff
path: root/src/u8c/chk.h.d/iscntrl.c
blob: c8532fcfc7c46f3a7b0c98b33b4dd5a29d9cdb1b (plain) (blame)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
	Copyright 2021 Gabriel Jensen

	This file is part of u8c.

	u8c is free software:   you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

	u8c is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

	See the	GNU Affero General Public License for more details.

	You should have received a copy of the GNU Affero General Public License along with u8c.

	If not, see <https://www.gnu.org/licenses/>.
*/
# include <stdbool.h>
# include <stddef.h>
# include <stdint.h>
# include <u8c/chk.h>
struct u8c_iscntrl_tuple u8c_iscntrl(char32_t const _chr) {
	struct u8c_iscntrl_tuple ret = {
		.stat = false,
	};
	switch(_chr) {
	default:
		ret.res = false;
		break;
	case U'\x0':    /* NULL */
	case U'\x1':    /* START OF HEADING */
	case U'\x2':    /* START OF TEXT */
	case U'\x3':    /* END OF TEXT */
	case U'\x4':    /* END OF TRANSMISSION */
	case U'\x5':    /* ENQUIRY */
	case U'\x6':    /* ACKNOWLEDGE */
	case U'\a':     /* BELL */
	case U'\b':     /* BACKSPACE */
	case U'\t':     /* HORIZONTAL TABULATION */
	case U'\n':     /* NEW LINE */
	case U'\v':     /* VERTICAL TABULATION */
	case U'\f':     /* FORM FEED */
	case U'\r':     /* CARRIAGE RETURN */
	case U'\xE':    /* SHIFT OUT */
	case U'\xF':    /* SHIFT IN */
	case U'\x10':   /* DATA LINK ESCAPE */
	case U'\x11':   /* DEVICE CONTROL ONE */
	case U'\x12':   /* DEVICE CONTROL TWO */
	case U'\x13':   /* DEVICE CONTROL THREE */
	case U'\x14':   /* DEVICE CONTROL FOUR */
	case U'\x15':   /* NEGATIVE ACKNOWLEDGE */
	case U'\x16':   /* SYNCHRONOUS IDLE */
	case U'\x17':   /* END OF TRANSMISSION BLOCK */
	case U'\x18':   /* CANCEL */
	case U'\x19':   /* END OF MEDIUM */
	case U'\x1A':   /* SUBSTITUTE */
	case U'\x1B':   /* ESCAPE */
	case U'\x1C':   /* FILE SEPERATOR */
	case U'\x1D':   /* GROUP SEPERATOR */
	case U'\x1E':   /* RECORD SEPERATOR */
	case U'\x1F':   /* UNIT SEPERATOR */
	case U'\x7F':   /* DELETE */
	case U'\x80':   /* <CONTROL> */
	case U'\x81':   /* <CONTROL */
	case U'\x82':   /* BREAK PERMITTED HERE */
	case U'\x83':   /* NO BREAK HERE */
	case U'\x84':   /* <CONTROL> */
	case U'\x85':   /* NEXT LINE */
	case U'\x86':   /* START OF SELECTED AREA */
	case U'\x87':   /* END OF SELECTED AREA */
	case U'\x88':   /* CHARACTER TABULATION SET */
	case U'\x89':   /* CHARACTER TABULATION SET WITH JUSTIFICATION */
	case U'\x8A':   /* LINE TABULATION SET */
	case U'\x8B':   /* PARTIAL LINE FORWARD */
	case U'\x8C':   /* PARTIAL LINE BACKWARD */
	case U'\x8D':   /* REVERSE LINE FEED */
	case U'\x8E':   /* SINGLE SHIFT TWO */
	case U'\x8F':   /* SINGLE SHIFT THREE */
	case U'\x90':   /* DEVICE CONTROL STRING */
	case U'\x91':   /* PRIVATE USE ONE */
	case U'\x92':   /* PRIVATE USE TWO */
	case U'\x93':   /* SET TRANSMIT STATE */
	case U'\x94':   /* CANCEL CHARACTER */
	case U'\x95':   /* MESSAGE WAITING */
	case U'\x96':   /* START OF GUARDED AREA */
	case U'\x97':   /* END OF GUARDED AREA */
	case U'\x98':   /* START OF STRING */
	case U'\x99':   /* <CONTROL> */
	case U'\x9A':   /* SINGLE CHARACTER INTRODUCER */
	case U'\x9B':   /* CONTROL SEQUENCE INTRODUCER */
	case U'\x9C':   /* STRING TERMINATOR */
	case U'\x9D':   /* OPERATING SYSTEM COMMAND */
	case U'\x9E':   /* PRIVACY MESSAGE */
	case U'\x9F':   /* APPLICATION PROGRAM COMMAND */
	case U'\xA0':   /* NO-BREAK SPACE */
	case U'\u2028': /* LINE SEPERATOR */
	case U'\u2029': /* PARAGRAPH SEPERATOR */
	case U'\u202D': /* LEFT-TO-RIGHT OVERRIDE */
	case U'\u202E': /* RIGHT-TO-LEFT OVERRIDE */
	case U'\u2068': /* FIRST STRONG ISOLATE */
	case U'\u2069': /* POP DIRECTIONAL ISOLATE */
		ret.res = true;
		break;
	}
	return ret;
}