aboutsummaryrefslogtreecommitdiff
path: root/gen/prop/bool-props
blob: 010dbf8380c49c759069ee79875b200c89b62888 (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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/sh

set -e
cd "${0%/*}/../.."

props1='
ahex=ASCII_Hex_Digit
bidi_c=Bidi_Control
dash=Dash
dep=Deprecated
dia=Diacritic
ext=Extender
hex=Hex_Digit
id_compat_math_continue=ID_Compat_Math_Continue
id_compat_math_start=ID_Compat_Math_Start
ideo=Ideographic
idsb=IDS_Binary_Operator
loe=Logical_Order_Exception
pat_syn=Pattern_Syntax
pat_ws=Pattern_White_Space
pcm=Prepended_Concatenation_Mark
qmark=Quotation_Mark
radical=Radical
sd=Soft_Dotted
sterm=Sentence_Terminal
term=Terminal_Punctuation
uideo=Unified_Ideograph
vs=Variation_Selector
wspace=White_Space
'

props2='
alpha=Alphabetic
cased=Cased
ci=Case_Ignorable
cwcf=Changes_When_Casefolded
cwcm=Changes_When_Casemapped
cwl=Changes_When_Lowercased
cwt=Changes_When_Titlecased
cwu=Changes_When_Uppercased
di=Default_Ignorable_Code_Point
gr_base=Grapheme_Base
gr_ext=Grapheme_Extend
idc=ID_Continue
ids=ID_Start
incb=Indic_Conjunct_Break
lower=Lowercase
math=Math
upper=Uppercase
xidc=XID_Continue
xids=XID_Start
'

props3='
ebase=Emoji_Modifier_Base
ecomp=Emoji_Component
emod=Emoji_Modifier
emoji=Emoji
epres=Emoji_Presentation
extpict=Extended_Pictographic
'

props4='
cwkcf=Changes_When_NFKC_Casefolded
comp_ex=Full_Composition_Exclusion
'

props5='
bidi_m=Bidi_Mirrored
'

props6='
ce=Composition_Exclusion
'

manual='
idst=IDS_Trinary_Operator
idsu=IDS_Unary_Operator
join_c=Join_Control
nchar=Noncharacter_Code_Point
ri=Regional_Indicator
'

gen()
{
	local p=${1%%=*}
	printf 'sh -c "gen/prop/bool-props.py %s %s %s >%s"\n' \
		${1#*=} $p data/$2 lib/unicode/prop/uprop_is_$p.c
}

(
	IFS='
'
	parallel-moreutils -- $(
		for prop in $props1; do gen $prop PropList                  & done
		for prop in $props2; do gen $prop DerivedCoreProperties     & done
		for prop in $props3; do gen $prop emoji-data                & done
		for prop in $props4; do gen $prop DerivedNormalizationProps & done
		for prop in $props5; do gen $prop DerivedBinaryProperties   & done
		for prop in $props6; do gen $prop CompositionExclusions     & done
	)
)

printf '[[_mlib_pure]] bool uprop_is_%s(rune);\n' \
	$(printf '%s\n' $props1 $props2 $props3 $props4 $props5 $props6 \
	  | cut -d= -f1) \
| gawk '
	/PROP PREDICATES END/ { no = 0 }
	FILENAME != "-" && !no { print }
	FILENAME == "-" { funcs[++i] = $0 }

	/PROP PREDICATES START/ {
		no = 1
		asort(funcs)
		for (i = 1; i <= length(funcs); i++)
			print funcs[i]
	}
' - include/unicode/prop.h | sponge include/unicode/prop.h

wait
for prop in $manual
do
	shrt=${prop%%=*}
	printf 'Function uprop_is_%s() implemented manually\n' $shrt >&2
done