chiark / gitweb /
quacks-ingredients: wip Base vs Witches vs Both
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 28 Mar 2020 21:48:58 +0000 (21:48 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 28 Mar 2020 21:48:58 +0000 (21:48 +0000)
Put $which in everything

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
quacks-ingredients-counts
quacks-ingredients-counts.scad

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 $!;
index 1eeb70ce4f088a6ca42f654c89ce7ef3ea394286..3b0e28f29270b634d2e7feaf0dfc204b602d9482 100644 (file)
@@ -1,8 +1,8 @@
 //  autogenerated - do not edit
 //   update script is quacks-ingredients-updates-levels
 //   source is quacks-ingredients-counts
-module 1xFour(){ ////toplevel
-// 1xFour      total= 1  rowsz=1  nrows=1
+module Base_1xFour(){ ////toplevel
+// Base  1xFour      total= 1  rowsz=1  nrows=1
   union(){
     Frame($phase, token_pitch * [ 1 + 1.00, 1 + 0.50 ]);
     $nspots = 1;
@@ -21,8 +21,8 @@ module 1xFour(){ ////toplevel
     translate(token_pitch * [   0.0,   0.0 ]) Token_L();
   };
 }
-module 1xOne(){ ////toplevel
-// 1xOne       total= 1  rowsz=1  nrows=1
+module Base_1xOne(){ ////toplevel
+// Base  1xOne       total= 1  rowsz=1  nrows=1
   union(){
     Frame($phase, token_pitch * [ 1 + 1.00, 1 + 0.50 ]);
     $nspots = 1;
@@ -41,8 +41,8 @@ module 1xOne(){ ////toplevel
     $nspots = 4;
   };
 }
-module 1xThree(){ ////toplevel
-// 1xThree     total= 1  rowsz=1  nrows=1
+module Base_1xThree(){ ////toplevel
+// Base  1xThree     total= 1  rowsz=1  nrows=1
   union(){
     Frame($phase, token_pitch * [ 1 + 1.00, 1 + 0.50 ]);
     $nspots = 1;
@@ -61,8 +61,8 @@ module 1xThree(){ ////toplevel
     $nspots = 4;
   };
 }
-module 1xTwo(){ ////toplevel
-// 1xTwo       total= 1  rowsz=1  nrows=1
+module Base_1xTwo(){ ////toplevel
+// Base  1xTwo       total= 1  rowsz=1  nrows=1
   union(){
     Frame($phase, token_pitch * [ 1 + 1.00, 1 + 0.50 ]);
     $nspots = 1;
@@ -81,8 +81,8 @@ module 1xTwo(){ ////toplevel
     $nspots = 4;
   };
 }
-module 2xFour(){ ////toplevel
-// 2xFour      total= 2  rowsz=2  nrows=1
+module Base_2xFour(){ ////toplevel
+// Base  2xFour      total= 2  rowsz=2  nrows=1
   union(){
     Frame($phase, token_pitch * [ 2 + 1.00, 1 + 0.50 ]);
     $nspots = 1;
@@ -102,8 +102,8 @@ module 2xFour(){ ////toplevel
     translate(token_pitch * [   0.5,   0.0 ]) Token_L();
   };
 }
-module 2xOne(){ ////toplevel
-// 2xOne       total= 2  rowsz=2  nrows=1
+module Base_2xOne(){ ////toplevel
+// Base  2xOne       total= 2  rowsz=2  nrows=1
   union(){
     Frame($phase, token_pitch * [ 2 + 1.00, 1 + 0.50 ]);
     $nspots = 1;
@@ -123,8 +123,8 @@ module 2xOne(){ ////toplevel
     $nspots = 4;
   };
 }
-module 2xThree(){ ////toplevel
-// 2xThree     total= 2  rowsz=2  nrows=1
+module Base_2xThree(){ ////toplevel
+// Base  2xThree     total= 2  rowsz=2  nrows=1
   union(){
     Frame($phase, token_pitch * [ 2 + 1.00, 1 + 0.50 ]);
     $nspots = 1;
@@ -144,8 +144,8 @@ module 2xThree(){ ////toplevel
     $nspots = 4;
   };
 }
-module 2xTwo(){ ////toplevel
-// 2xTwo       total= 2  rowsz=2  nrows=1
+module Base_2xTwo(){ ////toplevel
+// Base  2xTwo       total= 2  rowsz=2  nrows=1
   union(){
     Frame($phase, token_pitch * [ 2 + 1.00, 1 + 0.50 ]);
     $nspots = 1;
@@ -165,8 +165,8 @@ module 2xTwo(){ ////toplevel
     $nspots = 4;
   };
 }
-module 3xFour(){ ////toplevel
-// 3xFour      total= 3  rowsz=2  nrows=2
+module Base_3xFour(){ ////toplevel
+// Base  3xFour      total= 3  rowsz=2  nrows=2
   union(){
     Frame($phase, token_pitch * [ 2 + 1.00, 2 + 0.50 ]);
     $nspots = 1;
@@ -187,8 +187,8 @@ module 3xFour(){ ////toplevel
     translate(token_pitch * [   0.5,  -0.5 ]) Token_L();
   };
 }
-module 3xOne(){ ////toplevel
-// 3xOne       total= 3  rowsz=2  nrows=2
+module Base_3xOne(){ ////toplevel
+// Base  3xOne       total= 3  rowsz=2  nrows=2
   union(){
     Frame($phase, token_pitch * [ 2 + 1.00, 2 + 0.50 ]);
     $nspots = 1;
@@ -209,8 +209,8 @@ module 3xOne(){ ////toplevel
     $nspots = 4;
   };
 }
-module 3xThree(){ ////toplevel
-// 3xThree     total= 3  rowsz=2  nrows=2
+module Base_3xThree(){ ////toplevel
+// Base  3xThree     total= 3  rowsz=2  nrows=2
   union(){
     Frame($phase, token_pitch * [ 2 + 1.00, 2 + 0.50 ]);
     $nspots = 1;
@@ -231,8 +231,8 @@ module 3xThree(){ ////toplevel
     $nspots = 4;
   };
 }
-module 3xTwo(){ ////toplevel
-// 3xTwo       total= 3  rowsz=2  nrows=2
+module Base_3xTwo(){ ////toplevel
+// Base  3xTwo       total= 3  rowsz=2  nrows=2
   union(){
     Frame($phase, token_pitch * [ 2 + 1.00, 2 + 0.50 ]);
     $nspots = 1;
@@ -253,8 +253,8 @@ module 3xTwo(){ ////toplevel
     $nspots = 4;
   };
 }
-module Black(){ ////toplevel
-// Black       total=18  rowsz=5  nrows=4
+module Base_Black(){ ////toplevel
+// Base  Black       total=18  rowsz=5  nrows=4
   union(){
     Frame($phase, token_pitch * [ 5 + 1.00, 4 + 0.50 ]);
     $nspots = 1;
@@ -290,8 +290,8 @@ module Black(){ ////toplevel
     $nspots = 4;
   };
 }
-module Blue(){ ////toplevel
-// Blue        total=34  rowsz=6  nrows=6
+module Base_Blue(){ ////toplevel
+// Base  Blue        total=34  rowsz=6  nrows=6
   union(){
     Frame($phase, token_pitch * [ 6 + 1.00, 6 + 0.50 ]);
     $nspots = 1;
@@ -343,8 +343,8 @@ module Blue(){ ////toplevel
     translate(token_pitch * [   2.5,   0.5 ]) Token_L();
   };
 }
-module Green(){ ////toplevel
-// Green       total=38  rowsz=7  nrows=6
+module Base_Green(){ ////toplevel
+// Base  Green       total=38  rowsz=7  nrows=6
   union(){
     Frame($phase, token_pitch * [ 7 + 1.00, 6 + 0.50 ]);
     $nspots = 1;
@@ -400,8 +400,8 @@ module Green(){ ////toplevel
     translate(token_pitch * [   3.0,  -1.5 ]) Token_L();
   };
 }
-module Orange(){ ////toplevel
-// Orange      total=20  rowsz=5  nrows=4
+module Base_Orange(){ ////toplevel
+// Base  Orange      total=20  rowsz=5  nrows=4
   union(){
     Frame($phase, token_pitch * [ 5 + 1.00, 4 + 0.50 ]);
     $nspots = 1;
@@ -439,8 +439,8 @@ module Orange(){ ////toplevel
     $nspots = 4;
   };
 }
-module Purple(){ ////toplevel
-// Purple      total=15  rowsz=4  nrows=4
+module Base_Purple(){ ////toplevel
+// Base  Purple      total=15  rowsz=4  nrows=4
   union(){
     Frame($phase, token_pitch * [ 4 + 1.00, 4 + 0.50 ]);
     $nspots = 1;
@@ -473,8 +473,8 @@ module Purple(){ ////toplevel
     $nspots = 4;
   };
 }
-module Red(){ ////toplevel
-// Red         total=30  rowsz=6  nrows=5
+module Base_Red(){ ////toplevel
+// Base  Red         total=30  rowsz=6  nrows=5
   union(){
     Frame($phase, token_pitch * [ 6 + 1.00, 5 + 0.50 ]);
     $nspots = 1;
@@ -522,8 +522,8 @@ module Red(){ ////toplevel
     translate(token_pitch * [   2.5,   2.0 ]) Token_L();
   };
 }
-module White(){ ////toplevel
-// White       total=32  rowsz=6  nrows=6
+module Base_White(){ ////toplevel
+// Base  White       total=32  rowsz=6  nrows=6
   union(){
     Frame($phase, token_pitch * [ 6 + 1.00, 6 + 0.50 ]);
     $nspots = 1;
@@ -573,8 +573,8 @@ module White(){ ////toplevel
     $nspots = 4;
   };
 }
-module Yellow(){ ////toplevel
-// Yellow      total=29  rowsz=6  nrows=5
+module Base_Yellow(){ ////toplevel
+// Base  Yellow      total=29  rowsz=6  nrows=5
   union(){
     Frame($phase, token_pitch * [ 6 + 1.00, 5 + 0.50 ]);
     $nspots = 1;
@@ -621,5 +621,5 @@ module Yellow(){ ////toplevel
     translate(token_pitch * [   2.5,   1.0 ]) Token_L();
   };
 }
-// total_count=240   total_real_count=216
-// max_rowsz=7       max_nrows=6
+// Base  total_count=240   total_real_count=216
+// Base  max_rowsz=7       max_nrows=6