#!/usr/bin/perl
#########################################################################
#                                                                       #
#  program to generate the lower end of unicode output as an html file  #
#                           by Paul Grosse                              #
#                                                                       #
#########################################################################

($c, $tw, $ll, $ul) = (1, 8, 32, 4095);

# $c is just a counter and should be set to 1,
# $tw is the table width in sets of columns and can be set to whatever will fill your screen,
# $ll is the lower limit of the code you want to see,
# $ul is the upprt limit of the code you want to see in the table.


# Now the program itself.
# Create header and start of table
open (FH, ">unicode.html");
  print FH "<html>\n<head>\n<title>Unicode symbols</title>\n</head>\n<body>\n";
  # Note that we don't set any coding - this is so that you can experiment by
  #   setting it yourself in the browser.
  print FH "<h1>Unicode symbols</h1><table align=\"center\">\n<tr>";

  # if your fonts don't support &#333;, then remove the '#' from the next line and put one at the start of the one after.
  #print FH ("<th>No</th><th>Hex</th><th>Char</th><td>&nbsp;</td>") x ($tw);
  print FH ("<th>N&\#333;</th><th>Hex</th><th>Char</th><td>&nbsp;</td>") x ($tw);


  print FH "</tr>\n";

  # Create body of table
  print FH "<tr>";
  foreach $x ($ll..$ul) {
    printf FH "<td align=\"right\">%d</td><td align=\"center\">%x</td><td align=\"left\">&\#%d;</td>", ($x) x 3;
    if ($c >= $tw) {
      print FH "</tr>\n<tr>";
      $c = 1;
    } else {
      print FH "<td>&nbsp;</td>";
      $c++;
    }
  }
  # Add end of file
  print FH "</tr>\n";
  print FH "</table></body>\n</html>\n";

close FH;
