chiark / gitweb /
layout-test
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 1 Mar 2019 23:32:49 +0000 (23:32 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 1 Mar 2019 23:32:49 +0000 (23:32 +0000)
.gitignore
Makefile
generate-board

index 6c8bb5fec1cde1e0d89be143f5f1c1a0352b5ccf..70b6e507db5b34d2b29ff7f198202cf02e15cc0d 100644 (file)
@@ -6,3 +6,4 @@ faces.plag
 .opt.plag.sums
 *.tmp
 test.ps
+layout-test.ps
index da99ce3d288f117be43454d3a8c41e1af00fadaf..e8f3a45b076d968dcbba8beb36bcec4ec3042203 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@ PLANAR_GRAPH=planar-graph
 
 default: all
 
-all: test.ps
+all: test.ps layout-test.ps
 
 map.plag: generate-plag input-graph Parse.pm 
        ./$< input-graph $o
@@ -28,7 +28,10 @@ faces.plag: opt.plag $(PLANAR_GRAPH) Makefile
        $(PLANAR_GRAPH) RF $< W-FACES $@.tmp && $i
 
 test.ps: generate-board faces.plag input-graph misc-data.pl
-       ./$(filter-out misc-data.pl,$^) $o
+       ./generate-board -XS faces.plag input-graph $o
+
+layout-test.ps: test.ps Makefile
+       ./generate-board -XW faces.plag input-graph $o
 
 #map.ps: map.dot
 #      neato -Tps $^ $o
index 6554c2b83a4af97dbfb36c1398d361d67178a5c2..bd680f08ab029d4804a3709a3b5b04a599e54882 100755 (executable)
@@ -16,6 +16,7 @@ BEGIN { unshift @INC, qw(.); }
 
 use Parse;
 
+our $xopts;
 our $facesf;
 our %vxname2pos; # $vxname2pos{VXNAME} = Math::GSL::Vector
 
@@ -295,13 +296,15 @@ sub pscolour ($;$) {
 
 sub preamble() {
   o("%!\n");
-  o(" 0.52 dup scale\n"); # xxx bodge, want boundingbox or something
+  o(" 0.52 dup scale\n") if $xopts =~ m/S/;
+  # xxx bodge, want boundingbox or something
 }
 
 sub facepscolour ($) {
   my ($colourname) = @_;
-  pscolour($c{Colours}{$colourname},
-          sub { $_ = 1.0 - 0.75 * (1.0 - $_) foreach @_ });
+  $xopts =~ m/W/ ? '1 setgray'
+      : pscolour($c{Colours}{$colourname},
+                sub { $_ = 1.0 - 0.75 * (1.0 - $_) foreach @_ });
 }
     
 sub fill_faces() {
@@ -398,8 +401,14 @@ END
   }
 }
 
+sub postamble () {
+  o("showpage\n");
+}
+
 #----- main program -----
 
+$xopts = shift @ARGV if $ARGV[0] =~ s/^-X//;
+
 ($facesf, @ARGV) = @ARGV or die;
 parse_input_graph();
 prep_region_rmap();
@@ -412,6 +421,7 @@ preamble();
 fill_faces();
 edge_faces();
 label_faces();
+postamble();
 
 print STDERR Dumper(\%region) if $ENV{'GENERATE_BOARD_DUP'};