#!/bin/perl

$COLUMNS=9;
$ISO=7;
@ISOS= qw( 25 50 100 200 400 800 1600 3200 );
@SSPEEDS= (	"1/4000", "1/2000", "1/1000", "1/500", "1/250", "1/125",
		"1/60", "1/30", "1/15", "1/8", "1/4", "1/2",
		"1 sec", "2 sec", "4 sec", "8 sec", "15 sec", "30 sec",
		"1 min", "2 min", "4 min", "8 min", "15 min", "30 min" );
@FSTOPS= qw( 1 1.4 2 2.8 4 5.6 8 11 16 22 32 44 64 88 128 176 256 );

print "<html>\n";
print "<table border=1>\n";
print "  <tr>\n";
print "    <td align=center>ISO</td>\n";
print "    <td align=center>&nbsp;</td>\n";
print "    <td align=center colspan=$COLUMNS>f/stop</td>\n";
print "  </tr>\n";

$iso=0;
$fn=1;

for ($i=$iso; $i<$ISO; $i++) {
  print "  <tr>\n";
  print "    <td align=center>", $ISOS[$i],"</td>\n";
  print "    <td align=center>&nbsp;</td>\n";
  for ($f=0; $f<$COLUMNS; $f++) {
    print "    <td align=center>", $FSTOPS[$i+$f+$fn],"</td>\n";
  }
  print "  </tr>\n";
}

print "  <tr>\n";
print "  </tr>\n";
print "  <tr>\n";
print "    <td align=center>Subject</td>\n";
print "    <td align=center>Q</td>\n";
print "    <td align=center colspan=$COLUMNS>Shutter Speed</td>\n";
print "  </tr>\n";

for ($Q=8; $Q>=-11; $Q--) {
  if ($Q==8) {
    print "  <tr>\n";
    print "    <td align=center>Full Moon</td>\n";
    print "    <td align=center>$Q</td>\n";
  } elsif ($Q==7) {
    print "  <tr>\n";
    print "    <td align=center>Umbrela Contact<br>Gibbous Moon</td>\n";
    print "    <td align=center>$Q</td>\n";
  } elsif ($Q==6) {
    print "  <tr>\n";
    print "    <td align=center>Umbrela: Mag=0.25<br>Quarter Moon</td>\n";
    print "    <td align=center>$Q</td>\n";
  } elsif ($Q==5) {
    print "  <tr>\n";
    print "    <td align=center>Umbrela: Mag=0.50<br>Thick Crescent Moon</td>\n";
    print "    <td align=center>$Q</td>\n";
  } elsif ($Q==4) {
    print "  <tr>\n";
    print "    <td align=center>Umbrela: Mag=0.75<br>Thin Crescent Moon</td>\n";
    print "    <td align=center>$Q</td>\n";
  } elsif ($Q==-3) {
    print "  <tr>\n";
    print "    <td align=center>Totality: L=4</td>\n";
    print "    <td align=center>$Q</td>\n";
  } elsif ($Q==-5) {
    print "  <tr>\n";
    print "    <td align=center>Totality: L=3</td>\n";
    print "    <td align=center>$Q</td>\n";
  } elsif ($Q==-7) {
    print "  <tr>\n";
    print "    <td align=center>Totality: L=2</td>\n";
    print "    <td align=center>$Q</td>\n";
  } elsif ($Q==-9) {
    print "  <tr>\n";
    print "    <td align=center>Totality: L=1</td>\n";
    print "    <td align=center>$Q</td>\n";
  } elsif ($Q==-11) {
    print "  <tr>\n";
    print "    <td align=center>Totality: L=0</td>\n";
    print "    <td align=center>$Q</td>\n";
  } else {
      next;
  }
  for ($f=0; $f<$COLUMNS; $f++) {
    print "    <td align=center>", $SSPEEDS[8-$Q+$f],"</td>\n";
  }
  print "  </tr>\n";
}

print "</table>\n";


print "<br>Exposure Formula t=f2/(Ix2Q)\n";
print "<br>where: t=exposure time (sec)\n";
print "<br>where: f=f/stop\n";
print "<br>where: I=ISO film speed\n";
print "<br>where: Q=brightness exponent\n";
print "<br>by: F.Espenak\n";
print "<br>ref: <a href=http://www.mreclipse.com/LEphoto/image/LEexpo.GIF>";
print   "Origional image</a>\n";
print "<br>ref: <a href=http://www.mreclipse.com/LEphoto/LEphoto.html>";
print   "Origional Page</a>\n";
print "</html>\n";

