X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=quacks-ingredients-counts;h=fefbc72a1c046874f5eafa9363acceca948780db;hb=2132efba59634024b51ec9c19eb40a490081cfc9;hp=46d7f1bee8c294027a22e71bca1eeaa1627866b3;hpb=c8d10b1959359d727f4fa1daf42c5985d6bf46d1;p=reprap-play.git diff --git a/quacks-ingredients-counts b/quacks-ingredients-counts index 46d7f1b..fefbc72 100755 --- a/quacks-ingredients-counts +++ b/quacks-ingredients-counts @@ -26,7 +26,7 @@ our @names = split /\t/, $_; our %count; -foreach my $nspots (qw(1 2 3 4)) { +foreach my $nspots (qw(1 2 3 4 0)) { $_=; chomp or die; xdata sub { my ($xcount,$xnspots) = @_; @@ -36,7 +36,7 @@ foreach my $nspots (qw(1 2 3 4)) { foreach my $i (0..$#names) { $_ = $l[$i] || '0+0'; $_ ||= 0; - m/\+/; + m/\+/ or die "$which $nspots ?"; $count{$names[$i]}{$nspots} = $which eq 'All' ? $` + $' : @@ -57,9 +57,10 @@ our $max_nrows=0; our $max_rowsz=0; sub wrtoplevel () { - print "module ${which}_$name(){ ////toplevel\n"; my $cs = $count{$name}; my $total = 0; $total += $_ foreach values %$cs; + return unless $total; + print "module ${which}_$name(){ ////toplevel\n"; my $rowsz = ceil(sqrt($total)); my $nrows = ceil($total / $rowsz); $total_count += $total; @@ -102,8 +103,9 @@ END STDOUT->error and die $!; __DATA__ -White Green Blue Red Yellow Purple Black Orange -20+6 15+10 14+8 12+6 13+6 15+8 18+8 20+12 -8+3 10+5 10+5 8+5 6+5 -4+2 +White Green Blue Red Yellow Purple Black Orange Orange6 Loco WhiteSpare +21+6 15+10 14+8 12+6 13+6 15+8 18+8 20+12 1+0 +9+3 10+5 10+5 8+5 6+5 1+0 +5+2 1+0 13+5 10+5 10+5 10+5 + 0+20 0+25