summaryrefslogtreecommitdiff
path: root/src/u8c/ispunct.c
blob: 11a155a8933a15809595878494abf72629c19d9e (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
105
106
107
108
109
110
111
/*
	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 <assert.h>
# include <stddef.h>
# include <stdint.h>
# include <u8c/ispunct.h>
uint_least8_t u8c_ispunct(uint_least8_t * const _res,uint_least32_t _chr) {
	assert(_res != NULL);
	switch(_chr) {
	default:
		*_res = UINT8_C(0x0);
		break;
	case UINT32_C(0x21):    /* EXCLAMATION MARK */
	case UINT32_C(0x22):    /* QUOTATION MARK */
	case UINT32_C(0x23):    /* NUMBER SIGN */
	case UINT32_C(0x24):    /* DOLLAR SIGN */
	case UINT32_C(0x25):    /* PERCENT SIGN */
	case UINT32_C(0x26):    /* AMPERSAND */
	case UINT32_C(0x27):    /* APOSTROPHE */
	case UINT32_C(0x28):    /* LEFT PARANTHESIS */
	case UINT32_C(0x29):    /* RIGHT PARANTHESIS */
	case UINT32_C(0x2A):    /* ASTERISK */
	case UINT32_C(0x2B):    /* PLUS SIGN */
	case UINT32_C(0x2C):    /* COMMA */
	case UINT32_C(0x2D):    /* HYPHEN-MINUS */
	case UINT32_C(0x2E):    /* FULL STOP */
	case UINT32_C(0x2F):    /* SOLIDUS */
	case UINT32_C(0x3A):    /* COLON */
	case UINT32_C(0x3B):    /* SEMICOLON */
	case UINT32_C(0x3C):    /* LESS-THAN SIGN */
	case UINT32_C(0x3D):    /* EQUALS SIGN */
	case UINT32_C(0x3E):    /* GREATER-THAN SIGN */
	case UINT32_C(0x3F):    /* QUESTION MARK */
	case UINT32_C(0x40):    /* COMMERCIAL AT */
	case UINT32_C(0x5B):    /* LEFT SQUARE BRACKET */
	case UINT32_C(0x5C):    /* REVERSE SOLIDUS */
	case UINT32_C(0x5D):    /* RIGHT SQUARE BRACKET */
	case UINT32_C(0x5E):    /* CIRCUMFLEX ACCENT */
	case UINT32_C(0x5F):    /* LOW LINE */
	case UINT32_C(0x60):    /* GRAVE ACCENT */
	case UINT32_C(0x7B):    /* LEFT CURLY BRACKET */
	case UINT32_C(0x7C):    /* VERTICAL LINE */
	case UINT32_C(0x7D):    /* RIGHT CURLY BRACKET */
	case UINT32_C(0x7E):    /* TILDE */
	case UINT32_C(0xA1):    /* INVERT EXCLAMATION MARK */
	case UINT32_C(0xA2):    /* CENT SIGN */
	case UINT32_C(0xA3):    /* POUND SIGN */
	case UINT32_C(0xA4):    /* CURRENCY SIGN */
	case UINT32_C(0xA5):    /* YEN SIGN */
	case UINT32_C(0xA7):    /* SECTION SIGN */
	case UINT32_C(0xA8):    /* DIAERESIS */
	case UINT32_C(0xA9):    /* COPYRIGHT SIGN */
	case UINT32_C(0xAB):    /* LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */
	case UINT32_C(0xAE):    /* REGISTERED SIGN */
	case UINT32_C(0xB0):    /* DEGREE SIGN */
	case UINT32_C(0xB4):    /* ACUTE ACCENT */
	case UINT32_C(0xB6):    /* PILCROW SIGN */
	case UINT32_C(0xBB):    /* RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */
	case UINT32_C(0xB1):    /* PLUS MINUS SIGN */
	case UINT32_C(0xBF):    /* INVERT QUESTION MARK */
	case UINT32_C(0xD7):    /* MULTIPLICATION SIGN */
	case UINT32_C(0xF7):    /* DIVISION SIGN */
	case UINT32_C(0x2010):  /* HYPHEN */
	case UINT32_C(0x2013):  /* EN DASH */
	case UINT32_C(0x2014):  /* EM DASH */
	case UINT32_C(0x2018):  /* LEFT SINGLE QUOTATION MARK */
	case UINT32_C(0x2019):  /* RIGHT SINGLE QUOTATION MARK */
	case UINT32_C(0x201C):  /* LEFT DOUBLE QUOTATION MARK */
	case UINT32_C(0x201D):  /* RIGHT DOUBLE QUOTATION MARK */
	case UINT32_C(0x2026):  /* HORIZONTAL ELLIPSIS */
	case UINT32_C(0x2030):  /* PER MILLE SIGN */
	case UINT32_C(0x20A3):  /* FRENCH FRANC SIGN */
	case UINT32_C(0x20A4):  /* LIRA SIGN */
	case UINT32_C(0x20A8):  /* RUPEE SIGN */
	case UINT32_C(0x20A9):  /* WON SIGN */
	case UINT32_C(0x20AC):  /* EURO SIGN */
	case UINT32_C(0x20B9):  /* INDIAN RUPEE SIGN */
	case UINT32_C(0x20BF):  /* BITCOIN SIGN */
	case UINT32_C(0x2205):  /* EMPTY SET */
	case UINT32_C(0x2212):  /* MINUS SIGN */
	case UINT32_C(0x221E):  /* INFINITY */
	case UINT32_C(0x2248):  /* ALMOST EQUAL TO */
	case UINT32_C(0x2260):  /* NOT EQUAL TO */
	case UINT32_C(0x2264):  /* LESS-THAN OR EQUAL TO */
	case UINT32_C(0x2265):  /* GREATER-THAN OR EQUAL TO */
	case UINT32_C(0xFDFC):  /* RIAL SIGN */
	case UINT32_C(0x1F10D): /* CIRCLED ZERO WITH SLASH */
	case UINT32_C(0x1F10E): /* CIRCLED ANTICKLOCKWISE ARROW */
	case UINT32_C(0x1F10F): /* CIRCLED DOLLAR SIGN WITH OVERLAID BACKSLASH */
	case UINT32_C(0x1F12F): /* COPYLEFT SYMBOL */
	case UINT32_C(0x1F16D): /* CIRCLED CC */
	case UINT32_C(0x1F16E): /* CIRCLED C WITH OVERLAID BACKSLASH */
	case UINT32_C(0x1F16F): /* CIRCLED HUMAN FIGURE */
		*_res = UINT8_C(0x1);
		break;
	}
	return UINT8_C(0x0);
}