From 14ff554fa8663c6282edccf22335efa6d1741bde Mon Sep 17 00:00:00 2001 From: ian Date: Sun, 13 Jun 2004 19:27:30 +0000 Subject: [PATCH] do pages --- layout/layout | 192 ++++++++++++++++++++++----------------------- layout/testphys.m4 | 8 +- pcb/Makefile | 13 ++- pic.make | 13 ++- spice/Makefile | 13 ++- 5 files changed, 134 insertions(+), 105 deletions(-) diff --git a/layout/layout b/layout/layout index f94dbc2..6b50255 100755 --- a/layout/layout +++ b/layout/layout @@ -5,11 +5,102 @@ use strict; no strict 'subs'; our $scale= 7.0; +our $page_x= 0; +our $page_y= 0; +our $quiet=0; +our $debug=0; +our $output_layer= '*'; -if (@ARGV && $ARGV[0] =~ m/^\-S([0-9.]+)$/) { - $scale= $1 * 1.0; - shift @ARGV; -} +our @eopts; + +our $drawers= 'arsclmno'; +our %chdraw_emap= qw(A ARSc + R aRsc + S aRSc + C arsC + c Arsc + r arcs + L LM + l l + M Mno + N MNo + O MNO + m mnol); + +while (@ARGV && $ARGV[0] =~ m/^\-/) { + last if $ARGV[0] eq '-'; + $_= shift @ARGV; + last if $_ eq '--'; + s/^\-//; + while (length) { + if (s/^D(\d+)//) { $debug= $1; } + elsif (s/^D//) { $debug++; } + elsif (s/^q//) { $quiet=1; } + elsif (s/^l(\d+|\*)//) { $output_layer=$1; } + elsif (s/^S([0-9.]+)$//) { $scale= $1 * 1.0; } + elsif (s/^P(\d+)x(\d+)$//) { $page_x= $1; $page_y= $2; } + elsif (s/^(e) + ((?:[a-z]|\*|\?|\[[a-z][-a-z]*\])*?) + (\~?) (\d*) (\=*|\-+|\++) (\d*|\*) + ([a-z]+)$//ix) { + my ($ee,$g,$n,$d,$c,$v,$cc) = ($1,$2,$3,$4,$5,$6,$7); + my ($eo, $invert, $lfn, $ccc, $sense,$limit); + $g =~ s/\?/\./g; $g =~ s/\*/\.\*/g; + die '-[eE]GND[=]* not allowed' if $v eq '*' && length $d; + $d= $output_layer if !length $d; + $d= 5 if $d eq '*'; + $invert= length $n; + $c= '=' if !length $c; + if (length $v && $v ne '*') { + die '-[eE]GN[D]CCV not allowed' if length $c > 1; + $c= $c x $v; + } + if ($c =~ m/^[-+]/) { + die '-[eE]GN+/-* not allowed' if $v eq '*'; + $sense= ($&.'1') + 0; + $limit= ($sense * $d) + length($c) - 1; + $lfn= sub { + ($output_layer eq '*' ? $d + : $_[0]) * $sense >= $limit + xor $invert; + }; + } elsif ($v eq '*') { + $lfn= sub { !$invert; }; + } else { + $limit= length($c) - 1; + $lfn= sub { +#my ($lfn_result)=( + ($output_layer eq '*' ? 1 + : abs($_[0] - $d) <= $limit) + xor $invert +#) + ; +#print STDERR "output layer $output_layer; asking re $_[0] rel $d lim $limit invert $invert result $lfn_result\n"; +#$lfn_result; + }; + } + $ccc= ''; + foreach $c (split //, $cc) { + if ($ee eq 'e') { + die "bad -e option $c" unless defined $chdraw_emap{$c}; + $ccc .= $chdraw_emap{$c}; + } else { + die "bad -E option $c" unless $c =~ m/[$drawers]/i; + $ccc .= $c; + } + } + $eo->{GlobRe}= $g; + $eo->{LayerCheck}= $lfn; + $eo->{DrawMods}= $ccc; +#print STDERR "created eo $eo re $eo->{GlobRe} n=$n d=$d v=$v c=$c limit=$limit cc=$cc\n"; + push @eopts, $eo; + } elsif (m/^S/) { + die "-S option must come right at the start and have numeric arg"; + } else { + die "unknown option -$_"; + } + } +} our $ptscale= 72/25.4 / $scale; @@ -42,7 +133,6 @@ our $olu_textheight= 15; our $olu_textallowperc= $lmu_marktpt * 5.0/11; our $pi= atan2(0,-1); -our $output_layer= '*'; sub allwidth2 ($) { my ($radius)= @_; @@ -89,14 +179,12 @@ our $allwidthmin= allwidth(undef); our $ctx; our %objs; -our @eopts; our @al; # current cmd our $o=''; our $ol=''; our $param; # for parametric_curve -our $debug=0; # ev_... functions # @@ -1194,100 +1282,12 @@ print "%!\n". " /lf /Courier-New findfont $lmu_marktpt scalefont def\n". " 615 0 translate 90 rotate\n". + " -709 $page_x mul -566 $page_y mul translate\n". " $ptscale $ptscale scale\n" or die $!; newctx(); -our $drawers= 'arsclmno'; -our %chdraw_emap= qw(A ARSc - R aRsc - S aRSc - C arsC - c Arsc - r arcs - L LM - l l - M Mno - N MNo - O MNO - m mnol); - -our $quiet=0; - -while (@ARGV && $ARGV[0] =~ m/^\-/) { - last if $ARGV[0] eq '-'; - $_= shift @ARGV; - last if $_ eq '--'; - s/^\-//; - while (length) { - if (s/^D(\d+)//) { $debug= $1; } - elsif (s/^D//) { $debug++; } - elsif (s/^q//) { $quiet=1; } - elsif (s/^l(\d+|\*)//) { $output_layer=$1; } - elsif (s/^(e) - ((?:[a-z]|\*|\?|\[[a-z][-a-z]*\])*?) - (\~?) (\d*) (\=*|\-+|\++) (\d*|\*) - ([a-z]+)$//ix) { - my ($ee,$g,$n,$d,$c,$v,$cc) = ($1,$2,$3,$4,$5,$6,$7); - my ($eo, $invert, $lfn, $ccc, $sense,$limit); - $g =~ s/\?/\./g; $g =~ s/\*/\.\*/g; - die '-[eE]GND[=]* not allowed' if $v eq '*' && length $d; - $d= $output_layer if !length $d; - $d= 5 if $d eq '*'; - $invert= length $n; - $c= '=' if !length $c; - if (length $v && $v ne '*') { - die '-[eE]GN[D]CCV not allowed' if length $c > 1; - $c= $c x $v; - } - if ($c =~ m/^[-+]/) { - die '-[eE]GN+/-* not allowed' if $v eq '*'; - $sense= ($&.'1') + 0; - $limit= ($sense * $d) + length($c) - 1; - $lfn= sub { - ($output_layer eq '*' ? $d - : $_[0]) * $sense >= $limit - xor $invert; - }; - } elsif ($v eq '*') { - $lfn= sub { !$invert; }; - } else { - $limit= length($c) - 1; - $lfn= sub { -#my ($lfn_result)=( - ($output_layer eq '*' ? 1 - : abs($_[0] - $d) <= $limit) - xor $invert -#) - ; -#print STDERR "output layer $output_layer; asking re $_[0] rel $d lim $limit invert $invert result $lfn_result\n"; -#$lfn_result; - }; - } - $ccc= ''; - foreach $c (split //, $cc) { - if ($ee eq 'e') { - die "bad -e option $c" unless defined $chdraw_emap{$c}; - $ccc .= $chdraw_emap{$c}; - } else { - die "bad -E option $c" unless $c =~ m/[$drawers]/i; - $ccc .= $c; - } - } - $eo->{GlobRe}= $g; - $eo->{LayerCheck}= $lfn; - $eo->{DrawMods}= $ccc; -#print STDERR "created eo $eo re $eo->{GlobRe} n=$n d=$d v=$v c=$c limit=$limit cc=$cc\n"; - push @eopts, $eo; - } elsif (m/^S/) { - die "-S option must come right at the start and have numeric arg"; - } else { - die "unknown option -$_"; - } - } -} - open DEBUG, ($debug ? ">&2" : ">/dev/null") or die $!; if ($debug) { diff --git a/layout/testphys.m4 b/layout/testphys.m4 index 1c97fb8..904a7f6 100644 --- a/layout/testphys.m4 +++ b/layout/testphys.m4 @@ -1,5 +1,7 @@ -abs a 50 50 0 -extend a b ang 13.116 -230 +define(theta,38.50) +abs a 5 50 0 +extend a b ang theta -230 extend b c uptoang 0 230 -extend c d ang 13.116 230 +extend c d ang theta 230 extend d e uptoang 0 -230 +extend e f len 300 diff --git a/pcb/Makefile b/pcb/Makefile index 32a54fc..9fe3d14 100644 --- a/pcb/Makefile +++ b/pcb/Makefile @@ -4,14 +4,20 @@ M4INCS= parts.i4 E_TRACK= ArsCLMNo LAYOUTOPTS_ALL= -ep=*Cm LAYOUTOPTS= -E=*$(E_TRACK) $(LAYOUTOPTS_ALL) +LAYOUTOPTS_PHYS= -S1.0 $(LAYOUTOPTS) '-e*A' +XLAYOUTOPTS_LAYER= -e'=5AN' -E'*~=5rsm' -e'p~=5r' -e'*~=9C' -e'*=*l' + 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) +LPAGES= $(foreach x, 0 1 2 3 4 5 6, $(foreach y, 1 2 3 4 5, ours-p0-$xx$y.ps)) + default: ours-a.ps ours-al.ps parts.ps layers: $(LAYERS) +lpages: $(LPAGES) all: default layers circuit.bom bulkres.bom divider-tables @@ -60,13 +66,16 @@ divider-table.ps: divider-table.txt Makefile ./layout -S1.0 <$< $(LAYOUTOPTS) '-e*A' '-ep=rm' $o ours-l%.ps: ours.d4 layout - ./layout <$< -l$* $(LAYOUTOPTS) \ - -e'=5AN' -E'*~=5rsm' -e'p~=5r' -e'*~=9C' -e'*=*l' $o + ./layout <$< -l$* $(LAYOUTOPTS) $(XLAYOUTOPTS_LAYER) $o ours-e%.ps: ours.d4 layout ./layout <$< -l$* -E'=*aRsclMno' \ -e'p=*rm' -e'=5RN' -E'*~=5rsm' -e'p~=5r' -e'*=*l' $o +ours-p%.ps: ours.d4 layout + ./layout <$< -l$$(printf %s "$*" | sed -e 's/-/ -P/') \ + $(LAYOUTOPTS_PHYS) $(XLAYOUTOPTS_LAYER) $o + parts.ps: showlib.d4 layout ./layout <$< $(LAYOUTOPTS_ALL) $o diff --git a/pic.make b/pic.make index 32a54fc..9fe3d14 100644 --- a/pic.make +++ b/pic.make @@ -4,14 +4,20 @@ M4INCS= parts.i4 E_TRACK= ArsCLMNo LAYOUTOPTS_ALL= -ep=*Cm LAYOUTOPTS= -E=*$(E_TRACK) $(LAYOUTOPTS_ALL) +LAYOUTOPTS_PHYS= -S1.0 $(LAYOUTOPTS) '-e*A' +XLAYOUTOPTS_LAYER= -e'=5AN' -E'*~=5rsm' -e'p~=5r' -e'*~=9C' -e'*=*l' + 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) +LPAGES= $(foreach x, 0 1 2 3 4 5 6, $(foreach y, 1 2 3 4 5, ours-p0-$xx$y.ps)) + default: ours-a.ps ours-al.ps parts.ps layers: $(LAYERS) +lpages: $(LPAGES) all: default layers circuit.bom bulkres.bom divider-tables @@ -60,13 +66,16 @@ divider-table.ps: divider-table.txt Makefile ./layout -S1.0 <$< $(LAYOUTOPTS) '-e*A' '-ep=rm' $o ours-l%.ps: ours.d4 layout - ./layout <$< -l$* $(LAYOUTOPTS) \ - -e'=5AN' -E'*~=5rsm' -e'p~=5r' -e'*~=9C' -e'*=*l' $o + ./layout <$< -l$* $(LAYOUTOPTS) $(XLAYOUTOPTS_LAYER) $o ours-e%.ps: ours.d4 layout ./layout <$< -l$* -E'=*aRsclMno' \ -e'p=*rm' -e'=5RN' -E'*~=5rsm' -e'p~=5r' -e'*=*l' $o +ours-p%.ps: ours.d4 layout + ./layout <$< -l$$(printf %s "$*" | sed -e 's/-/ -P/') \ + $(LAYOUTOPTS_PHYS) $(XLAYOUTOPTS_LAYER) $o + parts.ps: showlib.d4 layout ./layout <$< $(LAYOUTOPTS_ALL) $o diff --git a/spice/Makefile b/spice/Makefile index 32a54fc..9fe3d14 100644 --- a/spice/Makefile +++ b/spice/Makefile @@ -4,14 +4,20 @@ M4INCS= parts.i4 E_TRACK= ArsCLMNo LAYOUTOPTS_ALL= -ep=*Cm LAYOUTOPTS= -E=*$(E_TRACK) $(LAYOUTOPTS_ALL) +LAYOUTOPTS_PHYS= -S1.0 $(LAYOUTOPTS) '-e*A' +XLAYOUTOPTS_LAYER= -e'=5AN' -E'*~=5rsm' -e'p~=5r' -e'*~=9C' -e'*=*l' + 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) +LPAGES= $(foreach x, 0 1 2 3 4 5 6, $(foreach y, 1 2 3 4 5, ours-p0-$xx$y.ps)) + default: ours-a.ps ours-al.ps parts.ps layers: $(LAYERS) +lpages: $(LPAGES) all: default layers circuit.bom bulkres.bom divider-tables @@ -60,13 +66,16 @@ divider-table.ps: divider-table.txt Makefile ./layout -S1.0 <$< $(LAYOUTOPTS) '-e*A' '-ep=rm' $o ours-l%.ps: ours.d4 layout - ./layout <$< -l$* $(LAYOUTOPTS) \ - -e'=5AN' -E'*~=5rsm' -e'p~=5r' -e'*~=9C' -e'*=*l' $o + ./layout <$< -l$* $(LAYOUTOPTS) $(XLAYOUTOPTS_LAYER) $o ours-e%.ps: ours.d4 layout ./layout <$< -l$* -E'=*aRsclMno' \ -e'p=*rm' -e'=5RN' -E'*~=5rsm' -e'p~=5r' -e'*=*l' $o +ours-p%.ps: ours.d4 layout + ./layout <$< -l$$(printf %s "$*" | sed -e 's/-/ -P/') \ + $(LAYOUTOPTS_PHYS) $(XLAYOUTOPTS_LAYER) $o + parts.ps: showlib.d4 layout ./layout <$< $(LAYOUTOPTS_ALL) $o -- 2.30.2