From d2f68b646eb0ca42dcb488171a6e36ea3da68a5d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 16 Oct 2019 03:01:51 +0000 Subject: CTAN sync 201910160301 --- graphics/circuit_macros/CHANGES | 4 + graphics/circuit_macros/Copying | 2 +- graphics/circuit_macros/README | 11 +- graphics/circuit_macros/darrow.m4 | 2 +- graphics/circuit_macros/doc/CctTable.m4 | 5 +- graphics/circuit_macros/doc/Circuit_macros.bib | 7 + graphics/circuit_macros/doc/Circuit_macros.pdf | Bin 909464 -> 911278 bytes graphics/circuit_macros/doc/Circuit_macros.tex | 4 +- graphics/circuit_macros/doc/Version.tex | 2 +- graphics/circuit_macros/doc/body.tex | 4 +- graphics/circuit_macros/doc/defines.tex | 17 + graphics/circuit_macros/dpictools.pic | 26 +- graphics/circuit_macros/examples/GrayCode.m4 | 20 ++ graphics/circuit_macros/examples/Inclpdf.m4 | 2 +- graphics/circuit_macros/examples/Makefile | 18 +- graphics/circuit_macros/examples/Planes.m4 | 95 +++++ graphics/circuit_macros/examples/Rotbox.m4 | 4 +- graphics/circuit_macros/examples/Sierpinski.m4 | 31 +- graphics/circuit_macros/examples/Tubediags.m4 | 381 +++++++++++++++++++++ graphics/circuit_macros/examples/Zcos.m4 | 29 ++ graphics/circuit_macros/examples/examples.pdf | Bin 1068937 -> 1144010 bytes graphics/circuit_macros/examples/files.tex | 30 +- graphics/circuit_macros/examples/graysurf.m4 | 2 +- graphics/circuit_macros/examples/ics.m4 | 48 ++- graphics/circuit_macros/examples/lcct.m4 | 17 +- graphics/circuit_macros/examples/mf/Makefile | 3 + graphics/circuit_macros/examples/mf/cct.mf | 30 +- graphics/circuit_macros/examples/mf/font.m4 | 2 +- graphics/circuit_macros/examples/mpost/Makefile | 6 +- graphics/circuit_macros/examples/pgf/Makefile | 31 +- graphics/circuit_macros/examples/psfrag/Makefile | 17 +- graphics/circuit_macros/examples/random.m4 | 2 - graphics/circuit_macros/examples/shapes.m4 | 3 +- graphics/circuit_macros/examples/svg/AdderSVG.m4 | 2 +- graphics/circuit_macros/examples/svg/Banking.txt | 54 --- .../circuit_macros/examples/svg/GrayCodeSVG.m4 | 20 ++ graphics/circuit_macros/examples/svg/Makefile | 7 +- graphics/circuit_macros/examples/svg/RotboxSVG.m4 | 4 +- .../circuit_macros/examples/svg/SierpinskiSVG.m4 | 30 +- .../circuit_macros/examples/svg/TubediagsSVG.m4 | 361 +++++++++++++++++++ .../circuit_macros/examples/svg/examplesSVG.htmx | 4 +- .../circuit_macros/examples/svg/graysurfSVG.m4 | 4 +- graphics/circuit_macros/examples/svg/icsSVG.m4 | 13 +- graphics/circuit_macros/examples/svg/lcctSVG.m4 | 17 +- graphics/circuit_macros/examples/tst.tex | 6 +- graphics/circuit_macros/examples/tubedefs.m4 | 260 ++++++++++++++ graphics/circuit_macros/examples/xfig/xfiglib.fig | 2 +- graphics/circuit_macros/gpic.m4 | 2 +- graphics/circuit_macros/lib3D.m4 | 3 +- graphics/circuit_macros/libcct.m4 | 2 +- graphics/circuit_macros/libgen.m4 | 22 +- graphics/circuit_macros/liblog.m4 | 4 +- graphics/circuit_macros/mfpic.m4 | 2 +- graphics/circuit_macros/mpost.m4 | 2 +- graphics/circuit_macros/pgf.m4 | 2 +- graphics/circuit_macros/postscript.m4 | 2 +- graphics/circuit_macros/psfrag.m4 | 2 +- graphics/circuit_macros/pstricks.m4 | 2 +- graphics/circuit_macros/svg.m4 | 2 +- graphics/circuit_macros/xfig.m4 | 2 +- 60 files changed, 1483 insertions(+), 205 deletions(-) create mode 100644 graphics/circuit_macros/examples/GrayCode.m4 create mode 100644 graphics/circuit_macros/examples/Planes.m4 create mode 100644 graphics/circuit_macros/examples/Tubediags.m4 create mode 100644 graphics/circuit_macros/examples/Zcos.m4 delete mode 100644 graphics/circuit_macros/examples/svg/Banking.txt create mode 100644 graphics/circuit_macros/examples/svg/GrayCodeSVG.m4 create mode 100644 graphics/circuit_macros/examples/svg/TubediagsSVG.m4 create mode 100644 graphics/circuit_macros/examples/tubedefs.m4 (limited to 'graphics') diff --git a/graphics/circuit_macros/CHANGES b/graphics/circuit_macros/CHANGES index a7aec66e54..55dd822d35 100644 --- a/graphics/circuit_macros/CHANGES +++ b/graphics/circuit_macros/CHANGES @@ -1,6 +1,10 @@ CHANGES (The stable CTAN version will be nn.n; intermediate versions nn.n.n): +Version 9.1: Corrected two examples; added others including vacuum tubes. + Tweaked dashline. Removed an extraneous log file and extraneous code + from libgen.m4. New pic macros for operations on complex numbers. New + macros Rot_, Vcoords. Version 9.0: Tweaked svg_sub, svg_sup, lamp. New macros cm__, px__. New option for source. Obsolete Autologic and stackpromote_ removed. Version 8.9: Tweaked lswitch, contact, rotbox, parallel_, darrow. diff --git a/graphics/circuit_macros/Copying b/graphics/circuit_macros/Copying index 0eec8c2ed3..72d57ff5b7 100644 --- a/graphics/circuit_macros/Copying +++ b/graphics/circuit_macros/Copying @@ -1,4 +1,4 @@ -* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under * +* Circuit_macros Version 9.1, copyright (c) 2019 J. D. Aplevich under * * the LaTeX Project Public License. The files of this distribution may * * be redistributed or modified provided that this copyright notice is * * included and provided that modifications are clearly marked to * diff --git a/graphics/circuit_macros/README b/graphics/circuit_macros/README index c20ea3d4a3..40768bb81a 100644 --- a/graphics/circuit_macros/README +++ b/graphics/circuit_macros/README @@ -1,5 +1,5 @@ -* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under * +* Circuit_macros Version 9.1, copyright (c) 2019 J. D. Aplevich under * * the LaTeX Project Public License. The files of this distribution may * * be redistributed or modified provided that this copyright notice is * * included and provided that modifications are clearly marked to * @@ -188,8 +188,8 @@ TESTING: diagrams but keep in mind that some of them contain details that allow the source to be used with a variety of postprocessors. Sticking to one postprocessor such as tikz or PStricks allows for the simplest - source. You might wish to browse some of the files that are not - included to produce examples.ps. + source. You might also wish to browse some of the files that are not + used for examples.ps. No "make" facility? You have to test by hand (but see below for diagram production software). Copy a test file as above into @@ -284,8 +284,9 @@ EXAMPLES AND INTEGRATION WITH OTHER TOOLS: A git repository of a newer version of cirkuit by Andrew G. for Linux is at https://github.com/ag-ckt/cirkuit/tree/V0.5.0 - The GUI front end PyCirkuit at https://github.com/orestesmas/pycirkuit - is Python-based and inspired by Cirkuit. + The GUI front end PyCirkuit at https://pypi.org/project/pycirkuit/ + and https://github.com/orestesmas/pycirkuit + is Python-based and inspired by cirkuit. A wiki offering examples and tips is at http://swwiki.e-dschungel.de/circuit_macros diff --git a/graphics/circuit_macros/darrow.m4 b/graphics/circuit_macros/darrow.m4 index 7721842da0..9f762bfec9 100644 --- a/graphics/circuit_macros/darrow.m4 +++ b/graphics/circuit_macros/darrow.m4 @@ -1,7 +1,7 @@ divert(-1) darrow.m4 Macros for double lines and arrows -* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under * +* Circuit_macros Version 9.1, copyright (c) 2019 J. D. Aplevich under * * the LaTeX Project Public License. The files of this distribution may * * be redistributed or modified provided that this copyright notice is * * included and provided that modifications are clearly marked to * diff --git a/graphics/circuit_macros/doc/CctTable.m4 b/graphics/circuit_macros/doc/CctTable.m4 index 4fa5405689..40b5849d66 100644 --- a/graphics/circuit_macros/doc/CctTable.m4 +++ b/graphics/circuit_macros/doc/CctTable.m4 @@ -1,9 +1,6 @@ .PS # `CctTable.m4' cct_init -divert(-1) - -divert(0)dnl movewid = 2 pt__ hm = 2.05 @@ -84,7 +81,7 @@ vm = 0.28 move right_ hm {reed ; move ;"`{\tt reed}'" ljust} move right_ hm - {reed(,,,fill_(0.9),CR) ; move ;"`{\tt reed(,{,},fill\_(0.9),CR)}'" ljust} + {reed(,,,fill_(0.9),CR) ; move ; "`{\tt reed(,{,},fill\_(0.9),CR)}'" ljust} } .PE diff --git a/graphics/circuit_macros/doc/Circuit_macros.bib b/graphics/circuit_macros/doc/Circuit_macros.bib index a918b18bb9..977060a26f 100644 --- a/graphics/circuit_macros/doc/Circuit_macros.bib +++ b/graphics/circuit_macros/doc/Circuit_macros.bib @@ -56,6 +56,13 @@ institution={Royal Holloway, University of London}, note={Email:{\tt adrean@cs.rhbnc.ac.uk}}, year={1992}} +@book{Mas2019, +author={Mas, O.}, +title={Pycirkuit 0.5.0}, +publisher={Python Software Foundation}, +note={\url{https://pypi.org/project/pycirkuit/}}, +year={2019}} + @misc{KDEApps2009, author={KDE-Apps.org}, title={Cirkuit}, diff --git a/graphics/circuit_macros/doc/Circuit_macros.pdf b/graphics/circuit_macros/doc/Circuit_macros.pdf index 95830643bd..e0a03e9510 100644 Binary files a/graphics/circuit_macros/doc/Circuit_macros.pdf and b/graphics/circuit_macros/doc/Circuit_macros.pdf differ diff --git a/graphics/circuit_macros/doc/Circuit_macros.tex b/graphics/circuit_macros/doc/Circuit_macros.tex index d1be7bc1e7..36f9bdf694 100644 --- a/graphics/circuit_macros/doc/Circuit_macros.tex +++ b/graphics/circuit_macros/doc/Circuit_macros.tex @@ -82,7 +82,9 @@ \bibliographystyle{plain} \makeatletter \addcontentsline{toc}{section}{References\ \unhbox \voidb@x - \cleaders \hbox to.44em{\hss .\hss }\hfill \kern \z@ } +%\cleaders \hbox to0.44em{\hss .\hss }\hfill \kern \z@ } +%\cleaders \hbox{\hss \hss }\hfill \kern \z@ } + \cleaders \hbox{\hss .$\;$\hss }\hfill \kern \z@ } \makeatother \bibliography{Circuit_macros} \end{document} diff --git a/graphics/circuit_macros/doc/Version.tex b/graphics/circuit_macros/doc/Version.tex index aee229c54b..f10e710006 100644 --- a/graphics/circuit_macros/doc/Version.tex +++ b/graphics/circuit_macros/doc/Version.tex @@ -1 +1 @@ -Version 9.0 +Version 9.1 diff --git a/graphics/circuit_macros/doc/body.tex b/graphics/circuit_macros/doc/body.tex index d1fb66d626..91c8fbe3ec 100644 --- a/graphics/circuit_macros/doc/body.tex +++ b/graphics/circuit_macros/doc/body.tex @@ -257,7 +257,9 @@ There are several ways to control the process, as follows: \begin{enumerate} \item The macros can be processed by \latex-specific -project software and by graphic applications such as Cirkuit~\cite{KDEApps2009}. +project software and by graphic applications such as +Pycirkuit~\cite{Mas2019}. +% Cirkuit~\cite{KDEApps2009}. Alternatively when many files are to be processed, a facility such as Unix ``make,'' which is also available in PC and Mac versions, can be employed to automate the required commands. On systems without such diff --git a/graphics/circuit_macros/doc/defines.tex b/graphics/circuit_macros/doc/defines.tex index 84634c5862..6b8f615fe2 100644 --- a/graphics/circuit_macros/doc/defines.tex +++ b/graphics/circuit_macros/doc/defines.tex @@ -1411,6 +1411,12 @@ nw,nn,ne,ns,pin lgth,style, other commands})} \macrodef{rot3Dz}{rot3Dz}{({\sl radians,x,y,z})} {3D} {rotates x,y,z about z axis} +\macrodef{Rot\_}{Rot_}{({\sl position, degrees})} + {gen} + {rotate position by degrees} +\macrodef{rot\_}{rot_}{({\sl x, y, angle})} + {gen} + {rotate {\sl x,y} by theta radians} \macrodef{rotbox}{rotbox}{({\sl wid,ht,type},[r|t={\sl val}])} {gen} {box oriented in current direction in {\tt [ ]} block; @@ -1834,6 +1840,13 @@ nw,nn,ne,ns,pin lgth,style, other commands})} {\tt A}=arrow, {\tt P}=preset, {\tt L}=linear, {\tt N}=nonlinear, {\tt C}=continuous, {\tt S}=setpwise \seesect{Twoterminal:}} +\macrodef{Vcoords\_}{Vcoords_}{({\sl position})} + {gen} + {The $x, y$ coordinate pair of the position} +\macrodef{Vdiff\_}{Vdiff_}{({\sl position},{\sl position})} + {gen} + {{\tt Vdiff\_(A,B)} evaluates to {\tt A-(B)} with dpic, {\tt A-(B.x,B.y)} + with gpic} \macrodef{vec\_}{vec_}{({\sl x},{\sl y})} {gen} {position rotated with respect to current direction} @@ -1860,6 +1873,10 @@ nw,nn,ne,ns,pin lgth,style, other commands})} \macrodef{Vsprod\_}{Vsprod_}{({\sl position}, {\sl expression})} {gen} {The vector in arg 1 multiplied by the scalar in arg 2} +\macrodef{Vsum\_}{Vsum_}{({\sl position},{\sl position})} + {gen} + {{\tt Vsum\_(A,B)} evaluates to {\tt A+B} with dpic, {\tt A+(B.x,B.y)} + with gpic} \macrodef{w\_}{w_}{} {gen} {.w with respect to current direction} diff --git a/graphics/circuit_macros/dpictools.pic b/graphics/circuit_macros/dpictools.pic index 00c7c71c15..40d621943e 100644 --- a/graphics/circuit_macros/dpictools.pic +++ b/graphics/circuit_macros/dpictools.pic @@ -1,9 +1,9 @@ # dpictools.pic -# General-purpose pic macros. Input this file using the m4 macro NeedDpicTools -# or the pic statement copy "HOMELIB_/dpictools.pic" when HOMELIB_ is defined -# or, generically, copy "dpictools.pic" +# General-purpose pic macros. Input this file using the Circuit_macros +# m4 macro NeedDpicTools or the pic statement copy "HOMELIB_/dpictools.pic" +# when HOMELIB_ is defined or, generically, copy "dpictools.pic" -# Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under # +# Circuit_macros Version 9.1, copyright (c) 2019 J. D. Aplevich under # # the LaTeX Project Public License. The files of this distribution may # # be redistributed or modified provided that this copyright notice is # # included and provided that modifications are clearly marked to # @@ -77,7 +77,7 @@ define slantbox { [ N: 0.5 between NW and NE ; E: 0.5 between NE and SE S: 0.5 between SE and SW ; W: 0.5 between SW and NW C: 0.5 between SW and NE - line $5 from N to NE then to SE then to SW then to NW then to N + line from N to NE then to SE then to SW then to NW then to N $5 ] } # arraymax( data array, n, index name, value) # Find the index in array[1:n] of the first @@ -380,6 +380,22 @@ define prow { define rnd {int($1+sign($1)/2)} # round function +# Operations on complex numbers (x,y) +define Zsum {($1+($2))} +define Zdiff{($1-($2))} +define Zprod {($1.x*$2.x-$1.y*$2.y,$1.y*$2.x+$1.x*$2.y)} +define Zinv {($1.x/($1.x^2+$1.y^2),-$1.y/($1.x^2+$1.y^2))} +define Zexp {((cos($1.y),sin($1.y))*expe($1.x))} +define Zcos {(cos($1.x)*cosh($1.y),-sin($1.x)*sinh($1.y))} +define Zsin {(sin($1.x)*cosh($1.y), cos(%1.x)*sinh($1.y))} +define zabs {sqrt($1.x^2+$1.y^2)} +define zarg {atan2($1.y,$1.x)} +# Trig functions if undefined +if "cosh"=="co"+"sh" then { + define cosh {((expe($1) + expe(-($1)))/2)} + define sinh {((expe($1) - expe(-($1)))/2)} +} + # print " *** dpic: dpictools.pic processed" define dpictools {1} # dpictools end diff --git a/graphics/circuit_macros/examples/GrayCode.m4 b/graphics/circuit_macros/examples/GrayCode.m4 new file mode 100644 index 0000000000..4fc4815cf1 --- /dev/null +++ b/graphics/circuit_macros/examples/GrayCode.m4 @@ -0,0 +1,20 @@ +.PS +# GrayCode.m4 +gen_init + + outer = 4 + inner = 0.75 + nbits = 10 + +C: circle diam outer + circle diam inner at C + sectors = 2^nbits + lthk = (outer-inner)/2/nbits + for bit = 1 to nbits do { + for is = 2^(bit-1) to sectors by 2^(bit+1) do { + startang = is/sectors*360 + endang = min(startang+(2^bit)/sectors*360,360) + arcd(C,outer/2-(bit-0.5)*lthk,startang,endang) thick lthk/(1bp__) + } + } +.PE diff --git a/graphics/circuit_macros/examples/Inclpdf.m4 b/graphics/circuit_macros/examples/Inclpdf.m4 index e93090948c..1e01494d67 100644 --- a/graphics/circuit_macros/examples/Inclpdf.m4 +++ b/graphics/circuit_macros/examples/Inclpdf.m4 @@ -1,7 +1,7 @@ .PS #`Inclpdf.m4 : Illustrating one way to import and overwrite graphics' -include(darrow.m4) +darrow_init s_init(Inclpdf) sinclude(F_Inclpdf.dim) diff --git a/graphics/circuit_macros/examples/Makefile b/graphics/circuit_macros/examples/Makefile index 5cad778d91..e0404f8aee 100644 --- a/graphics/circuit_macros/examples/Makefile +++ b/graphics/circuit_macros/examples/Makefile @@ -27,11 +27,13 @@ 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/tmp/dpic -p +#PIC = $$HOME/dpic/bison/dpic -p CONFIGFILE = pstricks.m4 @@ -45,7 +47,7 @@ CONFIGFILE = pstricks.m4 # Convert options EPSOPTS = -PNGOPTS = -density 400 -scale 25% -alpha Remove +PNGOPTS = -quiet -density 400 -scale 25% -alpha Remove # M4 = m4 -B32000 # M4 = m4 -I $(LIBDIR) @@ -61,7 +63,7 @@ PICS = \ 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 Grounds.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 \ @@ -70,7 +72,7 @@ PICS = \ 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 \ + 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 \ @@ -162,12 +164,12 @@ BS = tr '|' '\134' .m4.pdf: touch F_$*.dim $(M4) pgf.m4 F_$*.dim $*.m4 > $*.pic - dpic -g $*.pic > test.tex + $(PIC) -g $*.pic > test.tex sed -e '/^\\usepackage.*graphicx/s/^.*$$/\\usepackage{tikz}/' \ -e '/pstricks/d' tst.tex > F_$*.tex pdflatex F_$* $(M4) pgf.m4 F_$*.dim $*.m4 > $*.pic - dpic -g $*.pic > test.tex + $(PIC) -g $*.pic > test.tex pdflatex F_$* mv F_$*.pdf $*.pdf @@ -177,12 +179,12 @@ $(DOC).pdf: clean pdfmode $(DOC).frp touch $(DOC).dim for file in $(BOXDIMS) ; do \ rm -f $$file.tex $$file.pic ; \ - make PIC="dpic -g" CONFIGFILE=pgf.m4 DIMFILE=$(DOC).dim $${file}.tex ; \ + make PIC="$(PIC) -g" CONFIGFILE=pgf.m4 DIMFILE=$(DOC).dim $${file}.tex ; \ done pdflatex $(DOC) for file in $(BOXDIMS) ; do \ rm -f $$file.tex $$file.pic ; \ - make PIC="dpic -g" CONFIGFILE=pgf.m4 DIMFILE=$(DOC).dim $${file}.tex ; \ + make PIC="$(PIC) -g" CONFIGFILE=pgf.m4 DIMFILE=$(DOC).dim $${file}.tex ; \ done pdflatex $(DOC) @@ -217,7 +219,7 @@ $(DOC).frs: doclinks $(DOC).tex files.tex header.tex psmode rm -f $(DOC).dvi $(DOC).frp: doclinks $(DOC).tex files.tex header.tex pdfmode - make CONFIGFILE=pgf.m4 PIC="dpic -g" $(PICS) + make CONFIGFILE=pgf.m4 PIC="$(PIC) -g" $(PICS) cp $(LIBDIR)/doc/Version.tex . pdflatex $(DOC) rm -f $(DOC).pdf diff --git a/graphics/circuit_macros/examples/Planes.m4 b/graphics/circuit_macros/examples/Planes.m4 new file mode 100644 index 0000000000..726af31c56 --- /dev/null +++ b/graphics/circuit_macros/examples/Planes.m4 @@ -0,0 +1,95 @@ +.PS +# Planes.m4 +threeD_init +NeedDpicTools + +# This 3D diagram is like many others: define the facets, use the normal vectors +# to determine visibility, sort and plot the facets from back to front. + +define(`mark',`"`$1'" at `$1'') + +# size parameters + a = 3/2 + b = 0.4 + d = 1 +# Define intersecting lines in the plane + A0: -a,-b + A1: a,-b + B0: Rot_(A0,120) + B1: Rot_(A1,120) + C0: Rot_(A0,240) + C1: Rot_(A1,240) + +# intersections +define(`lintersect',`intersect_(`$1'0,`$1'1,`$2'0,`$2'1)') + AB: lintersect(A,B) + BC: lintersect(B,C) + CA: lintersect(C,A) + +# Store a point as x[i], y[i], z[i] +define(`mkxyz',` + x[$1] = $2 + y[$1] = $3 + z[$1] = $4') +# Recover point coordinates +define(`xyz',`x[$1], y[$1], z[$1]') + +# Facets are rectangles here; store 3 corners +define(`mkfacet',` + mkxyz((`$1')*3, 0,`$2'.x,`$2'.y) + mkxyz((`$1')*3+1, 0,`$3'.x,`$3'.y) + mkxyz((`$1')*3+2,-d,`$3'.x,`$3'.y) +') +# Define the facets + mkfacet(1,A0,CA) mkfacet(2,CA,A0) + mkfacet(3,CA,AB) mkfacet(4,AB,CA) + mkfacet(5,AB,A1) mkfacet(6,A1,AB) + + mkfacet(7,B0,AB) mkfacet(8,AB,B0) + mkfacet(9,AB,BC) mkfacet(10,BC,AB) + mkfacet(11,BC,B1) mkfacet(12,B1,BC) + + mkfacet(13,C0,BC) mkfacet(14,BC,C0) + mkfacet(15,BC,CA) mkfacet(16,CA,BC) + mkfacet(17,CA,C1) mkfacet(18,C1,CA) + nfacets = 18 + +# View angles azimuth, elevation, rotation (degrees) + setview( 10, 30, 5) + +ifelse(1,1,` +# # create array of visible facets and sort + n = 0 + for i=1 to nfacets do { + mkxyz(-1, + cross3D(diff3D(xyz(i*3+1),xyz(i*3)),diff3D(xyz(i*3+2),xyz(i*3+1)))) + dx = dot3D(xyz(-1),View3D) + if dx > 0 then { + dy[i] = dx/length3D(xyz(-1)) + n +=1 + d[n] = dot3D(sum3D(xyz(i*3),xyz(i*3+2)),View3D)/2 + ix[n] = i + } + } + dpquicksort(d,1,n,ix) + +#print sprintf("n=%g",n); for i=1 to n do { print i,ix[i] } + +# Recover the 4th corner and draw +define(`drawfacet',` + NW_facet: project(xyz(($1)*3)) + NE_facet: project(xyz(($1)*3+1)) + SE_facet: project(xyz(($1)*3+2)) + SW_facet: project(x[($1)*3+2],y[($1)*3],z[($1)*3]) + shd = 1-($2)^4 + line from SW_facet to SE_facet then to NE_facet \ + then to NW_facet then to SW_facet shaded rgbstring(shd,shd,shd) +# sprintf("%g",$1) at 0.5 between SW_facet and NE_facet +# Loopover_(`x',`mark(x);',SW_facet,SE_facet,NE_facet,NW_facet) + ') + +# # draw facets, shading with view cosines + for i=1 to n do { drawfacet(ix[i],dy[ix[i]]) } +') + +.PE diff --git a/graphics/circuit_macros/examples/Rotbox.m4 b/graphics/circuit_macros/examples/Rotbox.m4 index 6a22419095..7b33d769e8 100644 --- a/graphics/circuit_macros/examples/Rotbox.m4 +++ b/graphics/circuit_macros/examples/Rotbox.m4 @@ -9,9 +9,9 @@ gen_init "r=0.1" at last [] move to last [].ne Point_(0) - [ for_(2,8,2, `rotbox(,,dashed,t=m4x/10) at last []+vec_(boxwid*1.1,0) + [[]; for_(2,8,2, `rotbox(,,dashed,t=m4x/10) at last []+vec_(boxwid*1.1,0) sprintf("t=%g",m4x/10) at last [] ') ] with .nw at last [].ne+(0.1,0) - [ for_(10,16,2, `rotbox(,,dashed,t=m4x/10) at last []+vec_(boxwid*1.1,0) + [[]; for_(10,16,2, `rotbox(,,dashed,t=m4x/10) at last []+vec_(boxwid*1.1,0) sprintf("t=%g",m4x/10) at last [] ') ] with .nw at last [].sw+(0,-0.1) .PE diff --git a/graphics/circuit_macros/examples/Sierpinski.m4 b/graphics/circuit_macros/examples/Sierpinski.m4 index f9bad102e0..7fbf13bf15 100644 --- a/graphics/circuit_macros/examples/Sierpinski.m4 +++ b/graphics/circuit_macros/examples/Sierpinski.m4 @@ -1,7 +1,8 @@ .PS # Sierpinski.m4 gen_init -`define Sierpinski' { +[ + define Sierpinski { if $1 > 0.04 then { d = $1/2-lh shade(1,line from $2+(d/2,d/2*s3+lw*2) right d/2 up d/2*s3 then left d*2 \ @@ -22,6 +23,32 @@ gen_init d = r/2-lh shade(0,line from A+(0,lw) right d then up d*s3 left d then down d*s3 left d\ then right d ) - psset_(linecolor=white) + ifpstricks(`psset_(linecolor=white)') Sierpinski(r/2,A) + + ifpstricks(`psset_(linecolor=black)') + thicklines_ + ] + +# CayleyGraph.m4 +[ +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); } + { line to Here+(cosd($2+90),sind($2+90))*($1) + exec sprintf("CayleyGraph(%g,%g,%g);",0.5*($1),$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); } + } + } + + size = 2 + depth = 6 + for t=0 to 270 by 90 do { + line from (0,0) to (cosd(t),sind(t)); + { exec sprintf("CayleyGraph(%g,%g,%g);",size/4,t,depth); } + } + ] with .sw at last [].se+(-0.25,0) + .PE diff --git a/graphics/circuit_macros/examples/Tubediags.m4 b/graphics/circuit_macros/examples/Tubediags.m4 new file mode 100644 index 0000000000..f597ca1ae2 --- /dev/null +++ b/graphics/circuit_macros/examples/Tubediags.m4 @@ -0,0 +1,381 @@ +.PS +# Tubediags.m4 + +cct_init +include(tubedefs.m4) + +iflatex(`command "{\sf"') + +Overall:[ + +# Some base diagrams +[ Loopover_(`xv',` + V_`'xv: m4xpand(B_`'xv) ifelse(m4Lx,1,, + `with .Base at last [].Base+(dimen_*3,0)') + "xv" at V_`'xv.Base.s+(0,-dimen_/3) below', + 2AG,2D,4BB,9K) ] + +# Test circuit +[ +Ld: dot + battery(up dimen_,2) + line right_ dimen_ +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") + line right_ dimen_/3 +Tr: triode with .G1.w at Here + line from Tr.K1.sw to (Tr.K1.sw,Pot1.End); dot + { line down dimen_/2 +B: dot } + source(to (Tg,Here),"\scriptsize V"); corner; line to Tg + line from Tr.P1.c to (Tr.P1.c,Pot1.Start) + source(right_ elen_,"\scriptsize mA"); llabel(-,,+); rlabel(,I_b) +Tp: dot + { source(down_ to (Here,B),"\scriptsize V"); llabel(+,,-); rlabel(,E_b); dot} + line right_ dimen_/2 then down_ (Here.y-B.y)/2 then right_ dimen_/2 +P2: potentiometer(down_ Tp.y-B.y,5,0.5,-dimen_/6) with .T1 at Here + dot(at P2.End) + line right_ dimen_ from P2.Start; corner + battery(down_ dimen_*3/4,2,R) +T: Here + battery(up_ dimen_*3/4 from (Here,B),2) + line dashed up_ to T "B" ljust + line from (T,B) left T.x-Ld.x+dimen_/2 then up Ld.y-B.y then to Ld + ] with .nw at last [].sw + (0,-dimen_/2) + +# 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) + { line right_ dimen_/4 from last [].e; S2T: dot(,,1) + line from S1.end right_ S2T.x-S1.end.x; S21: dot(,,1) + line from S1.start right_ S2T.x-S1.end.x; S22: dot(,,1) } + move up_ dimen_/8 + S2: inductor(up_ dimen_*.4,L,3,M) + { line right_ dimen_/4 from last [].e; S1T: dot(,,1) + line from S2.end right_ S2T.x-S2.end.x; S11: dot(,,1) + line from S2.start right_ S2T.x-S2.end.x; S12: dot(,,1) } + line down_ dimen_/8 from M4Core1.start + line down_ dimen_/8 from M4Core2.start + P: inductor(down_ dimen_*0.6 with .c at 0.5 between S1.end and S2.start \ + -(dimen_*0.8,0),L,5,) + P1: P.start + P2: P.end + PT: last [].w + popdef(`dimen_')]') + +define(`PowerXformer',`[ pushdef(`dimen_',dimen_*1.5) + S3: inductor(up_ dimen_*.2,L,1,M) + ST3: last [].e + { line up_ dimen_/10 from M4Core1.end; line up_ dimen_/10 from M4Core2.end } + S2: inductor(up_ dimen_*.2 from S3.end+(0,dimen_/10),L,1,M) + { line up_ dimen_/10 from M4Core1.end; line up_ dimen_/10 from M4Core2.end } + S1: inductor(up_ dimen_*.4 from S2.end+(0,dimen_/10),L,3,M) + ST1: last [].e + P: inductor(down_ dimen_*0.6 with .c at 0.5 between S1.end and S3.start \ + -(dimen_*0.8,0),L,5,) + popdef(`dimen_')]') + +[ Toprail: Here +#{"Toprail"} + resistor(down_ dimen_); rlabel(,100\kilo) +V1P: dot +#{"V1P" rjust} + line down_ dimen_*3/4 +V1: triode(,W) with .P1 at Here + {"6SL7" at V1.nw above } + resistor(down_ dimen_*3/2 from V1.K1.sw); llabel(,2200) +Rail1: dot +#{"Rail1"} + ground + arrow left_ from V1.G1.w +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 + { move left_ dimen_ }; "Pickup" at RP below + capacitor(right_ dimen_ from V1P,C,R); llabel(,0.05\micro) + resistor(down_ dimen_); rlabel(,470\kilo) +V1o: dot +#{ "V1o" at V1o rjust } + resistor(down_ (Here.y-Rail1.y)/2); rlabel(,22\kilo) + dot + { capacitor(down_ Here.y-Rail1.y,C); rlabel(,0.01\micro); dot } + line right_ dimen_/2 +R47: resistor(down_ to (Here,Rail1)); llabel(,,4.7\mega) + line to Rail1 + +Pot1: potentiometer(down_ dimen_,,0.5,dimen_*2/3) \ + with .T1 at (V1o+(elen_+dimen_*2/3,0),V1.G1) + { line from Pot1.Start left_ (Pot1.Start.x-V1o.x)/2 + continue to (Here,V1o) then to V1o } + line from Pot1.End down_ dimen_/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) +V2k: dot } +#{ "V2k" at V2k above } + { line down_ to (Here,Rail1) + variable(`resistor(right_ dimen_); rlabel(,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) } + dot(at (V2.P1.c,Here)) + resistor(down_ dimen_); llabel(,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 + 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) + + dot(at (V3.P1.c,Toprail)); { line to R51k.end } + resistor(down_ dimen_); llabel(,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) + line to (V2k,Here) + resistor(down_ to V2k); rlabel(0.1); llabel(\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) +V4k: dot +#{"V4k"} + line left dimen_*3/4 +V4k1: dot + { resistor(up_ V4.G1.y-Here.y); llabel(,,2.2\mega) +V4G: dot } + line from V3p right_ dimen_ + variable(`resistor(down_ to (Here,V4.G1)); llabel(100\kilo)') +V3o: dot + capacitor(right_ to V4G,C); llabel(,3\nano) + line to V4.G1.w + resistor(left_ from V4k1 to (V3o,V4k)); rlabel(,51\kilo); dot + ground + capacitor(down_ from V3o to Here,C); llabel(,,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) + +V5: triode(,N) with .G1.w at V4.G1.e+(2.25*dimen_,0) + "6SL7" at V5.n above rjust +V6: triode(,SR) with .G1.w at V5.G1.w-(0,dimen_*2.5) + "6SL7" at (V6.w,V6.P1) below rjust + +V4p: dot(at (V4.P1.c,V3p)) +#{"V4p"} + line right_ dimen_*2/3; capacitor(right_ dimen_,C); llabel(,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) +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) +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) +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) + +PV: dot(at (V4.e.x+dimen_/5,Toprail.y)) +#{"PV"} + line from V6.P1.c down_ V4p.y-V4.P1.c.y +Rail2: dot +#{"Rail2" below} + line from PV to (PV,Rail2); corner + { resistor(right_ to Rail2); llabel(,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) + +V5P: dot(at (V6.P1.c,V4p)); { line to V5.P1.c } +#{"V5P"} + resistor(to (Here,Toprail)); rlabel(,220\kilo) + line to (V4p,Here) + + V7: V_6L6G at (V3,Rail2+(0,-2*dimen_)); "6L6G" at V7.n above ljust + V8: V_6L6G(,R) at V7+(0,-2*dimen_); "6L6G" at V8.s below ljust + line right dimen_/4 from V7.G2.e; resistor(right_ dimen_); llabel(,100); +V9G: dot +#{"V9G"} + line right dimen_/4 from V8.G2.e; resistor(right_ dimen_); llabel(,100); + V9: V_6L6G(,,G2) with .G2.w at V9G+(dimen_/2,0); "6L6G" at V9.n above rjust + V10: V_6L6G(,R,G2) at V9+(0,-2*dimen_); "6L6G" at V10.s below rjust + line from V9G to V9.G2.w + line from V10.G2.w left_ dimen_/2 +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) +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) + + 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) } +PP: potentiometer(left_ dimen_,,0.5,dimen_/2) with .Start at Here + rlabel(,50\ 10\Watt) + corner(,at PP.T1); line left_ dimen_ then up_ dimen_/4 + round(,tubethick) + line thick tubethick up tubeplatelen/3 left tubeplatelen*2/9 + round(,tubethick) + line thick tubethick down tubeplatelen/3 left tubeplatelen*2/9 + line down_ dimen_/4 then left_ dimen_ then up_ dimen_/4 + round(,tubethick) + line thick tubethick up tubeplatelen/3 left tubeplatelen*2/9 + round(,tubethick) + line thick tubethick down tubeplatelen/3 left tubeplatelen*2/9 + line down_ dimen_/4; ground + "1st two 6SL7" at Here+(dimen_*3/4,dimen_/2) above + +V9T: dot(at (L910,V7K)-(0,dimen_/4)) +#{"V9T"} + + line right_ dimen_/2 from V9.G1.e; continue to (Here,V9.P1)+(0,dimen_*2/3) + resistor(left_ to (V7G,Here)); llabel(,100) +V7nw: dot; { line to (Here,V7.G1) } + line right_ dimen_/2 from V10.G1.e; continue to (Here,V10.P1)-(0,dimen_*2/3) + resistor(left_ to (V7G,Here)); rlabel(,100) +V8sw: dot; { line to (Here,V8.G1) } + + line from V9.P1.c up_ dimen_ +V9P: dot + line from V10.P1.c down_ dimen_ +V10P: dot +#{"V10P"} + + 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}) +Rt1: Here + line to (Here,V6.e)+(0,dimen_/6); resistor(up_ dimen_) + llabel(,\shortstack{100\kilo\\2\Watt}) + 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}) + resistor(up_ dimen_*3/2) + llabel(,\shortstack{100\kilo\\2\Watt}) + line to (Here,V6K) then to V6K + + line from V9T to (V9.e+(dimen_*3/4,0),V9T) +Xout: OutputXformer with .PT at Here + line from Xout.P1 to (Xout.P1,V9P); dot + line from Xout.P2 to (Xout.P1,V10P); dot + line from Xout.PT left_ dimen_/4 +XT: dot + + resistor(from V6sw left_ dimen_); rlabel(,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) + 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) + 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) +Filt: dot + { capacitor(down_ dimen_*2/3,C); llabel(,40\micro) + line to R100.end } + +Pwr: [ + PXform: PowerXformer + line left_ dimen_/4 from PXform.P.start; fuse(left_ dimen_/2,D) + AC1: arrow left_ dimen_/2 + AC2: arrow from PXform.P.end to (AC1.end,PXform.P.end) + "AC" at 0.5 between AC1.end and AC2.end ljust + dot(at PXform.ST3); line right_ dimen_/4; dot + dot(at PXform.ST1); line right_ dimen_/4 then down_ dimen_*3/2; ground(,T) + line from PXform.S2.end right_ dimen_*2.5 then up_ dimen_/4 + Rect2: V_5V4G with .F1.sw at Here; "5V4G" at Rect2.n+(0,dimen_/2) + Rect1: V_5V4G with .e at Rect2.w-(dimen_/2,0); "5V4G" at Rect1.n+(0,dimen_/2) + move to Rect1.F1.sw; line to (Here,PXform.S2.end); dot + move to Rect1.F1.se; line to (Here,PXform.S2.start); dot + move to Rect2.F1.se; line to (Here,PXform.S2.start) +PO: dot + line from Rect1.P1 left_ dimen_/2; dot + { line to (Here,PXform.S1.start) then to PXform.S1.start } + line to (Here,Rect1.n)+(0,dimen_/8) + continue to (Rect1.P2+(dimen_/2,0),Here) + continue to (Here,Rect1.P2) then to Rect1.P2 + line from Rect2.P1 left_ dimen_/2 then up_ Rect2.ht/2+dimen_/4; dot + { line to (Rect2.P2+(dimen_/2,0),Here) + continue to (Here,Rect2.P2) then to Rect2.P2 } + move to PXform.S1.end + 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 + ] 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 + line to Filt + + ] with .nw at last [].sw+(0,-0.5) +#showbox_ + +] +#showbox_ +#print last [].wid,last [].ht + +iflatex(command "}") +.PE diff --git a/graphics/circuit_macros/examples/Zcos.m4 b/graphics/circuit_macros/examples/Zcos.m4 new file mode 100644 index 0000000000..cbf63fd8f3 --- /dev/null +++ b/graphics/circuit_macros/examples/Zcos.m4 @@ -0,0 +1,29 @@ +.PS +# Zcos.m4 +gen_init +NeedDpicTools + +# define f1 { ee = expe(8*x*`$1'*(x^2 - (`$1')^2)); +# $2 = ee + 1/ee + 2*cos(2*x^4 + 2*(`$1')^4 - 12*x^2*(`$1')^2) - 4; +# } + +# alternative: |cos(z^4)| = 1 + define f1 { Z: (x,$1) + Z4: Zprod(Zprod(Z,Z),Zprod(Z,Z)) + $2 = zabs(Zcos(Z4)) - 1 + } + + ni = 200 + for i=10 to ni do { x = i/ni*3 + findroot( f1, 0, 0.2, 1e-8, y ) + P[i-10]: x,y } + np = ni-10 + + for deg=0 to 359 by 45 do { + for i=0 to np do { Z[i]: rot_(P[i].x,P[i].y,deg*dtor_) } + fitcurve(Z,np,thick 2 outlined "blue") + for i=0 to np do { Z[i]: rot_(P[i].x,-P[i].y,deg*dtor_) } + fitcurve(Z,np,thick 2 outlined "blue") + } + +.PE diff --git a/graphics/circuit_macros/examples/examples.pdf b/graphics/circuit_macros/examples/examples.pdf index da082ee704..fc47a4f9f9 100644 Binary files a/graphics/circuit_macros/examples/examples.pdf and b/graphics/circuit_macros/examples/examples.pdf differ diff --git a/graphics/circuit_macros/examples/files.tex b/graphics/circuit_macros/examples/files.tex index 2e64c29cc3..1912e9e249 100644 --- a/graphics/circuit_macros/examples/files.tex +++ b/graphics/circuit_macros/examples/files.tex @@ -85,18 +85,18 @@ \src{Xform.m4}.} } -\bfig{ - \centerline{\getpic{Relay}} - \caption{The {\tt contact} and {\tt relay} macros - \src{Relay.m4}.} - } - \bfig{ \centerline{\getpic{NPDT}} \caption{Double throw with the {\tt NPDT} macro \src{NPDT.m4}.} } +\bfig{ + \centerline{\getpic{Relay}} + \caption{The {\tt contact} and {\tt relay} macros + \src{Relay.m4}.} + } + \bfig{ \centerline{\getpic{Jack}} \caption{The {\tt jack} and {\tt plug} macros @@ -356,6 +356,15 @@ } \end{sidewaysfigure} %}% \end{landscape} +\bfig{ + \centerline{\getpic{Tubediags}} + \caption{Electron-tube diagrams: a few bottom-view base diagrams, + a generic triode test circuit, and a 25-watt audio amplifier adapted + from F.\ Langford-Smith, {\it Radiotron Designer's Handbook,} fourth + edition, Harrison, NJ: Radio Corporation of America, 1952 + \src{Tubediags.m4}.} + } + \bfig{ \centerline{\getpic{sfg}} \caption{Signal-flow graphs @@ -451,6 +460,12 @@ \src{ex00.m4}.} } +\bfig{ + \centerline{\getpic{GrayCode}} + \caption{Gray code 10-bit encoder disk pattern + \src{GrayCode.m4}.} + } + \bfig{ \centerline{\getpic{Crossbar}} \caption{A crossbar switch @@ -580,7 +595,8 @@ \bfig{ \centerline{\getpic{Sierpinski}} - \caption{The Sierpinski triangle: a test of pic macro recursion + \caption{The Sierpinski triangle and a Cayley graph: + tests of pic macro recursion \src{Sierpinski.m4}.} } diff --git a/graphics/circuit_macros/examples/graysurf.m4 b/graphics/circuit_macros/examples/graysurf.m4 index 1dc3d1c38e..22372697b2 100644 --- a/graphics/circuit_macros/examples/graysurf.m4 +++ b/graphics/circuit_macros/examples/graysurf.m4 @@ -41,7 +41,7 @@ Surface:[ then to (project((x+dx),y,`fn((x+dx),y)'))\ then to (project(x,y,fnxy)) ) } } -] with .w at last [].e+(-0.2,0) +] #with .w at last [].e+(-0.2,0) Torus: [ # Calculate all the facet centres but draw diff --git a/graphics/circuit_macros/examples/ics.m4 b/graphics/circuit_macros/examples/ics.m4 index 660c07ab43..023b0d2a56 100644 --- a/graphics/circuit_macros/examples/ics.m4 +++ b/graphics/circuit_macros/examples/ics.m4 @@ -5,15 +5,23 @@ divert(-1) define(`lg_pinsep',3*L_unit) logic pin separation in logic units define(`lg_chipwd',18*L_unit) default chip width + `Chip outline sizes' +define(`chip_gen',` box invis wid lg_chipwd ht lg_pinsep*eval(`$1'/2+1) + arcd(last box.n, lg_pinsep/2, 180, 360) + { line to last box.ne chop -linewid bp__/2 } + { line from last arc.start to last box.nw chop -linewid bp__/2 } + line from last box.nw to last box.sw then to last box.se then to last box.ne + ') + `A sequence of pins along the east or west side of a chip: lg_pinseq(initial pin no,final pin no, e|w,initial offset,pinnum_root,Labelroot,[not])' +lg_pinseq(1,8,w) define(`lg_pinseq',`for_($1,$2,1, `lg_pin( Chip.s`$3'+(0,eval($4+m4x)*lg_pinsep), $6`'m4x,Pin`'eval($5`'m4x),`$3'`$7',eval($5`'m4x))') ') define(`ic6116',`[ Chip: box wid_ lg_chipwd ht_ 15*lg_pinsep - "6116" at Chip.sw below ljust lg_pin(Chip.sw_+(0,lg_pinsep),GND,Pin12,w,12) lg_pin(Chip.sw_+(0,2*lg_pinsep),lg_bartxt(CS),Pin18,wN,18) lg_pinseq(0,2,w,4,9+,D) @@ -24,10 +32,9 @@ define(`ic6116',`[ Chip: box wid_ lg_chipwd ht_ 15*lg_pinsep lg_pinseq(0,7,e,3,8-,A) lg_pinseq(8,9,e,3,31-,A) lg_pin(Chip.se_+(0,13*lg_pinsep),A10,Pin19,e,19) - ]') + `$1']') define(`ic6502',`[ Chip: box wid_ lg_chipwd ht_ 24*lg_pinsep - "6502" at Chip.sw_ below_ ljust_ lg_pin(Chip.sw_+(0,lg_pinsep),V\hbox{\tiny SS},Pin21,w,21) lg_pin(Chip.sw_+(0,2*lg_pinsep),V\hbox{\tiny SS},Pin1,w,1) lg_pin(Chip.sw_+(0,4*lg_pinsep),R/lg_bartxt(W),Pin34,w,34) @@ -44,10 +51,9 @@ define(`ic6502',`[ Chip: box wid_ lg_chipwd ht_ 24*lg_pinsep lg_pinseq(0,11,e,6,9+,A) lg_pinseq(12,15,e,6,10+,A) lg_pin(Chip.se+(0,23*lg_pinsep),lg_bartxt(IRQ),Pin4,eN,4) - ]') + `$1']') define(`ic6522',`[ Chip: box wid_ lg_chipwd ht_ 24*lg_pinsep - "6522" at Chip.sw below ljust lg_pin(Chip.sw_+(0,lg_pinsep),V\hbox{\tiny SS},Pin1,w,1) lg_pin(Chip.sw_+(0,3*lg_pinsep),CS1,Pin24,w,24) lg_pin(Chip.sw_+(0,4*lg_pinsep),{\large$\phi$},Pin25,w,25) @@ -65,10 +71,9 @@ define(`ic6522',`[ Chip: box wid_ lg_chipwd ht_ 24*lg_pinsep lg_pinseq(0,7,e,12,2+,PA) lg_pinseq(1,2,e,19,41-,CA) lg_pin(Chip.se_+(0,23*lg_pinsep),lg_bartxt(RESET),Pin34,eN,34) - ]') + `$1']') define(`ic74LS138',`[ Chip: box wid_ lg_chipwd ht_ 11*lg_pinsep - "74LS138" at Chip.sw below ljust lg_pin(Chip.sw_+(0,lg_pinsep),GND,Pin8,w,8) lg_pin(Chip.sw_+(0,2*lg_pinsep),lg_bartxt(G2a),Pin4,wN,4) lg_pin(Chip.sw_+(0,3*lg_pinsep),lg_bartxt(G2b),Pin5,wN,5) @@ -79,6 +84,33 @@ define(`ic74LS138',`[ Chip: box wid_ lg_chipwd ht_ 11*lg_pinsep lg_pin(Chip.sw_+(0,10*lg_pinsep),V\hbox{\tiny CC},Pin16,w,16) lg_pinseq(0,6,e,2,15-,Y,n) lg_pin(Chip.se_+(0,9*lg_pinsep),Y7,Pin7,eN,7) - ]') + `$1']') + +define(`ic4017',`[ Chip: chip_gen(16) + Loopover_(`x', + `lg_pin(Chip.nw-(0,lg_pinsep*m4Lx),x,Pin`'m4Lx,w,m4Lx)', + PL, Q3, I3, I0, CLE, Q0, TC, GND) + Loopover_(`x', + `lg_pin(Chip.se+(0,lg_pinsep*m4Lx),x,Pin`'eval(m4Lx+8),e,eval(m4Lx+8))', + MR, U/D, Q1, I1, I2, Q2, CLK, Vcc) + `$1']') + +define(`ic4510',`[ Chip: chip_gen(16) + Loopover_(`x', + `lg_pin(Chip.nw-(0,lg_pinsep*m4Lx),x,Pin`'m4Lx,w,m4Lx)', + PL, Q3, I3, I0, CLE, Q0, TC, GND) + Loopover_(`x', + `lg_pin(Chip.se+(0,lg_pinsep*m4Lx),x,Pin`'eval(m4Lx+8),e,eval(m4Lx+8))', + MR, U/D, Q1, I1, I2, Q2, CLK, Vcc) + `$1']') + +define(`icVS1053',`[ Chip: chip_gen(32) + Loopover_(`x', + `lg_pin(Chip.nw-(0,lg_pinsep*m4Lx),x,Pin`'m4Lx,w,m4Lx)', + LOUT,ROUT,GBUF,AGND,AGND,DREG,Vcc,3V3,GND,MISO,MOSI,sclk,RST,CS,DCS,DCS) + Loopover_(`x', + `lg_pin(Chip.se+(0,lg_pinsep*m4Lx),x,Pin`'eval(m4Lx+16),e,eval(m4Lx+16))', + SDCD,RX,TX,7,6,5,4,3,2,1,0,GND,3V3,AGND,MIC-,MIC+) + `$1']') divert(0)dnl diff --git a/graphics/circuit_macros/examples/lcct.m4 b/graphics/circuit_macros/examples/lcct.m4 index f1be48ac36..8fe244d796 100644 --- a/graphics/circuit_macros/examples/lcct.m4 +++ b/graphics/circuit_macros/examples/lcct.m4 @@ -18,7 +18,7 @@ del = lg_pinsep jog = del*2/3 right_ -IC1: ic6502 +IC1: ic6502("6502" at Chip.sw below ljust) Vcc: IC1.Pin8.end.x-del-elen_,IC1.Pin4.y+lg_pinsep+3*del Reset: IC1.Pin8.end.x-del,Vcc.y+del @@ -54,7 +54,8 @@ RWB: Here Addr: Here right_ -IC5: ic74LS138 with .Chip.nw at (IC1.Chip.w.x,Addr.y-2*del) +IC5: ic74LS138("74LS138" at Chip.sw below ljust) \ + with .Chip.nw at (IC1.Chip.w.x,Addr.y-2*del) line from IC5.Pin5.end down_ 3*lg_pinsep ; ground(,T,Groundtype) line from IC5.Pin16.end down_ 1.5*lg_pinsep ; ground(,T,Groundtype) move to IC5.Pin1.end; breakout(3,left,up) @@ -69,7 +70,8 @@ C1: Here } {line from IC1.Pin37.end to (Here,IC1.Pin37)} right_; xtal(right_ 3*del) -IC2: ic6116 with .Chip.nw at Here.x+2*del+lg_plen*L_unit,IC1.Chip.n.y +IC2: ic6116("6116" at Chip.sw below ljust) \ + with .Chip.nw at Here.x+2*del+lg_plen*L_unit,IC1.Chip.n.y line from IC2.Pin24.end up to (IC2.Pin24.end,Vcc) right_ Or1: OR_gate with .Out at IC2.Pin21.end @@ -87,9 +89,12 @@ RW: Here line down_ lg_pinsep from IC2.Pin20.end ; ground(,T,Groundtype) right_ -IC3: ic6116 with .Chip.nw at IC2.Chip.ne + (IC2.Chip.nw.x - IC1.Chip.ne.x-del,0) -IC4: ic6522 with .Chip.nw at IC3.Chip.ne + (IC2.Chip.nw.x - IC1.Chip.ne.x-del,0) -IC6: ic74LS138 with .Chip.nw at (IC3.Chip.nw,IC5.Chip.nw) +IC3: ic6116("6116" at Chip.sw below ljust) \ + with .Chip.nw at IC2.Chip.ne + (IC2.Chip.nw.x - IC1.Chip.ne.x-del,0) +IC4: ic6522("6522" at Chip.sw below ljust) \ + with .Chip.nw at IC3.Chip.ne + (IC2.Chip.nw.x - IC1.Chip.ne.x-del,0) +IC6: ic74LS138("74LS138" at Chip.sw below ljust) \ + with .Chip.nw at (IC3.Chip.nw,IC5.Chip.nw) line from Vcc to (IC4.Pin34.end.x+del,Vcc.y) line from Reset to (IC4.Pin34.end,Reset) then to IC4.Pin34.end diff --git a/graphics/circuit_macros/examples/mf/Makefile b/graphics/circuit_macros/examples/mf/Makefile index 10173d43f3..1386a927d6 100644 --- a/graphics/circuit_macros/examples/mf/Makefile +++ b/graphics/circuit_macros/examples/mf/Makefile @@ -5,6 +5,7 @@ LIBDIR = $$HOME/lib M4MACROS = mfpic.m4 M4 = m4 -I $(LIBDIR) +M4 = m4 # Use ljfive (which is 600dpi) because 1200dpi produces mf errors on some figs MODE = ljfive @@ -14,6 +15,8 @@ LATEX = TEXFORMATS=.: TEXFONTS=.: latex TR = tr '\075' '\134' PIC=dpic +#PIC=/cygdrive/d/Dwight/dpic/build/p2c/ftp/dpic +#PIC=/cygdrive/d/Dwight/dpic/bison/dpic testfont.ps: diff --git a/graphics/circuit_macros/examples/mf/cct.mf b/graphics/circuit_macros/examples/mf/cct.mf index a5c2759cfa..c3b66a5133 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/04/11 at 19:33 +% from TeX source "font" on 2019/10/15 at 16:40 numeric mfpicversion; mfpicversion := 110; if unknown mode: mode := localfont; fi if unknown mag: mag := 1000/1000; fi @@ -135,15 +135,15 @@ resizedrawpen (0.4bp); store (curpath) drawn -circle ((0.3084,0),0.002767); +circle ((0.3084,-0),0.002767); resizedrawpen (0.8bp); store (curpath) drawn polyline (false) -((0.3084,0), -(0.333333,0)); +((0.3084,-0), +(0.333333,-0)); endmfpic; % (3) line 59 in the TeX source. %------------------------------------------ @@ -299,15 +299,15 @@ resizedrawpen (0.4bp); store (curpath) drawn -circle ((-0.3084,0),0.002767); +circle ((-0.3084,-0),0.002767); resizedrawpen (0.8bp); store (curpath) drawn polyline (false) -((-0.3084,0), -(-0.333333,0)); +((-0.3084,-0), +(-0.333333,-0)); endmfpic; % (5) line 95 in the TeX source. %------------------------------------------ @@ -4687,7 +4687,7 @@ polyline (false) store (curpath) drawn -arcplr ((0,-0.2),0,-180,0.15); +arcplr ((0,-0.2),-0,-180,0.15); endmfpic; % (103) line 1561 in the TeX source. %------------------------------------------ @@ -4739,7 +4739,7 @@ polyline (false) store (curpath) drawn -arcplr ((0,0.2),-180,-360,0.15); +arcplr ((0,0.2),180,0,0.15); endmfpic; % (105) line 1581 in the TeX source. %------------------------------------------ @@ -5035,7 +5035,7 @@ polyline (false) store (curpath) drawn -arcplr ((0,-0.2),0,-180,0.15); +arcplr ((0,-0.2),-0,-180,0.15); store (curpath) drawn @@ -5095,7 +5095,7 @@ polyline (false) store (curpath) drawn -arcplr ((0,0.2),-180,-360,0.15); +arcplr ((0,0.2),180,0,0.15); store (curpath) drawn @@ -5276,7 +5276,7 @@ endmfpic; % (121) line 1761 in the TeX source. %----------------------------<122> unitlen := 1.0pt#; xscale := 72; yscale := 72; -bounds (-0, 0.4, -0.151089, 0.151089); +bounds (0, 0.4, -0.151089, 0.151089); beginmfpic(122); % line 1762 in the TeX source. @@ -5360,7 +5360,7 @@ endmfpic; % (123) line 1787 in the TeX source. %----------------------------<124> unitlen := 1.0pt#; xscale := 72; yscale := 72; -bounds (-0.4, 0, -0.151089, 0.151089); +bounds (-0.4, -0, -0.151089, 0.151089); beginmfpic(124); % line 1788 in the TeX source. @@ -5444,7 +5444,7 @@ endmfpic; % (125) line 1813 in the TeX source. %----------------------------<126> unitlen := 1.0pt#; xscale := 72; yscale := 72; -bounds (-0, 0.475, -0.151089, 0.151089); +bounds (0, 0.475, -0.151089, 0.151089); beginmfpic(126); % line 1814 in the TeX source. @@ -5536,7 +5536,7 @@ endmfpic; % (127) line 1841 in the TeX source. %----------------------------<128> unitlen := 1.0pt#; xscale := 72; yscale := 72; -bounds (-0.475, 0, -0.151089, 0.151089); +bounds (-0.475, -0, -0.151089, 0.151089); beginmfpic(128); % line 1842 in the TeX source. diff --git a/graphics/circuit_macros/examples/mf/font.m4 b/graphics/circuit_macros/examples/mf/font.m4 index f94e98207b..bbdc666642 100644 --- a/graphics/circuit_macros/examples/mf/font.m4 +++ b/graphics/circuit_macros/examples/mf/font.m4 @@ -5,10 +5,10 @@ \thispagestyle{empty} \opengraphsfile{cct} -ifdef(`L_unit',,`include(liblog.m4)') define(`srad_',`sourcerad_*3/2') define(`quad_',`srad_/sqrt(2)') define(`Dim',`dimen_*2/3') +include(liblog.m4) .PS resistor(right_ Dim) .PE diff --git a/graphics/circuit_macros/examples/mpost/Makefile b/graphics/circuit_macros/examples/mpost/Makefile index 37badbbf40..441d1d3ce2 100644 --- a/graphics/circuit_macros/examples/mpost/Makefile +++ b/graphics/circuit_macros/examples/mpost/Makefile @@ -24,19 +24,19 @@ FIGS = Adder.1 Alogix.1 ABlogix.1 Antennas.1 AmpTable.1 Audio.1 \ Counting.1 Crossbar.1 Crow.1 Csource.1 CanLogic.1 CctTable.1 Conn.1 \ Decoder.1 Demultiplexer.1 Diodes.1 Drive.1 \ Emarrows.1 Flow.1 Fuses.1 \ - Grounds.1 Headers.1 Heathkit.1 I2L.1 Inclpdf.1 Jack.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 \ Schottky.1 Sierpinski.1 ShiftR.1 Sixpole.1 Sources.1 SQUID.1 Switches.1 \ - Tgate.1 Three.1 Timer.1 TTLnand.1 Ttree.1 \ + Tgate.1 Three.1 Timer.1 TTLnand.1 Ttree.1 Tubediags.1 \ Variable.1 Windings.1 Xform.1 \ control.1 csc.1 diamond.1 ex00.1 ex01.1 ex02.1 \ ex03.1 ex04.1 ex05.1 ex06.1 ex08.1 ex09.1 ex10.1 \ ex11.1 ex12.1 ex15.1 ex16.1 ex17.1 ex18.1 ex21.1 exp.1 \ fet.1 graysurf.1 lcct.1 pwrsupply.1 quick.1 \ - recycle.1 rose.1 shapes.1 thyristor.1 sfg.1 ujt.1 worm.1 XOR.1 + random.1 recycle.1 rose.1 shapes.1 thyristor.1 sfg.1 ujt.1 worm.1 XOR.1 BOXDIMS = ex09 Crow Inclpdf Loglog Opamp Ttree Windings diff --git a/graphics/circuit_macros/examples/pgf/Makefile b/graphics/circuit_macros/examples/pgf/Makefile index daf98f1c5a..96a5e9face 100644 --- a/graphics/circuit_macros/examples/pgf/Makefile +++ b/graphics/circuit_macros/examples/pgf/Makefile @@ -23,7 +23,7 @@ FIGS = Adder.tex Alogix.tex ABlogix.tex Antennas.tex Audio.tex AmpTable.tex \ Csource.tex \ Decoder.tex Demultiplexer.tex Diodes.tex Drive.tex \ Emarrows.tex Flow.tex Fuses.tex \ - Grounds.tex Headers.tex Heathkit.tex Jack.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 \ @@ -31,15 +31,15 @@ FIGS = Adder.tex Alogix.tex ABlogix.tex Antennas.tex Audio.tex AmpTable.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 \ + 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 \ - recycle.tex rose.tex sfg.tex shapes.tex thyristor.tex ujt.tex worm.tex \ - XOR.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 @@ -50,11 +50,14 @@ BOXDIMS = ex09 Crow Incleps Loglog TTLnand Opamp Ttree Windings 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 $* + $(LATEX) $* dvips -Ppdf $* .m4.tex: $(M4) $(M4MACROS) $*.m4 | $(DPIC) -g > $*.tex @@ -62,7 +65,7 @@ TR = | tr '=' '\134' # $(DPIC) -g $*.pic > $*.tex .m4.pdf: $(M4) $(M4MACROS) $*.m4 | $(DPIC) -g > test.tex - pdflatex tstpgf + $(PDFLATEX) tstpgf mv tstpgf.pdf $*.pdf .m4.dim: printf '\\documentclass[11pt]{article}\n' > F$*.tex @@ -72,8 +75,8 @@ TR = | tr '=' '\134' 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$* + $(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 @@ -81,7 +84,7 @@ $(DOC).pdf: Incl.pdf $(DOC).tex -if test -n "$(BOXDIMS)" ; then \ for box in $(BOXDIMS) ; do touch F$$box.dim; make $$box.dim ; done; fi make $(FIGS) - pdflatex $(DOC) + $(PDFLATEX) $(DOC) EXL = exlinks $(DOC).ps: $(DOC).dvi @@ -90,7 +93,7 @@ $(DOC).ps: $(DOC).dvi $(DOC).dvi: Incl.eps.gz $(DOC).tex -if test "$(DOC)"="examplespgf" ; then make exlinks ; fi make dims $(FIGS) - latex $(DOC) + $(LATEX) $(DOC) dims: -if test -n "$(BOXDIMS)" ; then \ @@ -124,11 +127,11 @@ tst: test.m4 $(M4) pgf.m4 tstpgf.dim test.m4 \ > test.pic $(DPIC) -g test.pic > test.tex - latex tstpgf + $(LATEX) tstpgf $(M4) pgf.m4 tstpgf.dim test.m4 \ > test.pic $(DPIC) -g test.pic > test.tex - latex tstpgf + $(LATEX) tstpgf dvips tstpgf tst.pdf: test.m4 @@ -136,11 +139,11 @@ tst.pdf: test.m4 $(M4) pgf.m4 tstpgf.dim test.m4 \ > test.pic $(DPIC) -g test.pic > test.tex - pdflatex tstpgf + $(PDFLATEX) tstpgf $(M4) pgf.m4 tstpgf.dim test.m4 \ > test.pic $(DPIC) -g test.pic > test.tex - pdflatex tstpgf + $(PDFLATEX) tstpgf test.tex: test.m4 touch tstpgf.dim diff --git a/graphics/circuit_macros/examples/psfrag/Makefile b/graphics/circuit_macros/examples/psfrag/Makefile index cd2e7b63c5..881a9a6d8b 100644 --- a/graphics/circuit_macros/examples/psfrag/Makefile +++ b/graphics/circuit_macros/examples/psfrag/Makefile @@ -26,7 +26,7 @@ FIGS = Adder.eps Alogix.eps ABlogix.eps Antennas.eps Audio.eps AmpTable.eps \ Decoder.eps Demultiplexer.eps Diodes.eps Drive.eps \ Csource.eps \ Emarrows.eps Flow.eps Fuses.eps \ - Grounds.eps Headers.eps Heathkit.eps Jack.eps \ + GrayCode.eps Grounds.eps Headers.eps Heathkit.eps Jack.eps \ I2L.eps Inclpdf.eps \ Logic.eps Loglog.eps MC.eps Mixer.eps MotorControl.eps Multiplexer.eps \ NLG.eps NPDT.eps Nport.eps \ @@ -34,15 +34,15 @@ FIGS = Adder.eps Alogix.eps ABlogix.eps Antennas.eps Audio.eps AmpTable.eps \ Rectifiers.eps Relay.eps Rotbox.eps \ Schottky.eps Sierpinski.eps ShiftR.eps Sixpole.eps Sources.eps SQUID.eps \ Switches.eps \ - Tgate.eps Three.eps Timer.eps TTLnand.eps Ttree.eps \ - Windings.eps Variable.eps Xform.eps \ + Tgate.eps Three.eps Timer.eps TTLnand.eps Ttree.eps Tubediags.eps \ + Windings.eps Variable.eps Xform.eps XOR.eps \ control.eps csc.eps diamond.eps \ ex00.eps ex01.eps ex02.eps ex03.eps ex04.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 \ - recycle.eps rose.eps sfg.eps shapes.eps thyristor.eps ujt.eps worm.eps \ - XOR.eps + random.eps recycle.eps rose.eps sfg.eps shapes.eps thyristor.eps \ + ujt.eps worm.eps LOCALFIGS = ex21 @@ -54,10 +54,11 @@ BOXDIMS = ex09 Crow Inclpdf Loglog TTLnand Opamp Ttree Windings DPIC = dpic # DPIC = $$HOME/dpic/test/dpic +# DPIC = $$HOME/dpic/build/p2c/ftp/dpic TR = | tr '=' '\134' -LATEX = latex +LATEX = latex --quiet DIMFILE = tmp.dim @@ -113,7 +114,7 @@ tstpsfrag.ps: tstpsfrag.dvi dvips tstpsfrag tstpsfrag.dvi: test.eps - latex tstpsfrag + $(LATEX) tstpsfrag test.eps: test.pic $(DPIC) -f test.pic > test.eps @@ -121,7 +122,7 @@ test.eps: test.pic test.pic: test.m4 testlinks $(M4) $(M4MACROS) test.m4 > test.pic $(DPIC) -f test.pic > test.eps - latex tstpsfrag + $(LATEX) tstpsfrag touch tstpsfrag.dim $(M4) $(M4MACROS) tstpsfrag.dim test.m4 > test.pic diff --git a/graphics/circuit_macros/examples/random.m4 b/graphics/circuit_macros/examples/random.m4 index 6651048b75..d375cb6eb4 100644 --- a/graphics/circuit_macros/examples/random.m4 +++ b/graphics/circuit_macros/examples/random.m4 @@ -4,7 +4,6 @@ gen_init NeedDpicTools sinclude(tst.dim) s_init(random) -iflatex(`latexcommand({\small)') ################################################################ # hscale(right length,nlabels, @@ -97,5 +96,4 @@ for i=0 to ng do { x = i/ng*N.wid ] #showbox_ -iflatex(`latexcommand(})') .PE diff --git a/graphics/circuit_macros/examples/shapes.m4 b/graphics/circuit_macros/examples/shapes.m4 index 08962e9f85..914778c73c 100644 --- a/graphics/circuit_macros/examples/shapes.m4 +++ b/graphics/circuit_macros/examples/shapes.m4 @@ -64,7 +64,8 @@ define(`cone3D',`[ Start: (0,0) line from P to End outlined rgbstring(ql,ql,ql) `$5' if !b then { WB: P; b = 1 } } else { if b then { BW: P; b = 0 } } } - if vlength(CL.x,CL.y) != 0 then { Perp: (vperp(CL,radc,R)) } else { Perp: (radc,0) } + if vlength(CL.x,CL.y) != 0 then { Perp: (vperp(CL,radc,R)) } \ + else { Perp: (radc,0) } if cs >= 0 then { T: End; B: Start } else {T: Start; B: End } rpoint_(from Start to Perp) pout = (vlength(End.x,End.y) > abs(radc*cs)) diff --git a/graphics/circuit_macros/examples/svg/AdderSVG.m4 b/graphics/circuit_macros/examples/svg/AdderSVG.m4 index cef4d07a8e..6c0de6b5ed 100644 --- a/graphics/circuit_macros/examples/svg/AdderSVG.m4 +++ b/graphics/circuit_macros/examples/svg/AdderSVG.m4 @@ -4,7 +4,7 @@ log_init(svg_font(sans-serif,11bp__)) del = linewid/4 [ # full adder using gates - A: dot; {"A" rjust}; line right + A: dot; { move left 15bp__}; {"A" rjust}; line right Xor1: XOR_gate with .In1 at Here dy = Xor1.In1.y-Xor1.In2.y B: dot(at (A,Xor1.In2)); {"B" rjust}; line to Xor1.In2 diff --git a/graphics/circuit_macros/examples/svg/Banking.txt b/graphics/circuit_macros/examples/svg/Banking.txt deleted file mode 100644 index 122846d1c3..0000000000 --- a/graphics/circuit_macros/examples/svg/Banking.txt +++ /dev/null @@ -1,54 +0,0 @@ -.PS -#Banking.m4 - - command "" - textht = 12*(scale/72)*dptextratio # 12 pt size - - scale = 2.54 # use cm - boxwid = 6.8 - boxht = 4.5 - arrowwid = 0.25 - arrowht = 0.5 - -define heading {"$1"} -define subheading {"$1"} -define wtext {$1} - - C: circle diam 2.6 colored "mediumblue" - Person: box rad boxht/4 colored "mediumblue" with .n at C.s+(0,C.rad/8) \ - heading(Personal Banking) \ - "" \ - heading(Customer) \ - subheading(Person) \ - "" \ - wtext(A customer of the bank, with) \ - "wtext(personal bank accounts.)" - -# arrow thick 1.5 dashed down 3.5 from Person.s -# { box invis fill 1 ht 0.4 wid 1.0 "Uses" at last arrow } -# Internet: box colored "steelblue" \ -# "heading(Internet Banking System)" \ -# "subheading(Software system)" \ -# "" \ -# "wtext(Allows customers to view)" \ -# "wtext(information about their bank)" \ -# "wtext(accounts`,' and make payments.)" -# -# arrow thick 1.5 dashed right 5.4 from Internet.e \ -# "Sends e-mail" above "using" below -# Email: box colored "slategrey" \ -# "heading(E-mail System)" \ -# "subheading(Software system)" \ -# "" \ -# "wtext(The internal Microsoft Exchange)" \ -# "wtext(e-mail system..)" -# -# arrow thick 1.5 dashed from Email.nw+(0.4,0) to Person.se+(0.3,Person.ht/5) -# { box invis fill 1 ht 0.4 wid 3.3 "Sends e-mails to" at last arrow } - -# etc - - command "" # font -.PE diff --git a/graphics/circuit_macros/examples/svg/GrayCodeSVG.m4 b/graphics/circuit_macros/examples/svg/GrayCodeSVG.m4 new file mode 100644 index 0000000000..8d11969049 --- /dev/null +++ b/graphics/circuit_macros/examples/svg/GrayCodeSVG.m4 @@ -0,0 +1,20 @@ +.PS +# Gray_code.m4 +gen_init + + outer = 4 + inner = 0.75 + nbits = 10 + +C: circle diam outer + circle diam inner at C + sectors = 2^nbits + lthk = (outer-inner)/2/nbits + for bit = 1 to nbits do { + for is = 2^(bit-1) to sectors by 2^(bit+1) do { + startang = is/sectors*360 + endang = min(startang+(2^bit)/sectors*360,360) + arcd(C,outer/2-(bit-0.5)*lthk,startang,endang) thick lthk/(1bp__) + } + } +.PE diff --git a/graphics/circuit_macros/examples/svg/Makefile b/graphics/circuit_macros/examples/svg/Makefile index eba342fa22..4d604dac40 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 = ../../../dpic/bison/dpic .SUFFIXES: .pic .svg .m4 .pic.svg: @@ -25,7 +26,7 @@ CCTSVG = \ CrowSVG.svg CrullerSVG.svg CsourceSVG.svg \ DecoderSVG.svg DemultiplexerSVG.svg DiodesSVG.svg DriveSVG.svg \ EmarrowsSVG.svg \ - FlowSVG.svg FontsSVG.svg FusesSVG.svg GroundsSVG.svg \ + FlowSVG.svg FontsSVG.svg FusesSVG.svg GrayCodeSVG.svg GroundsSVG.svg \ HeadersSVG.svg HeathkitSVG.svg InclepsSVG.svg I2LSVG.svg JackSVG.svg \ LogicSVG.svg LoglogSVG.svg \ MCSVG.svg MixerSVG.svg MotorControlSVG.svg MultiplexerSVG.svg \ @@ -34,8 +35,8 @@ CCTSVG = \ RectifiersSVG.svg RelaySVG.svg RotboxSVG.svg\ SchottkySVG.svg ShiftRSVG.svg SierpinskiSVG.svg \ SixpoleSVG.svg SourcesSVG.svg SQUIDSVG.svg SwitchesSVG.svg \ - TTLnandSVG.svg TgateSVG.svg TtreeSVG.svg \ - ThreeSVG.svg TimerSVG.svg VariableSVG.svg WindingsSVG.svg XformSVG.svg \ + TTLnandSVG.svg TgateSVG.svg TtreeSVG.svg ThreeSVG.svg TimerSVG.svg \ + TubediagsSVG.svg VariableSVG.svg WindingsSVG.svg XformSVG.svg \ controlSVG.svg cscSVG.svg diamondSVG.svg ex00SVG.svg \ ex01SVG.svg ex02SVG.svg ex03SVG.svg ex04SVG.svg ex05SVG.svg ex06SVG.svg \ ex08SVG.svg ex09SVG.svg ex10SVG.svg ex11SVG.svg ex12SVG.svg \ diff --git a/graphics/circuit_macros/examples/svg/RotboxSVG.m4 b/graphics/circuit_macros/examples/svg/RotboxSVG.m4 index a5686ba393..3d4fbde82b 100644 --- a/graphics/circuit_macros/examples/svg/RotboxSVG.m4 +++ b/graphics/circuit_macros/examples/svg/RotboxSVG.m4 @@ -11,9 +11,9 @@ gen_init "r=0.1" at last [] move to last [].ne Point_(0) - [ for_(2,8,2, `rotbox(,,dashed,t=m4x/10) at last []+vec_(boxwid*1.1,0) + [[]; for_(2,8,2, `rotbox(,,dashed,t=m4x/10) at last []+vec_(boxwid*1.1,0) sprintf("t=%g",m4x/10) at last [] ') ] with .nw at last [].ne+(0.1,0) - [ for_(10,16,2, `rotbox(,,dashed,t=m4x/10) at last []+vec_(boxwid*1.1,0) + [[]; for_(10,16,2, `rotbox(,,dashed,t=m4x/10) at last []+vec_(boxwid*1.1,0) sprintf("t=%g",m4x/10) at last [] ') ] with .nw at last [].sw+(0,-0.1) ] diff --git a/graphics/circuit_macros/examples/svg/SierpinskiSVG.m4 b/graphics/circuit_macros/examples/svg/SierpinskiSVG.m4 index 3a014b8a0f..7fbf13bf15 100644 --- a/graphics/circuit_macros/examples/svg/SierpinskiSVG.m4 +++ b/graphics/circuit_macros/examples/svg/SierpinskiSVG.m4 @@ -1,6 +1,7 @@ .PS # Sierpinski.m4 gen_init +[ define Sierpinski { if $1 > 0.04 then { d = $1/2-lh @@ -14,6 +15,7 @@ gen_init r = 4 linethick = 0.2 + #linethick = 1/2 /(1pt__) lw = linethick pt__ /2 s3 = sqrt(3) lh = lw*s3 @@ -21,6 +23,32 @@ gen_init d = r/2-lh shade(0,line from A+(0,lw) right d then up d*s3 left d then down d*s3 left d\ then right d ) -# psset_(linecolor=white) + ifpstricks(`psset_(linecolor=white)') Sierpinski(r/2,A) + + ifpstricks(`psset_(linecolor=black)') + thicklines_ + ] + +# CayleyGraph.m4 +[ +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); } + { line to Here+(cosd($2+90),sind($2+90))*($1) + exec sprintf("CayleyGraph(%g,%g,%g);",0.5*($1),$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); } + } + } + + size = 2 + depth = 6 + for t=0 to 270 by 90 do { + line from (0,0) to (cosd(t),sind(t)); + { exec sprintf("CayleyGraph(%g,%g,%g);",size/4,t,depth); } + } + ] with .sw at last [].se+(-0.25,0) + .PE diff --git a/graphics/circuit_macros/examples/svg/TubediagsSVG.m4 b/graphics/circuit_macros/examples/svg/TubediagsSVG.m4 new file mode 100644 index 0000000000..cfc87b0a6a --- /dev/null +++ b/graphics/circuit_macros/examples/svg/TubediagsSVG.m4 @@ -0,0 +1,361 @@ +.PS +# TubediagsSVG.m4 + +cct_init(svg_font(sans-serif,11bp__,2bp__)) +include(../tubedefs.m4) + +# Some base diagrams +[ Loopover_(`xv',` + V_`'xv: m4xpand(B_`'xv) ifelse(m4Lx,1,, + `with .Base at last [].Base+(dimen_*3,0)') + "xv" at V_`'xv.Base.s+(0,-dimen_/3) below', + 2AG,2D,4BB,9K) ] + +# Test circuit +[ +Ld: dot + battery(up dimen_,2) + line right_ dimen_ +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,"svg_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 + { line down dimen_/2 +B: dot } + source(to (Tg,Here),"V"); corner; line to Tg + line from Tr.P1.c to (Tr.P1.c,Pot1.Start) + source(right_ elen_,"mA"); llabel(-,,+); rlabel(,I`'svg_sub(b)) +Tp: dot + { source(down_ to (Here,B),"V") + llabel(+,,-); rlabel(,E`'svg_sub(b)); dot } + line right_ dimen_/2 then down_ (Here.y-B.y)/2 then right_ dimen_/2 +P2: potentiometer(down_ Tp.y-B.y,5,0.5,-dimen_/6) with .T1 at Here + dot(at P2.End) + line right_ dimen_ from P2.Start; corner + battery(down_ dimen_*3/4,2,R) +T: Here + battery(up_ dimen_*3/4 from (Here,B),2) + line dashed up_ to T "B" ljust + line from (T,B) left T.x-Ld.x+dimen_/2 then up Ld.y-B.y then to Ld + ] with .nw at last [].sw + (0,-dimen_/2) + +define(`OutputXformer',`[ pushdef(`dimen_',dimen_*1.5) + S1: inductor(up_ dimen_*.4,L,3,M) + { line right_ dimen_/4 from last [].e; S2T: dot(,,1) + line from S1.end right_ S2T.x-S1.end.x; S21: dot(,,1) + line from S1.start right_ S2T.x-S1.end.x; S22: dot(,,1) } + move up_ dimen_/8 + S2: inductor(up_ dimen_*.4,L,3,M) + { line right_ dimen_/4 from last [].e; S1T: dot(,,1) + line from S2.end right_ S2T.x-S2.end.x; S11: dot(,,1) + line from S2.start right_ S2T.x-S2.end.x; S12: dot(,,1) } + line down_ dimen_/8 from M4Core1.start + line down_ dimen_/8 from M4Core2.start + P: inductor(down_ dimen_*0.6 with .c at 0.5 between S1.end and S2.start \ + -(dimen_*0.8,0),L,5,) + P1: P.start + P2: P.end + PT: last [].w + popdef(`dimen_')]') + +define(`PowerXformer',`[ pushdef(`dimen_',dimen_*1.5) + S3: inductor(up_ dimen_*.2,L,1,M) + ST3: last [].e + { line up_ dimen_/10 from M4Core1.end; line up_ dimen_/10 from M4Core2.end } + S2: inductor(up_ dimen_*.2 from S3.end+(0,dimen_/10),L,1,M) + { line up_ dimen_/10 from M4Core1.end; line up_ dimen_/10 from M4Core2.end } + S1: inductor(up_ dimen_*.4 from S2.end+(0,dimen_/10),L,3,M) + ST1: last [].e + P: inductor(down_ dimen_*0.6 with .c at 0.5 between S1.end and S3.start \ + -(dimen_*0.8,0),L,5,) + popdef(`dimen_')]') + +# Circuit of 25 W amplifier (adapted from F. Langford-Smith, "Radiotron +# Designer's Handbook," fourth edition, Harrison, NJ, Radio Corporation +# of America, 1952) + +[ Toprail: Here +#{"Toprail"} + resistor(down_ dimen_); rlabel(,100 k) +V1P: dot +#{"V1P" rjust} + line down_ dimen_*3/4 +V1: triode(,W) with .P1 at Here + {"6SL7" at V1.nw above } + resistor(down_ dimen_*3/2 from V1.K1.sw); llabel(,2.2 k) +Rail1: dot +#{"Rail1"} + ground + arrow left_ from V1.G1.w +RP: Here + arrow <- right from (Here,Rail1) to Rail1 + dot(at last arrow) + resistor(up_ 2nd last arrow.y-Here.y); llabel(,22 k); dot + { move left_ dimen_ }; "Pickup" at RP below + capacitor(right_ dimen_ from V1P,C,R); llabel(,0.05 svg_mu) + resistor(down_ dimen_); rlabel(,470 k) +V1o: dot +#{ "V1o" at V1o rjust } + resistor(down_ (Here.y-Rail1.y)/2); rlabel(,22 k) + dot + { capacitor(down_ Here.y-Rail1.y,C); rlabel(,0.01 svg_mu); dot } + line right_ dimen_/2 +R47: resistor(down_ to (Here,Rail1)); llabel(,4.7 M) + line to Rail1 + +Pot1: potentiometer(down_ dimen_,,0.5,dimen_*2/3) \ + with .T1 at (V1o+(elen_+dimen_*2/3,0),V1.G1) + { line from Pot1.Start left_ (Pot1.Start.x-V1o.x)/2 + continue to (Here,V1o) then to V1o } + line from Pot1.End down_ dimen_/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 k); dot + { capacitor(right_ dimen_,C,R); rlabel(,2 n) +V2k: dot } +#{ "V2k" at V2k above } + { line down_ to (Here,Rail1) + variable(`resistor(right_ dimen_); rlabel(,1 M);') + line up_ to V2k } + line to V2.K1.se + + line from Toprail to (R47,Toprail); dot + { capacitor(down_ dimen_,C); rlabel(10 svg_mu); ground(,T) } + R51k: resistor(right_ dimen_); rlabel(,51 k); dot + { capacitor(down_ dimen_,C); llabel(10 svg_mu); ground(,T) } + dot(at (V2.P1.c,Here)) + resistor(down_ dimen_); llabel(,100 k) +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 k); dot; ground + line left_ dimen_/2 + resistor(up_ to (Here,V3.G1)); llabel(,,2.2); rlabel(,,M); dot + { line to V3.G1.w } + line to (Here,V2p); capacitor(left_ to V2p,C,R); rlabel(,3 n) + + dot(at (V3.P1.c,Toprail)); { line to R51k.end } + resistor(down_ dimen_); llabel(,51 k) +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(,.1 svg_mu) + line to (V2k,Here) + resistor(down_ to V2k); rlabel(0.1); llabel( M) +#{"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 k) +V4k: dot +#{"V4k"} + line left dimen_*3/4 +V4k1: dot + { resistor(up_ V4.G1.y-Here.y); llabel(,,2.2 M) +V4G: dot } + line from V3p right_ dimen_ + variable(`resistor(down_ to (Here,V4.G1)); llabel(100 k)') +V3o: dot + capacitor(right_ to V4G,C); llabel(,3 n) + line to V4.G1.w + resistor(left_ from V4k1 to (V3o,V4k)); rlabel(,51 k); dot + ground + capacitor(down_ from V3o to Here,C); llabel(,,500 p) + + line from V4.P1.c to (V4.P1.c,V3p); + resistor(up_ dimen_); llabel(,51 k); dot + resistor(left_ to (V3p,Here)); llabel(,10 k) + +V5: triode(,N) with .G1.w at V4.G1.e+(2.25*dimen_,0) + "6SL7" at V5.n above rjust +V6: triode(,SR) with .G1.w at V5.G1.w-(0,dimen_*2.5) + "6SL7" at (V6.w,V6.P1) below rjust + +V4p: dot(at (V4.P1.c,V3p)) +#{"V4p"} + line right_ dimen_*2/3; capacitor(right_ dimen_,C); llabel(,3 p) + line down_ to (Here,V5.G1) +V5G: dot; { line to V5.G1.w } +#{"V5G"} + resistor(down_ dimen_); rlabel(,2.2 M); dot; + resistor(right_ to (V5.K1.sw,Here)); llabel(,1 k) +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 p) +V6G: dot; { line to V6.G1.w } +#{"V6G"} + resistor(up_ dimen_); llabel(,2.2 M); dot + resistor(right_ to (V6.K1.nw,Here)); llabel(,1 k) +V6K: dot +#{"V6K"} + line to V6.K1.nw + resistor(left_ dimen_*2/3 from (V6G,V6K)); rlabel(,1 k) dot; ground + line to (Here,V5K); resistor(right_ dimen_*2/3); llabel(,1 k) + +PV: dot(at (V4.e.x+dimen_/5,Toprail.y)) +#{"PV"} + line from V6.P1.c down_ V4p.y-V4.P1.c.y +Rail2: dot +#{"Rail2" below} + line from PV to (PV,Rail2); corner + { resistor(right_ to Rail2); llabel(,220 k) } + move up_ dimen_*2/3; dot; line left_ dimen_/2 +V6sw: dot +#{"V6sw"} + capacitor(down_ dimen_*2/3,C); rlabel(,10 svg_mu); ground(,T) + +V5P: dot(at (V6.P1.c,V4p)); { line to V5.P1.c } +#{"V5P"} + resistor(to (Here,Toprail)); rlabel(,220 k) + line to (V4p,Here) + + V7: V_6L6G at (V3,Rail2+(0,-2*dimen_)); "6L6G" at V7.n above ljust + V8: V_6L6G(,R) at V7+(0,-2*dimen_); "6L6G" at V8.s below ljust + line right dimen_/4 from V7.G2.e; resistor(right_ dimen_); llabel(,100); +V9G: dot +#{"V9G"} + line right dimen_/4 from V8.G2.e; resistor(right_ dimen_); llabel(,100); + V9: V_6L6G(,,G2) with .G2.w at V9G+(dimen_/2,0); "6L6G" at V9.n above rjust + V10: V_6L6G(,R,G2) at V9+(0,-2*dimen_); "6L6G" at V10.s below rjust + line from V9G to V9.G2.w + line from V10.G2.w left_ dimen_/2 +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 k) +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 k) + + 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 svg_mu); ground(,T) } +PP: potentiometer(left_ dimen_,,0.5,dimen_/2) with .Start at Here + rlabel(,50 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 + round(,tubethick) + line thick tubethick down tubeplatelen/3 left tubeplatelen*2/9 + line down_ dimen_/4 then left_ dimen_ then up_ dimen_/4 + round(,tubethick) + line thick tubethick up tubeplatelen/3 left tubeplatelen*2/9 + round(,tubethick) + line thick tubethick down tubeplatelen/3 left tubeplatelen*2/9 + line down_ dimen_/4; ground + "1st two 6SL7" at Here+(dimen_*3/4,dimen_/2) above + +V9T: dot(at (L910,V7K)-(0,dimen_/4)) +#{"V9T"} + + line right_ dimen_/2 from V9.G1.e; continue to (Here,V9.P1)+(0,dimen_*2/3) + resistor(left_ to (V7G,Here)); llabel(,100) +V7nw: dot; { line to (Here,V7.G1) } + line right_ dimen_/2 from V10.G1.e; continue to (Here,V10.P1)-(0,dimen_*2/3) + resistor(left_ to (V7G,Here)); rlabel(,100) +V8sw: dot; { line to (Here,V8.G1) } + + line from V9.P1.c up_ dimen_ +V9P: dot + line from V10.P1.c down_ dimen_ +V10P: dot +#{"V10P"} + + line from V7.P1.c up_ V9P.y-V7.P1.y then to V9P + resistor(right_ to (V5.e+(dimen_/4,0),Here)) + rlabel(,"100 k" "2 W") +Rt1: Here + line to (Here,V6.e)+(0,dimen_/6); resistor(up_ dimen_) + llabel(,"100 k" rjust "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(,"100 k" "2 W") + resistor(up_ dimen_*3/2) + llabel(,"100 k" rjust "2 W") + line to (Here,V6K) then to V6K + + line from V9T to (V9.e+(dimen_*3/4,0),V9T) +Xout: OutputXformer with .PT at Here + line from Xout.P1 to (Xout.P1,V9P); dot + line from Xout.P2 to (Xout.P1,V10P); dot + line from Xout.PT left_ dimen_/4 +XT: dot + + resistor(from V6sw left_ dimen_); rlabel(,10 k) +XP: dot + { line down_ dimen_; continue to (XT,Here) then to XT } + + capacitor(right_ dimen_*5/4 from V5P,C); llabel(,0.1 svg_mu) + 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 svg_mu) + 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(,"100 k" ljust "2 W"); dot; ground } + { capacitor(down_ dimen_*2/3,C); llabel(,40 svg_mu); dot } + reversed(`inductor',left_ dimen_,L,,M); rlabel(,4 H 300 mA) +Filt: dot + { capacitor(down_ dimen_*2/3,C); llabel(,40 svg_mu) + line to R100.end } + +Pwr: [ + PXform: PowerXformer + line left_ dimen_/4 from PXform.P.start; fuse(left_ dimen_/2,D) + AC1: arrow left_ dimen_/2 + AC2: arrow from PXform.P.end to (AC1.end,PXform.P.end) + "AC" at 0.5 between AC1.end and AC2.end ljust + dot(at PXform.ST3); line right_ dimen_/4; dot + dot(at PXform.ST1); line right_ dimen_/4 then down_ dimen_*3/2; ground(,T) + line from PXform.S2.end right_ dimen_*2.5 then up_ dimen_/4 + Rect2: V_5V4G with .F1.sw at Here; "5V4G" at Rect2.n+(0,dimen_/2) + Rect1: V_5V4G with .e at Rect2.w-(dimen_/2,0); "5V4G" at Rect1.n+(0,dimen_/2) + move to Rect1.F1.sw; line to (Here,PXform.S2.end); dot + move to Rect1.F1.se; line to (Here,PXform.S2.start); dot + move to Rect2.F1.se; line to (Here,PXform.S2.start) +PO: dot + line from Rect1.P1 left_ dimen_/2; dot + { line to (Here,PXform.S1.start) then to PXform.S1.start } + line to (Here,Rect1.n)+(0,dimen_/8) + continue to (Rect1.P2+(dimen_/2,0),Here) + continue to (Here,Rect1.P2) then to Rect1.P2 + line from Rect2.P1 left_ dimen_/2 then up_ Rect2.ht/2+dimen_/4; dot + { line to (Rect2.P2+(dimen_/2,0),Here) + continue to (Here,Rect2.P2) then to Rect2.P2 } + move to PXform.S1.end + 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 V" at PXform.S2 + (dimen_*3/4,0) + "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(,"V" ljust "adj"); corner + line to Filt + + ] with .nw at last [].sw+(0,-0.5) + + command "" # end font +.PE diff --git a/graphics/circuit_macros/examples/svg/examplesSVG.htmx b/graphics/circuit_macros/examples/svg/examplesSVG.htmx index 0a5fd2eca9..d4f45ecdef 100644 --- a/graphics/circuit_macros/examples/svg/examplesSVG.htmx +++ b/graphics/circuit_macros/examples/svg/examplesSVG.htmx @@ -310,6 +310,7 @@ cfig(ex02SVG) cfig(RectifiersSVG) cfig(HeathkitSVG) cfig(lcctSVG) +cfig(TubediagsSVG) cfig(sfgSVG) cfig(LogicSVG) cfig(ex08SVG) @@ -323,11 +324,12 @@ cfig(CanLogicSVG) cfig(AlogixSVG) cfig(ABlogixSVG) cfig(XORSVG) +cfig(paletteSVG) cfig(ex00SVG) +cfig(GrayCodeSVG) cfig(CrossbarSVG) cfig(ByteSVG) cfig(RotboxSVG) -cfig(paletteSVG) cfig(randomSVG) cfig(expSVG) cfig(graysurfSVG) diff --git a/graphics/circuit_macros/examples/svg/graysurfSVG.m4 b/graphics/circuit_macros/examples/svg/graysurfSVG.m4 index 9ea5580703..5427b62afc 100644 --- a/graphics/circuit_macros/examples/svg/graysurfSVG.m4 +++ b/graphics/circuit_macros/examples/svg/graysurfSVG.m4 @@ -4,7 +4,7 @@ threeD_init copy "HOMELIB_/dpictools.pic" Overall: [ - +[] Surface:[ # This just draws the facets back to front @@ -184,7 +184,7 @@ Z: arrow from Zv to (project(0,0,1.2)); "z" ljust # Partial rim ellipsearc(maxy*2,maxy*2*sind(elevation),-pi_*1.4,pi_/3) \ with .C at (project(0,0,(maxy^2-1)^2)+linethick bp__/2) -] scaled 1.25 with .s at 1st [].ne+(0,-0.75) +] scaled 1.25 with .s at 2nd [].ne+(0,-0.75) ] scaled 0.85 .PE diff --git a/graphics/circuit_macros/examples/svg/icsSVG.m4 b/graphics/circuit_macros/examples/svg/icsSVG.m4 index 88ea5b65a0..9a1f40634a 100644 --- a/graphics/circuit_macros/examples/svg/icsSVG.m4 +++ b/graphics/circuit_macros/examples/svg/icsSVG.m4 @@ -13,7 +13,6 @@ define(`lg_pinseq',`for_($1,$2,1, $6`'m4x,Pin`'eval($5`'m4x),`$3'`$7',eval($5`'m4x))') ') define(`ic6116',`[ Chip: box wid_ lg_chipwd ht_ 15*lg_pinsep - "6116" at Chip.sw+(0,-2bp__) below ljust lg_pin(Chip.sw_+(0,lg_pinsep),GND,Pin12,w,12) lg_pin(Chip.sw_+(0,2*lg_pinsep),,Pin18,wN,18) "svg_small(CS,75)" wid textht*1.5 at (Chip.w,last line) ljust @@ -33,10 +32,9 @@ define(`ic6116',`[ Chip: box wid_ lg_chipwd ht_ 15*lg_pinsep lg_pinseq(0,7,e,3,8-,A) lg_pinseq(8,9,e,3,31-,A) lg_pin(Chip.se_+(0,13*lg_pinsep),A10,Pin19,e,19) - ]') + `$1']') define(`ic6502',`[ Chip: box wid_ lg_chipwd ht_ 24*lg_pinsep - "6502" at Chip.sw_+(0,-2bp__) below_ ljust_ lg_pin(Chip.sw_+(0,lg_pinsep),V`'svg_small(SS,75),Pin21,w,21) lg_pin(Chip.sw_+(0,2*lg_pinsep),V`'svg_small(SS,75),Pin1,w,1) lg_pin(Chip.sw_+(0,4*lg_pinsep),,Pin34,w,34) @@ -63,11 +61,9 @@ define(`ic6502',`[ Chip: box wid_ lg_chipwd ht_ 24*lg_pinsep lg_pin(Chip.se+(0,23*lg_pinsep),,Pin4,eN,4) "svg_small(IRQ,75)" wid textht*2.0 at (Chip.e,last line) rjust { line left last "".wid from last "".ne+(-1,0)*textoffset } - - ]') + `$1']') define(`ic6522',`[ Chip: box wid_ lg_chipwd ht_ 24*lg_pinsep - "6522" at Chip.sw+(0,-2bp__) below ljust lg_pin(Chip.sw_+(0,lg_pinsep),V`'svg_small(SS,75),Pin1,w,1) lg_pin(Chip.sw_+(0,3*lg_pinsep),CS1,Pin24,w,24) lg_pin(Chip.sw_+(0,4*lg_pinsep),CK,Pin25,w,25) @@ -97,10 +93,9 @@ define(`ic6522',`[ Chip: box wid_ lg_chipwd ht_ 24*lg_pinsep "svg_small(RESET,75)" wid textht*3.8 at (Chip.e,last line) rjust { line left last "".wid from last "".ne+(-1,0)*textoffset } - ]') + `$1']') define(`ic74LS138',`[ Chip: box wid_ lg_chipwd ht_ 11*lg_pinsep - "74LS138" at Chip.sw+(0,-2bp__) below ljust lg_pin(Chip.sw_+(0,lg_pinsep),GND,Pin8,w,8) lg_pin(Chip.sw_+(0,2*lg_pinsep),,Pin4,wN,4) "svg_small(G2a,75)" wid textht*2.0 at (Chip.w,last line) ljust @@ -117,6 +112,6 @@ define(`ic74LS138',`[ Chip: box wid_ lg_chipwd ht_ 11*lg_pinsep lg_pin(Chip.sw_+(0,10*lg_pinsep),V`'svg_small(CC,75),Pin16,w,16) lg_pinseq(0,6,e,2,15-,Y,n) lg_pin(Chip.se_+(0,9*lg_pinsep),Y7,Pin7,eN,7) - ]') + `$1']') divert(0)dnl diff --git a/graphics/circuit_macros/examples/svg/lcctSVG.m4 b/graphics/circuit_macros/examples/svg/lcctSVG.m4 index 0a91b823cc..9994b32309 100644 --- a/graphics/circuit_macros/examples/svg/lcctSVG.m4 +++ b/graphics/circuit_macros/examples/svg/lcctSVG.m4 @@ -20,7 +20,7 @@ del = lg_pinsep jog = del*2/3 right_ -IC1: ic6502 +IC1: ic6502("6502" at Chip.sw+(0,-2bp__) below ljust) \ Vcc: IC1.Pin8.end.x-del-elen_,IC1.Pin4.y+lg_pinsep+3*del Reset: IC1.Pin8.end.x-del,Vcc.y+del @@ -56,7 +56,8 @@ RWB: Here Addr: Here right_ -IC5: ic74LS138 with .Chip.nw at (IC1.Chip.w.x,Addr.y-2*del) +IC5: ic74LS138("74LS138" at Chip.sw+(0,-2bp__) below ljust) \ + with .Chip.nw at (IC1.Chip.w.x,Addr.y-2*del) line from IC5.Pin5.end down_ 3*lg_pinsep ; ground(,T,Groundtype) line from IC5.Pin16.end down_ 1.5*lg_pinsep ; ground(,T,Groundtype) move to IC5.Pin1.end; breakout(3,left,up) @@ -71,7 +72,8 @@ C1: Here } {line from IC1.Pin37.end to (Here,IC1.Pin37)} right_; xtal(right_ 3*del) -IC2: ic6116 with .Chip.nw at Here.x+2*del+lg_plen*L_unit,IC1.Chip.n.y +IC2: ic6116("6116" at Chip.sw+(0,-2bp__) below ljust) \ + with .Chip.nw at Here.x+2*del+lg_plen*L_unit,IC1.Chip.n.y line from IC2.Pin24.end up to (IC2.Pin24.end,Vcc) right_ Or1: OR_gate with .Out at IC2.Pin21.end @@ -89,9 +91,12 @@ RW: Here line down_ lg_pinsep from IC2.Pin20.end ; ground(,T,Groundtype) right_ -IC3: ic6116 with .Chip.nw at IC2.Chip.ne + (IC2.Chip.nw.x - IC1.Chip.ne.x-del,0) -IC4: ic6522 with .Chip.nw at IC3.Chip.ne + (IC2.Chip.nw.x - IC1.Chip.ne.x-del,0) -IC6: ic74LS138 with .Chip.nw at (IC3.Chip.nw,IC5.Chip.nw) +IC3: ic6116("6116" at Chip.sw+(0,-2bp__) below ljust) \ + with .Chip.nw at IC2.Chip.ne + (IC2.Chip.nw.x - IC1.Chip.ne.x-del,0) +IC4: ic6522("6522" at Chip.sw+(0,-2bp__) below ljust) \ + with .Chip.nw at IC3.Chip.ne + (IC2.Chip.nw.x - IC1.Chip.ne.x-del,0) +IC6: ic74LS138("74LS138" at Chip.sw+(0,-2bp__) below ljust) \ + with .Chip.nw at (IC3.Chip.nw,IC5.Chip.nw) line from Vcc to (IC4.Pin34.end.x+del,Vcc.y) line from Reset to (IC4.Pin34.end,Reset) then to IC4.Pin34.end diff --git a/graphics/circuit_macros/examples/tst.tex b/graphics/circuit_macros/examples/tst.tex index ef14d1a43c..46992a001f 100644 --- a/graphics/circuit_macros/examples/tst.tex +++ b/graphics/circuit_macros/examples/tst.tex @@ -7,8 +7,10 @@ \usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits} \usepackage{amssymb} % -\addtolength{\textwidth}{2cm} -\addtolength{\textheight}{3cm} +%\addtolength{\textwidth}{2cm} +\addtolength{\textwidth}{10cm} % for Tubediags.ps +%\addtolength{\textheight}{3cm} +\addtolength{\textheight}{10cm} % for Tubediags.ps \setlength{\oddsidemargin}{0pt} \setlength{\evensidemargin}{0pt} \setlength{\hoffset}{-0.5in} diff --git a/graphics/circuit_macros/examples/tubedefs.m4 b/graphics/circuit_macros/examples/tubedefs.m4 new file mode 100644 index 0000000000..af47e307b7 --- /dev/null +++ b/graphics/circuit_macros/examples/tubedefs.m4 @@ -0,0 +1,260 @@ +divert(-1) +# tubedefs.m4 +# macros for the Tubediags.m4 file + +# Size parameters +define(`tubediam',`dimen_') +define(`tubethick',`2') +define(`tubepindiam',`tubediam*3/8') +define(`tubeplatelen',`tubediam/2') +define(`tubegridlen',`tubediam*7/12') +define(`tubcathlen',`tubeplatelen-tubethick bp__') +define(`tubedotthick',`1.2') +define(`tubedotdiam',`tubediam/6') +define(`tgap',`tubediam*3/20') + +# Generic tubes + `triode(diam,R[N|S|E|W]) + R=tubeplate at bottom + N,S,E,W=half circle' +define(`triode',`[ ifelse(`$1',,,`pushdef(`tubediam',`$1')') + drawEnv(`$2') + G1: tubegrid(right tubegridlen at Env) + ifinstr(`$2',R, + `K1: tubecathode(,`$2') with .s at G1+(0,tgap) + P1: tubeplate(at G1+(0,-tgap))', + `K1: tubecathode(,`$2') with .n at G1+(0,-tgap) + P1: tubeplate(at G1+(0,tgap))') + `$3' ifelse(`$1',,,`popdef(`tubediam')')] ') + + `tetrode(diam,R[N|S|E|W]) + R=tubeplate at bottom + N,S,E,W=half circle' +define(`tetrode',`[ ifelse(`$1',,,`pushdef(`tubediam',`$1')') + drawEnv(`$2') + ifinstr(`$2',R, + `G1: tubegrid(right tubegridlen at Env+(0,tgap/2)) + G2: tubegrid(right tubegridlen at G1-(0,tgap)) + P1: tubeplate(at G2-(0,tgap)) + K1: tubecathode(,`$2') with .s at G1+(0,tgap)', + `G1: tubegrid(right tubegridlen at Env-(0,tgap/2)) + G2: tubegrid(right tubegridlen at G1+(0,tgap)) + P1: tubeplate(at G2+(0,tgap)) + K1: tubecathode(,`$2') with .n at G1+(0,-tgap)') + `$3' ifelse(`$1',,,`popdef(`tubediam')')] ') + + `pentode(diam,R[N|S|E|W]) + R=tubeplate at bottom + N,S,E,W=half circle' +define(`pentode',`[ ifelse(`$1',,,`pushdef(`tubediam',`$1')') + drawEnv(`$2') pushdef(`tgap',`tubediam/8') + ifinstr(`$2',R, + `G2: tubegrid(right tubegridlen at Env-(0,tgap/4)) + G3: tubegrid(right tubegridlen at G2-(0,tgap)) + P1: tubeplate(at G3-(0,tgap)) + G1: tubegrid(right tubegridlen at G2+(0,tgap)) + K1: tubecathode(,`$2') with .s at G1+(0,tgap)', + `G2: tubegrid(right tubegridlen at Env+(0,tgap/4)) + G3: tubegrid(right tubegridlen at G2+(0,tgap)) + P1: tubeplate(at G3+(0,tgap)) + G1: tubegrid(right tubegridlen at G2-(0,tgap)) + K1: tubecathode(,`$2') with .n at G1-(0,tgap)') popdef(`tgap') + `$3' ifelse(`$1',,,`popdef(`tubediam')')] ') + +# utilities +define(`drawEnv', + `thktmp = linethick; linethick_(tubethick) + Env: circle invis diam tubediam + ifinstr(`$1',N, + `line from Env.w down tubediam*3/2/8 + line from Env.e down tubediam*3/2/8 + arc from Env.e to Env.w', + `$1',S, + `line from Env.w up tubediam*3/2/8 + line from Env.e up tubediam*3/2/8 + arc from Env.w to Env.e', + `$1',E, + `line from Env.n left tubediam*3/2/8 + line from Env.s left tubediam*3/2/8 + arc from Env.s to Env.n', + `$1',W, + `line from Env.n right tubediam*3/2/8 + line from Env.s right tubediam*3/2/8 + arc from Env.n to Env.s', + `circle diam tubediam') with .c at Env + linethick_(thktmp) ') + +define(`tubedot',`dot(ifelse(`$1',,`at Here',`$1'),tubedotdiam/2,1,thick tubedotthick)') + +define(`pin',`circle diam tubepindiam `$1'') + +define(`Base_pins',`define(`pincount',`ifelse(`$2',,8,`$2')')dnl + define(`pinpattern',`ifelse(`$1',,8,`$1')')dnl + define(`pininit',`ifelse(`$3',,-90,`$3')')dnl + for_(1,pincount,1, + `pinang = pininit+360/(2*pinpattern)-m4x*360/pinpattern + Pin`'m4x: pin(at \ + Base+(Rect_(Base.rad+tubepindiam/2+tubethick/2bp__,pinang)) \ + ifsvg("svg_small(m4x)","\small m4x")) + {PinT`'m4x: Base+(Rect_(Base.rad+tubethick/2bp__,pinang))} ') + ') + +# structural elements + `tubeplate(attributes,length)' +define(`tubeplate',`line thick tubethick right ifelse(`$2',,tubeplatelen,`$2') `$1'') + +define(`thinthick',0.4)dnl +define(`thinline',`line thick thinthick')dnl + +define(`tubeTab',`[ + ang = ifelse(`$1',,90,`$1') + ca = cosd(ang); sa = sind(ang) + tabht = tubepindiam/2 + tabwd = tabht*5/6 + T0: Here + T1: T0+(vrot_(0,tabwd/2,ca,sa)) + T2: T0+(vrot_(tabht,tabwd/2,ca,sa)) + T3: T0+(vrot_(tabht,-tabwd/2,ca,sa)) + T4: T0+(vrot_(0,-tabwd/2,ca,sa)) + line from T1 to T2 then to T3 then to T4 fill_(ifelse(`$2',,1,`$2')) + ] with .T0 at Base+(Rect_(tubediam*3/2/2+tubethick/2bp__,ifelse(`$1',,90,`$1'))) + ') + +define(`tubegrid',`dashline(ifelse(`$1',,`right tubegridlen',`$1'), + thick tubethick,(tubegridlen*7/8/3),(tubegridlen/8/2))') + + `tubecathode(length,R)' +define(`tubecathode',`[ + box invis wid ifelse(`$1',,tubcathlen,`$1') ht tubeplatelen/6 + ifinstr(`$2',R, + `line thick tubethick from last box.nw to last box.sw \ + then to last box.se then to last box.ne', + `line thick tubethick from last box.sw to last box.nw \ + then to last box.ne then to last box.se ') + `$3'] ') + + `tubefilament(length,R)' +define(`tubefilament',`[ define(`filalen',`ifelse(`$1',,`tubeplatelen/3',`$1')')dnl + round(,tubethick) define(`filn',`ifinstr(`$2',R,-)') + line thick tubethick up filn`'tubeplatelen/3 right tubeplatelen*2/9; round(,tubethick) + line thick tubethick down filn`'tubeplatelen/3 right tubeplatelen*2/9 + round(,tubethick) + `$3'] ') + +# specific base examples, bottom view +define(`B_2AG',`[ ifelse(`$1',,,`pushdef(`tubediam',`$1')') + Base: circle thick tubethick diam tubediam*3/2 + Base_pins(8,7) + Dk1: tubedot(at Base+(0,-tubedotdiam*5/6)) + P1: tubeplate(at Base+(0,tubedotdiam/3)) + thinline from PinT1 to Dk1 chop 0 chop tubedotdiam/2 + thinline from P1 to Base.n + tubeTab(90) + `$2' ifelse(`$1',,,`popdef(`tubediam')') ]') + +define(`B_2D',`[ ifelse(`$1',,,`pushdef(`tubediam',`$1')') + Base: circle thick tubethick diam tubediam*3/2 + Base_pins(4,4) + G1: tubegrid(right tubegridlen at Base) + F1: tubefilament with .n at G1+(0,-tgap) + P1: tubeplate(at G1+(0,tgap)) + thtmp = linethick; linethick = thinthick + T1: tubeTab(105) + T2: tubeTab(75) + line from PinT1 to F1.sw + line from PinT4 to F1.se + line from G1.start left tubediam*3/2/8 then to T1.T0 + line from P1 up tubediam*3/2/8 then to T2.T0 + linethick = thtmp + `$2' ifelse(`$1',,,`popdef(`tubediam')') ] ') + +define(`B_4BB',`[ ifelse(`$1',,,`pushdef(`tubediam',`$1')') + Base: circle thick tubethick diam tubediam*3/2 + Base_pins(8,8) + K1: tubecathode with .n at Base-(0,tgap/2) + F1: tubefilament with .n at K1.s + G1: tubegrid(right tubegridlen at K1.n+(0,tgap)) + P1: tubeplate(at G1+(0,tgap)) + pushdef(`hoprad_',`dimen_/16') thtmp = linethick; linethick_(thinthick) + T1: tubeTab(135) + T2: tubeTab(-45) + T3: tubeTab(-90,0) + line from PinT2 to F1.sw + L7: line from PinT7 to F1.se + line up tgap from P1 then to T1.T0 + move to K1.se + crossover(to (Here,PinT8),,L7) + line right tgap from G1.end; corner + crossover(to (Here,T2.T1),,L7); line to T2.T0 + popdef(`hoprad_') linethick_(thtmp) + `$2' ifelse(`$1',,,`popdef(`tubediam')') ] ') + +define(`B_9K',`[ ifelse(`$1',,,`pushdef(`tubediam',`$1')') + Base: circle thick tubethick diam tubediam*3/2 + Base_pins(10,9,-90-360/20) + G1: tubegrid(right tubegridlen at Base-(0,tgap/2)) + K1: tubecathode with .n at G1+(0,-tgap) + F1: tubefilament with .n at K1.s + G2: tubegrid(right tubegridlen at G1+(0,tgap)) + G3: tubegrid(right tubegridlen at G2+(0,tgap)) + P1: tubeplate(at G3+(0,tgap)) + pushdef(`hoprad_',`dimen_/16') thtmp = linethick; linethick_(thinthick) + L3: line from G3.start to PinT3 + M6: move from G2.end to (PinT6,G2.end) + line from M6.start to M6.end then to PinT6 + L7: line from K1.se right tubediam*3/2/5 + L71: line to PinT7 + line up tgap from P1 then left tubeplatelen/2 + { M1: move left tgap down tgap + M21: move up tgap from PinT1 } + line to Intersect_(M1,M21) + crossover(to PinT1,R,L3) + L8: line right tgap from G1.e + crossover(to PinT8,,L71) + line from F1.se to (K1.e+(tgap*3/4,0),F1) + corner(thinthick) + crossover(to P1.e+(tgap*3/4,tgap/2),R,L7,L8) + line to PinT5 + line up tgap*3/2 from PinT9 then to PinT8 + line from F1.sw to (K1.w-(tgap*3/4,0),F1) + crossover(up P1.y-tgap/2-Here.y,,L3) + crossover(to PinT4,,M1) + popdef(`hoprad_') linethick_(thtmp) + `$2' ifelse(`$1',,,`popdef(`tubediam')') ] ') + +# specific tubes + `V_6L6G(diam,R[N|S|E|W],G1|G2) + R=plate at bottom + N,S,E,W=half circle' +define(`V_6L6G',`[ ifelse(`$1',,,`pushdef(`tubediam',`$1')') + drawEnv(`$2') pushdef(`tgap',`tubediam/8') + ifinstr(`$2',R, + `G2: tubegrid(right tubegridlen at Env-(0,tgap/4)) + G3: dashline(right tubegridlen at G2-(0,tgap),thick tubethick, + (tubegridlen*3/10),(tubegridlen*4/10)) + P1: tubeplate(at G3-(0,tgap)) + G1: tubegrid(right tubegridlen at G2+(0,tgap)) + K1: tubecathode(,`$2') with .s at G1+(0,tgap) + line from K1.nw down tgap/2 left tgap + crossover(to (Here,G3),R,ifelse(`$3',,G1,`$3')); corner; line to G3.w ', + `G2: tubegrid(right tubegridlen at Env+(0,tgap/4)) + G3: dashline(right tubegridlen at G2+(0,tgap),thick tubethick, + (tubegridlen*3/10),(tubegridlen*4/10)) + P1: tubeplate(at G3+(0,tgap)) + G1: tubegrid(right tubegridlen at G2-(0,tgap)) + K1: tubecathode(,`$2') with .n at G1-(0,tgap) + line from K1.sw up tgap/2 left tgap + crossover(to (Here,G3),,ifelse(`$3',,G1,`$3')); corner; line to G3.w ') + popdef(`tgap') `$4' ifelse(`$1',,,`popdef(`tubediam')')] ') + + `5U4G rectifier(diam,R)' +define(`V_5V4G',`[ ifelse(`$1',,,`pushdef(`tubediam',`$1')') + drawEnv(`$2') + P1: line thick tubethick up tubediam/3 with .c at Env-(tubediam/6,0) + P2: line thick tubethick up tubediam/3 with .c at Env+(tubediam/6,0) + ifinstr(`$2',R, + `F1: tubefilament(,R) with .n at Env.n-(0,tubediam/20) ', + `F1: tubefilament with .s at Env.s+(0,tubediam/20) ') + `$3'] ') + +divert(0)dnl diff --git a/graphics/circuit_macros/examples/xfig/xfiglib.fig b/graphics/circuit_macros/examples/xfig/xfiglib.fig index a07a0885f8..d567d99933 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.04.10 option -x for Fig 3.2 +# dpic version 2019.12.31 option -x for Fig 3.2 1200 2 6 0 0 3975 5025 6 0 0 3975 5025 diff --git a/graphics/circuit_macros/gpic.m4 b/graphics/circuit_macros/gpic.m4 index 7202ce6e15..3b8a60e40e 100644 --- a/graphics/circuit_macros/gpic.m4 +++ b/graphics/circuit_macros/gpic.m4 @@ -1,7 +1,7 @@ divert(-1) gpic.m4 Initialization for gpic. -* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under * +* Circuit_macros Version 9.1, copyright (c) 2019 J. D. Aplevich under * * the LaTeX Project Public License. The files of this distribution may * * be redistributed or modified provided that this copyright notice is * * included and provided that modifications are clearly marked to * diff --git a/graphics/circuit_macros/lib3D.m4 b/graphics/circuit_macros/lib3D.m4 index 68c0ca3ba3..90bb05d2d1 100644 --- a/graphics/circuit_macros/lib3D.m4 +++ b/graphics/circuit_macros/lib3D.m4 @@ -3,7 +3,7 @@ lib3D.m4 Macros for rotation, projection, and other operations on argument triples representing 3D vectors. -* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under * +* Circuit_macros Version 9.1, copyright (c) 2019 J. D. Aplevich under * * the LaTeX Project Public License. The files of this distribution may * * be redistributed or modified provided that this copyright notice is * * included and provided that modifications are clearly marked to * @@ -26,6 +26,7 @@ ifdef(`libgen_',,`include(libgen.m4)divert(-1)') P =( -sin(az), cos(az), 0 ) (-sin(el)cos(az),-sin(az)sin(el),cos(el))' define(`setview',` +# setview m4azim=ifelse(`$1',,0,`$1',0,0,`prod_(`$1',dtor_)') m4elev=ifelse(`$2',,0,`$2',0,0,`prod_(`$2',dtor_)') m4rot =ifelse(`$3',,0,`$3',0,0,`prod_(`$3',dtor_)') diff --git a/graphics/circuit_macros/libcct.m4 b/graphics/circuit_macros/libcct.m4 index 52c9922402..f8a98a84c0 100644 --- a/graphics/circuit_macros/libcct.m4 +++ b/graphics/circuit_macros/libcct.m4 @@ -1,7 +1,7 @@ divert(-1) libcct.m4 -* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under * +* Circuit_macros Version 9.1, copyright (c) 2019 J. D. Aplevich under * * the LaTeX Project Public License. The files of this distribution may * * be redistributed or modified provided that this copyright notice is * * included and provided that modifications are clearly marked to * diff --git a/graphics/circuit_macros/libgen.m4 b/graphics/circuit_macros/libgen.m4 index 0b7212b513..f65fc2f74f 100644 --- a/graphics/circuit_macros/libgen.m4 +++ b/graphics/circuit_macros/libgen.m4 @@ -2,7 +2,7 @@ divert(-1) libgen.m4 Base macros for dpic and gpic diagrams -* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under * +* Circuit_macros Version 9.1, copyright (c) 2019 J. D. Aplevich under * * the LaTeX Project Public License. The files of this distribution may * * be redistributed or modified provided that this copyright notice is * * included and provided that modifications are clearly marked to * @@ -181,7 +181,7 @@ define(`SIdefaults', define(`latexcommand',`command "ifmpost(verbatimtex) `$1' ifmpost(etex)"') define(`m4announceprocessor',`dnl Do not change the format of the next line: -`#' `$1' Version 9.0: ifelse(m4picprocessor,gpic,`Gpic', +`#' `$1' Version 9.1: ifelse(m4picprocessor,gpic,`Gpic', m4postprocessor,pstricks,`PSTricks', m4postprocessor,pgf,`TikZ PGF', m4postprocessor,mfpic,`Mfpic', @@ -460,7 +460,7 @@ define(`dashline',`rpoint_(`$1')define(`m4opts',`$2') m4xtract(`m4opts',->),1,`define(`m4rar',->)')dnl if (m4dsh+m4ssv)==0 then { dashline_n = 1 } \ else {dashline_n = max(1,\ - int(abs((rp_len ifelse(`$5',G,,+m4ssv))/(m4dsh+m4ssv))))} + round_(abs((rp_len ifelse(`$5',G,,+m4ssv))/(m4dsh+m4ssv))))} dashline_f = (rp_len-(dashline_n ifelse(`$5',G,,-1))*m4ssv)/dashline_n for m4ti=1 to dashline_n do { if m4ti==1 then { line m4opts m4lar to rvec_(dashline_f,0) } \ @@ -596,7 +596,7 @@ define(`abs_',`ifelse(index($1,-),0,`substr($1,1)',`$1')') define(`neg_',`ifelse($1,0,0,index($1,-),0,`substr($1,1)',-`$1')') define(`sign_',`ifelse(index($1,-),0,-,)') - `Vector sum: Vsum_(A,B) evaluates to A+(B) with + `Vector sum: Vsum_(A,B) evaluates to A+B with dpic, A+(B.x,B.y) with gpic' define(`Vsum_',`ifdpic(`$1'+`$2', ``$1'+(`$2'.x,`$2'.y)')') @@ -608,6 +608,8 @@ define(`Vdiff_',`ifdpic(`$1'-(`$2'), (V.x*s,V.y*s) with gpic' define(`Vsprod_',`ifdpic((`$1')*(`$2'), `(prod_(`$1'.x,`$2'),prod_(`$1'.y,`$2'))')') + `The x,y coordinate pair of a position' +define(`Vcoords_',`(`$1').x,(`$1').y') `binary_(n,[m]) binary representation of n, padded to m bits @@ -636,6 +638,8 @@ define(`vrot_', `diff_(prod_($3,$1),prod_($4,$2)),sum_(prod_($4,$1),prod_($3,$2))') `rot_(x,y,t)' define(`rot_',`vrot_($1,$2,cos($3),sin($3))') + `Rot_(X,deg) rotate location by degrees' +define(`Rot_',`vrot_($1.x,$1.y,cosd($2),sind($2))') `rrot_(x,y,t)' define(`rrot_',`Here+(rot_($1,$2,$3))') @@ -808,7 +812,7 @@ define(`dot',`[define(`m4ft',`ifelse(`$3',,0,(`$3'))')dnl ifgpic(`circle rad ifelse(`$2',,`dotrad_',`$2') fill_(m4ft)', `ifdef(`r_',`rgbfill(r_+(1-r_)*m4ft, g_+(1-g_)*m4ft, b_+(1-b_)*m4ft, circle rad ifelse(`$2',,`dotrad_',`$2'))', - `circle rad ifelse(`$2',,`dotrad_',`$2') fill_(m4ft)')') + `circle rad ifelse(`$2',,`dotrad_',`$2') fill_(m4ft)')') dnl `$4'] with .c ifelse(`$1',,`at Here',`$1') move to last [].c') `cross(at location); assumes that a @@ -1535,14 +1539,6 @@ define(`sinusoid', define(`def_bisect',`NeedDpicTools') # This macro is obsolete - Normally redefined in initialization macros: -ifelse(ifgpic(,F)`'ifpstricks(,F)`'ifmfpic(,F)`'ifpgf(,F)`'ifsvg(,F),,` -define(`thinlines_',` -command "\thinlines%" -') TeX commands are written on separate lines -define(`thicklines_',` -command "\thicklines%" -')') `Colour routines:' `graystring(value in [0,1])' define(`graystring',`rgbstring(`$1',`$1',`$1')') diff --git a/graphics/circuit_macros/liblog.m4 b/graphics/circuit_macros/liblog.m4 index 2e9b7baca4..0e8d4a5022 100644 --- a/graphics/circuit_macros/liblog.m4 +++ b/graphics/circuit_macros/liblog.m4 @@ -1,7 +1,7 @@ divert(-1) liblog.m4 Logic gates -* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under * +* Circuit_macros Version 9.1, copyright (c) 2019 J. D. Aplevich under * * the LaTeX Project Public License. The files of this distribution may * * be redistributed or modified provided that this copyright notice is * * included and provided that modifications are clearly marked to * @@ -485,6 +485,8 @@ define(`NOT_gate',`ifinstr(`$2',B, `The comprehensive logic pin: lg_pin(location, label, Picname, n|e|s|w [L|M|I|O][N][E], pinno, optlen) + label=text indicating logical pin function; + Picname=pic label for referring to the pin; n|e|s|w=orientation; L=active low out; M=active low in; I=inward arrow; O=outward arrow N=negated; E=edge trigger' diff --git a/graphics/circuit_macros/mfpic.m4 b/graphics/circuit_macros/mfpic.m4 index d9c7ccc767..c513899628 100644 --- a/graphics/circuit_macros/mfpic.m4 +++ b/graphics/circuit_macros/mfpic.m4 @@ -1,7 +1,7 @@ divert(-1) mfpic.m4 Initialization for mfpic. -* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under * +* Circuit_macros Version 9.1, copyright (c) 2019 J. D. Aplevich under * * the LaTeX Project Public License. The files of this distribution may * * be redistributed or modified provided that this copyright notice is * * included and provided that modifications are clearly marked to * diff --git a/graphics/circuit_macros/mpost.m4 b/graphics/circuit_macros/mpost.m4 index bb528c067e..1377038ea7 100644 --- a/graphics/circuit_macros/mpost.m4 +++ b/graphics/circuit_macros/mpost.m4 @@ -1,7 +1,7 @@ divert(-1) mpost.m4 Initialization for metapost. -* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under * +* Circuit_macros Version 9.1, copyright (c) 2019 J. D. Aplevich under * * the LaTeX Project Public License. The files of this distribution may * * be redistributed or modified provided that this copyright notice is * * included and provided that modifications are clearly marked to * diff --git a/graphics/circuit_macros/pgf.m4 b/graphics/circuit_macros/pgf.m4 index 13767bed06..0d3d83db0f 100644 --- a/graphics/circuit_macros/pgf.m4 +++ b/graphics/circuit_macros/pgf.m4 @@ -1,7 +1,7 @@ divert(-1) pgf.m4 Initialization for Tikz-pgf. -* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under * +* Circuit_macros Version 9.1, copyright (c) 2019 J. D. Aplevich under * * the LaTeX Project Public License. The files of this distribution may * * be redistributed or modified provided that this copyright notice is * * included and provided that modifications are clearly marked to * diff --git a/graphics/circuit_macros/postscript.m4 b/graphics/circuit_macros/postscript.m4 index 4a8d9b7ec0..912170bb9a 100644 --- a/graphics/circuit_macros/postscript.m4 +++ b/graphics/circuit_macros/postscript.m4 @@ -1,7 +1,7 @@ divert(-1) postscript.m4 Initialization for Postscript output. -* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under * +* Circuit_macros Version 9.1, copyright (c) 2019 J. D. Aplevich under * * the LaTeX Project Public License. The files of this distribution may * * be redistributed or modified provided that this copyright notice is * * included and provided that modifications are clearly marked to * diff --git a/graphics/circuit_macros/psfrag.m4 b/graphics/circuit_macros/psfrag.m4 index 3088c5670a..c1e6dace50 100644 --- a/graphics/circuit_macros/psfrag.m4 +++ b/graphics/circuit_macros/psfrag.m4 @@ -2,7 +2,7 @@ divert(-1) psfrag.m4 Initialization for dpic -f processing: Postscript with psfrag strings -* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under * +* Circuit_macros Version 9.1, copyright (c) 2019 J. D. Aplevich under * * the LaTeX Project Public License. The files of this distribution may * * be redistributed or modified provided that this copyright notice is * * included and provided that modifications are clearly marked to * diff --git a/graphics/circuit_macros/pstricks.m4 b/graphics/circuit_macros/pstricks.m4 index ef7bb03d7c..d2fdebcbe0 100644 --- a/graphics/circuit_macros/pstricks.m4 +++ b/graphics/circuit_macros/pstricks.m4 @@ -1,7 +1,7 @@ divert(-1) pstricks.m4 Initialization for PSTricks. -* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under * +* Circuit_macros Version 9.1, copyright (c) 2019 J. D. Aplevich under * * the LaTeX Project Public License. The files of this distribution may * * be redistributed or modified provided that this copyright notice is * * included and provided that modifications are clearly marked to * diff --git a/graphics/circuit_macros/svg.m4 b/graphics/circuit_macros/svg.m4 index 4676222c40..cd04defbf6 100644 --- a/graphics/circuit_macros/svg.m4 +++ b/graphics/circuit_macros/svg.m4 @@ -1,7 +1,7 @@ divert(-1) svg.m4 Initialization for SVG output. -* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under * +* Circuit_macros Version 9.1, copyright (c) 2019 J. D. Aplevich under * * the LaTeX Project Public License. The files of this distribution may * * be redistributed or modified provided that this copyright notice is * * included and provided that modifications are clearly marked to * diff --git a/graphics/circuit_macros/xfig.m4 b/graphics/circuit_macros/xfig.m4 index 44bd0dc7a7..f8757b5e18 100644 --- a/graphics/circuit_macros/xfig.m4 +++ b/graphics/circuit_macros/xfig.m4 @@ -1,7 +1,7 @@ divert(-1) xfig.m4 Initialization for xfig. -* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under * +* Circuit_macros Version 9.1, copyright (c) 2019 J. D. Aplevich under * * the LaTeX Project Public License. The files of this distribution may * * be redistributed or modified provided that this copyright notice is * * included and provided that modifications are clearly marked to * -- cgit v1.2.3