diff options
Diffstat (limited to 'graphics/circuit_macros/examples')
92 files changed, 3962 insertions, 1024 deletions
diff --git a/graphics/circuit_macros/examples/AmpTable.m4 b/graphics/circuit_macros/examples/AmpTable.m4 new file mode 100644 index 0000000000..c94f682cbc --- /dev/null +++ b/graphics/circuit_macros/examples/AmpTable.m4 @@ -0,0 +1,22 @@ +.PS +# `Amptable.m4' +cct_init +movewid = 2pt__ +{ + {amp ; move ; "{\tt `amp'}" ljust} + move down 0.4; right_ + {amp(,0.3) ; move ; "{\tt `amp'(,0.3)}" ljust} + } + move right_ 2.0 +{ {delay ; move ; "{\tt `delay'}" ljust} + move down 0.4; right_ + {delay(,0.2) ; move ; "{\tt `delay'(,0.2)}" ljust} + } + + move right_ 2.0 +{ {integrator ; move ; "{\tt `integrator'}" ljust} + move down 0.5; right_ + {integrator(,0.3) ; move ; "{\tt `integrator'(,0.3)}" wid 82pt__ ljust} + } + +.PE diff --git a/graphics/circuit_macros/examples/Antennas.m4 b/graphics/circuit_macros/examples/Antennas.m4 new file mode 100644 index 0000000000..6053cd2e3f --- /dev/null +++ b/graphics/circuit_macros/examples/Antennas.m4 @@ -0,0 +1,40 @@ +.PS +# `Antennas.m4' +cct_init +s_init(Antennas) +sinclude(Circuit_macros.dim) + + define(`elen_',elen_*0.9) + B: Here + A: antenna + s_box(T) below at A.T + s_box(`\tt an`'tenna') at A.n above + A: antenna(at A.T+(elen_,0),T) + s_box(T) below at A.T + s_box(`\tt (,T)') at A.n above + A: antenna(at A.T+(elen_,0),,L) + s_box(T1) below rjust at A.T1 + s_box(T2) below ljust at A.T2 + s_box(`\tt (,{,}L)') at A.n above + A: antenna(at A.T+(elen_,0),T,L) + s_box(T1) below rjust at A.T1 + s_box(T2) below ljust at A.T2 + s_box(`\tt (,T,L)') at A.n above + A: antenna(at A.T+(elen_,0),,T) + s_box(T) below at A.T + s_box(`\tt (,{,}T)') at A.n above + A: antenna(at A.T+(elen_,0),,S) + s_box(T1) below rjust at A.T1 + s_box(T2) below ljust at A.T2 + s_box(`\tt (,{,}S)') at A.n above + A: antenna(at A.T+(elen_,0),,D) + s_box(T1) below rjust at A.T1 + s_box(T2) below ljust at A.T2 + s_box(`\tt (,{,}D)') at A.n above + A: antenna(at A.T+(elen_,0),,P) + s_box(T) below at A.T + s_box(`\tt (,{,}P)') at A.n above + A: antenna(at A.T+(elen_,0),,F) + s_box(T) below at A.T + s_box(`\tt (,{,}F)') at A.n above +.PE diff --git a/graphics/circuit_macros/examples/AntiqueClock.m4 b/graphics/circuit_macros/examples/AntiqueClock.m4 new file mode 100644 index 0000000000..566fb4c814 --- /dev/null +++ b/graphics/circuit_macros/examples/AntiqueClock.m4 @@ -0,0 +1,142 @@ +.PS +# AntiqueClock.m4 +gen_init +NeedDpicTools +iflatex(command "{\sf") + +# https://tex.stackexchange.com/questions/236923/generate-analog-clock-with-numbered-face-add-seconds-roman-numerals + +# `hms2deg(hr,min,sec) hr:min:sec to degrees +# blank arg1: degrees for minute hand +# blank arg1 and arg2: degrees for second hand' +define(`hms2deg',`ifelse(`$1',, + `ifelse(`$2',, + `(90-pmod(ifelse(`$3',,0,`$3'),60)/60*360)', + `(90-(pmod(`$2',60)/60 + pmod(ifelse(`$3',,0,`$3'),60)/60/60)*360)')', + `(90-(pmod(`$1',12) + pmod(ifelse(`$2',,0,`$2'),60)/60 + dnl + pmod(ifelse(`$3',,0,`$3'),60)/3600)/12*360)')') + +# `SecondHand(length,hr,min,sec)' +define(`SecondHand',`[ shsf = (`$1')/3.2 + C: Here + { L: rpoint_(to (Rect_(`$1',hms2deg(,,`$4')))) } + line thick 8*shsf to rvec_(`$1',0) + ]') + +# `AntiqueMinuteHand(length,hr,min,sec)' +define(`AntiqueMinuteHand',`[ mhsf = (`$1')/2.84 + L: rpoint_(to (Rect_(`$1',hms2deg(,`$3',`$4')))) + C: circle fill_(0) diam 0.47*mhsf at L.start + move to C + spline from rvec_(0,0.047*mhsf) \ + to rvec_(1.65*mhsf,0.11*mhsf) \ + then to rvec_(`$1',0.018*mhsf) \ + then to rvec_(`$1',-0.018*mhsf) \ + then to rvec_(1.65*mhsf,-0.11*mhsf) \ + then to rvec_(0,-0.047*mhsf) \ + shaded rgbstring(0,0,0) + ]') + +# `AntiqueHourHand(length,hr,min,sec)' +define(`AntiqueHourHand',`[ hhsf = (`$1')/2.2 + L: rpoint_(to (Rect_(`$1',hms2deg(`$2',`$3',`$4')))) + C: circle fill_(0) diam 0.6*hhsf at L.start + move to C + v = 0.25*hhsf + { line to rvec_(1.1*hhsf,0) thick 0.15/(1bp__)*hhsf } + { C1: circle rad v at rvec_(1.25*hhsf,0) fill_(0) } + d = `$1'-1.25*hhsf + q = 1bp__*hhsf + r1 = (d^2 + q^2 - v^2)/(v-q)/2 + h = r1+v + shade(0, + arc ccw from C1+vec_(d/h*v,(r1+q)/h*v) to \ + C1+vec_(d,q) rad r1 with .c at C1+vec_(d,r1+q) + arc ccw from C1+vec_(d,-q) to C1+vec_(d/h*v,-(r1+q)/h*v) rad r1 \ + with .c at C1+vec_(d,-r1-q)) + ]') + +define(`AntiqueClock',`[ # h,m,s,diam +# Clock size parameters: + hour = ifelse(`$1',,3,`$1') + minute = ifelse(`$2',,41,`$2') + second = ifelse(`$3',,51,`$3') + # outer radius + ifelse(`$4',,`skale=0.5; r1=2',`r1=(`$4')/2; skale=r1/4') + r2 = r1-0.5*skale + r3 = r2-0.14*skale + r4 = r3 - 0.35*skale + r5 = r4 - 0.17*skale + r6 = r5 - 0.63*skale + r7 = r6 - 0.17*skale + shadelinethick = 1.0 + +C: circle thick 0.2 rad r1 + +define shadeline { + s = 1-($`'1)*2 + v = r*s + h = sqrt(r^2-v^2) + t = 1-abs(s) + line from (vrot_(-h,v,cost,sint)) to (vrot_(h,v,cost,sint)) \ + thick shadelinethick outlined rgbstring(t,t,t) + } + + r = r1 # Bezel outer + nlines = int(2*r/(shadelinethick pt__)*1.1) + cost = cosd(10); sint = sind(10); + ShadeObject(shadeline,nlines, 0, 0,0,0, 0.5, 1,1,1, 1, 0,0,0 ) at C + + r = r2 # Bezel inner + nlines = int(2*r/(shadelinethick pt__)*1.1) + cost = cosd(-10); sint = sind(-10); + ShadeObject(shadeline,nlines, 0, 0,0,0, 0.25, 0.8,0.8,0.8, 0.5, 1,1,1, + 0.75, 0.8,0.8,0.8, 1, 0,0,0 ) at C + +# Clock face +Face: circle thick 0 fill_(1) rad r3 at C + circle rad r4 at C + circle rad r5 at C + circle rad r6 at C + circle rad r7 at C + +# Text rotation for PSTricks or TikZ + define(`rottext', + `ifpstricks(`\rput[c]{%g}(0,0)')ifpgf(`\pgftext[rotate=%g]')') +# Outer numbers + command sprintf("\font\outerfont=cmss12 at %4.2fin",r3-r4) + for mn = -15 to 15 by 5 do { sprintf("rottext{\outerfont %g}",\ + -mn/60*360,pmod(mn,60)) at C+(Rect_((r3+r4)/2,90-mn/60*360)) } + for mn = 20 to 40 by 5 do { sprintf("rottext{\outerfont %g}",\ + 180-mn/60*360,mn) at C+(Rect_((r3+r4)/2,90-mn/60*360)) } +# Outer tics + for mn = 1 to 60 do { t = 90-mn/60*360 + line from C+(Rect_(r5,t)) to C+(Rect_(r4,t)) } + +# Inner numbers + command sprintf("\font\innerfont=cmss12 at %4.2fin",r5-r6) + Loopover_(`mx',`t = (m4Lx-4)/12*360; + sprintf("rottext{\scalebox{0.7}[1.0]{\innerfont mx}}",-t) \ + at C+(Rect_((r5+r6)/2,90-t))', IX,X,XI,XII,I,II,III) + Loopover_(`mx',`t = (m4Lx+3)/12*360; + sprintf("rottext{\scalebox{0.7}[1.0]{\innerfont mx}}",-t+180) \ + at C+(Rect_((r5+r6)/2,90-t))', IV,V,VI,VII,VIII) + +# Inner tics + for mn = 5 to 60 by 5 do { t = 90-mn/60*360 + line from C+(Rect_(r7,t)) to C+(Rect_(r6,t)) } + +# Hands + AntiqueHourHand(r6,hour,minute,second) with .C at C + AntiqueMinuteHand(r5,hour,minute,second) with .C at C + SecondHand((r3+r4)/2,hour,minute,second) with .C at C + +# Center + dot(at C,0.1/4*r1,1) + ]') + + Clock1: AntiqueClock(,,,3) +# Clock2: AntiqueClock(4,50,07,2) at Clock1.e+(1.5,0) + +iflatex(command "}%") +.PE diff --git a/graphics/circuit_macros/examples/Audio.m4 b/graphics/circuit_macros/examples/Audio.m4 new file mode 100644 index 0000000000..722a2434d8 --- /dev/null +++ b/graphics/circuit_macros/examples/Audio.m4 @@ -0,0 +1,94 @@ +.PS +# `Audio.m4' +cct_init + +define(`In123',` +thinlines_ + arrow <- from `$1'.In1 up 0.05 left 0.15 + "{\sl In1}sp_" rjust above + arrow <- left 0.15 from `$1'.In2 + "{\sl In2}sp_" wid 0.2 rjust + arrow <- from `$1'.In3 down 0.05 left 0.15 + "{\sl In3}sp_" rjust below +thicklines_ ') + +L:[ + [ + S: speaker + `"\tt speaker"' at S.s+(0,-0.2) #below + In123(S) + thinlines_ + arrow <- from S.In4 left 0.05 up 0.15 + "{\sl In4}" above rjust + arrow <- from S.In5 right 0.05 up 0.15 + "{\sl In5}" above + arrow <- from S.In6 left 0.05 down 0.15 + "{\sl In6}" below rjust + arrow <- from S.In7 right 0.05 down 0.15 + "{\sl In7}" below + spline <- from S.Box.e+(0,0.05) right 0.27 up 0.10 \ + then right 0.1 up 0.2 + "\sl Box" above + thicklines_ + ] +[ + H: speaker(,,H) + `"\tt speaker(,{,}H)"' at H.s+(0,-0.30) #below + ] with .sw at last [].se+(0.25,-0.1) + ] +[ + B: bell + `"\tt bell"' at B.s+(0,-0.2) #below + In123(B) + thinlines_ + arrow <- from B.Box.n+(-0.1,0) up 0.15 left 0.1 ; "\sl Box" above + arrow <- from B.Circle.n up 0.15 ; "\sl Circle" above + thicklines_ + ] with .w at last [].e+(0.0,0.5) +[ + M: microphone + `"\tt microphone"' at M.s+(0,-0.2) #below + In123(M) + thinlines_ + arrow <- from M.Circle.n up 0.15 ; "\sl Circle" above + thicklines_ + ] with .sw at last [].se+(0.4,0) +[ + Z: buzzer + `"\tt buzzer"' at Z.s+(0,-0.2) #below + In123(Z) + thinlines_ + arrow <- from Z.Box.n up 0.15 ; "\sl Box" above + thicklines_ + ] with .sw at last [].se+(0.4,0) +R:[ + Z: buzzer(,,C) + `"\tt buzzer(,{,}C)"' at Z.s+(0,-0.2) #below + In123(Z) + thinlines_ + spline <- from 0.8<Z.Face.s,Z.Face.n> right 2*arrowht up 0.5*arrowht \ + then up 0.15 right 0.05 + "\sl Face" above + thicklines_ + ] with .sw at last [].se+(0.4,0) +[[ + E: earphone + `"\tt earphone"' at E.s+(0,-0.2) #below + In123(E) + thinlines_ + arrow <- from E.Box.n up 0.15 left 0.15 ; "\sl Box" above + thicklines_ + ] + [ + E: earphone(,,C) + `"\tt earphone(,{,}C)"' at E.s+(0,-0.2) #below + thinlines_ + arrow <- from E.L up 0.15 left 0.15; "\sl L" rjust + arrow <- from E.R up 0.15 right 0.15; "\sl R" ljust + "\sl N" at E.N above + "\sl C" at E.C + thicklines_ + ] with .sw at last [].se+(0.6,0) +] with .n at (0.6 between L and R, R.s)+(0,0.1-ifdpic(0.2,0.25)) + +.PE diff --git a/graphics/circuit_macros/examples/Bip.m4 b/graphics/circuit_macros/examples/Bip.m4 new file mode 100644 index 0000000000..121517d16d --- /dev/null +++ b/graphics/circuit_macros/examples/Bip.m4 @@ -0,0 +1,60 @@ +.PS +# `Bip.m4' +cct_init + + up_ +Q1: bi_tr(up_ dimen_) + thinlines_ + showbox_(,dotted) + thicklines_ + "\hbox{\sl E}" at Q1.E-(0,0.05) below + "\hbox{\sl B}sp_" at Q1.B rjust + "\hbox{\sl C}" at Q1.C above + "`{\tt bi\_tr(up\_ dimen\_)}'" wid 1.2 at Q1.s + (0,-0.35) below + +Q2: bi_tr(,R) with .E at Q1.E+(0.25,0) + thinlines_ + showbox_(,dotted) + thicklines_ + "\hbox{\sl E}" at Q2.E-(0,0.05) below + "sp_\hbox{\sl B}" at Q2.B ljust + "\hbox{\sl C}" at Q2.C above + "`{\tt bi\_tr(,R)}'" at Q2.s + (0,-0.2) below + +Q3: bi_tr(,,P) with .C at Q2.C+(1.15,0) + thinlines_ + showbox_(,dotted) + thicklines_ + "\hbox{\sl E}" at Q3.E-(0,0.05) below + "\hbox{\sl B}sp_" at Q3.B rjust + "\hbox{\sl C}" at Q3.C above + "`{\tt bi\_tr(,{,}P)}'" at Q3.s + (0,-0.35) below + +Q4: bi_tr(,,,E) with .C at Q3.C+(0.9,0) + thinlines_ + showbox_(,dotted) + thicklines_ + "\hbox{\sl E}" at Q4.E-(0,0.05) below + "\hbox{\sl B}sp_" at Q4.B rjust + "\hbox{\sl C}" at Q4.C above + "`{\tt bi\_tr(,{,},E)}'" at (Q4.s,Q4.E) + (0,-0.2) below + +Q5: igbt(,,) with .E at Q4.E+(0.65,0) + thinlines_ + showbox_(,dotted) + thicklines_ + "\hbox{\sl E}" at Q5.E-(0,0.05) below + "\hbox{\sl G}sp_" at Q5.G rjust + "\hbox{\sl C}" at Q5.C above + "`{\tt igbt}'" at Q5.s + (0,-0.35) below + +Q6: igbt(,,LD) with .E at Q5.E+(0.55,0) + thinlines_ + showbox_(,dotted) + thicklines_ + "\hbox{\sl E}" at Q6.E-(0,0.05) below + "\hbox{\sl G}sp_" at Q6.G rjust + "\hbox{\sl C}" at Q6.C above + "`{\tt igbt(,{,}LD)}'" at (Q6.s,Q6.E) + (0,-0.2) below + +.PE diff --git a/graphics/circuit_macros/examples/Btree.m4 b/graphics/circuit_macros/examples/Btree.m4 index ebe0986433..d17a192cc4 100644 --- a/graphics/circuit_macros/examples/Btree.m4 +++ b/graphics/circuit_macros/examples/Btree.m4 @@ -2,7 +2,7 @@ # Btree.m4 # One way to draw a binary tree using pic macros gen_init -circlerad = 0.35 +circlerad = 0.30 define n { [C: circle fill_(0.9) $1 if "$2" != "" then { diff --git a/graphics/circuit_macros/examples/CctTable.m4 b/graphics/circuit_macros/examples/CctTable.m4 new file mode 100644 index 0000000000..f7e47d0758 --- /dev/null +++ b/graphics/circuit_macros/examples/CctTable.m4 @@ -0,0 +1,90 @@ +.PS +# `CctTable.m4' +cct_init + +movewid = 2 pt__ +hm = 2.05 +vm = 0.28 +{ {resistor ; move ;"`{\tt resistor}'" ljust} + move right_ hm + {resistor(,,Q) ; move ;"`\tt resistor(,{,}Q) '" ljust} + move right_ hm + {resistor(,,E) ; move + "`\shortstack[l]{\tt resistor(,{,}E)\\ {\tt $\equiv$ ebox}}'" ljust} +} + move down vm; right_ +{ {resistor(,,ES) ; move ;"`\tt resistor(,{,}ES) '" ljust} + move right_ hm + {resistor(,,H) ; move ;"`\tt resistor(,{,}H) '" ljust} + move right_ hm + {ebox(,,,0.5) ; move ;"`{\tt ebox(,{,},0.5)}'" ljust} +} + move down vm; right_ +{ {resistor(,,V) ; move ;"`{\tt resistor(,{,}V)}'" ljust} + move right_ hm + {move down_ 0.05; right_ + thermocouple ; move;"`{\tt thermocouple}'" ljust; move up_ 0.05} + move right_ hm + {ebox(,0.5,0.3) ; move ;"`{\tt ebox(,0.5,0.3)}'" ljust} +} + move down vm; right_ +{ {inductor ; move ;"`{\tt inductor}'" ljust} + move right_ hm + {inductor(,W); move ;"`{\tt inductor(,W)}'" ljust} + move right_ hm + {inductor(,L); move ;"`{\tt inductor(,L)}'" ljust} +} + move down vm; right_ +{ {inductor(,,,M) ; move ;"`{\tt inductor(,{,},M)}'" ljust} + move right_ hm + {inductor(,W,6,P); move ;"`{\tt inductor(,W,6,P)}'" ljust} + move right_ hm + {move right_ 0.2; ttmotor(,G) ; move ;"`{\tt ttmotor(,G)}'" ljust} +} + move down vm; right_ +{ {capacitor ; move ;"`{\tt capacitor}'" ljust} + move right_ hm + {capacitor(,C); move ;"`{\tt capacitor(,C)}'" ljust} + move right_ hm + {capacitor(,C+); move ;"`{\tt capacitor(,C+)}'" ljust} +} + move down vm; right_ +{ {capacitor(,P); move ;"`{\tt capacitor(,P)}'" ljust} + move right_ hm + {capacitor(,E); move ;"`{\tt capacitor(,E)}'" ljust} + move right_ hm + {capacitor(,K); move ;"`{\tt capacitor(,K)}'" ljust} +} + move down 0.25; right_ +{ {capacitor(,M); move ;"`{\tt capacitor(,M)}'" ljust} + move right_ hm + {capacitor(,N); move ;"`{\tt capacitor(,N)}'" ljust} + move right_ hm + {xtal ; move ;"`{\tt xtal}'" ljust} +} + move down 0.25; right_ +{ {memristor ; move;"`{\tt memristor}'" ljust} + move right_ hm + {heater; move;"`{\tt heater}'" ljust} + move right_ hm + {tline ; move;"`{\tt tline}'" ljust} +} + move down 0.25; right_ +{ {move up_ 0.05; right_; gap ; move ;"`{\tt gap}'" ljust} + move right_ hm + {gap(,,A) ; move ;"`{\tt gap(,{,}A)}'" ljust} + move right_ hm + {arrowline ; move;"`{\tt arrowline}'" ljust} +} + move down 0.25; right_ +{ {lamp ; move;"`{\tt lamp}'" ljust} + move right_ hm + {reed ; move ;"`{\tt reed}'" ljust} + move right_ hm + {reed(,,,fill_(0.9),CR) ; move ; "`{\tt reed(,{,},fill\_(0.9),CR)}'" ljust} +} + move down 0.25; right_ +{ {pvcell ; move;"`{\tt pvcell}'" ljust} +} + +.PE diff --git a/graphics/circuit_macros/examples/Conn.m4 b/graphics/circuit_macros/examples/Conn.m4 new file mode 100644 index 0000000000..7253d2b313 --- /dev/null +++ b/graphics/circuit_macros/examples/Conn.m4 @@ -0,0 +1,69 @@ +.PS +# `Conn.m4' +cct_init + +T:[ + ifelse(ifmpost(T)`'ifpostscript(T),,`command "{\sf"') + S1: tstrip(U) + thinlines_ + arrow <- left 0.15 from S1.L1; "L1" rjust + arrow <- left 0.15 from S1.L4; "L4" wid 0.2 rjust + "$\vdots$" at (0.5 between last "" and 2nd last "")+(-0.15,0.02) + arrow <- right 0.25 from S1.R1; "R1" ljust + arrow <- right 0.25 from S1.R4; "R4" ljust + "$\vdots$" at (0.5 between last "" and 2nd last "")+(0.15,0.02) + arrow <- right 0.15 up 0.10 from S1.T1; "T1" ljust + arrow <- right 0.15 up 0.10 from S1.T4; "T4" ht 11 pt__ ljust + "$\vdots$" at (0.5 between last "" and 2nd last "")+(0.15,0.02) + thicklines_ + CS1: "`\tt tstrip(U)'" at S1.s+(0,-0.15) + S2: tstrip(R,5,DO;wid=1.0;ht=0.25) with .sw at S1.se+(0.7,0.15) + thinlines_ + arrow <- up 0.2 right 0.1 from S2.T1; "T1" above + arrow <- up 0.2 right 0.1 from S2.T5; "T5" above + "$\cdots$" at 0.5 between last "" and 2nd last "" above + CS2: `"\tt tstrip(R,5,"' ht 0.1 ljust \ + `"\tt $\;\;$DO;wid=1.0;ht=0.25)"' ljust at S2.sw+(-0.1,-0.2) + ifelse(ifmpost(T)`'ifpostscript(T),,`command "}"') +] + +C: [ + C1: ccoax + `"\tt ccoax\vphantom{(}"' ht 11 pt__ at C1.s below + thinlines_ + arrow <- up 0.1 right 0.1 from C1.C.ne; "C" ljust + arrow <- down 0.05 right 0.1 from C1.S.e; "S" wid 0.1 ht 11pt__ ljust + thicklines_ + C2: ccoax(at C1+(0,0.3),F) + `"\tt ccoax(,F)"' ht 11 pt__ wid 0.65 at C2.ne ljust + ] with .C1.sw at T.S2.se+(0.5,0.0) + +Y: [ + tconn(,O) + {`"\tt tconn(,O)"' at last line.c+(0,-0.2) wid 43 pt__ } + move to Here+(0.3,0) + P1: tconn(,>) + {`"\tt (,>)"' at last line.c+(0,-0.2)} + move to P1.end+(0.3,0) + tconn(,>>) + {`"\tt (,>>)"' at last line.c+(0,-0.2)} + move to P1.start+(0,linewid) + P3: tconn(,<) + {`"\tt tconn(,<)"' at last line.c+(0,-0.2)} + move to P3.end+(0.3,0) + tconn(,<<) + {`"\tt (,<<)"' at last line.c+(0,-0.2)} + +] with .sw at (C.e.x-0.4,T.s.y) + +B: [ + tbox(V_2) + `"\tt tbox(V\_2)"' at last [].sw below ljust + [ left_; + tbox(V_1,,,<>) ] with .nw at last [].sw+(0,-0.25) + `"\tt tbox(V\_1,{,},<>)"' at last [].sw below ljust +# `"\tt left\_"' at last [].sw +(0,-0.2) ljust `"\tt tbox(V\_1)"' ljust +] with .nw at Y.ne+(0.2,0) + + +.PE diff --git a/graphics/circuit_macros/examples/Contact.m4 b/graphics/circuit_macros/examples/Contact.m4 new file mode 100644 index 0000000000..26f8d5a982 --- /dev/null +++ b/graphics/circuit_macros/examples/Contact.m4 @@ -0,0 +1,98 @@ +.PS +# Contact +cct_init + +movw = 0.45 +{ + contact + {S:`"\tt contact"' at last [].s+(0,-0.15) + "\sl P" rjust at last [].P.w + "\sl O" ljust at last [].O + "\sl C" ljust at last [].C } + move right_ movw; contact(R) + {`"\tt (R)"' at (last [].s,S) + "\sl P" rjust at last [].P.w + "\sl O" ljust at last [].O + "\sl C" ljust at last [].C } + move right_ movw; contact(O); {`"\tt (O)"' at (last [],S)} + move right_ movw; contact(C); {`"\tt (C)"' at (last [],S)} + + move right_ movw; contact(P) + {S: `"\tt (P)"' at last [].s+(0,-0.15) + "\sl P" rjust at last [].P.w + "\sl O" ljust at last [].O + "\sl C" ljust at last [].C } + move right_ movw; contact(PR) + {S: `"\tt (PR)"' at last [].s+(0,-0.15) + "\sl P" rjust at last [].P.w + "\sl O" ljust at last [].O + "\sl C" ljust at last [].C } + move right_ movw; contact(PO); {`"\tt (PO)"' at (last [],S)} + {"\sl O" ljust at last [].O + "\sl C" ljust at last [].C } + move right_ movw; contact(PC); {`"\tt (PC)"' at (last [],S)} +} + +move down 0.75; right_ ; { + contact(I); {`S: "\tt (I)"' at last [].s+(0,-12bp__) + "\sl P" rjust at last [].P.w + "\sl O" ljust at last [].O.e + "\sl C" ljust at last [].C.e } + move right_ movw; contact(RI) + {`"\tt (RI)"' at (last [],S) + "\sl P" rjust at last [].P.w + "\sl O" ljust at last [].O.e + "\sl C" ljust at last [].C.e } + move right_ movw; contact(OI); {`"\tt (OI)"' at (last [],S)} + move right_ movw; contact(CI); {`"\tt (CI)"' at (last [],S)} + + move right_ movw; contact(PI); {`"\tt (PI)"' at (last [],S) } + {"\sl O" ljust at last [].O.e + "\sl C" ljust at last [].C.e } + move right_ movw; contact(PIO); {`"\tt (PIO)"' at (last [],S) } + move right_ movw; contact(PIC); {`"\tt (PIC)"' at (last [],S) } +} + +movewid = movw + move down 0.65; right_; { + K: contact(T) + {S: `"\tt (T)"' at last [].s+(0,-0.15) + thinlines_ + spline <- right 0.09 then up 0.05 right 0.05 from K.C; "$\;\;$\sl C" + spline <- right 0.09 then down 0.05 right 0.05 from K.O; "$\;\;$\sl O" + thicklines_ } + move; K: contact(RT) + {`"\tt (RT)"' at (last [],S) + thinlines_ + spline <- right 0.09 then up 0.05 right 0.05 from K.O; "$\;\;$\sl O" + spline <- right 0.09 then down 0.05 right 0.05 from K.C; "$\;\;$\sl C" + thicklines_ } + move; contact(OT); {S: `"\tt (OT)"' at (last [],S) } + move; contact(CT); {S: `"\tt (CT)"' at (last [],S) } + move; contact(PT); {S: `"\tt (PT)"' at (last [],S) } + move; contact(PTO); {S: `"\tt (PTO)"' at (last [],S) } + move; contact(PTC); {S: `"\tt (PTC)"' at (last [],S) } +} + + move down 0.65; right_; { + K: contact(U) + {S: `"\tt (U)"' at last [].s+(0,-0.15) + thinlines_ + spline <- right 0.09 then up 0.05 right 0.05 from K.C; "$\;\;$\sl C" + spline <- right 0.09 then down 0.05 right 0.05 from K.O; "$\;\;$\sl O" + thicklines_ } + move; K: contact(RU) + {`"\tt (RU)"' at (last [],S) + thinlines_ + spline <- right 0.09 then up 0.05 right 0.05 from K.O; "$\;\;$\sl O" + spline <- right 0.09 then down 0.05 right 0.05 from K.C; "$\;\;$\sl C" + thicklines_ } + move; K: contact(OU); {S: `"\tt (OU)"' at (last [],S) + "\sl O" ljust at K.O.e } + move; K: contact(CU); {S: `"\tt (CU)"' at (last [],S) + "\sl C" ljust at K.C.e } + move; contact(PU); {S: `"\tt (PU)"' at (last [],S) } + move; contact(PUO); {S: `"\tt (PUO)"' at (last [],S) } + move; contact(PUC); {S: `"\tt (PUC)"' at (last [],S) } +} +.PE diff --git a/graphics/circuit_macros/examples/Contacts.m4 b/graphics/circuit_macros/examples/Contacts.m4 new file mode 100644 index 0000000000..9e006218e3 --- /dev/null +++ b/graphics/circuit_macros/examples/Contacts.m4 @@ -0,0 +1,46 @@ +.PS +# Contacts.m4 +cct_init + + space = 0.75 + KS:contacts(2) + {`"\tt contacts(2)"' at KS.s +(0,-12bp__) + for_(1,2,1, + `"\sl P`'m4x" rjust at last [].P`'m4x-(dotrad_,0) + "\sl O`'m4x" ljust at last [].O`'m4x+(dotrad_,0) + "\sl C`'m4x" ljust at last [].C`'m4x+(dotrad_,0) ') } + + KS:contacts(2,I) with .sw at last [].se+(space,0) + {`"\tt (2,I)"' at KS.s +(0,-12bp__) + for_(1,2,1, + `"\sl P`'m4x" rjust at last [].P`'m4x-(dotrad_,0) + "\sl O`'m4x" ljust at last [].O`'m4x+(dotrad_,0) + "\sl C`'m4x" ljust at last [].C`'m4x+(dotrad_,0) ') } + + KS:contacts(2,IO) with .sw at last [].se+(space,0) + {`"\tt (2,IO)"' at KS.s +(0,-12bp__) + for_(1,2,1, + `"\sl P`'m4x" rjust at last [].P`'m4x-(dotrad_,0) + "\sl O`'m4x" ljust at last [].O`'m4x+(dotrad_,0) ') } + + KS:contacts(2,PICD) with .sw at last [].se+(space,0) + {`"\tt (2,PICD)"' at KS.s +(0,-12bp__) + for_(1,2,1, + `"\sl P`'m4x" rjust at last [].P`'m4x-(dotrad_,0) + "\sl O`'m4x" ljust at last [].O`'m4x+(dotrad_,0) + "\sl C`'m4x" ljust at last [].C`'m4x+(dotrad_,0) ') } + + KS:contacts(2,PTCD) with .sw at last [].se+(space,0) + {`"\tt (2,PTCD)"' at KS.s +(0,-12bp__) + for_(1,2,1, + `"\sl P`'m4x" rjust at last [].P`'m4x-(dotrad_,0) + "\sl O`'m4x" ljust at last [].O`'m4x+(dotrad_,0) + "\sl C`'m4x" ljust at last [].C`'m4x+(dotrad_,0) ') } + + KS:contacts(2,PUCD) with .sw at last [].se+(space,0) + {`"\tt (2,PUCD)"' at KS.s +(0,-12bp__) + for_(1,2,1, + `"\sl P`'m4x" rjust at last [].P`'m4x-(dotrad_,0) + "\sl O`'m4x" ljust at last [].O`'m4x+(dotrad_,0) + "\sl C`'m4x" ljust at last [].C`'m4x+(dotrad_,0) ') } +.PE diff --git a/graphics/circuit_macros/examples/Crow.m4 b/graphics/circuit_macros/examples/Crow.m4 index 61e2a3ce50..91434c0c01 100644 --- a/graphics/circuit_macros/examples/Crow.m4 +++ b/graphics/circuit_macros/examples/Crow.m4 @@ -33,22 +33,22 @@ define(`boxtext',`s_box(\parbox{%gpt}{\sf `$1'},int(last box.wid/(1pt__))) \ boxwid = boxwid*1.15 boxsep = boxwid/2 - custombox(Class,ht boxht*2.2, + custombox(Class,ht boxht*1.7, `classkey\\ class\_type\\ class\_desc') custombox(Product,ht Class.ht with .nw at Class.ne+(boxsep,0), `classkey\\ prodkey\\ prod\_name\\ pkg\_type') - custombox(Sales,ht boxht*3.3 with .nw at Product.ne+(boxsep*2,15pt__), + custombox(Sales,ht boxht*2.75 with .nw at Product.ne+(boxsep*2,13pt__), `perkey\\ classkey\\ prodkey\\ storekey\\ promokey\\ quantity\\ dollars') custombox(Period,ht Sales.ht with .nw at Sales.ne+(boxsep*2,0), `perkey\\ date\\ day\\ week\\ month\\ qtr\\ year') - custombox(Market,ht Sales.ht with .nw at Class.sw+(0,-boxsep*2), + custombox(Market,ht Sales.ht with .nw at Class.sw+(0,-boxsep*3/2), `perkey\\ date\\ day\\ week\\ month\\ qtr\\ year') - custombox(Store,ht boxht*3.6 with .sw at (Product.w,Market.s), + custombox(Store,ht boxht*3.2 with .sw at (Product.w,Market.s), `storekey\\ mktkey\\ store\_type\\ store\_name\\ street\\ city\\ state\\ zip') custombox(Promotion,ht Market.ht with .sw at (Period.w,Market.s), @@ -61,7 +61,7 @@ define(`boxtext',`s_box(\parbox{%gpt}{\sf `$1'},int(last box.wid/(1pt__))) \ T: last line.c+(0,-crow_wd*2.5) move to Period.nw+(0,-10pt__); crowline(to (Sales.e,Here),,1.75*crow_wd) -Q: (last line.c,0.4 between Sales.se and Sales.ne) +Q: (last line.c,0.35 between Sales.se and Sales.ne) move to Market.ne+(0,-10pt__); crowline(to (Store.w,Here)) move to Store.ne+(0,-10pt__); line to (T,Here) then to T diff --git a/graphics/circuit_macros/examples/Csource.m4 b/graphics/circuit_macros/examples/Csource.m4 index 1441cfcb17..f2902525c0 100644 --- a/graphics/circuit_macros/examples/Csource.m4 +++ b/graphics/circuit_macros/examples/Csource.m4 @@ -31,7 +31,7 @@ define(`ppair',`[define(`m4lr',ifelse(`$1',,ljust,rjust)) line from J.D to S then to Q.C ]') R2: resistor(down_ dimen_) - llabel(,"$R_2$" ljust "\unit{150}{}") + llabel(,"$R_2$" ljust "\num{150}") dot Q13: bi_tr(down_ dimen_,,P,E) with .E at Here rlabel(,"$Q_{13}$" rjust "2N4236") @@ -41,7 +41,7 @@ define(`ppair',`[define(`m4lr',ifelse(`$1',,ljust,rjust)) dot(at Q14.E) { line left_ dimen_*1.3 then up_ dimen_ R1: potentiometer(up_ dimen_) with .Start at Here - rlabel(,"$R_1$" ljust "\unit{20}{\kilo}") + rlabel(,"$R_1$" ljust "\SI{20}{\kilo{}}") { ground(at R1.T1) } line from R1.End to (R1.End,Q13.E) then to Q13.E } { dot(at Q13.C+(0,-elen_)) @@ -50,7 +50,7 @@ define(`ppair',`[define(`m4lr',ifelse(`$1',,ljust,rjust)) V1: gap(down_ dimen_,1); rlabel(+,V_1,-) line down_ dimen_/4 chop dotrad_ chop 0; ground(,T) } R3: resistor(down_ dimen_) - llabel(,"$R_3$" ljust "\unit{150}{}") + llabel(,"$R_3$" ljust "\num{150}") dot(at Q13.C+(0,-2*elen_)) line right_ dimen_/2 A1: opamp with .In2 at Here; "A$_1$" at A1.C @@ -58,17 +58,17 @@ define(`ppair',`[define(`m4lr',ifelse(`$1',,ljust,rjust)) line left_ dimen_/4 from A1.In1 then up_ dimen_/2 then right dimen_ dot { resistor(up_ elen_) - llabel(,"$R_{14}$" rjust "\unit{19}{\kilo}") + llabel(,"$R_{14}$" rjust "\SI{19}{\kilo{}}") line to (Here,Q13.E) then to Q13.E } line to (A1.Out,Here) dot { line to A1.Out dot resistor(down_ to (Here,Q14.E)) - llabel(,"$R_{13}$" ljust "\unit{91}{\kilo}") + llabel(,"$R_{13}$" ljust "\SI{91}{\kilo{}}") line to Q14.E } R6: resistor(right_ dimen_) - clabel(,"$R_6$" "\vphantom{x}" "\unit{15}{\kilo}") + clabel(,"$R_6$" "\vphantom{x}" "\SI{15}{\kilo{}}") dot line to (Here,A1.In1) then right_ dimen_/4 A2: opamp with .In1 at Here; "A$_2$" at A2.C @@ -101,39 +101,39 @@ define(`ppair',`[define(`m4lr',ifelse(`$1',,ljust,rjust)) line to Q13.B line from DP3.G to (T,DP3.G) then to (T,DP4.G) then to DP4.G R11: resistor(down_ dimen_ from DP4.S) - rlabel(,"$R_{11}$" rjust "\unit{20}{}") + rlabel(,"$R_{11}$" rjust "\num{20}") D5: diode(up_ from DP3.S to (DP3.S,A2),Z) llabel(,"$D_5$" rjust "1N4729$_{\strut}$") line to R11.end C4: capacitor(right_ dimen_*1.3 from DP3.S,C) - llabel(,C_4); rlabel(,\unit{0.68}{\micro\farad}) + llabel(,C_4); rlabel(,\SI{0.68}{\micro\farad}) C3: capacitor(right_ dimen_*1.3 from DP4.S,C) - llabel(,C_3); rlabel(,\unit{0.68}{\micro\farad}) + llabel(,C_3); rlabel(,\SI{0.68}{\micro\farad}) dot dot(at (Here,R6)) C2: reversed(`capacitor',left_ dimen_*1.3,C) - rlabel(,C_2); llabel(,\unit{0.1}{\micro\farad}) + rlabel(,C_2); llabel(,\SI{0.1}{\micro\farad}) line to R6.end R5: resistor(up_ from R6.end to (R6.end,Q13.B)) - rlabel(,"$R_5$" ljust "\unit{100}{\kilo}") + rlabel(,"$R_5$" ljust "\SI{100}{\kilo{}}") dot(at R5.top-(0,dimen_/2)) line left_ dimen_/2 capacitor(down_ dimen_,C) - rlabel(,"$C_1$" rjust "\unit{1}{\micro\farad}") + rlabel(,"$C_1$" rjust "\SI{1}{\micro\farad}") ground(,T) line from DP4.E to (DP4.E,R2.bottom) resistor(up_ to (Here,R2.top)) - rlabel(,"$R_9$" ljust "\unit{910}{}") + rlabel(,"$R_9$" ljust "\num{910}") dot resistor(down_ from DP3.E to (DP3.E,R3.bottom)) - llabel(,"$R_{10}$" ljust "\unit{910}{}") + llabel(,"$R_{10}$" ljust "\num{910}") dot line from R5.top to (R5,Q13.E) resistor(right_ elen_) - clabel(,"$R_4$" "\vphantom{x}" "\unit{100}{\kilo}") + clabel(,"$R_4$" "\vphantom{x}" "\SI{100}{\kilo{}}") line to (C4.end,Here) then to C4.end DP5: npair(L,11,10) with .E at (C4.end,DP1.E)+(elen_*0.8,0) @@ -149,7 +149,7 @@ define(`ppair',`[define(`m4lr',ifelse(`$1',,ljust,rjust)) dot(,,1) `"$+E_{CC}$"' ljust at last [].e resistor(down_ from DP6.S to (DP6.S,C2)) - rlabel(,"$R_{12}$" rjust "\unit{20}{}") + rlabel(,"$R_{12}$" rjust "\num{20}") dot { line to C2.e } line to D6.end @@ -162,7 +162,7 @@ define(`ppair',`[define(`m4lr',ifelse(`$1',,ljust,rjust)) dot(at (Vr,T)) resistor(left_ to (DP6.E,Here)) - clabel("$R_{15}$" "" "\unit{200}{}" ljust) + clabel("$R_{15}$" "" "\num{200}" ljust) line to (DP1.E,Here) dot diff --git a/graphics/circuit_macros/examples/Demultiplexer.m4 b/graphics/circuit_macros/examples/Demultiplexer.m4 new file mode 100644 index 0000000000..210b643441 --- /dev/null +++ b/graphics/circuit_macros/examples/Demultiplexer.m4 @@ -0,0 +1,44 @@ +.PS +# `Demultiplexer.m4' +log_init + + ifmpost(`command "verbatimtex {\sf etex"', + `ifpostscript(, + `command "{\sf"')') + + right_ + + Demux(4,DM1) + `"\tt Demux(4,DM1)"' at last [].s below + `"\sl Out0"' at last [].Out0.end +(6bp__,6bp__) + `"\sl Out3"' at last [].Out3.end +(6bp__,-6bp__) + `"\sl In"' at last [].In.end rjust wid 11bp__ + `"\sl Sel"' at last [].Sel.end ljust above + left_; Demux(4,,LOE) with .c at last [].c+(1.2,0) + `"\tt left\_; Demux(4,{,}LOE)"' at last [].s + (0,-20bp__) ht 10bp__ + `"\sl Sel"' at last [].Sel.end rjust + `"\sl Out0"' at last [].Out0.end +(-6bp__,6bp__) + `"\sl OE"' at last [].OE.end ljust + `"\sl In"' at last [].In.end+(0,5bp__) ljust + right_; Demux(4,,NOEBN2) with .c at last [].c+(1.2,0) + `"\tt (4,{,}NOEBN2)"' at last [].s below + `"\sl Sel0"' at last [].Sel0.end rjust + `"\sl Sel1"' at last [].Sel1.end ljust + `"\sl Out0"' at last [].Out0.end +(5bp__,6bp__) + `"\sl Out3"' at last [].Out3.end +(5bp__,6bp__) + `"\sl NOE"' at last [].NOE.end rjust + `"\sl In"' at last [].In.end above + down_; Demux(8,,L3,,28*L_unit) with .c at last [].c+(1.8,0) + `"\tt down\_; Demux(8,{,}L3,{,}28*L\_unit)"' at last [].s+(0,-15bp__) \ + ht 10bp__ wid 170bp__ + `"\sl Sel0"' at last [].Sel0.end rjust + `"\sl Sel2"' at last [].Sel2.end rjust below + `"\sl Out0"' at last [].Out0.end rjust + `"\sl Out7"' at last [].Out7.end ljust + `"\sl In"' at last [].In.end rjust + +ifmpost(`command "verbatimtex } etex"', +`ifpostscript(, +`command "}"')') + +.PE diff --git a/graphics/circuit_macros/examples/Dini.m4 b/graphics/circuit_macros/examples/Dini.m4 new file mode 100644 index 0000000000..5631a4822f --- /dev/null +++ b/graphics/circuit_macros/examples/Dini.m4 @@ -0,0 +1,193 @@ +.PS +# Dini.m4 +# This diagram can be produced using, e.g. +# m4 pdf.m4 Dini.m4 | dpic -d > Dini.pdf + +threeD_init +NeedDpicTools +scale = 1.5 +[ + viewazimuth = 0 # View angles in degrees + viewelevation = 20 + setview(viewazimuth,viewelevation,0) + + a = 1.5 + b = 0.25 + +define(`Dini', +`a*cos(`$1')*sin(`$2'),dnl + a*sin(`$1')*sin(`$2'),dnl + (a*(cos(`$2')+loge(tan((`$2')/2))) + b*(`$1'))') + + umin = 0; umax = 4*pi_ + vmin = 0.2; vmax = 2.0 + ugrid = 80; vgrid = 20 + + ur = umax-umin + vr = vmax-vmin +`define cu {umin+($1)/ugrid*ur}' +`define cv {vmin+($1)/vgrid*vr}' + +# Generate points and sort + n = -1 + for iu=0 to ugrid do { + for iv=0 to vgrid do { + n +=1 + ciu[n] = cu(iu) + civ[n] = cv(iv) + d[n] = dot3D(View3D,Dini(ciu[n],civ[n])) + ix[n] = n + } + } + dpquicksort(d,0,n,ix) + +# Draw the facets + linethick = 0.4 + du = ur/ugrid/2 + dv = vr/vgrid/2 + for i=0 to n do { + NE: project(Dini(ciu[ix[i]]+du,civ[ix[i]]+dv)) + SE: project(Dini(ciu[ix[i]]+du,civ[ix[i]]-dv)) + SW: project(Dini(ciu[ix[i]]-du,civ[ix[i]]-dv)) + NW: project(Dini(ciu[ix[i]]-du,civ[ix[i]]+dv)) + f = (-cos(ciu[ix[i]])+1)/2 + g = ( sin(ciu[ix[i]])+1)/2 + line from NE to SE then to SW then to NW then to NE \ + outlined rgbstring(f,g,0) shaded rgbstring(f,g,0) +# outlined rgbstring(0,0.5,0) shaded rgbstring(f,g,0) + } +] +# Icosahedron.m4 +[ +#threeD_init +#NeedDpicTools + # Computing facets is complicated, so list them. + # 60 vertices: +define(`m4x',-1) + array2(v,m4inx,0, 0, 1.021) + array2(v,m4inx,0.4035482, 0, 0.9378643) + array2(v,m4inx,-0.2274644, 0.3333333, 0.9378643) + array2(v,m4inx,-0.1471226, -0.375774, 0.9378643) + array2(v,m4inx,0.579632, 0.3333333, 0.7715933) + array2(v,m4inx,0.5058321, -0.375774, 0.8033483) + array2(v,m4inx,-0.6020514, 0.2908927, 0.7715933) + array2(v,m4inx,-0.05138057, 0.6666667, 0.7715933) + array2(v,m4inx,0.1654988, -0.6080151, 0.8033483) + array2(v,m4inx,-0.5217096, -0.4182147, 0.7715933) + array2(v,m4inx,0.8579998, 0.2908927, 0.4708062) + array2(v,m4inx,0.3521676, 0.6666667, 0.6884578) + array2(v,m4inx,0.7841999, -0.4182147, 0.5025612) + array2(v,m4inx,-0.657475, 0.5979962, 0.5025612) + array2(v,m4inx,-0.749174, -0.08488134, 0.6884578) + array2(v,m4inx,-0.3171418, 0.8302373, 0.5025612) + array2(v,m4inx,0.1035333, -0.8826969, 0.5025612) + array2(v,m4inx,-0.5836751, -0.6928964, 0.4708062) + array2(v,m4inx,0.8025761, 0.5979962, 0.2017741) + array2(v,m4inx,0.9602837, -0.08488134, 0.3362902) + array2(v,m4inx,0.4899547, 0.8302373, 0.3362902) + array2(v,m4inx,0.7222343, -0.6928964, 0.2017741) + array2(v,m4inx,-0.8600213, 0.5293258, 0.1503935) + array2(v,m4inx,-0.9517203, -0.1535518, 0.3362902) + array2(v,m4inx,-0.1793548, 0.993808, 0.1503935) + array2(v,m4inx,0.381901, -0.9251375, 0.2017741) + array2(v,m4inx,-0.2710537, -0.9251375, 0.3362902) + array2(v,m4inx,-0.8494363, -0.5293258, 0.2017741) + array2(v,m4inx,0.8494363, 0.5293258, -0.2017741) + array2(v,m4inx,1.007144, -0.1535518, -0.06725804) + array2(v,m4inx,0.2241935, 0.993808, 0.06725804) + array2(v,m4inx,0.8600213, -0.5293258, -0.1503935) + array2(v,m4inx,-0.7222343, 0.6928964, -0.2017741) + array2(v,m4inx,-1.007144, 0.1535518, 0.06725804) + array2(v,m4inx,-0.381901, 0.9251375, -0.2017741) + array2(v,m4inx,0.1793548, -0.993808, -0.1503935) + array2(v,m4inx,-0.2241935, -0.993808, -0.06725804) + array2(v,m4inx,-0.8025761, -0.5979962, -0.2017741) + array2(v,m4inx,0.5836751, 0.6928964, -0.4708062) + array2(v,m4inx,0.9517203, 0.1535518, -0.3362902) + array2(v,m4inx,0.2710537, 0.9251375, -0.3362902) + array2(v,m4inx,0.657475, -0.5979962, -0.5025612) + array2(v,m4inx,-0.7841999, 0.4182147, -0.5025612) + array2(v,m4inx,-0.9602837, 0.08488134, -0.3362902) + array2(v,m4inx,-0.1035333, 0.8826969, -0.5025612) + array2(v,m4inx,0.3171418, -0.8302373, -0.5025612) + array2(v,m4inx,-0.4899547, -0.8302373, -0.3362902) + array2(v,m4inx,-0.8579998, -0.2908927, -0.4708062) + array2(v,m4inx,0.5217096, 0.4182147, -0.7715933) + array2(v,m4inx,0.749174, 0.08488134, -0.6884578) + array2(v,m4inx,0.6020514, -0.2908927, -0.7715933) + array2(v,m4inx,-0.5058321, 0.375774, -0.8033483) + array2(v,m4inx,-0.1654988, 0.6080151, -0.8033483) + array2(v,m4inx,0.05138057, -0.6666667, -0.7715933) + array2(v,m4inx,-0.3521676, -0.6666667, -0.6884578) + array2(v,m4inx,-0.579632, -0.3333333, -0.7715933) + array2(v,m4inx,0.1471226, 0.375774, -0.9378643) + array2(v,m4inx,0.2274644, -0.3333333, -0.9378643) + array2(v,m4inx,-0.4035482, 0, -0.9378643) + array2(v,m4inx,0, 0, -1.021) + + # 12 pentagons +undefine(`m4x') +array2(p,m4inx,0,3,8,5,1) +array2(p,m4inx,2,7,15,13,6) +array2(p,m4inx,4,10,18,20,11) +array2(p,m4inx,9,14,23,27,17) +array2(p,m4inx,12,21,31,29,19) +array2(p,m4inx,16,26,36,35,25) +array2(p,m4inx,22,32,42,43,33) +array2(p,m4inx,24,30,40,44,34) +array2(p,m4inx,28,39,49,48,38) +array2(p,m4inx,37,47,55,54,46) +array2(p,m4inx,41,45,53,57,50) +array2(p,m4inx,51,52,56,59,58) + + # 20 hexagons +undefine(`m4x') +array2(h,m4inx,0,1,4,11,7,2) +array2(h,m4inx,0,2,6,14,9,3) +array2(h,m4inx,1,5,12,19,10,4) +array2(h,m4inx,3,9,17,26,16,8) +array2(h,m4inx,5,8,16,25,21,12) +array2(h,m4inx,6,13,22,33,23,14) +array2(h,m4inx,7,11,20,30,24,15) +array2(h,m4inx,10,19,29,39,28,18) +array2(h,m4inx,13,15,24,34,32,22) +array2(h,m4inx,17,27,37,46,36,26) +array2(h,m4inx,18,28,38,40,30,20) +array2(h,m4inx,21,25,35,45,41,31) +array2(h,m4inx,23,33,43,47,37,27) +array2(h,m4inx,29,31,41,50,49,39) +array2(h,m4inx,32,34,44,52,51,42) +array2(h,m4inx,35,36,46,54,53,45) +array2(h,m4inx,38,48,56,52,44,40) +array2(h,m4inx,42,51,58,55,47,43) +array2(h,m4inx,48,49,50,57,59,56) +array2(h,m4inx,53,54,55,58,59,57) + + viewazimuth = -10 # View angles in degrees + viewelevation = 40 + setview(viewazimuth,viewelevation,0) + + n = 0 # Find and draw the visible hexagons + for i=1 to 20 do { # The normal is the line to the center + for_(1,3,1,`a[m4x] = (v[h[i,1],m4x] + v[h[i,4],m4x])/2') + if dot3D(View3D,a[1],a[2],a[3]) >= 0 then { n +=1; ih[n] = i } + } + for i=1 to n do { + for j=1 to 6 do { x[j]=h[ih[i],j] } + line from project((v[x[1],1]),(v[x[1],2]),(v[x[1],3]))\ + for_(2,6,1,`to project((v[x[m4x],1]),(v[x[m4x],2]),(v[x[m4x],3]))\')\ + to project((v[x[1],1]),(v[x[1],2]),(v[x[1],3])) thick 0.2 fill_(0.95) + } + m = 0 + for i=1 to 12 do { # Visible pentagons + for_(1,3,1,`a[m4x] = 0; for j=1 to 5 do { a[m4x] += v[p[i,j],m4x] }') + if dot3D(View3D,a[1]/5,a[2]/5,a[3]/5) >= 0 then { m +=1; ip[m] = i } + } + for i=1 to m do { + for j=1 to 5 do { x[j]=p[ip[i],j] } + line from project((v[x[1],1]),(v[x[1],2]),(v[x[1],3])) \ + for_(2,5,1,`to project((v[x[m4x],1]),(v[x[m4x],2]),(v[x[m4x],3]))\')\ + to project((v[x[1],1]),(v[x[1],2]),(v[x[1],3])) thick 0.2 fill_(0) + } +] scaled 2.5 with .sw at last [].se+(1,0) +.PE diff --git a/graphics/circuit_macros/examples/Diodes.m4 b/graphics/circuit_macros/examples/Diodes.m4 new file mode 100644 index 0000000000..360d8e9d9e --- /dev/null +++ b/graphics/circuit_macros/examples/Diodes.m4 @@ -0,0 +1,48 @@ +.PS +# `Diodes.m4' +cct_init +movewid = 2pt__ +{ {diode ; move ; "`{\tt diode}'" ljust} + move down 0.2; right_ + {diode(,S) ; move ; "`{\tt diode(,S)}'" ljust} + move down 0.2; right_ + {diode(,V) ; move ; "`{\tt diode(,V)}'" ljust} + move down 0.2; right_ + {diode(,v) ; move ; "`{\tt diode(,v)}'" ljust} + move down 0.2; right_ + {diode(,w) ; move ; "`{\tt diode(,w)}'" ljust} + move down 0.2; right_ + {diode(,B) ; move ; "`{\tt diode(,B)}'" ljust} + move down 0.2; right_ + {diode(,G) ; move ; "`{\tt diode(,G)}'" ljust} + } + + move right_ 2.0 +{ {diode(,K) ; move ; "`{\tt diode(,K)}'" ljust} + move down 0.2; right_ + {diode(,ZK) ; move ; "`{\tt diode(,ZK)}'" ljust} + move down 0.2; right_ + {diode(,CR) ; move ; "`{\tt diode(,CR)}'" ljust} + move down 0.2; right_ + {diode(,L) ; move ; "`{\tt diode(,L)}'" ljust} + move down 0.2; right_ + {diode(,F) ; move ; "`{\tt diode(,F)}'" ljust} + move down 0.2; right_ + {diode(,Sh) ; move ; "`{\tt diode(,Sh)}'" ljust} + move down 0.2; right_ + {diode(,D) ; move ; "`{\tt diode(,D)}'" ljust} + } + + move right_ 2.0 +{ {diode(,Z,RE) ; move ; "`{\tt diode(,Z,RE)}'" ljust} + move down 0.25; right_ + {diode(,T) ; move ; "`{\tt diode(,T)}'" ljust} + move down 0.30; right_ + {diode(,P) ; move ; "`{\tt diode(,P)}'" ljust} + move down 0.30; right_ + {diode(,LE) ; move ; "`{\tt diode(,LE)}'" ljust} + move down 0.15; right_ + {diode(,LER) ; move ; "`{\tt diode(,LER)}'" ljust} + } + +.PE diff --git a/graphics/circuit_macros/examples/Emarrows.m4 b/graphics/circuit_macros/examples/Emarrows.m4 new file mode 100644 index 0000000000..c4b2131902 --- /dev/null +++ b/graphics/circuit_macros/examples/Emarrows.m4 @@ -0,0 +1,30 @@ +.PS +# `Emarrows.m4' +cct_init + hskip = 0.6 +[ + { em_arrows(N) + box dotted wid last [].wid ht last [].ht at last [].c + thinlines_ + arrow <- left 0.15 from last [].Head; "\sl Head" wid 0.31 rjust + arrow <- down 0.12 from last [].Tail; "\sl Tail" below + "\sl A1" rjust below at last [].A1.c + "\sl A2" ljust above at last [].A2.c + thicklines_ + move down 0.25 from last [].s + move up 0.2 from last [].n + "\tt em\_arrows(N)" at last [].s+(0,-0.20) below } + { em_arrows(ND,45) with .sw at last [].se+(hskip*1.5,0) + "\tt em\_arrows(ND,45)" at last [].s below } + { em_arrows(I) with .sw at last [].se+(hskip,0) + "\tt $\ldots$(I)" at last [].s below } + { em_arrows(ID) with .sw at last [].se+(hskip,0) + "\tt $\ldots$(ID)" at last [].s below } + { em_arrows(E) with .sw at last [].se+(hskip,0) + "\tt $\ldots$(E)" at last [].s below } + { em_arrows(ED) with .sw at last [].se+(hskip,0) + "\tt $\ldots$(ED)" at last [].s below } + ] +#showbox_ + +.PE diff --git a/graphics/circuit_macros/examples/Fuses.m4 b/graphics/circuit_macros/examples/Fuses.m4 new file mode 100644 index 0000000000..b308e5aadb --- /dev/null +++ b/graphics/circuit_macros/examples/Fuses.m4 @@ -0,0 +1,32 @@ +.PS +# `Fuses.m4' +cct_init + +movewid = 0.25 + + {fuse ; {"`{\tt fuse}'" at last line.c+(0,-0.2)} + move + fuse(,D) ; {"`{\tt fuse(,D)}'" at last line.c+(0,-0.2)} + move + fuse(,B) ; {"`{\tt fuse(,B)}'" at last line.c+(0,-0.2)} + move + fuse(,C) ; {"`{\tt fuse(,C)}'" at last line.c+(0,-0.2)} + move + fuse(,S) ; {"`{\tt fuse(,S)}'" at last line.c+(0,-0.2)} + move + fuse(,HB) ; {"`{\tt fuse(,HB)}'" at last line.c+(0,-0.2)} + } + move down; right_ + fuse(,HC,0.5,0.3) ; {"`{\tt (,HC,0.5,0.3)}'" at last line.c+(0,-0.25)} + move + cbreaker; {"`{\tt cbreaker}'" at last line.c+(0,-0.25)} + move + cbreaker(,R); {"`{\tt cbreaker(,R)}'" at last line.c+(0,-0.25)} + move + cbreaker(,{,}D); {"`{\tt $\ldots$(,{,}D)}'" at last line.c+(0,-0.25)} + move + cbreaker(,{,}T); {"`{\tt $\ldots$(,{,}T)}'" at last line.c+(0,-0.25)} + move + cbreaker(,{,}TS); {"`{\tt $\ldots$(,{,}TS)}'" at last line.c+(0,-0.25)} + +.PE diff --git a/graphics/circuit_macros/examples/GnuMakefile b/graphics/circuit_macros/examples/GnuMakefile deleted file mode 100644 index 4b7d99c453..0000000000 --- a/graphics/circuit_macros/examples/GnuMakefile +++ /dev/null @@ -1,119 +0,0 @@ -# Makefile for Circuit macros (based on Version 8.5.1) -# Use GNU make. - -SRC = $(wildcard *.m4) -TARGET = $(SRC:%.m4=%.$(MODE)) - -CMLIBDIR = /usr/local/share/Circuit_macros -CMLIBDIR = $$(HOME)/lib -CMLIBS = liblog.m4 -CMLIBS = libgen.m4 - -DPIC = dpic -GPIC = pic -M4 = m4 -I $(CMLIBDIR) - -# select one of tex, eps, pdf, svg, mp or fig -MODE = tex - -# select one of pstricks, pgf, mfpic, latex or tpic -# (for .tex output) -TEXMODE = pgf -TEXMODE = pstricks - -# select one of raw or psfrag -# (for .eps output) -EPSMODE = raw - - - -# ---- DO NOT CHANGE THE FOLLOWING LINES ---- -PIC = $(DPIC) - -# for .tex -TPIC = $(PIC) -ifeq ($(TEXMODE),pstricks) - TPICOPT = -P - TCMDRIVER = $(TEXMODE).m4 -else ifeq ($(TEXMODE),pgf) - TPICOPT = -g - TCMDRIVER = $(TEXMODE).m4 -else ifeq ($(TEXMODE),mfpic) - TPICOPT = -m - TCMDRIVER = $(TEXMODE).m4 -else ifeq ($(TEXMODE),latex) - TPICOPT = -e - TCMDRIVER = -else ifeq ($(TEXMODE),tpic) - TPIC = $(GPIC) - TPICOPT = -t - TCMDRIVER = gpic.m4 -else - TERROR = TRUE -endif - -# for .eps -ifeq ($(EPSMODE),raw) - EPICOPT = -r - ECMDRIVER = postscript.m4 -else ifeq ($(EPSMODE),psfrag) - EPICOPT = -f - ECMDRIVER = $(EPSMODE).m4 -else - EERROR = TRUE -endif - - -.SUFFIXES: .m4 .tex .eps .pdf .svg .mp .fig - -.m4.tex: -ifeq ($(TERROR),TRUE) - @echo "Invalid TEXMODE:" $(TEXMODE) - @exit 1 \ -else - $(M4) $(CMLIBS) $(TCMDRIVER) $< > $*.pic - $(TPIC) $(TPICOPT) $*.pic > $*.tex -endif - -.m4.eps: -ifeq ($(EERROR),TRUE) - echo "Invalid EPSMODE:" $(EPSMODE) - @exit 1 \ -else - $(M4) $(CMLIBS) $(ECMDRIVER) $< > $*.pic - $(PIC) $(EPICOPT) $*.pic > $*.eps -endif - -.m4.pdf: - $(M4) $(CMLIBS) $< > $*.pic - $(PIC) -d $*.pic > $*.pdf -.m4.svg: - $(M4) $(CMLIBS) svg.m4 $< > $*.pic - $(PIC) -v $*.pic > $*.svg -.m4.mp: - $(M4) $(CMLIBS) mpost.m4 $< > $*.pic - $(PIC) -s $*.pic > $*.mp -.m4.fig: - $(M4) $(CMLIBS) xfig.m4 $< > $*.pic - $(PIC) -x $*.pic > $*.fig - --include GNUmakefile.local - -all: $(TARGET) - -clean: - rm -f *~ - rm -f $(SRC:%.m4=%.pic) - -distclean: clean - -# use carefully!!! -dodistclean: distclean - rm -f $(SRC:%.m4=%.tex) - rm -f $(SRC:%.m4=%.eps) - rm -f $(SRC:%.m4=%.pdf) - rm -f $(SRC:%.m4=%.svg) - rm -f $(SRC:%.m4=%.mp) - rm -f $(SRC:%.m4=%.fig) - --include GNUmakefile.localdep diff --git a/graphics/circuit_macros/examples/Grounds.m4 b/graphics/circuit_macros/examples/Grounds.m4 new file mode 100644 index 0000000000..13b4730b80 --- /dev/null +++ b/graphics/circuit_macros/examples/Grounds.m4 @@ -0,0 +1,39 @@ +.PS +# `Grounds.m4' +cct_init + +sep = 0.65 +Ground: ground + move right sep +GT: ground(,T) + move right sep +GF: ground(,,F) + move right sep +GE: ground(,,E) + move right sep + +B: Here+(0,-0.5) ; { + "{\tt `ground'}" wid 32bp__ at (Ground,B) + "{\tt `ground'(,T)}" at (GT,B)+(0,7bp__) + "{\tt (,{,}F)}" at (GF,B) + "{\tt (,{,}E)}" at (GE,B)} + + +GS: ground(,,S) + move right sep +GS90: [ground(,,S,90) ] with .n at Here + move right sep from GS90.n +GQ: ground(,,Q) + move right sep +GL: ground(,,L) + move right sep +GP: ground(,,P) + +C: Here+(0,-0.5) + "{\tt (,{,}S)}" at (GS,C) + "{\tt (,{,}S,90)}" at (GS90,C) + "{\tt (,{,}Q)}" at (GQ,C) + "{\tt (,{,}L)}" at (GL,C) + "{\tt (,{,}P)}" at (GP,C) + +.PE diff --git a/graphics/circuit_macros/examples/Headers.m4 b/graphics/circuit_macros/examples/Headers.m4 new file mode 100644 index 0000000000..a4e1abce3b --- /dev/null +++ b/graphics/circuit_macros/examples/Headers.m4 @@ -0,0 +1,37 @@ +.PS +# Headers.m4 +log_init + + Header + {"\sl P1" at last [].P1 rjust + `"\tt Header"' at last [].s+(0,-10pt__) + "\sl P2" at last [].P2 rjust} + + Header(2,3,8mm__,10mm__) with .nw at last [].ne+(0.75,-0.05) + {"\sl P1" at last [].P1 rjust + `"\tt Header(2,3,8mm\_\_,10mm\_\_)"' at last [].s+(0,-10pt__) + "\sl P2" at last [].P2 ljust + "\sl P5" at last [].P5 rjust + "\sl P6" at last [].P6 ljust} + + left_ + Header(2,4,,,fill_(0.9)) with .sw at last [].se+(0.75,0) + {"\sl P1" at last [].P1 rjust_ + `"\tt left\_; Header(2,4,{,},fill\_(0.9))"' at last [].s+(0,-20pt__) + "\sl P8" at last [].P8 ljust_} + + down_ + Header(2,8) with .nw at last [].ne+(0.75,0) + {"\sl P1" at last [].P1 ljust + "\sl P2" at last [].P2 ljust + `"\tt down\_; Header(2,8)" ' at last [].s+(0,-10pt__) + "\sl P15" at last [].P15 rjust + "\sl P16" at last [].P16 rjust} + {thinlines_ + arrow <- right 0.15 from last [].PinP1.e + `"\sl PinP1"' ljust + arrow <- right 0.15 from last [].PinP2.e + `"\sl PinP2"' ljust + thicklines_ } + +.PE diff --git a/graphics/circuit_macros/examples/Heathkit.m4 b/graphics/circuit_macros/examples/Heathkit.m4 index 5cf7ca38d2..8d3ec5ad00 100644 --- a/graphics/circuit_macros/examples/Heathkit.m4 +++ b/graphics/circuit_macros/examples/Heathkit.m4 @@ -67,7 +67,7 @@ define Pad { P`$1': box fill_(1) "$1" } GRN2: line from P3.e to L2.end "GRN" above spline <-> from GRN2.end+(-g,0) up 2.5*g right 0.5*g then up 5*g left g \ then up 2.5*g right 0.5*g - box invis fill_(1) wid 3*g ht g "\unit{6}{\hbox{VAC}}" at L2.c-(2*g,0) + box invis fill_(1) wid 3*g ht g "\SI{6}{VAC}" at L2.c-(2*g,0) Pad(4) at P3-(0,3*g) line right_ 3*g from P4.e "BRN" above arrow down_ 2*g ht arrowht*2/3 @@ -96,7 +96,7 @@ define(`socket',`[ line right_ g; PL: dot line from BLKYEL.end right g then to Here+(0,-g) fuse(down_ 3*g,D) - rlabel(,"\unit{3}{\ampere} FUSE" rjust "SLOW BLOW") + rlabel(,"\SI{3}{\ampere} FUSE" rjust "SLOW BLOW") line to (Here.x,int(Here.y/g)*g-g); dot Sckt1: socket at Here+(5*g,0) line from Sckt1.w to (PL,Sckt1); A: dot; "A" rjust @@ -117,7 +117,7 @@ define(`plug',`[ w = dimen_*2/3; q = 0.25*w line from T2 to (T2,F.c)-(0,2*g) ]') PP: plug with .F.c at Sckt3+(0,-8*g) - "\unit{120}{\hbox{VAC}}" ljust "\unit{50/60}{\hertz}" ljust at PP.e + "\SI{120}{VAC}" ljust "\SI{50/60}{\hertz}" ljust at PP.e define(`pwrswitch',`[ right; circlerad = 1.75*g/2 C1: circle "1" @@ -154,7 +154,7 @@ define(`pwrswitch',`[ right; circlerad = 1.75*g/2 Pad(22) at Board.sw+(0,3*g) R514: resistor(right_ 8*g from P22.e); llabel(,"R514") - rlabel(,"\unit{680}{\kilo}") + rlabel(,"\SI{680}{\kilo{}}") dot; { ground } line to (P23,Here) then to P23.n @@ -168,7 +168,7 @@ define(`pwrswitch',`[ right; circlerad = 1.75*g/2 diode(from BE left_ d1h down_ d1h); llabel(,,"D509") BS: dot diode(left_ d1h up_ d1h); llabel(D507) - capacitor(down_ from BN to BS,C); llabel("C507",,\unit{.22}{}) + capacitor(down_ from BN to BS,C); llabel("C507",,\num{.22}) line from BE to P24.n line from BN to P2.w line from BS to P1.w @@ -192,17 +192,17 @@ define(`hbi_tr',`[ linewid = linewid*4/4.16 # Interior circuits line from P6.w left 2*g; ground line from P5.w left 4*g; dot - { C504: capacitor(down_ 4*g,C); llabel("C504",,\unit{.22}{}); ground(,T) } + { C504: capacitor(down_ 4*g,C); llabel("C504",,\num{.22}); ground(,T) } D504: diode(left_ 5*g); rlabel(,"D504"); dot { C505: capacitor(down_ to (Here,C504.end),C+L) - rlabel("C505",\unit{100}{},\unit{75}{\volt}); ground(,T) } + rlabel("C505",\num{100},\SI{75}{\volt}); ground(,T) } line right_ to (Here,P7); dot { D503: reversed(`diode',to (D504.start,Here)); llabel(,"D503") line to P7.w } d3 = lin_leng(L3) spline <-> from C504.start+(g/2,0) \ up d3/4 right g/4 then up d3*2/4 left g/2 then up d3/4 right g/4 - box invis fill_(1) ht g wid 4*g "\unit{100}{\hbox{VAC}}" \ + box invis fill_(1) ht g wid 4*g "\SI{100}{VAC}" \ at last spline.c+(-g,0) down_ @@ -211,11 +211,11 @@ define(`hbi_tr',`[ linewid = linewid*4/4.16 line from Q503.B.s to (Q503.B.x,Q503.E.y-4*g) R513: resistor(down_ 5*g); llabel(,"R513" ljust "1500"); ground(,T) line from P19.e to (BW-(2*g,0),P19) then up Q503.E.y-P19.y+2*g - R511: resistor(right_ 5*g); llabel(,"R511"); rlabel(,\unit{470}{}); + R511: resistor(right_ 5*g); llabel(,"R511"); rlabel(,\num{470}); line to (Q503.E,Here) then to Q503.E.n line from P20.e to (BW,P20) then up R513.end.y-P20.y resistor(up_ lin_leng(R513)) - rlabel(,"R512" ljust "5600" ljust "\unit{1}{\watt}") + rlabel(,"R512" ljust "5600" ljust "\SI{1}{\watt}") line to (Here,Q503.B) then to Q503.B.w "Q503" "S2091 HI TEMP" "CONTROL" at Q503.E+(1.5*g,4*g) D505: reversed(`diode',right_ from Q503.E.e to (C504,Q503.E)); llabel(,"D505") @@ -226,23 +226,23 @@ define(`hbi_tr',`[ linewid = linewid*4/4.16 { Pad(8) at (Here,Board.n) } { line to P8.s } R505: resistor(down_ to (Here,P6)) - llabel(,"R505" ljust "\unit{12}{\kilo}"); dot + llabel(,"R505" ljust "\SI{12}{\kilo{}}"); dot { C503: capacitor(down_ to (Here,C505.end),C+L) - rlabel(,"C503" rjust "100" rjust "\unit{70}{\volt}") + rlabel(,"C503" rjust "100" rjust "\SI{70}{\volt}") ground(,T) } right_ Q502: hbi_tr(,R) with .B at (R511.start,Here) line from Q502.C.e to R505.start line from Q502.B.e to R505.end R504: resistor(down_ from Q502.B.s to (Q502.B,C505.end)) - rlabel(,"R504" rjust "\unit{51}{\kilo}"); ground(,T) + rlabel(,"R504" rjust "\SI{51}{\kilo{}}"); ground(,T) "Q502" "TA7311" "REGULATOR" "CONTROL" at Q502.C+(-1*g,3.5*g) Pad(9) at (Q502.E,Board.n) line from Q502.E.n to P9.s Pad(10) at (Q502.B-(9*g,0),Board.n) R502: resistor(left_ from Q502.E.w to (P10,Q502.E)) - rlabel(,"R502"); llabel(,\unit{150}{}); dot + rlabel(,"R502"); llabel(,\num{150}); dot Pad(11) at (Board.w,Q502.E) Pad(14) at P11+(0,2.5*g) @@ -275,41 +275,41 @@ define(`hbi_tr',`[ linewid = linewid*4/4.16 { line to P10.s } { resistor(down_ 5*g) llabel(, - "R510" ljust "225" ljust "\unit{10}{\watt}" ljust "\unit{5}{\hbox{\%}}") + "R510" ljust "225" ljust "\SI{10}{\watt}" ljust "\SI{5}{\hbox{\%}}") line to Q504.C.n } R503:resistor(left_ 10*g); rlabel(,"R503") - { "290" "\unit{10}{\watt} \unit{5}{\hbox{\%}}" at last [].s+(0,-1.3*g) } + { "290" "\SI{10}{\watt} \SI{5}{\hbox{\%}}" at last [].s+(0,-1.3*g) } dot line to (Here,Q504.B) - resistor(right_ to Q504.B.w); llabel(,"R507"); rlabel(,\unit{100}{}) + resistor(right_ to Q504.B.w); llabel(,"R507"); rlabel(,\num{100}) line from P15.e to R503.end # "Q504" "40409" "REGULATOR" at Q504.C+(3.5*g,3*g) "Q504" "40409" "REGULATOR" at Q504.n+(-2*g,3*g) resistor(left_ from R502.end to (R503.end,P11)); rlabel(,"R501") - {"390" "\unit{5}{\watt} \unit{5}{\hbox{\%}}" at last [].s+(0,-1.3*g)} + {"390" "\SI{5}{\watt} \SI{5}{\hbox{\%}}" at last [].s+(0,-1.3*g)} line to P11.e resistor(right_ from P16.e to (R514.end,P16)); llabel(,"R506") - rlabel(,\unit{82}{}) + rlabel(,\num{82}) line down P16.y-P17.y; dot dot(at (R514.end,P11)) C501: capacitor(down_ 6*g,C+); llabel("C501") - {"100" ljust "\unit{30}{\volt}" ljust at last [].s+(0,-g) below } + {"100" ljust "\SI{30}{\volt}" ljust at last [].s+(0,-g) below } ground(,T) dot(at (Here.x+4*g,P11.y)) ZD501: reversed(`diode',down_ lin_leng(C501),Z); llabel("ZD501"); ground(,T) dot(at (R514.end,P15)) C502: capacitor(down_ 6*g,C+); llabel("C502") - {"100" ljust "\unit{30}{\volt}" ljust at last [].s+(0,-g) below } + {"100" ljust "\SI{30}{\volt}" ljust at last [].s+(0,-g) below } ground(,T) dot(at (Here.x+4*g,P15.y)) ZD502: reversed(`diode',down_ lin_leng(C502),Z); llabel("ZD502"); ground(,T) line from (C502,P17) to (C502,R508.start+(0,g)) C506: capacitor(down_ to (Here,R508.end),C+); llabel("C506") - {"100" ljust "\unit{30}{\volt}" ljust at last [].s+(0,-g) below } + {"100" ljust "\SI{30}{\volt}" ljust at last [].s+(0,-g) below } ground(,T) # Left-side boxes @@ -326,27 +326,27 @@ define(`hbi_tr',`[ linewid = linewid*4/4.16 line left 3*g from P17.w "RED" above line left 3*g from P18.w "WHT-" "RED" above box with .e at (Here,0.5 between P17 and P18) \ - "\shortstack[l]{\unit{12.7}{\volt} SOURCE\\ TO MULTIPLEX}" + "\shortstack[l]{\SI{12.7}{\volt} SOURCE\\ TO MULTIPLEX}" line left 3*g from P16.w "WHT" above box with .se at Here+(0,-g) \ - "\shortstack[l]{\unit{12}{\volt} SOURCE\\ TO FM TUNER\\ SOURCE SWITCH}" + "\shortstack[l]{\SI{12}{\volt} SOURCE\\ TO FM TUNER\\ SOURCE SWITCH}" line left 3*g from P15.w "ORG" above box ht 3*g with .e at Here \ - "\shortstack[l]{\unit{15}{\volt} SOURCE\\ TO FM TUNER}" + "\shortstack[l]{\SI{15}{\volt} SOURCE\\ TO FM TUNER}" line left 3*g from P13.w "BLU" above line left 3*g from P12.w " WHT-" "RED" line left 3*g from P11.w "RED" above box ht 6*g with .e at (Here,P12) \ - "\shortstack[l]{\unit{27}{\volt} SOURCE\\ TO CONTROL\\ PREAMP AND\\ PWR\ + "\shortstack[l]{\SI{27}{\volt} SOURCE\\ TO CONTROL\\ PREAMP AND\\ PWR\ AMPLIFIER}" line left 3*g from P14.w { "WHT-" "GRY-" "GRN" at last line.c+(0,2*g) } box with .se at Here+(0,-g) \ - "\shortstack[l]{\unit{50}{\volt} SOURCE\\ TO PHONO\\ PREAMP}" + "\shortstack[l]{\SI{50}{\volt} SOURCE\\ TO PHONO\\ PREAMP}" iflatex(`ifpsfrag(,`latexcommand(})')') diff --git a/graphics/circuit_macros/examples/Jack.m4 b/graphics/circuit_macros/examples/Jack.m4 new file mode 100644 index 0000000000..b9a005d279 --- /dev/null +++ b/graphics/circuit_macros/examples/Jack.m4 @@ -0,0 +1,78 @@ +.PS +# `Jack.m4' +cct_init + +P: [ + P1: plug + "\sl A" wid 0.1 at P1.A rjust + "\sl B" at P1.B rjust + "\sl TB" at P1.TB ljust above + "\sl TA" at P1.TA ljust below + P2: plug(,R) with .B at P1.A+(0.85,0) + "\sl A" wid 0.1 at P2.A rjust + "\sl B" at P2.B rjust +# P3: plug(L) with .A at P2.A+(1,0) +# "\sl A" wid 0.1 at P3.A ljust +# "\sl B" at P3.B ljust + P4: plug(,3) with .A at P2.B+(0.85,0) + "\sl A" at P4.A rjust + "\sl B" at P4.B rjust + "\sl C" at P4.C rjust + P5: plug(L,3R) with .A at P4.A+(1,0) + "\sl A" wid 0.1 at P5.A ljust + "\sl B" at P5.B ljust + "\sl C" at P5.C ljust + `"\tt plug"' below at P1.s+(0,-0.1) + `"\tt plug(,R)"' below at P2.s+(0,-0.1) +# `"\tt plug(L)"' below at P3.s+(0,-0.1) + `"\tt plug(,3)"' below at P4.s+(-0.1,-0.1) + `"\tt plug(L,3R)"' below at P5.s+(0.1,-0.1) +] + +L: [ right_ + J1: jack + thinlines_ + "\sl L" wid 0.1 rjust at J1.L + arrow <- right 0.1 from J1.F; "\sl F" ljust + arrow <- down 0.1 from J1.G then left 0.1 ; "\sl G" rjust + thicklines_ + J2:[K2: jack(,LMBS) #with .F at J1.F+(1.2,0) + thinlines_ + "\sl L" rjust at K2.L + arrow <- from K2.LM left 0.25; "\sl LM" wid 0.18 rjust + arrow <- from K2.LB left 0.25; "\sl LB" rjust + "\sl S" rjust at K2.S + thicklines_ ] with .K2.F at J1.F+(1.2,0) + J3: jack(L,RLS) with .F at J2.K2.F+(0.4,0) + thinlines_ + "\sl L" ljust at J3.L + "\sl S" ljust at J3.S + thicklines_ + J4: jack(L,RLBLMLMS) with .F at J3.F+(1.1,0) + thinlines_ + "\sl L1" ljust at J4.L1 + arrow <- right 0.3 from J4.LM1; "\sl LM1" ljust + "\sl L2" ljust at J4.L2 + arrow <- right 0.3 from J4.LM2; "\sl LM2" wid 0.2 ht 11pt__ ljust + "\sl S" ljust at J4.S + "\sl L" ljust at J4.L + arrow <- right 0.2 from J4.LB ; "\sl LB" ljust + right_ + J5: jack(,RSBSMLB) with .F at J4.F+(1.95,0) + thinlines_ + "\sl L" rjust at J5.L + "\sl S" rjust at J5.S + "\sl S1" rjust at J5.S1 + arrow <- left 0.3 from J5.SM1; "\sl SM1" rjust + spline 0.5 <- left 0.25 then left 0.1 down 0.05 from J5.LB; "\sl LB" rjust + spline 0.5 <- left 0.25 then left 0.1 up 0.05 from J5.SB; "\sl SB" rjust + thicklines_ + + `"\tt jack"' ht 0.15 below at J1.s+(0,-0.15) + `"\tt jack(,LMBS)"' below at (J2,last "") + `"\tt ..(L,RLS)"' below at (J3,last "") + `"\tt ..(L,RLBLMLMS)"' below at (J4,last "") + `"\tt ..(,RSBSMLB)"' below at (J5,last "") +] with .nw at P.sw #+ (0,0.1) + +.PE diff --git a/graphics/circuit_macros/examples/Logic.m4 b/graphics/circuit_macros/examples/Logic.m4 new file mode 100644 index 0000000000..d42e02768e --- /dev/null +++ b/graphics/circuit_macros/examples/Logic.m4 @@ -0,0 +1,62 @@ +.PS +# Logic.m4 +cct_init +ifdef(`AND_gate',,`include(liblog.m4)') +xgap = 0.6 +[ dmov = 0.4 +{ {AND_gate ; "{\tt AND\_gate}" ljust at last [].w + (xgap,0)} + move down dmov; right_ + {OR_gate ; "{\tt OR\_gate}" ljust at last [].w + (xgap,0)} + move down dmov; right_ + {BUFFER_gate ; "{\tt BUFFER\_gate}" ljust at last [].w + (xgap,0)} + move down dmov; right_ + {XOR_gate ; "{\tt XOR\_gate}" ljust at last [].w + (xgap,0)} + } + + move right_ 140pt__ +{ { NAND_gate; "{\tt NAND\_gate}" ljust at last [].w + (xgap,0) } + move down dmov; right_ + { Gate: NOR_gate(3) + "{\tt NOR\_gate(3)}" ljust at last [].w + (xgap,0) + thinlines_ + spline <- from Gate.Out right arrowht*2.0 \ + then up 0.15 then right 0.05 + "{\tt Out}" ljust + spline <- from Gate.N_Out down arrowht*2.0 \ + then right 0.1+arrowht*1.5+NOT_rad down 0.15-arrowht*2.0 + "{\tt N\_Out}" ljust + for_(1,3,1, + `arrow <- left 0.2 down 0.05 from Gate.In`'m4x + "{\tt In`'m4x\/}" rjust at Here+(0,(2-m4x)*0.02)') + } + thicklines_ + move down dmov; right_ + { NOT_gate ; "{\tt NOT\_gate}" ljust at last [].w + (xgap,0) } + move down dmov; right_ + {Gate: NXOR_gate(NPN); "{\tt NXOR\_gate(NPN)}" ljust at last [].w + (xgap,0) + for_(1,3,1, + `arrow <- left 0.2 up 0.05 from Gate.In`'m4x + "{\tt In`'m4x\/}" rjust at Here+(0,(2-m4x)*0.02)') + } +} + move right_ 140pt__ +{ {NAND_gate(,B) ; "{\tt NAND\_gate(,B)}" ljust at last [].w + (xgap,0)} + { line invis right 1.6 from last [].se then down 1} + move down dmov; right_ + move left N_diam*L_unit; right_ + {NOR_gate(3,NB) ; "{\tt NOR\_gate(3,NB)}" ljust at (last "",last []) } + move down dmov; right_ + {BOX_gate(PN,N,,,=1) + "{\tt BOX\_gate(PN,N,{,},=1)}" ljust at (last "",last []) + line left 0.15 from last [].In1 + line left 0.15-NOT_rad*2 from last [].In2 + line right 0.15 from last [].Out } + move down dmov; move right_ N_diam*L_unit + {BOX_gate(PP,N,,,=) + "{\tt BOX\_gate(PP,N,{,},=)}" ljust at (last "",last []) + line left 0.15 from last [].In1 + line left 0.15 from last [].In2 + line right 0.15 from last [].Out } +} +] +.PE diff --git a/graphics/circuit_macros/examples/MC.m4 b/graphics/circuit_macros/examples/MC.m4 index 8c8872b9c9..6e4eb88ea0 100644 --- a/graphics/circuit_macros/examples/MC.m4 +++ b/graphics/circuit_macros/examples/MC.m4 @@ -11,7 +11,7 @@ cct_init source(right_ dimen_,AC); llabel(,,sprintf("$v_{\char%g}$",96+i)) resistor(right_ dimen_ from Here-(backup/2,0)); if i==1 then { llabel(,R_i)} inductor(right_ dimen_ from Here-(backup,0),W); if i==1 then { llabel(,L_i)} - line right_ i*dh; b_current(sprintf("$i_{\char%g}$",96+i)); dot + line right_ i*dh; b_current(sprintf("\strut$i_{\char%g}$",96+i)); dot { line down (3-i)*dv; capacitor(down_ dimen_) if i==1 then { rlabel(,C_i) } if i==2 then { dot(ifgpic(at last line.end)) } \ @@ -26,7 +26,7 @@ cct_init if i==2 then { dot } else { line down (2-i)*dv } }} line from E right dh then down E.y-Here.y - arrow right dimen_/2 ; { sprintf("$i_{\char%g}\quad$",64+i) above } + arrow right dimen_/2 ; { sprintf("\strut$i_{\char%g}\quad$",64+i) above } resistor(right_ dimen_ from Here-(arrowht/2,0)); if i==1 then {llabel(,R_o)} inductor(right_ dimen_ from Here-(backup,0),W); if i==1 then {llabel(,L_o)} source(right_ dimen_,AC); llabel(sprintf("$v_{\char%g}$",64+i)) diff --git a/graphics/circuit_macros/examples/Makefile b/graphics/circuit_macros/examples/Makefile index e0404f8aee..92968df523 100644 --- a/graphics/circuit_macros/examples/Makefile +++ b/graphics/circuit_macros/examples/Makefile @@ -27,13 +27,14 @@ LIBDIR = .. # The dpic processor: PIC = dpic -p -PIC = dpic -p #PIC = $$HOME/dpic/bu*/p2c/ftp/dpic -p #PIC = /cygdrive/d/Dwight/dpic/p2c/Windows/dpic -p #PIC = dpic -1 -p #PIC = $$HOME/dpic/build/test/dpic -p +#PIC = $$HOME/dpic/dev/p2c/ftp/dpic -p #PIC = $$HOME/tmp/dpic -p #PIC = $$HOME/dpic/bison/dpic -p +#PIC = $$HOME/dpic/bdev/dpic -p CONFIGFILE = pstricks.m4 @@ -58,41 +59,33 @@ M4 = m4 DOC = examples PICS = \ - Adder.tex Alogix.tex ABlogix.tex AmpTable.tex Antennas.tex Audio.tex \ - Bip.tex Btree.tex Byte.tex Buttons.tex \ - CanLogic.tex CctTable.tex Conn.tex Counting.tex Crossbar.tex Crow.tex \ - Csource.tex \ - Decoder.tex Demultiplexer.tex Diodes.tex Drive.tex \ - Emarrows.tex Flow.tex Fuses.tex GrayCode.tex Grounds.tex \ - Headers.tex Heathkit.tex \ - I2L.tex Incleps.tex Jack.tex \ - Logic.tex Loglog.tex MC.tex Mixer.tex MotorControl.tex Multiplexer.tex \ - NLG.tex NPDT.tex Nport.tex \ - Opamp.tex Optoiso.tex Pconn.tex PushPull.tex \ - Quantum.tex Rectifiers.tex Relay.tex Rotbox.tex \ - Schottky.tex ShiftR.tex Sierpinski.tex Sixpole.tex Sources.tex SQUID.tex \ - Switches.tex \ - TTLnand.tex Tgate.tex Three.tex Timer.tex Ttree.tex Tubediags.tex \ - Variable.tex Windings.tex Xform.tex \ - control.tex csc.tex diamond.tex \ - ex00.tex ex01.tex ex02.tex ex03.tex ex04.tex ex05.tex ex06.tex \ - ex08.tex ex09.tex ex10.tex ex11.tex ex12.tex ex15.tex \ - ex16.tex ex17.tex ex18.tex ex21.tex exp.tex fet.tex \ - graysurf.tex lcct.tex pwrsupply.tex quick.tex \ - random.tex recycle.tex rose.tex \ - sfg.tex shapes.tex thyristor.tex ujt.tex worm.tex XOR.tex - -# From the doc directory: -MANFIGS = AmpTable Antennas Audio Bip CctTable Conn Demultiplexer Diodes \ - Emarrows Fuses \ - Grounds Headers Jack Logic Multiplexer NLG NPDT Nport Opamp Pconn \ - Relay ShiftR Sources Switches \ - Tgate Variable Windings Xform fet quick thyristor ujt + ABlogix.tex Adder.tex Alogix.tex AmpTable.tex Antennas.tex \ + AntiqueClock.tex Audio.tex Bip.tex Btree.tex Buttons.tex Byte.tex \ + CanLogic.tex CctTable.tex Conn.tex Contacts.tex Contact.tex control.tex \ + Counting.tex Crossbar.tex Crow.tex csc.tex Csource.tex Decoder.tex \ + Demultiplexer.tex diamond.tex Dini.tex Diodes.tex Drive.tex Emarrows.tex \ + ex00.tex ex01.tex ex02.tex ex03.tex ex04.tex ex05.tex ex06.tex ex08.tex \ + ex09.tex ex10.tex ex11.tex ex12.tex ex15.tex ex16.tex ex17.tex ex18.tex \ + ex21.tex exp.tex fet.tex Flow.tex Fuses.tex GrayCode.tex graysurf.tex \ + Grounds.tex Headers.tex Heathkit.tex I2L.tex Incleps.tex Jack.tex \ + lcct.tex Logic.tex Loglog.tex MC.tex Mixer.tex MotorControl.tex \ + Multiplexer.tex NLG.tex NPDT.tex Nport.tex Opamp.tex Optoiso.tex \ + Pconn.tex PushPull.tex pwrsupply.tex Quantum.tex quick.tex random.tex \ + Rectifiers.tex recycle.tex relaycoil.tex Relay.tex rose.tex Rotbox.tex \ + Schottky.tex sfg.tex shapes.tex ShiftR.tex Sierpinski.tex Sixpole.tex \ + Sources.tex SQUID.tex Switches.tex \ + Tgate.tex Three.tex thyristor.tex Timer.tex \ + TTLnand.tex Ttree.tex Tubediags.tex ujt.tex Variable.tex Windings.tex \ + worm.tex Xform.tex XOR.tex # Files that have to be processed twice: -BOXDIMS = ex09 Crow Incleps Loglog Opamp random Ttree Windings +BOXDIMS = ex09.tex Crow.tex Incleps.tex Loglog.tex Opamp.tex random.tex \ + Ttree.tex Windings.tex +BOXPICS = ex09.pic Crow.pic Incleps.pic Loglog.pic Opamp.pic random.pic \ + Ttree.pic Windings.pic DVIPSOPTS = -Ppdf -G0 -t letter +DVIPSOPTS = -G0 -t letter M4LIBS = $(CONFIGFILE) $(CUSTOM) DIMFILE = $(DOC).dim BS = tr '|' '\134' @@ -106,8 +99,10 @@ BS = tr '|' '\134' chmod 644 $*.ps .m4.tex: @if test -n "$(DIMFILE)" ; then touch $(DIMFILE) ; fi ; touch F_$*.dim - $(M4) $(M4LIBS) $(DIMFILE) F_$*.dim $*.m4 | sed -e '/^ *$$/d' > $*.pic - $(PIC) $*.pic > $*.tex + $(M4) $(M4LIBS) $(DIMFILE) F_$*.dim $*.m4 | sed -e '/^ *$$/d' \ + | $(PIC) > $*.tex +# $(M4) $(M4LIBS) $(DIMFILE) F_$*.dim $*.m4 | sed -e '/^ *$$/d' > $*.pic +# $(PIC) $*.pic > $*.tex # grep Production dpic.log >> newp.txt .m4.pic: @if test -n "$(DIMFILE)" ; then touch $(DIMFILE) ; fi @@ -132,7 +127,8 @@ BS = tr '|' '\134' latex F_$* .m4.eps: make $*.dvi - dvips -Ppdf F_$* -T128cm,28cm -o $*.ps + dvips F_$* -T128cm,28cm -o $*.ps +# dvips -Ppdf F_$* -T128cm,28cm -o $*.ps # Recent changes to PSTricks(?) have clashed with the use of TeXtoEPS # so use ps2epsi ps2epsi $*.ps $*.epsi @@ -177,16 +173,16 @@ BS = tr '|' '\134' $(DOC).pdf: clean pdfmode $(DOC).frp touch $(DOC).dim - for file in $(BOXDIMS) ; do \ - rm -f $$file.tex $$file.pic ; \ - make PIC="$(PIC) -g" CONFIGFILE=pgf.m4 DIMFILE=$(DOC).dim $${file}.tex ; \ - done + rm -f $(BOXDIMS) $(BOXPICS) + make PIC="dpic -g" CONFIGFILE=pgf.m4 DIMFILE=$(DOC).dim pics pdflatex $(DOC) - for file in $(BOXDIMS) ; do \ - rm -f $$file.tex $$file.pic ; \ - make PIC="$(PIC) -g" CONFIGFILE=pgf.m4 DIMFILE=$(DOC).dim $${file}.tex ; \ - done + rm -f $(BOXDIMS) $(BOXPICS) + make PIC="dpic -g" CONFIGFILE=pgf.m4 DIMFILE=$(DOC).dim pics pdflatex $(DOC) + optpdf $(DOC).pdf + +pics: $(PICS) + touch pics $(DOC).ps: psmode $(DOC).dvi @@ -196,30 +192,24 @@ psmode: pdfmode: printf "|usepackage{tikz}\n" | $(BS) > mode.tex -doclinks: - -for nm in $(MANFIGS) ; do cp $(LIBDIR)/doc/$$nm.m4 . ; done - touch doclinks - $(DOC).dvi: $(DOC).frs touch $(DOC).dim - for file in $(BOXDIMS) ; do \ - rm -f $$file.tex $$file.pic ; \ - make PIC="$(PIC)" DIMFILE=$(DOC).dim $${file}.tex ; done + for file in $(BOXDIMS) ; do rm -f $$file.tex $$file.pic ; done + make PIC="$(PIC)" CONFIGFILE=pstricks.m4 DIMFILE=$(DOC).dim pics latex $(DOC) - for file in $(BOXDIMS) ; do \ - rm -f $$file.tex $$file.pic ; \ - make PIC="$(PIC)" DIMFILE=$(DOC).dim $${file}.tex ; done + for file in $(BOXDIMS) ; do rm -f $$file.tex $$file.pic ; done + make PIC="$(PIC)" CONFIGFILE=pstricks.m4 DIMFILE=$(DOC).dim pics latex $(DOC) -$(DOC).frs: doclinks $(DOC).tex files.tex header.tex psmode - make $(PICS) +$(DOC).frs: $(DOC).tex files.tex header.tex psmode + make PIC="dpic -p" CONFIGFILE=pstricks.m4 DIMFILE=$(DOC).dim pics cp $(LIBDIR)/doc/Version.tex . latex $(DOC) - touch $(DOC).frs rm -f $(DOC).dvi + touch $(DOC).frs -$(DOC).frp: doclinks $(DOC).tex files.tex header.tex pdfmode - make CONFIGFILE=pgf.m4 PIC="$(PIC) -g" $(PICS) +$(DOC).frp: $(DOC).tex files.tex header.tex pdfmode + make PIC="dpic -g" CONFIGFILE=pgf.m4 DIMFILE=$(DOC).dim pics cp $(LIBDIR)/doc/Version.tex . pdflatex $(DOC) rm -f $(DOC).pdf @@ -247,7 +237,8 @@ clobber: clean rm -f *.ps -@for dir in mf mpost pdflatex xfig psfrag pgf svg dev test; \ do (if test -d $$dir ; then cd $$dir; make clobber; fi) ; done - rm -f *.warn quick.m4 + rm -f *.warn + rm -f examples.pdf rm -rf index.html html basenames *.png* dist zips htmlfiles svgfiles rm -rf $(TMP)/Cir* $(ECETMP)/Cir* $(ECEDIR) if test -f Incl.pdf ; then \ @@ -259,13 +250,12 @@ clobber: clean clean: @printf "\n examples clean:\n" - rm -f core examples.pdf boxdims.tar.gz + rm -f core boxdims.tar.gz pics rm -f *.dvi *.aux *.log *.toc *.blg *.eps *.tif *.epsi eps *-mfpic* rm -f fig*.tex $(PICS) *.roff *.int *.pic gpic.m4 test.tex xxx* *.fig rm -f *.dim *.bak *.frs *.frp $(RPICS) rotate.ps tst.ps *.bbl *-pics.ps rm -f *.tfm *[0-9]pk *.png *.1 *.gif - rm -f F_* Version.tex doclinks *stackdump *.ico quick.m4 - for nm in $(MANFIGS) ; do rm -f $$nm.* ; done + rm -f F_* Version.tex *stackdump *.ico rm -rf distfile distfile.tar.gz mode.tex @printf "\n" @if test -f distmakefile ; then make -f distmakefile clean ; fi diff --git a/graphics/circuit_macros/examples/Mixer.m4 b/graphics/circuit_macros/examples/Mixer.m4 index 32920a89cf..13291261c8 100644 --- a/graphics/circuit_macros/examples/Mixer.m4 +++ b/graphics/circuit_macros/examples/Mixer.m4 @@ -29,10 +29,10 @@ RF: dot(,,1); "sftxt(RF)" at RF.w rjust line from T1.L3.end left_ del; corner; ground(,,F) line down_ del/2 from T1.L1.start then right_ del - reversed(`capacitor',right_ dimen_,C); llabel(,\unit{0.1}{\micro\farad}) + reversed(`capacitor',right_ dimen_,C); llabel(,\SI{0.1}{\micro{}}\hbox{\sf F}) BT: dot(at Here) line up_ del/2 from T1.L2.end then right del - reversed(`capacitor',right_ dimen_,C); llabel(,\unit{0.1}{\micro\farad}) + reversed(`capacitor',right_ dimen_,C); llabel(,\SI{0.1}{\micro{}}\hbox{\sf F}) t = dimen_*7/8 line to (BT.x+4*t,Here.y) TT: dot @@ -55,46 +55,46 @@ Q2: mosfet(,,dMESDQuB,E) at (Q1,T2.s-(0,elen_-del)) line right_ del from T1.T then down_ T1.T.y-BT.y+del corner; left_ capacitor(to (T1.L3.end-(del,0),Here),C) - rlabel(,\unit{0.1}{\micro\farad}\hskip20pt) + rlabel(,\SI{0.1}{\micro{}}\hbox{\sf F}\hskip20pt) LOD: dot { line to (RF,Here); dot(,,1) move left_ 4bp__; "sftxt(local)" rjust "sftxt(oscillator)" rjust move left 40bp__ } line from T2.T left_ to (Q1.S,T2.T) T2T: dot - { capacitor(down_ to (Here,BT),C); rlabel(,\unit{0.1}{\micro\farad}) + { capacitor(down_ to (Here,BT),C); rlabel(,\SI{0.1}{\micro{}}\hbox{\sf F}) ground(,T,F) } { line from T2.L3.start right_ del; corner; ground(,,F) } Vt: dot(at (0.5 between BT and TT,Q1.Env.nw),,1) { "sftxt($+$V$_{\hbox{\scriptsize CC}}$)" at last [].e ljust } line to (Here,T2T) chop dotrad_ chop 0; dot { line to (Here,BT); Cv: capacitor(down_ 3/2*dimen_,C) - llabel(\unit{10}{\micro\farad}); G: dot; ground(,,F) } + llabel(\SI{10}{\micro{}}\hbox{\sf F}); G: dot; ground(,,F) } for s=-1 to 1 by 2 do {{ line right s*t; corner resistor(down_ to (Here,BT)) - if s<0 then { llabel(,\unit{5}{\kilo\ohm}) } \ - else { rlabel(,\unit{5}{\kilo\ohm}) + if s<0 then { llabel(,\SI{5}{\kilo\ohm}) } \ + else { rlabel(,\SI{5}{\kilo\ohm}) { dot(at last line.start); line to (TT,Here) resistor(right_ to (T2T,Here)) - llabel(,\unit{10}{\ohm}) } } + llabel(,\SI{10}{\ohm}) } } P: potentiometer(down_ Cv.len,,0.5,s*t ) with .Start at Here - if s<0 then { "sftxt(\unit{1}{\kilo\ohm})" at P. 1st [].ne ljust } \ - else { "sftxt(\unit{1}{\kilo\ohm})" at P. 1st [].sw rjust } + if s<0 then { "sftxt(1\`,'\si{\kilo\ohm})" at P. 1st [].ne ljust } \ + else { "sftxt(1\`,'\si{\kilo\ohm})" at P. 1st [].sw rjust } dot(at P.End) dot(at P.T1) { L: inductor(up_ to (Here,BT),L); - if s<0 then { "sftxt(\unit{100}{\micro\henry})" at last [].sw rjust } \ + if s<0 then { "sftxt(100\`,'\si{\micro{}}H)" at last [].sw rjust } \ else { line to TT - "sftxt(\unit{100}{\micro\henry})" \ + "sftxt(100\`,'\si{\micro{}}H)" \ at last [].ne ljust below } } capacitor(down_ to (Here,G),C) - if s<0 then { rlabel(,\unit{0.1}{\micro\farad}) } \ - else { llabel(,\unit{0.1}{\micro\farad}) } + if s<0 then { rlabel(,\SI{0.1}{\micro{}}\hbox{\sf F}) } \ + else { llabel(,\SI{0.1}{\micro{}}\hbox{\sf F}) } dot }} - resistor(down_ from LOD to (LOD,G)); llabel(,\unit{51}{\ohm}); corner + resistor(down_ from LOD to (LOD,G)); llabel(,\SI{51}{\ohm}); corner line to (Q2.S,Here) then to Q2.S ', diff --git a/graphics/circuit_macros/examples/MosfetElements.m4 b/graphics/circuit_macros/examples/MosfetElements.m4 deleted file mode 100644 index b8786e20e8..0000000000 --- a/graphics/circuit_macros/examples/MosfetElements.m4 +++ /dev/null @@ -1,78 +0,0 @@ -.PS -# MosfetElements.m4 -cct_init -s_init(MosfetElements) - - linewid = linewid*1.5 - linethick = 1.5 - -define(`mfgrid', - `tr_xy_init(,m4_U,m4R)define(`m4R',) - ltt = linethick; linethick = 0.4 - m4gdim = ifelse(`$1',,4,`($1)') - iflatex(`latexcommand(\color{lightgray})') - for x=-m4gdim to m4gdim do { - line color "lightgray" from tr_xy(x,0) to tr_xy(x,2*m4gdim) - if pmod(x,2)==0 then { sprintf("{\tiny %g}",x) at last line.start below }} - for y=0 to 2*m4gdim do { - line color "lightgray" from tr_xy(-m4gdim,y) to tr_xy(m4gdim,y) - if pmod(y,2)==0 then { sprintf("{\tiny %g}",y) at last line.start rjust }} - linethick = ltt - iflatex(`latexcommand(\color{black})') - Grid: box invis wid 2*m4gdim*m4_xyU ht 2*m4gdim*m4_xyU \ - with .sw at tr_xy(-m4gdim,0) -') -define(`gridnext',`with .Grid.w at last [].Grid.e + (m4_xyU*2,0)') -define(`gridbelow',`with .Grid.nw at `$1'.Grid.sw+(0,-linewid/2)') -define(`Gmosfet',`mfgrid; Q: mosfet(,,`$1') with .S at Grid.sw + (2*m4_xyU,0)') - -R1: [ Gmosfet(B); "B" at Q.Bl ljust ] - [ Gmosfet(D); "D" at Q.Dl ljust ] gridnext - [ Gmosfet(E); "E" at Q.Channel below ] gridnext - [ Gmosfet(F); "F" at Q.Channel below ] gridnext - [ Gmosfet(G); "G" at Q.Gl ljust ] gridnext - [ Gmosfet(H); "H" at Q.Hl ljust ] gridnext - [ Gmosfet(L); "L" at Q.Ll ] gridnext - [ Gmosfet(M); "M" at Q.Glh below ] gridnext - -R2:[ Gmosfet(uM); "uM" at Q.Gl ] gridbelow(R1) - [ Gmosfet(dM); "dM" at Q.Gl ] gridnext - [ Gmosfet(Pz); "Pz" at Grid.s ] gridnext - [ Gmosfet(Q); "Q" at Q.Ql above ] gridnext - [ Gmosfet(R); "R" at Q.Rl below ] gridnext - [ Gmosfet(S); "S" at Q.Sl ljust ] gridnext - [ Gmosfet(dT); "dT" at Q.Tl below ] gridnext - [ Gmosfet(X); "X" at Q.Xh above ] gridnext - -R3:[ Gmosfet(uM1) - "uM1" at Grid.s above - "G0" at Q.G0 above - "G1" at Q.G1 above ] gridbelow(R2) - [ Gmosfet(dM1) - "G0" at Q.G0 above - "G1" at Q.G1 above - "dM1" at Grid.s above ] gridnext - -# [ Q: mosfet -# {"S" at Q.S rjust} -# {"D" at Q.D ljust} -# {"G" at Q.G rjust} -# s_box(``mosfet'') at Q.s below] -# -# [ Q: mosfet(,,DSELuBQ) -# s_box(``mosfet(,,DSELuBQ)'') at Q.s below] with .n at last [].s + (0,-0.2) -# -# [ Q: mosfet(,,DSEMuBQ) -# s_box(``mosfet(,,DSEMuBQ)'') at Q.s below] with .n at last [].s + (0,-0.2) -# -# [ Q: mosfet(,,DSEdMuBQ) -# s_box(``mosfet(,,DSEdMuBQ)'') at Q.s below] with .n at last [].s + (0,-0.2) -# -# [ Q: mosfet(right dimen_,,DSELuBQN) -# {"S" at Q.S rjust} -# {"D" at Q.D ljust} -# {"G" at Q.G rjust} -# s_box(``mosfet(right dimen\_,,DSELuBQN)'') at Q.s below] \ -# with .n at last [].s + (0,-0.2) - -.PE diff --git a/graphics/circuit_macros/examples/Multiplexer.m4 b/graphics/circuit_macros/examples/Multiplexer.m4 new file mode 100644 index 0000000000..f4b72154a4 --- /dev/null +++ b/graphics/circuit_macros/examples/Multiplexer.m4 @@ -0,0 +1,43 @@ +.PS +# `Multiplexer.m4' +log_init + + ifmpost(`command "verbatimtex {\sf etex"', + `ifpostscript(, + `command "{\sf"')') + + right_ + + Mux(4,M1) + `"\tt Mux(4,M1)"' at last [].s below + `"\sl In0"' at last [].In0.end rjust wid 14bp__ + `"\sl In1"' at last [].In1.end rjust + `"\sl In2"' at last [].In2.end rjust + `"\sl In3"' at last [].In3.end rjust + `"\sl Out"' at last [].Out.end above + `"\sl Sel"' at last [].Sel.end ljust above + left_; Mux(4,,LNOE) with .c at last [].c+(0.9,0) + `"\tt left\_; Mux(4,{,}LNOE)"' at last [].s +(0,-20bp__) ht 10bp__ + `"\sl In0"' at last [].In0.end above + `"\sl NOE"' at last [].NOE.end +(4bp__,0) below + `"\sl Out"' at last [].Out.end below + `"\sl Sel"' at last [].Sel.end rjust below + right_; Mux(4,,OEBN2) with .c at last [].c+(1.4,0) + `"\tt Mux(4,{,}OEBN2)"' at last [].s below + `"\sl Sel0"' at last [].Sel0.end rjust + `"\sl Sel1"' at last [].Sel1.end ljust + `"\sl In0"' at last [].In0.end rjust + `"\sl In3"' at last [].In3.end rjust + `"\sl OE"' at last [].OE.end rjust + down_; Mux(8,,L3,,28*L_unit) with .c at last [].c+(1.7,0) + `"\tt down\_; Mux(8,{,}L3,{,}28*L\_unit)"' at last [].s below + `"\sl Sel0"' at last [].Sel0.end rjust + `"\sl Sel2"' at last [].Sel2.end rjust below + `"\sl In0"' at last [].In0.end rjust + `"\sl In7"' at last [].In7.end ljust wid 14bp__ + +ifmpost(`command "verbatimtex } etex"', +`ifpostscript(, +`command "}"')') + +.PE diff --git a/graphics/circuit_macros/examples/NLG.m4 b/graphics/circuit_macros/examples/NLG.m4 new file mode 100644 index 0000000000..2b9a39f86e --- /dev/null +++ b/graphics/circuit_macros/examples/NLG.m4 @@ -0,0 +1,19 @@ +.PS +# NLG.m4 +cct_init + + define(`nullor',`nport(`$1' + {`"${}0$"' at Box.w ljust + `"$\infty$"' at Box.e rjust},shift($@))') + +N: nullor +`"\tt nullor"' at last [].s+(0,-3pt__) below +G: gyrator with .sw at N.se+(0.5,0) +`"\tt gyrator"' at G.s+(0,-3pt__) below +I: gyrator(invis,,0,N) with .w at G.e+(0.5,0) +`"\tt gyrator(invis,{,}0,N)"' at I.s +V: gyrator(invis wid boxht,,0,NV) with .w at I.e+(1,0) +`"\tt gyrator(invis wid boxht,{,}0,NV)"' at V.s+(0,-3pt__) below + + move right 0.9 +.PE diff --git a/graphics/circuit_macros/examples/NPDT.m4 b/graphics/circuit_macros/examples/NPDT.m4 new file mode 100644 index 0000000000..17f4ef26b1 --- /dev/null +++ b/graphics/circuit_macros/examples/NPDT.m4 @@ -0,0 +1,35 @@ +.PS +# `NPDT.m4' +cct_init + linewid = linewid*1.2 + movewid = 1.0 + + NPDT + { `"\sl R" at last [].R.s below + "\sl T" at last [].T.s below + "\sl L" at last [].L.s below' } + { `"\tt NPDT"' at last [].s +(0,-0.22) } + up_; NPDT with .L at last[].R+(0.75,0) + { `"\sl R"' wid 8pt__ at last [].R.e ljust + "\sl T" at last [].T.e ljust + "\sl L" at last [].L.e ljust } + { `"\tt up\_; NPDT\strut"' at last [].s +(0.1,-0.15) } + right_ + NPDT(2) with .L1 at last [].L+(0.75,0) + { for_(1,2,1, + `"\sl R`'m4x" at last [].R`'m4x.e ljust + "\sl L`'m4x" wid 11pt__ at last [].L`'m4x.w rjust') } + { `"\tt NPDT(2)\strut"' at last [].s +(0,-0.15) } + move + NPDT(3,R) with .L3 at last [].R1+(0.75,0) + { for_(1,3,1, + `"\sl R`'m4x" at last [].R`'m4x.e ljust + "\sl L`'m4x" wid 11pt__ at last [].L`'m4x.w rjust') } + { `"\tt NPDT(3,R)\strut"' at last [].s below } + left_; NPDT(2,R) with .R1 at last [].R3+(0.75,0) + { for_(1,2,1, + `"\sl R`'m4x" at last [].R`'m4x.w rjust + "\sl L`'m4x" wid 11pt__ at last [].L`'m4x.e ljust') } + { `"\tt left\_; NPDT(2,R)\strut"' at last [].s +(0,-0.15) } + +.PE diff --git a/graphics/circuit_macros/examples/Nport.m4 b/graphics/circuit_macros/examples/Nport.m4 new file mode 100644 index 0000000000..37dbffeacc --- /dev/null +++ b/graphics/circuit_macros/examples/Nport.m4 @@ -0,0 +1,43 @@ +.PS +# `Nport.m4' +cct_init +textoffset = 5bp__ + +Twoport: nport + + "\sl W1a" above rjust at Twoport.W1a + "\sl W1b" below rjust at Twoport.W1b wid 0.25 + "\sl E1a" above ljust at Twoport.E1a + "\sl E1b" below ljust at Twoport.E1b + +Nport: nport(wid 2.0 ht 1 fill_(0.9) "n-port",1,2,3,4) \ + with .Box.w at Twoport.Box.e+(1.0,0) + + "\sl W1a" rjust at Nport.W1a + "\sl W1b" rjust at Nport.W1b + + "\sl E1a" ljust at Nport.E1a + "\sl E3b" ljust at Nport.E3b + + "\sl N1a" above at Nport.N1a + "\sl N1b$\;\;$" above at Nport.N1b + "\sl $\;\;$N2a" above at Nport.N2a + "\sl N2b" above at Nport.N2b + + "\sl S1a" below at Nport.S1a + "\sl S4b" below at Nport.S4b + + "$\cdots$" at 0.5<Nport.S1a,Nport.S4b>+(0,-0.10) + "$\vdots$" at 0.5<Nport.E1a,Nport.E3b>+(0.15,0.05) + +Nterm: nterm with .Box.w at Nport.Box.e+(1.0,0) + "\sl W1" rjust at Nterm.W1 + "\sl E1" ljust at Nterm.E1 + "\sl S1" below at Nterm.S1 + + `"\tt nport"' at Twoport.s+(0,-0.3) + `"\tt nport(wid 2.0 ht 1 fill\_(0.9) \"n-port\",1,2,3,4)"' \ + at Nport.s+(0,-0.25) + `"\tt nterm"' at Nterm.s+(0,-0.3) + +.PE diff --git a/graphics/circuit_macros/examples/Opamp.m4 b/graphics/circuit_macros/examples/Opamp.m4 new file mode 100644 index 0000000000..5bdb8ac208 --- /dev/null +++ b/graphics/circuit_macros/examples/Opamp.m4 @@ -0,0 +1,45 @@ +.PS +# Opamp.m4 +sinclude(FOpamp.dim) +sinclude(Circuit_macros.dim) +s_init(Opamp) +cct_init + + A: opamp + thinlines_ + s_box(`\tt opam{}p') at A.s-(0,0.35) + s_box(\tt Out) below at A.Out + spline <- from A.In1 left 0.1 then up 0.1 left 0.1 + s_box(\tt In1) rjust above + spline <- from A.In2 left 0.1 then down 0.1 left 0.1 + s_box(\tt In2) rjust below + arrow <- up 0.1 right 0.1 from A.N + s_box(\tt N) ljust above + arrow <- up 0.1 right 0.1 from A.E1 + s_box(\tt E1) ljust above + arrow <- up 0.1 right 0.1 from A.E + s_box(\tt E) ljust above + arrow <- down 0.1 right 0.1 from A.E2 + s_box(\tt E2) ljust below + arrow <- down 0.1 right 0.1 from A.S + s_box(\tt S) ljust below + arrow <- left 0.2 from A.W + s_box(\tt W) rjust + thicklines_ + Point_(15) + B: opamp(,,,,PR) with .sw at A.se+(0.65,0) + thinlines_ + s_box(`\tt Point\_(15); opam{}p(,{,},{,}PR)') at B.s-(0,0.20) + spline <- right arrowht up arrowht from B.V1 then right 0.1 + s_box(\tt V1) ljust + spline <- right arrowht down arrowht from B.V2 then right 0.1 + s_box(\tt V2) ljust + thicklines_ + Point_(90) + C: opamp with .sw at B.se+(1.05,0) + s_box(`\tt Point\_(90); opam{}p') at C.s-(0,0.35) + right_ + D: opamp(,,,,T) with .sw at C.se+(0.65,0) + s_box(`\tt opam{}p(,{,},{,}T)') at D.s-(0,0.20) + +.PE diff --git a/graphics/circuit_macros/examples/Pconn.m4 b/graphics/circuit_macros/examples/Pconn.m4 new file mode 100644 index 0000000000..fbda5cc2e7 --- /dev/null +++ b/graphics/circuit_macros/examples/Pconn.m4 @@ -0,0 +1,52 @@ +.PS +# `Pconn.m4' +cct_init + +P1: [ + C1: pconnex(,A) + thinlines_ + arrow <- left 0.2 from C1.H.w; `"\sl H"' rjust + thicklines_ + `"\tt pconnex(,A)"' at last [].s below + C2: pconnex(,AF) with .w at C1.e+(0.3,0) + thinlines_ + arrow <- right 0.2 up 0.1 from C2.H.e; `"\sl H"' ljust + N: box invis wid (C2.w.x-C1.e.x)/2 ht C1.N.ht \ + with .n at 0.5 between C1.ne and C2.nw "\sl N" + arrow from N.w to C1.N.e + arrow from N.e to C2.N.w + G: box invis wid N.wid ht N.ht with .n at (N,C1.N.s) "\sl G" + arrow from G.w to C1.G.e + arrow from G.e to C2.G.w + `"\tt (,AF)"' at last [].s below + C03: pconnex(,AC) with .w at C2.e+(0.2,0) + `"\tt (,AC)"' at last [].s below + C3: pconnex(,ACF) with .w at last [].e+(0.2,0) + `"\tt (,ACF)"' at last [].s below + + C5: pconnex(U,D) with .w at last [].e+(0.2,0) + `"\tt (U,D)"' at last [].s below + C6: pconnex(U,DF) with .w at last [].e+(0.2,0) + `"\tt (U,DF)"' at last [].s below + C7: pconnex(U,J) with .w at last [].e+(0.2,0) + `"\tt (U,J)"' at last [].s below + C8: pconnex(U,JF) with .w at last [].e+(0.2,0) + `"\tt (U,JF)"' at last [].s below + ] + +P2: [ + C4: pconnex(,P) + `"\tt (,P)"' at last [].s below + C11: pconnex(,PF) with .w at last [].e+(0.2,0) + `"\tt (,PF)"' at (C11,last "") below + C9: pconnex(,G) with .w at last [].e+(0.2,0) + `"\tt (,G)"' at last [].s below + C91: pconnex(,GF) with .w at last [].e+(0.2,0) + `"\tt (,GF)"' at last [].s below + C92: pconnex(L,GF) with .w at last [].e+(0.2,0) + `"\tt (L,GF)"' at last [].s below + C10: pconnex(,GC) with .w at last [].e + (0.2,0) + `"\tt (,GC)"' ht 11pt__ at last [].s below +] with .nw at P1.C1.sw + (0,-0.25) + +.PE diff --git a/graphics/circuit_macros/examples/PushPull.m4 b/graphics/circuit_macros/examples/PushPull.m4 index f071103307..24669faf29 100644 --- a/graphics/circuit_macros/examples/PushPull.m4 +++ b/graphics/circuit_macros/examples/PushPull.m4 @@ -30,38 +30,38 @@ define(`Xform21', { "3N200" at last [].n above } line from T1.L1.start to (T1.L1.start,Q2.G0) then to Q2.G0 - resistor(right_ dimen_ from T1.T); llabel(,\unit{330}{\ohm}); Tx:dot + resistor(right_ dimen_ from T1.T); llabel(,\SI{330}{\Omega}); Tx:dot { line right_ del*3/2; corner; ground(,,F) } dot(at (Tx,Q1.G0)) - capacitor(down_ to Tx,C); llabel(\unit{5.6}{\pico\farad}) + capacitor(down_ to Tx,C); llabel(\SI{5.6}{pF}) dot(at (Tx,Q2.G0)) - capacitor(up_ to Tx,C); rlabel(\unit{5.6}{\pico\farad}) + capacitor(up_ to Tx,C); rlabel(\SI{5.6}{pF}) for_(1,2,1, `dot(at Q`'m4x.S+(dimen_+del/2,0)) { resistor(down_ dimen_); G1:Here; { "$120$" at last [].nw rjust } - rlabel(,\ohm); dot; ground(,,F) } + rlabel(,\Omega\;); dot; ground(,,F) } line from Q`'m4x.S to (Here.x+dimen_*3/4,Q`'m4x.S.y); corner - capacitor(down_ to (Here,G1),C); rlabel(\raisebox{2pt}{1000},{\pico\farad}); + capacitor(down_ to (Here,G1),C); rlabel(\raisebox{2pt}{\num{1000}},\si{pF}); corner line left_ 2*dimen_*3/4; corner TG: dot(at (Here,Q`'m4x.S)) - capacitor(down_ to (Here,G1),C); rlabel(,,\unit{0.01}{\micro\farad}) + capacitor(down_ to (Here,G1),C); rlabel(,,\SI{0.01}{\micro F}) ') R: dot(at (Here.x+dimen_*2,(Q1.D.y+Q2.D.y)/2)) - dot(at (R,Q1.D)); capacitor(down_ to R,C); llabel(\unit{20}{\pico\farad}) - dot(at (R,Q2.D)); capacitor(up_ to R,C); llabel(\unit{20}{\pico\farad}) + dot(at (R,Q1.D)); capacitor(down_ to R,C); llabel(\SI{20}{pF}) + dot(at (R,Q2.D)); capacitor(up_ to R,C); llabel(\SI{20}{pF}) line right_ del*3/2 from R then down_ R.y-(Q1.S.y-dimen_); ground(,,F) Vc: dot(at (R+(dimen_,0),Q1.ne),,1); { "$+V_{\hbox{c}}$" rjust at Vc.w } dot(at (Vc,R)) - inductor(right_ dimen_,); llabel(,\unit{1}{\micro\henry}) + inductor(right_ dimen_,); llabel(,\SI{1}{\micro\henry}) down_ T2: Xform21 with .T at Here arrow from T2.L2 to T2.L3 chop -dimen_/4 line right_ del from T2.L3.start; corner - capacitor(down_ dimen_,C); llabel(\unit{1000}{\pico\farad}); ground(,T,F) + capacitor(down_ dimen_,C); llabel(\SI{1000}{pF}); ground(,T,F) line right_ 2*del from T2.L3.end Out: dot(,,1); { "IF" wid 12bp__ at Out.n above }; move right_ 0.3 @@ -70,38 +70,38 @@ define(`Xform21', line from Vc to (Vc,Q2.S) chop dotrad_/2 chop 0; dot { line right_ del*2; corner - capacitor(down_ dimen_,C); llabel(,,\unit{1000}{\pico\farad}); ground(,,F) } - reversed(`inductor',down_ dimen_,); rlabel(,\unit{1}{\micro\henry}) + capacitor(down_ dimen_,C); llabel(,,\SI{1000}{pF}); ground(,,F) } + reversed(`inductor',down_ dimen_,); rlabel(,\SI{1}{\micro\henry}) line down_ dimen_/2 TL: dot(at (Q1.G1.x-del/2,Here.y)) up_ Q3: bi_tr(,R,,E) with .C at (TG.x,TL.y-dimen_*2/3) - resistor(right_ from TL to (Q3.C,TL)); llabel(,\unit{82}{\kilo\ohm}) + resistor(right_ from TL to (Q3.C,TL)); llabel(,\SI{82}{\kilo\Omega}) line to (Vc,Here); dot - resistor(down_ to (Here,Q3.B)); rlabel(,\unit{8.2}{\kilo\ohm}); dot + resistor(down_ to (Here,Q3.B)); rlabel(,\SI{8.2}{\kilo\Omega}); dot dot(at Q3.B+(del,0)) line up_ (TL.y+Q3.C.y)/2 - Here.y+del/4 then left_ Here.x-TL.x - reversed(`capacitor',left_ dimen_,C); llabel(,\unit{1500}{\pico\farad}) + reversed(`capacitor',left_ dimen_,C); llabel(,\SI{1500}{pF}) Osc: dot(,,1); { "Osc" above at Osc.n } line from Q3.B to (Vc,Q3.B) line from Q3.C to (Q3.C,TL); dot dot(at Q3.C+(0,del/2)) - capacitor(left_ to (TL,Here),C); llabel(,\unit{1500}{\pico\farad}); dot + capacitor(left_ to (TL,Here),C); llabel(,\SI{1500}{pF}); dot line down_ del/2 from Q3.E; dot - { resistor(down_ dimen_*3/4); rlabel(,\unit{820}{\ohm}) + { resistor(down_ dimen_*3/4); rlabel(,\SI{820}{\Omega}) G: Here; ground(,T,F) } line right_ dimen_; corner - capacitor(down_ to (Here,G),C); llabel(,\unit{1000}{\pico\farad}) + capacitor(down_ to (Here,G),C); llabel(,\SI{1000}{pF}) ground(,T,F) ground(at (TL,G),T,F) - resistor(up_ dimen_); llabel(,\unit{12}{\kilo\ohm}) + resistor(up_ dimen_); llabel(,\SI{12}{\kilo\Omega}) line to (Here,Q1.G1) then to Q1.G1 line from Q2.G1 to (TL,Q2.G1); dot ground(at (Vc,G),T,F) - resistor(up_ dimen_); rlabel(,\unit{5.6}{\kilo\ohm}); line to (Here,Q3.B) + resistor(up_ dimen_); rlabel(,\SI{5.6}{\kilo\Omega}); line to (Here,Q3.B) iflatex(`ifpsfrag(,`latexcommand(})')') .PE diff --git a/graphics/circuit_macros/examples/Relay.m4 b/graphics/circuit_macros/examples/Relay.m4 new file mode 100644 index 0000000000..20c51ebb6a --- /dev/null +++ b/graphics/circuit_macros/examples/Relay.m4 @@ -0,0 +1,44 @@ +.PS +# Relay +cct_init + +skip = 1.1 + +R1:relay + {"\sl V1" wid 0.16 rjust at last [].V1 + "\sl V2" ljust at last [].V2 + "\sl P1" rjust at last [].P1-(dotrad_,0) + "\sl O1" ljust at last [].O1 + "\sl C1" ljust at last [].C1 } + S: `"\tt relay"' at last [].s+(0,-0.2) + +R5:relay(2,CTh) with .sw at last [].sw+(skip,0) + { for_(1,2,1,` + "\sl P`'m4x" rjust at last [].P`'m4x-(dotrad_,0) + "\sl C`'m4x" ljust at last [].C`'m4x ') } + `"\tt (2,CTh)"' at (last [],S) + +R4:relay(2,O) with .sw at last [].sw+(skip,0) + {for_(1,2,1,` + "\sl P1" rjust at last [].P1-(dotrad_,0) + "\sl O`'m4x" ljust at last [].O`'m4x ')} + `"\tt (2,O)"' at (last [],S) + +R3:relay(2,PIAX) with .sw at last [].sw+(skip,0) + {"\sl V1" rjust at last [].V1 + "\sl V2" rjust at last [].V2 + for_(1,2,1, + `"\sl P`'m4x" rjust at last [].P`'m4x-(dotrad_,0) + "\sl O`'m4x" ljust at last [].O`'m4x+(dotrad_,0) + "\sl C`'m4x" ljust at last [].C`'m4x+(dotrad_,-2pt__) ') } + `"\tt (2,PIAX)"' at (last [],S) + +R2:relay(2,R) with .sw at last [].sw+(skip,0) + {"\sl V1" rjust at last [].V1 + "\sl V2" ljust at last [].V2 + for_(1,2,1, + `"\sl P`'m4x" rjust at last [].P`'m4x-(dotrad_,0) + "\sl O`'m4x" ljust at last [].O`'m4x + "\sl C`'m4x" ljust at last [].C`'m4x ') } + `"\tt relay(2,R)"' at (last [],S) +.PE diff --git a/graphics/circuit_macros/examples/Schottky.m4 b/graphics/circuit_macros/examples/Schottky.m4 index 8cd98061e9..dea7da2b1a 100644 --- a/graphics/circuit_macros/examples/Schottky.m4 +++ b/graphics/circuit_macros/examples/Schottky.m4 @@ -8,7 +8,7 @@ E1: dot; line up_ tic Q1: bi_trans(,,dEBCBUS) with .E at Here; line left tic from Q1.B; B1: Here - resistor(up_ rlen from Q1.C); llabel(,\unit{3}{\kilo}) + resistor(up_ rlen from Q1.C); llabel(,\SI{3}{\kilo{}}) B2: dot; line right_ tic Q2: bi_trans(up_ dimen_,,dEBCBUS) with .B at Here line from Q2.E to (Q2.E,E1); dot @@ -16,7 +16,7 @@ Gnd: "GND" ljust at Here+(dimen_/2,0) dot(at Q2.C) { line to (Gnd,Here); "Y" ljust } line to (Q1.C,Here); dot - resistor(up_ rlen); llabel(,\unit{4}{\kilo}); B4: dot; line right_ tic; up_ + resistor(up_ rlen); llabel(,\SI{4}{\kilo{}}); B4: dot; line right_ tic; up_ Q4: bi_tr with .B at Here line from Q4.E to Q2.C line up_ tic from B4 @@ -26,17 +26,17 @@ Q5: bi_trans(,,dEBCBUS) with .E at Here; line left_ tic from Q5.B; B5: dot resistor(up_ rlen); llabel(,iflatex(120,"120")); dot Vcc: "Vcc" ljust at (Gnd,Here) dot(at (B5,Vcc)) - resistor(to (Here,Q5.C)); llabel(,\unit{8}{\kilo}) + resistor(to (Here,Q5.C)); llabel(,\SI{8}{\kilo{}}) diode(from (B4,Q2.C) to (B5,Q2.C),Z) line to (Here,Q5.C) diode(from B4 to (Here,B4),Z); dot line left_ tic; up_ Q3: bi_trans(,,dEBCBUS) with .C at Here; line left_ tic from Q3.B; B3: Here line from Q3.E to (Q3.E,B2); dot - dot(at (B1,Here)); resistor(down_ to (Here,Q1.C)); rlabel(,\unit{1.5}{\kilo}); line to B1 - resistor(down_ from B3 to (B3,B2)); rlabel(,\unit{12}{\kilo}); line to B2 + dot(at (B1,Here)); resistor(down_ to (Here,Q1.C)); rlabel(,\SI{1.5}{\kilo{}}); line to B1 + resistor(down_ from B3 to (B3,B2)); rlabel(,\SI{12}{\kilo{}}); line to B2 line from Vcc to (B3,Vcc); resistor(down_ to (Here,Q5.C)) - rlabel(,\unit{20}{\kilo}) + rlabel(,\SI{20}{\kilo{}}) line to B3 ground(at (Q3.C,Gnd),,F); dot diff --git a/graphics/circuit_macros/examples/ShiftR.m4 b/graphics/circuit_macros/examples/ShiftR.m4 new file mode 100644 index 0000000000..e7bf1f0c5c --- /dev/null +++ b/graphics/circuit_macros/examples/ShiftR.m4 @@ -0,0 +1,49 @@ +.PS +# ShiftR.m4 +log_init + + iflatex(`textoffset = 1bp__; ifpsfrag(,`latexcommand({\sf)') ') + +define(`lg_plen',3) + +define(`customFF',`FlipFlopX(wid 10*L_unit ht FF_ht*L_unit,, + :S;NE:CK;:R, N:PR, :Q;;ifelse(`$1',1,:lg_bartxt(Q)), N:CLR) ') + + F0: customFF(1) + + BUFFER_gate(,N) with .Out at F0.W1.end + line left 2*L_unit from last [].In1 + T: dot + reversed(`NOT_gate',left 10*L_unit) + Serial: "\scriptsize\shortstack[r]{SERIAL\\ INPUT}" rjust + line from T to (T,F0.W3) then to F0.W3.end + + NCLR: NOT_gate(right T.x-Serial.x from (Serial,F0.S1.end),N) + "$\overline{\hbox{\scriptsize CLEAR}}$" at NCLR.start rjust + + CLK: NOT_gate(right T.x-Serial.x from NCLR.start+(0,-BUF_ht*3/2*L_unit)) + "\scriptsize CLOCK" at CLK.start rjust + +for_(1,4,1,` + F`'m4x: customFF(eval(m4x!=4)) with .W3.end at F`'eval(m4x-1).E3.end + ') + + "\scriptsize OUTPUT" at F4.E1.end ljust + line from NCLR.end to F4.S1.end + + down_ +for_(0,4,1,` + line from F`'m4x.W2.end down F0.W2.y-CLK.y + ifelse(eval(m4x!=4),1,`dot',`line to CLK.end') + N`'m4x: NAND_gate with .Out at F`'m4x.N1.end + line up 2*L_unit from N`'m4x.In2 + { line up 6*L_unit from N`'m4x.In1 + "\scriptsize PR`'eval(4-m4x)" rjust } + ifelse(eval(m4x!=4),1, + `dot; dot(at F`'m4x.S1.end)', + `line to (Serial,Here) + "\scriptsize\shortstack[r]{PRESET\\ ENABLE}" wid 0.4 rjust ') + ') + + iflatex(ifpsfrag(,`latexcommand(})')) +.PE diff --git a/graphics/circuit_macros/examples/Sierpinski.m4 b/graphics/circuit_macros/examples/Sierpinski.m4 index 7fbf13bf15..08d7fab111 100644 --- a/graphics/circuit_macros/examples/Sierpinski.m4 +++ b/graphics/circuit_macros/examples/Sierpinski.m4 @@ -13,7 +13,7 @@ gen_init } } - r = 4 + r = 3 linethick = 0.2 #linethick = 1/2 /(1pt__) lw = linethick pt__ /2 @@ -35,20 +35,20 @@ gen_init define CayleyGraph { if $3 > 0 then { { line to Here+(cosd($2),sind($2))*($1) - exec sprintf("CayleyGraph(%g,%g,%g);",0.5*($1),$2,$3-1); } + exec sprintf("CayleyGraph(%g,%g,%g);", ($1)/2, $2, $3-1); } { line to Here+(cosd($2+90),sind($2+90))*($1) - exec sprintf("CayleyGraph(%g,%g,%g);",0.5*($1),$2+90,$3-1); } + exec sprintf("CayleyGraph(%g,%g,%g);", ($1)/2, $2+90, $3-1); } { line to Here+(cosd($2-90),sind($2-90))*($1) - exec sprintf("CayleyGraph(%g,%g,%g);",0.5*($1),$2-90,$3-1); } + exec sprintf("CayleyGraph(%g,%g,%g);", ($1)/2, $2-90, $3-1); } } } size = 2 depth = 6 for t=0 to 270 by 90 do { - line from (0,0) to (cosd(t),sind(t)); + line from (0,0) to (cosd(t),sind(t))*size/2; { exec sprintf("CayleyGraph(%g,%g,%g);",size/4,t,depth); } } - ] with .sw at last [].se+(-0.25,0) + ] scaled 3/4 with .sw at last [].se+(-0.25,0) .PE diff --git a/graphics/circuit_macros/examples/Sources.m4 b/graphics/circuit_macros/examples/Sources.m4 new file mode 100644 index 0000000000..a70cea1113 --- /dev/null +++ b/graphics/circuit_macros/examples/Sources.m4 @@ -0,0 +1,56 @@ +.PS +# `Sources.m4' +cct_init +divert(-1) + +divert(0)dnl + +iflatex(`ifpsfrag(,`latexcommand({\sf)') ') + +movewid = 2pt__ +moveht = 0.275 +define(`NL',`; move down $1; right_') +{ + {source ; move ; "`source'" ljust} NL + {source(,I) ; move ; "`source(,I)'" ljust} NL + {source(,i) ; move ; "`source(,i)'" ljust} NL + {source(,V) ; move ; "`source(,V)'" ljust} NL + {source(,v) ; move ; "`source(,v)'" ljust} NL + {source(,SC) ; move ; "`source(,SC)'" ljust} NL + {source(,AC); move ; "`source(,AC)'" ljust} NL + {source(,X) ; move ; "`source(,X)'" ljust} NL + {source(,F) ; move ; "`source(,F)'" ljust} NL + {source(,G) ; move ; "`source(,G)'" ljust} NL + {source(,Q) ; move ; "`source(,Q)'" ljust} +} + move right_ 2.0 +{ + {source(,,0.4) ; move ; "`source(,{,}0.4)'" ljust} NL(0.35) + {source(,P) ; move ; "`source(,P)'" ljust} NL + {source(,U) ; move ; "`source(,U)'" ljust} NL + {source(,H) ; move ; "`source(,H)'" ljust} NL + {source(,R) ; move ; "`source(,R)'" ljust} NL + {source(,S) ; move ; "`source(,S)'" ljust} NL + {source(,SCr) ; move ; "`source(,SCr)'" ljust} NL + {source(,T) ; move ; "`source(,T)'" ljust} NL + {source(,L) ; move ; "`source(,L)'" ljust} NL + {source(,B) ; move ; "`source(,B)'" ljust} NL(moveht*0.8) + {nullator ; move ; "`nullator'" ljust} NL(moveht*0.6) + {norator ; move ; "`norator'" ljust} +} + move right_ 2.0 + {source(,N) ; move ; "`source(,N)'" ljust} NL + {source(,"\rm mA");move; "`source(,\"mA\")'" ljust} NL(0.31) +# {source(,"mA");move; "`source(,'" ljust \ +# "`\enskip \"mA\")'" ljust} NL(0.31) + {consource ; move ; "`consource'" ljust} NL(0.32) + {consource(,I) ; move ; "`consource(,I)'" ljust} NL(0.32) + {consource(,i) ; move ; "`consource(,i)'" ljust} NL(0.32) + {source(,SE) ; move ; "`source(,SE)'" ljust} NL + {consource(,V) ; move ; "`consource(,V)'" ljust} NL(0.32) + {consource(,v) ; move ; "`consource(,v)'" ljust} NL(0.3) + {battery ; move ; "`battery'" ljust} NL + {battery(,3,R) ; move ; "`battery(,3,R)'" ljust} + +iflatex(`ifpsfrag(,`latexcommand(})')') +.PE diff --git a/graphics/circuit_macros/examples/Switches.m4 b/graphics/circuit_macros/examples/Switches.m4 new file mode 100644 index 0000000000..d8262be92d --- /dev/null +++ b/graphics/circuit_macros/examples/Switches.m4 @@ -0,0 +1,117 @@ +.PS +# Switches.m4 +cct_init + +movewid = 0.25 +# Row 1 + right_; { + lswitch; {S:"\tt ls{}witch" at last [].s+(0,-10bp__)} + move right_ + lswitch(,,O); {"\tt (,,O)" at (last [],S)} + move right_ + lswitch(,,C); {"\tt (,,C)" at (last [],S)} + move right_ + lswitch(,,DA); {"\tt (,,DA)" at (last [],S)} + move right_ + lswitch(,,dDO); {"\tt (,,dDO)" at (last [],S)} + move right_ + lswitch(,,uDC); {"\tt (,,uDC)" at (last [],S)} + } +# Row 2 + move down; right_; { + lswitch(,,K); {S:"\tt (,,K)" at last [].s+(0,-10bp__)} + move right_ + lswitch(,,KD); {"\tt (,,KD)" at (last [],S)} + move right_ + lswitch(,,KOD); {"\tt (,,KOD)" at (last [],S)} + move right_ + lswitch(,,KCD); {"\tt (,,KCD)" at (last [],S)} + move right_ + bswitch; {"\tt `bswitch'" at (last [],S)} + move right_ + bswitch(,,C); {"\tt (,,C)" at (last [],S)} + } +# Row 3 + move down; right_; { + D: dswitch(,,); {S: "\tt ds{}witch(,{},)" at last [].s+(0,-10bp__)} + thinlines_ + { spline <- from 0.25 along_(D) up 0.1 then up 0.05 left 0.1 + {"\tt W" rjust} + spline <- from D.c+(0,m4sc*2) up 0.1 then up 0.05 left 0.1 + {"\tt B" rjust }} + thicklines_ + move right_ + D: dswitch(,,WdBK); {"\tt (,,WdBK)" at (last [],S)+(0,-4bp__)} + thinlines_ + { spline <- from tr_xy(0,-2) up 0.1 then up 0.10 left 0.1 + {"\tt dB" rjust} + spline <- from tr_xy(4,-2) right 0.1 then right 0.05 up 0.15 + {"\tt K" above }} + thicklines_ + move right_ + dswitch(,,WBmdDK); {"\tt (,,WBmdDK)" at (last [],S)} + move right_ + dswitch(,,WBKTr); {"\tt (,,WBKTr)" at (last [],S)} + move right_ + dswitch(,,WdBL); {"\tt (,,WdBL)" at (last [],S+(0,-4bp__))} + move right_ + dswitch(,,WBCo); {"\tt (,,WBCo)" at (last [],S)} + } +# Row 4 + move down; right_; { + dswitch(,,WBKCo); {S: "\tt (,,WBKCo)" at last [].s+(0,-10bp__)} + move right_ + dswitch(,,WBCb); {"\tt (,,WBCb)" at (last [],S)} + move right_ + dswitch(,,WBDI); {"\tt (,,WBDI)" at (last [],S)} + move right_ + dswitch(,,WBSd); {"\tt (,,WBSd)" at (last [],S)} + move right_ + dswitch(,,WBFDI); {"\tt (,,WBFDI)" at (last [],S)} + move right_ + dswitch(,,WBFSd); {"\tt (,,WBFSd)" at (last [],S)} + } +# Row 5 + move down moveht*5/4; right_; { + dswitch(,,WBTh); {S: "\tt (,,WBTh)" at last [].s+(0,-10bp__)} + move right_ + dswitch(,,WBKC); {"\tt (,,WBKC)" at (last [],S)} + move right_ + dswitch(,,WBM); {"\tt (,,WBM)" at (last [],S)} + move right_ + dswitch(,,WBCO); {"\tt (,,WBCO)" at (last [],S)} + move right_ + dswitch(,,WBMP); {"\tt (,,WBMP)" at (last [],S)} + move right_ + dswitch(,,WBoKCP); {"\tt (,,WBoKCP)" at (last [],S)} + } +# Row 6 + move down moveht*5/4; right_; { + dswitch(,,WBCY); {S: "\tt (,,WBCY)" at last [].s+(0,-10bp__)} + move right_ + dswitch(,,WBCZ); {"\tt (,,WBCZ)" at (last [],S)} + move right_ + dswitch(,,WBCE); {"\tt (,,WBCE)" at (last [],S)} + move right_ + dswitch(,,WBRH); {"\tt (,,WBRH)" at (last [],S)} + move right_ + dswitch(,,WBRdH); {"\tt (,,WBRdH)" at (last [],S)} + move right_ + dswitch(,,WBRHH); {"\tt (,,WBRHH)" at (last [],S)} + } +# Row 7 + move down; right_; { + dswitch(,,WBMMR); {S: "\tt (,,WBMMR)" at last [].s+(0,-10bp__)} + move right_ + dswitch(,,WBMM); {"\tt (,,WBMM)" at (last [],S)} + move right_ + dswitch(,,WBMR); {"\tt (,,WBMR)" at (last [],S)} + move right_ + dswitch(,,WBEL); {"\tt (,,WBEL)" at (last [],S)} + move right_ + dswitch(,,WBLE); {"\tt (,,WBLE)" at (last [],S)} + move right_ + dswitch(,,WBoKEL); {"\tt (,,WBoKEL)" at (last [],S)} + } + +.PE diff --git a/graphics/circuit_macros/examples/Tgate.m4 b/graphics/circuit_macros/examples/Tgate.m4 new file mode 100644 index 0000000000..ff42cecb8d --- /dev/null +++ b/graphics/circuit_macros/examples/Tgate.m4 @@ -0,0 +1,50 @@ +.PS +# Tgate.m4 +cct_init +right_ + +[ { Q: tgate + "$A$" at Q.A rjust + "$B$" at Q.B ljust + "$G$" at Q.G ljust below + "$Gb$" at Q.Gb ljust above + `"\tt tgate"' at Q.A-(0.25,0) rjust + } + + move down_ linewid; right_ + { Q: tgate(,L) + "$A$" at Q.A rjust + "$B$" at Q.B ljust + "$G$" at Q.G ljust above + "$Gb$" at Q.Gb ljust below + `"\tt tgate(,L)"' wid 0.65 at Q.A-(0.25,0) rjust + } + ] + +[ { Q: tgate(,B) + "$A$" at Q.A rjust + "$B$" at Q.B ljust + "$G$" at Q.G ljust + `"\tt tgate(,B)"' at Q.G-(0,10bp__) below + } + ] with .Q.A at last [].Q.B+(0.5,linewid/2) + +[ { Q: ptrans + "$A$" at Q.A rjust + "$B$" at Q.B ljust + "$G$" at Q.G rjust below + "$Gb$" at Q.Gb rjust + `"\tt ptrans"' at Q.B+(0.25,0) ljust + } + + move down_ linewid; right_ + { Q: ptrans(,L) + "$A$" at Q.A rjust + "$B$" at Q.B ljust + "$G$" at Q.G ljust above + "$Gb$" at Q.Gb ljust below + `"\tt ptrans(,L)"' at Q.B+(0.25,0) ljust + } + ] with .Q.Gb at (last [].e.x+elen_/2+0.5,1st [].Q.Gb.y) + +.PE diff --git a/graphics/circuit_macros/examples/Timer.m4 b/graphics/circuit_macros/examples/Timer.m4 index 65fe897847..a5db32c800 100644 --- a/graphics/circuit_macros/examples/Timer.m4 +++ b/graphics/circuit_macros/examples/Timer.m4 @@ -16,15 +16,15 @@ define(`ic555',`[Chip: box ht boxwid wid boxwid "555" define(`elen_',`linewid') Vs: dot down_ - variable(`resistor(,E); llabel(,1`\,'\hbox{M})') - resistor(,E); llabel(,100`\,'\hbox{k}) - capacitor(,E); llabel(220`\,'\mu) + variable(`resistor(,E); llabel(,\SI{1}{M})') + resistor(,E); llabel(,\SI{100}{\kilo{}}) + capacitor(,E); llabel(\SI{220}{\micro{}}) Zero: dot dot(at Vs+(elen_*4/3,0)) - resistor(,E); llabel(,33`\,'\hbox{k}) + resistor(,E); llabel(,\SI{33}{\kilo{}}) line to (Here,Zero) chop 0 chop elen_ -C2: capacitor; llabel(0.1`\,'\mu) +C2: capacitor; llabel(\SI{0.1}{\micro{}}) dot IC1: ic555 with .P7 at C2.start + (elen_,0) @@ -40,11 +40,11 @@ R: dot B: buzzer(,,C) with .In3 at Here line from B.In1 to (R,B.In1) reversed(`diode',to (Here,Vs),LE); "red" at last line.c+(elen_/2,0) - resistor(down_ elen_ from R,E); llabel(,470) + resistor(down_ elen_ from R,E); llabel(,\num{470}) diode(to (Here,Zero),LE); {"green" at last line.c+(elen_*2/3,0)} line to Zero chop 0 chop -elen_ line up_ (Vs.y-Here.y)/3 - battery(up_ (Vs.y-Here.y)/3); rlabel(,,9`\,'\hbox{V}) + battery(up_ (Vs.y-Here.y)/3); rlabel(,,\SI{9}{V}) switch(to (Here,Vs),,D) line to (R,Vs) diff --git a/graphics/circuit_macros/examples/Tubediags.m4 b/graphics/circuit_macros/examples/Tubediags.m4 index f597ca1ae2..e07336e4e3 100644 --- a/graphics/circuit_macros/examples/Tubediags.m4 +++ b/graphics/circuit_macros/examples/Tubediags.m4 @@ -24,7 +24,7 @@ Pot1: potentiometer(down_ dimen_*2,5) with .Start at Here line from Pot1.End left_ dimen_ battery(up_ to Ld,2) Tg: dot(at Pot1.T1) - source(right_ dimen_ from Pot1.T1,"\scriptsize $\mu$A") + source(right_ dimen_ from Pot1.T1,"\scriptsize \si{\mu A}") line right_ dimen_/3 Tr: triode with .G1.w at Here line from Tr.K1.sw to (Tr.K1.sw,Pot1.End); dot @@ -49,18 +49,6 @@ T: Here # Circuit of 25 W amplifier (adapted from F. Langford-Smith, "Radiotron # Designer's Handbook," fourth edition, Harrison, NJ, Radio Corporation # of America, 1952) -command " -\newcommand{\Amp}{\hbox{$\,$A}} -\newcommand{\Henry}{\hbox{$\,$H}} -\newcommand{\Volt}{\hbox{$\,$V}} -\newcommand{\Watt}{\hbox{$\,$W}} -\newcommand{\mA}{\hbox{$\,$mA}} -\renewcommand{\kilo}{\hbox{$\,$k}} -\renewcommand{\mega}{\hbox{$\,$M}} -\renewcommand{\micro}{\hbox{$\,\mu$}} -\renewcommand{\nano}{\hbox{$\,$n}} -\renewcommand{\pico}{\hbox{$\,$p}} -" define(`OutputXformer',`[ pushdef(`dimen_',dimen_*1.5) S1: inductor(up_ dimen_*.4,L,3,M) @@ -95,7 +83,7 @@ define(`PowerXformer',`[ pushdef(`dimen_',dimen_*1.5) [ Toprail: Here #{"Toprail"} - resistor(down_ dimen_); rlabel(,100\kilo) + resistor(down_ dimen_); rlabel(,\SI{100}{\kilo{}}) V1P: dot #{"V1P" rjust} line down_ dimen_*3/4 @@ -109,17 +97,17 @@ Rail1: dot RP: Here arrow <- right from (Here,Rail1) to Rail1 dot(at last arrow) - resistor(up_ 2nd last arrow.y-Here.y); llabel(,22\kilo); dot + resistor(up_ 2nd last arrow.y-Here.y); llabel(,\SI{22}{\kilo{}}); dot { move left_ dimen_ }; "Pickup" at RP below - capacitor(right_ dimen_ from V1P,C,R); llabel(,0.05\micro) - resistor(down_ dimen_); rlabel(,470\kilo) + capacitor(right_ dimen_ from V1P,C,R); llabel(,\SI{0.05}{\micro{}}) + resistor(down_ dimen_); rlabel(,\SI{470}{\kilo{}}) V1o: dot #{ "V1o" at V1o rjust } - resistor(down_ (Here.y-Rail1.y)/2); rlabel(,22\kilo) + resistor(down_ (Here.y-Rail1.y)/2); rlabel(,\SI{22}{\kilo{}}) dot - { capacitor(down_ Here.y-Rail1.y,C); rlabel(,0.01\micro); dot } + { capacitor(down_ Here.y-Rail1.y,C); rlabel(,\SI{0.01}{\micro{}}); dot } line right_ dimen_/2 -R47: resistor(down_ to (Here,Rail1)); llabel(,,4.7\mega) +R47: resistor(down_ to (Here,Rail1)); llabel(,,\SI{4.7}{\mega{}}) line to Rail1 Pot1: potentiometer(down_ dimen_,,0.5,dimen_*2/3) \ @@ -130,64 +118,64 @@ Pot1: potentiometer(down_ dimen_,,0.5,dimen_*2/3) \ Rail2: dot ground V2: triode(,E) with .G1.w at Pot1.T1; "6SL7" at V2.ne above - resistor(from Rail2 right_ V2.K1.e.x-Rail2.x); rlabel(,22\kilo); dot - { capacitor(right_ dimen_,C,R); rlabel(,2\nano) + resistor(from Rail2 right_ V2.K1.e.x-Rail2.x); rlabel(,\SI{22}{\kilo{}}); dot + { capacitor(right_ dimen_,C,R); rlabel(,\SI{2}{\nano{}}) V2k: dot } #{ "V2k" at V2k above } { line down_ to (Here,Rail1) - variable(`resistor(right_ dimen_); rlabel(,1\mega);') + variable(`resistor(right_ dimen_); rlabel(,\SI{1}{\mega{}});') line up_ to V2k } line to V2.K1.se line from Toprail to (R47,Toprail); dot - { capacitor(down_ dimen_,C); rlabel(10\micro); ground(,T) } - R51k: resistor(right_ dimen_); rlabel(,51\kilo); dot - { capacitor(down_ dimen_,C); llabel(10\micro); ground(,T) } + { capacitor(down_ dimen_,C); rlabel(\SI{10}{\micro{}}); ground(,T) } + R51k: resistor(right_ dimen_); rlabel(,\SI{51}{\kilo{}}); dot + { capacitor(down_ dimen_,C); llabel(\SI{10}{\micro{}}); ground(,T) } dot(at (V2.P1.c,Here)) - resistor(down_ dimen_); llabel(,100\kilo) + resistor(down_ dimen_); llabel(,\SI{100}{\kilo{}}) V2p: dot line to V2.P1 V3: triode(,W) with .G1.w at (V2k+(dimen_,0),V2.G1) "$\;$6SL7" at V3.n below ljust - resistor(from V3.K1.sw to (V3.K1.sw,Rail1)); llabel(,1.5\kilo); dot; ground + resistor(from V3.K1.sw to (V3.K1.sw,Rail1)); llabel(,\SI{1.5}{\kilo{}}); dot; ground line left_ dimen_/2 resistor(up_ to (Here,V3.G1)); llabel(2.2); rlabel(\hbox{M}); dot { line to V3.G1.w } - line to (Here,V2p); capacitor(left_ to V2p,C,R); rlabel(,3\nano) + line to (Here,V2p); capacitor(left_ to V2p,C,R); rlabel(,\SI{3}{\nano{}}) dot(at (V3.P1.c,Toprail)); { line to R51k.end } - resistor(down_ dimen_); llabel(,51\kilo) + resistor(down_ dimen_); llabel(,\SI{51}{\kilo{}}) V3p: dot #{"V3p"} line down_ (Here.y-V3.n.y)/2 V3q: dot; { line to V3.P1.c } - capacitor(left_ dimen_*2/3,C); rlabel(,0.1\micro) + capacitor(left_ dimen_*2/3,C); rlabel(,\SI{0.1}{\micro{}}) line to (V2k,Here) - resistor(down_ to V2k); rlabel(0.1); llabel(\mega) + resistor(down_ to V2k); rlabel(0.1); llabel(\si{\mega{}}) #{"V2k" at V2k} V4: triode(,E) with .G1.w at (V3.G1.e+(dimen_*2,0),V3.G1) "6SL7" at V4.n above rjust - resistor(from V4.K1.se to (V4.K1.se,Rail1)); rlabel(,,1.5\kilo) + resistor(from V4.K1.se to (V4.K1.se,Rail1)); rlabel(,,\SI{1.5}{\kilo{}}) V4k: dot #{"V4k"} line left dimen_*3/4 V4k1: dot - { resistor(up_ V4.G1.y-Here.y); llabel(,,2.2\mega) + { resistor(up_ V4.G1.y-Here.y); llabel(,,\SI{2.2}{\mega{}}) V4G: dot } line from V3p right_ dimen_ - variable(`resistor(down_ to (Here,V4.G1)); llabel(100\kilo)') + variable(`resistor(down_ to (Here,V4.G1)); llabel(\SI{100}{\kilo{}})') V3o: dot - capacitor(right_ to V4G,C); llabel(,3\nano) + capacitor(right_ to V4G,C); llabel(,\SI{3}{\nano{}}) line to V4.G1.w - resistor(left_ from V4k1 to (V3o,V4k)); rlabel(,51\kilo); dot + resistor(left_ from V4k1 to (V3o,V4k)); rlabel(,\SI{51}{\kilo{}}); dot ground - capacitor(down_ from V3o to Here,C); llabel(,,500\pico) + capacitor(down_ from V3o to Here,C); llabel(,,\SI{500}{\pico{}}) line from V4.P1.c to (V4.P1.c,V3p); - resistor(up_ dimen_); llabel(,51\kilo); dot - resistor(left_ to (V3p,Here)); llabel(,10\kilo) + resistor(up_ dimen_); llabel(,\SI{51}{\kilo{}}); dot + resistor(left_ to (V3p,Here)); llabel(,\SI{10}{\kilo{}}) V5: triode(,N) with .G1.w at V4.G1.e+(2.25*dimen_,0) "6SL7" at V5.n above rjust @@ -196,26 +184,26 @@ V6: triode(,SR) with .G1.w at V5.G1.w-(0,dimen_*2.5) V4p: dot(at (V4.P1.c,V3p)) #{"V4p"} - line right_ dimen_*2/3; capacitor(right_ dimen_,C); llabel(,3\pico) + line right_ dimen_*2/3; capacitor(right_ dimen_,C); llabel(,\SI{3}{\pico{}}) line down_ to (Here,V5.G1) V5G: dot; { line to V5.G1.w } #{"V5G"} - resistor(down_ dimen_); rlabel(,2.2); llabel(,\mega); dot - resistor(right_ to (V5.K1.sw,Here)); llabel(,1\kilo) + resistor(down_ dimen_); rlabel(,\num{2.2}); llabel(,\si{\mega{}}); dot + resistor(right_ to (V5.K1.sw,Here)); llabel(,\SI{1}{\kilo{}}) V5K: dot #{"V5K"} line to V5.K1.sw line from V4k down_ V4k.y-V6.G1.y then right_ V5G.x-V4k.x - dimen_ - capacitor(right_ dimen_,C); rlabel(,3\pico) + capacitor(right_ dimen_,C); rlabel(,\SI{3}{\pico{}}) V6G: dot; { line to V6.G1.w } #{"V6G"} - resistor(up_ dimen_); llabel(,2.2); rlabel(,\mega); dot - resistor(right_ to (V6.K1.nw,Here)); llabel(,1\kilo) + resistor(up_ dimen_); llabel(,2.2); rlabel(,\si{\mega{}}); dot + resistor(right_ to (V6.K1.nw,Here)); llabel(,\SI{1}{\kilo{}}) V6K: dot #{"V6K"} line to V6.K1.nw - resistor(left_ dimen_*2/3 from (V6G,V6K)); rlabel(,1\kilo) dot; ground - line to (Here,V5K); resistor(right_ dimen_*2/3); llabel(,1\kilo) + resistor(left_ dimen_*2/3 from (V6G,V6K));rlabel(,\SI{1}{\kilo{}}) dot; ground + line to (Here,V5K); resistor(right_ dimen_*2/3); llabel(,\SI{1}{\kilo{}}) PV: dot(at (V4.e.x+dimen_/5,Toprail.y)) #{"PV"} @@ -223,15 +211,15 @@ PV: dot(at (V4.e.x+dimen_/5,Toprail.y)) Rail2: dot #{"Rail2" below} line from PV to (PV,Rail2); corner - { resistor(right_ to Rail2); llabel(,220\kilo) } + { resistor(right_ to Rail2); llabel(,\SI{220}{\kilo{}}) } move up_ dimen_*2/3; dot; line left_ dimen_/2 V6sw: dot #{"V6sw"} - capacitor(down_ dimen_*2/3,C); rlabel(,10\micro); ground(,T) + capacitor(down_ dimen_*2/3,C); rlabel(,\SI{10}{\micro{}}); ground(,T) V5P: dot(at (V6.P1.c,V4p)); { line to V5.P1.c } #{"V5P"} - resistor(to (Here,Toprail)); rlabel(,220\kilo) + resistor(to (Here,Toprail)); rlabel(,\SI{220}{\kilo{}}) line to (V4p,Here) V7: V_6L6G at (V3,Rail2+(0,-2*dimen_)); "6L6G" at V7.n above ljust @@ -248,21 +236,22 @@ L910: line from V9G to (V9G,V10.G2); dot line left_ dimen_/2 from V7.G1.w V7G: dot #{"V7G"} - resistor(down_ to 0.5 between Here and (Here,V10.G1)); rlabel(,220\kilo) + resistor(down_ to 0.5 between Here and (Here,V10.G1)) + rlabel(,\SI{220}{\kilo{}}) V7T: dot #{"V7T"} { line left_ dimen_/3; corner; ground } line from V8.G1.w to (V7G,V8.G1); dot - resistor(up_ to V7T); llabel(,220\kilo) + resistor(up_ to V7T); llabel(,\SI{220}{\kilo{}}) line from V9.K1.sw to V10.K1.nw line from V7.K1.sw to V8.K1.nw V7K: dot(at last line.c+(0,dimen_/8)) #{"V7K"} line left_ dimen_*2; dot - { capacitor(down_ dimen_/2,C); llabel(,50\micro); ground(,T) } + { capacitor(down_ dimen_/2,C); llabel(,\SI{50}{\micro{}}); ground(,T) } PP: potentiometer(left_ dimen_,,0.5,dimen_/2) with .Start at Here - rlabel(,50\ 10\Watt) + rlabel(,50\ \SI{10}{W}) corner(,at PP.T1); line left_ dimen_ then up_ dimen_/4 round(,tubethick) line thick tubethick up tubeplatelen/3 left tubeplatelen*2/9 @@ -294,16 +283,16 @@ V10P: dot line from V7.P1.c up_ V9P.y-V7.P1.y then to V9P resistor(right_ to (V5.e+(dimen_/4,0),Here)) - rlabel(,\shortstack{100\kilo\\2\Watt}) + rlabel(,\shortstack{\SI{100}{\kilo{}}\\ \SI{2}{W}}) Rt1: Here line to (Here,V6.e)+(0,dimen_/6); resistor(up_ dimen_) - llabel(,\shortstack{100\kilo\\2\Watt}) + llabel(,\shortstack{\SI{100}{\kilo{}}\\ \SI{2}{W}}) line to (Here,V5K) then to V5K line from V8.P1.c down_ V8.P1.y-V10P.y then to V10P resistor(right_ to (V6.e+(dimen_/2,0),Here)) - llabel(,\shortstack{100\kilo\\2\Watt}) + llabel(,\shortstack{\SI{100}{\kilo{}}\\ \SI{2}{W}}) resistor(up_ dimen_*3/2) - llabel(,\shortstack{100\kilo\\2\Watt}) + llabel(,\shortstack{\SI{100}{\kilo{}}\\ \SI{2}{W}}) line to (Here,V6K) then to V6K line from V9T to (V9.e+(dimen_*3/4,0),V9T) @@ -313,27 +302,27 @@ Xout: OutputXformer with .PT at Here line from Xout.PT left_ dimen_/4 XT: dot - resistor(from V6sw left_ dimen_); rlabel(,10\kilo) + resistor(from V6sw left_ dimen_); rlabel(,\SI{10}{\kilo{}}) XP: dot { line down_ dimen_; continue to (XT,Here) then to XT } - capacitor(right_ dimen_*5/4 from V5P,C); llabel(,0.1\micro) + capacitor(right_ dimen_*5/4 from V5P,C); llabel(,\SI{0.1}{\micro{}}) corner; line to (Here,Rail2)-(0,dimen_/2) continue to (V7nw,Here) then to V7nw line from V8sw down_ dimen_*5/8 continue to (Rail2,Here) then to (Rail2,V9.n) - capacitor(up_ dimen_/2,C,R); rlabel(,0.1\micro) + capacitor(up_ dimen_/2,C,R); rlabel(,\SI{0.1}{\micro{}}) line to Rail2 line from XP left_ dimen_*2; dot { dot(at Here+(dimen_,0)) { "290 V" at last [].n above } R100: resistor(down_ dimen_*2/3) - llabel(,\shortstack{100\kilo\\2\Watt}); dot; ground } - { capacitor(down_ dimen_*2/3,C); llabel(,40\micro); dot } - reversed(`inductor',left_ dimen_,L,,M); rlabel(,4\Henry\; 300\mA) + llabel(,\shortstack{\SI{100}{\kilo{}}\\ \SI{2}{W}}); dot; ground } + { capacitor(down_ dimen_*2/3,C); llabel(,\SI{40}{\micro{}}); dot } + reversed(`inductor',left_ dimen_,L,,M); rlabel(,\SI{4}{H}\; \SI{300}{\mA}) Filt: dot - { capacitor(down_ dimen_*2/3,C); llabel(,40\micro) + { capacitor(down_ dimen_*2/3,C); llabel(,\SI{40}{\micro{}}) line to R100.end } Pwr: [ @@ -363,8 +352,8 @@ PO: dot line right_ dimen_/8 then up last [].y - Here.y then to last [].w arrow from PXform.S3.start right_ dimen_ arrow from PXform.S3.end right_ dimen_ - "5\Volt" at PXform.S2 + (dimen_*3/4,0) - "6.3\Volt" at 0.5 between last arrow.end and 2nd last arrow.end ljust + "\SI{5}{V}" at PXform.S2 + (dimen_*3/4,0) + "\SI{6.3}{V}" at 0.5 between last arrow.end and 2nd last arrow.end ljust ] with .nw at (RP,Filt)+(0,dimen_/4) line from Pwr.PXform.S2.start to Pwr.PO + (dimen_*3/4,0); corner resistor(up_ to (Here,Filt)); rlabel(,\shortstack{V\\\hbox{adj}}); corner diff --git a/graphics/circuit_macros/examples/Variable.m4 b/graphics/circuit_macros/examples/Variable.m4 new file mode 100644 index 0000000000..6fac01e164 --- /dev/null +++ b/graphics/circuit_macros/examples/Variable.m4 @@ -0,0 +1,28 @@ +.PS +# `Variable.m4' +cct_init + +define(`elen_',dimen_); down_ +[ { variable(`capacitor') }; move right + { variable(`resistor',uN) }; move right + { variable(`capacitor(,C)') }; move right + { variable(`inductor') }; move right + { variable(`inductor(,W)') } + ] +[ + skp = 0.4 + hskip = linewid*0.5 + cskip = hskip +Orig: Here + { move right cskip+elen_+hskip + line invis right_ elen_ "\tt C"; move right_ hskip + line invis right_ elen_ "\tt S" } + Loopover_(`char', + `move down skp ifelse(char,A,*0.5) + { line invis right_ cskip "\tt char" + variable(`capacitor(,C)',char); move right_ hskip + variable(`capacitor(,C)',char`'C); move right_ hskip + variable(`capacitor(,C)',char`'S) }', + A,P,L,N) + ] with .w at last [].e+(0.4,0) +.PE diff --git a/graphics/circuit_macros/examples/Windings.m4 b/graphics/circuit_macros/examples/Windings.m4 new file mode 100644 index 0000000000..0c1ff4b87b --- /dev/null +++ b/graphics/circuit_macros/examples/Windings.m4 @@ -0,0 +1,113 @@ +.PS +cct_init +# Windings.m4 + ifelse(xtract(m4postprocessor,pstricks,pgf,mpost,pdf,postscript,svg),, + `print " + `pstricks, pgf, mpost, pdf, postscript, or svg required for Windings.m4'" + "`pstricks, pgf, mpost, pdf, postscript, or svg required for Windings.m4'"', +` + s_init(Windings) + ifdef(`Windings_1',,`sinclude(FWindings.dim)') + sinclude(Circuit_macros.dim) + ifdef(`Windings_1',,`sinclude(tst.dim)') + +define(`vlight',`rgbstring(0.9,0.9,0.9)') +define(`lightgray',`rgbstring(0.7,0.7,0.7)') + +[ W: winding ] + s_box(\tt w{}inding) at last [].s below + +[ winding(R) ] with .n at last "".s+(0,-0.1) + s_box(\tt w{}inding(R)) at last [].s below + +[ sk = 0.75 + d = 1.5*sk + p = 0.4*sk + w = 1*sk + +W: winding(L,d,p,4,w,vlight) + +thinlines_ + dimension_(from W.nw+(p/4,0) right p,0.1,s_box(\tt pitch\strut) above,W) + dimension_(from W.sw to W.nw,0.2,s_box(\tt diam),H) + dimension_(from W.e+(-p/2,-w/2) up w,-0.3,,s_ht) + s_box(\tt\hfill core wid) at W.e ljust + arrow <- up d-w+0.1 left d/10 from W.ne+(-p/2,-(d-w)) + s_box(\tt core color) at Here+(-0.2,0) ljust above +thicklines_ +] with .sw at last [].se+(0.25,0) + "\tt T1" at last [].W.T1 below + "\tt T2" at last [].W.T2 below + +[ +#`winding(L|R, diam, pitch, nturns, core wid, core color )' +boxwid = 0.3 +boxht = 0.4 + down_ +B1: box + winding(,boxwid*1.3,boxht/5,3,boxwid) at B1 + "Left pins" "cw" at B1.s+(0,-0.15) + for_(1,2,1,`"\sl\small T`'m4x" at last [].T`'m4x rjust') +B2: box at B1.e + (0.5,0) + winding(R,boxwid*1.3,boxht/5,3,boxwid) at B2 + "Left pins" "ccw" at B2.s+(0,-0.15) + for_(1,2,1,`"\sl\small T`'m4x" at last [].T`'m4x rjust') + up_ +B3: box at B1.s + (0,-0.55) + winding(,boxwid*1.3,boxht/5,3,boxwid) at B3 + "Right pins" "cw" at B3.s+(0,-0.15) + for_(1,2,1,`"\sl\small T`'m4x" at last [].T`'m4x ljust') +B4: box at (B2,B3) + winding(R,boxwid*1.3,boxht/5,3,boxwid) at B4 + "Right pins" "ccw" at B4.s+(0,-0.15) + for_(1,2,1,`"\sl\small T`'m4x" at last [].T`'m4x ljust') +] with .sw at last [].se+(0.1,0) + +[ + Q: box invis ht 1 wid 5/4 + g = Q.wid/12 + ironwid = Q.wid/4.5 + + line thick ironwid/(1bp__)+linethick from Q.n+(g/2-linethick/2 bp__,0) \ + to Q.ne then to Q.se then to Q.sw then to Q.nw \ + then to Q.n+(-g/2+linethick/2 bp__,0) + ifmpost(`rgbdraw(0.7,0.7,0.7,') + line thick ironwid/(1bp__)-linethick outlined lightgray \ + from Q.n+(g/2+linethick/2 bp__,0) \ + to Q.ne then to Q.se then to Q.sw then to Q.nw \ + then to Q.n+(-g/2-linethick/2 bp__,0) + ifmpost(`)') + +thinlines_ + dimension_(from Q.n+(-g/2,-ironwid/2) right g,-ironwid/4, + "$g$" below,1,2pt__) +thicklines_ + + down_ + P: winding(R,ironwid*5/4,ironwid/2,4,ironwid,lightgray) at Q.w + line left ironwid*2/3 from P.T1 + arrow right to P.T1 "$i_1$" above + line left ironwid*2/3 from P.T2 + gap(up_ to 2nd last line.end) + llabel(-,s_box($v_1$),+) + "$N_1$" at P.e ljust + + up_ + S: winding(L,ironwid*5/4,ironwid/2,4,ironwid,lightgray) at Q.e + line right ironwid*2/3 from S.T2 + arrow left to S.T2 "$i_2$" above + line right ironwid*2/3 from S.T1 + gap(up_ to 2nd last line.end) + rlabel(-,s_box($v_2$),+) + "$N_2$" at S.w rjust + + box dashed rad ironwid/4 wid Q.wid ht Q.ht at Q + arrow right arrowht from 0.5 between Q.n and Q.ne + "$\phi$" ljust at Here+(0,5pt__) + + move up ironwid/2 from Q.n + move down ironwid/2 from Q.s +] with .sw at last [].se+(0.15,0) + +') +.PE diff --git a/graphics/circuit_macros/examples/Xform.m4 b/graphics/circuit_macros/examples/Xform.m4 new file mode 100644 index 0000000000..697d87fafa --- /dev/null +++ b/graphics/circuit_macros/examples/Xform.m4 @@ -0,0 +1,39 @@ +.PS +# `Xform.m4' +cct_init + +divert(-1) +define(`trlabels', + `{ thinlines_ + ifelse(`$1',R, + `arrow from `$3'.P1 <- right 0.12 up 0.072 chop 1pt__ ; "\sl P1" ljust + arrow from `$3'.P2 <- right 0.12 down 0.072 chop 1pt__ ; "\sl P2" ljust + arrow from `$3'.TP <- right 0.12 chop 1pt__ ; "\sl TP" wid 0.2 ljust + arrow from `$3'.S1 <- left 0.12 up 0.072 chop 1pt__ ; "\sl S1" rjust + arrow from `$3'.S2 <- left 0.12 down 0.072 chop 1pt__ ; "\sl S2" rjust + arrow from `$3'.TS <- left 0.12 chop 1pt__ ; "\sl TS" rjust + ',` + arrow from `$3'.P1 <- left 0.12 up 0.072 chop 1pt__ ; "\sl P1" rjust + arrow from `$3'.P2 <- left 0.12 down 0.072 chop 1pt__ ; "\sl P2" rjust + arrow from `$3'.TP <- left 0.12 chop 1pt__ ; "\sl TP" wid 0.2 rjust + arrow from `$3'.S1 <- right 0.12 up 0.072 chop 1pt__ ; "\sl S1" ljust + arrow from `$3'.S2 <- right 0.12 down 0.072 chop 1pt__ ; "\sl S2" ljust + arrow from `$3'.TS <- right 0.12 chop 1pt__ ; "\sl TS" ljust + ') + `"'\tt `$2'`"' at `$3'.s+(0,-(`$4')) + thicklines_ } ') +divert(0)dnl + + down_ + T1: transformer + trlabels(,`transformer',T1,0.3) + T2: transformer(down_ 0.6,,2,P,8) with .w at T1.e+(1,0) + trlabels(,`...(down\_ 0.6,,2,P,8)',T2,0.3) + T3: transformer(,,8,WD12,4) with .w at T2.e+(1,0) + trlabels(,`...(,,8,WD12,4)',T3,0.21) + T4: transformer(,,9,AL) with .sw at T3.se+(1,0) + trlabels(,`...(,,9,AL)',T4,0.3) + T5: transformer(,R,8,AW) with .sw at T4.se+(1,0) + trlabels(R,`...(,R,8,AW)',T5,0.3) + +.PE diff --git a/graphics/circuit_macros/examples/darrows.m4 b/graphics/circuit_macros/examples/darrows.m4 deleted file mode 100644 index 07c5bfaf22..0000000000 --- a/graphics/circuit_macros/examples/darrows.m4 +++ /dev/null @@ -1,61 +0,0 @@ -.PS -# darrows.m4 -darrow_init - -[ -line thick 0.4 outlined "lightgray" down_ 6 -line thick 0.4 outlined "lightgray" down_ 6 from last line.start+(1,0) -move to 1st line.start -right_ - -linethick = 5 -define(`dlthick',0.25) -linewid = 1 - - { darrow() } -move down 0.4; right_; { darrow(,t) } -move down 0.4; right_; { darrow(,,t) } -move down 0.4; right_; { darrow(,t,t) } -move down 0.4; right_; { darrow(,,,,,,|-) } -move down 0.4; right_; { darrow(,,,,,,!-) } -move down 0.4; right_; { darrow(,,,,,,<-) } -move down 0.4; right_; { darrow(,t,,,,,<-) } -move down 0.4; right_; { darrow(,,t,,,,<-) } -move down 0.4; right_; { darrow(,t,t,,,,<-) } -move down 0.4; right_; { darrow(,,,,,,<-|) } -move down 0.4; right_; { darrow(,,,,,,<-!) } -move down 0.4; right_; { darrow(,,,,,,<->) } -move down 0.4; right_; { darrow(,t,,,,,<->) } -move down 0.4; right_; { darrow(,,t,,,,<->) } -move down 0.4; right_; { darrow(,t,t,,,,<->) } -] - -[ -line thick 0.4 outlined "lightgray" down_ 6 -line thick 0.4 outlined "lightgray" down_ 6 from last line.start+(1,0) -move to 1st line.start -right_ - -linethick = 5 -define(`dlthick',0.25) -linewid = 1 - - { Darrow() } -move down 0.4; right_; { Darrow(,S) } -move down 0.4; right_; { Darrow(,E) } -move down 0.4; right_; { Darrow(,S;E) } -move down 0.4; right_; { Darrow(,ends=|-) } -move down 0.4; right_; { Darrow(,ends=!-) } -move down 0.4; right_; { Darrow(,ends=<-) } -move down 0.4; right_; { Darrow(,S;ends=<-) } -move down 0.4; right_; { Darrow(,E;ends=<-) } -move down 0.4; right_; { Darrow(,S;E;ends=<-) } -move down 0.4; right_; { Darrow(,ends=<-|) } -move down 0.4; right_; { Darrow(,ends=<-!) } -move down 0.4; right_; { Darrow(,ends=<->) } -move down 0.4; right_; { Darrow(,S;ends=<->) } -move down 0.4; right_; { Darrow(,E;ends=<->) } -move down 0.4; right_; { Darrow(,S;E;ends=<->) } -] with .nw at last [].ne+(0.5,0) - -.PE diff --git a/graphics/circuit_macros/examples/ex01.m4 b/graphics/circuit_macros/examples/ex01.m4 index c72185cb00..a5bcef47ab 100644 --- a/graphics/circuit_macros/examples/ex01.m4 +++ b/graphics/circuit_macros/examples/ex01.m4 @@ -11,7 +11,7 @@ cct_init resistor; llabel(,47\`,'\Omega,); b_current(i_R\strut,above rjust) line right_ elen_/2 then down_ del - parallel_(`inductor(,W); llabel(,L,); b_current(i_L)', + parallel_(`inductor(,W); llabel(,L,); b_current(\>`'i_L)', `capacitor(,C); rlabel(+,v_C,-); llabel(,,\;C)') line to (Here,Vin.start) then to Vin.start diff --git a/graphics/circuit_macros/examples/ex02.m4 b/graphics/circuit_macros/examples/ex02.m4 index 2e5c2a6cb5..2265c1e317 100644 --- a/graphics/circuit_macros/examples/ex02.m4 +++ b/graphics/circuit_macros/examples/ex02.m4 @@ -1,6 +1,7 @@ .PS # ex02.m4 cct_init +linewid = linewid*4/5 [ [ diff --git a/graphics/circuit_macros/examples/ex07.m4 b/graphics/circuit_macros/examples/ex07.m4 deleted file mode 100644 index 56dfa7c198..0000000000 --- a/graphics/circuit_macros/examples/ex07.m4 +++ /dev/null @@ -1,69 +0,0 @@ -.PS -# ex07.m4 -gen_init -Barrel: box invis ht 0.4 wid 1.5 - up -Face: arc rad 2.6 from Barrel.e+(2.4,-1.7/2) to Barrel.e+(2.4,1.7/2) - - eps = 0.03 - arc ccw rad 2.6 from Face.start-(eps,0) to Face.end-(eps,0) \ - with .c at Face.c-(eps,0) - line from Barrel.nw to Barrel.ne then to Face.end - line from Barrel.sw to Barrel.se then to Face.start - arc cw from Barrel.sw to Barrel.nw rad Barrel.ht*1.2 - -Cathode: Barrel.w+(0.3,0) -Term: Barrel.w+(-0.25,0) - dcath = 0.13 - dan = 0.12 - - line from Cathode up dcath/2 left dcath/2 then to Term.x,Cathode.y+dcath/2 - dot - line from Cathode down dcath/2 left dcath/2 then to Term.x,Cathode.y-dcath/2 - dot - - hole = 0.06 -Hole: line invis up hole from Cathode+(0.5,-hole/2) - line from Hole.end up dan-hole/2 then to Term.x,Cathode.y+dan; dot - line from Hole.start down dan-hole/2 then to Term.x,Cathode.y-dan; dot - - platewid = 0.25 - platesep = 0.15 -Plates: box invis wid platewid ht platesep at Barrel.e+(-platewid/2,0) - line right platewid from Plates.nw - line right platewid from Plates.sw - line up 0.3 from Plates.n - line down 0.3 from Plates.s - -linethick_(1.4) -psset_(linecolor=gray) - - move to Cathode+(0.03,0) -Spot: 0.9<Face.start,Face.end> - arcto(Plates.c,Spot,(Plates.c.x-Cathode.x)*0.90) - line to Spot chop 0 chop -0.02 - -psset_(linecolor=black) -thinlines_ - - arrow <- from Cathode+(0.2,0.06) up 0.5 left 0.3 - "{\sl electron}" above "{\sl gun}" above - - arrow <- from Plates.nw+(0,0.06) up 0.5 left 0.3 - "{\sl deflection}" above "{\sl plates}" above - - arrow <- from 0.5<Plates.e,Spot>+(0,0.06) up 0.5 left 0.3 - "{\sl electron beam}" at Here+(-0.3,0) above - - spline <- from 1.015<Plates.e,Spot> right 0.1 up 0.1 then up 0.1 \ - then up 0.1 left 0.1 - "{\sl spot of light}sp_" rjust - - "{\sl vacuum}sp_" at 0.5<Face.start,Face.end>+(-0.4,0) rjust - - arrow <- from Face.start+(0.1,0.5) left 0.6*1.4 down 0.3*1.4 - "{\sl phosphor coating}sp_" rjust - - arrow <- from 0.2<Barrel.se,Face.start> left 0.6 down 0.3 - "{\sl glass enclosure (tube)}sp_" rjust -.PE diff --git a/graphics/circuit_macros/examples/ex18.m4 b/graphics/circuit_macros/examples/ex18.m4 index 201e8fee62..58fd24331a 100644 --- a/graphics/circuit_macros/examples/ex18.m4 +++ b/graphics/circuit_macros/examples/ex18.m4 @@ -27,7 +27,7 @@ define(`dimen_',dimen_*1.25) B: battery(up_ dimen_*2/3); rlabel(,V^o) move down dimen_/4 resistor(up_ dimen_); rlabel(,R,) - inductor(right_ elen_); b_current(i); rlabel(,L) + inductor(right_ elen_); b_current(i\mathstrut); rlabel(,L) { capacitor(down_ to (Here,B.start)); rlabel(,C); llabel(+,v,-) } line right_ dimen_ diode(down_ to (Here,B.start),T); b_current(h(v)) diff --git a/graphics/circuit_macros/examples/examples.pdf b/graphics/circuit_macros/examples/examples.pdf Binary files differindex fc47a4f9f9..2f31b4f030 100644 --- a/graphics/circuit_macros/examples/examples.pdf +++ b/graphics/circuit_macros/examples/examples.pdf diff --git a/graphics/circuit_macros/examples/examples.tex b/graphics/circuit_macros/examples/examples.tex index 6ab8d80315..0e483fa094 100644 --- a/graphics/circuit_macros/examples/examples.tex +++ b/graphics/circuit_macros/examples/examples.tex @@ -8,7 +8,7 @@ \usepackage{graphicx} \usepackage{boxdims} \usepackage{upgreek} -\usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits} +\usepackage{siunitx} \usepackage{amssymb} \input header @@ -25,10 +25,56 @@ using m4 circuit macros and others, and gpic or dpic. In some cases there are other or better m4 or pic constructs for producing the same drawings, but the source-file names are shown for reference. - Most of the examples can be processed using either dpic~-p or gpic~-t, - but the possibility of other postprocessing has meant that sometimes - the source is slightly more complicated than it would be if only - one workflow had been assumed. The most simplicity and elegance is - achieved by sticking to one pic interpreter and one postprocessor. + Most of the examples can be processed using either dpic~-p, dpic~-g, + or gpic~-t, but the possibility of other postprocessing has meant that + sometimes the source is slightly more complicated than it would be if + only one workflow had been assumed. The most simplicity and elegance + is achieved by sticking to one pic interpreter and one postprocessor. + + A few of these examples are also found in the manual + Circuit\_macros.pdf. There are other examples in the examples directory + that are not included in this document. To process {\sl file}.m4, type, for + example, "make {\sl file}.pdf." + +% The tables of elements attempt to illustrate each macro option +% at least once but the number of option combinations is huge so these +% examples are not exhaustive. + + A few of the examples following the circuits test some of the boundaries + of what macros and the pic language can do. \input files +\endinput + +Other examples currently: +Ball.m4 +birds.m4 +Blogix.m4 +brace.m4 +Ccurve.m4 +chaos.m4 +Chuck.m4 +clock.m4 +Cruller.m4 +debug2.m4 +Escher.m4 +Euro.m4 +Floor.m4 +IC10107.m4 +keyval.m4 +Koch.m4 +OpAmpFilter.m4 +Orbits.m4 +person.m4 +Planes.m4 +PPA.m4 +Resolver.m4 +rotatetext.m4 +rotellipse.m4 +Shaky.m4 +snake.m4 +SPM.m4 +squiggle.m4 +Wheat.m4 +Zcos.m4 + diff --git a/graphics/circuit_macros/examples/fet.m4 b/graphics/circuit_macros/examples/fet.m4 new file mode 100644 index 0000000000..08498ef83d --- /dev/null +++ b/graphics/circuit_macros/examples/fet.m4 @@ -0,0 +1,170 @@ +.PS +# `fet.m4' +cct_init + +dwn = 0.9 +dwn = 1.0 +rgt = 0.9 +textht = 0.1 + +dnl `IRF4905(linespec,R)' +define(`IRF4905', + `[ ifelse(`$1',,,`eleminit_(`$1')') + Q: mosfet(,`$2',dMdPzEDSQdB,) ifelse(`$1',,` + S: Q.tr_xy(-4,-2); line from Q.tr_xy(-2,-2) to S + D: Q.tr_xy( 4,-2); line from Q.tr_xy(2,-2) to D', + `with .Diode.c at last line.c + S: last line.start; D: last line.end; line from S to D ') + G: Q.G + circle rad 5*dimen_/10 at Q.tr_xy(0,1) ]') + +define(`rmove',0.75) +define(`dir_',`right_') + +Orig: Here +dir_ + { move left 0.2 } + {J: j_fet(right_ dimen_,,,E) + "{\tt j\_fet(right\_ dimen\_,{,},E)}" wid 1.75 \ + with .nw at last [].sw+(0.0,-0.25) + "$G$" at last [].G rjust above + "$S$" at last [].S rjust + "$D$" at last [].D ljust + } + + move right_ 0.9; dir_ + {j_fet(,,P,) + "{\tt j\_fet(,{,}P,)}" at last [].s+(0,-0.05) below + "$G$" at last [].G rjust + "$S$" at last [].S rjust + "$D$" at last [].D ljust + } + + move right_ 0.9; dir_ + {e_fet(,R,,) + "{\tt e\_fet(,R,{,})}" at last [].s+(0,-0.05) below + "$G$" at last [].G rjust + "$S$" at last [].S rjust + "$D$" at last [].D ljust + } + + {move down_ dwn; dir_ + e_fet(,,P) + "{\tt e\_fet(,{,}P)}" at last [].s+(0.1,-0.2) below} + + move right_ 0.9; dir_ + {d_fet(,,,) + "{\tt d\_fet(,{,},)}" at last [].s+(0,-0.05) below} + + {move down_ dwn; dir_ + d_fet(,,P) + "{\tt d\_fet(,{,}P)}" at last [].s+(0,-0.05) below} + + move right_ 0.9; dir_ + {e_fet(,,,S) + "{\tt e\_fet(,{,},S)}" at last [].s+(0,-0.05) below} + + {move down_ dwn; dir_ + e_fet(,,P,S) + "{\tt e\_fet(,{,}P,S)}" at last [].s+(0,-0.2) below} + + move right_ 0.9; dir_ + {d_fet(,,,S) + "{\tt d\_fet(,{,},S)}" at last [].s+(0,-0.2) below} + + {move down_ dwn; dir_ + d_fet(,,P,S) + "{\tt d\_fet(,{,}P,S)}" at last [].s+(0,-0.05) below} + + move right_ 0.9; dir_ + {c_fet(,,,) + "{\tt `c\_fet'(,{,},)}" at last [].s+(0,-0.05) below} + + {move down_ dwn; dir_ + c_fet(,,P) + "{\tt `c\_fet'(,{,}P)}" at last [].s+(0,-0.2) below} + +move down 1; right_ + [ + linewid = linewid*1.2 + + Q1: mosfet(,,dGSDF,) + {"\tt `mosfet'(,{,}dGSDF,)" wid 1.25 \ + with .nw at last [].sw+(-0.2,-0.05) + thinlines_ + arrow <- down .05 left .15 from (Q1.G.x,Q1.G.y-0.05) + "\tt dG" rjust + arrow <- down .10 left .30 from Q1.Channel.start+(.15,0) + "\tt F" rjust + arrow <- down .05 left .15 from (Q1.S.x,Q1.S.y+0.05) + "\tt S" rjust + arrow <- down .05 right .15 from (Q1.D.x,Q1.D.y+0.05) + "\tt D" ljust + thicklines_ } + + move right_ rmove + Q2: mosfet(,,uHSDF,) + {"\tt `$\ldots$'(,{,}uHSDF,)" at last [].s+(0,-0.15) below + thinlines_ + arrow <- down .05 left .15 from (Q2.G.x,Q2.G.y-0.05) + "\tt uH" rjust + thicklines_ } + + move right_ rmove + Q3: mosfet(,,dMEDSQuB,) + {"\tt `$\ldots$'(,{,}dMEDSQuB,)" at last [].s+(0,-0.05) below + thinlines_ + arrow <- down .05 left .15 from (Q3.G.x,Q3.G.y-0.05) + "\tt dM" rjust + arrow <- down .13 left .30 from Q3.Channel.start+(.12,0) + "\tt E" rjust + arrow <- down .05 left .10 from Q3.S+(.06,0) + "\tt Q" rjust + arrow <- down .08 right .24 from (Q3.B.x,Q3.B.y+0.175) + "\tt uB" ljust + thicklines_ } + + move right_ rmove + Q4: mosfet(,,uMEDSuB) + {`"{\tt $\ldots$(,{,}uMEDSuB)}"' at last [].s+(0,-0.15) below + "$G$" at last [].G rjust + "$S$" at last [].S rjust + "$D$" at last [].D ljust + "$B$" at last [].B below + } + + move right_ rmove + Q5: mosfet(,,ZSDFdT,) + {"\tt `$\ldots$'(,{,}ZSDFdT,)" at last [].s+(0,-0.05) below + thinlines_ + arrow <- down .08 left .08 from (Q5.S.x,Q5.S.y+0.12) + "\tt Z" rjust + arrow from last arrow.end to Q5.Channel.c+(0.05,0) + arrow from last arrow.start to (Q5.D.x,Q5.D.y+.05) + arrow <- down .08 right .24 from (Q5.G.x,Q5.G.y-0.02) + "\tt dT" ljust + thicklines_ } + + move right_ rmove + up_ + Q6: IRF4905 with .c at Here + {`"\tt IRF4905"' at Q6.s+(0,-0.15) below + "$G$" at Q6.G rjust + "$D$" at Q6.D ljust above + "$S$" at Q6.S ljust below + } + ] with .nw at J.sw+(0,-1.35) #Orig+(-0.26,-1.2) + + right_ + M1: mosfet(,,dBSDFQM1,E) with .nw at J.nw+(0,-dwn) + "$G0$" at M1.G0 above rjust + "$G1$" at M1.G1 above ljust + {"\tt `mosfet'(,{,}dBSDFQM1,E)" wid 1.45 \ + with .nw at last [].sw+(0,-0.23) } + M2: mosfet(,,dBSDFQuM1) with .nw at M1.ne+(0.5,0) + "$G0$" at M2.G0 above ljust + "$G1$" at M2.G1 above rjust + {"\tt ...(,{,}dBSDFQuM1)" wid 1.25 \ + with .n at last [].s+(0,-0.05) } + +.PE diff --git a/graphics/circuit_macros/examples/files.tex b/graphics/circuit_macros/examples/files.tex index 1912e9e249..3f14c21bdb 100644 --- a/graphics/circuit_macros/examples/files.tex +++ b/graphics/circuit_macros/examples/files.tex @@ -49,6 +49,12 @@ } \bfig{ + \centerline{\getpic{Grounds}} + \caption{Ground symbols + \src{Grounds.m4}.} + } + +\bfig{ \centerline{\getpic{Switches}} \caption{The switch macros; {\tt switch(,,,L|B|D)} is a wrapper for {\tt lswitch}, {\tt bswitch}, and {\tt dswitch} @@ -56,12 +62,6 @@ } \bfig{ - \centerline{\getpic{Grounds}} - \caption{Ground symbols - \src{Grounds.m4}.} - } - -\bfig{ \centerline{\getpic{Antennas}} \caption{Antenna symbols \src{Antennas.m4}.} @@ -92,8 +92,26 @@ } \bfig{ + \centerline{\getpic{Contact}} + \caption{A non-exhaustive sampling of {\tt contact} macro variations + \src{Contact.m4}.} + } + +\bfig{ + \centerline{\getpic{Contacts}} + \caption{The {\tt contacts} macro + \src{Contacts.m4}.} + } + +\bfig{ + \centerline{\getpic{relaycoil}} + \caption{The {\tt relaycoil} macro + \src{relaycoil.m4}.} + } + +\bfig{ \centerline{\getpic{Relay}} - \caption{The {\tt contact} and {\tt relay} macros + \caption{Some variants of the {\tt relay} macro \src{Relay.m4}.} } @@ -179,6 +197,12 @@ } \bfig{ + \centerline{\getpic{ex02}} + \caption{Elements at obtuse angles + \src{ex02.m4}.} + } + +\bfig{ {\small\centerline{\getpic{Optoiso}} } \caption{Optical isolator: a circuit with right or left orientation \src{Optoiso.m4}.} @@ -324,12 +348,6 @@ } \bfig{ - \centerline{\getpic{ex02}} - \caption{Elements at obtuse angles - \src{ex02.m4}.} - } - -\bfig{ \centerline{\getpic{Rectifiers}} \caption{Rectifier circuits and waveforms \src{Rectifiers.m4}.} @@ -461,6 +479,12 @@ } \bfig{ + \centerline{\getpic{control}} + \caption{Control-system block diagrams that do not require m4 + \src{control.m4}.} + } + +\bfig{ \centerline{\getpic{GrayCode}} \caption{Gray code 10-bit encoder disk pattern \src{GrayCode.m4}.} @@ -487,24 +511,9 @@ } \bfig{ - \centerline{\getpic{exp}} - \caption{Test of {\tt project} and other {\tt lib3D} - macros, showing the projection of a solid onto - the $y_1,z_1$ plane by sighting along the $x_1$ axis. - \src{exp.m4}.} - } - -\bfig{ - \centerline{\getpic{graysurf}} - \caption{Plotting surfaces using gray scales. A sort algorithm - determines plotting order - \src{graysurf.m4}.} - } - -\bfig{ - \centerline{\getpic{shapes}} - \caption{Basic shapes - \src{shapes.m4}.} + \centerline{\getpic{ex06}} + \caption{Crosshatching by {\tt for} loops + \src{ex06.m4}.} } \bfig{ @@ -532,18 +541,6 @@ } \bfig{ - \centerline{\getpic{control}} - \caption{Control-system block diagrams that do not require m4 - \src{control.m4}.} - } - -\bfig{ - \centerline{\getpic{ex06}} - \caption{Crosshatching by {\tt for} loops - \src{ex06.m4}.} - } - -\bfig{ \centerline{\getpic{Loglog}} \caption{A graph drawn using the pic language \src{Loglog.m4}.} @@ -556,6 +553,33 @@ } \bfig{ + \centerline{\getpic{exp}} + \caption{Test of {\tt project} and other {\tt lib3D} + macros, showing the projection of a solid onto + the $y_1,z_1$ plane by sighting along the $x_1$ axis. + \src{exp.m4}.} + } + +\bfig{ + \centerline{\getpic{graysurf}} + \caption{Plotting surfaces using gray scales. A sort algorithm + determines plotting order + \src{graysurf.m4}.} + } + +\bfig{ + \centerline{\getpic{shapes}} + \caption{Basic shapes + \src{shapes.m4}.} + } + +\bfig{ + \centerline{\getpic{AntiqueClock}} + \caption{An antique clock face + \src{AntiqueClock.m4}.} + } + +\bfig{ \centerline{\getpic{csc}} \caption{Conestoga Sailing Club (illustrating the filling of arbitrary shapes) @@ -594,6 +618,12 @@ } \bfig{ + \centerline{\getpic{Dini}} + \caption{Dini surface and an icosahedron + \src{Dini.m4}.} + } + +\bfig{ \centerline{\getpic{Sierpinski}} \caption{The Sierpinski triangle and a Cayley graph: tests of pic macro recursion diff --git a/graphics/circuit_macros/examples/mf/cct.mf b/graphics/circuit_macros/examples/mf/cct.mf index c3b66a5133..789ec556e1 100644 --- a/graphics/circuit_macros/examples/mf/cct.mf +++ b/graphics/circuit_macros/examples/mf/cct.mf @@ -1,5 +1,5 @@ % cct.mf, generated by Mfpic, v1.10 2012/12/03, -% from TeX source "font" on 2019/10/15 at 16:40 +% from TeX source "font" on 2020/02/16 at 21:34 numeric mfpicversion; mfpicversion := 110; if unknown mode: mode := localfont; fi if unknown mag: mag := 1000/1000; fi diff --git a/graphics/circuit_macros/examples/mode.tex b/graphics/circuit_macros/examples/mode.tex deleted file mode 100644 index f9aeb85384..0000000000 --- a/graphics/circuit_macros/examples/mode.tex +++ /dev/null @@ -1 +0,0 @@ -\usepackage{tikz} diff --git a/graphics/circuit_macros/examples/mpost/Makefile b/graphics/circuit_macros/examples/mpost/Makefile index 441d1d3ce2..3373e88305 100644 --- a/graphics/circuit_macros/examples/mpost/Makefile +++ b/graphics/circuit_macros/examples/mpost/Makefile @@ -20,15 +20,16 @@ MKDIM=printf '=boxdimfile{$(DIMFILE)}\n' DOC = examplesmpost FIGS = Adder.1 Alogix.1 ABlogix.1 Antennas.1 AmpTable.1 Audio.1 \ + AntiqueClock.1 \ Bip.1 Btree.1 Byte.1 Buttons.1 \ Counting.1 Crossbar.1 Crow.1 Csource.1 CanLogic.1 CctTable.1 Conn.1 \ - Decoder.1 Demultiplexer.1 Diodes.1 Drive.1 \ + Decoder.1 Demultiplexer.1 Dini.1 Diodes.1 Drive.1 \ Emarrows.1 Flow.1 Fuses.1 \ GrayCode.1 Grounds.1 Headers.1 Heathkit.1 I2L.1 Inclpdf.1 Jack.1 \ Logic.1 Loglog.1 MC.1 Mixer.1 MotorControl.1 Multiplexer.1 \ NLG.1 NPDT.1 Nport.1 \ Opamp.1 Optoiso.1 Pconn.1 PushPull.1 Quantum.1 \ - Rectifiers.1 Relay.1 Rotbox.1 \ + Rectifiers.1 Relay.1 relaycoil.1 Rotbox.1 \ Schottky.1 Sierpinski.1 ShiftR.1 Sixpole.1 Sources.1 SQUID.1 Switches.1 \ Tgate.1 Three.1 Timer.1 TTLnand.1 Ttree.1 Tubediags.1 \ Variable.1 Windings.1 Xform.1 \ diff --git a/graphics/circuit_macros/examples/odistmakefile b/graphics/circuit_macros/examples/odistmakefile new file mode 100644 index 0000000000..f6e26d9d37 --- /dev/null +++ b/graphics/circuit_macros/examples/odistmakefile @@ -0,0 +1,548 @@ +# Examples distmakefile. +# +# CTAN dist files: make -f distmakefile dist zips +# The CTAN file is tmp/Circuit_macros/Circuit_macrosN.N.tar.gz +# or +# make -f distmakefile distece +# The ECE file is ~/tmp/CMdistfiles.tar.gz +# Change the version number in doc/Version.tex + +# Circuit_macro directory, change this if necessary: +LIBDIR = $$HOME/lib +LIBDIR=/cygdrive/D/Dwight/lib +# LIBDIR = .. + +# The dpic processor: +PIC = dpic -p + +CONFIGFILE = pstricks.m4 + +# Uncomment for gpic. Use gpic or pic as applicable on your machine: +# PIC = gpic -t +# PIC = pic -t +# CONFIGFILE = gpic.m4 + +######################################################################### + +# M4 = m4 -B32000 +# M4 = m4 -I $(LIBDIR) +# Environment variable M4PATH has been set to the installation directory: +M4 = m4 + +######################################################################### + +THISFILE = distmakefile + +DOC = examples +PICS = \ + Adder.tex Alogix.tex ABlogix.tex AmpTable.tex Antennas.tex Audio.tex \ + Bip.tex Btree.tex Byte.tex Buttons.tex \ + CanLogic.tex CctTable.tex Conn.tex Counting.tex Crossbar.tex Crow.tex \ + Csource.tex \ + Decoder.tex Demultiplexer.tex Dini.tex Diodes.tex Drive.tex \ + Emarrows.tex Flow.tex Fuses.tex Grounds.tex \ + Headers.tex Heathkit.tex \ + I2L.tex Incleps.tex Jack.tex \ + Logic.tex Loglog.tex MC.tex Mixer.tex MotorControl.tex Multiplexer.tex \ + NLG.tex NPDT.tex Nport.tex \ + Opamp.tex Optoiso.tex \ + Pconn.tex PushPull.tex Quantum.tex \ + Rectifiers.tex Relay.tex Rotbox.tex \ + Schottky.tex ShiftR.tex Sierpinski.tex Sixpole.tex Sources.tex SQUID.tex \ + Switches.tex \ + TTLnand.tex Tgate.tex Three.tex Timer.tex Ttree.tex Tubediags.tex \ + Variable.tex Windings.tex Xform.tex \ + control.tex csc.tex diamond.tex \ + ex00.tex ex01.tex ex02.tex ex03.tex ex04.tex ex05.tex ex06.tex \ + ex08.tex ex09.tex ex10.tex ex11.tex ex12.tex ex15.tex \ + ex16.tex ex17.tex ex18.tex ex21.tex exp.tex fet.tex \ + graysurf.tex lcct.tex pwrsupply.tex quick.tex recycle.tex rose.tex \ + sfg.tex shapes.tex thyristor.tex ujt.tex worm.tex XOR.tex + +PICS = `make -f Makefile echopics` + +MANFIGS = AmpTable Antennas Audio Bip CctTable Conn Contact Contacts \ + Demultiplexer Diodes \ + Emarrows Fuses Grounds Headers Jack Logic Multiplexer NLG NPDT Nport Opamp \ + Pconn Relay ShiftR Sources Switches Tgate Variable Windings Xform fet quick \ + thyristor ujt + +# Files that have to be processed twice: +BOXDIMS = ex09 Crow Incleps Loglog Opamp Windings + +M4LIBS = $(CONFIGFILE) + +# Convert options +EPSOPTS = -trim +TIFOPTS = -trim +SVGOPTS = -trim +GIFOPTS = -trim +PNGOPTS = -trim -density 400 -scale 25% -quality 92 -alpha Remove + +DVIPSOPTS = -Ppdf -G0 -t ledger + +DIMFILE = $(DOC).dim +LTX = latex --shell-escape --quiet +BS = tr '|' '\134' + +.SUFFIXES: .ps .dvi .tex .m4 .pic .eps .png .pdf .svg .tif .gif +.dvi.ps: + dvips $(DVIPSOPTS) $* -o $*.ps + chmod 644 $*.ps +.m4.tex: + @if test -n "$(DIMFILE)" ; then touch $(DIMFILE) ; fi ; touch F_$*.dim + $(M4) $(M4LIBS) $(DIMFILE) F_$*.dim $*.m4 | sed -e '/^ *$$/d' > $*.pic + $(PIC) $*.pic > $*.tex +.m4.pic: + @if test -n "$(DIMFILE)" ; then touch $(DIMFILE) ; fi + $(M4) $(M4LIBS) $(DIMFILE) $*.m4 > $*.pic +.m4.dvi: + make -f $(THISFILE) $*.tex + printf "|documentclass[11pt]{article}\n\ +|usepackage{times,pstricks,boxdims,graphicx,pst-grad,pst-slpe}\n\ +|usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits}\n\ +|setlength{|textwidth}{28cm}|addtolength{|textheight}{28cm}\n\ +|setlength{|oddsidemargin}{0pt}|setlength{|evensidemargin}{0pt}\n\ +|setlength{|hoffset}{-1cm}\n\ +|newbox|graph\n\ +|pagestyle{empty}|thispagestyle{empty}\n\ +|begin{document}\n\ +|noindent|input{"$*".tex}\n\ +|end{document}\n" | $(BS) > F_$*.tex + latex --quiet F_$* + touch F_$*.dim $(DIMFILE) ; rm -f $*.tex $*.pic ; make -f $(THISFILE) $*.tex + latex --quiet F_$* + touch F_$*.dim $(DIMFILE) ; rm -f $*.tex $*.pic ; make -f $(THISFILE) $*.tex + latex --quiet F_$* +.m4.eps: + make -f $(THISFILE) $*.dvi + dvips -Ppdf F_$* -T128cm,28cm -o $*.ps +# Recent changes to PSTricks(?) have clashed with the use of TeXtoEPS +# so use ps2epsi + ps2epsi $*.ps $*.epsi + ( sed -e '/%%Pages:/d' -e '/BeginPreview/,$$d' -e '/%%HiResBoundingBox/d' \ + $*.epsi | tr '\015' '\012' ; sed -e '1,/EndPreview/d' $*.epsi ) | awk \ + '/^%%BoundingBox/{print $$1" "$$2" "$$3" "$$4+10" "$$5+15; next}; {print}' \ + >$*.eps +.m4.ps: + make -f $(THISFILE) $*.tex && mv $*.tex test.tex; latex --quiet tst + rm -f test.tex $*.pic + if test -f tst.dim ; then cp tst.dim F_$*.dim ; fi + make -f $(THISFILE) $*.tex && mv $*.tex test.tex; latex --quiet tst + dvips $(DVIPSOPTS) tst -o $*.ps + chmod 644 $*.ps +.m4.svg: + make -f $(THISFILE) $*.ps + convert $(SVGOPTS) $*.ps $*.svg +.m4.png: + make -f $(THISFILE) $*.ps +# make -f $(THISFILE) $*.eps +# convert $(PNGOPTS) $*.eps $*.png + convert $(PNGOPTS) $*.ps $*.png + @if test -f $*.png.0 ; then mv $*.png.0 $*.png ; fi +.m4.gif: + make -f $(THISFILE) $*.ps + convert $(GIFOPTS) $*.ps $*.gif +.m4.tif: + make -f $(THISFILE) $*.ps + convert $(TIFOPTS) $*.ps $*.tif + @if test -f $*.tif.0 ; then mv $*.tif.0 $*.tif ; fi +.m4.pdf: + touch F_$*.dim + $(M4) pgf.m4 F_$*.dim $*.m4 > $*.pic + dpic -g $*.pic > test.tex + sed -e '/^\\usepackage.*graphicx/s/^.*$$/\\usepackage{tikz}/' \ + -e '/pstricks/d' tst.tex > F_$*.tex + pdflatex --quiet F_$* + $(M4) pgf.m4 F_$*.dim $*.m4 > $*.pic + dpic -g $*.pic > test.tex + pdflatex --quiet F_$* + mv F_$*.pdf $*.pdf + +######################################################################### +default: + @printf "\n === making default\n" + @printf "\n\n\nUSAGE: make -f $(THISFILE) distece\n\n\n" + +$(DOC).ps: $(DOC).dvi + +doclinks: + @printf "\n === making doclinks\n" + -for nm in $(MANFIGS) ; do cp $(LIBDIR)/doc/$$nm.m4 . ; done + touch doclinks + +$(DOC).dvi: $(DOC).frs + @printf "\n === making $(DOC).dvi\n" + touch $(DOC).dim + for file in $(BOXDIMS) ; do \ + rm -f $$file.tex $$file.pic ; \ + make -f $(THISFILE) PIC="$(PIC)" DIMFILE=$(DOC).dim $${file}.tex ; done + latex --quiet $(DOC) + for file in $(BOXDIMS) ; do \ + rm -f $$file.tex $$file.pic ; \ + make -f $(THISFILE) PIC="$(PIC)" DIMFILE=$(DOC).dim $${file}.tex ; done + latex --quiet $(DOC) + +$(DOC).frs: $(DOC).tex files.tex header.tex + @printf "\n === making $(DOC).frs\n" + printf "|usepackage{pstricks,pst-grad}\n" | $(BS) > mode.tex + make -f $(THISFILE) $(PICS) + cp $(LIBDIR)/doc/Version.tex . + latex --quiet $(DOC) + touch $(DOC).frs + rm -f $(DOC).dvi + +tst: + make -f $(THISFILE) test.tex; latex --quiet tst; rm -f test.tex test.pic + make -f $(THISFILE) DIMFILE=tst.dim test.tex; latex --quiet tst + dvips $(DVIPSOPTS) tst -o tst.ps + +tst1: test.tex tst.tex + latex --quiet tst + dvips $(DVIPSOPTS) tst -o tst.ps + +gtst: + touch test.m4; make -f $(THISFILE) PIC="gpic -t" CONFIGFILE="" tst + +gtst1: + touch test.m4; make -f $(THISFILE) PIC="gpic -t" CONFIGFILE="" tst1 + +# Distribution files +NAME=Circuit_macros +TMP=/tmp + +# Makes test.m4, examples.pdf, Circuit_macros.pdf, +# Copying, examples/mf/cct.tfm examples/xfig +dist: + @printf "\n === making lib/examples/dist\n" + (cd .. ; make clobber ) + touch test.m4; cp test.m4 $(TMP)/test`date +%Y.%m.%d.%H:%M:%S` + find . -name test.m4 -exec rm -f {} \; + make -f $(THISFILE) test.m4 + (cd $(LIBDIR)/doc; make ) + make -f Makefile examples.pdf + ( cd $(LIBDIR); mv doc/Circuit_macros.pdf . ; \ + mv examples/examples.pdf . ; \ + make clobber; chmod 644 Circuit_macros.pdf examples.pdf; \ + cp -p Circuit_macros.pdf examples.pdf $(TMP) ; \ + mv Circuit_macros.pdf doc; mv examples.pdf examples ) +# touch reducedfiles +# make -f $(THISFILE) reducedfiles +# while test -f reducedfiles ; do sleep 1; done + make -f $(THISFILE) Copying + @printf "\n === making lib/examples/mf/cct.tfm\n" + (cd mf; make; chmod 644 cct.tfm; make clean) + @printf "\n === making lib/examples/xfig\n" + (cd xfig; make; make clean) + (cd $(LIBDIR)/doc; make clean ) + -dir=`pwd` ; if [ "`basename $$dir`" = "examples" ] ; then \ + rm -f $(LIBDIR)/examples.tar.gz ; fi + +EXCHANGE="`find C:/Program*\\(x86\\)/Adobe -name Acrobat.exe -print`" + +reducedfiles: + @printf "\n === making reducedfiles\n" + -( cd $(LIBDIR)/doc ; \ + printf "\n\n save Circuit_macros.pdf as reduced size pdf\n\n" ; \ + pwd | sed -e 's%/cygdrive/\(.\)%\1:%' -e 's%/%\\\\%g' \ + -e 's%^%$(EXCHANGE) %' -e 's%$$%\\\\Circuit_macros.pdf%' | sh ) && \ + ( printf "\n\n save examples.pdf as reduced size pdf\n\n" ; \ + pwd | sed -e 's%/cygdrive/\(.\)%\1:%' -e 's%/%\\\\%g' \ + -e 's%^%$(EXCHANGE) %' -e 's%$$%/examples.pdf%' | sh ) && \ + +$(TMP)/$(NAME): + if test -d $(TMP)/$(NAME); then rm -rf $(TMP)/$(NAME); \ + mkdir -p $(TMP)/$(NAME) ; fi + +COPIED = boxdims.sty CHANGES Copying darrow.m4 doc examples gpic.m4 \ + lib3D.m4 libcct.m4 libgen.m4 liblog.m4 Licence.txt \ + Makefile mfpic.m4 mpost.m4 pgf.m4 postscript.m4 psfrag.m4 pstricks.m4 \ + README svg.m4 xfig.m4 dpictools.pic + +REMOVED = examples/test examples/dev examples/pdflatex examples/xfig/info \ + examples/htmlsource examples/html examples/dist examples/zips \ + examples/SCP examples/distmakefile examples/boxdims \ + m4s \ + doc/expl-m4.pdf + +zipdir: $(TMP)/$(NAME) + @printf "\n === making lib/examples/zips\n" + Version=`sed -e 's/Version //' $(LIBDIR)/doc/Version.tex` ; \ + PCVersion=`echo $$Version | sed -e 's/\./_/g'` ; \ + rm -rf $(TMP)/$(NAME)$$Version ; mkdir $(TMP)/$(NAME)$$Version; \ + (cd $(LIBDIR); cp -r $(COPIED) $(TMP)/$(NAME)$$Version ); \ + (cd $(TMP)/$(NAME)$$Version ; rm -rf $(REMOVED) ) ; \ + (cd $(TMP)/$(NAME)$$Version ; find . -type f -exec chmod 644 {} \; ) ; \ + (cd $(TMP)/$(NAME)$$Version ; find . -type f -empty -exec rm {} \; ) ; \ + (cd $(TMP)/$(NAME)$$Version ; find . -type d -exec chmod 755 {} \; ) ; \ + (cd $(TMP)/$(NAME)$$Version ; chmod +x examples/mf/mftest ) ; \ + (cd $(TMP)/$(NAME)$$Version ; chmod +x examples/mpost/mptest ) ; \ + (cd $(LIBDIR)/doc; make clobber ) + touch zipdir + +zips: zipdir + Version=`sed -e 's/Version //' $(LIBDIR)/doc/Version.tex` ; \ + ( cd $(TMP); \ + tar cf - $(NAME)$$Version | gzip > $(NAME)$$Version.tar.gz ; \ + (cd $(NAME)$$Version; zip -r $(NAME) * ) ; \ + mv $(NAME)$$Version/$(NAME).zip $(NAME)$$PCVersion.zip ; \ + printf "\n$(TMP)/$(NAME)$$Version and\n" ; \ + printf "$(TMP)/$(NAME)$$Version.tar.gz created\n"; \ + printf "\n$(TMP)/$(NAME)$$PCVersion.zip created\n" ) +# touch zips + +test.m4: + @printf "\n === making test.m4\n" + printf \ +".PS\n\ +# Test.m4\n\ +cct_init\n\ +# Use this file to do a quick test of diagrams you are developing.\n\ +# Enter the drawing commands here and (if you have a \"make\" utility) type\n\ +# make tst\n\ +# Otherwise, to process a file called filename.m4, type one of\n\ +# make filename.ps\n\ +# make filename.eps\n\ +# make filename.pdf\n\ +# make filename.gif (requires ImageMagick convert)\n\ +# make filename.png (requires ImageMagick convert)\n\ +# make filename.tif (requires ImageMagick convert)\n\ +# To perform tests in a new folder, copy the Makefile, this file,\n\ +# and tst.tex (or your own equivalent) to that folder.\n\ +.PE\n" > test.m4 + +# For the git repository +GITDIR=$${HOME}/dpic/git/Circuit_macros +gitsync: dist zipdir + cd $(GITDIR) && rsync -a -v $(TMP)/Cir*[0-9]/* . + cp -p htmlsource/.gitignore $(GITDIR) + +distfile: + @printf "\n === making distfile\n" + rm -f dist zips htmlfiles + make -f $(THISFILE) dist zips htmlfiles + rm -rf distfile distfile.tar.gz; mkdir distfile + Version=`sed -e 's/Version //' $(LIBDIR)/doc/Version.tex` ; \ + cp -p $(TMP)/$(NAME)$$Version.tar.gz \ + $(TMP)/$(NAME)$$Version/README $(TMP)/$(NAME)$$Version/CHANGES \ + distfile ;\ + PCVersion=`echo $$Version | sed -e 's/\./_/g'` ; \ + cp -p $(TMP)/$(NAME)$$PCVersion.zip distfile ;\ + mkdir distfile/html + cp -rp html/* distfile/html + (cd distfile/html; mv index.html .. ; rm -f access.log *.pl ) +# tarlib distfile + +EPSFILES=${PICS:%.tex=%.eps} +# Make an encapsulated Postscript file for each example (requires pstricks) +eps: + @printf "\n === making eps\n" + make -f $(THISFILE) ${PICS:%.tex=%.eps} + +Copying: $(LIBDIR)/doc/Version.tex + @printf "\n === making Copying\n" + sed -e \ + "s%Version *[0-9.]*,%`cat $(LIBDIR)/doc/Version.tex`,%" $(LIBDIR)/Copying \ + > xxx + sed -e "s%opyright (c) [^ ][^ ]* J%opyright (c) `date '+%Y'` J%" xxx \ + > $(LIBDIR)/Copying ; rm -f xxx +# for file in `find $(LIBDIR) -name Copying -print` ; do \ +# if test ! "$$file" = "$(LIBDIR)/Copying" ; then \ +# cp $(LIBDIR)/Copying $$file; fi ; done + (cd $(LIBDIR) ; for file in `grep -l 'Version [0-9][\.0-9]*,' *` ; do \ + if test ! \( "$$file" = "Copying" -o "$$file" = "CHANGES" \) ; then \ + ( sed -e '/opyright (c)/,$$d' $$file ; cat Copying ; echo "" ; \ + sed -e '1,/opyright (c)/d' $$file | sed -e '1,/^ *$$/d' ) > xxx ; \ + sed -e "s%Version *[0-9.]*:%`cat doc/Version.tex`:%" xxx \ + > $$file ; rm -f xxx ; fi ; done ; ) + (cd $(LIBDIR) ; \ + ( sed -e '/opyright (c)/,$$d' dpictools.pic ; \ + sed -e 's/^ *\*/\#/' -e 's/\* *$$/\#/' Copying ; echo "" ; \ + sed -e '1,/opyright (c)/d' dpictools.pic | sed -e '1,/^ *$$/d' ) > xxx ;\ + sed -e "s%Version *[0-9.]*:%`cat doc/Version.tex`:%" xxx \ + > dpictools.pic ; rm xxx ) + +htmlfiles: html svgfiles pngs html/examples.html html/index.html \ + Circuit_macros.ico html/Optosample.png + @printf "\n === making lib/examples/htmlfiles\n" + mv Circuit_macros.ico html + if test -f examples.pdf ; \ + then printf "\n\n examples.pdf found\n" ; \ + else printf "\n\n examples.pdf not found\n" ; fi + if test -f doc/Circuit_macros.pdf ; \ + then printf "\n\n doc/Circuit_macros.pdf found\n" ; \ + cp doc/Circuit_macros.pdf html ; \ + else printf "\n\n doc/Circuit_macros.pdf not found\n" ; \ + cp $(TMP)/Circuit_macros.pdf $(LIBDIR)/doc ; fi + cp examples.pdf html + (cd html; chmod 644 *.svg *.txt *.html *.pdf ) + touch htmlfiles + +html: + @printf "\n === making html\n" + if test ! -d html ; then mkdir html ; fi + ( cd htmlsource; cp -p $(PERLFILE).pl .htaccess ../html ) + +svgfiles: html + @printf "\n === making svgfiles\n" + ( cd svg; make ) + for file in `ls svg/*SVG.m4` ; \ + do cp $$file html/`basename $$file .m4`.txt ; done + cp -p svg/examplesSVG.html svg/*.svg svg/*.jpg html + touch svgfiles + +Circuit_macros.ico: html htmlsource/favicon.m4 + @printf "\n === making Circuit_macros.ico\n" + cp htmlsource/favicon.m4 . + make -f $(THISFILE) favicon.eps + convert -density 105 favicon.eps Circuit_macros.ico + rm -f favicon.* + +html/index.html: htmlsource/index.htmx html + @printf "\n === making index.html\n" + Version=`sed -e 's/Version //' $(LIBDIR)/doc/Version.tex` ; \ + PCVersion=`echo $$Version | sed -e 's/\./_/g'` ; \ + sed -e 's/XXX/'$$Version'/' \ + -e 's/PCVersion/'$$PCVersion'/' \ + htmlsource/index.htmx > html/index.html + +html/Optosample.png: html htmlsource/Optosample.m4 + @printf "\n === making Optosample.png\n" + cp htmlsource/Optosample.m4 . + make -f $(THISFILE) Optosample.eps + convert Optosample.eps Optosample.png + mv Optosample.png html/Optosample.png + rm -f Optosample.* + +TR = tr '^@' '\012`' +html/examples.html: html htmlsource/examples.htmx files.tex + @printf "\n === making examples.html\n" + Version=`sed -e 's/Version //' $(LIBDIR)/doc/Version.tex` ; \ + sed -e 's/Version XXX/Version '$$Version'/' htmlsource/examples.htmx \ + > html/examples.html + cat files.tex | sed -e '/bfig[\{]/d' -e '/^ *[\}][\}]* *$$/d' \ + -e '/src[\{]/d' -e '/\\if/d' -e '/\\fi/d' -e '/includegraphics/d' \ + -e '/\%ignore\%/d' -e '/^\%/d' -e '/\\end[\{]/d' -e '/^\%/d' \ + -e '/getpic/s/\\getpic[\{]\([^\}]*\)[\}][\}]*/ <\1> /g' \ + -e '/<[^-]/s/^[^<]*<//' -e '/<[^-]/s/>[^<]*</> /g' -e '/[^-]>/s/>.*$$/>/' \ + -e 's/\([^ -][^ -]*\)>/IS_"\1.png" A_"\1 diagram">B_"\1.txt" T_\1.m4Y/'\ + -e 's/IS_/<P><IMG SRC=/' -e 's/A_/ALT=/' -e 's/B_/<BR>^<A HREF=/' \ + -e 's/T_/TARGET="_blank"><P>/' -e 's/4Y/4<\/A>:/' \ + -e 's/^.*caption[\{]//' -e '/^ *$$/s/^ */<HR>/' \ + -e 's/\\hbox//g' \ + | sed \ + -e '/<P>/!s/{\\tt \([^}]*\)}/<tt>\1<\/tt>/g' \ + -e '/<P>/!s/{\\texttt \([^}]*\)}/<tt>\1<\/tt>/g' \ + -e '/<P>/!s/{\\bf \([^}]*\)}/<tt>\1<\/tt>/g' \ + -e '/<P>/!s/{\\em \([^}]*\)}/<em>\1<\/em>/g' \ + -e '/<P>/!s/{\\it \([^}]*\)}/<em>\1<\/em>/g' \ + -e '/<P>/!s/{\\sl \([^}]*\)}/<em>\1<\/em>/g' \ + -e '/<P>/!s%\([^\\]\)_\(.\)%\1<sub>\2</sub>%g' \ + -e '/<P>/!s%\([^\\]\)\^\(.\)%\1<sup>\2</sup>%g' \ + -e 's%``%"%g' -e "s%''%\"%g" -e 's/\~/ /g' \ + -e 's%\\%%g' -e 's/\$$//g' \ + | sed -e 's/HREF=Inclpdf.m4/HREF=Inclpdf.txt/' | $(TR) \ + >> html/examples.html + cat htmlsource/endexamples.htmx >> html/examples.html + +BACKGROUND = blight + +pngs: basenames + @printf "\n === making pngs\n" + cp htmlsource/$(BACKGROUND).m4 . + -for nm in `cat basenames` ; do \ + echo "make -f $(THISFILE) $$nm.png ; mv $$nm.png html/$$nm.png" ;\ + make -f $(THISFILE) $$nm.png ; mv $$nm.png html/$$nm.png ;\ + ls -l html/$$nm.png ; \ + done + make -f $(THISFILE) $(BACKGROUND).png + mv $(BACKGROUND).png html/$(BACKGROUND).png + rm -f $(BACKGROUND).tex + -for nm in `cat basenames` ; do\ + cp $$nm.m4 html/$$nm.txt ; done + cp Inclpdf.m4 html/Inclpdf.txt + echo "" > html/Inclpdf.m4 + cat Inclpdf.m4 >> html/Inclpdf.m4 + chmod 644 html/Inclpdf.m4 + +gifs: basenames + @printf "\n === making gifs\n" + -for nm in `cat basenames` ; do \ + make -f $(THISFILE) $$nm.gif ; mv $$nm.gif html/$$nm.gif ;\ + done + make -f $(THISFILE) $(BACKGROUND).gif + mv $(BACKGROUND).gif html/$(BACKGROUND).gif + rm -f $(BACKGROUND).tex + -for nm in `cat basenames` ; do\ + cp $$nm.m4 html/$$nm.txt ; done + cp Inclpdf.m4 html/Inclpdf.txt + echo "" > html/Inclpdf.m4 + cat Inclpdf.m4 >> html/Inclpdf.m4 + chmod 644 html/Inclpdf.m4 + +basenames: files.tex + @printf "\n === making basenames\n" + grep '\\getpic' files.tex | sed -e '/Inclpdf/d' \ + -e 's%\\getpic[\{]\([^\}]*\)[\}]% <\1> %g' \ + -e 's/^[^<]*<//' -e 's/>[^<]*</ /g' -e 's/>.*$$//' \ + | sort | uniq > basenames + +# To make but not distribute everything: make dist zips htmlfiles + +ECETMP = /cygdrive/d/Dwight/tmp +ECENAM = CMdistfiles +ECEDIR = $(ECETMP)/$(NAME) +PERLFILE = Circuit_macros_access_log + +# (cd lib/examples; make -f distmakefile distece 2>&1)2>&1 > typescript +distece: + @printf "\n === making lib/examples/distece\n" + (cd ..; find . -type f -exec chmod 644 {} \; ) + rm -f dist zips htmlfiles + make -f $(THISFILE) dist zips htmlfiles + rm -rf $(ECEDIR)* ; mkdir $(ECEDIR) + Version=`sed -e 's/Version //' $(LIBDIR)/doc/Version.tex` ; \ + PCVersion=`echo $$Version | sed -e 's/\./_/g'` ; \ + cp -p $(TMP)/$(NAME)$$Version.tar.gz \ + $(TMP)/$(NAME)$$PCVersion.zip \ + $(TMP)/$(NAME)$$Version/README $(TMP)/$(NAME)$$Version/CHANGES \ + $(TMP)/$(NAME)$$Version/doc/Circuit_macros.pdf \ + $(ECEDIR) + rm -rf $(ECEDIR)/html ; mkdir $(ECEDIR)/html + cp -rp html/* $(ECEDIR)/html + mv $(ECEDIR)/html/index.html $(ECEDIR)/index.html + (cd $(ECETMP); tarlib $(NAME); mv $(NAME).tar.gz $(ECENAM).tar.gz ) + echo ""; echo ""; ls -l $(ECETMP)/$(ECENAM).tar.gz + +testall: + (cd mf; make) + (cd mpost; make) +# (cd pgf; make) + (cd psfrag; make) + (cd svg; make) + (cd xfig; make) + +clobber: clean + rm -f *.ps + -@for dir in mf mpost pdflatex xfig psfrag pgf svg dev test; \ + do (if test -d $$dir ; then cd $$dir; make clobber; fi) ; done + rm -f *.warn + rm -rf index.html html basenames *.png* dist zips htmlfiles svgfiles + rm -rf $(TMP)/Cir* $(ECETMP)/Cir* $(ECEDIR) + if test -f Incl.pdf ; then \ + mv Incl.pdf Incl.pdx; rm -f *.pdf; mv Incl.pdx Incl.pdf ; fi + for file in `ls *.tex` ; do \ + nm=`echo $$file | sed -e "s/\(.*\)\.tex/\1/"` ; \ + if test -s $$nm.m4 ; then rm -f $$nm.pic $$nm.tex ; fi ; done + +clean: + @printf "\nclean:\n" + find .. -name \*stackdump -exec rm {} \; + rm -f core snapshots *.ico *favicon* $(BACKGROUND).* zipdir + rm -f *.dvi *.aux *.log *.toc *.blg *.eps *.epsi eps *-mfpic* + rm -f fig*.tex $(PICS) *.roff *.int *.pic gpic.m4 test.tex xxx* *.fig + rm -f *.dim *.bak *.frs $(RPICS) rotate.ps tst.ps *.bbl *-pics.ps *.gif + rm -f *.tfm *[0-9]pk *.png *.1 + rm -f F_*.tex Version.tex doclinks *stackdump *.ico + rm -rf distfile distfile.tar.gz + @printf "\n" diff --git a/graphics/circuit_macros/examples/pgf/Makefile b/graphics/circuit_macros/examples/pgf/Makefile deleted file mode 100644 index 96a5e9face..0000000000 --- a/graphics/circuit_macros/examples/pgf/Makefile +++ /dev/null @@ -1,163 +0,0 @@ -# Makefile for the pgf subdirectory - -# Type "make" to produce the examplespgf.pdf file -# Type "make examplespgf.ps" for postscript output -# Type "make tst" to process the file test.m4 and produce tstpgf.ps -# Type "make tst.pdf" to process the file test.m4 and produce tstpgf.pdf - -# Where the .m4 libraries are installed. Change if necessary: -LIBDIR = $$HOME/lib - -#--------------------------------------------- - -# The .m4 circuit_macro libraries used for the examples: -M4MACROS = pgf.m4 -M4 = m4 -I $(LIBDIR) - -#--------------------------------------------- -DOC = examplespgf - -FIGS = Adder.tex Alogix.tex ABlogix.tex Antennas.tex Audio.tex AmpTable.tex \ - Bip.tex Btree.tex Byte.tex Buttons.tex \ - CanLogic.tex CctTable.tex Conn.tex Counting.tex Crossbar.tex Crow.tex \ - Csource.tex \ - Decoder.tex Demultiplexer.tex Diodes.tex Drive.tex \ - Emarrows.tex Flow.tex Fuses.tex \ - GrayCode.tex Grounds.tex Headers.tex Heathkit.tex Jack.tex \ - I2L.tex Incleps.tex \ - Logic.tex Loglog.tex MC.tex Mixer.tex MotorControl.tex Multiplexer.tex \ - NLG.tex NPDT.tex Nport.tex \ - Opamp.tex Optoiso.tex Pconn.tex PushPull.tex Quantum.tex \ - Rectifiers.tex Relay.tex Rotbox.tex \ - Schottky.tex Sierpinski.tex ShiftR.tex Sixpole.tex Sources.tex SQUID.tex \ - Switches.tex \ - Tgate.tex Three.tex Timer.tex TTLnand.tex Ttree.tex Tubediags.tex \ - Windings.tex Variable.tex Xform.tex \ - control.tex csc.tex diamond.tex \ - ex00.tex ex01.tex ex02.tex ex03.tex ex04.tex \ - ex05.tex ex06.tex ex08.tex ex09.tex ex10.tex ex11.tex ex12.tex \ - ex15.tex ex16.tex ex17.tex ex18.tex ex21.tex exp.tex \ - fet.tex graysurf.tex lcct.tex pwrsupply.tex quick.tex \ - random.tex recycle.tex rose.tex sfg.tex shapes.tex \ - thyristor.tex ujt.tex worm.tex XOR.tex - -# Files using boxdims macros: -BOXDIMS = ex09 Crow Incleps Loglog TTLnand Opamp Ttree Windings - -# It is advisable to do `make clean' between test examples. -#--------------------------------------------- - -DPIC = dpic -# DPIC = $$HOME/dpic/test/dpic - -LATEX = latex --quiet -PDFLATEX = pdflatex --quiet - -TR = | tr '=' '\134' - -.SUFFIXES: .tex .m4 .eps .ps .dim .pdf -.tex.ps: - $(LATEX) $* - dvips -Ppdf $* -.m4.tex: - $(M4) $(M4MACROS) $*.m4 | $(DPIC) -g > $*.tex -# $(M4) $(M4MACROS) $*.m4 > $*.pic -# $(DPIC) -g $*.pic > $*.tex -.m4.pdf: - $(M4) $(M4MACROS) $*.m4 | $(DPIC) -g > test.tex - $(PDFLATEX) tstpgf - mv tstpgf.pdf $*.pdf -.m4.dim: - printf '\\documentclass[11pt]{article}\n' > F$*.tex - printf '\usepackage{times,boxdims,tikz}\n' >> F$*.tex - printf '\usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits}\n' >>F$*.tex - printf '\\begin{document}\\input '$* >> F$*.tex - printf '\n\\end{document}\n' >> F$*.tex - make $*.tex - touch F$*.dim - $(M4) $(M4MACROS) F$*.dim $*.m4 | $(DPIC) -g > $*.tex; $(LATEX) F$* - $(M4) $(M4MACROS) F$*.dim $*.m4 | $(DPIC) -g > $*.tex; $(LATEX) F$* - - -$(DOC).pdf: Incl.pdf $(DOC).tex - -if test "$(DOC)"="examplespgf" ; then make exlinks ; fi - -if test -n "$(BOXDIMS)" ; then \ - for box in $(BOXDIMS) ; do touch F$$box.dim; make $$box.dim ; done; fi - make $(FIGS) - $(PDFLATEX) $(DOC) - -EXL = exlinks -$(DOC).ps: $(DOC).dvi - dvips -Ppdf $(DOC) - -$(DOC).dvi: Incl.eps.gz $(DOC).tex - -if test "$(DOC)"="examplespgf" ; then make exlinks ; fi - make dims $(FIGS) - $(LATEX) $(DOC) - -dims: - -if test -n "$(BOXDIMS)" ; then \ - for box in $(BOXDIMS) ; do touch F$$box.dim; make $$box.dim ; done; fi - touch dims - -Incl.eps.gz: ../Incl.eps.gz ../Incl.eps.bb - cp ../Incl.eps.gz . - cp ../Incl.eps.bb . - -Incl.pdf: ../Incl.pdf - cp ../Incl.pdf . - -figs: $(EXL) $(FIGS) - -exlinks: Incl.eps.gz - @echo "" - @echo 'Ignore "cannot create ... exists" warnings.' - -@if test ! -f ex11.m4 ; then \ - ls ../*.m4 | sed -e 's/^/ln -s /' -e '/test.m4/d' -e '/quick.m4/d' | sh;\ - ls ../../doc/*.m4 ../*.gz | sed -e 's/^/ln -s /' | sh;\ - fi - touch $(EXL) - -clobber: clean - rm -f $(DOC).ps test.m4 *.pdf - -tstpgf.ps: tst -tst: test.m4 - touch tstpgf.dim - $(M4) pgf.m4 tstpgf.dim test.m4 \ - > test.pic - $(DPIC) -g test.pic > test.tex - $(LATEX) tstpgf - $(M4) pgf.m4 tstpgf.dim test.m4 \ - > test.pic - $(DPIC) -g test.pic > test.tex - $(LATEX) tstpgf - dvips tstpgf - -tst.pdf: test.m4 - touch tstpgf.dim - $(M4) pgf.m4 tstpgf.dim test.m4 \ - > test.pic - $(DPIC) -g test.pic > test.tex - $(PDFLATEX) tstpgf - $(M4) pgf.m4 tstpgf.dim test.m4 \ - > test.pic - $(DPIC) -g test.pic > test.tex - $(PDFLATEX) tstpgf - -test.tex: test.m4 - touch tstpgf.dim - $(M4) pgf.m4 tstpgf.dim test.m4 > test.pic - $(DPIC) -g test.pic > test.tex - -clean: - rm -f stamp-* $(FIGS) *.dvi *.bb *.gz tstpgf.ps tstpgf.pdf - rm -f *.out *.pfg Incl.* *.pic - -if /usr/bin/test -f exlinks ; then \ - ls -l *.m4 | grep '\->' | \ - sed -e 's/^.* \([^ ][^ ]*\) ->.*$$/rm -f \1/' | sh; fi - rm -f *.log *.ps *.aux *.mp *.[0-9] *.[0-9][0-9] *.mpx *.eps *.dim - rm -f core log mpxerr* *links figs.* *.dim dims Ftest.* setdim.tex - rm -f man[0-9]*.pic man[0-9]*.m4 figs.m4 test.1 test.mp test.pic test.tex - -if test -n "$(BOXDIMS)" ; then for box in $(BOXDIMS) ; do \ - rm -f F$$box.tex $$box.tex ; done; fi diff --git a/graphics/circuit_macros/examples/pgf/README-pgf b/graphics/circuit_macros/examples/pgf/README-pgf deleted file mode 100644 index cddf8f2ef8..0000000000 --- a/graphics/circuit_macros/examples/pgf/README-pgf +++ /dev/null @@ -1,9 +0,0 @@ - -To test a single diagram, copy it into test.m4 -and type 'make tst'. The file is processed through -m4 and dpic -g to make test.tex which is then -included by tstpgf.tex. - -To produce examplespgf.pdf using tikz-pgf and pdflatex, type "make" -To produce examplespgf.ps using tikz-pgf, latex, and dvips, - type "make examplespgf.ps". diff --git a/graphics/circuit_macros/examples/pgf/examplespgf.tex b/graphics/circuit_macros/examples/pgf/examplespgf.tex deleted file mode 100644 index 5ceb9cece2..0000000000 --- a/graphics/circuit_macros/examples/pgf/examplespgf.tex +++ /dev/null @@ -1,28 +0,0 @@ -% pgf examples.tex - -\documentclass[11pt]{article} -\usepackage{times,boxdims,tikz} -\usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits} -\usepackage{rotating} - -\input ../header - -\global\pgftrue -\addtolength{\textheight}{6ex} - -\begin{document} - \hfill - {\large\bf Examples: - \input{../../doc/Version.tex} - } - \hfill\break - - In this directory the source files are processed with m4, dpic -g, - and TikZ PGF. - This is a collection of diagrams the author has had occasion to - produce using m4 circuit macros and others, and gpic or dpic. The - source-file names are shown for reference. There may be other or - better m4 or pic constructs for producing the same drawings in some - cases. - -\input ../files.tex diff --git a/graphics/circuit_macros/examples/pgf/tstpgf.tex b/graphics/circuit_macros/examples/pgf/tstpgf.tex deleted file mode 100644 index c5c560908c..0000000000 --- a/graphics/circuit_macros/examples/pgf/tstpgf.tex +++ /dev/null @@ -1,9 +0,0 @@ -\documentclass{article} -\usepackage{times,boxdims,tikz} -\usepackage{rotating} -\pagestyle{empty} -\begin{document} -\thispagestyle{empty} -%\centerline{\input test.tex} -\centerline{\boxdims{tpgf}{\input{test.tex}}} -\end{document} diff --git a/graphics/circuit_macros/examples/psfrag/Makefile b/graphics/circuit_macros/examples/psfrag/Makefile index 881a9a6d8b..83eb573f8e 100644 --- a/graphics/circuit_macros/examples/psfrag/Makefile +++ b/graphics/circuit_macros/examples/psfrag/Makefile @@ -21,9 +21,10 @@ M4 = m4 DOC = examplespsfrag FIGS = Adder.eps Alogix.eps ABlogix.eps Antennas.eps Audio.eps AmpTable.eps \ + AntiqueClock.eps \ Bip.eps Btree.eps Byte.eps Buttons.eps \ CanLogic.eps CctTable.eps Conn.eps Counting.eps Crossbar.eps Crow.eps \ - Decoder.eps Demultiplexer.eps Diodes.eps Drive.eps \ + Decoder.eps Demultiplexer.eps Dini.eps Diodes.eps Drive.eps \ Csource.eps \ Emarrows.eps Flow.eps Fuses.eps \ GrayCode.eps Grounds.eps Headers.eps Heathkit.eps Jack.eps \ @@ -41,8 +42,8 @@ FIGS = Adder.eps Alogix.eps ABlogix.eps Antennas.eps Audio.eps AmpTable.eps \ ex05.eps ex06.eps ex08.eps ex09.eps ex10.eps ex11.eps ex12.eps \ ex15.eps ex16.eps ex17.eps ex18.eps ex21.eps exp.eps \ fet.eps graysurf.eps lcct.eps pwrsupply.eps quick.eps \ - random.eps recycle.eps rose.eps sfg.eps shapes.eps thyristor.eps \ - ujt.eps worm.eps + random.eps recycle.eps relaycoil.eps rose.eps sfg.eps shapes.eps \ + thyristor.eps ujt.eps worm.eps LOCALFIGS = ex21 diff --git a/graphics/circuit_macros/examples/quick.m4 b/graphics/circuit_macros/examples/quick.m4 new file mode 100644 index 0000000000..7de2399601 --- /dev/null +++ b/graphics/circuit_macros/examples/quick.m4 @@ -0,0 +1,16 @@ +.PS # Pic input begins with .PS +cct_init # Read in macro definitions and set defaults +elen = 0.75 # Variables are allowed; default units are inches +Origin: Here # Position names are capitalized + source(up_ elen); llabel(-,v_s,+) + resistor(right_ elen); rlabel(,R,) + dot + { # Save the current position and direction + capacitor(down_ to (Here,Origin)) #(Here,Origin) = (Here.x,Origin.y) + rlabel(+,v,-); llabel(,C,) + dot + } # Restore position and direction + line right_ elen*2/3 + inductor(down_ Here.y-Origin.y); rlabel(,L,); b_current(i) + line to Origin +.PE # Pic input ends diff --git a/graphics/circuit_macros/examples/relaycoil.m4 b/graphics/circuit_macros/examples/relaycoil.m4 new file mode 100644 index 0000000000..b3273794cd --- /dev/null +++ b/graphics/circuit_macros/examples/relaycoil.m4 @@ -0,0 +1,40 @@ +.PS +# relaycoil.m4 +cct_init + + spc = dimen_/3 +{ relaycoil; S: "\tt re{}laycoil" at last [].s+(0,-20bp__) + { "\sl V1" wid 10bp__ at last [].V1 rjust + "\sl V2" at last [].V2 ljust } + K: relaycoil(NX) with .nw at last [].ne+(spc*4,0); "\tt (NX)" at (last [],S) + { thinlines_ + spline <- from K.A1 left 7bp__ then up 4bp__ left 4bp__; "\sl A1" rjust + arrow <- from K.A2 left 10bp__; "\sl A2" rjust + spline <- from K.A3 left 7bp__ then down 4bp__ left 4bp__; "\sl A3" rjust + spline <- from K.B1 right 7bp__ then up 4bp__ right 4bp__; "\sl B1" ljust + arrow <- from K.B2 right 10bp__; "\sl B2" ljust + spline <- from K.B3 right 7bp__ then down 4bp__ right 4bp__; "\sl B3" ljust + thicklines_ + } + relaycoil(AXSR) with .nw at last [].ne+(spc*5,0); "\tt (AXSR)" at (last [],S) + { "\sl V1" at last [].V1 rjust; "\sl V2" at last [].V2 rjust } + relaycoil(BXSR) with .nw at last [].ne+(spc*2,0); "\tt (BXSR)" at (last [],S) + { "\sl V1" at last [].V1 ljust; "\sl V2" at last [].V2 ljust } + relaycoil(SR) with .nw at last [].ne+(spc*4,0); "\tt (SR)" at (last [],S) + relaycoil(SO) with .nw at last [].ne+(spc,0); "\tt (SO)" at (last [],S) + relaycoil(SOR) with .nw at last [].ne+(spc,0); "\tt (SOR)" at (last [],S) + } +{ + move down_ 3/4; right_ + relaycoil(HS); S: "\tt (HS)" at last [].s+(0,-12bp__) + relaycoil(NAC) with .nw at last [].ne+(spc,0); "\tt (NAC)" at (last [],S) + relaycoil(AC) with .nw at last [].ne+(spc,0); "\tt (AC)" at (last [],S) + relaycoil(ML) with .nw at last [].ne+(spc,0); "\tt (ML)" at (last [],S) + relaycoil(PO) with .nw at last [].ne+(spc,0); "\tt (PO)" at (last [],S) + relaycoil(RM) with .nw at last [].ne+(spc,0); "\tt (RM)" at (last [],S) + relaycoil(RH) with .nw at last [].ne+(spc,0); "\tt (RH)" at (last [],S) + relaycoil(TH) with .nw at last [].ne+(spc,0); "\tt (TH)" at (last [],S) + relaycoil(EL) with .nw at last [].ne+(spc,0); "\tt (EL)" at (last [],S) + } + +.PE diff --git a/graphics/circuit_macros/examples/rotatetext.m4 b/graphics/circuit_macros/examples/rotatetext.m4 index 2aec6abdf8..9aa2dbea01 100644 --- a/graphics/circuit_macros/examples/rotatetext.m4 +++ b/graphics/circuit_macros/examples/rotatetext.m4 @@ -1,7 +1,7 @@ .PS # rotatetext.m4 -# This is a test of the \rput function to write a string around the -# periphery of a circle of radius r, accounting for inter-letter kerns +# This is a test of the pstricks \rput function to write a string around +# the periphery of a circle of radius r, accounting for inter-letter kerns {\Huge gen_init twopi = twopi_ diff --git a/graphics/circuit_macros/examples/svg/AntiqueClockSVG.m4 b/graphics/circuit_macros/examples/svg/AntiqueClockSVG.m4 new file mode 100644 index 0000000000..0848a53cbe --- /dev/null +++ b/graphics/circuit_macros/examples/svg/AntiqueClockSVG.m4 @@ -0,0 +1,158 @@ +.PS +# AntiqueClockSVG.m4 +gen_init(svg_font(font-family="sans-serif" font-stretch="condensed")) + +# https://tex.stackexchange.com/questions/236923/generate-analog-clock-with-numbered-face-add-seconds-roman-numerals + +# `Initialize rotated text. Any unrotated text must +# appear after the rotated text.' +svgrot_init(AntiqueClockSVG) + +# `hms2deg(hr,min,sec) hr:min:sec to degrees +# blank arg1: degrees for minute hand +# blank arg1 and arg2: degrees for second hand' +define(`hms2deg',`ifelse(`$1',, + `ifelse(`$2',, + `(90-pmod(ifelse(`$3',,0,`$3'),60)/60*360)', + `(90-(pmod(`$2',60)/60 + pmod(ifelse(`$3',,0,`$3'),60)/60/60)*360)')', + `(90-(pmod(`$1',12) + pmod(ifelse(`$2',,0,`$2'),60)/60 + dnl + pmod(ifelse(`$3',,0,`$3'),60)/3600)/12*360)')') + +# `SecondHand(length,hr,min,sec)' +define(`SecondHand',`[ shsf = (`$1')/3.2 + C: Here + { L: rpoint_(to (Rect_(`$1',hms2deg(,,`$4')))) } + line thick 8*shsf to rvec_(`$1',0) + ]') + +# `AntiqueMinuteHand(length,hr,min,sec)' +define(`AntiqueMinuteHand',`[ mhsf = (`$1')/2.84 + L: rpoint_(to (Rect_(`$1',hms2deg(,`$3',`$4')))) + C: circle fill_(0) diam 0.47*mhsf at L.start + move to C + spline from rvec_(0,0.047*mhsf) \ + to rvec_(1.65*mhsf,0.11*mhsf) \ + then to rvec_(`$1',0.018*mhsf) \ + then to rvec_(`$1',-0.018*mhsf) \ + then to rvec_(1.65*mhsf,-0.11*mhsf) \ + then to rvec_(0,-0.047*mhsf) \ + shaded rgbstring(0,0,0) + ]') + +# `AntiqueHourHand(length,hr,min,sec)' +define(`AntiqueHourHand',`[ hhsf = (`$1')/2.2 + L: rpoint_(to (Rect_(`$1',hms2deg(`$2',`$3',`$4')))) + C: circle fill_(0) diam 0.6*hhsf at L.start + move to C + v = 0.25*hhsf + { line to rvec_(1.1*hhsf,0) thick 0.15/(1bp__)*hhsf } + C1: rvec_(1.25*hhsf,0) + d = `$1'-1.25*hhsf + q = 1bp__*hhsf + r1 = (d^2 + q^2 - v^2)/(v-q)/2 + tang = atan2((r1+q),d) + for i=0 to 3 do { + X[i]: C1+vec_(rect_(v, pi_+i/3*( tang-pi_))) + Y[i]: C1+vec_(rect_(v,-pi_+i/3*(-tang+pi_))) + } + n = 3 + for i=1 to 4 do { aa = -pi_+tang + i/4*(pi_/2-tang) + XX: (d,r1+q)+(rect_(r1,aa)) + n+=1; + X[n]: C1+vec_(XX.x, XX.y) + Y[n]: C1+vec_(XX.x,-XX.y) + } + m = n + for i= 0 to m do { n+=1; X[n]: Y[m-i] } + fitcurve(X,n,shaded rgbstring(0,0,0)) + ]') + +define(`AntiqueClock',`[ # h,m,s,diam +# Clock size parameters: + hour = ifelse(`$1',,3,`$1') + minute = ifelse(`$2',,41,`$2') + second = ifelse(`$3',,51,`$3') + # outer radius + ifelse(`$4',,`skale=0.5; r1=2',`r1=(`$4')/2; skale=r1/4') + r2 = r1-0.5*skale + r3 = r2-0.14*skale + r4 = r3 - 0.35*skale + r5 = r4 - 0.17*skale + r6 = r5 - 0.63*skale + r7 = r6 - 0.17*skale + shadelinethick = 1.0 + +C: circle thick 0.2 rad r1 + +define shadeline { + s = 1-($`'1)*2 + v = r*s + h = sqrt(r^2-v^2) + t = 1-abs(s) + line from (vrot_(-h,v,cost,sint)) to (vrot_(h,v,cost,sint)) \ + thick shadelinethick outlined rgbstring(t,t,t) + } + + r = r1 # Bezel outer + nlines = int(2*r/(shadelinethick pt__)*1.1) + cost = cosd(10); sint = sind(10); + ShadeObject(shadeline,nlines, 0, 0,0,0, 0.5, 1,1,1, 1, 0,0,0 ) at C + + r = r2 # Bezel inner + nlines = int(2*r/(shadelinethick pt__)*1.1) + cost = cosd(-10); sint = sind(-10); + ShadeObject(shadeline,nlines, 0, 0,0,0, 0.25, 0.8,0.8,0.8, 0.5, 1,1,1, + 0.75, 0.8,0.8,0.8, 1, 0,0,0 ) at C + +# Clock face +Face: circle thick 0 fill_(1) rad r3 at C + circle rad r4 at C + circle rad r5 at C + circle rad r6 at C + circle rad r7 at C +# Ad hoc shift of rotated SVG text + define adj { (-cosd($`'1)*textht*0.5*sign(180-($`'1)),\ + (0.25+0.25*cosd(2*($`'1)))*textht) } +# Outer numbers + textht = (r3-r4)*0.6 + for mn = -15 to 15 by 5 do { t = 90-mn/60*360 + R:(Rect_((r3+r4)/2,t)) + svg_rot(mn/60*360,sprintf("%g",pmod(mn,60)) at C+R+adj(t)) + } + for mn = 20 to 40 by 5 do { t = 450-mn/60*360 + R: (Rect_((r3+r4)/2,t)) + svg_rot(-180+mn/60*360, sprintf("%g",pmod(mn,60)) at C+R+adj(t)) + } +# Outer tics + for mn = 1 to 60 do { t = 90-mn/60*360 + line from C+(Rect_(r5,t)) to C+(Rect_(r4,t)) } + +# Inner numbers + textht = (r5-r6)*0.6 + Loopover_(`mx',`tt = 90-(m4Lx-4)/12*360 + R: (Rect_((r5+r6)/2,tt)) + svg_rot(90-tt, "mx" at C+R+adj(tt)) ', + IX,X,XI,XII,I,II,III) + Loopover_(`mx',`tt = 360-m4Lx*30 + R: (Rect_((r5+r6)/2,tt)) + svg_rot(270-tt, "mx" at C+R+adj(tt)) ', + IV,V,VI,VII,VIII) + +# Inner tics + for mn = 5 to 60 by 5 do { t = 90-mn/60*360 + line from C+(Rect_(r7,t)) to C+(Rect_(r6,t)) } + +# Hands + AntiqueHourHand(r6,hour,minute,second) with .C at C + AntiqueMinuteHand(r5,hour,minute,second) with .C at C + SecondHand((r3+r4)/2,hour,minute,second) with .C at C + +# Center + dot(at C,0.1/4*r1,1) + ]') + + Clock1: AntiqueClock(,,,3.5) +# Clock2: AntiqueClock(4,48,07,2) at Clock1.e+(1.5,0) + + command "</g>" # end font +.PE diff --git a/graphics/circuit_macros/examples/svg/BtreeSVG.m4 b/graphics/circuit_macros/examples/svg/BtreeSVG.m4 index df0a2726b2..312249605e 100644 --- a/graphics/circuit_macros/examples/svg/BtreeSVG.m4 +++ b/graphics/circuit_macros/examples/svg/BtreeSVG.m4 @@ -2,7 +2,7 @@ # Btree.m4 # One way to draw a binary tree using pic macros gen_init(svg_font(sans-serif,11bp__)) -circlerad = 0.35 +circlerad = 0.30 define n { [C: circle fill_(0.9) $1 if "$2" != "" then { diff --git a/graphics/circuit_macros/examples/svg/ContactSVG.m4 b/graphics/circuit_macros/examples/svg/ContactSVG.m4 new file mode 100644 index 0000000000..057f702731 --- /dev/null +++ b/graphics/circuit_macros/examples/svg/ContactSVG.m4 @@ -0,0 +1,101 @@ +.PS +# ContactSVG +cct_init +svg_font(sans-serif,11bp__) + +movw = 0.45 +{ + contact + {S:"svg_tt(`contact')" at last [].s+(0,-0.15) + "svg_it(`P')" rjust at last [].P.w + "svg_it(`O')" ljust at last [].O + "svg_it(`C')" ljust at last [].C } + move right_ movw; contact(R) + {"svg_tt(`(R)')" at (last [].s,S) + "svg_it(`P')" rjust at last [].P.w + "svg_it(`O')" ljust at last [].O + "svg_it(`C')" ljust at last [].C } + move right_ movw; contact(O); {"svg_tt(`(O)')" at (last [],S)} + move right_ movw; contact(C); {"svg_tt(`(C)')" at (last [],S)} + + move right_ movw; contact(P) + {S: "svg_tt(`(P)')" at last [].s+(0,-0.15) + "svg_it(`P')" rjust at last [].P.w + "svg_it(`O')" ljust at last [].O + "svg_it(`C')" ljust at last [].C } + move right_ movw; contact(PR) + {S: "svg_tt(`(PR)')" at last [].s+(0,-0.15) + "svg_it(`P')" rjust at last [].P.w + "svg_it(`O')" ljust at last [].O + "svg_it(`C')" ljust at last [].C } + move right_ movw; contact(PO); {"svg_tt(`(PO)')" at (last [],S)} + {"svg_it(`O')" ljust at last [].O + "svg_it(`C')" ljust at last [].C } + move right_ movw; contact(PC); {"svg_tt(`(PC)')" at (last [],S)} +} + +move down 0.75; right_ ; { + contact(I); {S: "svg_tt(`(I)')" at last [].s+(0,-12bp__) + "svg_it(`P')" rjust at last [].P.w + "svg_it(`O')" ljust at last [].O.e + "svg_it(`C')" ljust at last [].C.e } + move right_ movw; contact(RI) + {"svg_tt(`(RI)')" at (last [],S) + "svg_it(`P')" rjust at last [].P.w + "svg_it(`O')" ljust at last [].O.e + "svg_it(`C')" ljust at last [].C.e } + move right_ movw; contact(OI); {"svg_tt(`(OI)')" at (last [],S)} + move right_ movw; contact(CI); {"svg_tt(`(CI)')" at (last [],S)} + + move right_ movw; contact(PI); {"svg_tt(`(PI)')" at (last [],S) } + {"svg_it(`O')" ljust at last [].O.e + "svg_it(`C')" ljust at last [].C.e } + move right_ movw; contact(PIO); {"svg_tt(`(PIO)')" at (last [],S) } + move right_ movw; contact(PIC); {"svg_tt(`(PIC)')" at (last [],S) } +} + +movewid = movw + move down 0.65; right_; { + K: contact(T) + {S: "svg_tt(`(T)')" at last [].s+(0,-0.15) + thinlines_ + spline <- right 0.09 then up 0.05 right 0.05 from K.C; "svg_it(`C')" + spline <- right 0.09 then down 0.05 right 0.05 from K.O; "svg_it(`O')" + thicklines_ } + move; K: contact(RT) + {"svg_tt(`(RT)')" at (last [],S) + thinlines_ + spline <- right 0.09 then up 0.05 right 0.05 from K.O; "svg_it(`O')" + spline <- right 0.09 then down 0.05 right 0.05 from K.C; "svg_it(`C')" + thicklines_ } + move; contact(OT); {S: "svg_tt(`(OT)')" at (last [],S) } + move; contact(CT); {S: "svg_tt(`(CT)')" at (last [],S) } + move; contact(PT); {S: "svg_tt(`(PT)')" at (last [],S) } + move; contact(PTO); {S: "svg_tt(`(PTO)')" at (last [],S) } + move; contact(PTC); {S: "svg_tt(`(PTC)')" at (last [],S) } +} + + move down 0.65; right_; { + K: contact(U) + {S: "svg_tt(`(U)')" at last [].s+(0,-0.15) + thinlines_ + spline <- right 0.09 then up 0.05 right 0.05 from K.C; "svg_it(`C')" + spline <- right 0.09 then down 0.05 right 0.05 from K.O; "svg_it(`O')" + thicklines_ } + move; K: contact(RU) + {"svg_tt(`(RU)')" at (last [],S) + thinlines_ + spline <- right 0.09 then up 0.05 right 0.05 from K.O; "svg_it(`O')" + spline <- right 0.09 then down 0.05 right 0.05 from K.C; "svg_it(`C')" + thicklines_ } + move; K: contact(OU); {S: "svg_tt(`(OU)')" at (last [],S) + "svg_it(`O')" ljust at K.O.e } + move; K: contact(CU); {S: "svg_tt(`(CU)')" at (last [],S) + "svg_it(`C')" ljust at K.C.e } + move; contact(PU); {S: "svg_tt(`(PU)')" at (last [],S) } + move; contact(PUO); {S: "svg_tt(`(PUO)')" at (last [],S) } + move; contact(PUC); {S: "svg_tt(`(PUC)')" at (last [],S) } +} + + command "</g>" # end font +.PE diff --git a/graphics/circuit_macros/examples/svg/ContactsSVG.m4 b/graphics/circuit_macros/examples/svg/ContactsSVG.m4 new file mode 100644 index 0000000000..556ae04a61 --- /dev/null +++ b/graphics/circuit_macros/examples/svg/ContactsSVG.m4 @@ -0,0 +1,49 @@ +.PS +# ContactsSVG.m4 +cct_init +svg_font(sans-serif,10bp__) + + space = 0.75 + KS:contacts(2) + {"svg_tt(`contacts(2)')" wid 1 at KS.s +(0,-12bp__) + for_(1,2,1, + `"svg_it(P`'m4x)" rjust at last [].P`'m4x-(dotrad_,0) + "svg_it(O`'m4x)" ljust at last [].O`'m4x+(dotrad_,0) + "svg_it(C`'m4x)" ljust at last [].C`'m4x+(dotrad_,0) ') } + + KS:contacts(2,I) with .sw at last [].se+(space,0) + {"svg_tt(`(2,I)')" at KS.s +(0,-12bp__) + for_(1,2,1, + `"svg_it(P`'m4x)" rjust at last [].P`'m4x-(dotrad_,0) + "svg_it(O`'m4x)" ljust at last [].O`'m4x+(dotrad_,0) + "svg_it(C`'m4x)" ljust at last [].C`'m4x+(dotrad_,0) ') } + + KS:contacts(2,IO) with .sw at last [].se+(space,0) + {"svg_tt(`(2,IO)')" at KS.s +(0,-12bp__) + for_(1,2,1, + `"svg_it(P`'m4x)" rjust at last [].P`'m4x-(dotrad_,0) + "svg_it(O`'m4x)" ljust at last [].O`'m4x+(dotrad_,0) ') } + + KS:contacts(2,PICD) with .sw at last [].se+(space,0) + {"svg_tt(`(2,PICD)')" at KS.s +(0,-12bp__) + for_(1,2,1, + `"svg_it(P`'m4x)" rjust at last [].P`'m4x-(dotrad_,0) + "svg_it(O`'m4x)" ljust at last [].O`'m4x+(dotrad_,0) + "svg_it(C`'m4x)" ljust at last [].C`'m4x+(dotrad_,0) ') } + + KS:contacts(2,PTCD) with .sw at last [].se+(space,0) + {"svg_tt(`(2,PTCD)')" at KS.s +(0,-12bp__) + for_(1,2,1, + `"svg_it(P`'m4x)" rjust at last [].P`'m4x-(dotrad_,0) + "svg_it(O`'m4x)" ljust at last [].O`'m4x+(dotrad_,0) + "svg_it(C`'m4x)" ljust at last [].C`'m4x+(dotrad_,0) ') } + + KS:contacts(2,PUCD) with .sw at last [].se+(space,0) + {"svg_tt(`(2,PUCD)')" at KS.s +(0,-12bp__) + for_(1,2,1, + `"svg_it(P`'m4x)" rjust at last [].P`'m4x-(dotrad_,0) + "svg_it(O`'m4x)" ljust at last [].O`'m4x+(dotrad_,0) + "svg_it(C`'m4x)" ljust at last [].C`'m4x+(dotrad_,0) ') } + + command "</g>" # end font +.PE diff --git a/graphics/circuit_macros/examples/svg/CrowSVG.m4 b/graphics/circuit_macros/examples/svg/CrowSVG.m4 index 6be0938947..3fe2e8ff72 100644 --- a/graphics/circuit_macros/examples/svg/CrowSVG.m4 +++ b/graphics/circuit_macros/examples/svg/CrowSVG.m4 @@ -33,22 +33,22 @@ define boxtext { boxwid = boxwid*1.15 boxsep = boxwid/2 - custombox(Class,ht boxht*2.2, + custombox(Class,ht boxht*1.7, `classkey, class_type, class_desc') custombox(Product,ht Class.ht with .nw at Class.ne+(boxsep,0), `classkey, prodkey, prod_name, pkg_type') - custombox(Sales,ht boxht*3.3 with .nw at Product.ne+(boxsep*2,15pt__), + custombox(Sales,ht boxht*2.75 with .nw at Product.ne+(boxsep*2,13pt__), `perkey, classkey, prodkey, storekey, promokey, quantity, dollars') custombox(Period,ht Sales.ht with .nw at Sales.ne+(boxsep*2,0), `perkey, date, day, week, month, qtr, year') - custombox(Market,ht Sales.ht with .nw at Class.sw+(0,-boxsep*2), + custombox(Market,ht Sales.ht with .nw at Class.sw+(0,-boxsep*3/2), `perkey, date, day, week, month, qtr, year') - custombox(Store,ht boxht*3.6 with .sw at (Product.w,Market.s), + custombox(Store,ht boxht*3.2 with .sw at (Product.w,Market.s), `storekey, mktkey, store_type, store_name, street, city, state, zip') custombox(Promotion,ht Market.ht with .sw at (Period.w,Market.s), @@ -61,7 +61,7 @@ define boxtext { T: last line.c+(0,-crow_wd*2.5) move to Period.nw+(0,-10pt__); crowline(to (Sales.e,Here),,1.75*crow_wd) -Q: (last line.c,0.4 between Sales.se and Sales.ne) +Q: (last line.c,0.35 between Sales.se and Sales.ne) move to Market.ne+(0,-10pt__); crowline(to (Store.w,Here)) move to Store.ne+(0,-10pt__); line to (T,Here) then to T diff --git a/graphics/circuit_macros/examples/svg/DiniSVG.m4 b/graphics/circuit_macros/examples/svg/DiniSVG.m4 new file mode 100644 index 0000000000..5631a4822f --- /dev/null +++ b/graphics/circuit_macros/examples/svg/DiniSVG.m4 @@ -0,0 +1,193 @@ +.PS +# Dini.m4 +# This diagram can be produced using, e.g. +# m4 pdf.m4 Dini.m4 | dpic -d > Dini.pdf + +threeD_init +NeedDpicTools +scale = 1.5 +[ + viewazimuth = 0 # View angles in degrees + viewelevation = 20 + setview(viewazimuth,viewelevation,0) + + a = 1.5 + b = 0.25 + +define(`Dini', +`a*cos(`$1')*sin(`$2'),dnl + a*sin(`$1')*sin(`$2'),dnl + (a*(cos(`$2')+loge(tan((`$2')/2))) + b*(`$1'))') + + umin = 0; umax = 4*pi_ + vmin = 0.2; vmax = 2.0 + ugrid = 80; vgrid = 20 + + ur = umax-umin + vr = vmax-vmin +`define cu {umin+($1)/ugrid*ur}' +`define cv {vmin+($1)/vgrid*vr}' + +# Generate points and sort + n = -1 + for iu=0 to ugrid do { + for iv=0 to vgrid do { + n +=1 + ciu[n] = cu(iu) + civ[n] = cv(iv) + d[n] = dot3D(View3D,Dini(ciu[n],civ[n])) + ix[n] = n + } + } + dpquicksort(d,0,n,ix) + +# Draw the facets + linethick = 0.4 + du = ur/ugrid/2 + dv = vr/vgrid/2 + for i=0 to n do { + NE: project(Dini(ciu[ix[i]]+du,civ[ix[i]]+dv)) + SE: project(Dini(ciu[ix[i]]+du,civ[ix[i]]-dv)) + SW: project(Dini(ciu[ix[i]]-du,civ[ix[i]]-dv)) + NW: project(Dini(ciu[ix[i]]-du,civ[ix[i]]+dv)) + f = (-cos(ciu[ix[i]])+1)/2 + g = ( sin(ciu[ix[i]])+1)/2 + line from NE to SE then to SW then to NW then to NE \ + outlined rgbstring(f,g,0) shaded rgbstring(f,g,0) +# outlined rgbstring(0,0.5,0) shaded rgbstring(f,g,0) + } +] +# Icosahedron.m4 +[ +#threeD_init +#NeedDpicTools + # Computing facets is complicated, so list them. + # 60 vertices: +define(`m4x',-1) + array2(v,m4inx,0, 0, 1.021) + array2(v,m4inx,0.4035482, 0, 0.9378643) + array2(v,m4inx,-0.2274644, 0.3333333, 0.9378643) + array2(v,m4inx,-0.1471226, -0.375774, 0.9378643) + array2(v,m4inx,0.579632, 0.3333333, 0.7715933) + array2(v,m4inx,0.5058321, -0.375774, 0.8033483) + array2(v,m4inx,-0.6020514, 0.2908927, 0.7715933) + array2(v,m4inx,-0.05138057, 0.6666667, 0.7715933) + array2(v,m4inx,0.1654988, -0.6080151, 0.8033483) + array2(v,m4inx,-0.5217096, -0.4182147, 0.7715933) + array2(v,m4inx,0.8579998, 0.2908927, 0.4708062) + array2(v,m4inx,0.3521676, 0.6666667, 0.6884578) + array2(v,m4inx,0.7841999, -0.4182147, 0.5025612) + array2(v,m4inx,-0.657475, 0.5979962, 0.5025612) + array2(v,m4inx,-0.749174, -0.08488134, 0.6884578) + array2(v,m4inx,-0.3171418, 0.8302373, 0.5025612) + array2(v,m4inx,0.1035333, -0.8826969, 0.5025612) + array2(v,m4inx,-0.5836751, -0.6928964, 0.4708062) + array2(v,m4inx,0.8025761, 0.5979962, 0.2017741) + array2(v,m4inx,0.9602837, -0.08488134, 0.3362902) + array2(v,m4inx,0.4899547, 0.8302373, 0.3362902) + array2(v,m4inx,0.7222343, -0.6928964, 0.2017741) + array2(v,m4inx,-0.8600213, 0.5293258, 0.1503935) + array2(v,m4inx,-0.9517203, -0.1535518, 0.3362902) + array2(v,m4inx,-0.1793548, 0.993808, 0.1503935) + array2(v,m4inx,0.381901, -0.9251375, 0.2017741) + array2(v,m4inx,-0.2710537, -0.9251375, 0.3362902) + array2(v,m4inx,-0.8494363, -0.5293258, 0.2017741) + array2(v,m4inx,0.8494363, 0.5293258, -0.2017741) + array2(v,m4inx,1.007144, -0.1535518, -0.06725804) + array2(v,m4inx,0.2241935, 0.993808, 0.06725804) + array2(v,m4inx,0.8600213, -0.5293258, -0.1503935) + array2(v,m4inx,-0.7222343, 0.6928964, -0.2017741) + array2(v,m4inx,-1.007144, 0.1535518, 0.06725804) + array2(v,m4inx,-0.381901, 0.9251375, -0.2017741) + array2(v,m4inx,0.1793548, -0.993808, -0.1503935) + array2(v,m4inx,-0.2241935, -0.993808, -0.06725804) + array2(v,m4inx,-0.8025761, -0.5979962, -0.2017741) + array2(v,m4inx,0.5836751, 0.6928964, -0.4708062) + array2(v,m4inx,0.9517203, 0.1535518, -0.3362902) + array2(v,m4inx,0.2710537, 0.9251375, -0.3362902) + array2(v,m4inx,0.657475, -0.5979962, -0.5025612) + array2(v,m4inx,-0.7841999, 0.4182147, -0.5025612) + array2(v,m4inx,-0.9602837, 0.08488134, -0.3362902) + array2(v,m4inx,-0.1035333, 0.8826969, -0.5025612) + array2(v,m4inx,0.3171418, -0.8302373, -0.5025612) + array2(v,m4inx,-0.4899547, -0.8302373, -0.3362902) + array2(v,m4inx,-0.8579998, -0.2908927, -0.4708062) + array2(v,m4inx,0.5217096, 0.4182147, -0.7715933) + array2(v,m4inx,0.749174, 0.08488134, -0.6884578) + array2(v,m4inx,0.6020514, -0.2908927, -0.7715933) + array2(v,m4inx,-0.5058321, 0.375774, -0.8033483) + array2(v,m4inx,-0.1654988, 0.6080151, -0.8033483) + array2(v,m4inx,0.05138057, -0.6666667, -0.7715933) + array2(v,m4inx,-0.3521676, -0.6666667, -0.6884578) + array2(v,m4inx,-0.579632, -0.3333333, -0.7715933) + array2(v,m4inx,0.1471226, 0.375774, -0.9378643) + array2(v,m4inx,0.2274644, -0.3333333, -0.9378643) + array2(v,m4inx,-0.4035482, 0, -0.9378643) + array2(v,m4inx,0, 0, -1.021) + + # 12 pentagons +undefine(`m4x') +array2(p,m4inx,0,3,8,5,1) +array2(p,m4inx,2,7,15,13,6) +array2(p,m4inx,4,10,18,20,11) +array2(p,m4inx,9,14,23,27,17) +array2(p,m4inx,12,21,31,29,19) +array2(p,m4inx,16,26,36,35,25) +array2(p,m4inx,22,32,42,43,33) +array2(p,m4inx,24,30,40,44,34) +array2(p,m4inx,28,39,49,48,38) +array2(p,m4inx,37,47,55,54,46) +array2(p,m4inx,41,45,53,57,50) +array2(p,m4inx,51,52,56,59,58) + + # 20 hexagons +undefine(`m4x') +array2(h,m4inx,0,1,4,11,7,2) +array2(h,m4inx,0,2,6,14,9,3) +array2(h,m4inx,1,5,12,19,10,4) +array2(h,m4inx,3,9,17,26,16,8) +array2(h,m4inx,5,8,16,25,21,12) +array2(h,m4inx,6,13,22,33,23,14) +array2(h,m4inx,7,11,20,30,24,15) +array2(h,m4inx,10,19,29,39,28,18) +array2(h,m4inx,13,15,24,34,32,22) +array2(h,m4inx,17,27,37,46,36,26) +array2(h,m4inx,18,28,38,40,30,20) +array2(h,m4inx,21,25,35,45,41,31) +array2(h,m4inx,23,33,43,47,37,27) +array2(h,m4inx,29,31,41,50,49,39) +array2(h,m4inx,32,34,44,52,51,42) +array2(h,m4inx,35,36,46,54,53,45) +array2(h,m4inx,38,48,56,52,44,40) +array2(h,m4inx,42,51,58,55,47,43) +array2(h,m4inx,48,49,50,57,59,56) +array2(h,m4inx,53,54,55,58,59,57) + + viewazimuth = -10 # View angles in degrees + viewelevation = 40 + setview(viewazimuth,viewelevation,0) + + n = 0 # Find and draw the visible hexagons + for i=1 to 20 do { # The normal is the line to the center + for_(1,3,1,`a[m4x] = (v[h[i,1],m4x] + v[h[i,4],m4x])/2') + if dot3D(View3D,a[1],a[2],a[3]) >= 0 then { n +=1; ih[n] = i } + } + for i=1 to n do { + for j=1 to 6 do { x[j]=h[ih[i],j] } + line from project((v[x[1],1]),(v[x[1],2]),(v[x[1],3]))\ + for_(2,6,1,`to project((v[x[m4x],1]),(v[x[m4x],2]),(v[x[m4x],3]))\')\ + to project((v[x[1],1]),(v[x[1],2]),(v[x[1],3])) thick 0.2 fill_(0.95) + } + m = 0 + for i=1 to 12 do { # Visible pentagons + for_(1,3,1,`a[m4x] = 0; for j=1 to 5 do { a[m4x] += v[p[i,j],m4x] }') + if dot3D(View3D,a[1]/5,a[2]/5,a[3]/5) >= 0 then { m +=1; ip[m] = i } + } + for i=1 to m do { + for j=1 to 5 do { x[j]=p[ip[i],j] } + line from project((v[x[1],1]),(v[x[1],2]),(v[x[1],3])) \ + for_(2,5,1,`to project((v[x[m4x],1]),(v[x[m4x],2]),(v[x[m4x],3]))\')\ + to project((v[x[1],1]),(v[x[1],2]),(v[x[1],3])) thick 0.2 fill_(0) + } +] scaled 2.5 with .sw at last [].se+(1,0) +.PE diff --git a/graphics/circuit_macros/examples/svg/Makefile b/graphics/circuit_macros/examples/svg/Makefile index 4d604dac40..5ee232a5ea 100644 --- a/graphics/circuit_macros/examples/svg/Makefile +++ b/graphics/circuit_macros/examples/svg/Makefile @@ -7,6 +7,7 @@ M4LIBS = svg.m4 SVGconfig.m4 DPIC = dpic #DPIC = $$HOME/dpic/bu*/p2c/ftp/dpic #DPIC = $$HOME/dpic/bu*/test/dpic +#DPIC = $$HOME/dpic/dev/p2c/ftp/dpic #DPIC = ../../../dpic/bison/dpic .SUFFIXES: .pic .svg .m4 @@ -20,11 +21,11 @@ DPIC = dpic CCTSVG = \ AdderSVG.svg AlogixSVG.svg ABlogixSVG.svg AmpTableSVG.svg AntennasSVG.svg \ - AudioSVG.svg \ + AntiqueClockSVG.svg \ AudioSVG.svg \ BipSVG.svg BtreeSVG.svg ByteSVG.svg ButtonsSVG.svg \ - CanLogicSVG.svg CctTableSVG.svg ConnSVG.svg CountingSVG.svg CrossbarSVG.svg \ - CrowSVG.svg CrullerSVG.svg CsourceSVG.svg \ - DecoderSVG.svg DemultiplexerSVG.svg DiodesSVG.svg DriveSVG.svg \ + CanLogicSVG.svg CctTableSVG.svg ConnSVG.svg ContactSVG.svg ContactsSVG.svg \ + CountingSVG.svg CrossbarSVG.svg CrowSVG.svg CrullerSVG.svg CsourceSVG.svg \ + DecoderSVG.svg DemultiplexerSVG.svg DiniSVG.svg DiodesSVG.svg DriveSVG.svg \ EmarrowsSVG.svg \ FlowSVG.svg FontsSVG.svg FusesSVG.svg GrayCodeSVG.svg GroundsSVG.svg \ HeadersSVG.svg HeathkitSVG.svg InclepsSVG.svg I2LSVG.svg JackSVG.svg \ @@ -42,8 +43,8 @@ CCTSVG = \ ex08SVG.svg ex09SVG.svg ex10SVG.svg ex11SVG.svg ex12SVG.svg \ ex15SVG.svg ex16SVG.svg ex17SVG.svg ex18SVG.svg ex21SVG.svg \ expSVG.svg fetSVG.svg graysurfSVG.svg lcctSVG.svg \ - pwrsupplySVG.svg quickSVG.svg randomSVG.svg recycleSVG.svg roseSVG.svg \ - sfgSVG.svg shapesSVG.svg paletteSVG.svg \ + pwrsupplySVG.svg quickSVG.svg randomSVG.svg recycleSVG.svg relaycoilSVG.svg \ + roseSVG.svg sfgSVG.svg shapesSVG.svg paletteSVG.svg \ thyristorSVG.svg ujtSVG.svg wormSVG.svg XORSVG.svg Np.svg examplesSVG.html: examplesSVG.htmx @@ -54,7 +55,9 @@ examplesSVG.html: examplesSVG.htmx SED = sed -e '/^\%/d' TEST = test -tst: $(TEST).pic +tst: + if test -f test.pic; then printf "\n\nUsage: make clean tst\n\n"; exit 1; fi + m4 $(M4LIBS) test.m4 | $(SED) > test.pic $(DPIC) -v $(TEST).pic > $(TEST).svg m4 $(M4LIBS) $(TEST).m4 | $(SED) > $(TEST).pic $(DPIC) -v $(TEST).pic > $(TEST).svg @@ -63,6 +66,7 @@ tst: $(TEST).pic make tstSVG.html test.pic: + if test -f test.pic ; then echo "Usage: make clean tst" ; fi m4 $(M4LIBS) test.m4 | $(SED) > test.pic tstSVG.html: tstSVG.htmx $(TEST).svg @@ -74,6 +78,13 @@ tstSVG.html: tstSVG.htmx $(TEST).svg xst: Incleps.png +AntiqueClockSVG.svg: + m4 $(M4LIBS) AntiqueClockSVG.m4 | sed -e '/^\%/d' > AntiqueClockSVG.pic + $(DPIC) -v AntiqueClockSVG.pic > AntiqueClockSVG.svg + m4 $(M4LIBS) AntiqueClockSVG.m4 | sed -e '/^\%/d' > AntiqueClockSVG.pic + $(DPIC) -v AntiqueClockSVG.pic > AntiqueClockSVG.svg + grep '<\!-- width' AntiqueClockSVG.svg | sed -e 's%<\!-- *%%' -e 's% *-->%%' > AntiqueClockSVG.siz + InclepsSVG.svg: InclepsSVG.m4 m4 $(M4LIBS) $*.m4 | sed -e '/^\%/d' > $*.pic $(DPIC) -v $*.pic > $*.svg diff --git a/graphics/circuit_macros/examples/svg/PconnSVG.m4 b/graphics/circuit_macros/examples/svg/PconnSVG.m4 index 066d397ca2..348a619317 100644 --- a/graphics/circuit_macros/examples/svg/PconnSVG.m4 +++ b/graphics/circuit_macros/examples/svg/PconnSVG.m4 @@ -24,8 +24,6 @@ P1: [ C3: pconnex(,ACF) with .w at last [].e+(0.2,0) `"(,ACF)"' at last [].s below - C4: pconnex(,P) with .w at last [].e+(0.2,0) - `"(,P)"' at (C4,last "") below C5: pconnex(U,D) with .w at last [].e+(0.2,0) `"(U,D)"' at last [].s below C6: pconnex(U,DF) with .w at last [].e+(0.2,0) @@ -37,7 +35,11 @@ P1: [ ] P2: [ - C9: pconnex(,G) + C4: pconnex(,P) + `"(,P)"' at last [].s below + C11: pconnex(,PF) with .w at last [].e+(0.2,0) + `"(,PF)"' at C11.s below + C9: pconnex(,G) with .w at C11.e+(0.2,0) `"(,G)"' at last [].s below C91: pconnex(,GF) with .w at last [].e+(0.2,0) `"(,GF)"' at last [].s below diff --git a/graphics/circuit_macros/examples/svg/RelaySVG.m4 b/graphics/circuit_macros/examples/svg/RelaySVG.m4 index df633176b0..f4b8152a50 100644 --- a/graphics/circuit_macros/examples/svg/RelaySVG.m4 +++ b/graphics/circuit_macros/examples/svg/RelaySVG.m4 @@ -1,80 +1,47 @@ .PS -# `Relay.m4' -cct_init(svg_font(sans-serif,11bp__)) - -{contact - {`"contact"' wid 0.8 at last [].s+(0,-0.2) - "svg_it(P)" rjust at last [].P.w - "svg_it(O)" ljust at last [].O - "svg_it(C)" ljust at last [].C } - move right_ 1.0; contact(R,) - {`"contact(,R)"' at last [].s+(0,-0.2) - "svg_it(P)" rjust at last [].P.w - "svg_it(O)" ljust at last [].O - "svg_it(C)" ljust at last [].C } - move right_ 1.0; contact(P) - {`"contact(P)"' at last [].s+(0,-0.2) - "svg_it(P)" rjust at last [].P.w - "svg_it(O)" ljust at last [].O - "svg_it(C)" ljust at last [].C } - move right_ 1.0; contact(O,); {`"contact(O,)"' at last [].s+(0,-0.2)} - move right_ 1.0; contact(C,); {`"contact(C,)"' at last [].s+(0,-0.2)} -} -move down 0.8 -right_ -{contact(I) - {`"contact(I)"' at last [].s+(0,-0.2) - "svg_it(P)" rjust at last [].P.w - "svg_it(O)" ljust at last [].O.e - "svg_it(C)" ljust at last [].C.e } - move right_ 1.0; contact(RI) - {`"contact(RI)"' at last [].s+(0,-0.2) - "svg_it(P)" rjust at last [].P.w - "svg_it(O)" ljust at last [].O.e - "svg_it(C)" ljust at last [].C.e } - move right_ 1.0; contact(PI) - {`"contact(PI)"' at last [].s+(0,-0.2) - "svg_it(P)" rjust at last [].P.w - "svg_it(O)" ljust at last [].O.e - "svg_it(C)" ljust at last [].C.e } - move right_ 1.0; contact(OI); {`"contact(OI)"' at last [].s+(0,-0.2)} - move right_ 1.0; contact(CI); {`"contact(CI)"' at last [].s+(0,-0.2) wid 1} -} -move down 1.3 -right_ -{ -relay - {"svg_it(V1)" rjust at last [].V1 +# RelaySVG +cct_init +svg_font(sans-serif,10bp__) + +skip = 1.1 + +R1:relay + {"svg_it(V1)" wid 0.16 rjust at last [].V1 "svg_it(V2)" ljust at last [].V2 - "svg_it(P1)" rjust at last [].P1.w + "svg_it(P1)" rjust at last [].P1-(dotrad_,0) "svg_it(O1)" ljust at last [].O1 "svg_it(C1)" ljust at last [].C1 } -`"relay"' at last [].s+(0,-0.2) -relay(2) with .sw at last [].sw+(1.2,0) + S: "svg_tt(`relay')" at last [].s+(0,-0.2) + +R5:relay(2,CTh) with .sw at last [].sw+(skip,0) + { for_(1,2,1,` + "svg_it(P`'m4x)" rjust at last [].P`'m4x-(dotrad_,0) + "svg_it(C`'m4x)" ljust at last [].C`'m4x ') } + "svg_tt((2,CTh))" at (last [],S) + +R4:relay(2,O) with .sw at last [].sw+(skip,0) + {for_(1,2,1,` + "svg_it(P1)" rjust at last [].P1-(dotrad_,0) + "svg_it(O`'m4x)" ljust at last [].O`'m4x ')} + "svg_tt((2,O))" at (last [],S) + +R3:relay(2,PIAX) with .sw at last [].sw+(skip,0) {"svg_it(V1)" rjust at last [].V1 - "svg_it(V2)" ljust at last [].V2 - "svg_it(P1)" rjust at last [].P1.w - "svg_it(O1)" ljust at last [].O1 - "svg_it(C1)" ljust below at last [].C1 - "svg_it(P2)" rjust at last [].P2.w - "svg_it(O2)" ljust at last [].O2 - "svg_it(C2)" ljust at last [].C2 } -`"relay(2)"' at last [].s+(0,-0.2) -relay(2,RPI) with .sw at last [].sw+(1.2,0) + "svg_it(V2)" rjust at last [].V2 + for_(1,2,1,` + "svg_it(P`'m4x)" rjust at last [].P`'m4x-(dotrad_,0) + "svg_it(O`'m4x)" ljust at last [].O`'m4x+(dotrad_,0) + "svg_it(C`'m4x)" ljust at last [].C`'m4x+(dotrad_,-2pt__) ') } + "svg_tt((2,PIAX))" at (last [],S) + +R2:relay(2,R) with .sw at last [].sw+(skip,0) {"svg_it(V1)" rjust at last [].V1 - "svg_it(V2)" ljust at last [].V2 - "svg_it(P1)" rjust at last [].P1.w - "svg_it(O1)" wid 0.2 ljust at last [].O1.e - "svg_it(C1)" wid 0.2 ljust at last [].C1.e+(0,2pt__) - "svg_it(P2)" rjust at last [].P2.w - "svg_it(O2)" wid 0.2 ljust at last [].O2.e+(0,-2pt__) - "svg_it(C2)" wid 0.2 ljust at last [].C2.e } -`"relay(2,RIP)"' at last [].s+(0,-0.2) -relay(2,O) with .sw at last [].sw+(1.2,0) -`"relay(2,O)"' at last [].s+(0,-0.2) -relay(2,CT) with .sw at last [].sw+(1.2,0) -`"relay(2,CT)"' at last [].s+(0,-0.2) -} + "svg_it(V2)" wid 0.2 ljust at last [].V2 + for_(1,2,1,` + "svg_it(P`'m4x)" rjust at last [].P`'m4x-(dotrad_,0) + "svg_it(O`'m4x)" ljust at last [].O`'m4x + "svg_it(C`'m4x)" ljust at last [].C`'m4x ') } + "svg_tt(`relay(2,R)')" at (last [],S) - command "</g>" # end font + command "</g>)" # end font .PE diff --git a/graphics/circuit_macros/examples/svg/ShiftRSVG.m4 b/graphics/circuit_macros/examples/svg/ShiftRSVG.m4 index 9c8aa65a1c..022f4ced9f 100644 --- a/graphics/circuit_macros/examples/svg/ShiftRSVG.m4 +++ b/graphics/circuit_macros/examples/svg/ShiftRSVG.m4 @@ -1,13 +1,14 @@ .PS # ShiftR.m4 log_init(svg_font(sans-serif,11*0.9bp__)) +textoffset = textht/6 define(`lg_plen',3) -define(`customFF', - `FlipFlopX(wid 10*L_unit ht FF_ht*L_unit,, - : S;NE:CK;: R, N:PR, :Q;;ifelse(`$1',1,:Q), N:CLR, - ifelse(`$1',1,line right 5bp__ at 2nd last ""+(-7bp__,4bp__)))') +define(`customFF',`FlipFlopX(wid 10*L_unit ht FF_ht*L_unit,, + :S;NE:CK;:R, N:PR, :Q;;ifelse(`$1',1,:Q), N:CLR,, + ifelse(`$1',1, + line right textht with .end at 2nd last ""+(-textoffset,0.4*textht)))') F0: customFF(1) @@ -21,7 +22,7 @@ define(`customFF', NCLR: NOT_gate(right T.x-Serial.x from (Serial,F0.S1.end),N) "CLEAR" at NCLR.start rjust - line left textht*2.3 from last ""+(-0.3,0.6)*textht + line left textht*5 from last ""+(-textoffset,0.8*textht) CLK: NOT_gate(right T.x-Serial.x from NCLR.start+(0,-BUF_ht*3/2*L_unit)) "CLOCK" at CLK.start rjust diff --git a/graphics/circuit_macros/examples/svg/SierpinskiSVG.m4 b/graphics/circuit_macros/examples/svg/SierpinskiSVG.m4 index 7fbf13bf15..08d7fab111 100644 --- a/graphics/circuit_macros/examples/svg/SierpinskiSVG.m4 +++ b/graphics/circuit_macros/examples/svg/SierpinskiSVG.m4 @@ -13,7 +13,7 @@ gen_init } } - r = 4 + r = 3 linethick = 0.2 #linethick = 1/2 /(1pt__) lw = linethick pt__ /2 @@ -35,20 +35,20 @@ gen_init define CayleyGraph { if $3 > 0 then { { line to Here+(cosd($2),sind($2))*($1) - exec sprintf("CayleyGraph(%g,%g,%g);",0.5*($1),$2,$3-1); } + exec sprintf("CayleyGraph(%g,%g,%g);", ($1)/2, $2, $3-1); } { line to Here+(cosd($2+90),sind($2+90))*($1) - exec sprintf("CayleyGraph(%g,%g,%g);",0.5*($1),$2+90,$3-1); } + exec sprintf("CayleyGraph(%g,%g,%g);", ($1)/2, $2+90, $3-1); } { line to Here+(cosd($2-90),sind($2-90))*($1) - exec sprintf("CayleyGraph(%g,%g,%g);",0.5*($1),$2-90,$3-1); } + exec sprintf("CayleyGraph(%g,%g,%g);", ($1)/2, $2-90, $3-1); } } } size = 2 depth = 6 for t=0 to 270 by 90 do { - line from (0,0) to (cosd(t),sind(t)); + line from (0,0) to (cosd(t),sind(t))*size/2; { exec sprintf("CayleyGraph(%g,%g,%g);",size/4,t,depth); } } - ] with .sw at last [].se+(-0.25,0) + ] scaled 3/4 with .sw at last [].se+(-0.25,0) .PE diff --git a/graphics/circuit_macros/examples/svg/SwitchesSVG.m4 b/graphics/circuit_macros/examples/svg/SwitchesSVG.m4 index 8808e5be27..04fc2f52c5 100644 --- a/graphics/circuit_macros/examples/svg/SwitchesSVG.m4 +++ b/graphics/circuit_macros/examples/svg/SwitchesSVG.m4 @@ -4,100 +4,116 @@ cct_init(svg_font(sans-serif,11bp__,2bp__)) textoffset = 3bp__ movewid = 0.25 -moveht = moveht*1.25 +# Row 1 right_; { - lswitch; rlabel(,"``lswitch''") + lswitch; {S:"svg_tt(`lswitch')" at last [].s+(0,-10bp__)} move right_ - lswitch(,,O); rlabel(,"`(,,O)'") + lswitch(,,O); {"svg_tt(`(,,O)')" at (last [],S)} move right_ - lswitch(,,C); rlabel(,"`(,,C)'") + lswitch(,,C); {"svg_tt(`(,,C)')" at (last [],S)} move right_ - lswitch(,,DA); rlabel(,"`(,,DA)'") + lswitch(,,DA); {"svg_tt(`(,,DA)')" at (last [],S)} move right_ - lswitch(,,DO); rlabel(,"`(,,DO)'") + lswitch(,,dDO); {"svg_tt(`(,,dDO)')" at (last [],S)} move right_ - lswitch(,,DC); rlabel(,"`(,,DC)'") + lswitch(,,uDC); {"svg_tt(`(,,uDC)')" at (last [],S)} } +# Row 2 move down; right_; { - lswitch(,,K); rlabel(,"`(,,K)'") + lswitch(,,K); {S:"svg_tt(`(,,K)')" at last [].s+(0,-10bp__)} move right_ - lswitch(,,KD); rlabel(,"`(,,KD)'") + lswitch(,,KD); {"svg_tt(`(,,KD)')" at (last [],S)} move right_ - lswitch(,,KOD); rlabel(,"`(,,KOD)'") + lswitch(,,KOD); {"svg_tt(`(,,KOD)')" at (last [],S)} move right_ - lswitch(,,KCD); rlabel(,"`(,,KCD)'") + lswitch(,,KCD); {"svg_tt(`(,,KCD)')" at (last [],S)} move right_ - bswitch; rlabel(,"``bswitch''") + bswitch; {"svg_tt(``bswitch'')" at (last [],S)} move right_ - bswitch(,,C); rlabel(,"`(,,C)'") + bswitch(,,C); {"svg_tt(`(,,C)')" at (last [],S)} } +# Row 3 move down; right_; { - S: dswitch(,,) - ifgpic(`{[line invis] at S.c+(0,-0.2)}') - rlabel(,"``dswitch=''") - { "`switch(,,,D)'" at last [].s + (0,-0.23) } - thinlines_ - { spline <- from 0.25 along_(S) up 0.1 then up 0.05 left 0.1 - "W" wid 8bp__ at Here+(-5bp__,0) - spline <- from S.c+(0,m4sc*2) up 0.1 then up 0.05 left 0.1 - "B" wid 5bp__ at Here+(-5bp__,0) } - thicklines_ - move right_ - S: dswitch(,,WdBK); rlabel(,"`(,,WdBK)'") - thinlines_ - { spline <- from tr_xy(0,-2) up 0.1 then up 0.10 left 0.1 - "dB" rjust - spline <- from tr_xy(4,-2) right 0.1 then right 0.05 up 0.15 - "K" above } - thicklines_ - move right_ - dswitch(,,WBuD); rlabel(,"`(,,WBuD)'") - move right_ - dswitch(,,WdBKF); rlabel(,"`(,,WdBKF)'") - move right_ - dswitch(,,WBL); rlabel(,"`(,,WBL)'") - move right_ - dswitch(,,WdBKL); rlabel(,"`(,,WdBKL)'") + D: dswitch(,,); {S: "svg_tt(`dswitch(,,)')" at last [].s+(0,-10bp__)} + thinlines_ + { spline <- from 0.25 along_(D) up 0.1 then up 0.05 left 0.1 + {"svg_tt(`W')" rjust} + spline <- from D.c+(0,m4sc*2) up 0.1 then up 0.05 left 0.1 + {"svg_tt(`B')" rjust }} + thicklines_ + move right_ + D: dswitch(,,WdBK); {"svg_tt(`(,,WdBK)')" at (last [],S)+(0,-4bp__)} + thinlines_ + { spline <- from tr_xy(0,-2) up 0.1 then up 0.10 left 0.1 + {"svg_tt(`dB')" rjust} + spline <- from tr_xy(4,-2) right 0.1 then right 0.05 up 0.15 + {"svg_tt(`K')" above }} + thicklines_ + move right_ + dswitch(,,WBmdDK); {"svg_tt(`(,,WBmdDK)')" at (last [],S)} + move right_ + dswitch(,,WBKTr); {"svg_tt(`(,,WBKTr)')" at (last [],S)} + move right_ + dswitch(,,WdBL); {"svg_tt(`(,,WdBL)')" at (last [],S+(0,-4bp__))} + move right_ + dswitch(,,WBCo); {"svg_tt(`(,,WBCo)')" at (last [],S)} } +# Row 4 move down; right_; { - dswitch(,,WBT); rlabel(,"`(,,WBT)'") + dswitch(,,WBKCo); {S: "svg_tt(`(,,WBKCo)')" at last [].s+(0,-10bp__)} move right_ - dswitch(,,WdBKC); rlabel(,"`(,,WdBKC)'") + dswitch(,,WBCb); {"svg_tt(`(,,WBCb)')" at (last [],S)} move right_ - dswitch(,,WBM); rlabel(,"`(,,WBM)'") + dswitch(,,WBDI); {"svg_tt(`(,,WBDI)')" at (last [],S)} move right_ - dswitch(,,WBCO); rlabel(,"`(,,WBCO)'") + dswitch(,,WBSd); {"svg_tt(`(,,WBSd)')" at (last [],S)} move right_ - dswitch(,,WBMP); rlabel(,"`(,,WBMP)'") + dswitch(,,WBFDI); {"svg_tt(`(,,WBFDI)')" at (last [],S)} move right_ - dswitch(,,WBoKCP); rlabel(,"`(,,WBoKCP)'") + dswitch(,,WBFSd); {"svg_tt(`(,,WBFSd)')" at (last [],S)} } - move down; right_; { - dswitch(,,WBCY); rlabel(,"`(,,WBCY)'") +# Row 5 + move down moveht*5/4; right_; { + dswitch(,,WBTh); {S: "svg_tt(`(,,WBTh)')" at last [].s+(0,-10bp__)} + move right_ + dswitch(,,WBKC); {"svg_tt(`(,,WBKC)')" at (last [],S)} + move right_ + dswitch(,,WBM); {"svg_tt(`(,,WBM)')" at (last [],S)} + move right_ + dswitch(,,WBCO); {"svg_tt(`(,,WBCO)')" at (last [],S)} + move right_ + dswitch(,,WBMP); {"svg_tt(`(,,WBMP)')" at (last [],S)} + move right_ + dswitch(,,WBoKCP); {"svg_tt(`(,,WBoKCP)')" at (last [],S)} + } +# Row 6 + move down moveht*5/4; right_; { + dswitch(,,WBCY); {S: "svg_tt(`(,,WBCY)')" at last [].s+(0,-10bp__)} move right_ - dswitch(,,WBCZ); rlabel(,"`(,,WBCZ)'") + dswitch(,,WBCZ); {"svg_tt(`(,,WBCZ)')" at (last [],S)} move right_ - dswitch(,,WBCE); rlabel(,"`(,,WBCE)'") + dswitch(,,WBCE); {"svg_tt(`(,,WBCE)')" at (last [],S)} move right_ - dswitch(,,WBRH); rlabel(,"`(,,WBRH)'") + dswitch(,,WBRH); {"svg_tt(`(,,WBRH)')" at (last [],S)} move right_ - dswitch(,,WBRdH); rlabel(,"`(,,WBRdH)'") + dswitch(,,WBRdH); {"svg_tt(`(,,WBRdH)')" at (last [],S)} move right_ - dswitch(,,WBRHH); rlabel(,"`(,,WBRHH)'") + dswitch(,,WBRHH); {"svg_tt(`(,,WBRHH)')" at (last [],S)} } +# Row 7 move down; right_; { - dswitch(,,WBMMR); rlabel(,"`(,,WBMMR)'") + dswitch(,,WBMMR); {S: "svg_tt(`(,,WBMMR)')" at last [].s+(0,-10bp__)} move right_ - dswitch(,,WBMM); rlabel(,"`(,,WBMM)'") + dswitch(,,WBMM); {"svg_tt(`(,,WBMM)')" at (last [],S)} move right_ - dswitch(,,WBMR); rlabel(,"`(,,WBMR)'") + dswitch(,,WBMR); {"svg_tt(`(,,WBMR)')" at (last [],S)} move right_ - dswitch(,,WBEL); rlabel(,"`(,,WBEL)'") + dswitch(,,WBEL); {"svg_tt(`(,,WBEL)')" at (last [],S)} move right_ - dswitch(,,WBLE); rlabel(,"`(,,WBLE)'") + dswitch(,,WBLE); {"svg_tt(`(,,WBLE)')" at (last [],S)} move right_ - dswitch(,,WdBKEL); rlabel(,"`(,,WdBKEL)'") + dswitch(,,WBoKEL); {"svg_tt(`(,,WBoKEL)')" at (last [],S)} } - command "</g>" # end font + command "</g>')" # end font .PE diff --git a/graphics/circuit_macros/examples/svg/ex02SVG.m4 b/graphics/circuit_macros/examples/svg/ex02SVG.m4 index 9ec72d8e2a..ad2f7324fb 100644 --- a/graphics/circuit_macros/examples/svg/ex02SVG.m4 +++ b/graphics/circuit_macros/examples/svg/ex02SVG.m4 @@ -1,6 +1,7 @@ .PS # ex02.m4 cct_init +linewid = linewid*4/5 [ [ for angle = 0 to 315 by 45 do { Point_(angle) diff --git a/graphics/circuit_macros/examples/svg/examplesSVG.htmx b/graphics/circuit_macros/examples/svg/examplesSVG.htmx index d4f45ecdef..91bc93f48e 100644 --- a/graphics/circuit_macros/examples/svg/examplesSVG.htmx +++ b/graphics/circuit_macros/examples/svg/examplesSVG.htmx @@ -84,9 +84,10 @@ There are a number of other issues: giving reasonable dimensions in pixels but this has to be insterted into the <embed or <object line. A makefile does it easily but otherwise this could be tedious. - <li> The font face is not specified by default in these diagrams but is - inherited from the enclosing document. The default appearance of labels can - differ according to the browser. + <li> The default font face is not specified in all of these diagrams but is + inherited from the enclosing document, so the appearance of labels can + differ depend on the browser. Some of these diagrams set the font at + the beginning of the diagram source. <li> The <svg tag may require modification from the default used for this test. Dpic might be modified to allow the generation of custom headers but that has not yet been done. @@ -116,8 +117,8 @@ There are a number of other issues: m4tt`'svg_font(font-family="Times")</g><br> m4tt`'svg_font(font-family="Times" font-style="italic")</g><br> m4tt`'svg_font(style="font-family:Times; font-style:italic")</g> - <li>m4tt svg_tspan(</g>text attributes`'m4tt)</g>; - e.g. m4tt`'svg_tspan(font-style="italic" font-size="75%")</g> + <li>m4tt svg_tspan(</g>text attributes, text`'m4tt)</g>; + e.g. m4tt`'svg_tspan(font-style="italic" font-size="75%",XYZ)</g> <li>m4tt svg_it(</g>text`'m4tt)</g>: for italics <li>m4tt svg_tt(</g>text`'m4tt)</g>: for monospace (courier) <li>m4tt svg_norm(</g>text`'m4tt)</g>: for normal text @@ -267,8 +268,11 @@ cfig(AntennasSVG) cfig(AudioSVG) cfig(OpampSVG) cfig(XformSVG) -cfig(RelaySVG) cfig(NPDTSVG) +cfig(ContactSVG) +cfig(ContactsSVG) +cfig(relaycoilSVG) +cfig(RelaySVG) cfig(JackSVG) cfig(ConnSVG) cfig(PconnSVG) @@ -281,7 +285,7 @@ cfig(TgateSVG) cfig(NportSVG) cfig(NLGSVG) cfig(WindingsSVG) -cfig(ex01SVG) +cfig(ex01.m4) cfig(TimerSVG) cfig(OptoisoSVG) cfig(MixerSVG) @@ -294,6 +298,7 @@ cfig(MCSVG) cfig(ex10SVG) cfig(ThreeSVG) cfig(ex17SVG) +cfig(ex02SVG) cfig(ex12SVG) cfig(pwrsupplySVG) cfig(TTLnandSVG) @@ -306,7 +311,6 @@ cfig(DriveSVG) cfig(ex16SVG) cfig(ex03SVG) cfig(MotorControlSVG) -cfig(ex02SVG) cfig(RectifiersSVG) cfig(HeathkitSVG) cfig(lcctSVG) @@ -324,27 +328,27 @@ cfig(CanLogicSVG) cfig(AlogixSVG) cfig(ABlogixSVG) cfig(XORSVG) -cfig(paletteSVG) cfig(ex00SVG) +cfig(controlSVG) cfig(GrayCodeSVG) cfig(CrossbarSVG) cfig(ByteSVG) cfig(RotboxSVG) +cfig(ex06SVG) +cfig(ex09SVG) +cfig(ex05SVG) +cfig(LoglogSVG) cfig(randomSVG) cfig(expSVG) cfig(graysurfSVG) -cfig(CrullerSVG) cfig(shapesSVG) -cfig(ex09SVG) -cfig(ex05SVG) -cfig(controlSVG) -cfig(ex06SVG) -cfig(LoglogSVG) +cfig(AntiqueClockSVG) cfig(cscSVG) cfig(roseSVG) cfig(diamondSVG) cfig(wormSVG) cfig(ButtonsSVG) +cfig(DiniSVG) cfig(SierpinskiSVG) cfig(recycleSVG) cfig(ex15SVG) diff --git a/graphics/circuit_macros/examples/svg/relaycoilSVG.m4 b/graphics/circuit_macros/examples/svg/relaycoilSVG.m4 new file mode 100644 index 0000000000..fc2bc2738f --- /dev/null +++ b/graphics/circuit_macros/examples/svg/relaycoilSVG.m4 @@ -0,0 +1,47 @@ +.PS +# relaycoil.m4 +cct_init + + spc = dimen_/3 +{ relaycoil; S: "svg_tt(`relaycoil')" at last [].s+(0,-20bp__) + { "svg_it(V1)" wid 15bp__ at last [].V1 rjust + "svg_it(V2)" at last [].V2 ljust } + K: relaycoil(NX) with .nw at last [].ne+(spc*4,0); "svg_tt((NX))" \ + at (last [],S) + { thinlines_ + spline <- from K.A1 left 7bp__ then up 4bp__ left 4bp__ + "svg_it(A1)" rjust + arrow <- from K.A2 left 10bp__; "svg_it(A2)" rjust + spline <- from K.A3 left 7bp__ then down 4bp__ left 4bp__ + "svg_it(A3)" rjust + spline <- from K.B1 right 7bp__ then up 4bp__ right 4bp__ + "svg_it(B1)" ljust + arrow <- from K.B2 right 10bp__; "svg_it(B2)" ljust + spline <- from K.B3 right 7bp__ then down 4bp__ right 4bp__ + "svg_it(B3)" ljust + thicklines_ + } + relaycoil(AXSR) with .nw at last [].ne+(spc*5,0); "svg_tt((AXSR))" \ + at (last [],S) + { "svg_it(V1)" at last [].V1 rjust; "svg_it(V2)" at last [].V2 rjust } + relaycoil(BXSR) with .nw at last [].ne+(spc*2,0); "svg_tt((BXSR))" \ + at (last [],S) + { "svg_it(V1)" at last [].V1 ljust; "svg_it(V2)" at last [].V2 ljust } + relaycoil(SR) with .nw at last [].ne+(spc*4,0); "svg_tt((SR))" at (last [],S) + relaycoil(SO) with .nw at last [].ne+(spc,0); "svg_tt((SO))" at (last [],S) + relaycoil(SOR) with .nw at last [].ne+(spc,0); "svg_tt((SOR))" at (last [],S) + } +{ + move down_ 3/4; right_ + relaycoil(HS); S: "svg_tt((HS))" at last [].s+(0,-12bp__) + relaycoil(NAC) with .nw at last [].ne+(spc,0); "svg_tt((NAC))" at (last [],S) + relaycoil(AC) with .nw at last [].ne+(spc,0); "svg_tt((AC))" at (last [],S) + relaycoil(ML) with .nw at last [].ne+(spc,0); "svg_tt((ML))" at (last [],S) + relaycoil(PO) with .nw at last [].ne+(spc,0); "svg_tt((PO))" at (last [],S) + relaycoil(RM) with .nw at last [].ne+(spc,0); "svg_tt((RM))" at (last [],S) + relaycoil(RH) with .nw at last [].ne+(spc,0); "svg_tt((RH))" at (last [],S) + relaycoil(TH) with .nw at last [].ne+(spc,0); "svg_tt((TH))" at (last [],S) + relaycoil(EL) with .nw at last [].ne+(spc,0); "svg_tt((EL))" at (last [],S) + } + +.PE diff --git a/graphics/circuit_macros/examples/svg/tstSVG.htmx b/graphics/circuit_macros/examples/svg/tstSVG.htmx index 1dd990c82a..f15d09b7c7 100644 --- a/graphics/circuit_macros/examples/svg/tstSVG.htmx +++ b/graphics/circuit_macros/examples/svg/tstSVG.htmx @@ -70,8 +70,8 @@ more basic. m4tt`'svg_font(font-family="Times")</g><br> m4tt`'svg_font(font-family="Times" font-style="italic")</g><br> m4tt`'svg_font(style="font-family:Times; font-style:italic")</g> - <li>m4tt svg_tspan(</g>text attributes`'m4tt)</g>; - e.g. m4tt`'svg_tspan(font-style="italic" font-size="75%")</g> + <li>m4tt svg_tspan(</g>text attributes, text`'m4tt)</g>; + e.g. m4tt`'svg_tspan(font-style="italic" font-size="75%",XYZ)</g> <li>m4tt svg_it(</g>text`'m4tt)</g>: for italics <li>m4tt svg_tt(</g>text`'m4tt)</g>: for monospace (courier) <li>m4tt svg_norm(</g>text`'m4tt)</g>: for normal text diff --git a/graphics/circuit_macros/examples/svg/xx.html b/graphics/circuit_macros/examples/svg/xx.html deleted file mode 100644 index 6b4881d450..0000000000 --- a/graphics/circuit_macros/examples/svg/xx.html +++ /dev/null @@ -1,11 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" version="1.1"> -<g> - <text x = "10" y = "25" font-size = "20"> - <tspan x = "10" y = "60"> - T<tspan dy="10">i+2</tspan> - <tspan dy="-10">= T</tspan><tspan dy="10">i</tspan> - <tspan dy="-10">+ T</tspan><tspan dy="10">i+1</tspan> - </tspan> - </text> - </g> -</svg> diff --git a/graphics/circuit_macros/examples/testpdf.tex b/graphics/circuit_macros/examples/testpdf.tex index 823b297b34..7ff3664707 100644 --- a/graphics/circuit_macros/examples/testpdf.tex +++ b/graphics/circuit_macros/examples/testpdf.tex @@ -6,7 +6,7 @@ % \documentclass[11pt]{article} \usepackage{ps4pdf} -\usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits} +\usepackage{siunitx} \PSforPDF{ \usepackage{pstricks} } \pagestyle{empty} \thispagestyle{empty} diff --git a/graphics/circuit_macros/examples/thyristor.m4 b/graphics/circuit_macros/examples/thyristor.m4 new file mode 100644 index 0000000000..ecc6448bf3 --- /dev/null +++ b/graphics/circuit_macros/examples/thyristor.m4 @@ -0,0 +1,118 @@ +.PS +# `thyristor.m4' +cct_init + +define labels { { + "\sl $1" ht 11 pt__ $2 at last[].$1 + "\sl $3" $4 at last[].$3 + "\sl $5" $6 at last[].$5 + "\tt $7" ht 11 pt__ $9 at (last[].s+(0,$8)) } } + +down_ +Row1: [ + {thyristor + labels(A,above,K,below,G,ljust,`thyristor',-0.25,wid 0.75) } + + move right 0.50 ; down_ + {thyristor(,B) + labels(T1,above,T2,below,G,below ljust,`...(,B)',-0.35) } + + move right 0.50 ; down_ + {thyristor(down_ dimen_*0.8,BRK) + labels(T1,above,T2,below,G,below rjust,`...(,BRK)',-0.22) } + + move right 0.60 ; down_ + {thyristor(,BE) + labels(T1,above,T2,below,G,below ljust,`...(,BE)',-0.35) } + + move right 0.50 ; down_ + {thyristor(,A) at (Here,last []) + labels(A,above,K,below,G,ljust,`...(,A)',-0.35) } + + move right 0.50 ; down_ + {thyristor(,F) at (Here,last []) + labels(A,above,K,below,G,ljust,`...(,F)',-0.22) } + + move right 0.65 ; down_ + {thyristor(,BRE) + labels(T1,above,T2,below,G,below rjust,`...(,BRE)',-0.35) } + + move right 0.75 ; down_ + {thyristor(,UARE) at (Here,last []) + labels(A,above,K,below,G,rjust below,`...(,UARE)',-0.22) } + + move right 0.50 ; down_ + {thyristor(,AV,G: G+(0.1,0.1)) at (Here,last []) + thinlines_ + spline -> from last[].G left 0.05 then left 0.05 down 0.1 + thicklines_ + labels(A,above,K,below,G,ljust,`...(,AV)',-0.35) } + + move right 0.50 ; down_ + {thyristor(,IEC) + labels(A,above ljust,K,below ljust,G,ljust,`...(,IEC)',-0.22) } + ] +Row2: [ + down_ + {thyristor(,UAH) + labels(A,rjust above,K,rjust below,G,ljust,`...(,UAH)',-0.35,wid 0.65) } + + move right 0.55 ; down_ + {thyristor(,N) at (Here,last []) + labels(A,above,K,below,Ga,rjust,`...(,N)',-0.22) } + + move right 0.55 ; down_ + {thyristor(,UANRE) at (Here,last []) + labels(A,above,K,below,Ga,ljust above,`...(,UANRE)',-0.35) } + move right 0.55 ; down_ + {thyristor(,SCR) at (Here,last []) + labels(A,above,K,below rjust,G,below ljust,`...(,SCR)',-0.22) } + + move right 0.55 ; down_ + {thyristor(,SCRE) at (Here,last []) + labels(A,above,K,below,G,ljust below,`...(SCRE)',-0.35) } + + move right 0.65 ; down_ + {thyristor(,SCRRE) at (Here,last []) + labels(A,above,K,below,G,rjust below,`...(SCRRE)',-0.22) } + + move right 0.55 ; down_ + {thyristor(,SCS) at (Here,last []) + labels(A,above,K,below,G,ljust,`...(SCS)',-0.35) } + { "\sl Ga" rjust above at last[].Ga } + + move right 0.55 ; down_ + {thyristor(,SCSE) at (Here,last []) + labels(A,above,K,below,G,ljust below,`...(SCSE)',-0.22) } + { "\sl Ga" rjust above at last[].Ga } + + move right 0.65 ; down_ + {thyristor(,SUSE) at (Here,last []) + labels(A,above,K,below,G,rjust,`...(SUSE)',-0.35) } + + move right 0.65 ; down_ + {thyristor(,SBSE) at (Here,last []) + labels(T1,above,T2,below,G,rjust,`...(SBSE)',-0.22) } + + ] with .nw at Row1.sw + (0,-0.20) + +Twoterms: [ right_ + { scr(,,Q) ; `"\tt scr(,{,}Q)"' at last [].e ljust} + { "\sl Q.G" at Q.G above } + + move down 0.4; right_ + { scs(,,Q2) ; `"\tt scs(,{,}Q2)"' at last [].e ljust } + { "\sl Q2.G" at Q2.G above } + { "\sl Q2.Ga" at Q2.Ga below } + ] with .nw at Row2.sw+(0,-0.2) + + [ right_ + { sus(,RE,Q3) ; `"\tt sus(,RE,Q3)"' at last [].e ljust} + { "\sl Q3.G" at Q3.G above } + + move right_ 1.2 from last line.end + { sbs(,E,Q4) ; `"\tt sbs(,E,Q4)"' at last [].e ljust} + { "\sl Q4.G" at Q4.G below } + ] with .w at last [].e+(1.0,0) + +.PE diff --git a/graphics/circuit_macros/examples/tikz.tex b/graphics/circuit_macros/examples/tikz.tex index df8ae91f82..fc3f4c17dc 100644 --- a/graphics/circuit_macros/examples/tikz.tex +++ b/graphics/circuit_macros/examples/tikz.tex @@ -1,6 +1,6 @@ \documentclass[11pt]{article} \usepackage{tikz} -\usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits} +\usepackage{siunitx} \usepackage[T1]{fontenc} \usepackage{boxdims} \addtolength{\textwidth}{2cm} diff --git a/graphics/circuit_macros/examples/tst.tex b/graphics/circuit_macros/examples/tst.tex index 46992a001f..c4549a1631 100644 --- a/graphics/circuit_macros/examples/tst.tex +++ b/graphics/circuit_macros/examples/tst.tex @@ -4,7 +4,7 @@ \usepackage{pstricks,pst-slpe,pst-grad} \usepackage{boxdims} \usepackage{upgreek} -\usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits} +\usepackage{siunitx} \usepackage{amssymb} % %\addtolength{\textwidth}{2cm} diff --git a/graphics/circuit_macros/examples/tst1.tex b/graphics/circuit_macros/examples/tst1.tex index 95363d1d9c..393c675149 100644 --- a/graphics/circuit_macros/examples/tst1.tex +++ b/graphics/circuit_macros/examples/tst1.tex @@ -1,7 +1,7 @@ %\documentclass{article} \documentclass[11pt]{article} \usepackage{graphicx} -\usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits} +\usepackage{siunitx} \usepackage{boxdims} \pagestyle{empty} diff --git a/graphics/circuit_macros/examples/ujt.m4 b/graphics/circuit_macros/examples/ujt.m4 new file mode 100644 index 0000000000..aa4e708462 --- /dev/null +++ b/graphics/circuit_macros/examples/ujt.m4 @@ -0,0 +1,28 @@ +.PS +# `ujt.m4' +cct_init +dwn = 1.0 +dsep = 0.15 + +define(`demo_ujt',`Q: ujt(`$1',`$2',`$3',`$4') + "\sl B1" ifelse(`$5',,below,ljust) at last [].B1 + "{\sl E}sp_" at 1.5 between last [].Bulk.c and last [].E + "\sl B2" ifelse(`$5',,above,ljust) at last [].B2 + ') + +[demo_ujt(up_ dimen_,,,E,A) +`"{\tt ujt(up\_ dimen\_,{,},E)}"' wid 1.45 ht 0.1 at Q.s+(0,-0.15) ] + +[demo_ujt(,,P,) +`"{\tt ujt(,{,}P,)}"' at Q.s+(0.1,-dsep) below ] \ +with .Q.w at last [].Q.e+(0.85,0) + +[demo_ujt(,R,,) +`"{\tt ujt(,R,{,})}"' at Q.s+(0,-dsep) below] \ +with .Q.w at last [].Q.e+(0.8,0) + +[demo_ujt(,R,P,) +`"{\tt ujt(,R,P,)}"' at Q.s+(0,-dsep) below] \ +with .Q.w at last [].Q.e+(0.8,0) + +.PE diff --git a/graphics/circuit_macros/examples/windows.m4 b/graphics/circuit_macros/examples/windows.m4 index da6b9e0e51..1b2a904af0 100644 --- a/graphics/circuit_macros/examples/windows.m4 +++ b/graphics/circuit_macros/examples/windows.m4 @@ -1,6 +1,7 @@ divert(-1) +# This file is used if the CUSTOM= function is turned on in Makefile -# Change the absolute Windwos path to your installation directory: +# Change the absolute Windows path to your installation directory: define(`NeedDpicTools',`if "dpictools" != "1" then { copy "D:\Dwight\lib\dpictools.pic" } define(`dfitcurve__') ') diff --git a/graphics/circuit_macros/examples/xfig/xfiglib.fig b/graphics/circuit_macros/examples/xfig/xfiglib.fig index d567d99933..386844bc5c 100644 --- a/graphics/circuit_macros/examples/xfig/xfiglib.fig +++ b/graphics/circuit_macros/examples/xfig/xfiglib.fig @@ -6,7 +6,7 @@ Letter 100.00 Single -2 -# dpic version 2019.12.31 option -x for Fig 3.2 +# dpic version 2020.03.01 option -x for Fig 3.2 1200 2 6 0 0 3975 5025 6 0 0 3975 5025 |