chiark / gitweb /
extractgraph in Makefile, still wip
authorian <ian>
Sun, 13 Mar 2005 08:33:54 +0000 (08:33 +0000)
committerian <ian>
Sun, 13 Mar 2005 08:33:54 +0000 (08:33 +0000)
layout/.cvsignore
layout/Makefile
layout/extractgraph
layout/informat.txt
layout/layout

index fd3503958d979d60d3e2303bcb17f54581755a58..b1842cc0c216bb655c7614ba275c2747f2226c5a 100644 (file)
@@ -14,3 +14,4 @@ tmp.*
 ui-plan-*.ppm
 parts.ps
 *-a.ps
+ours.graph.c
index 89edfff513bb613be69a9b8e7c7297e2a5cc4c49..9b90c83402d1a0499b7ae870c5c7652e06a3e48a 100644 (file)
@@ -1,4 +1,4 @@
-include ../cprogs.make
+#include ../cprogs.make
 
 M4INCS=                parts.i4
 
@@ -23,7 +23,7 @@ CPROGS=               subseg2display compose-segenco
 default:       $(CPROGS) for-test-ui
 all:           default lpages layers extras
 for-test-ui:   ours.dgram-bot.segcmap subseg2display \
-               ui-plan-bot.ppm
+               ui-plan-bot.ppm ours.graph.c
 
 layers:                $(LAYERS)
 lpages:                $(LPAGES)
@@ -71,6 +71,11 @@ compose-segenco: compose-segenco.o
                        -sDEVICE=ppmraw -r72 -g595x842 \
                        -sOutputFile=$@.new $< && mv -f $@.new $@
 
+ours.graph.c:  extractgraph ours.dgram-bot.p0.segenco.ps
+               ./$^ $o
+# Strictly, this is wrong as it only uses layer 0.  When we have more
+# layers, should put them all in same segenco specially for extractgraph
+
 ours-l%.ps:    ours.d4 layout
                ./layout <$< -l$* $(LAYOUTOPTS) $(XLAYOUTOPTS_LAYER) $o
 
index 7a5c30d96674ba0855ae3987c6bb4d2d7eee4aad..3873ddb0146fc5a5302f65c3059dcfeb899d488e 100755 (executable)
@@ -49,7 +49,7 @@ $conf{MinClearDist}= 2.0;
 $conf{MaxTolerDist}= 0.2;
 $conf{MinClearAngle}= 5.0;
 $conf{MaxTolerAngle}= 0.5;
-$conf{LayerKinds}= ''; # comma-separated list
+$conf{LayerKinds}= ','; # comma-separated list as for split /\,/, ..., -1;
 
 our @nodes;
 # $nodes[$nodenum]{X}
@@ -58,6 +58,12 @@ our @nodes;
 # $nodes[$nodenum]{LayerMin}
 # $nodes[$nodenum]{LayerMax}
 
+sub comment ($) {
+    print "/* $_[0] */\n";
+}
+
+sub sqr ($) { return $_[0]*$_[0]; }
+
 sub find_node (@) {
     my ($l,$x,$y,$a) = @_;
     my ($any_outside_tol);
@@ -84,19 +90,22 @@ sub find_node (@) {
            }
        }
        if ($any_outside_clear) {
-       } elsif ($any_outside_toler) {
+       } elsif ($any_outside_toler) {
            die "$l,$x,$y,$a vs. $node->{LayerMin}..$node->{LayerMax}".
-               ",$node->{X},$node->{Y},$node->{A}";
+               ",$node->{X},$node->{Y},$node->{A}".
+                   " at <> line $node->{LineNum} and";
        } else {
            if ($diff{Layer} < 0) { $node->{LayerMin}= $l }
            if ($diff{Layer} > 0) { $node->{LayerMax}= $l }
-           return ($node,$back);
+           comment("nodulated ex.#$ni/$back $l,$x,$y,$a");
+           return ($ni,$back);
        }
     }
     $node= { X => $x, Y => $y, A => $a,
-            LayerMin => $l, LayerMax => $l };
+            LayerMin => $l, LayerMax => $l, LineNum => $. };
     push @nodes, $node;
-    return ($node,0);
+    comment("nodulated new#$ni/0 $l,$x,$y,$a");
+    return ($#nodes,0);
 }
     
 while (<>) {
@@ -105,17 +114,18 @@ while (<>) {
     next unless $1 eq 'segmentpart';
     die unless m/^\%L segmentpart ([A-Za-z_]*)(\d+) (\S+) ([-.eE0-9 ]+)$/;
     ($layerkind, $level, $subsegspec, $numbers) = ($1,$2,$3,$4);
-    next unless grep { $layerkind eq $_ } split /\,/, $conf{LayerKinds};
+    next unless grep { $layerkind eq $_ } split /\,/, $conf{LayerKinds}, -1;
     @numbers = map { $_ + 0 } split / /, $numbers;
+    $dist= shift @numbers;
+    @numbers == 6 or die;
     for ($pti=0; $pti<2; $pti++) {
        ($node[$pti], $back[$pti])=
-           find_node($level, $numbers[($i*3)..($i*3+2)]);
+           find_node($level, @numbers[($i*3)..($i*3+2)]);
     }
 }
 
-    ($pts[0]{X}, $pts[0]{Y}, $pts[0]{A},
-     $pts[1]{X}, $pts[1]{Y}, $pts[1]{A}) = 
-    $node[0]
-     
-
-(\w+(?:(?:\/([A-Za-z]+)(\d+))?)?)
+#    ($pts[0]{X}, $pts[0]{Y}, $pts[0]{A},
+#     $pts[1]{X}, $pts[1]{Y}, $pts[1]{A}) = 
+#    $node[0]
+#(\w+(?:(?:\/([A-Za-z]+)(\d+))?)?)
index f15a6589e3365f433936267b9208ede3bb6e37c5..5756cedea263619fdbd7bba71107babbc4d52bf5 100644 (file)
@@ -294,7 +294,7 @@ Special comments in PostScript:
  %L bbox no locs, no bbox
        there were no locs, so there is no bounding box
        usu because input file was just obj defns and showlibrary
- %L segmentpart KL D [-]S X0 Y0 A0 X1 Y1 A1
+ %L segmentpart KL [-]S D X0 Y0 A0 X1 Y1 A1
        records that a piece of subsegment S is drawn in the subsegment
        encoding.  The piece is of length D, in layer KL (which may be
        the empty string, depending on layer configurations), and runs
index bf042dd9f1601755d6ca9113295118f9dd876e06..0d2db4bab8f6e4b4dab4ae19945894fae8239400 100755 (executable)
@@ -631,9 +631,10 @@ sub segment_used__print ($) {
     if ($segused_incurrent > 0) {
        o("%L segmentpart ".
          $ctx->{Layer}{Level}.$ctx->{Layer}{Kind}." ".
-         $segused_incurrent." ".$segments[0]." ".
+         $segments[0]." ".
+         $segused_incurrent." ".
          loc2dbg($segused_currentpt)." ".
-         loc2dbg($pt));
+         loc2dbg($pt)."\n");
     }
     $segused_incurrent= undef;
     $segused_currentpt= undef;