From c88568c9f16aca9fefc4976adc1f2174be7ce0de Mon Sep 17 00:00:00 2001 From: ian Date: Mon, 18 Sep 2006 00:28:05 +0000 Subject: [PATCH] new ours-m.ps files for layout editing; pass input file to m4 by name rather than as stdin for better #line directives M --- layout/Makefile | 9 +++-- layout/informat.txt | 4 +-- layout/layout | 83 ++++++++++++++++++++++++++++++++++----------- layout/ours.m4 | 2 +- layout/parts.i4 | 3 +- 5 files changed, 75 insertions(+), 26 deletions(-) diff --git a/layout/Makefile b/layout/Makefile index c0d1c17..bedb221 100644 --- a/layout/Makefile +++ b/layout/Makefile @@ -15,7 +15,8 @@ LAYERS_LS= 0 10 20 LAYERS_PS= $(addsuffix .ps, $(LAYERS_LS)) LAYERS_L= $(addprefix ours-l, $(LAYERS_PS)) LAYERS_E= $(addprefix ours-e, $(LAYERS_PS)) -LAYERS= $(LAYERS_L) $(LAYERS_E) +LAYERS_M= $(addprefix ours-m, $(LAYERS_PS)) +LAYERS= $(LAYERS_L) $(LAYERS_E) $(LAYERS_M) LPAGES= $(foreach x, 0 1 2 3 4 5 6, $(foreach y, 1 2 3 4 5, ours-p0-$xx$y.ps)) @@ -80,7 +81,7 @@ compose-segenco: compose-segenco.o $(LINK) %.d4: %.m4 $(M4INCS) Makefile - m4 -s <$< $o + m4 -s $< $o %-a.ps: %.d4 layout ./layout <$< $(LAYOUTOPTS) '-E*lD' $o @@ -116,6 +117,10 @@ ours.graph.c: extractgraph ours.dgram-bot.p0.segenco.ps ours-l%.ps: ours.d4 layout ./layout <$< -l$* $(LAYOUTOPTS) $(XLAYOUTOPTS_LAYER) $o +ours-m%.ps: ours.d4 layout + ./layout <$< -l$* -E'=*aRscLDMno' \ + -e'p=*rm' -E'=5RNLDA' -E'*~=5rCdsml' $o + ours-e%.ps: ours.d4 layout ./layout <$< -l$* -E'=*aRsclMno' \ -e'p=*rm' -e'=5RN' -E'*~=5rsm' -e'p~=5r' -e'*=*l' $o diff --git a/layout/informat.txt b/layout/informat.txt index 29f5fe1..916f1f6 100644 --- a/layout/informat.txt +++ b/layout/informat.txt @@ -209,7 +209,7 @@ Command-line options in each direction. xp is multiplied by 270mm; yp is multiplied by 190mm. - -e[ARSCcLlMNOm]... + -e[ARSCcLlDdMNOm]... Turn on and off drawing of elements in groups. These are abbreviations for various -E... options. track -E..... @@ -233,7 +233,7 @@ Command-line options subsegment encoding G draw only subsegment encoding Garcslmno - -E[ARSCLMNOarsclmno]... + -E[ARSCLDMNOarscldmno]... enable (capitals) or disable (lowercase) drawing of individual elements A draw track swept area, with ticks diff --git a/layout/layout b/layout/layout index 31d1daf..06dfb77 100755 --- a/layout/layout +++ b/layout/layout @@ -7,6 +7,9 @@ use IO::File; use strict; no strict 'subs'; +our $file_lineno= 0; +our $file_filename; + our $scale= 7.0; our $page_x= 0; our $page_y= 0; @@ -23,6 +26,7 @@ our $ps_page_ymul= 538.583; our @eopts; our @segments= ('/'); +our @ident_strings= (); our %subsegcmap; our $drawers= 'arscldmnog'; @@ -34,6 +38,8 @@ our %chdraw_emap= qw(A ARScgd r arcs L LMg l l + D D + d d M Mnog N MNog O MNOg @@ -173,7 +179,7 @@ our $lmu_lenlabeloff= $lmu_marklw * 0.5; our $olu_left= 10 * $scale; our $olu_right= 217 * $scale - $olu_left; -our $olu_bottom= 20 * $scale; +our $olu_bottom= 25 * $scale; our $olu_top= 270 * $scale - $olu_bottom; our $olu_gap_x= 30; our $olu_gap_y= 60; @@ -568,6 +574,7 @@ sub o ($) { $o .= $_[0]; } sub ol ($) { $ol .= $_[0]; } sub oflushpage () { return if $subsegcmapreq; + print $o, $ol, " showpage\n" or die $!; $o=$ol=''; @@ -772,23 +779,7 @@ print DEBUG "ps $p0 $p1 $lenperp ($ppu)\n"; parametric__o_pt(&$calcfn); o(" stroke\n"); } - if ($draw =~ m/D/) { - my ($pt,$ad,$len,$off); - $param= ($p0+$p1)*0.5; - $pt= &$calcfn; - $ad= ang2deg($pt->{A}); - $len= sprintf "%.0f", $lenperp * abs($p1-$p0); - $off= $draw =~ m/C/ ? $lmu_lenlabeloff : $lmu_lenlabeloffctr; - ol(" gsave\n". - " $pt->{X} $pt->{Y} translate\n". - " $ad rotate\n". - " lf setfont\n". - " 0 $off moveto\n". - " ($len) show\n". - " grestore\n"); - } - return unless $draw =~ m/[ARS]/; - for ($pa= $p0; $pa<$p1; $pa=$pb) { + if ($draw =~ m/[ARS]/) { for ($pa= $p0; $pa<$p1; $pa=$pb) { $pb= $pa + $ppu; $param= $pa; $ends[0]= @ends ? $ends[1] : &$calcfn; $param= $pb; $ends[1]= &$calcfn; @@ -828,7 +819,22 @@ print DEBUG "ps $p0 $p1 $lenperp ($ppu)\n"; } } o(" grestore\n"); - } + } } + if ($draw =~ m/D/) { + my ($pt,$ad,$len,$off); + $param= ($p0+$p1)*0.5; + $pt= &$calcfn; + $ad= ang2deg($pt->{A}); + $len= sprintf "%.0f", $lenperp * abs($p1-$p0); + $off= $draw =~ m/C/ ? $lmu_lenlabeloff : $lmu_lenlabeloffctr; + ol(" gsave\n". + " $pt->{X} $pt->{Y} translate\n". + " $ad rotate\n". + " lf setfont\n". + " 0 $off moveto\n". + " ($len) show\n". + " grestore\n"); + } } sub arc ($$$$$) { @@ -1496,6 +1502,23 @@ dv("cmd__do $ctx @al ",'$ctx',$ctx); } } +sub cmd_ident { + my ($vs, @lt, $inf, $strft); + $vs= "@al"; + $vs= $1 if $vs =~ m/^\$Revision\: ([0-9.]+)\ \$$/; + if (!defined $file_filename) { + $inf= "$vs (unknown file: $file_lineno)"; + } elsif (!stat $file_filename || + !(@lt= localtime((stat _)[9]))) { + $inf= "$file_filename ($1 $!)"; + } else { + $strft= strftime "%Y-%m-%d %H:%M:%S +%Z", @lt; + $inf= "$file_filename ($1 $strft)"; + } + push @ident_strings, $inf; + @al= (); +} + sub cmd_showlibrary { my ($obj_id, $y, $x, $ctx_save, $width, $height); my ($max_x, $min_x, $max_y, $min_y, $nxty, $obj, $loc, $pat, $got, $glob); @@ -1570,7 +1593,8 @@ sub cmd__one { o("%!\n". " /lf /Courier-New findfont $lmu_marktpt scalefont def\n". - " $ps_page_shift 0 translate 90 rotate\n"); + " $ps_page_shift 0 translate 90 rotate\n". + " gsave\n"); if ($page_x || $page_y) { o(" /Courier-New findfont 15 scalefont setfont\n". @@ -1596,6 +1620,14 @@ $ctx->{SegName}= ''; cmd__one(); while (<>) { + $file_lineno++; + if (m/^\#line (\d+)$/) { $file_lineno= $1; next; } + if (m/^\#line (\d+) (.*)$/) { + $file_lineno= $1; + $file_filename= $2; + $file_filename =~ s/^\"(.*)\"$/$1/; + next; + } next if m/^\s*\#/; chomp; s/^\s+//; s/\s+$//; @al= split /\s+/, $_; @@ -1644,4 +1676,15 @@ while (<>) { } } +ol("grestore\n"); + +if (@ident_strings) { + my ($is); + $is= join('; ', @ident_strings); + $is =~ s/[()\\]/\\$&/g; + ol("25 50 moveto". + "/Courier-New findfont 6 scalefont setfont\n". + " ($is) show\n"); +} + oflushpage(); diff --git a/layout/ours.m4 b/layout/ours.m4 index 32ec3bb..bad343c 100644 --- a/layout/ours.m4 +++ b/layout/ours.m4 @@ -463,5 +463,5 @@ extend sta_tt_out135 sta_9house len 200 -230 extend sta_tt_out150 sta_8house len 230 -400 extend sta_tt_out165 sta_7house upto sta_8house -2000 -#ident $Revision$ +ident $Revision$ eof diff --git a/layout/parts.i4 b/layout/parts.i4 index 43b54e4..4fc69e9 100644 --- a/layout/parts.i4 +++ b/layout/parts.i4 @@ -264,4 +264,5 @@ defpart tt_atlas_motor join tl -tr 0.1 enddef -#ident $Revision$ +ident $Revision$ + -- 2.30.2