3 # Compile list of HTML 4.0/XHTML entities.
5 my %ent=("amp" => 38, "lt" => 60, "gt" => 62);
7 foreach ("xhtml-lat1.ent", "xhtml-special.ent", "xhtml-symbol.ent")
9 open(F
, "<$_") or die "$_: $!\n";
13 while (defined($l=<F
>))
16 next unless $l =~ m/^<!ENTITY\s+([^\s]+)\s+"&#(\d+);">/;
22 print "static const char n[]={\n";
26 foreach (sort keys %ent)
35 foreach (0..length($n)-1)
37 $str .= $prev . ord(substr($n, $_, 1));
45 $prev .= (" " x
(40 - length($str)))
46 if (length($str) < 40);
48 $prev .= " /* $n */\n\t";
51 substr($prev, 0, 1)=" ";
55 print "$prev};\n\nstatic const struct i ii[]={";
61 foreach (sort keys %ent)
63 print $prev . "{$n, " . length($_) . ", $ent{$_}" . "}";