summaryrefslogtreecommitdiff
path: root/graphics/circuit_macros/liblog.m4
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/circuit_macros/liblog.m4')
-rw-r--r--graphics/circuit_macros/liblog.m453
1 files changed, 19 insertions, 34 deletions
diff --git a/graphics/circuit_macros/liblog.m4 b/graphics/circuit_macros/liblog.m4
index 495ab2ad2b..ce261707ca 100644
--- a/graphics/circuit_macros/liblog.m4
+++ b/graphics/circuit_macros/liblog.m4
@@ -1,7 +1,7 @@
divert(-1)
liblog.m4 Logic gates
-* Circuit_macros Version 9.2, copyright (c) 2020 J. D. Aplevich under *
+* Circuit_macros Version 9.3, copyright (c) 2020 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 *
@@ -52,6 +52,8 @@ define(`Mux_wid',8) `Multiplexer defaults'
define(`Mux_ht',18)
define(`lg_plen',4) `Logic pin'
+define(`lg_pinsep',`(3*L_unit)') `logic pin separation in logic units'
+define(`lg_chipwd',`(18*L_unit)') `default chip width'
define(`lg_pintxt',
`"ifxfig(`$1',`ifsvg(`svg_small(`$1',75)',`sp_{\scriptsize `$1'}sp_')')"')
`Logic pin text with bar where possible'
@@ -485,17 +487,17 @@ define(`NOT_gate',`ifinstr(`$2',B,
`The comprehensive logic pin:
lg_pin(location, label, Picname, n|e|s|w [L|M|I|O][N][E], pinno, optlen)
- label=text indicating logical pin function;
- Picname=pic label for referring to the pin;
- n|e|s|w=orientation;
+ label=text (indicating logical pin function, usually)
+ Picname=pic label for referring to the pin
+ n|e|s|w=orientation (north, east, south, west)
L=active low out; M=active low in; I=inward arrow; O=outward arrow
- N=negated; E=edge trigger'
+ N=negated (NOT-circle); E=edge trigger'
define(`lg_pin',`ifelse(`$1',,,`move to $1')
- define(`dna_',`substr(`$4',1)')define(`m4lE',)define(`m4lN',)dnl
+ define(`dna_',`substr(`$4',1)')define(`m4lE',)define(`m4lch',0)dnl
define(`m4ld',`ifelse(`$4',,e,`substr(`$4',0,1)')')dnl
define(`m4lph',`ifelse(m4ld,n,0,m4ld,w,-1,m4ld,s,0,1)')dnl
define(`m4lpv',`ifelse(m4ld,n,1,m4ld,w,0,m4ld,s,-1,0)')dnl
- define(`m4lpl',`ifelse(`$6',,`lg_plen',`$6')')dnl
+ define(`m4lpl',`ifelse(`$6',,`lg_plen',(`$6')/L_unit)')dnl
sc_draw(`dna_',E,`define(`m4lE',1)dnl
{ line from rsvec_(lp_xy(0,N_rad)) \
to rsvec_(lp_xy(-N_diam*sqrt(3)/2,0)) then to rsvec_(lp_xy(0,-N_rad)) }')
@@ -504,29 +506,22 @@ define(`lg_pin',`ifelse(`$1',,,`move to $1')
m4ld,s,`above_',`rjust_') at Here dnl
ifxfig(`+(lp_xy(-0.72bp__,0))') dnl
ifelse(m4lE,1,`+svec_(lp_xy(-N_diam*sqrt(3)/2,0))') }')
- sc_draw(`dna_',N,`define(`m4lN',N)
+ sc_draw(`dna_',N,`define(`m4lch',N_diam*L_unit)
{ NOT_circle \
at rsvec_(lp_xy(N_rad,0)) }')
- sc_draw(`dna_',L,`define(`m4lN',M)
+ sc_draw(`dna_',L,`define(`m4lch',N_rad*2.5*L_unit)
{line from rsvec_(lp_xy(0,
- ifelse(m4ld,w,-,m4ld,s,-)N_rad*3/2)) to rsvec_(lp_xy(N_rad*2.5,0)) }')
- sc_draw(`dna_',M,`define(`m4lN',M)
+ ifelse(m4ld,w,-,m4ld,s,-)N_rad*3/2)) to rsvec_(lp_xy(N_rad*2.5,0)) \
+ then to Here }')
+ sc_draw(`dna_',M,`define(`m4lch',N_rad*2.5*L_unit)
{ line to rsvec_(lp_xy(N_rad*2.5,
- ifelse(m4ld,w,-,m4ld,s,-)N_rad*3/2)) then to rsvec_(lp_xy(N_rad*2.5,0))}')
- {ifelse(`$3',,,`$3':) line to rsvec_(lp_xy(m4lpl,0))dnl
- ifelse(m4lN,N,`chop N_diam*L_unit chop 0')dnl
+ ifelse(m4ld,w,-,m4ld,s,-)N_rad*3/2)) then to rsvec_(lp_xy(N_rad*2.5,0)) \
+ then to Here}')
+ {ifelse(`$3',,,`$3':) line to rsvec_(lp_xy(m4lpl,0)) chop m4lch chop 0 dnl
ifinstr(dna_,I,` <- wid linethick*5.6bp__ ht linethick*7.2bp__ ')dnl
ifinstr(dna_,O,` -> wid linethick*5.6bp__ ht linethick*7.2bp__ ')
- ifelse(`$5',,,`lg_pintxt(`$5') dnl
- at rsvec_(lp_xy(vscal_(1/(L_unit),1pt__,0))) dnl
- ifgpic(
- `ifelse(m4ld,n,`+svec_(lp_xy(4pt__/(L_unit),0)) rjust_ below_',
- m4ld,w,`+svec_(lp_xy(vscal_(1/(L_unit),1pt__,3pt__))) \
- ljust_ above_',
- m4ld,s,`+svec_(lp_xy(2pt__/(L_unit),0)) rjust_ above_',
- `+svec_(lp_xy(0,-3pt__/(L_unit))) rjust_ above_') ',
- `ifelse(m4ld,n,`rjust_ below_', m4ld,w,`ljust_ above_',
- `rjust_ above_')')') dnl
+ ifelse(`$5',,,`move to last line.c; lg_pintxt(`$5') dnl
+ ifelse(m4ld,n,`rjust_', m4ld,w,`above_',m4ld,e,`above_',`rjust_')')
} ')
define(`lp_xy',`vrot_(`$1',`$2',m4lph,m4lpv)')
@@ -746,16 +741,6 @@ define(`m4ifboolvar_',
define(`m4stackdump',`ifdef(`$1',`ifelse($1,,`popdef(`$1')',
`$2`'popdef(`$1')m4stackdump(`$1',`$2')')')')dnl
-# ****Obsolete `Define positions In1, In2, ... equal to
-# positions stacked in `arg2', prefixed by arg1.
-# If arg3 is not null then In is replaced by arg3.
-# eg H:And(x,y); stackpromote_(H,`AutoInNames',In_)'
-#define(`stackpromote_',`define(`m4nct',0)
-#`#' Promoting stack `$2':
-#stackexec_(`$2',`m4R_',`ifelse($2,,,`define(`m4nct',incr(m4nct))
-#ifelse(`$3',,In,$3)`'m4nct: ifelse(`$1',,,$1.)$2')')
-#stackexec_(`m4R_',`$2')')
-
define(`DrawIn',`
# Draw and label input $1
PrevInput: PrevInput-ifdef(`m4LI',`(0,autoinputsep)',