#!/usr/bin/perl

#
# List work related to PDP-8 stuff.

@todo = (
# *linc8,
# *straight8,
# *pdp8s,
# *pt08,
# *tu55,
# *tc01,
# *tc08,
# *pdp8i,
  *pdp8l,
# *pdp12,
);


#
# Straight-8 list cleaned up from one by Rob Krten.
@linc8 = (
  "A130", "A401", "A502", "A601", "A604", "A704", "A706", "B104", # linc8
  "B115", "B117", "B130", "B171", "B204", "B360", "B602", "B684", # linc8
# The 5 G882 appear to be misidentified as G885 in module locator.
  "G007", "G008", "G208", "G209", "G882", "G906", "R001", "R002", # linc8
  "R107", "R111", "R113", "R121", "R122", "R123", "R141", "R151", # linc8
  "R181", "R201", "R202", "R203", "R204", "R210", "R211", "R212", # linc8
  "R220", "R302", "R303", "R401", "R405", "R410", "R601", "R602", # linc8
  "R603", "R613", "R650", "S107", "S111", "S151", "S181", "S202", # linc8
# S623 is most likely a typo for S603.
  "S203", "S205", "S284", "S602", "S603", "W002", "W005", "W011", # linc8
  "W021", "W023", "W024", "W025", "W026", "W031", "W033", "W034", # linc8
  "W035", "W050", "W070", "W072", "W073", "W300", "W500", "W501", # linc8
# MC31 is W640, not W650; calculates IOPn.
  "W607", "W640" # linc8
);

@straight8 = (
  "A502", "A601", "A604", "A704", "B104", "B130", "B204", "B360", # straight8
  "B684", "G007", "G008", "G208", "G209", "R002", "R107", "R111", # straight8
  "R113", "R121", "R123", "R151", "R201", "R202", "R203", "R205", # straight8
# Most straight-8 actually use a 1.3Mhz R405 instead of the R408.
# "R211", "R212", "R220", "R302", "R401", "R405", "R408", "R603", # straight8
  "R211", "R212", "R220", "R302", "R401", "R405",         "R603", # straight8
  "R650", "S107", "S111", "S151", "S181", "S202", "S203", "S205", # straight8
  "S284", "S602", "S603", "W005", "W011", "W024", "W025", "W026", # straight8
  "W050", "W070", "W300", "W501", "W512", "W607", "W640" # straight8
);

@pdp8s = (
  "A702", "G609", "G803", "R001", "R002", "R107", "R111", "R113", # pdp8s
  "R151", "R202", "R302", "R401", "R602", "R603", "W005", "W021", # pdp8s
  "W028", "W050", "W108", "W501", "W506", "W532" # pdp8s
);

@pt08 = (
  "R401", "W002", "W005", "W070", "W103", "W511", "W705", "W706", # pt08
  "W707" # pt08
);

@tu55 = (
  "G850", "G851", "R002", "R107", "R303", "W040", "W990" # tu55
);

@tc01 = (
  "G853", "G882", "R002", "R113", "R123", "R141", "R201", "R302", # tc01
  "R303", "R401", "S107", "S111", "S151", "S202", "S203", "S205", # tc01
  "S602", "S603", "W005", "W021", "W023", "W032", "W050", "W103", # tc01
  "W520" # tc01
);

@tc08 = (
  "G888", "G879", "M101", "M103", "M111", "M113", "M115", "M117", # tc08
  "M119", "M121", "M161", "M206", "M207", "M228", "M302", "M307", # tc08
  "M401", "M502", "M602", "M627", "M623", "M903", "M633", "M916", # tc08
  "W005", "W023", "W032" # tc08
);

@pdp8i = (
  "A607", "G020", "G021", "G221", "G228", "G610", "G611", "G624", # pdp8i
  "G826", "M040", "M113", "M115", "M117", "M119", "M160", "M162", # pdp8i
  "M216", "M220", "M310", "M360", "M401", "M405", "M452", "M501", # pdp8i
  "M506", "M516", "M617", "M651", "M660", "M661", "M700", "M701", # pdp8i
  "M702", "M703", "M704", "M705", "M706", "M707", "M708", "M709", # pdp8i
  "M710", "M714", "M715", "M716", "W011", "W025", # pdp8i
);

@pdp8l = (
  "G020", "G221", "G228", "G610", "G611", "G624", "G785", "G826", # pdp8l
  "M002", "M111", "M113", "M115", "M117", "M119", "M160", "M162", # pdp8l
  "M216", "M220", "M310", "M360", "M452", "M516", "M617", "M623", # pdp8l
  "M660", "M700", "M703", "M705", "M706", "M707", "M710", "M715", # pdp8l
  "M901", "M903", "M906", "M908", "W025", "W076", # pdp8l
);

@mm8i = (
  "G021", "G221", "G228", "G624", "G717", "G805", "G826", "M113", # mm8i
  "M206", "M216", "M310", "M360", "M617", "W033", # mm8i
);

@pdp12 = (
  "A131", "A215", "A404", "A615", "A811", "G021", "G221", "G228", # pdp12
  "G624", "G718", "G780", "G783", "G793", "G805", "G826", "G853", # pdp12
  "G882", "G916", "M101", "M103", "M111", "M112", "M113", "M115", # pdp12
  "M117", "M119", "M121", "M141", "M160", "M161", "M166", "M169", # pdp12
  "M212", "M216", "M217", "M221", "M222", "M304", "M307", "M310", # pdp12
  "M360", "M401", "M405", "M452", "M503", "M516", "M602", "M617", # pdp12
  "M623", "M627", "M660", "M700", "M706", "M707", "M711", "M719", # pdp12
  "M720", "M760", "M900", "M904", "M906", "R107", "R303", "W021", # pdp12
  "W023", "W025", "W032", "W078", "W512", "W520", "W603", # pdp12
);

foreach $d (@todo) {
  *dev = $d;
  $missing = 0;
  for $m (@dev) {
    next if $m eq "G609"; # Skip core plane interface for now
    next if $m eq "G610"; # Skip core plane interface for now
    $m =~ /^(.)/;
    $dir = "$1" . "xxx";
    unless (-f "$dir/$m/${m}X.brd" || -f "$dir/$m/$m.nox") {
      # warn "$dir/$m/${m}X.brd is missing\n";
      $missing{"$dir/$m/${m}X.brd"} = 1;
      $missing++;
    }
    @images = <$dir/$m/${m}?back.jpg>;
    unless (-f $images[0]) {
      # warn "$dir/$m/${m}*.jpg is missing\n";
      $missing{"$dir/$m/${m}*.jpg"} = 1;
      # $missing++;
    }
  }
  if ($missing) {
      print "$d is missing ", $missing, " module types\n";
  } else {
      print "$d is finished!\n";
  }
}

foreach $m (sort keys %missing) {
  print "$m is missing\n";
}
