chiark / gitweb /
quacks-ingredients: wip Base vs Witches vs Both
[reprap-play.git] / quacks-ingredients-counts
index 15e6bd8c52ad5325d053964c85a90375de365c02..4913f3cf90504f693381f2f4b1d5a0e0a2bdd4d6 100755 (executable)
@@ -39,7 +39,7 @@ foreach my $nspots (qw(1 2 3 4)) {
        m/\+/;
        
        $count{$names[$i]}{$nspots} =
-           $which eq 'Both'    ? $` + $' :
+           $which eq 'All'    ? $` + $' :
            $which eq 'Base'    ? $`      :
            $which eq 'Witches' ?      $' :
            die "$which ?";
@@ -57,7 +57,7 @@ our $max_nrows=0;
 our $max_rowsz=0;
 
 sub wrtoplevel () {
-    print "module $name(){ ////toplevel\n";
+    print "module ${which}_$name(){ ////toplevel\n";
     my $cs = $count{$name};
     my $total = 0; $total += $_ foreach values %$cs;
     my $rowsz = ceil(sqrt($total));
@@ -67,8 +67,8 @@ sub wrtoplevel () {
     $max_nrows = $nrows if $nrows > $max_nrows;
     $max_rowsz = $rowsz if $rowsz > $max_rowsz;
     my $ix = 0;
-    printf "// %-10s  total=%2d  rowsz=$rowsz  nrows=$nrows\n",
-       "$name", $total;
+    printf "// %-5s %-10s  total=%2d  rowsz=$rowsz  nrows=$nrows\n",
+       $which, "$name", $total;
     foreach my $nspots (sort keys %$cs) {
        my $c = $cs->{$nspots};
        print <<END;
@@ -95,8 +95,8 @@ foreach $name (sort keys %count) {
 }
 
 print <<END;
-// total_count=$total_count   total_real_count=$total_real_count
-// max_rowsz=$max_rowsz       max_nrows=$max_nrows
+// $which  total_count=$total_count   total_real_count=$total_real_count
+// $which  max_rowsz=$max_rowsz       max_nrows=$max_nrows
 END
 
 STDOUT->error and die $!;