summaryrefslogtreecommitdiff
path: root/graphics/circuit_macros
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-06-01 03:03:23 +0000
committerNorbert Preining <norbert@preining.info>2023-06-01 03:03:23 +0000
commita378d2379e220fa1022ae052bcd1aed6bf0d2c41 (patch)
treeea7474d9b63bd7343446152da818a0f51b4b4f26 /graphics/circuit_macros
parent63f5147c70933ab652aa5c700beabb6685d1139a (diff)
CTAN sync 202306010303
Diffstat (limited to 'graphics/circuit_macros')
-rw-r--r--graphics/circuit_macros/CHANGES3
-rw-r--r--graphics/circuit_macros/Copying2
-rw-r--r--graphics/circuit_macros/README7
-rw-r--r--graphics/circuit_macros/darrow.m42
-rw-r--r--graphics/circuit_macros/doc/AlogixMan.m466
-rw-r--r--graphics/circuit_macros/doc/AutologixMan.m49
-rw-r--r--graphics/circuit_macros/doc/CanLogicMan.tex142
-rw-r--r--graphics/circuit_macros/doc/Circuit_macros.bib14
-rw-r--r--graphics/circuit_macros/doc/Circuit_macros.pdfbin1037622 -> 1055738 bytes
-rw-r--r--graphics/circuit_macros/doc/Makefile10
-rw-r--r--graphics/circuit_macros/doc/QTrans.m419
-rw-r--r--graphics/circuit_macros/doc/SRffMan.m439
-rw-r--r--graphics/circuit_macros/doc/Version.tex2
-rw-r--r--graphics/circuit_macros/doc/XformMan.m410
-rw-r--r--graphics/circuit_macros/doc/body.tex291
-rw-r--r--graphics/circuit_macros/doc/defines.tex38
-rw-r--r--graphics/circuit_macros/doc/sampleIC.m411
-rw-r--r--graphics/circuit_macros/dpictools.pic20
-rw-r--r--graphics/circuit_macros/examples/Alogix.m428
-rw-r--r--graphics/circuit_macros/examples/CanLogic.m444
-rw-r--r--graphics/circuit_macros/examples/Diodes.m44
-rw-r--r--graphics/circuit_macros/examples/Makefile3
-rw-r--r--graphics/circuit_macros/examples/Mixer.m46
-rw-r--r--graphics/circuit_macros/examples/UNO.m42
-rw-r--r--graphics/circuit_macros/examples/Views.dms5
-rw-r--r--graphics/circuit_macros/examples/control.m48
-rw-r--r--graphics/circuit_macros/examples/dpv/CanLogicDPV.m444
-rw-r--r--graphics/circuit_macros/examples/dpv/UNODPV.m42
-rw-r--r--graphics/circuit_macros/examples/dpv/examplesDPV.htmx10
-rw-r--r--graphics/circuit_macros/examples/dpv/examplesDPVs.htmx11
-rw-r--r--graphics/circuit_macros/examples/dpv/sfgDPV.m46
-rw-r--r--graphics/circuit_macros/examples/dpv/tstDPV.htmx11
-rw-r--r--graphics/circuit_macros/examples/examples.pdfbin1903610 -> 1902473 bytes
-rw-r--r--graphics/circuit_macros/examples/extras/README_extras18
-rw-r--r--graphics/circuit_macros/examples/extras/Y14-5_example.m453
-rw-r--r--graphics/circuit_macros/examples/files.tex3
-rw-r--r--graphics/circuit_macros/examples/keyboard.pdfbin118060 -> 0 bytes
-rw-r--r--graphics/circuit_macros/examples/mf/cct.mf2
-rw-r--r--graphics/circuit_macros/examples/mpost/Makefile19
-rw-r--r--graphics/circuit_macros/examples/sfg.m48
-rw-r--r--graphics/circuit_macros/examples/shadowed.m41
-rw-r--r--graphics/circuit_macros/examples/xfig/xfiglib.fig2
-rw-r--r--graphics/circuit_macros/examples/xtras61
-rw-r--r--graphics/circuit_macros/gpic.m42
-rw-r--r--graphics/circuit_macros/lib3D.m42
-rw-r--r--graphics/circuit_macros/libSLD.m42
-rw-r--r--graphics/circuit_macros/libcct.m445
-rw-r--r--graphics/circuit_macros/libgen.m491
-rw-r--r--graphics/circuit_macros/liblog.m488
-rw-r--r--graphics/circuit_macros/mfpic.m42
-rw-r--r--graphics/circuit_macros/mpost.m42
-rw-r--r--graphics/circuit_macros/pdf.m42
-rw-r--r--graphics/circuit_macros/pgf.m42
-rw-r--r--graphics/circuit_macros/postscript.m42
-rw-r--r--graphics/circuit_macros/psfrag.m42
-rw-r--r--graphics/circuit_macros/pstricks.m42
-rw-r--r--graphics/circuit_macros/svg.m42
-rw-r--r--graphics/circuit_macros/xfig.m42
58 files changed, 848 insertions, 436 deletions
diff --git a/graphics/circuit_macros/CHANGES b/graphics/circuit_macros/CHANGES
index 1c34df35d8..466b2d8e44 100644
--- a/graphics/circuit_macros/CHANGES
+++ b/graphics/circuit_macros/CHANGES
@@ -1,5 +1,8 @@
CHANGES
+Version 10.3: Tweaked sfg_init and NeedDpicTools functionality;
+ macro lin_ang, langle, ACsymbol, DCsymbol, Ysymbol, Deltasymbol,
+ Autologix. New macro polygon.
Version 10.2: New options for tconn, heater, lamp, thermocouple.
New macro jumper. Include configuration file pdf.m4 in distribution.
Fixed examples/Makefile. Tweaked macros sl_ct, figures in the manual.
diff --git a/graphics/circuit_macros/Copying b/graphics/circuit_macros/Copying
index 96f3a0ceed..6ab5c35895 100644
--- a/graphics/circuit_macros/Copying
+++ b/graphics/circuit_macros/Copying
@@ -1,4 +1,4 @@
-* Circuit_macros Version 10.2, copyright (c) 2023 J. D. Aplevich under *
+* Circuit_macros Version 10.3, copyright (c) 2023 J. D. Aplevich under *
* the LaTeX Project Public Licence in file Licence.txt. The files of *
* this distribution may be redistributed or modified provided that this *
* copyright notice is included and provided that modifications are clearly *
diff --git a/graphics/circuit_macros/README b/graphics/circuit_macros/README
index d3cd9aab5a..43c6a847b3 100644
--- a/graphics/circuit_macros/README
+++ b/graphics/circuit_macros/README
@@ -1,5 +1,5 @@
-* Circuit_macros Version 10.2, copyright (c) 2023 J. D. Aplevich under *
+* Circuit_macros Version 10.3, copyright (c) 2023 J. D. Aplevich under *
* the LaTeX Project Public Licence in file Licence.txt. The files of *
* this distribution may be redistributed or modified provided that this *
* copyright notice is included and provided that modifications are clearly *
@@ -255,8 +255,9 @@ INTEGRATION WITH OTHER TOOLS:
http://someonehasdonethis.blogspot.ca/2012/12/a-solution-for-drawing-circuit-diagrams.html
Mac users:
- A nice description of a Mac installation is at
- https://www.hamish.science/2020/06/24/circuitmacros
+ Descriptions of Mac installations have been published from time to time;
+ for example:
+ https://www.yumpu.com/en/document/view/34946319/using-circuitmacros-in-mac-os-x-automation-and-robotics-
VARIATIONS
Macros such as these will be modified inevitably to suit individual
diff --git a/graphics/circuit_macros/darrow.m4 b/graphics/circuit_macros/darrow.m4
index 98a98eac32..4b29a48560 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 10.2, copyright (c) 2023 J. D. Aplevich under *
+* Circuit_macros Version 10.3, copyright (c) 2023 J. D. Aplevich under *
* the LaTeX Project Public Licence in file Licence.txt. The files of *
* this distribution may be redistributed or modified provided that this *
* copyright notice is included and provided that modifications are clearly *
diff --git a/graphics/circuit_macros/doc/AlogixMan.m4 b/graphics/circuit_macros/doc/AlogixMan.m4
new file mode 100644
index 0000000000..b524f555ee
--- /dev/null
+++ b/graphics/circuit_macros/doc/AlogixMan.m4
@@ -0,0 +1,66 @@
+.PS
+# `AlogixMan.m4'
+log_init
+
+# A modest expression in default form
+A: Autologix(
+ Nand(And(Or(A,C),Or(B,~C),Or(~A,B,C)),Ck);
+ Nand(~A,B)@with .n at last [].s+(0,-2bp__))
+ move left 10bp__ from A.InCk
+ "\sl Out1" at A.Out1 ljust
+ "\sl Out2" at A.Out2 ljust
+ Loopover_(`v_', `"$v_$" at A.In`'v_ above ', A,B,C,Ck)
+ `"\shortstack[l]{
+ \tt Autologix( \\ \tt \quad
+ Nand(And(Or(A,C),Or(B,\~{}C),Or(\~{}A,B,C)),Ck);\\ \tt \quad
+ Nand(\~{}A,B))@with .n at last [].s+(0,-2bp\_\_))}"'\
+ wid 288bp__ ht 32bp__ with .nw at A.sw+(0,-0.10)
+
+# Draw a tree of gates only. The ~ has been
+# replaced by NOT gates.
+B: Autologix(Or(And(B,Not(C)),And(Not(A),B,C)),N) \
+ with .sw at A.e+(0.4,0.25)
+ "{\sl Out}" at B.Out above ljust
+ `"\shortstack[l]{\tt B: Autologix( \\ \tt \
+ Or(And(B,Not(C)),And(Not(A),B,C)),N)}"' \
+ wid 242pt__ ht 20pt__ at B.s+(0,-0.2)
+ for_(1,4,1,`"{\sf\small\sl B.In`'m4x}" at B.In`'m4x rjust')
+ "{\sf\small\sl B.In5}" at B.In5+(0,-1.5bp__) rjust
+
+ifelse(0,1,`
+# Here is how to include an arbitrary circuit
+# (an SR-flipflop, for example)
+# that is not one of the standard gates.
+# First, define the circuit with a name ending
+# in _gate. Put its inputs named In1, In2, ...
+# on the left and the output Out on the right.
+define(`SR_gate',`[ v = 2*L_unit
+ S: NOR_gate
+ line right_ 4*L_unit from S.Out
+ Out: Here
+ R: NOR_gate at S+(0,-10*L_unit)
+ TS: S.In2-(v,0)
+ TR: (TS,R.In1)
+ dot(at S.Out+(v,0))
+ line down v*3/2 then to TR+(0,v) then to TR then to R.In1
+ line from R.Out right v then up v*3/2 then to TS+(0,-v) \
+ then to TS then to S.In2
+ In1: S.In1
+ In2: R.In2 ]')
+# Now define the function by which the circuit
+# will be invoked using the built-in _AutoGate:
+define(`SRff',`_AutoGate(SR,$@)')
+
+# You are done. Here is an example:
+G: [
+ F: Autologix(SRff(And(x,y),Nand(x,y)),LRV)
+
+ "$x$" at F.Inx rjust
+ "$y$" at F.Iny rjust
+ "\sl Out" at F.Out ljust
+ ] with .sw at A.n+(0.0,-0.25)
+ `"{\tt Autologix(SRff(And(x,y),Nand(x,y)),LRV)}"' wid 253pt__ ht 7pt__ \
+ with .w at last [].sw+(0,-10pt__)
+')
+
+.PE
diff --git a/graphics/circuit_macros/doc/AutologixMan.m4 b/graphics/circuit_macros/doc/AutologixMan.m4
new file mode 100644
index 0000000000..e0d8dc0eaf
--- /dev/null
+++ b/graphics/circuit_macros/doc/AutologixMan.m4
@@ -0,0 +1,9 @@
+.PS
+# AutoLogixMan.m4
+log_init
+
+ F: Autologix(Or(And(a,b,c,d),And(Not(b),a),c,And(d,Not(a))))
+ Loopover_(`v',`"$v$" at F.In`'v above',a,b,c,d)
+ "$f$" at F.Out ljust
+
+.PE
diff --git a/graphics/circuit_macros/doc/CanLogicMan.tex b/graphics/circuit_macros/doc/CanLogicMan.tex
new file mode 100644
index 0000000000..da849dd23d
--- /dev/null
+++ b/graphics/circuit_macros/doc/CanLogicMan.tex
@@ -0,0 +1,142 @@
+\begin{tikzpicture}[scale=2.54]%
+% dpic version 2023.06.01 option -g for TikZ and PGF 1.01
+\ifx\dpiclw\undefined\newdimen\dpiclw\fi
+\global\def\dpicdraw{\draw[line width=\dpiclw]}
+\global\def\dpicstop{;}
+\dpiclw=0.8bp
+\dpiclw=0.8bp
+\dpiclw=0.5bp
+\draw (0,0) node[right=-2bp]{$a$};
+\dpicdraw (0,0)
+ --(0,-0.15)\dpicstop
+\dpicdraw[fill=black](0,-0.15) circle (0.007874in)\dpicstop
+\dpicdraw (0,-0.15)
+ --(0.3,-0.15)
+ --(0.3,-0.3)\dpicstop
+\dpiclw=1bp
+\dpicdraw (0.3,-0.475)
+ --(0.2,-0.3)
+ --(0.4,-0.3)
+ --(0.3,-0.475)\dpicstop
+\dpicdraw (0.3,-0.5125) circle (0.014764in)\dpicstop
+\dpiclw=0.5bp
+\draw (0.6,0) node[right=-2bp]{$b$};
+\dpicdraw (0.6,0)
+ --(0.6,-0.15)\dpicstop
+\dpicdraw[fill=black](0.6,-0.15) circle (0.007874in)\dpicstop
+\dpicdraw (0.6,-0.15)
+ --(0.9,-0.15)
+ --(0.9,-0.3)\dpicstop
+\dpiclw=1bp
+\dpicdraw (0.9,-0.475)
+ --(0.8,-0.3)
+ --(1,-0.3)
+ --(0.9,-0.475)\dpicstop
+\dpicdraw (0.9,-0.5125) circle (0.014764in)\dpicstop
+\dpiclw=0.5bp
+\draw (1.2,0) node[right=-2bp]{$c$};
+\draw (1.5,0) node[right=-2bp]{$d$};
+\dpiclw=1bp
+\dpicdraw (2.1,-0.975)
+ --(1.9,-0.975)
+ --(1.9,-0.675)
+ --(2.1,-0.675)\dpicstop
+\dpicdraw (2.1,-0.675)
+ ..controls (2.15359,-0.675) and (2.203109,-0.70359)
+ ..(2.229904,-0.75)
+ ..controls (2.256699,-0.79641) and (2.256699,-0.85359)
+ ..(2.229904,-0.9)
+ ..controls (2.203109,-0.94641) and (2.15359,-0.975)
+ ..(2.1,-0.975)\dpicstop
+\dpiclw=0.5bp
+\dpiclw=1bp
+\dpicdraw (2.1,-1.425)
+ --(1.9,-1.425)
+ --(1.9,-1.125)
+ --(2.1,-1.125)\dpicstop
+\dpicdraw (2.1,-1.125)
+ ..controls (2.15359,-1.125) and (2.203109,-1.15359)
+ ..(2.229904,-1.2)
+ ..controls (2.256699,-1.24641) and (2.256699,-1.30359)
+ ..(2.229904,-1.35)
+ ..controls (2.203109,-1.39641) and (2.15359,-1.425)
+ ..(2.1,-1.425)\dpicstop
+\dpiclw=0.5bp
+\dpicdraw (1.9,-1.575)
+ --(2.25,-1.575)\dpicstop
+\dpiclw=1bp
+\dpicdraw (2.1,-2.025)
+ --(1.9,-2.025)
+ --(1.9,-1.725)
+ --(2.1,-1.725)\dpicstop
+\dpicdraw (2.1,-1.725)
+ ..controls (2.15359,-1.725) and (2.203109,-1.75359)
+ ..(2.229904,-1.8)
+ ..controls (2.256699,-1.84641) and (2.256699,-1.90359)
+ ..(2.229904,-1.95)
+ ..controls (2.203109,-1.99641) and (2.15359,-2.025)
+ ..(2.1,-2.025)\dpicstop
+\dpiclw=0.5bp
+\dpiclw=1bp
+\dpicdraw (2.891667,-1.2)
+ --(2.768056,-1.2)\dpicstop
+\dpicdraw (2.773689,-1.197268)
+ ..controls (2.820003,-1.29276) and (2.820485,-1.40411)
+ ..(2.775,-1.5)\dpicstop
+\dpicdraw (2.768056,-1.5)
+ --(2.891667,-1.5)\dpicstop
+\dpicdraw (2.891667,-1.2)
+ ..controls (2.992105,-1.2) and (3.083302,-1.258626)
+ ..(3.125,-1.35)\dpicstop
+\dpicdraw (2.891667,-1.5)
+ ..controls (2.992105,-1.5) and (3.083302,-1.441374)
+ ..(3.125,-1.35)\dpicstop
+\dpiclw=0.5bp
+\dpicdraw (2.25,-0.825)
+ --(2.640199,-0.825)
+ --(2.640199,-1.2375)
+ --(2.790199,-1.2375)\dpicstop
+\dpicdraw (2.25,-1.275)
+ --(2.490199,-1.275)
+ --(2.490199,-1.3125)
+ --(2.806758,-1.3125)\dpicstop
+\dpicdraw (2.25,-1.575)
+ --(2.490199,-1.575)
+ --(2.490199,-1.3875)
+ --(2.806758,-1.3875)\dpicstop
+\dpicdraw (2.25,-1.875)
+ --(2.640199,-1.875)
+ --(2.640199,-1.4625)
+ --(2.790199,-1.4625)\dpicstop
+\dpicdraw (1.9,-0.7125)
+ --(0,-0.7125)\dpicstop
+\dpicdraw[fill=black](0,-0.7125) circle (0.007874in)\dpicstop
+\dpicdraw (1.9,-0.7875)
+ --(0.6,-0.7875)
+ --(0.6,0)\dpicstop
+\dpicdraw (1.9,-0.8625)
+ --(1.2,-0.8625)\dpicstop
+\dpicdraw[fill=black](1.2,-0.8625) circle (0.007874in)\dpicstop
+\dpicdraw (1.9,-0.9375)
+ --(1.5,-0.9375)\dpicstop
+\dpicdraw[fill=black](1.5,-0.9375) circle (0.007874in)\dpicstop
+\dpicdraw (1.9,-1.2)
+ --(0.9,-1.2)
+ --(0.9,-0.55)\dpicstop
+\dpicdraw (1.9,-1.35)
+ --(0,-1.35)
+ --(0,0)\dpicstop
+\dpicdraw (1.9,-1.575)
+ --(1.2,-1.575)
+ --(1.2,0)\dpicstop
+\dpicdraw (1.9,-1.8)
+ --(1.5,-1.8)
+ --(1.5,0)\dpicstop
+\dpicdraw (1.9,-1.95)
+ --(0.3,-1.95)
+ --(0.3,-0.55)\dpicstop
+\dpicdraw (3.125,-1.348634)
+ --(3.275,-1.348634)\dpicstop
+\draw (3.275,-1.348634) node[right=-2bp]{$f$};
+\end{tikzpicture}%
+\vspace*{-0.5\baselineskip}
diff --git a/graphics/circuit_macros/doc/Circuit_macros.bib b/graphics/circuit_macros/doc/Circuit_macros.bib
index 08d6831ba9..b19a0b7c14 100644
--- a/graphics/circuit_macros/doc/Circuit_macros.bib
+++ b/graphics/circuit_macros/doc/Circuit_macros.bib
@@ -150,6 +150,12 @@ title={A User's Manual for {M}eta{P}ost},
institution={Bell Laboratories},
year={1990}}
+@misc{drawingwithmetapost,
+author={Thurston, T.},
+title={Drawing with {M}eta{P}ost},
+note={CTAN, \url{https://www.ctan.org/pkg/drawing-with-metapost}},
+year={2023}}
+
@misc{mfpic,
author={Leathrum, T. and Tobin, G.},
title={Pictures in {\TeX\ }with Metafont},
@@ -159,13 +165,13 @@ year={1996}}
@misc{pstricks,
author={Van Zandt, T.},
title={{PST}ricks: Postscript Macros for Generic TeX},
-institution={CTAN.org},
-note={\url{http://mirrors.ctan.org/graphics/pstricks/base/doc/pst-user.pdf}},
+note={CTAN,
+ \url{http://mirrors.ctan.org/graphics/pstricks/base/doc/pst-user.pdf}},
year={2007}}
@misc{tikz,
author={Tantau, T.},
title={TiKz \& PGF},
-institution={CTAN.org},
-note={\url{http://mirrors.ctan.org/graphics/pgf/base/doc/pgfmanual.pdf}},
+note={CTAN,
+ \url{http://mirrors.ctan.org/graphics/pgf/base/doc/pgfmanual.pdf}},
year={2013}}
diff --git a/graphics/circuit_macros/doc/Circuit_macros.pdf b/graphics/circuit_macros/doc/Circuit_macros.pdf
index 5aba4c4ac4..e9b0b671bf 100644
--- a/graphics/circuit_macros/doc/Circuit_macros.pdf
+++ b/graphics/circuit_macros/doc/Circuit_macros.pdf
Binary files differ
diff --git a/graphics/circuit_macros/doc/Makefile b/graphics/circuit_macros/doc/Makefile
index 6eb3e35e03..0f0a596447 100644
--- a/graphics/circuit_macros/doc/Makefile
+++ b/graphics/circuit_macros/doc/Makefile
@@ -5,8 +5,9 @@ DOC = Circuit_macros
DOCSRC = Circuit_macros.tex body.tex defines.tex
PICTEX = \
- ACsymbol.tex \
- AmpTableMan.tex AntennasMan.tex ArrestersMan.tex AudioMan.tex Axes.tex \
+ ACsymbol.tex AlogixMan.tex \
+ AmpTableMan.tex AntennasMan.tex ArrestersMan.tex AudioMan.tex \
+ AutologixMan.tex Axes.tex \
Buffer.tex BigResistor.tex BipMan.tex \
CapacitorsMan.tex Composite.tex ConfigA.tex ConfigB.tex \
ConfigC.tex ConnMan.tex Corners.tex ContactMan.tex ContactsMan.tex \
@@ -16,9 +17,10 @@ PICTEX = \
JackMan.tex LogicMan.tex \
Loop.tex MultiplexerMan.tex NPDTMan.tex NLGMan.tex NportMan.tex \
Oblique.tex OpampMan.tex Opto.tex ParSeries.tex PconnMan.tex \
- Potentiometers.tex RelayMan.tex relaycoilMan.tex ResistorsMan.tex \
+ Potentiometers.tex QTrans.tex \
+ RelayMan.tex relaycoilMan.tex ResistorsMan.tex \
Series.tex ShiftRMan.tex Sinus.tex SLDsMan.tex SourcesMan.tex \
- SwitchesMan.tex \
+ SRffMan.tex SwitchesMan.tex \
Taps.tex TgateMan.tex Thermal.tex Tline.tex \
VariableMan.tex WindingsMan.tex Workflow.tex XformMan.tex \
arrowex.tex \
diff --git a/graphics/circuit_macros/doc/QTrans.m4 b/graphics/circuit_macros/doc/QTrans.m4
new file mode 100644
index 0000000000..95039e6f1c
--- /dev/null
+++ b/graphics/circuit_macros/doc/QTrans.m4
@@ -0,0 +1,19 @@
+.PS
+#QTrans.m4
+cct_init
+elen = 0.75
+ Origin: Here
+ Vs: source(up_ elen,S); llabel(-,V_s,+)
+ resistor(right_ elen); rlabel(,R_s)
+ dot
+ { capacitor(down_ to (Here,Origin))
+ rlabel(+,V,-); llabel(,{1\over{j\omega C}},)
+ dot }
+ arrowline(right_ elen*2/3); llabel(,I)
+ T1: transformer(down_ Vs.len,,6,,4) with .P1 at Here
+ "$T1$" at last [].n above
+ line from T1.P2 to Origin
+ line from T1.S1 up_ to (T1.S1,Vs.end) then right_ elen*2/3
+ resistor(down_ Vs.len); rlabel(,R_L); b_current(I_L,rjust)
+ line to (T1.S2,Here) then to T1.S2
+.PE
diff --git a/graphics/circuit_macros/doc/SRffMan.m4 b/graphics/circuit_macros/doc/SRffMan.m4
new file mode 100644
index 0000000000..1c3a95e5bb
--- /dev/null
+++ b/graphics/circuit_macros/doc/SRffMan.m4
@@ -0,0 +1,39 @@
+.PS
+# `SRffMan.m4'
+log_init
+
+# Here is how to include an arbitrary circuit
+# (an SR-flipflop, for example)
+# that is not one of the standard gates.
+# First, define the circuit with a name ending
+# in _gate. Put its inputs named In1, In2, ...
+# on the left and the output Out on the right.
+define(`SR_gate',`[ u = 2*L_unit
+ S: NOR_gate
+ line right_ 2*u from S.Out
+ Out: Here
+ R: NOR_gate at S+(0,-5*u)
+ TS: S.In2-(u,0)
+ TR: (TS,R.In1)
+ dot(at S.Out+(u,0))
+ line down u*3/2 then to TR+(0,u) then to TR then to R.In1
+ line from R.Out right u then up u*3/2 then to TS+(0,-u) \
+ then to TS then to S.In2
+ In1: S.In1
+ In2: R.In2 ]')
+# Now define the function by which the circuit
+# will be invoked using the built-in _AutoGate:
+define(`SRff',`_AutoGate(SR,$@)')
+
+# You are done. Here is an example:
+G: [
+ F: Autologix(SRff(And(x,y),Nand(x,y)),LRV)
+
+ "$x$" at F.Inx rjust
+ "$y$" at F.Iny rjust
+ "\sl Out" at F.Out ljust
+ ]
+ `"{\tt Autologix(SRff(And(x,y),Nand(x,y)),LRV)}"' wid 253pt__ ht 7pt__ \
+ with .w at last [].sw+(0,-10pt__)
+
+.PE
diff --git a/graphics/circuit_macros/doc/Version.tex b/graphics/circuit_macros/doc/Version.tex
index 58fb6e89e5..73fb7dd577 100644
--- a/graphics/circuit_macros/doc/Version.tex
+++ b/graphics/circuit_macros/doc/Version.tex
@@ -1 +1 @@
-Version 10.2
+Version 10.3
diff --git a/graphics/circuit_macros/doc/XformMan.m4 b/graphics/circuit_macros/doc/XformMan.m4
index 697d87fafa..7290c4bd84 100644
--- a/graphics/circuit_macros/doc/XformMan.m4
+++ b/graphics/circuit_macros/doc/XformMan.m4
@@ -28,11 +28,11 @@ divert(0)dnl
T1: transformer
trlabels(,`transformer',T1,0.3)
T2: transformer(down_ 0.6,,2,P,8) with .w at T1.e+(1,0)
- trlabels(,`...(down\_ 0.6,,2,P,8)',T2,0.3)
- T3: transformer(,,8,WD12,4) with .w at T2.e+(1,0)
- trlabels(,`...(,,8,WD12,4)',T3,0.21)
- T4: transformer(,,9,AL) with .sw at T3.se+(1,0)
- trlabels(,`...(,,9,AL)',T4,0.3)
+ trlabels(,`...(down\_ 0.6,{},2,P,8)',T2,0.3)
+ T3: transformer(,{},8,WD12,4) with .w at T2.e+(1,0)
+ trlabels(,`...(,{},8,WD12,4)',T3,0.21)
+ T4: transformer(,{},9,AL) with .sw at T3.se+(1,0)
+ trlabels(,`...(,{},9,AL)',T4,0.3)
T5: transformer(,R,8,AW) with .sw at T4.se+(1,0)
trlabels(R,`...(,R,8,AW)',T5,0.3)
diff --git a/graphics/circuit_macros/doc/body.tex b/graphics/circuit_macros/doc/body.tex
index f89fe710fe..e229888d91 100644
--- a/graphics/circuit_macros/doc/body.tex
+++ b/graphics/circuit_macros/doc/body.tex
@@ -118,10 +118,12 @@ only with \dpic.
concepts applied here do not require \Mfour.
\subsection{Quick start\label{Quickstart:}}
-Read this section to understand basic usage of \Mfour and macros.
-The contents of file {\tt quick.m4} and resulting diagram are shown in
-\FR{quick} to illustrate the language
-and the production of basic labeled circuits.
+Read this section to understand basic usage of \Mfour and macros,
+and look at the {\tt examples.pdf} file for cases
+that might be similar to yours.
+The contents of file {\tt quick.m4} and resulting diagram are shown
+in \FR{quick} to illustrate the language and the production of basic
+labeled circuits.
\begin{figure}[ht]
\parbox{\textwidth}{\small\verbatiminput{quick.m4}}%
\hfill\llap{\raise-1.15in\hbox{\input quick }}%
@@ -741,10 +743,8 @@ operating-system commands, \pic macros, and external file inclusion.
There is a fundamental difference between the two-terminal elements, each
of which is drawn along an invisible straight-line segment,
and other elements, which are generally compound objects
-in {\tt[} {\tt]} blocks as mentioned in \SR{Compoundobjects:}.
-% Specifying the straight-line segment requires four numbers, the coordinates
-% of the start and end, or equivalent, but default values are used if
-% not specified.
+in {\tt[} {\tt]} blocks as described in \SR{Compoundobjects:}
+and \SR{Composite:}.
The two-terminal element macros follow a
set of conventions described in this section, and other elements will
be described in \SR{Composite:}.
@@ -1391,15 +1391,57 @@ The block must be placed by using its compass corners, thus:
{\sl element} {\tt with} {\sl corner} {\tt at} {\sl position}
or, when the block contains a predefined location, thus:
{\sl element} {\tt with} {\sl location} {\tt at} {\sl position}.
+In some cases, an invisible line can be specified by the first argument
+to determine length and direction (but not position) of the block.
A few macros are positioned with the first argument;
the {\tt ground} macro, for example:
{\tt ground(}{\tt at} {\sl position}{\tt ).}
-In some cases, an invisible line can be specified by the first argument
-to determine length and direction (but not position) of the block.
Nearly all elements drawn within blocks can be customized by adding an
extra argument, which is executed as the last item within the block.
+As a preliminary example,
+\FR{QTrans} shows the file {\tt quick.m4} adapted to include a
+transformer,
+% a composite element with predefined interior locations
+%{\sl P1,} {\sl P2,} {\sl S1,} {\sl S2} and others. The {\tt transformer} macro
+which is described in more detail below.
+\begin{figure}[H]
+% \vspace*{-\baselineskip}
+ \parbox{4in}{\small \verbatiminput{QTrans.m4}}%
+ \hspace*{-0.45in}\raise-0.15in\hbox{\input QTrans }
+ \vspace*{-\baselineskip}
+ \caption{The file {\tt quick.m4} has been modified to include a
+ transformer, of which the length and orientation of connectors
+ is given by the first argument, and which is placed by reference
+ to internal position {\sl P1.} Label {\sl Vs} has
+ been added for convenient reference.}
+ \label{QTrans}
+ \end{figure}
+
+\FR{Xform} shows variants of the transformer macro,
+which has predefined internal locations
+{\sl P1,} {\sl P2,} {\sl S1,} {\sl S2,} {\sl TP,} and {\sl TS.}
+The first argument specifies the direction and distance from {\sl P1}
+to {\sl P2} but not the position of the transformer, which is determined
+by the enclosing block as normal for a composite element. The second
+argument places the secondary side of the transformer to the left or
+right of the drawing direction. The optional third and fifth arguments
+specify the number of primary and secondary arcs respectively. If the
+fourth argument string contains an {\tt A}, the iron core is omitted;
+if a {\tt P}, the core is dashed (powder); and if it contains a {\tt W},
+wide windings are drawn. A {\tt D1} puts phase dots at the {\sl P1,
+S1} end, {\tt D2} at the {\sl P2, S2} ends, and {\tt D12} or {\tt D21}
+puts dots at opposite ends.
+\begin{figure}[H]
+ \input XformMan
+ \caption{The {\tt transformer(\linespec,L|R,{\sl np},%
+[A|P][W|L][D1|D2|D12|D21],{\sl ns})}
+ macro (drawing direction {\tt down}), showing predefined terminal
+ and centre-tap points.}
+ \label{Xform}
+ \end{figure}
+
The macro {\tt
potentiometer(\linespec,{\sl cycles},{\sl fractional pos},{\sl length},
$\ldots$)},
@@ -1439,6 +1481,7 @@ These two macros require the two-terminal element to be drawn either up,
down, to the left, or to the right; they are not designed for obliquely
drawn elements.
+\pagebreak
A few composite symbols derived from two-terminal elements
are shown in \FR{Composite}.
\begin{figure}[H]
@@ -1528,30 +1571,6 @@ The code in \FR{opampex} places an opamp with three connections.
\label{opampex}
\end{figure}
-\FR{Xform} shows variants of the transformer macro,
-which has predefined internal locations
-{\sl P1,} {\sl P2,} {\sl S1,} {\sl S2,} {\sl TP,} and {\sl TS.}
-\begin{figure}[H]
- \input XformMan
- \caption{The {\tt transformer(\linespec,L|R,{\sl np},%
-[A|P][W|L][D1|D2|D12|D21],{\sl ns})}
- macro (drawing direction {\tt down}), showing predefined terminal
- and centre-tap points.}
- \label{Xform}
- \end{figure}
-The first argument
-specifies the direction and distance from {\sl P1} to {\sl P2}, with
-position determined by the enclosing block as for opamps. The second
-argument places the secondary side of the transformer to the left
-or right of the drawing direction. The optional third and fifth arguments
-specify the number of primary and secondary arcs respectively.
-If the fourth argument string contains an {\tt A}, the iron core
-is omitted;
-if a {\tt P}, the core is dashed (powder);
-and if it contains a {\tt W}, wide windings are drawn.
-A {\tt D1} puts phase dots at the {\sl P1, S1} end, {\tt D2} at the
-{\sl P2, S2} ends, and {\tt D12} or {\tt D21} puts dots at opposite ends.
-
\FR{Audio} shows some audio devices, defined in {\tt []} blocks,
with predefined internal locations as shown.
\begin{figure}[H]
@@ -1582,6 +1601,7 @@ macro is shown in \FR{Nport}.
The {\tt nterm} macro draws single pins instead of pin pairs.}
\label{Nport}
\end{figure}
+\pagebreak
The macro begins with the line
\verb|define(`nport',`[Box: box `$1'|,
so the first argument is a box specification such as size, fill,
@@ -1644,7 +1664,7 @@ An {\tt I} in the first argument draws open circles for contacts.
\label{Contact}
\end{figure}
-\enlargethispage{\baselineskip}
+\pagebreak
The {\tt contacts({\sl poles, chars})} macro in \FR{Contacts}
draws multiple contacts.
\begin{figure}[H]
@@ -1686,6 +1706,7 @@ composite elements that must be placed accordingly.
\label{NPDT}
\end{figure}
+\pagebreak
The {\tt jack} and {\tt plug} macros and their defined points are
illustrated in \FR{Jack}.
The first argument of both macros establishes the drawing direction.
@@ -1752,7 +1773,6 @@ is first drawn and then blanked in appropriate places using the background
\label{Windings}
\end{figure}
-\pagebreak
\subsection{Semiconductors\label{Semiconductors:}}%
\FR{Bip} shows the variants of bipolar transistor macro
{\tt bi\_tr(\linespec,L|R,P,E)}
@@ -1773,6 +1793,7 @@ current drawing direction according to the second argument. Setting the third
argument to {\tt P} creates a PNP device instead of NPN, and setting the
fourth to {\tt E} draws an envelope around the device.
+\pagebreak
\FR{Darlington} shows a composite macro with several optional internal elements.
\begin{figure}[H]
\input Darlington
@@ -1806,7 +1827,6 @@ specified as shown in \FR{bitrans}.
\label{bitrans}
\end{figure}
-\pagebreak
A UJT macro with predefined internal locations {\sl B1,} {\sl B2,}
and {\sl E} is shown in \FR{ujt}.
\begin{figure}[H]
@@ -1834,6 +1854,7 @@ is much like a two-terminal element.
to the second argument to draw open arrowheads.}
\label{thyristor}
\end{figure}
+\enlargethispage{\baselineskip}
The wrapper macro
{\tt thyristor\_t({\sl linespec, chars, label})} and similar macros
{\tt scr, scs, sus,} and {\tt sbs}
@@ -1985,10 +2006,11 @@ index takes on values 1, 3, 5, $\ldots$.
Repetitive actions can also be performed with the {\tt libgen} macro
-{\tt Loopover\_(`{\sl variable}', {\sl actions}, {\sl value1},
+{\tt foreach\_(`{\sl variable}', {\sl actions}, {\sl value1},
{\sl value2}, $\ldots$)}
\noindent
+(an alias for the older macro {\tt Loopover\_}),
which evaluates {\sl actions} and increments counter {\tt m4Lx}
for each instance of {\sl variable} set to {\sl value1, value2, $\ldots$}
@@ -2026,7 +2048,6 @@ regardless of gate orientation, as in \FR{FF}.
\label{FF}
\end{figure}
-\pagebreak
Beyond a default number (6) of inputs, the
gates are given wings as in \FR{exVIII}.
\begin{figure}[H]
@@ -2062,7 +2083,7 @@ argument character sequence of any gate negates the inputs, and including
\verb|B| in the second argument invokes the
general macro {\tt BOX\_gate([P|N]...,[P|N],{\sl horiz size},{\sl
vert size},{\sl label})}, which draws box gates. Thus, {\tt
-BOX\_gate(PNP,N,,8,\char92 geq 1)} creates a gate of default width,
+BOX\_gate(PNP,N,{},8,\char92 geq 1)} creates a gate of default width,
eight {\tt L\_unit}s height, negated output, three inputs with the
second negated, and internal label ``$\geq1$''.
If the fifth argument begins with {\tt sprintf} or a double quote then
@@ -2140,7 +2161,7 @@ a label, use {\tt lg\_bartxt(}{\sl label}{\tt)}.
The {\sl pinopts} are {\tt [L|M|I|O][N][E]} as for the \verb|lg_pin| macro.
Optional argument 7 is the pin length in drawing units.
-
+\enlargethispage{\baselineskip}
\FR{Multiplexer} shows a multiplexer block with variations, and
\FR{Demultiplexer} shows
the very similar demultiplexer.
@@ -2187,6 +2208,125 @@ of which can be specified as macro arguments.
In addition to the logic gates described here, some experimental
IC chip diagrams are included with the distributed example files.
+\subsection{Automatic structures\label{Automatic:}}
+In some common but special cases, logic circuits having a predefined
+structure can be drawn automatically, thereby saving much
+repetitive code. Boolean functions
+expressed as a product of sums or a sum of products are examples, and
+result in two-layer diagrams. Consider for example, the function
+\[
+ f(a,b,c,d) = abcd + \hbox{\tt\char126}ba + c + b\hbox{\tt\char126}a
+ \]
+which is the sum (that is, ``or'') of four terms which are products
+(that is, ``and'') of one or more single-character variables or their
+negation indicated by a preceding tilde. This and similar functions can
+be drawn in two-layer form, as follows. Define the circuit using function
+notation with the logic-gate functions {\tt And, Or, Not, Buffer, Xor,
+Nand, Nor,} and {\tt Nxor.} Variables can also be negated using tilde
+notation as shown above. An \Mfour\ macro implementing a stack can
+parse the defining function and draw the corresponding structure,
+as shown in \FR{Autologix} for the above example.
+\begin{figure}[H]
+ \vspace*{-\baselineskip}
+ \input AutologixMan
+ \caption{The circuit drawn by
+ {\tt Autologix(Or(And(a,b,c,d),And(Not(b),a),c,And(d,Not(a))))}.}
+ \label{Autologix}
+ \end{figure}
+Such an implementation is the macro
+
+{\tt Autologix({\sl function-spec}; {\sl function-spec}; $\ldots$,
+ [M[irror]] [N[occonect]] [L[eftinputs]]\\
+ {}\hspace*{20bp} [R][V] [;offset={\sl value}])}
+
+\noindent
+where {\sl function-spec} is of the form
+{\tt{\sl function}({\sl args}) [@ {\sl location-attribute}]},
+e.g.,
+
+{\tt HalfAdder: Autologix(Xor(x,y);And(x,y),LVR)}.
+
+This macro draws one or more trees of gates with the output or outputs
+(treeroots) to the right (on the left if the {\tt M[irror]} option is used).
+The predefined functions are given above
+and may be nested; e.g., {\tt Or(And(x,{\char126}y),And({\char126}x,y)).}
+The output is contained in a {\tt [ ]} block, which can be positioned normally.
+Function notation does not model internal connections such as
+feedback, however, but internal nodes can be accessed and connections added.
+
+The resulting block has outputs labeled {\sl Out1, Out2, $\ldots$}
+corresponding to the functions in the first argument, and inputs
+labeled {\sl In{\tt<}var{\tt>}} for each variable {\sl {\tt<}var{\tt>}} in the
+defining expressions, (with NOT gates for variables preceded by {\tt\char126}).
+
+The exact appearance of a tree depends on the order in which
+terms and variables appear in the expressions. Gates can be placed
+relative to previously drawn objects using the {\tt @ {\sl location}} construct;
+e.g., {\tt @with .nw at last [].sw+(0,-dimen\_)}.
+
+The macro has option {\tt R} for reversing the drawn order of the inputs
+{\tt N} for omitting input connections,
+and {\tt V} to reverse the order in which variables are scanned.
+There is also a
+limited capability {\tt L} for drawing inputs on the left; their vertical
+placement can be adjusted by adding {\tt ;offset={\sl var}}.
+
+
+To assist in manually adding connections to the resulting structure,
+the internal gate inputs and outputs are defined and numbered
+{\sl In1, In2, $\ldots$} and {\sl Out1, Out2, $\ldots$}. These labels
+are listed at the end of the output of {\tt Autologix}. Inputs
+are shown for an example in in \FR{Alogix}.
+\begin{figure}[H]
+% \vspace*{-\baselineskip}
+ \input AlogixMan
+ \caption{The {\tt Autologix({\sl expression; expression;$\ldots$, options})}
+ macro automatically draws Boolean expressions in function
+ notation. The function tree is drawn, then a row or column of inputs,
+ then the connections. A default result is on the left, and a tree
+ of gates without input connections but with internal input labels
+ shown is at the upper right.}
+ \label{Alogix}
+ \end{figure}
+
+The given expressions
+need not be in canonical two-layer form and, with minor effort, custom
+gates beyond those mentioned above can be defined and included.
+Here is how to include an arbitrary circuit (an SR-flipflop, for example)
+that is not one of the standard gates.
+First, define the circuit with a name ending
+in {\tt \_gate}. Put its inputs named {\sl In1, In2, $\ldots$}
+on the left and the output {\sl Out} on the right:
+\begin{verbatim}
+define(`SR_gate',`[ u = 2*L_unit
+ S: NOR_gate
+ line right_ 2*u from S.Out
+ Out: Here
+ R: NOR_gate at S+(0,-5*u)
+ TS: S.In2-(u,0)
+ TR: (TS,R.In1)
+ dot(at S.Out+(u,0))
+ line down u*3/2 then to TR+(0,u) then to TR then to R.In1
+ line from R.Out right u then up u*3/2 then to TS+(0,-u) \
+ then to TS then to S.In2
+ In1: S.In1
+ In2: R.In2 ]')
+\end{verbatim}
+
+Now define the function by which the circuit
+will be invoked using the built-in {\tt \_AutoGate} and the circuit name
+omitting {\tt \_gate}:
+\begin{verbatim}
+ define(`SRff',`_AutoGate(SR,$@)')
+\end{verbatim}
+That is all. The result, with a NAND and an AND gate, is shown in \FR{SRff}:
+\begin{figure}[H]
+% \vspace*{-\baselineskip}
+ \input SRffMan
+ \caption{The {\tt SRff} example.}
+ \label{SRff}
+ \end{figure}
+
\xection{Integrated circuits\label{ICs:}}
Developing a definitive library of integrated circuits is problematic
because context may determine how they should be drawn. Logical clarity
@@ -2206,33 +2346,36 @@ To draw the left-side pins, for example, one can write
\end{verbatim}
\noindent
and so on.
+Each pin can also be given a \pic\ name, some text
+to indicate function, and a number but,
+to reduce the tedium of adding the pins by hand, a list
+can be given to
+{\tt foreach\_(\char96{}variable\char39,
+\char96{}{\sl actions}\char39,
+{\sl value1, value2, $\ldots$})}
+which executes the given actions successively with
+ {\sl variable} = {\sl value1}, {\sl value2} $\ldots$ and the
+ counter {\tt m4Lx} set to 1, 2, $\ldots$ . The remaining left-side
+ and the right-side pins in the figure have been specified using this
+ macro.
+%as in \FR{sampleIC}.
\begin{figure}[H]
\parbox{\textwidth}{\small\verbatiminput{sampleIC.m4}}%
\hfill\llap{\raise-0.15in\hbox{\input sampleIC }}%
\vspace*{-\baselineskip}%
\caption{ An imaginary 16-pin integrated circuit and its code.
- Pin variations defined by the first {\tt Loopover\_}
+ Pin variations defined individually and by the first {\tt foreach\_}
are shown on the left; and text, pic labels, and pin
numbers are defined on the right.
The third and successive arguments of the second
- {\tt Loopover\_}
+ {\tt foreach\_}
are {\tt ;}-separated pin number, text, and pin type. The
semicolons are changed to commas by the {\tt patsubst} \Mfour\ macro
and the {\tt Upin} macro gives the resulting arguments to {\tt lg\_pin}.
\label{sampleIC}}%
\end{figure}
-Each pin can also be given a \pic\ name, some text
-to indicate function, and a number.
-
-To reduce the tedium of adding the pins by hand, a list
-can be given to the
-{\tt Loopover\_(\char96{}variable\char39,
-\char96{}{\sl actions}\char39,
-{\sl value1, value2, $\ldots$})}
-which executes the given actions successively with
- {\sl variable} = {\sl value1}, {\sl value2} $\ldots$ and the
- counter {\tt m4Lx} set to 1, 2, $\ldots$ as in the diagram.
+%\pagebreak
\xection{Single-line diagrams\label{SingleLine:}}
\input SLDsMan
Standard single-line diagrams for power distribution employ many of
@@ -2363,7 +2506,6 @@ and can be labelled like a normal two-terminal element. If, however,
breakers are included using {\tt B: tt\_box(,{,},C,C)} then write, for example,
{\tt llabel(,Box 15,{,},Body)} to place the label correctly.
-\pagebreak
\subsection{One-terminal and composite SLD elements\label{OneTermSLD:}}
The one-terminal elements have two components: a stem with optional
breaker or slash symbol, and a head.
@@ -2558,7 +2700,6 @@ If you develop a library of custom macros in the installation
directory then the statement {\tt include(}{\sl mylibrary}{\tt.m4)}
can bring its definitions into play.
-%\enlargethispage{\baselineskip}
It may not be necessary to define your own macro if all that is needed is
a small addition to an existing element that is defined in an enclosing
\verb|[ ]| block. After the element arguments are expanded,
@@ -2577,7 +2718,6 @@ to defer macro expansion. Macro arguments are referenced inside a
macro by number; thus {\tt \$1} refers to the first argument.
A few examples will be given.
-\pagebreak
\Example{1}
Custom two-terminal elements can often be defined by writing a wrapper
for an existing element. For example, an enclosed thermal switch
@@ -2592,6 +2732,7 @@ can be defined as shown in \FR{Thermal}.
\label{Thermal}
\end{figure}
+\enlargethispage{\baselineskip}
\Example{2}
In the following,
two macros are defined to simplify the repeated drawing
@@ -2606,7 +2747,6 @@ a subcircuit that is replicated several times to generate \FR{Tline}.
\label{Tline}
\end{figure}
-\pagebreak
\Example{3}
\FR{HybridPi} shows an element that is composed of several basic
elements and that can be drawn in any direction prespecified by
@@ -3324,7 +3464,7 @@ as illustrated in \FR{Workflow} and in example files included with the
distribution. The \latex drawing commands alone or with {\tt eepic}
or {\tt pict2e} extensions are suitable only for simple diagrams.
-\enlargethispage{\baselineskip}
+\pagebreak
\xection{Developer's notes\label{Developersnotes:}}
In the course of writing a book in the late 1980s when there was little
available for creating line diagrams in \latex, I wished to eliminate
@@ -3334,20 +3474,20 @@ good fit for this purpose, and I took a few days off to write a \pic-like
interpreter (\dpic). The macros in this distribution and the interpreter
are the result of that effort, drawings I have had to produce since,
and suggestions received from others. The interpreter has been upgraded
-over time to generate \mfpic, \MetaPost~\cite{metapost}, raw \Postscript,
-\Postscript with {\tt psfrag} tags, raw PDF, \PSTricks, and Ti{\it k}Z
-PGF output, the latter two my preference because of their quality and
-flexibility, including facilities for colour and rotations, together
-with simple font selection. \Xfig{}-compatible output was introduced
-early on to allow the creation of diagrams both by programming and by
-interactive graphics. \SVG output was added relatively recently, and
-seems suitable for producing web diagrams directly and for further editing
-by the Inkscape interactive graphics editor. The latest addition is raw
-PDF output, which has very basic text capability and is most suitable for
-creating diagrams without labels, but on which sophisticated text can
-be overlaid if necessary. \Dpic can write the coordinates of selected
-locations to an external file to be used in overlaying text or other
-items on the diagram.
+over time to generate \mfpic, \MetaPost~\cite{metapost,drawingwithmetapost},
+raw \Postscript, \Postscript with {\tt psfrag} tags, raw PDF, \PSTricks,
+and Ti{\it k}Z PGF output, the latter two my preference because of their
+quality and flexibility, including facilities for colour and rotations,
+together with simple font selection. \Xfig{}-compatible output was
+introduced early on to allow the creation of diagrams both by programming
+and by interactive graphics. \SVG output was added relatively recently,
+and seems suitable for producing web diagrams directly and for further
+editing by the Inkscape interactive graphics editor. The latest addition
+is raw PDF output, which has very basic text capability and is most
+suitable for creating diagrams without labels, but on which sophisticated
+text can be overlaid if necessary. \Dpic can write the coordinates of
+selected locations to an external file to be used in overlaying text or
+other items on the diagram.
The simple \pic\ language is but one of many available tools for creating
line graphics. Consequently, the main value of this distribution
@@ -3358,8 +3498,8 @@ thousands of lines. The learning curve of \pic\ compares well with
other possibilities, but some of the macros have become less readable
as more options and flexibility have been added, and if starting
over today, perhaps I would change some details. Compromises have
-been made to preserve the compatability of some of the older macros.
-Compromises have also been made to retain reasonable compatibility with
+been made to preserve the compatability of some of the older macros
+and also to retain reasonable compatibility with
the various postprocessors. No choice of tool is without compromise,
and producing good graphics seems to be time consuming, no matter how
it is done, but the payoff can be worth the effort.
@@ -3758,6 +3898,7 @@ without sacrificing ease of use.
\end{enumerate}
+\pagebreak
\xection{List of macros\label{Listofmacros:}}
\label{defines}
The following table lists macros in the libraries, configuration
diff --git a/graphics/circuit_macros/doc/defines.tex b/graphics/circuit_macros/doc/defines.tex
index f806236197..cf87a5b02f 100644
--- a/graphics/circuit_macros/doc/defines.tex
+++ b/graphics/circuit_macros/doc/defines.tex
@@ -197,17 +197,23 @@
{Assigns \$1 = arg4 if \$1 is nonblank; similarly \$2 = arg5 and \$3 = arg6}
\macrodef{Autologix}{Autologix}%
{({\sl Boolean function sequence},%
- [N[oconnect]][L[eftinputs]][R][V][M][;offset={\sl value}]}
+ [N[oconnect]][L[eftinputs]][R][V][M][;offset={\sl value}])}
{log}
- {Draw the Boolean expressions defined in function notation
- using {\tt And, Or, Not, Buffer, Xor, Nand, Nor, Nxor}
- and variables, e.g.,
+ {Draw the Boolean expressions defined in function notation.
+ The first argument is a semicolon (;)-separated sequence of
+ Boolean function specifications using the functions
+ {\tt And, Or, Not, Buffer, Xor, Nand, Nor, Nxor}
+ with variables, e.g.,
{\tt Autologix(And(Or(x1,~x2),Or(~x1,x2)));}.
- The Boolean functions are separated by semicolons (;). Function
- outputs are aligned vertically but appending
- {\tt:}{\sl location attribute} to a function can be used to place it.
+ Each function specification is of the form
+ {\tt {\sl function}({\sl arguments}) [@{\sl attributes}]}.
+ \par
+ Function outputs are aligned vertically but appending
+ {\tt@}{\sl attributes} to a function can be used to place it.
+ \par
+ The function arguments are variable names or nested Boolean functions.
Each unique variable {\sl var} causes an input point {\tt In}{\sl var}
- to be defined. Preceding the variable by a {\tt \~{}} causes a not gate
+ to be defined. Preceding the variable by a {\tt \~{}} causes a NOT gate
to be drawn at the input.
The inputs are drawn in a row at the upper left by default.
An {\tt L} in arg2 draws the inputs in a column at the left;
@@ -222,7 +228,16 @@
points with label {\tt In}{\sl var}.
Setting {\tt offset=}{\sl value} displaces the
drawn input list in order to disambiguate the input connections when {\tt L}
- is used}
+ is used.
+ \par
+ In the (possibly rare) case where one or more inputs of a normal function
+ gate is to have a NOT-circle, an additional first argument of the function
+ is inserted, of the form {\tt [{\sl charseq}]}, where {\sl charseq}
+ is a string containing the characters {\tt P} for a normal input or
+ {\tt N} for a negated input, the length of the string equal to the number
+ of gate inputs. For example:
+ {\tt Autologix(Xor([PN],And(x,y),And(x,y)),LRV)}}
+
\Letter{B}%
\macrodef{b\_}{b_}{}
{gen}
@@ -1199,9 +1214,10 @@ n|e|s|w,{\sl length})}
\macrodef{LH\_symbol}{LH_symbol}{([U|D|L|R|{\sl degrees}][I])}
{log}
{logic-gate hysteresis symbol; {\tt I=}inverted}
-\macrodef{lin\_ang}{lin_ang}{({\sl line-reference})}
+\macrodef{lin\_ang}{lin_ang}{({\sl line-reference}[,d])}
{gen}
- {the angle from {\tt .start} to {\tt .end} of a line or move}
+ {the angle of a line or move from {\tt .start} to {\tt .end} of a linear
+ object (in degrees if arg2={\tt d})}
\macrodef{lin\_leng}{lin_leng}{({\sl line-reference})}
{gen}
{length of a line, equivalent to {\sl line-reference}{\tt .len}
diff --git a/graphics/circuit_macros/doc/sampleIC.m4 b/graphics/circuit_macros/doc/sampleIC.m4
index bf2bb2358e..4813841d0b 100644
--- a/graphics/circuit_macros/doc/sampleIC.m4
+++ b/graphics/circuit_macros/doc/sampleIC.m4
@@ -1,16 +1,19 @@
.PS
+# SampleIC.m4
log_init
command "\small\sf"
U: box wid 18*L_unit ht 9*lg_pinsep
- Loopover_(`x',
- `lg_pin(U.nw-(0,m4Lx*lg_pinsep),,,w`'x)',
- nul,L,M,I,O,N,E,NE)
+ lg_pin(U.nw-(0,lg_pinsep),Vin,Pin1,w)
+ lg_pin(U.nw-(0,2*lg_pinsep),,,wL)
+ foreach_(`x',
+ `lg_pin(U.nw-(0,(m4Lx+2)*lg_pinsep),x,,w`'x)',
+ M,I,O,N,E,NE)
define(`Upin',
`lg_pin(U.ne-(0,(17-`$1')*lg_pinsep),`$2',Pin`$1',e`$3',`$1',8*L_unit)')
- Loopover_(`x',
+ foreach_(`x',
`Upin(patsubst(x,;,`,'))',
16;Vin;, 15;D0;L, 14;D1;M, 13;D2;I, 12;D3;O, 11;D4;N, 10;D5;E, 9;D6;NE )
.PE
diff --git a/graphics/circuit_macros/dpictools.pic b/graphics/circuit_macros/dpictools.pic
index 6118039658..c89f13d293 100644
--- a/graphics/circuit_macros/dpictools.pic
+++ b/graphics/circuit_macros/dpictools.pic
@@ -3,7 +3,7 @@
# m4 macro NeedDpicTools or the pic statement copy "HOMELIB_/dpictools.pic"
# when HOMELIB_ is defined or, generically, copy "<path>dpictools.pic"
-# Circuit_macros Version 10.2, copyright (c) 2023 J. D. Aplevich under #
+# Circuit_macros Version 10.3, copyright (c) 2023 J. D. Aplevich under #
# the LaTeX Project Public Licence in file Licence.txt. The files of #
# this distribution may be redistributed or modified provided that this #
# copyright notice is included and provided that modifications are clearly #
@@ -484,6 +484,8 @@ if dpicopt==optSVG then { define px__ {*(scale/dpPPI)} } \
else { define px__ {*(scale/96)} } # Absolute pixels
define assign_dpicvars {
+# print " *** dpic: dpictools.pic processed"
+ define dpictools_ {1}
ld__ = 0
rtod_ = 57.295779513082323
dtor_ = 0.017453292519943295
@@ -563,21 +565,5 @@ else { if dpicopt==optSVG then {
#######################################################################
assign_dpicvars()
-# print " *** dpic: dpictools.pic processed"
-define dpictools_ {1}
- case(abs(dpicopt),
- optMFpic := -abs(optMFpic),
- optMpost := -abs(optMFpic),
- optPDF := -abs(optPDF),
- optPGF := -abs(optPGF),
- optPict2e := -abs(optPict2e),
- optPS := -abs(optPS),
- optPSfrag := -abs(optPSfrag),
- optPSTricks := -abs(optPSTricks),
- optSVG := -abs(optSVG),
- optTeX := -abs(optTeX),
- opttTeX := -abs(opttTeX),
- optxfig := -abs(optxfig) )
- dpicopt := -abs(dpicopt)
# dpictools end
diff --git a/graphics/circuit_macros/examples/Alogix.m4 b/graphics/circuit_macros/examples/Alogix.m4
index 1bafd90681..fd586869b7 100644
--- a/graphics/circuit_macros/examples/Alogix.m4
+++ b/graphics/circuit_macros/examples/Alogix.m4
@@ -28,28 +28,26 @@ B: Autologix(Or(And(B,Not(C)),And(Not(A),B,C)),N) \
"{\sf\small\sl B.In5}" at B.In5+(0,-1.5bp__) rjust
# Here is how to include an arbitrary circuit
+# (an SR-flipflop, for example)
# that is not one of the standard gates.
# First, define the circuit with a name ending
-# in _gate. Make sure its inputs are on the left
-# and named In1, In2, ... and the output Out
-# is on the right.
-define(`SR_gate',`[
+# in _gate. Put its inputs named In1, In2, ...
+# on the left and the output Out on the right.
+define(`SR_gate',`[ v = 2*L_unit
S: NOR_gate
- R: NOR_gate at S+(0,-L_unit*(AND_ht+4))
- w = (S.Out.x-R.In1.x)/3
- v = 2*L_unit
- line right_ dimen_/2 from S.Out
+ line right_ 4*L_unit from S.Out
Out: Here
- TR: R.In1-(v,0)
- line from S.Out+(v,0) down w*3/2 then left S.Out.x-TR.x+v down w \
- then to TR then to R.In1
- TS: S.In2-(v,0);
- line from R.Out right v then up w*3/2 then left R.Out.x-TS.x+v up w \
- then to TS then to S.In2
+ R: NOR_gate at S+(0,-10*L_unit)
+ TS: S.In2-(v,0)
+ TR: (TS,R.In1)
+ dot(at S.Out+(v,0))
+ line down v*3/2 then to TR+(0,v) then to TR then to R.In1
+ line from R.Out right v then up v*3/2 then to TS+(0,-v) \
+ then to TS then to S.In2
In1: S.In1
In2: R.In2 ]')
# Now define the function by which the circuit
-# will be invoked:
+# will be invoked using the built-in _AutoGate:
define(`SRff',`_AutoGate(SR,$@)')
# You are done. Here is an example:
diff --git a/graphics/circuit_macros/examples/CanLogic.m4 b/graphics/circuit_macros/examples/CanLogic.m4
index 88e2646928..5b809d9e6f 100644
--- a/graphics/circuit_macros/examples/CanLogic.m4
+++ b/graphics/circuit_macros/examples/CanLogic.m4
@@ -25,18 +25,18 @@ define(`CanLogic',
`define(`terms',`shift(shift(shift(shift($@))))')
# Determine required input variables and negated
# variables
- Loopover_(`t_',`varloop(`v_',`define(X`'v_)',`define(XN`'v_)',t_)',terms)
+ Loopover_(`t_',`CLvarloop(`v_',`define(X`'v_)',`define(XN`'v_)',t_)',terms)
# Draw the inputs with NOT gates as necessary
PrevInput: Here-(inputsep,0)
- Loopover_(`t_',`varloop(`v_',
- `ifdef(D`'v_,,`ifdef(XN`'v_,`DrawInNotIn(v_)',`DrawIn(v_)')')',
- `ifdef(D`'v_,,`ifdef(X`'v_,`DrawInNotIn(v_)',`DrawNotIn(v_)')')', t_)',
+ Loopover_(`t_',`CLvarloop(`v_',
+ `ifdef(D`'v_,,`ifdef(XN`'v_,`CLDrawInNotIn(v_)',`CLDrawIn(v_)')')',
+ `ifdef(D`'v_,,`ifdef(X`'v_,`CLDrawInNotIn(v_)',`CLDrawNotIn(v_)')')', t_)',
terms)
# Draw 2nd-layer gates
right_
LastGateSE: PrevInput+(5*jog,-(AND_wd*L_unit*1.5)) dnl
Loopover_(`t_',
- `define(`termcount',m4Lx)DrawLayerGate(G`'termcount,$1,$2,t_)',
+ `define(`termcount',m4Lx)CLDrawLayerGate(G`'termcount,$1,$2,t_)',
terms)
# Draw output gate
linethick = gatelineth
@@ -45,26 +45,26 @@ define(`CanLogic',
Out: Here
linethick = lineth
# Connect 2nd-layer gates to the output gate
- VectorConnect(G,termcount,OP)
+ CLVectorConnect(G,termcount,OP)
# Connect the inputs and negated inputs to
# 2nd-layer gates
- Loopover_(`t_',`ConnectInputs(G`'m4Lx,t_)',terms)
+ Loopover_(`t_',`CLConnectInputs(G`'m4Lx,t_)',terms)
# Clean up
- Loopover_(`t_',`DeleteLogDefs(t_)',terms)
+ Loopover_(`t_',`CLDeleteLogDefs(t_)',terms)
')
- `VectorConnect(number of 2nd layer gates,
+ `CLVectorConnect(number of 2nd layer gates,
common 2nd layer gate name,
output gate name)
Connect the 2nd-layer gate outputs to the
output gate inputs'
-define(`VectorConnect',
+define(`CLVectorConnect',
`for_(1,`$2',1,
`line from `$1'm4x.Out right `$3'.In1.x-`$1'm4x.Out.x \
- jog/2*(`$2'+1-abs(2*m4x-`$2'-1)) \
then down `$1'm4x.Out.y - `$3'.In`'m4x.y then to `$3'.In`'m4x ')')
Draw and label a non-inverted input
-define(`DrawIn',
+define(`CLDrawIn',
`PrevInput: PrevInput+(inputsep,0)
In`'$1: PrevInput
"$$1$" ljust at PrevInput # Maybe labels should be done externally
@@ -72,7 +72,7 @@ define(`DrawIn',
define(D`'$1)')
Draw and label an inverted input
-define(`DrawNotIn',
+define(`CLDrawNotIn',
`PrevInput: PrevInput+(inputsep,0)
In`'$1: PrevInput
"$$1$" ljust at PrevInput # Maybe labels should be done externally
@@ -84,7 +84,7 @@ define(`DrawNotIn',
define(D`'$1)')
Draw and label an input that is required both
inverted and uninverted.
-define(`DrawInNotIn',
+define(`CLDrawInNotIn',
`PrevInput: PrevInput+(inputsep,0)
In`'$1: PrevInput
"$$1$" ljust at PrevInput # Maybe labels should be done externally
@@ -97,23 +97,23 @@ define(`DrawInNotIn',
linethick = lineth
InNt`'$1: Here
define(D`'$1)')
- `varloop(`var',ifnotnegated,ifnegated,term)
+ `CLvarloop(`var',ifnotnegated,ifnegated,term)
Loop over term variables performing actions'
-define(`varloop',`ifelse(`$4',,,substr(`$4',0,1),~,
+define(`CLvarloop',`ifelse(`$4',,,substr(`$4',0,1),~,
`define(`$1',substr($4,1,1)) $3
- varloop(`$1',`$2',`$3',substr($4,2))',
+ CLvarloop(`$1',`$2',`$3',substr($4,2))',
`define(`$1',substr($4,0,1)) $2
- varloop(`$1',`$2',`$3',substr($4,1))')')')
+ CLvarloop(`$1',`$2',`$3',substr($4,1))')')')
Count gate inputs and mark last appearance
-define(`Countinputs',`varloop(`v_',
+define(`CLCountinputs',`CLvarloop(`v_',
`define(`incount',incr(incount)) define(Last`'v_,`$1')',
`define(`incount',incr(incount)) define(LastN`'v_,`$1')',$2)')
Draw a 2nd layer gate
-define(`DrawLayerGate',
+define(`CLDrawLayerGate',
`define(`incount',0) dnl
- Countinputs($1,$4) dnl
+ CLCountinputs($1,$4) dnl
ifelse(incount,1,
`LastGateSE: LastGateSE-(0,jog)
$1: [ In1:Here; line right AND_wd*L_unit; Out: Here] \
@@ -124,7 +124,7 @@ define(`DrawLayerGate',
linethick = lineth ')')
Connect this gate to its input lines
-define(`ConnectInputs',`define(`innum',0) varloop(`v_',
+define(`CLConnectInputs',`define(`innum',0) CLvarloop(`v_',
`define(`innum',incr(innum))
line from `$1'.In`'innum to (In`'v_,`$1'.In`'innum)dnl
ifelse(`$1',m4xpand(Last`'v_),`then to In`'v_',`; dot')',
@@ -134,7 +134,7 @@ define(`ConnectInputs',`define(`innum',0) varloop(`v_',
Delete definitions to allow more than one
circuit per diagram
-define(`DeleteLogDefs',`varloop(`v_',
+define(`CLDeleteLogDefs',`CLvarloop(`v_',
`undefine(Last`'v_) undefine(D`'v_) undefine(X`'v_)',
`undefine(LastN`'v_) undefine(D`'v_) undefine(XN`'v_)',$1)')
diff --git a/graphics/circuit_macros/examples/Diodes.m4 b/graphics/circuit_macros/examples/Diodes.m4
index bb34913822..f9fb94cdd2 100644
--- a/graphics/circuit_macros/examples/Diodes.m4
+++ b/graphics/circuit_macros/examples/Diodes.m4
@@ -45,9 +45,9 @@ movewid = 2pt__
{ {diode(,Z,RE) ; move ; "`{\tt diode(,Z,RE)}'" ljust}
move down 0.30; right_
{diode(,U) ; move ; "`{\tt diode(,U)}'" ljust}
- move down 0.25; right_
+ move down 0.15; right_
{diode(,T) ; move ; "`{\tt diode(,T)}'" ljust}
- move down 0.20; right_
+ move down 0.30; right_
{diode(,P) ; move ; "`{\tt diode(,P)}'" ljust}
move down 0.30; right_
{diode(,LE) ; move ; "`{\tt diode(,LE)}'" ljust}
diff --git a/graphics/circuit_macros/examples/Makefile b/graphics/circuit_macros/examples/Makefile
index b6ccbe2942..f3444395af 100644
--- a/graphics/circuit_macros/examples/Makefile
+++ b/graphics/circuit_macros/examples/Makefile
@@ -278,6 +278,7 @@ clobber: clean
rm -f *.ps
-@for dir in mf mpost pdflatex xfig psfrag svg dev test; \
do (if test -d $$dir ; then cd $$dir; make clobber; fi) ; done
+ rm -f ../doc/Circuit_macros.pdf ../Circuit_macros.pdf
rm -f *.warn
rm -f examples.pdf
rm -rf index.html html basenames *.png* dist zips htmlfiles svgfiles
@@ -295,7 +296,7 @@ clean:
rm -f core boxdims.tar.gz pics
rm -f *.dvi *.aux *.log *.toc *.blg *.eps *.tif *.epsi eps *-mfpic* *.svg
rm -f fig*.tex $(TEXPICS) *.roff *.int *.pic gpic.m4 test.tex xxx* *.fig
- rm -f rose.pdf
+ rm -f rose.pdf keyboard.pdf
rm -f *.dim *.bak rotate.ps tst.ps *.bbl *-pics.ps
rm -f *.tfm *[0-9]pk *.png *.svg *.1 *.gif
rm -f F_* Version.tex *stackdump *.ico ./.[A-Za-z]*
diff --git a/graphics/circuit_macros/examples/Mixer.m4 b/graphics/circuit_macros/examples/Mixer.m4
index 13291261c8..fbae37b095 100644
--- a/graphics/circuit_macros/examples/Mixer.m4
+++ b/graphics/circuit_macros/examples/Mixer.m4
@@ -57,9 +57,9 @@ Q2: mosfet(,,dMESDQuB,E) at (Q1,T2.s-(0,elen_-del))
capacitor(to (T1.L3.end-(del,0),Here),C)
rlabel(,\SI{0.1}{\micro{}}\hbox{\sf F}\hskip20pt)
LOD: dot
- { line to (RF,Here); dot(,,1)
- move left_ 4bp__; "sftxt(local)" rjust "sftxt(oscillator)" rjust
- move left 40bp__ }
+ { line to (RF,Here); dot(,,1); move left_ 4bp__; textht = 10bp__
+ { "sftxt(local)" wid 30bp__ rjust at Here+(0,5bp__) }
+ "sftxt(oscillator)" wid 50 bp__ rjust at Here+(0,-5bp__) }
line from T2.T left_ to (Q1.S,T2.T)
T2T: dot
{ capacitor(down_ to (Here,BT),C); rlabel(,\SI{0.1}{\micro{}}\hbox{\sf F})
diff --git a/graphics/circuit_macros/examples/UNO.m4 b/graphics/circuit_macros/examples/UNO.m4
index 5a4e5381b7..dab914ac80 100644
--- a/graphics/circuit_macros/examples/UNO.m4
+++ b/graphics/circuit_macros/examples/UNO.m4
@@ -153,7 +153,7 @@ divert(0)dnl
dot
dot(at R1.start-(2*del,0))
xtal(down_ 2*lg_pinsep)
- rlabel(16,,"MHz"); dot
+ rlabel(,16,"MHz"); dot
XT2: dot(at last line.start-(2*del,0)); { "XT2" at last [].n above }
Br1: jumper(left_ from U3.Pin33.end to (XT2,U3.Pin33))
diff --git a/graphics/circuit_macros/examples/Views.dms b/graphics/circuit_macros/examples/Views.dms
deleted file mode 100644
index c92e42bac2..0000000000
--- a/graphics/circuit_macros/examples/Views.dms
+++ /dev/null
@@ -1,5 +0,0 @@
-w[1]=58.0802
-w[2]=47.6604
-w[3]=46.9552
-w[4]=120.41
-w[5]=114.866
diff --git a/graphics/circuit_macros/examples/control.m4 b/graphics/circuit_macros/examples/control.m4
index e42a63edec..9da5c4a7fc 100644
--- a/graphics/circuit_macros/examples/control.m4
+++ b/graphics/circuit_macros/examples/control.m4
@@ -134,6 +134,7 @@ Plant: box wid boxwid*3/2 ht boxht*5/4 \
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #
ifelse(1,1,`
+ifelse(0,1,`
Multiblock: [
boxht = 0.4
boxwid = boxht
@@ -172,7 +173,12 @@ Rf: doublebox(R_2,R_3) at ((S1.x+T.x)/2,T.y-boxht*5/4)
arrow from Rf.w to (S1,Rf) then to S1.s
"$n_2$" at S1.s+(0,-boxht/2) ljust
] with .nw at Observer.sw + (0,-0.3)
- "(c) A multiblock example" below ljust at Multiblock.sw+(0,-3pt__)
+')
+ifelse(1,1,`
+Attitude: [
+] with .nw at Observer.sw + (0,-0.3)
+')
+ "(c) A multiblock example" below ljust at last [].sw+(0,-3pt__)
')
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #
diff --git a/graphics/circuit_macros/examples/dpv/CanLogicDPV.m4 b/graphics/circuit_macros/examples/dpv/CanLogicDPV.m4
index b6c1d02e2f..2f05d8e366 100644
--- a/graphics/circuit_macros/examples/dpv/CanLogicDPV.m4
+++ b/graphics/circuit_macros/examples/dpv/CanLogicDPV.m4
@@ -27,18 +27,18 @@ define(`CanLogic',
`define(`terms',`shift(shift(shift(shift($@))))')
# Determine required input variables and negated
# variables
- Loopover_(`t_',`varloop(`v_',`define(X`'v_)',`define(XN`'v_)',t_)',terms)
+ Loopover_(`t_',`CLvarloop(`v_',`define(X`'v_)',`define(XN`'v_)',t_)',terms)
# Draw the inputs with NOT gates as necessary
LastInput: Here-(inputsep,0)
- Loopover_(`t_',`varloop(`v_',
- `ifdef(D`'v_,,`ifdef(XN`'v_,`DrawInNotIn(v_)',`DrawIn(v_)')')',
- `ifdef(D`'v_,,`ifdef(X`'v_,`DrawInNotIn(v_)',`DrawNotIn(v_)')')', t_)',
+ Loopover_(`t_',`CLvarloop(`v_',
+ `ifdef(D`'v_,,`ifdef(XN`'v_,`CLDrawInNotIn(v_)',`CLDrawIn(v_)')')',
+ `ifdef(D`'v_,,`ifdef(X`'v_,`CLDrawInNotIn(v_)',`CLDrawNotIn(v_)')')', t_)',
terms)
# Draw 2nd-layer gates
right_
LastGateSE: LastInput+(5*jog,-(AND_wd*L_unit*1.5))
Loopover_(`t_',
- `define(`termcount',m4Lx)DrawLayerGate(G`'termcount,$1,$2,t_)',
+ `define(`termcount',m4Lx)CLDrawLayerGate(G`'termcount,$1,$2,t_)',
terms)
# Draw output gate
linethick = gatelineth
@@ -47,26 +47,26 @@ define(`CanLogic',
Out: Here
linethick = lineth
# Connect 2nd-layer gates to the output gate
- VectorConnect(G,termcount,OP)
+ CLVectorConnect(G,termcount,OP)
# Connect the inputs and negated inputs to
# 2nd-layer gates
- Loopover_(`t_',`ConnectInputs(G`'m4Lx,t_)',terms)
+ Loopover_(`t_',`CLConnectInputs(G`'m4Lx,t_)',terms)
# Clean up
- Loopover_(`t_',`DeleteLogDefs(t_)',terms)
+ Loopover_(`t_',`CLDeleteLogDefs(t_)',terms)
')
- `VectorConnect(number of 2nd layer gates,
+ `CLVectorConnect(number of 2nd layer gates,
common 2nd layer gate name,
output gate name)
Connect the 2nd-layer gate outputs to the
output gate inputs'
-define(`VectorConnect',
+define(`CLVectorConnect',
`for_(1,`$2',1,
`line from `$1'm4x.Out right `$3'.In1.x-`$1'm4x.Out.x \
- jog/2*(`$2'+1-abs(2*m4x-`$2'-1)) \
then down `$1'm4x.Out.y - `$3'.In`'m4x.y then to `$3'.In`'m4x ')')
Draw and label a non-inverted input
-define(`DrawIn',
+define(`CLDrawIn',
`LastInput: LastInput+(inputsep,0)
In`'$1: LastInput
"svg_it($1)" ljust at LastInput # Maybe labels should be done externally
@@ -74,7 +74,7 @@ define(`DrawIn',
define(D`'$1)')
Draw and label an inverted input
-define(`DrawNotIn',
+define(`CLDrawNotIn',
`LastInput: LastInput+(inputsep,0)
InN`'$1: LastInput
"svg_it($1)" ljust at LastInput # Maybe labels should be done externally
@@ -86,7 +86,7 @@ define(`DrawNotIn',
define(D`'$1)')
Draw and label an input that is required both
inverted and uninverted.
-define(`DrawInNotIn',
+define(`CLDrawInNotIn',
`LastInput: LastInput+(inputsep,0)
In`'$1: LastInput
"svg_it($1)" ljust at LastInput # Maybe labels should be done externally
@@ -99,23 +99,23 @@ define(`DrawInNotIn',
linethick = lineth
InNt`'$1: Here
define(D`'$1)')
- `varloop(`var',ifnotnegated,ifnegated,term)
+ `CLvarloop(`var',ifnotnegated,ifnegated,term)
Loop over term variables performing actions'
-define(`varloop',`ifelse(`$4',,,substr(`$4',0,1),~,
+define(`CLvarloop',`ifelse(`$4',,,substr(`$4',0,1),~,
`define(`$1',substr($4,1,1)) $3
- varloop(`$1',`$2',`$3',substr($4,2))',
+ CLvarloop(`$1',`$2',`$3',substr($4,2))',
`define(`$1',substr($4,0,1)) $2
- varloop(`$1',`$2',`$3',substr($4,1))')')')
+ CLvarloop(`$1',`$2',`$3',substr($4,1))')')')
Count gate inputs and mark last appearance
-define(`Countinputs',`varloop(`v_',
+define(`CLCountinputs',`CLvarloop(`v_',
`define(`incount',incr(incount)) define(Last`'v_,`$1')',
`define(`incount',incr(incount)) define(LastN`'v_,`$1')',$2)')
Draw a 2nd layer gate
-define(`DrawLayerGate',
+define(`CLDrawLayerGate',
`define(`incount',0)
- Countinputs($1,$4)
+ CLCountinputs($1,$4)
ifelse(incount,1,
`LastGateSE: LastGateSE-(0,jog)
$1: [ In1:Here; line right AND_wd*L_unit; Out: Here] \
@@ -126,7 +126,7 @@ define(`DrawLayerGate',
linethick = lineth ')')
Connect this gate to its input lines
-define(`ConnectInputs',`define(`innum',0) varloop(`v_',
+define(`CLConnectInputs',`define(`innum',0) CLvarloop(`v_',
`define(`innum',incr(innum))
line from `$1'.In`'innum to (In`'v_,`$1'.In`'innum)dnl
ifelse(`$1',m4xpand(Last`'v_),`then to In`'v_',`; dot')',
@@ -136,7 +136,7 @@ define(`ConnectInputs',`define(`innum',0) varloop(`v_',
Delete definitions to allow more than one
circuit per diagram
-define(`DeleteLogDefs',`varloop(`v_',
+define(`CLDeleteLogDefs',`CLvarloop(`v_',
`undefine(Last`'v_) undefine(D`'v_) undefine(X`'v_)',
`undefine(LastN`'v_) undefine(D`'v_) undefine(XN`'v_)',$1)')
diff --git a/graphics/circuit_macros/examples/dpv/UNODPV.m4 b/graphics/circuit_macros/examples/dpv/UNODPV.m4
index 86b5100f34..3e5fb11e93 100644
--- a/graphics/circuit_macros/examples/dpv/UNODPV.m4
+++ b/graphics/circuit_macros/examples/dpv/UNODPV.m4
@@ -153,7 +153,7 @@ divert(0)dnl
dot
dot(at R1.start-(2*del,0))
xtal(down_ 2*lg_pinsep)
- rlabel(16,,MHz); dot
+ rlabel(,16,MHz); dot
XT2: dot(at last line.start-(2*del,0)); { "XT2" at last [].n above }
Br1: jumper(left_ from U3.Pin33.end to (XT2,U3.Pin33))
diff --git a/graphics/circuit_macros/examples/dpv/examplesDPV.htmx b/graphics/circuit_macros/examples/dpv/examplesDPV.htmx
index 8d33b9f07e..84fb877209 100644
--- a/graphics/circuit_macros/examples/dpv/examplesDPV.htmx
+++ b/graphics/circuit_macros/examples/dpv/examplesDPV.htmx
@@ -21,6 +21,16 @@ flowcharts, picture overlay, ASME Y14.5' >
<link rel="shortcut icon" href="../Circuit_macros.ico" type="image/x-icon" />
</HEAD>
+`<!-- Google tag (gtag.js) -->
+<script async src="https://www.googletagmanager.com/gtag/js?id=G-HRS8TQGRE8"></script>
+<script>
+ window.dataLayer = window.dataLayer || [];
+ function gtag(){dataLayer.push(arguments);}
+ gtag('js', new Date());
+
+ gtag('config', 'G-HRS8TQGRE8');
+</script>'
+
<!-- m4 macros: ------------------------------------------------------------
define(`ifinstr',`ifelse(`$2',,`$1',index(`$1',`$2'),-1,
`ifinstr(shift(shift(shift($@))))',`$3')')
diff --git a/graphics/circuit_macros/examples/dpv/examplesDPVs.htmx b/graphics/circuit_macros/examples/dpv/examplesDPVs.htmx
index 7ad5f84e9f..e46725b0d7 100644
--- a/graphics/circuit_macros/examples/dpv/examplesDPVs.htmx
+++ b/graphics/circuit_macros/examples/dpv/examplesDPVs.htmx
@@ -21,6 +21,17 @@ flowcharts, picture overlay, ASME Y14.5' >
<link rel="shortcut icon" href="../Circuit_macros.ico" type="image/x-icon" />
</HEAD>
+`<!-- Google tag (gtag.js) -->
+<script async src="https://www.googletagmanager.com/gtag/js?id=G-HRS8TQGRE8"></script>
+<script>
+ window.dataLayer = window.dataLayer || [];
+ function gtag(){dataLayer.push(arguments);}
+ gtag('js', new Date());
+
+ gtag('config', 'G-HRS8TQGRE8');
+</script>'
+
+
<!-- m4 macros: ------------------------------------------------------------
define(`ifinstr',`ifelse(`$2',,`$1',index(`$1',`$2'),-1,
`ifinstr(shift(shift(shift($@))))',`$3')')
diff --git a/graphics/circuit_macros/examples/dpv/sfgDPV.m4 b/graphics/circuit_macros/examples/dpv/sfgDPV.m4
index 4e32981619..a516b3fb97 100644
--- a/graphics/circuit_macros/examples/dpv/sfgDPV.m4
+++ b/graphics/circuit_macros/examples/dpv/sfgDPV.m4
@@ -1,7 +1,7 @@
.PS
# sfgDPV.m4
gen_init(svg_font(Times,11bp__))
-sfg_init( 1.2 ) # scale default size by 1.2
+sfg_init( blen=1.2 ) # default edge length
textht = textht*0.9
@@ -71,7 +71,7 @@ define(`svg_choose',`[ P:"svg_fsize(( ),150)"
"svg_small(`$2')" at P-(0,3bp__)
]')
-G4: [sfg_init( 2.0,0.25/2 ) # change node spacing and increase node size
+G4: [sfg_init( blen=2;rad=0.25/2 ) # change node spacing and size
s1 = 0.9
s2 = 1.2
N0: sfgnode(,svg_fsize(0,120),,invis)
@@ -98,7 +98,7 @@ G4: [sfg_init( 2.0,0.25/2 ) # change node spacing and increase node size
] with .nw at G3.sw+(0,-0.1)
# https://tex.stackexchange.com/questions/637455/tikz-how-to-set-exact-position-of-node
-G5: [sfg_init( 1.75,0.25/2 ) # change node spacing and increase node size
+G5: [sfg_init( blen=1.75;rad=0.25/2 ) # change node spacing and size
Dstar: sfgnode(,* )
D0: sfgnode(at Dstar+(2,0),svg_small(&lt;&gt;)svg_sub(0) )
sfgline(,
diff --git a/graphics/circuit_macros/examples/dpv/tstDPV.htmx b/graphics/circuit_macros/examples/dpv/tstDPV.htmx
index 64d1753399..3859f9f30f 100644
--- a/graphics/circuit_macros/examples/dpv/tstDPV.htmx
+++ b/graphics/circuit_macros/examples/dpv/tstDPV.htmx
@@ -21,6 +21,17 @@ flowcharts, picture overlay, ASME Y14.5' >
<link rel="shortcut icon" href="../Circuit_macros.ico" type="image/x-icon" />
</HEAD>
+`<!-- Google tag (gtag.js) -->
+<script async src="https://www.googletagmanager.com/gtag/js?id=G-HRS8TQGRE8"></script>
+<script>
+ window.dataLayer = window.dataLayer || [];
+ function gtag(){dataLayer.push(arguments);}
+ gtag('js', new Date());
+
+ gtag('config', 'G-HRS8TQGRE8');
+</script>'
+
+
<!-- m4 macros: ------------------------------------------------------------
define(`ifinstr',`ifelse(`$2',,`$1',index(`$1',`$2'),-1,
`ifinstr(shift(shift(shift($@))))',`$3')')
diff --git a/graphics/circuit_macros/examples/examples.pdf b/graphics/circuit_macros/examples/examples.pdf
index ac0892249d..1ca1e0ca2d 100644
--- a/graphics/circuit_macros/examples/examples.pdf
+++ b/graphics/circuit_macros/examples/examples.pdf
Binary files differ
diff --git a/graphics/circuit_macros/examples/extras/README_extras b/graphics/circuit_macros/examples/extras/README_extras
index 140802fb68..1c18266a6a 100644
--- a/graphics/circuit_macros/examples/extras/README_extras
+++ b/graphics/circuit_macros/examples/extras/README_extras
@@ -1,6 +1,14 @@
-THIS DIRECTORY contains a Makefile and .m4 sources for diagrams
-not included in the examples files. Type "make" and, to clean up,
-"make clean". This directory is assumed to be a subdirectory of
-the examples directory in order to include the necessary definition
-files.
+THIS DIRECTORY contains a Makefile and m4 sources for diagrams not
+included in the examples files. Many of these correspond to questions
+asked on stackexchange, of the form "How do I draw ... with tikz?"
+Producing drawings like these can be satisfying, as shown by the alacrity
+with which knowledgable people assist when questions are asked. Often,
+the question has more to do with geometry than drawing language, and
+the examples here using m4 with dpic merely confirm that the coding can
+often be done reasonably in several possible languages.
+
+This directory is assumed to be a subdirectory of the examples directory
+in order to include the necessary definition files.
+
+Type "make" and, to clean up, "make clean".
diff --git a/graphics/circuit_macros/examples/extras/Y14-5_example.m4 b/graphics/circuit_macros/examples/extras/Y14-5_example.m4
deleted file mode 100644
index cb4397516c..0000000000
--- a/graphics/circuit_macros/examples/extras/Y14-5_example.m4
+++ /dev/null
@@ -1,53 +0,0 @@
-.PS
-# Y14-5_example.m4
-# https://en.wikipedia.org/wiki/Geometric_dimensioning_and_tolerancing
-cct_init
-textht = 11bp__*2/3
-command "{\sf"
-sinclude(ASME_Y14-5.m4def)
-sinclude(../ASME_Y14-5.m4def)
-
- boxht = 7.5/0.5*textht
- boxwid = 15/7.5 * boxht
- circlerad = 2.3/0.5*textht*0.5
- thicklines_(1)
- arrowht = textht*0.8
- arrowwid = textht*0.6
-
- Box: box
- Circle: circle at Box.c; {CM: move from Circle.se down textht right textht}
-thinlines_
-CLV: ctrline( up_ Box.ht with .c at Box.c, Box.ht/2 )
-CLH: ctrline( right Box.ht with .c at Box.c, Box.ht/2 )
-
- dimension_(from Box.nw to Box.n,Box.ht/6)
- thicklines_(1)
- {Y14_frame("10") with .s at AS_C+(0,textht/2)}
- thinlines_
- line from 3rd last line.start to CLV.end
- dimension_(from Box.w to Box.nw,Box.ht/6)
- thicklines_(1)
- {Y14_frame("5") with .e at AS_C+(-textht/2,0)}
- thinlines_
- line from 4th last line.start to CLH.start
-
-thicklines_
- DA: Y14_frame("A") at Box.ne+(-textht*1.5,textht*5)
- datumarrow(from DA.s to (DA,Box.n))
- DB: Y14_frame("B") at Box.sw+(-textht*5,textht*2)
- datumarrow(from DB.e to (Box.w,DB))
-
- F: Y14_frame(Y14_pos_,
- Y14_dia_;"0.03";"(M)",
- "A","B","C") with .w at Box.se+(-textht*4,-textht*2)
- G: Y14_frame(Y14_fla_,Y14_cyl_,Y14_lin_,
- Y14_sur_,Y14_per_,Y14_ang_,
- Y14_par_) with .nw at F.sw+(0,-0.1)
- H: Y14_frame(Y14_pos_,Y14_cir_,Y14_tot_,Y14_dia_) \
- with .nw at G.sw+(0,-0.1)
-
- { CB: move left textht from F.w }
- arrow <- from Circle.se to Intersect_(CM,CB) then to F.w
-
- command "}"
-.PE
diff --git a/graphics/circuit_macros/examples/files.tex b/graphics/circuit_macros/examples/files.tex
index 8ca2c08f76..333eeb6825 100644
--- a/graphics/circuit_macros/examples/files.tex
+++ b/graphics/circuit_macros/examples/files.tex
@@ -793,8 +793,7 @@ ifpostscript(,\bfig{%
\includegraphics[width=3in]{Incl.eps}}%
\hspace*{-3in}\includegraphics{Incleps.eps}}%
\caption{Overlaying a figure with line graphics %ignore%
- \src{Incleps.m4}.}
- })
+ \src{Incleps.m4}.}})
\fi\fi\fi\fi\fi
\fi % ifmpost
diff --git a/graphics/circuit_macros/examples/keyboard.pdf b/graphics/circuit_macros/examples/keyboard.pdf
deleted file mode 100644
index 0d5fa829b8..0000000000
--- a/graphics/circuit_macros/examples/keyboard.pdf
+++ /dev/null
Binary files differ
diff --git a/graphics/circuit_macros/examples/mf/cct.mf b/graphics/circuit_macros/examples/mf/cct.mf
index fd626e6be7..776d8f4183 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 2023/03/10 at 23:35
+% from TeX source "font" on 2023/05/31 at 20:45
numeric mfpicversion; mfpicversion := 110;
if unknown mode: mode := localfont; fi
if unknown mag: mag := 1000/1000; fi
diff --git a/graphics/circuit_macros/examples/mpost/Makefile b/graphics/circuit_macros/examples/mpost/Makefile
index 978e1e3592..af86f44cbe 100644
--- a/graphics/circuit_macros/examples/mpost/Makefile
+++ b/graphics/circuit_macros/examples/mpost/Makefile
@@ -61,7 +61,7 @@ MPOST = mpost --tex=latex
TR = | tr '=' '\134'
-LATEX = latex
+LATEX = latex --quiet
DVIPS = dvips
DIMFILE = tmp.dim
@@ -95,8 +95,9 @@ $(DOC).ps: $(DOC).dvi
EXL = exlinks
$(DOC).dvi: $(DOC).tex
- -if test "$(DOC)" = "examplesmpost" ; then make exlinks dims; fi
- make $(FIGS) rose.pdf
+ -if test "$(DOC)" = "examplesmpost" ; then \
+ make exlinks dims; rose.pdf; fi
+ make $(FIGS)
$(LATEX) $(DOC)
-if test -n "$(BOXDIMS)" ; then rm -f dims; \
for box in $(BOXDIMS) ; do rm -f $$box.1; done; \
@@ -112,9 +113,14 @@ figs: $(EXL) $(FIGS)
rose.pdf: ../rose.m4
m4 pdf.m4 ../rose.m4 | dpic -d > rose.pdf
-exlinks:
+ignore:
+ @echo ""
@echo ""
@echo 'Ignore "cannot create ... exists and file.1 not found" warnings.'
+ @echo ""
+ @echo ""
+
+exlinks: ignore
-@if test ! -f ex11.m4 ; then \
ls ../*.m4 | sed -e 's/^/ln -s /' -e '/test.m4/d' | sh;\
fi
@@ -125,10 +131,9 @@ exlinks:
clobber: clean
-tst:
+tst: ignore
rm -f tst.ps tst.dvi test.1 test.mp
- make EXL="" DPIC="$(DPIC)" CONFIGFILE="$(CONFIGFILE)" DOC=tstmpost \
- FIGS=test.1 BOXDIMS=test
+ make EXL="" DPIC="$(DPIC)" DOC=tstmpost FIGS=test.1 BOXDIMS=test
rm -f *.frs
tst1: test.1 tstmpost.tex
diff --git a/graphics/circuit_macros/examples/sfg.m4 b/graphics/circuit_macros/examples/sfg.m4
index a2efdb2ec6..1d22326d45 100644
--- a/graphics/circuit_macros/examples/sfg.m4
+++ b/graphics/circuit_macros/examples/sfg.m4
@@ -1,6 +1,6 @@
.PS
# sfg.m4
-sfg_init( 1.2 ) # scale default size by 1.2
+sfg_init( 1.2 ) # default edge length = 1.2
iflatex(`textoffset = 1bp__; ifpsfrag(`textht = 9.5bp__',
`latexcommand({\small)') ')
@@ -43,7 +43,7 @@ B: [
#showbox_(,"B")
# Graph 3
-G3: [#sfg_init( 0.85,0.35/2 ) # change node spacing and increase node size
+G3: [#sfg_init( 0.85,0.35/2 ) # change node spacing and size
sfg_wid = 0.85
sfg_rad = 0.35/2
for_(1,4,1,`N`'m4x: sfgnode(,m4x,,fill_(0.9))
@@ -70,7 +70,7 @@ A: [#sfg_init( 0.75,0.15 )
] with .w at G3.e+(linewid/2,0)
#showbox_(,"A")
-G4: [sfg_init( 2.0,0.25/2 ) # change node spacing and increase node size
+G4: [sfg_init( 2.0,0.25/2 ) # change node spacing and size
s1 = 0.9
s2 = 1.2
N0: sfgnode(,\hbox{\Large 0},,invis)
@@ -92,7 +92,7 @@ G4: [sfg_init( 2.0,0.25/2 ) # change node spacing and increase node size
#showbox_(,"G4")
# https://tex.stackexchange.com/questions/637455/tikz-how-to-set-exact-position-of-node
-G5: [sfg_init( 1.75,0.25/2 ) # change node spacing and increase node size
+G5: [sfg_init( 1.75,0.25/2 ) # change node spacing and size
Dstar: sfgnode(,*)
D0: sfgnode(at Dstar+(2,0),\diamond_0)
sfgline(,`1-r_{x{-}1,x}-q^i_{x{-}1,x}',,->)
diff --git a/graphics/circuit_macros/examples/shadowed.m4 b/graphics/circuit_macros/examples/shadowed.m4
index b0bf0afa15..f25be03732 100644
--- a/graphics/circuit_macros/examples/shadowed.m4
+++ b/graphics/circuit_macros/examples/shadowed.m4
@@ -1,4 +1,5 @@
.PS
+# shadowed.m4
gen_init
divert(-1)
diff --git a/graphics/circuit_macros/examples/xfig/xfiglib.fig b/graphics/circuit_macros/examples/xfig/xfiglib.fig
index 53db089ade..e284b3c82f 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 2023.03.01 option -x for Fig 3.2
+# dpic version 2023.06.01 option -x for Fig 3.2
1200 2
6 0 0 3975 5025
6 0 0 3975 5025
diff --git a/graphics/circuit_macros/examples/xtras b/graphics/circuit_macros/examples/xtras
deleted file mode 100644
index d2211aa5f5..0000000000
--- a/graphics/circuit_macros/examples/xtras
+++ /dev/null
@@ -1,61 +0,0 @@
-mv ASMEbox.m4 extras
-mv Ant.m4 extras
-mv ArrowFn.m4 extras
-mv Attention.m4 extras
-mv Autoencoder.m4 extras
-mv Bridge.m4 extras
-mv CSlight.m4 extras
-mv Ccurve.m4 extras
-mv Chuck.m4 extras
-mv Clocks.m4 extras
-mv ControlLoop.m4 extras
-mv Counting.m4 extras
-mv Cruller.m4 extras
-mv Cylinder.m4 extras
-mv Egg.m4 extras
-mv Euro.m4 extras
-mv Eye.m4 extras
-mv Fefets.m4 extras
-mv FieldLines.m4 extras
-mv Floor.m4 extras
-mv Flow2.m4 extras
-mv Hexagon.m4 extras
-mv Highgain.m4 extras
-mv IC10107.m4 extras
-mv Koch.m4 extras
-mv Lyap.m4 extras
-mv Metamodel.m4 extras
-mv Obliq.m4 extras
-mv OneLine.m4 extras
-mv OpAmpFilter.m4 extras
-mv Optics.m4 extras
-mv Orbits.m4 extras
-mv PPA.m4 extras
-mv PerpTo.m4 extras
-mv Pipe.m4 extras
-mv Planes.m4 extras
-mv RandomNodes.m4 extras
-mv Region.m4 extras
-mv Resolver.m4 extras
-mv SPM.m4 extras
-mv SampleFlow.m4 extras
-mv ShadeSector.m4 extras
-mv Shadow.m4 extras
-mv Shaky.m4 extras
-mv Star.m4 extras
-mv Stator.m4 extras
-mv TR_fill.m4 extras
-mv Views.m4 extras
-mv Wheat.m4 extras
-mv Wheel.m4 extras
-mv Y14-5_example.m4 extras
-mv Zcos.m4 extras
-mv birds.m4 extras
-mv bistable.m4 extras
-mv brace.m4 extras
-mv chaos.m4 extras
-mv hsv.m4 extras
-mv person.m4 extras
-mv rotellipse.m4 extras
-mv squiggle.m4 extras
-mv venus.m4 extras
diff --git a/graphics/circuit_macros/gpic.m4 b/graphics/circuit_macros/gpic.m4
index 109f941e7b..6ac550379d 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 10.2, copyright (c) 2023 J. D. Aplevich under *
+* Circuit_macros Version 10.3, copyright (c) 2023 J. D. Aplevich under *
* the LaTeX Project Public Licence in file Licence.txt. The files of *
* this distribution may be redistributed or modified provided that this *
* copyright notice is included and provided that modifications are clearly *
diff --git a/graphics/circuit_macros/lib3D.m4 b/graphics/circuit_macros/lib3D.m4
index 040866aa45..b5a2f87aaf 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 or colors.
-* Circuit_macros Version 10.2, copyright (c) 2023 J. D. Aplevich under *
+* Circuit_macros Version 10.3, copyright (c) 2023 J. D. Aplevich under *
* the LaTeX Project Public Licence in file Licence.txt. The files of *
* this distribution may be redistributed or modified provided that this *
* copyright notice is included and provided that modifications are clearly *
diff --git a/graphics/circuit_macros/libSLD.m4 b/graphics/circuit_macros/libSLD.m4
index 5555e03131..59729e8f86 100644
--- a/graphics/circuit_macros/libSLD.m4
+++ b/graphics/circuit_macros/libSLD.m4
@@ -2,7 +2,7 @@ divert(-1)
libSLD.m4 Draft macros for single-line diagram elements
-* Circuit_macros Version 10.2, copyright (c) 2023 J. D. Aplevich under *
+* Circuit_macros Version 10.3, copyright (c) 2023 J. D. Aplevich under *
* the LaTeX Project Public Licence in file Licence.txt. The files of *
* this distribution may be redistributed or modified provided that this *
* copyright notice is included and provided that modifications are clearly *
diff --git a/graphics/circuit_macros/libcct.m4 b/graphics/circuit_macros/libcct.m4
index cf73ba0567..fd31a76c80 100644
--- a/graphics/circuit_macros/libcct.m4
+++ b/graphics/circuit_macros/libcct.m4
@@ -1,7 +1,7 @@
divert(-1)
libcct.m4
-* Circuit_macros Version 10.2, copyright (c) 2023 J. D. Aplevich under *
+* Circuit_macros Version 10.3, copyright (c) 2023 J. D. Aplevich under *
* the LaTeX Project Public Licence in file Licence.txt. The files of *
* this distribution may be redistributed or modified provided that this *
* copyright notice is included and provided that modifications are clearly *
@@ -3464,6 +3464,14 @@ define(`m4pconpin',`[ifinstr(`$3',F,`lbox(`$1',`$2')',
define(`m4pcrpin',`[ifinstr(`$2',F,`circle diam `$1'',
`m4fshade(m4fill,circle diam `$1')')]')
+ `m4fshade(gray value,closed curve) internal'
+ifelse(m4picprocessor,gpic,
+ `define`m4fshade',`shade(ifelse(`$1',,0,`$1'),`$2')')',
+m4postprocessor,xfig,
+ `define(`m4fshade',``$2' fill ifelse(`$1',,0,`$1')')',
+`define(`m4fshade',``$2' dnl
+ ifdef(`r_',`shaded rgbstring(r_,g_,b_)',`fill ifelse(`$1',,0,`$1')')')')
+
`Header(1|2,rows,wid,ht,type)
arg1: number of columns
arg2: pins per column
@@ -3597,7 +3605,8 @@ define(`norator',`eleminit_(`$1')
{[box invis ht_ m4ht wid_ m4wd] at rvec_(rp_len/2,0)}
line to rvec_(rp_len,0) invis ')
- `ACsymbol(at position, len, ht, [n:][A]U|D|L|R|degrees)
+ `ACsymbol(at position, len, ht, [n:][A]U|D|L|R|degrees,
+ attributes)
Arg4: drawing direction (default: current direction)
Arg4 contains A: use arcs instead of sinusoid
A convenience for drawing a stack of n 1-cycle
@@ -3619,12 +3628,13 @@ define(`ACsymbol',`[ Origin: Here
{ arc ccw to rvec_( m4range/2,0) \
with .c at rvec_( m4range/4, max(m4range/4-m4amp,0)) }] dnl
with .Origin at Here }',
- `{ S`'m4x: sinusoid(m4amp,twopi_/m4range,pi_/2,-m4range/2,m4range/2) dnl
- with .Origin at Here } ')')
- `$5'; resetdir_ popdef(`m4amp',`m4n',`m4ACd',`m4range')] dnl
+ `{ S`'m4x: sinusoid(m4amp,twopi_/m4range,pi_/2,
+ -m4range/2,m4range/2,`$5') with .Origin at Here } ')')
+ `$6'; resetdir_ popdef(`m4amp',`m4n',`m4ACd',`m4range')] dnl
with .Origin ifelse(`$1',,`at Here',`$1')')
- `Deltasymbol(at position, keys, U|D|L|R|degrees)
+ `Deltasymbol(at position, keys, U|D|L|R|degrees,
+ attributes)
keys: size=expr;
type=C|O (default C for Closed, O means open);
Arg3: drawing direction (default: Up)
@@ -3633,18 +3643,18 @@ define(`Deltasymbol',`[ sq3 = sqrt(3)
pushkeys_(`$2',size:dimen_/10; type:C:N )dnl
setdir_(`$3',U)
ifinstr(m4type,C,
- `line from vec_(vscal_(m4size,-sq3,0)) to \
+ `line `$4' from vec_(vscal_(m4size,-sq3,0)) to \
vec_(vscal_(m4size,-sq3,1)) then to Here \
then to vec_(vscal_(m4size,-sq3,-1)) \
then to vec_(vscal_(m4size,-sq3,0))',
- `line from vec_(vscal_(m4size,-sq3/2,-1/2)) \
+ `line `$4' from vec_(vscal_(m4size,-sq3/2,-1/2)) \
to vec_(vscal_(m4size,-sq3,-1)) \
then to vec_(vscal_(m4size,-sq3,1)) \
then to vec_(vscal_(m4size,-sq3/2,1/2)) ')
C: vec_(vscal_(m4size,-(sq3+1/sq3)/2,0)); N: C
`$4'; resetdir_ popdef(`m4size',`m4type') ] ifelse(`$1',,`at Here',`$1')')
- `Ysymbol(at position, keys, U|D|L|R|degrees)
+ `Ysymbol(at position, keys, U|D|L|R|degrees, attributes)
keys: size=expr; type=G[L] (grounded,
L puts the ground on the left);
Arg3: drawing direction (default: Up)'
@@ -3653,25 +3663,26 @@ define(`Ysymbol',`[ sq3 = sqrt(3)
setdir_(`$3',U)
C: Here; N: C
line from vec_(vscal_(m4size,-2/sq3,0)) to C
- { line from vec_(vscal_(m4size,1/sq3,1)) to C \
+ { line `$4' from vec_(vscal_(m4size,1/sq3,1)) to C \
then to vec_(vscal_(m4size,1/sq3,-1)) }
- ifelse(m4type,,,`line ifinstr(m4type,L,left_,right_) m4size*3/2; corner
- pushdef(`dimen_',m4size*4) ground popdef(`dimen_') ')
- `$4'; resetdir_ popdef(`m4size',`m4type') ] ifelse(`$1',,`at Here',`$1')')
+ ifelse(m4type,,,`line `$4' ifinstr(m4type,L,left_,right_) m4size*3/2
+ corner(,`$4'); pushdef(`dimen_',m4size*4) ground popdef(`dimen_') ')
+ `$5'; resetdir_ popdef(`m4size',`m4type') ] ifelse(`$1',,`at Here',`$1')')
`Wyesymbol(at position, keys, U|D|L|R|degrees)
Synonym for Ysymbol'
define(`Wyesymbol',`Ysymbol($@)')
- `DCsymbol(at position, len, ht, U|D|L|R|degrees)
+ `DCsymbol(at position, len, ht, U|D|L|R|degrees,
+ attributes)
Arg4: drawing direction (default: current direction)'
define(`DCsymbol',`[
pushdef(`m4wid',`ifelse(`$2',,(dimen_/3),`($2)')')dnl
pushdef(`m4ht',`ifelse(`$3',,`(m4wid/5)',`($3)')')
setdir_(ifelse(`$4',,`ifdef(`m4a_',rp_ang*rtod_,0)',`$4'))
Origin: rvec_(m4wid/2, m4ht/2)
- {line to rvec_(m4wid,0)}
- dashline(from rvec_(0, m4ht) to rvec_(m4wid, m4ht),,m4wid/4,m4wid/8)
- `$5'; resetdir_ popdef(`m4ht',`m4wid') ] \
+ {line `$5' to rvec_(m4wid,0)}
+ dashline(from rvec_(0, m4ht) to rvec_(m4wid, m4ht),`$5',m4wid/4,m4wid/8)
+ `$6'; resetdir_ popdef(`m4ht',`m4wid') ] \
with .Origin ifelse(`$1',,`at Here',`$1')')
`n-terminal box
diff --git a/graphics/circuit_macros/libgen.m4 b/graphics/circuit_macros/libgen.m4
index b62c7d3fa8..324196e6ec 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 10.2, copyright (c) 2023 J. D. Aplevich under *
+* Circuit_macros Version 10.3, copyright (c) 2023 J. D. Aplevich under *
* the LaTeX Project Public Licence in file Licence.txt. The files of *
* this distribution may be redistributed or modified provided that this *
* copyright notice is included and provided that modifications are clearly *
@@ -44,8 +44,7 @@ dnl define(`HOMELIB_',`D:\Dwight\lib')
`NeedDpicTools( path )
If path is empty then HOMELIB_ is used
e.g. NeedDpicTools or NeedDpicTools(/home/lib/)'
-define(`NeedDpicTools',`if dpicopt > 0 then { copy dnl
-ifelse(`$1',,`"HOMELIB_`'dpictools.pic"',`"`$1'dpictools.pic"') }')
+define(`NeedDpicTools',`if !dpictools_ then { copydpictools_($1) }')
Processor shortcuts
define(`ifdpic',`ifelse(m4picprocessor,dpic,`$1',`$2')')
@@ -102,12 +101,12 @@ ifgpic(` if (rp_len == 0) then { rp_ang=0 } else {')dnl
define(`twopi__',`6.2831853071795862')`twopi_' = twopi__;dnl
define(`pi__',`(twopi_/2)')`pi_' = pi__
rp_ang = 0; right_
- define(`ctension_',`0.551784')dnl
-
+ define(`ctension_',`0.551784')define dpictools_ {0}dnl
+ define copydpictools_ {if "$`'1"=="" then { copy "HOMELIB_/dpictools.pic"; } \
+ else { copy "$`'1/dpictools.pic"; } }
ifmpost(`defineRGBprimaries')
ifpostscript(`defineRGBprimaries
- command " 0.8 setlinewidth"',
- `thicklines_')
+ command "0.8 setlinewidth"',`thicklines_')
ifpstricks(M4PatchPSTricks)
ifgpic(linethick = 0.8)
dnl Insert customizations as desired,
@@ -150,9 +149,23 @@ ifdef(`threeD_init',,
`$1'
`# threeD_init end'
')')
+ `sfg_init( branchlen, radius, height, width )
+ or sfg_init(keys)
+ keys= blen=expr; branch len
+ rad=expr; node radius
+ hght=expr; arrowhead height
+ wdth=expr; arrowhead width'
+define(`sfg_init',`cct_init
+ pushkeys_(`$1',blen:m4bxx; rad:m4rxx; hght:m4hxx; wdth:m4wxx)dnl
+ sfg_wid = ifelse(m4blen,(m4bxx),ifelse(`$1',,linewid/3*2.75,`$1'),m4blen)
+ sfg_rad = ifelse(m4rad,(m4rxx),ifelse(`$2',,1/32,`$2'),m4rad)
+ sfg_aht = ifelse(m4hght,(m4hxx),ifelse(`$3',,1/16,`$3'),m4hght)
+ sfg_awid =ifelse(m4wdth,(m4wxx),ifelse(`$4',,`sfg_aht',`$4'),m4wdth)
+ popdef(`m4blen',`m4rad',`m4hght',`m4wdth')dnl
+ ')
sfg graphs in libcct.m4
-define(`sfg_init',`cct_init
+define(`xfg_init',`cct_init
sfg_wid = ifelse(`$1',,`(linewid/0.75*(2.5+0.25)/4)',(`$1'))# default line len
sfg_rad = ifelse(`$2',,(0.25/4/2),(`$2')) # node radius
sfg_aht = ifelse(`$3',,(0.25/4),(`$3')) # arrow height (arrowhead length)
@@ -186,7 +199,7 @@ define(`latexcommand',
`$2')')
define(`m4announceprocessor',`dnl Do not change the format of the next line:
-`#' `$1' Version 10.2: ifelse(m4picprocessor,gpic,`Gpic',
+`#' `$1' Version 10.3: ifelse(m4picprocessor,gpic,`Gpic',
m4postprocessor,pstricks,`PSTricks',
m4postprocessor,pgf,`TikZ PGF',
m4postprocessor,mfpic,`Mfpic',
@@ -680,12 +693,14 @@ define(`hex_digit',`ifelse(eval(`$1'<10),1,`$1',
`vrot_(x,y,ct,st)'
define(`vrot_',
`diff_(prod_($3,$1),prod_($4,$2)),sum_(prod_($4,$1),prod_($3,$2))')
- `rot_(x,y,t)'
+ `rot_(x,y,radians)'
define(`rot_',`vrot_($1,$2,cos($3),sin($3))')
+ `rrot_(x,y,radians)'
+define(`rrot_',`Here+(rot_($1,$2,$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))')
+ `RRot_(X,deg)'
+define(`RRot_',`Here+(Rot_($1,$2))')
Vector scaling: returns a pair
`vscal_(scalefactor,x,y)'
@@ -1264,6 +1279,20 @@ define(`arcdimension_',`arc invis `$1' ; {
to M4ArcC+(rect_(m4hr,m4eang)) rad m4hr with .c at M4ArcC } }
ifelse(`$3',,,`m4lstring(`$3',"`$3'") at M4ArcC+(rect_(m4hr,m4hang))')
}')
+ `polygon(nsides,keys) regular polygon in [] block
+ keys: line=attribs; e.g. dashed shaded "red"
+ rot=expr; angle of first vertex V[0]
+ side|rad=expr; size by radius or side
+ Defined points: C, V[0], ... V[nsides-1]'
+define(`polygon',`[ C: Here; nsides=ifelse(`$1',,3,`$1')
+ a=360/nsides; b=(180-a)/2 # interior angles
+ pushkeys_(`$2',
+ `line::N; rot:90; side:linewid; rad:m4side*sind(b)/sind(a);')dnl
+ for i=0 to nsides-1 do { V[i]: Rect_(m4rad,m4rot+a*i) }
+ V[nsides]: 0.5 between V[nsides-1] and V[0]
+ line m4line from V[nsides] to V[0]; for i=1 to nsides do { continue to V[i] }
+ `$3' popdef(`m4line',`m4rot',`m4side',`m4rad') ]')
+
`shade(gray value,closed line specs)
Fill an arbitray closed curve with a gray value
0=black, 1=white,
@@ -1384,13 +1413,13 @@ define(`gpolyline',`1-(`$1') between `$2' and `$3' \
then to `$1' between `$3' and `$4' ifelse(`$5',,,`\
then to gpolyline(`$1',shift(shift($@)))')')
- `m4fshade(gray value,closed curve) internal'
+ `m4xshade(gray value,closed curve) internal'
ifelse(m4picprocessor,gpic,
`define`m4fshade',`shade(ifelse(`$1',,0,`$1'),`$2')')',
m4postprocessor,xfig,
`define(`m4fshade',``$2' fill ifelse(`$1',,0,`$1')')',
- `define(`m4fshade',``$2' dnl
- ifdef(`r_',`shaded rgbstring(r_,g_,b_)',`fill ifelse(`$1',,0,`$1')')')')
+`define(`m4fshade',``$2' dnl
+ ifdef(`r_',`shaded rgbstring(r_,g_,b_)',`fill ifelse(`$1',,0,`$1')')')')
ifelse(0,1,`
ifelse(m4picprocessor,gpic,
@@ -1460,16 +1489,6 @@ define(`elchop',`chop 0.5 * `$1'.wid * `$1'.ht * sqrt(\
`vlength(x,y) 2-D vector length'
define(`vlength',`sqrt(abs((`$1')^2+(`$2')^2))')
- `distance(Pos1,Pos2)' distance between positions
-define(`distance',
- `vlength(M4Pos(`$1').x-M4Pos(`$2').x,M4Pos(`$1').y-M4Pos(`$2').y)')
-
- `lin_leng(linear object)' calculates length
-define(`lin_leng',`distance(`$1'.start,`$1'.end)')
- `lin_ang(linear object)' calculates angle
-define(`lin_ang',
- `atan2(`$1'.end.y-`$1'.start.y,`$1'.end.x-`$1'.start.x)')
-
`inner_prod(linear obj,linear obj)'
define(`inner_prod',`(sum_(dnl
prod_(`$1'.end.x-`$1'.start.x,`$2'.end.x-`$2'.start.x),dnl
@@ -1522,7 +1541,7 @@ define(`Equidist3',`
`Cintersect(Ctr1,rad1,Ctr2,rad2,[R])
Upper (lower if arg5=R) intersection of
circles at Ctr1 and Ctr2, radius rad1 and rad2
- Supercedes obsolete cintersect which is kept
+ Supersedes obsolete cintersect which is kept
for consistency'
define(`Cintersect',
`define(`m4Cr1',`ifelse(`$2',,circlerad,(`$2'))')dnl
@@ -1589,11 +1608,23 @@ define(`M4LP',`($1-($2))')dnl
define(`M4LET',`LCtangent((M4LP.x/m4LEta,M4LP.y/m4LEtb),`(0,0)',1,`$5')')dnl
(`$2'+(M4LET.x*m4LEta,M4LET.y*m4LEtb))')
- `langle(Start,End)
+ `langle(Start,End,[d])
Angle relative to horizontal of a line
- between two points'
-define(`langle',
-`atan2(M4Pos(`$2').y-M4Pos(`$1').y,M4Pos(`$2').x-M4Pos(`$1').x)')
+ between two points (degrees if arg3=d)'
+define(`langle',`ifelse(`$3',d,`(')dnl
+atan2(M4Pos(`$2').y-M4Pos(`$1').y,M4Pos(`$2').x-M4Pos(`$1').x)dnl
+ifelse(`$3',d,`*rtod_`)'')')
+
+ `distance(Pos1,Pos2)' distance between positions
+define(`distance',
+ `vlength(M4Pos(`$1').x-M4Pos(`$2').x,M4Pos(`$1').y-M4Pos(`$2').y)')
+
+ `lin_leng(linear object)' calculates length
+define(`lin_leng',`distance(`$1'.start,`$1'.end)')
+ `lin_ang(linear object,[d]) calculates angle
+ of object (in degrees if arg2=d)'
+define(`lin_ang',`atan2(`$1'.end.y-`$1'.start.y,`$1'.end.x-`$1'.start.x)dnl
+ifelse(`$2',d,`*rtod_')')
`ArcAngle(Pos1,Pos2,Pos3,
  radius,attributes,label)
diff --git a/graphics/circuit_macros/liblog.m4 b/graphics/circuit_macros/liblog.m4
index 52e2d116b2..67b9a78773 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 10.2, copyright (c) 2023 J. D. Aplevich under *
+* Circuit_macros Version 10.3, copyright (c) 2023 J. D. Aplevich under *
* the LaTeX Project Public Licence in file Licence.txt. The files of *
* this distribution may be redistributed or modified provided that this *
* copyright notice is included and provided that modifications are clearly *
@@ -648,7 +648,7 @@ define(`Demux',`[
`$6']')
###########################################################################
- Autogate allowable functions (plus the ~ operator)
+ AutoGate allowable functions (plus the ~ operator)
define(`And',`_AutoGate(AND,$@)')
define(`Or',`_AutoGate(OR,$@)')
define(`Not',`_AutoGate(NOT,$@)')
@@ -677,31 +677,34 @@ define(`autovsep',`L_unit') # vertical separation between input gates
Draw the gate with input sublayer Sg containing
gates G1, G2, ...
-define(`AutoGate',`[ pushdef(`m4nargs',0)dnl
+define(`AutoGate',`[
lu = L_unit define(`m4dirt',m4_dir_)
dnl Count the arguments (inputs) (could use $# )
+ pushdef(`m4nargs',0)dnl
Loopover_(`arg',`define(`m4nargs',incr(m4nargs))',shift($@))dnl
+ ifinstr(`$2',[,`define(`m4nargs',decr(m4nargs))dnl
+ define(`m4PN',substr(`$2',1,eval(len(`$2')-2)))')
`#' m4Delch(`$1') gate(m4nargs)
# Draw the gate
linethick = gatelineth
ifelse(m4Delch(`$1'),NOT,`Q: NOT_gate()',
m4Delch(`$1'),BUFFER,`Q: BUFFER_gate()',
- `Q: m4Delch($1)_gate(m4nargs)') `#' End Q
+ `Q: m4Delch(`$1')_gate(ifinstr(`$2',[,m4PN,m4nargs))') `#' End Q
linethick = lineth
ifelse(substr(m4Delch(`$1'),0,1),N,
`Out: Q.Out',
`line thick lineth from Q.Out m4dirt N_diam*L_unit; Out: Here')
pushdef(`AutoOutNames',m4Path.Out)
T: ifelse(m4dirt,right,`Q.w-(2*lu,0)',`Q.e+(2*lu,0)')
-# Sublayer Sg containing gates G1, G2,... with
-# output vertical median at the height of Q.c
+# Sublayer Sg containing gates or vars G1, G2,...
+# with output vertical median at the height of Q.c
Sg: [ pushdef(`m4_nct',0)dnl
pushdef(`m4Path',m4Path.Sg)dnl
Loopover_(`arg',
`define(`m4_nct',incr(m4_nct))dnl
-# Variable or a sublayer gate
-# Inputs are labelled In<var>_N or In<var>_X
-# Remove initial white space; detect a name or gate
+dnl Variable or a sublayer gate
+dnl Inputs are labelled In<var>_N or In<var>_X
+dnl Remove initial white space; detect a name or gate
pushdef(`m4Path',m4Path.G`'m4_nct)dnl
m4ifboolvar_(arg,
`G`'m4_nct: [dnl
@@ -711,13 +714,13 @@ dnl Count the arguments (inputs) (could use $# )
In`'m4xg`'_N: Here',
`pushdef(`m4InNames',m4Path.In`'arg`'_X)define(X_`'arg)dnl
In`'arg`'_X: Here ')
- Out: Here ] dnl
- ht ifelse(m4nargs,1,`2*autovsep',`abs(Q.In1.y-Q.In2.y)-autovsep')',
+ Out: Here ] ht \
+ ifelse(m4nargs,1,`2*autovsep',`abs(Q.In1.y-Q.In2.y)-autovsep')',
`pushdef(`AutoOutNames',m4Path.Out)dnl
G`'m4_nct: m4Delch(arg)') ifelse(m4_nct,1,,`ifelse(m4dirt,right, \
`with .ne at last [].se',`with .nw at last [].sw')+(0,-autovsep)')
- popdef(`m4Path') ',
- shift($@))
+ popdef(`m4Path') ',
+ ifinstr(`$2',[,`shift(shift($@))',`shift($@)'))
MidOut: 0.5 between G`'eval((m4_nct+1)/2).Out and G`'eval((m4_nct+2)/2).Out
popdef(`m4_nct')dnl
popdef(`m4Path')dnl
@@ -725,7 +728,7 @@ dnl Count the arguments (inputs) (could use $# )
# Draw the connecting lines
define(`m4hhv',`(m4nargs-1)/2')dnl
ifelse(m4dirt,right,
- `for_(1,m4nargs,1,`line thick lineth from Q.In`'m4x \
+ `for_(1,m4nargs,1,`ifelse(m4x,1,,` ')line thick lineth from Q.In`'m4x \
left Q.In`'m4x.x-T.x+(m4hhv-abs(m4x-m4hhv-1))*lu \
then up Sg.G`'m4x.Out.y-Q.In`'m4x.y \
then to Sg.G`'m4x.Out')',
@@ -753,7 +756,7 @@ ifinstr(`$2',N,
NOT_gate
linethick = lineth
InNt`'$1: Here',
- `line thick lineth from PrevInput ifdef(`m4LI',m4_dir_,down) dimen_/4
+ ` line thick lineth from PrevInput ifdef(`m4LI',m4_dir_,down) dimen_/4
Int`'$1: Here')
m4xpand(m4dirt`'_)
')
@@ -839,23 +842,22 @@ define(`Autologic',
Function tree i is drawn by the `AutoGate' macro.
'
define(`Autologix',
-`[ # Auto logix
+`[ `# Autologix'
dnl Split arg1 into FunctionSpecs
undefine(`m4BooleanR')stacksplit_(`m4BooleanR',`$1',;)dnl
dnl
ifinstr(`$2',L,`define(`m4LI')',`undefine(`m4LI')')dnl
undefine(`m4InNames')undefine(`AutoOutNames')define(`m4Path',)dnl
- define(`m4nbf',0)undefine(`m4BooleanFn')undefine(`m4locattr')dnl
-dnl Separate functions from location attributes
+ define(`m4nbf',0)undefine(`m4BooleanFn')undefine(`m4posattr')dnl
+dnl Separate functions from position attributes
stackexec_(`m4BooleanR',,
`define(`m4nbf',incr(m4nbf))define(`m4xi',regexp(m4BooleanR,[a-zA-Z_~]))dnl
ifinstr(m4BooleanR,@,`define(`m4xc',index(m4BooleanR,@))dnl
pushdef(`m4BooleanFn',substr(m4BooleanR,m4xi,eval(m4xc-m4xi)))dnl
- pushdef(`m4locattr',substr(m4BooleanR,incr(m4xc)))',
+ pushdef(`m4posattr',substr(m4BooleanR,incr(m4xc)))',
`pushdef(`m4BooleanFn',substr(m4BooleanR,m4xi))dnl
- pushdef(`m4locattr')')dnl
+ pushdef(`m4posattr')')dnl
')dnl
-dnl
dnl Sublayer of functions, outputs Out1, Out2,..
pushdef(`m4Path',ifelse(m4Path,,,m4Path.)Fx)
Fx: [ define(`m4fno',0)dnl
@@ -867,18 +869,18 @@ dnl
dnl Simple variable or gate
m4ifboolvar_(m4BooleanFn,
`Tx`'m4fno: [ifelse(substr(m4BooleanFn,0,1),~,
- `define(`m4xg',substr(m4BooleanFn,1))dnl
- pushdef(`m4InNames',m4Path.In`'m4xg`'_N)define(N_`'m4xg)
- In`'m4xg`'_N: Here',
- `pushdef(`m4InNames',m4Path.In`'m4BooleanFn`'_X)dnl
- define(X_`'m4BooleanFn)dnl
- In`'m4BooleanFn`'_X: Here'); Out: Here ] ht 2*autovsep',
- `Tx`'m4fno: m4Delch(m4BooleanFn)') ifelse(m4fno,1,,
- `ifelse(m4locattr,,`with .n`'ifinstr(`$2',M,w,e) \
- at Tx`'eval(m4fno-1).s`'ifinstr(`$2',M,w,e)+(0,-dimen_/4)',
- m4locattr)')dnl
+ `define(`m4xg',substr(m4BooleanFn,1))dnl
+ pushdef(`m4InNames',m4Path.In`'m4xg`'_N)define(N_`'m4xg)
+ In`'m4xg`'_N: Here',
+ `pushdef(`m4InNames',m4Path.In`'m4BooleanFn`'_X)dnl
+ define(X_`'m4BooleanFn)dnl
+ In`'m4BooleanFn`'_X: Here'); Out: Here ] ht 2*autovsep',
+ `Tx`'m4fno: m4Delch(m4BooleanFn)') ifelse(m4posattr,,
+ `ifelse(m4fno,1,,`with .n`'ifinstr(`$2',M,w,e) \
+ at Tx`'eval(m4fno-1).s`'ifinstr(`$2',M,w,e)+(0,-dimen_/4)')',
+ m4posattr) dnl
pushdef(`AutoOutNames',m4Path.Out)dnl
- popdef(`m4locattr') `#' End Tx`'m4fno
+ popdef(`m4posattr') `#' End Tx`'m4fno
popdef(`m4Path')dnl
dnl Functions drawn
dnl Out and Out1, Out2, ...
@@ -933,28 +935,32 @@ PrevInput: ifdef(`m4LI',dnl
stackexec_(`m4r',,`undefine(N_`'m4r)undefine(X_`'m4r)')
dnl
dnl Show the internal inputs in comment lines
-`# Internal input names' (m4nargs):dnl
-stackexec_(`m4InNames',`m4R',`
-`#' m4InNames')
-stackexec_(`m4R',`m4InNames')
+dnl `# Internal input names' (m4nargs):dnl
+dnl stackexec_(`m4InNames',`m4R',`
+dnl `#' m4InNames')
+dnl stackexec_(`m4R',`m4InNames')
dnl
# Promote the In and Out locations to the top level
- define(`m4ix',0)dnl
- stackexec_(`AutoOutNames',,`define(`m4ix',incr(m4ix))
- Out`'m4ix: AutoOutNames')
+`# Internal gate input labels' (m4nargs):dnl
define(`m4ix',0)dnl
stackexec_(`m4InNames',`m4R',`define(`m4ix',incr(m4ix))
In`'m4ix: m4InNames')
stackexec_(`m4R',`m4InNames')
+`# Internal gate output labels (there may be duplicate locations)':dnl
+ define(`m4ix',0)define(`m4lastout')dnl
+ stackexec_(`AutoOutNames',,
+ `ifelse(AutoOutNames,m4lastout,,`define(`m4ix',incr(m4ix))
+ Out`'m4ix: AutoOutNames define(`m4lastout',AutoOutNames)')')
# Connect the gates to the inputs and clean up
ifinstr(`$2',N,,
`m4AutoConnex(Fx,`m4InNames',ifdef(`m4LI',`ifinstr(`$2',V,Top,Bot)',Bot))')
stackexec_(`m4TAL',,
`define(`m4bn',basename_(m4TAL))undefine(Bot`'m4bn)undefine(Top`'m4bn)')
-# Define the inputs
+# Define the outputs
ifelse(m4nbf,1,`Out: Fx.Out')
for_(1,m4nbf,1,`Out`'m4x: Fx.Out`'m4x')
- `$3' ] ')
+ `$3' `# End Autologix'
+ ] ')
define(`m4AutoConnex',`define(`m4cx',0)dnl
define(`m4ltn',`substr(`$2',decr(len(`$2')))')dnl
diff --git a/graphics/circuit_macros/mfpic.m4 b/graphics/circuit_macros/mfpic.m4
index d82447b136..d82cb5ffce 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 10.2, copyright (c) 2023 J. D. Aplevich under *
+* Circuit_macros Version 10.3, copyright (c) 2023 J. D. Aplevich under *
* the LaTeX Project Public Licence in file Licence.txt. The files of *
* this distribution may be redistributed or modified provided that this *
* copyright notice is included and provided that modifications are clearly *
diff --git a/graphics/circuit_macros/mpost.m4 b/graphics/circuit_macros/mpost.m4
index 47a54c6c8d..9cc15dc897 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 10.2, copyright (c) 2023 J. D. Aplevich under *
+* Circuit_macros Version 10.3, copyright (c) 2023 J. D. Aplevich under *
* the LaTeX Project Public Licence in file Licence.txt. The files of *
* this distribution may be redistributed or modified provided that this *
* copyright notice is included and provided that modifications are clearly *
diff --git a/graphics/circuit_macros/pdf.m4 b/graphics/circuit_macros/pdf.m4
index a9f2da0997..30c88f407d 100644
--- a/graphics/circuit_macros/pdf.m4
+++ b/graphics/circuit_macros/pdf.m4
@@ -1,7 +1,7 @@
divert(-1)
pdf.m4 Initialization for pdf output.
-* Circuit_macros Version 10.2, copyright (c) 2023 J. D. Aplevich under *
+* Circuit_macros Version 10.3, copyright (c) 2023 J. D. Aplevich under *
* the LaTeX Project Public Licence in file Licence.txt. The files of *
* this distribution may be redistributed or modified provided that this *
* copyright notice is included and provided that modifications are clearly *
diff --git a/graphics/circuit_macros/pgf.m4 b/graphics/circuit_macros/pgf.m4
index 1f13d582e1..72f109832f 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 10.2, copyright (c) 2023 J. D. Aplevich under *
+* Circuit_macros Version 10.3, copyright (c) 2023 J. D. Aplevich under *
* the LaTeX Project Public Licence in file Licence.txt. The files of *
* this distribution may be redistributed or modified provided that this *
* copyright notice is included and provided that modifications are clearly *
diff --git a/graphics/circuit_macros/postscript.m4 b/graphics/circuit_macros/postscript.m4
index f5d052943d..da7e16ba34 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 10.2, copyright (c) 2023 J. D. Aplevich under *
+* Circuit_macros Version 10.3, copyright (c) 2023 J. D. Aplevich under *
* the LaTeX Project Public Licence in file Licence.txt. The files of *
* this distribution may be redistributed or modified provided that this *
* copyright notice is included and provided that modifications are clearly *
diff --git a/graphics/circuit_macros/psfrag.m4 b/graphics/circuit_macros/psfrag.m4
index 3ab0bf0090..172ed5ce6d 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 10.2, copyright (c) 2023 J. D. Aplevich under *
+* Circuit_macros Version 10.3, copyright (c) 2023 J. D. Aplevich under *
* the LaTeX Project Public Licence in file Licence.txt. The files of *
* this distribution may be redistributed or modified provided that this *
* copyright notice is included and provided that modifications are clearly *
diff --git a/graphics/circuit_macros/pstricks.m4 b/graphics/circuit_macros/pstricks.m4
index 8c16babd1c..f172c6cde3 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 10.2, copyright (c) 2023 J. D. Aplevich under *
+* Circuit_macros Version 10.3, copyright (c) 2023 J. D. Aplevich under *
* the LaTeX Project Public Licence in file Licence.txt. The files of *
* this distribution may be redistributed or modified provided that this *
* copyright notice is included and provided that modifications are clearly *
diff --git a/graphics/circuit_macros/svg.m4 b/graphics/circuit_macros/svg.m4
index 3e2479539b..f08764fd13 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 10.2, copyright (c) 2023 J. D. Aplevich under *
+* Circuit_macros Version 10.3, copyright (c) 2023 J. D. Aplevich under *
* the LaTeX Project Public Licence in file Licence.txt. The files of *
* this distribution may be redistributed or modified provided that this *
* copyright notice is included and provided that modifications are clearly *
diff --git a/graphics/circuit_macros/xfig.m4 b/graphics/circuit_macros/xfig.m4
index 966da643fd..40a94e454c 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 10.2, copyright (c) 2023 J. D. Aplevich under *
+* Circuit_macros Version 10.3, copyright (c) 2023 J. D. Aplevich under *
* the LaTeX Project Public Licence in file Licence.txt. The files of *
* this distribution may be redistributed or modified provided that this *
* copyright notice is included and provided that modifications are clearly *