2005-09-15 09:58:31 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo Generating entity table.
|
2006-01-03 10:43:31 -05:00
|
|
|
|
|
|
|
sed -n '/^[^#]/,$p' < entities.txt | while read line; do \
|
|
|
|
name=$(echo "$line" | cut -f 1); \
|
|
|
|
code=$(echo "$line" | cut -f 3); \
|
|
|
|
desc=$(echo "$line" | cut -f 4 | sed 's/# //'); \
|
|
|
|
printf "\t{ %-12s %s }, /* %-46s */\n" \
|
|
|
|
"\"$name\"," "$code" "$desc"; \
|
|
|
|
done | LC_ALL=C sort > tmp
|
2005-09-15 09:58:31 -04:00
|
|
|
N=`cat tmp | wc -l`
|
2006-01-03 10:43:31 -05:00
|
|
|
|
|
|
|
cat > ../src/intl/entity.inc <<EOF
|
|
|
|
/* Automatically generated by gen-ent */
|
|
|
|
|
|
|
|
struct entity { char *s; unicode_val_T c; } entities [$(expr $N + 1)] = {
|
|
|
|
$(cat tmp)
|
|
|
|
{ NULL, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
#define N_ENTITIES $N
|
|
|
|
EOF
|
2005-09-15 09:58:31 -04:00
|
|
|
rm -f tmp
|
|
|
|
echo Done.
|
|
|
|
echo
|