aboutsummaryrefslogtreecommitdiff
path: root/arch/all/core/src/ctype/tab.c
blob: 60c6744a411f240f0c5a8143cd191561e25250f6 (plain)
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
/* ****************************************************************************
 * ctype/tab.c -- ASCII locale table for character identification.
 * Copyright (C) 1991-2016 Free Software Foundation, Inc <info@fsf.org>
 * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
 *
 * This file is part of the 'all/core' module,
 * in libcarrot, an experimental modular libc project.
 *
 * This file is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option)
 * any later version.
 *
 * This file 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 Lesser General Lesser Public
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this file.  If not, see <http://www.gnu.org/licenses/>.
 * ************************************************************************* */
#include <ctype.h>
#define _U _ISupper
#define _L _ISlower
#define _A _ISalpha
#define _D _ISdigit
#define _X _ISxdigit
#define _S _ISspace
#define _P _ISprint
#define _G _ISgraph
#define _B _ISblank
#define _C _IScntrl
#define _p _ISpunct
#define _a _ISalnum

/* repeating */
#define r4(F)  (F), (F), (F), (F)
#define r5(F)  r4(F),  (F)
#define r6(F)  r5(F),  (F)
#define r7(F)  r6(F),  (F)
#define r8(F)  r7(F),  (F)
#define r9(F)  r8(F),  (F)
#define r10(F) r9(F),  (F)
#define r15(F) r10(F), r5(F)
#define r16(F) r10(F), r6(F)
#define r20(F) r10(F), r10(F)
#define r26(F) r20(F), r6(F)

/* the main tab */
const unsigned short __ctype_b[] = {
	r9(_C), _C | _S | _B, r4(_C | _S), _C, _C, r16(_C),
	_B | _P | _S, r15(_P | _p),
	r10(_D | _X | _P), r7(_P | _p),
	r26(_A | _U | _P), r6(_P | _p),
	r6(_A | _U | _X | _P), r20(_A | _U | _P),
	r4(_P | _p), _C
};