Merge with git+ssh://pasky.or.cz/srv/git/elinks.git
[elinks.git] / Unicode / gen-ent
blob1fdf1ffe380270febcf00eac4f9f197bca88e14f
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 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