#!/usr/bin/perl
#
# Scan the directory, find the boards, and make an HTML
# table describing what we found.
$WEBURL = "https://svn.so-much-stuff.com/svn/trunk/Eagle/projects/DEC";
#
#
# row 1, cell 1 |
# row 1, cell 2 |
#
#
# row 2, cell 1 |
# row 2, cell 2 |
#
#
#
# Keep these tables ordered as you want them presented
# (and the indices must line up).
@suffix = (
".pdf",
".brd",
".sch",
"front.jpg",
"back.jpg",
".wtb",
".wts",
".xpl",
"ds.pdf",
"ds2.pdf",
# "brd.pdf",
# "sch.pdf",
# "hb.pdf",
);
@desc = (
"PDF schematic",
"Eagle board",
"Eagle schematic",
"Front side photo",
"Back side photo",
"Want to buy",
"Want to sell",
"Have example",
"Data Sheet",
"Another Data Sheet",
"Eagle board PDF",
"Eagle schematic PDF",
"Logic Handbook PDF",
);
#
# Look at the situation with respect to a board and decide what
# next further action should be taken.
# $d is the name of the directory.
# $b is the name of the board (M111A).
# $d2 is the basename of the module (M111).
sub NextAction {
#
# Warn if there's a photo, but no schematic or exemplar.
($pdf) = <$d/${d2}[A-z]*.pdf>;
warn "$d/$b: photos without .pdf!\n"
if (! -f "$d/${d2}.xpl") && (! -f $pdf)
&& (-f "$d/${b}front.jpg" && -f "$d/${b}back.jpg");
#
# A .pdf should imply a photograph, .wtb or .xpl.
# return print STDERR "$d/$b: Missing .wtb and .xpl!\n"
# if ! (-f "$d/$b.wtb" || -f "$d/$b.xpl");
#
# A .wts should imply a .xpl.
return print STDERR "$d/$b: Missing $d/$b.xpl!\n"
if -f "$d/$b.wts" && ! -f "$d/$b.xpl";
#
# A .xpl should imply no .wtb.
return print STDERR "$d/$b: .wtb with $d/$b.xpl!\n"
if -f "$d/$b.xpl" && -f "$d/$b.wtb";
# A .wtb should imply no .wts or .xpl.
# (A .wtb with .xpl already checked for.)
return print STDERR "$d/$b: .wtb with .wts!\n"
if -f "$d/$b.wtb" && -f "$d/$b.wts";
#
# A .xpl of the board should imply photographs of the board.
return print STDERR "$d/$b: .xpl without photos!\n"
if -f "$d/$b.xpl" && ! (-f "$d/${b}front.jpg" && -f "$d/${b}back.jpg");
#
# Photographs of the board should imply the existence of .sch and .brd.
return print STDERR "$d/$b: needs Eagle drawings!\n"
if (-f "$d/${b}front.jpg" && -f "$d/${b}back.jpg")
&& ! (-f "$d/$b.sch" && -f "$d/$b.brd");
#
# Existence of schematic and board should imply a .pdf
return print STDERR "$d/$b: needs .pdf!\n"
if -f "$d/$b.sch" && ! -f "$d/$b.pdf";
#
# A .pdf should imply the existence of .sch and .brd for an "X"
# version of the board, as well.
# BUGBUG: for now, check for the .brd instead.
return print STDERR "$d/$b: needs Eagle 'X' version!\n"
# if -f "$d/$b.pdf"
if -f "$d/$b.brd"
&& ! (-f "$d/${d2}X.sch" && -f "$d/${d2}X.brd")
&& ! (-f "$d/${d2}.nox");
#
# I can't believe something got finished!
return 0;
}
$modules = "modules";
open(MTXT, ">$modules.txt") || die "$modules.txt: $!";
print MTXT "Module\tVersions Description\r\n";
open(MHTM, ">$modules.htm") || die "$modules.htm: $!";
print MHTM "\r\n";
print MHTM "Module";
print MHTM " | Versions | Description |
\r\n";
for $d1 ('Axxx', 'Bxxx', 'Gxxx', 'Hxxx', 'Kxxx', 'Mxxx', 'Rxxx', 'Sxxx', 'Wxxx') {
opendir(DIR1, $d1) || die "$d1: $!";
open(STDOUT, ">$d1.htm") || die "$d1.htm: $!";
print "\n";
print "
$d1
\n";
print "
";
print "
";
}
close(MTXT);
close(MHTM);