Blob


1 #!/bin/sh
3 sed -e '/^$/d' \
4 -e '/^#/d' \
5 -e 's/;.*//' \
6 -e 's/[ \t]*$//' \
7 -e 's/\.\./ /' \
8 data/emoji.txt \
9 | awk '
10 BEGIN {
11 print "#include \"utf8.h\""
12 print "int is_emoji(uint32_t cp) {"
14 e=""
15 }
17 {
18 if (NF == 1) {
19 printf("%sif (cp == 0x%s)", e, $1);
20 } else {
21 printf("%sif (cp >= 0x%s && cp <= 0x%s)", e, $1, $2);
22 }
24 print " return 1;"
26 e="else "
27 }
29 END {
30 print "return 0; }"
31 }
33 '