ELinks 0.12pre3
[elinks/elinks-j605.git] / Unicode / gen-ent
blobe1f2d31828e389a963a03c215bb9508ce765a78c
1 #!/bin/sh
3 echo
4 echo Generating entity table.
6 sed -n '/^[^#]/,$p' < entities.txt | while read line; do \
7 name=$(echo "$line" | cut -f 1); \
8 code=$(echo "$line" | cut -f 3); \
9 desc=$(echo "$line" | cut -f 4 | sed 's/# //'); \
10 test "$code" = "0x????" && continue
11 printf "\t{ %-12s %s }, /* %-46s */\n" \
12 "\"$name\"," "$code" "$desc"; \
13 done | LC_ALL=C sort > tmp
14 N=`cat tmp | wc -l`
16 cat > ../src/intl/entity.inc <<EOF
17 /* Automatically generated by gen-ent */
19 static const struct entity { char *s; unicode_val_T c; } entities [$(expr $N + 1)] = {
20 $(cat tmp)
21 { NULL, 0 }
24 #define N_ENTITIES $N
25 EOF
26 rm -f tmp
27 echo Done.
28 echo