From 38bfdd26ed9712031fe7cc58af932d1ed08acd2a Mon Sep 17 00:00:00 2001 From: ian Date: Sun, 13 Mar 2005 08:33:54 +0000 Subject: [PATCH] extractgraph in Makefile, still wip --- layout/.cvsignore | 1 + layout/Makefile | 9 +++++++-- layout/extractgraph | 38 ++++++++++++++++++++++++-------------- layout/informat.txt | 2 +- layout/layout | 5 +++-- 5 files changed, 36 insertions(+), 19 deletions(-) diff --git a/layout/.cvsignore b/layout/.cvsignore index fd35039..b1842cc 100644 --- a/layout/.cvsignore +++ b/layout/.cvsignore @@ -14,3 +14,4 @@ tmp.* ui-plan-*.ppm parts.ps *-a.ps +ours.graph.c diff --git a/layout/Makefile b/layout/Makefile index 89edfff..9b90c83 100644 --- a/layout/Makefile +++ b/layout/Makefile @@ -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 diff --git a/layout/extractgraph b/layout/extractgraph index 7a5c30d..3873ddb 100755 --- a/layout/extractgraph +++ b/layout/extractgraph @@ -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) { - } else if ($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+))?)?) diff --git a/layout/informat.txt b/layout/informat.txt index f15a658..5756ced 100644 --- a/layout/informat.txt +++ b/layout/informat.txt @@ -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 diff --git a/layout/layout b/layout/layout index bf042dd..0d2db4b 100755 --- a/layout/layout +++ b/layout/layout @@ -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; -- 2.30.2