#!/usr/bin/env perl
# $Id: mktestunicode,v 1.3 2002/09/14 21:07:03 euske Exp $
#
# usage: mktestunicode cmap-unicode.src
#
# generate Unicode character table in html.
#
#	2002/2 by 1@2ch
#	* public domain *
#

print '<html><body>';
print '<p><strong>Caution! This is incredibly heavy..</strong>';
print '<table><tr><td></td>';
for($i = 0; $i < 16; $i++) {
    printf "<td>%x</td>", $i;
}
$c = 0;
$x = 0;
while(<>) {
    $x0 = $x;
    chop; split; $x = eval($_[0]);
#    next if ($x < 256);
    $c0 = $c;
    $c = $x % 16;
    if ($c < $c0 || $x0+15 < $x) {
	printf "</tr>\n<tr><td>%04x</td>%s", $x & 0xFFF0, "<td></td>" x $c;
    }
    print "<td>&#$x;</td>";
}
print "</tr></table></body></html>\n";
