summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r--Master/texmf-dist/metapost/drv/drv.mp491
1 files changed, 229 insertions, 262 deletions
diff --git a/Master/texmf-dist/metapost/drv/drv.mp b/Master/texmf-dist/metapost/drv/drv.mp
index 5eb38396144..69f2f9f72c7 100644
--- a/Master/texmf-dist/metapost/drv/drv.mp
+++ b/Master/texmf-dist/metapost/drv/drv.mp
@@ -1,4 +1,4 @@
-%% drv.mp 0.93
+%% drv.mp 0.94
%% Copyright 2009 Laurent M\'ehats
%
% This work may be distributed and/or modified under the
@@ -188,10 +188,10 @@
%
% drv_left_delimiter <str>
% <str> left delimiter math-mode LaTeX code
-% "(" $($
-% "[" $[$
-% "\lbrace" $\lbrace$
-% "\langle" $\langle$
+% "("
+% "["
+% "\lbrace"
+% "\langle"
% etc.
%
% drv_right_delimiter <str>
@@ -391,8 +391,8 @@ drv_message "done.";
% writing LaTeX picture definitions
%
-numeric tex_pct_idx;
-tex_pct_idx:=0;
+numeric tex_pct_rnk;
+tex_pct_rnk:=0;
% Math style indices: 0, 1, 2, 3
string mth_sty_str[];
@@ -410,14 +410,14 @@ vardef drv_tex[] expr tex_str=
string def_str;
picture pct;
def_str:="btex{"&drv_fontsize&"$"&mth_sty_str[@]&"{}"&tex_str&"{}$}etex;";
- write "tex_pct["&(decimal tex_pct_idx)&"]:="&def_str to delayed_tex_file;
+ write "tex_pct["&(decimal tex_pct_rnk)&"]:="&def_str to delayed_tex_file;
pct:=
- if known tex_pct[tex_pct_idx]:
- tex_pct[tex_pct_idx]
+ if known tex_pct[tex_pct_rnk]:
+ tex_pct[tex_pct_rnk]
else:
nullpicture
fi;
- tex_pct_idx:=tex_pct_idx+1;
+ tex_pct_rnk:=tex_pct_rnk+1;
pct
enddef;
@@ -644,31 +644,31 @@ vardef drv_beginfig=
numeric iln_sty[];
numeric l_prm[], r_prm[];
%
- % imin_x[i] inference minimal x
- % l_dlb[i] left delimiter label drv-box
- % l_dlm[i] left delimiter drv-box
- % l_ilb[i] left label drv-box
- % iln[i] inference line drv-box
- % r_ilb[i] right label drv-box
- % r_dlm[i] right delimiter drv-box
- % r_dlb[i] right delimiter label drv-box
- % imax_x[i] inference maximal x
+ % nfr_min_x[i] inference minimal x
+ % l_dlb[i] left delimiter label drv-box
+ % l_dlm[i] left delimiter drv-box
+ % l_ilb[i] left label drv-box
+ % iln[i] inference line drv-box
+ % r_ilb[i] right label drv-box
+ % r_dlm[i] right delimiter drv-box
+ % r_dlb[i] right delimiter label drv-box
+ % nfr_max_x[i] inference maximal x
%
- numeric imin_x[];
+ numeric nfr_min_x[];
drv_box "l_dlb[]", "l_dlm[]", "l_ilb[]";
drv_box "iln[]";
drv_box "r_ilb[]", "r_dlm[]", "r_dlb[]";
- numeric imax_x[];
+ numeric nfr_max_x[];
%
% Sub-trees
%
- % smin_x[i] sub-tree minimal x
- % smax_x[i] sub-tree maximal x
- % smin_y[i] sub-tree minimal y
- % smax_y[i] sub-tree maximal y
- % boxed[i] boolean
+ % sub_min_x[i] sub-tree minimal x
+ % sub_max_x[i] sub-tree maximal x
+ % sub_min_y[i] sub-tree minimal y
+ % sub_max_y[i] sub-tree maximal y
+ % boxed[i] boolean
%
- numeric smin_x[], smax_x[], smin_y[], smax_y[];
+ numeric sub_min_x[], sub_max_x[], sub_min_y[], sub_max_y[];
boolean boxed[];
%
% Pen initialization
@@ -694,14 +694,13 @@ vardef drv_beginfig=
%
% root_num number of roots
% root[i] root index (i ranges from 0 to root_num-1)
- % drv_built boolean
+ % drv_checked boolean
% drv_frozen boolean
%
numeric root_num, root[];
- boolean drv_checked, drv_built, drv_frozen;
+ boolean drv_checked, drv_frozen;
root_num:=0;
drv_checked:=false;
- drv_built:=false;
drv_frozen:=false;
%
% Phantom steps
@@ -819,27 +818,19 @@ vardef jgm[] text SUB=
jdg_wd:=0;
sbj_rnk:=0;
for sub=SUB:
- sbj_pct:=
- if picture sub:
- sub
- elseif sub<>"":
- mth_tex[jdg_sty[drv_sty]] sub
- else:
- nullpicture
- fi;
+ sbj_pct:=mth_tex[jdg_sty[drv_sty]] sub;
box_init sbj[@][sbj_rnk] (sbj_pct);
- if sbj_rnk>0:
- sbj[@][sbj_rnk-1].r=sbj[@][sbj_rnk].l;
+ if sbj_rnk>0: % non mandatory test
+ sbj[@][sbj_rnk-1].r=sbj[@][sbj_rnk].l; % irrelevant if rnk=0
fi
addto jdg_pct also sbj_pct shifted (jdg_wd, 0);
- jdg_wd:=width jdg_pct;
+ jdg_wd:=jdg_wd+width sbj_pct;
sbj_rnk:=sbj_rnk+1;
endfor
sbj_num[@]:=sbj_rnk;
box_init jdg[@] (jdg_pct);
- if sbj_num[@]>0:
- jdg[@].l=sbj[@][0].l;
- jdg[@].r=sbj[@][sbj_num[@]-1].r;
+ if sbj_num[@]>0: % non mandatory test
+ jdg[@].l=sbj[@][0].l; % irrelevant if sbj_num=0
fi
fi
enddef;
@@ -850,6 +841,19 @@ enddef;
% Inference declarations
%
+%
+% 1. Global parameters
+%
+
+numeric drv_jct_sty; % default junction style
+string drv_alg_sty; % default junction style
+numeric drv_iln_sty; % default inference line path-style
+numeric drv_phm_sty; % default phantom steps path-style
+
+%
+% 2. Macros
+%
+
vardef check_junction_style (suffix sty_sfx) (expr default)=
save sty_str;
string sty_str;
@@ -931,13 +935,9 @@ vardef check_path_style (suffix sty_sfx) (expr default)=
fi
enddef;
-vardef opt_init[] @# expr arg=
- if picture arg:
- if arg<>nullpicture:
- box_init @# (arg);
- fi
- elseif arg<>"":
- box_init @# (mth_tex[@] arg);
+vardef opt_init[] @# expr str=
+ if str<>"":
+ box_init @# (mth_tex[@] str);
fi
enddef;
@@ -971,17 +971,17 @@ vardef NFR[] (text PRM) (expr lilb, rilb, ldlb, rdlb)
%
% roots list update
%
- save root_idx;
- numeric root_idx;
- root_idx:=0;
+ save root_rnk;
+ numeric root_rnk;
+ root_rnk:=0;
forever:
- exitif root[root_idx]=prm_idx;
- root_idx:=root_idx+1;
+ exitif root[root_rnk]=prm_idx;
+ root_rnk:=root_rnk+1;
endfor
forever:
- exitif root_idx=root_num-1;
- root[root_idx]:=root[root_idx+1];
- root_idx:=root_idx+1;
+ exitif root_rnk=root_num-1;
+ root[root_rnk]:=root[root_rnk+1];
+ root_rnk:=root_rnk+1;
endfor
root_num:=root_num-1;
fi
@@ -1033,9 +1033,6 @@ vardef NFR[] (text PRM) (expr lilb, rilb, ldlb, rdlb)
jct_sty[@]:=check_junction_style (j_sty, drv_jct_sty);
alg_sty[@]:=check_alignment_style (a_sty, drv_alg_sty);
iln_sty[@]:=check_path_style (i_sty, drv_iln_sty);
- if drv_boxmode_on:
- boxed[@]:=true;
- fi
fi
enddef;
@@ -1051,23 +1048,23 @@ vardef MVD[] (expr inf_num, lplb, rplb) (suffix a_sty, p_sty)=
drv_errmessage (decimal inf_num)&" is not a valid number of inference"&
" steps";
else:
- save aux_idx, aux_sty, phm_jdg;
- numeric aux_idx, aux_sty;
+ save prm_idx, pth_sty, phm_jdg;
+ numeric prm_idx, pth_sty;
picture phm_jdg;
- aux_sty:=check_path_style (p_sty, drv_phm_sty);
+ pth_sty:=check_path_style (p_sty, drv_phm_sty);
phm_jdg:=nullpicture;
- setbounds phm_jdg to (0, 0)--(iln_hg[aux_sty]-iln_dp[aux_sty], 0)--cycle;
- aux_idx:=@;
+ setbounds phm_jdg to (0, 0)--(iln_hg[pth_sty]-iln_dp[pth_sty], 0)--cycle;
+ prm_idx:=@;
for i=1 upto inf_num:
phm_idx:=phm_idx-1;
box_init jdg[phm_idx] (phm_jdg);
sbj_num[phm_idx]:=0;
- NFR[phm_idx] (aux_idx) ("", "", "", "", 0, a_sty, 0);
- aux_idx:=phm_idx;
+ NFR[phm_idx] (prm_idx) ("", "", "", "", 0, a_sty, 0);
+ prm_idx:=phm_idx;
endfor
src[@]:=phm_idx;
tgt[phm_idx]:=@;
- phm_sty[phm_idx]:=aux_sty;
+ phm_sty[phm_idx]:=pth_sty;
%
% lplb, rplb: phantom steps labels
%
@@ -1086,33 +1083,20 @@ enddef;
% Optional labels & shorthands
%
-numeric drv_jct_sty; % default junction style
-string drv_alg_sty; % default junction style
-numeric drv_iln_sty; % default inference line path-style
-numeric drv_phm_sty; % default phantom steps path-style
-
boolean drv_left_ilb; % inference labels on the left
boolean drv_left_dlb; % delimiter labels (hence delimiters) on the left
boolean drv_left_plb; % phantom steps labels on the left
-vardef arg_type expr arg=
- if picture arg:
- "picture"
- else:
- "string"
- fi
-enddef;
-
vardef opt_lbls @# (text LBL) expr left_lbls=
save lbl_num, fst_lbl, snd_lbl;
numeric lbl_num;
lbl_num:=0;
for lbl=LBL:
if lbl_num=0:
- scantokens (arg_type lbl) fst_lbl;
+ string fst_lbl;
fst_lbl:=lbl;
elseif lbl_num=1:
- scantokens (arg_type lbl) snd_lbl;
+ string snd_lbl;
snd_lbl:=lbl;
else:
drv_errhelp "At most two labels can be specified:"&
@@ -1121,26 +1105,20 @@ vardef opt_lbls @# (text LBL) expr left_lbls=
fi
lbl_num:=lbl_num+1;
endfor
+ string @#.l;
+ string @#.r;
if lbl_num=0:
- string @#.l;
- string @#.r;
@#.l:="";
@#.r:="";
elseif lbl_num=1:
if left_lbls:
- scantokens (arg_type fst_lbl) @#.l;
- string @#.r;
@#.l:=fst_lbl;
@#.r:="";
else:
- string @#.l;
- scantokens (arg_type fst_lbl) @#.r;
@#.l:="";
@#.r:=fst_lbl;
fi
else:
- scantokens (arg_type fst_lbl) @#.l;
- scantokens (arg_type snd_lbl) @#.r;
@#.l:=fst_lbl;
@#.r:=snd_lbl;
fi
@@ -1339,8 +1317,8 @@ enddef;
% 1. Global parameters
%
-string drv_l_dlm; % left delimiter LaTeX code
-string drv_r_dlm; % right delimiter LaTeX code
+string drv_ldlm_str; % left delimiter LaTeX code
+string drv_rdlm_str; % right delimiter LaTeX code
%
% 2. Macros
@@ -1352,16 +1330,16 @@ vardef minmax_y[]=(
ypart jdg[@].c-num_hg+iln_hg[(iln_sty[ccl[@]])]
+min_clr_scl*min_clr[drv_sty]/2
else:
- smin_y[@]-min_clr_scl*min_clr[drv_sty]
+ sub_min_y[@]-min_clr_scl*min_clr[drv_sty]
fi,
- smax_y[@]+min_clr_scl*min_clr[drv_sty]
+ sub_max_y[@]+min_clr_scl*min_clr[drv_sty]
else:
- smin_y[@]-min_clr_scl*min_clr[drv_sty],
+ sub_min_y[@]-min_clr_scl*min_clr[drv_sty],
if known ccl[@]:
- ypart jdg[@].c-den_dp-iln_hg[(iln_sty[ccl[@]])]
+ ypart jdg[@].c-den_dp+iln_dp[(iln_sty[ccl[@]])]
-min_clr_scl*min_clr[drv_sty]/2
else:
- smax_y[@]+min_clr_scl*min_clr[drv_sty]
+ sub_max_y[@]+min_clr_scl*min_clr[drv_sty]
fi
fi)
enddef;
@@ -1374,9 +1352,9 @@ vardef delim @# expr dlm_len=
rule_str:="\rule{0bp}{"&(decimal(dlm_len/2+axis_hg[drv_sty]))&"bp}";
dlm_str:=
if str @#="l":
- "\left"&drv_l_dlm&rule_str&"\right."
+ "\left"&drv_ldlm_str&rule_str&"\right."
else:
- "\left."&rule_str&"\right"&drv_r_dlm
+ "\left."&rule_str&"\right"&drv_rdlm_str
fi;
dlm_pct:=mth_tex[drv_sty] dlm_str;
dlm_dp:=depth dlm_pct;
@@ -1472,7 +1450,7 @@ vardef drv_check_root[]=
fi
fi
if unknown boxed[@]:
- boxed[@]:=false;
+ boxed[@]:=drv_boxmode_on;
fi
fi
enddef;
@@ -1490,8 +1468,8 @@ vardef drv_check=
save root_str;
string root_str;
root_str:=decimal root_idx;
- for idx=1 upto root_num-1:
- root_idx:=root[idx];
+ for root_rnk=1 upto root_num-1:
+ root_idx:=root[root_rnk];
drv_check_root[root_idx];
root_str:=root_str&", "&(decimal root_idx);
endfor
@@ -1507,70 +1485,96 @@ enddef;
vardef drv_build_root[]=
%
+ % orientation
+ %
+ if drv_bot_roots:
+ ypart iln[@].c=ypart jdg[@].c-den_dp;
+ sub_min_y[@]:=ypart jdg[@].c+jdg[@].dp;
+ sub_max_y[@]:=
+ if iln_sty[@]=0:
+ ypart jdg[@].c+jdg[@].hg
+ else:
+ ypart iln[@].c+iln_hg[iln_sty[@]]
+ fi;
+ for prm_rnk=0 upto prm_num[@]-1:
+ ypart jdg[prm[@][prm_rnk]].c=ypart iln[@].c+num_hg;
+ drv_build_root[prm[@][prm_rnk]];
+ sub_max_y[@]:=max(sub_max_y[@], sub_max_y[prm[@][prm_rnk]]);
+ endfor
+ else:
+ ypart iln[@].c=ypart jdg[@].c-num_hg;
+ sub_min_y[@]:=
+ if iln_sty[@]=0:
+ ypart jdg[@].c+jdg[@].dp
+ else:
+ ypart iln[@].c+iln_dp[iln_sty[@]]
+ fi;
+ sub_max_y[@]:=ypart jdg[@].c+jdg[@].hg;
+ for prm_rnk=0 upto prm_num[@]-1:
+ ypart jdg[prm[@][prm_rnk]].c=ypart iln[@].c+den_dp;
+ drv_build_root[prm[@][prm_rnk]];
+ sub_min_y[@]:=min(sub_min_y[@], sub_min_y[prm[@][prm_rnk]]);
+ endfor
+ fi
+ %
% premises junction (from left to right)
%
- for prm_rnk=0 upto prm_num[@]-1:
- drv_build_root[prm[@][prm_rnk]];
- if prm_rnk>0:
- save ll_idx, lr_idx, rl_idx, rr_idx;
- save lmax_x, rmin_x, min_skp;
- numeric ll_idx, lr_idx, rl_idx, rr_idx;
- numeric lmax_x, rmin_x, min_skp;
- ypart jdg[prm[@][prm_rnk-1]].c=ypart jdg[prm[@][prm_rnk]].c;
- ll_idx:=prm[@][0];
- lr_idx:=prm[@][prm_rnk-1];
- rl_idx:=prm[@][prm_rnk];
- rr_idx:=prm[@][prm_rnk];
- lmax_x:=imax_x[lr_idx];
- rmin_x:=imin_x[rl_idx];
- min_skp[0]:=rmin_x-lmax_x;
- forever:
- exitif (unknown r_prm[lr_idx]) or (unknown l_prm[rl_idx]);
- ll_idx:=l_prm[ll_idx];
- lr_idx:=r_prm[lr_idx];
- rl_idx:=l_prm[rl_idx];
- rr_idx:=r_prm[rr_idx];
- lmax_x:=max(lmax_x, imax_x[lr_idx]);
- rmin_x:=min(rmin_x, imin_x[rl_idx]);
- min_skp[0]:=min(min_skp[0], imin_x[rl_idx]-imax_x[lr_idx]);
- endfor
- min_skp[1]:=rmin_x-lmax_x;
- if known r_prm[lr_idx]:
- r_prm[rr_idx]:= r_prm[lr_idx];
- lmax_x:=smax_x[lr_idx];
- elseif known l_prm[rl_idx]:
- l_prm[ll_idx]:=l_prm[rl_idx];
- rmin_x:=smin_x[rl_idx];
- fi
- min_skp[2]:=rmin_x-lmax_x;
- if jct_sty[@]<3:
- min_skp[jct_sty[@]]=prm_skp_scl*prm_skp[drv_sty];
- fi
+ for prm_rnk=1 upto prm_num[@]-1:
+ save l_lmost, l_rmost, r_lmost, r_rmost;
+ save l_max_x, r_min_x, min_skp;
+ numeric l_lmost, l_rmost, r_lmost, r_rmost;
+ numeric l_max_x, r_min_x, min_skp[];
+ l_lmost:=prm[@][0];
+ l_rmost:=prm[@][prm_rnk-1];
+ r_lmost:=prm[@][prm_rnk];
+ r_rmost:=prm[@][prm_rnk];
+ l_max_x:=nfr_max_x[l_rmost];
+ r_min_x:=nfr_min_x[r_lmost];
+ min_skp[0]:=r_min_x-l_max_x;
+ forever:
+ exitif (unknown r_prm[l_rmost]) or (unknown l_prm[r_lmost]);
+ l_lmost:=l_prm[l_lmost];
+ l_rmost:=r_prm[l_rmost];
+ r_lmost:=l_prm[r_lmost];
+ r_rmost:=r_prm[r_rmost];
+ l_max_x:=max(l_max_x, nfr_max_x[l_rmost]);
+ r_min_x:=min(r_min_x, nfr_min_x[r_lmost]);
+ min_skp[0]:=min(min_skp[0], nfr_min_x[r_lmost]-nfr_max_x[l_rmost]);
+ endfor
+ min_skp[1]:=r_min_x-l_max_x;
+ if known r_prm[l_rmost]:
+ r_prm[r_rmost]:= r_prm[l_rmost];
+ l_max_x:=sub_max_x[l_rmost];
+ elseif known l_prm[r_lmost]:
+ l_prm[l_lmost]:=l_prm[r_lmost];
+ r_min_x:=sub_min_x[r_lmost];
+ fi
+ min_skp[2]:=r_min_x-l_max_x;
+ if jct_sty[@]<3:
+ min_skp[jct_sty[@]]=prm_skp_scl*prm_skp[drv_sty];
fi
endfor
- if prm_num[@]>0:
- l_prm[@]:=prm[@][0];
- r_prm[@]:=prm[@][prm_num[@]-1];
- fi
%
% judgment alignment
%
if prm_num[@]=0:
- imin_x[@]:=xpart jdg[@].l-jdg_skp_scl*jdg_skp[jdg_sty[drv_sty]];
- imax_x[@]:=xpart jdg[@].r+jdg_skp_scl*jdg_skp[jdg_sty[drv_sty]];
+ nfr_min_x[@]:=xpart jdg[@].l;
+ nfr_max_x[@]:=xpart jdg[@].r;
else:
+ l_prm[@]:=prm[@][0];
+ r_prm[@]:=prm[@][prm_num[@]-1];
save l_xref, r_xref;
l_xref=
- if boxed[prm[@][0]]:
- smin_x[prm[@][0]]
+ if boxed[l_prm[@]]:
+ sub_min_x[l_prm[@]]
else:
- xpart jdg[prm[@][0]].l
+ xpart jdg[l_prm[@]].l
fi;
r_xref=
- if boxed[prm[@][prm_num[@]-1]]:
- smax_x[prm[@][prm_num[@]-1]]
+ if boxed[r_prm[@]]:
+ sub_max_x[r_prm[@]]
else:
- xpart jdg[prm[@][prm_num[@]-1]].r
+ xpart jdg[r_prm[@]].r
fi;
if alg_sty[@]="l":
xpart jdg[@].l=l_xref;
@@ -1579,10 +1583,8 @@ vardef drv_build_root[]=
elseif alg_sty[@]="r":
xpart jdg[@].r=r_xref;
fi
- imin_x[@]:=min(xpart jdg[@].l, l_xref)
- -jdg_skp_scl*jdg_skp[jdg_sty[drv_sty]];
- imax_x[@]:=max(xpart jdg[@].r, r_xref)
- +jdg_skp_scl*jdg_skp[jdg_sty[drv_sty]];
+ nfr_min_x[@]:=min(xpart jdg[@].l, l_xref);
+ nfr_max_x[@]:=max(xpart jdg[@].r, r_xref);
fi
%
% inference line
@@ -1590,7 +1592,7 @@ vardef drv_build_root[]=
save iln_wd, iln_pct;
numeric iln_wd;
picture iln_pct;
- iln_wd:=imax_x[@]-imin_x[@];
+ iln_wd:=nfr_max_x[@]-nfr_min_x[@]+2*jdg_skp_scl*jdg_skp[jdg_sty[drv_sty]];
iln_pct:=((0, 0)--(iln_wd, 0)) drv_styled iln_sty[@];
setbounds iln_pct to
(0, ypart llcorner iln_pct)
@@ -1599,65 +1601,33 @@ vardef drv_build_root[]=
--(iln_wd, ypart llcorner iln_pct)
--cycle; % ! `linecap:=butt' and `linecap:=squared' -> same bounding box !
box_init iln[@] (iln_pct);
- xpart iln[@].c=(imin_x[@]+imax_x[@])/2;
- %
- % orientation, smin_y & smax_y
- %
- if drv_bot_roots:
- ypart iln[@].c=ypart jdg[@].c-den_dp;
- smin_y[@]:=ypart jdg[@].c+jdg[@].dp;
- smax_y[@]:=
- if iln_sty[@]=0:
- ypart jdg[@].c+jdg[@].hg
- else:
- ypart iln[@].c+iln[@].hg
- fi;
- if prm_num[@]>0:
- ypart iln[@].c=ypart jdg[prm[@][0]].c-num_hg;
- for prm_rnk=0 upto prm_num[@]-1:
- smax_y[@]:=max(smax_y[@], smax_y[prm[@][prm_rnk]]);
- endfor;
- fi
- else:
- ypart iln[@].c=ypart jdg[@].c-num_hg;
- smin_y[@]:=
- if iln_sty[@]=0:
- ypart jdg[@].c+jdg[@].dp
- else:
- ypart iln[@].c+iln[@].dp
- fi;
- smax_y[@]:=ypart jdg[@].c+jdg[@].hg;
- if prm_num[@]>0:
- ypart iln[@].c=ypart jdg[prm[@][0]].c-den_dp;
- for prm_rnk=0 upto prm_num[@]-1:
- smin_y[@]:=min(smin_y[@], smin_y[prm[@][prm_rnk]]);
- endfor;
- fi
+ xpart iln[@].c=(nfr_min_x[@]+nfr_max_x[@])/2;
+ if iln_sty[@]>0:
+ nfr_min_x[@]:=xpart iln[@].l;
+ nfr_max_x[@]:=xpart iln[@].r;
fi
%
% inference labels
%
if known l_ilb[@]:
l_ilb[@].r=iln[@].l shifted (-ilb_skp_scl*ilb_skp[drv_sty], 0);
- imin_x[@]:=xpart l_ilb[@].l;
- smin_y[@]:=min(smin_y[@], ypart l_ilb[@].c+l_ilb[@].dp);
- smax_y[@]:=max(smax_y[@], ypart l_ilb[@].c+l_ilb[@].hg);
+ nfr_min_x[@]:=xpart l_ilb[@].l;
+ sub_min_y[@]:=min(sub_min_y[@], ypart l_ilb[@].c+l_ilb[@].dp);
+ sub_max_y[@]:=max(sub_max_y[@], ypart l_ilb[@].c+l_ilb[@].hg);
fi
if known r_ilb[@]:
r_ilb[@].l=iln[@].r shifted (ilb_skp_scl*ilb_skp[drv_sty], 0);
- imax_x[@]:=xpart r_ilb[@].r;
- smin_y[@]:=min(smin_y[@], ypart r_ilb[@].c+r_ilb[@].dp);
- smax_y[@]:=max(smax_y[@], ypart r_ilb[@].c+r_ilb[@].hg);
+ nfr_max_x[@]:=xpart r_ilb[@].r;
+ sub_min_y[@]:=min(sub_min_y[@], ypart r_ilb[@].c+r_ilb[@].dp);
+ sub_max_y[@]:=max(sub_max_y[@], ypart r_ilb[@].c+r_ilb[@].hg);
fi
%
% phantom steps
%
if known tgt[@]:
- save phm_pth, phm_pct;
- path phm_pth;
+ save bot_y, top_y, phm_pct;
+ numeric bot_y, top_y;
picture phm_pct;
- save top_y, mid_y, bot_y;
- numeric top_y, bot_y;
if drv_bot_roots:
bot_y:=xpart minmax_y[@]+min_clr_scl*min_clr[drv_sty]/2;
top_y:=xpart minmax_y[tgt[@]];
@@ -1665,85 +1635,78 @@ vardef drv_build_root[]=
bot_y:=ypart minmax_y[tgt[@]];
top_y:=ypart minmax_y[@]-min_clr_scl*min_clr[drv_sty]/2;
fi
- mid_y:=(top_y+bot_y)/2;
- phm_pth:=(0, (bot_y-top_y)/2)--(0, (top_y-bot_y)/2);
- phm_pct:=phm_pth drv_styled phm_sty[@];
+ phm_pct:=((0, (bot_y-top_y)/2)--(0, (top_y-bot_y)/2))
+ drv_styled phm_sty[@];
box_init phm[@] (phm_pct shifted ((width phm_pct)/2, 0));
- phm[@].c=(xpart jdg[@].c, mid_y);
- imin_x[@]:=min(imin_x[@], xpart phm[@].l);
- imax_x[@]:=max(imax_x[@], xpart phm[@].r);
+ phm[@].c=(xpart jdg[@].c, (top_y+bot_y)/2);
+ nfr_min_x[@]:=min(nfr_min_x[@], xpart phm[@].l);
+ nfr_max_x[@]:=max(nfr_max_x[@], xpart phm[@].r);
%
% phantom steps labels
%
if known l_plb[@]:
l_plb[@].r=phm[@].l shifted (-plb_skp[drv_sty], 0);
- imin_x[@]:=min(imin_x[@], xpart l_plb[@].l);
+ nfr_min_x[@]:=min(nfr_min_x[@], xpart l_plb[@].l);
fi
if known r_plb[@]:
r_plb[@].l=phm[@].r shifted ( plb_skp[drv_sty], 0);
- imax_x[@]:=max(imax_x[@], xpart r_plb[@].r);
+ nfr_max_x[@]:=max(nfr_max_x[@], xpart r_plb[@].r);
fi
fi
%
- % smin_x & smax_x
+ % sub_min_x & sub_max_x
%
- smin_x[@]:=imin_x[@];
- smax_x[@]:=imax_x[@];
+ sub_min_x[@]:=nfr_min_x[@];
+ sub_max_x[@]:=nfr_max_x[@];
for prm_rnk=0 upto prm_num[@]-1:
- smin_x[@]:=min(smin_x[@], smin_x[prm[@][prm_rnk]]);
- smax_x[@]:=max(smax_x[@], smax_x[prm[@][prm_rnk]]);
+ sub_min_x[@]:=min(sub_min_x[@], sub_min_x[prm[@][prm_rnk]]);
+ sub_max_x[@]:=max(sub_max_x[@], sub_max_x[prm[@][prm_rnk]]);
endfor
%
% delimiters
%
if known l_dlb[@] or known r_dlb[@]:
- save idx, mmy, min_y, max_y;
- numeric idx, min_y, max_y;
+ save mmy, min_y, max_y;
+ numeric min_y, max_y;
pair mmy;
mmy:=minmax_y[@];
min_y:=xpart mmy;
max_y:=ypart mmy;
if known l_dlb[@]:
box_init l_dlm[@] (delim l (max_y-min_y));
- l_dlm[@].r=(smin_x[@], (max_y+min_y)/2);
+ l_dlm[@].r=(sub_min_x[@], (max_y+min_y)/2);
l_dlb[@].r=l_dlm[@].l;
- smin_x[@]:=xpart l_dlb[@].l;
+ sub_min_x[@]:=xpart l_dlb[@].l;
fi
if known r_dlb[@]:
box_init r_dlm[@] (delim r (max_y-min_y));
- r_dlm[@].l=(smax_x[@], (max_y+min_y)/2);
+ r_dlm[@].l=(sub_max_x[@], (max_y+min_y)/2);
r_dlb[@].l=r_dlm[@].r;
- smax_x[@]:=xpart r_dlb[@].r;
+ sub_max_x[@]:=xpart r_dlb[@].r;
fi
fi
if (known l_dlb[@]) or boxed[@]:
+ save idx;
+ numeric idx;
idx:=@;
forever:
- imin_x[idx]:=smin_x[@];
+ nfr_min_x[idx]:=sub_min_x[@];
exitif unknown l_prm[idx];
idx:=l_prm[idx];
endfor
fi
if (known r_dlb[@]) or boxed[@]:
+ save idx;
+ numeric idx;
idx:=@;
forever:
- imax_x[idx]:=smax_x[@];
+ nfr_max_x[idx]:=sub_max_x[@];
exitif unknown r_prm[idx];
idx:=r_prm[idx];
endfor
fi
enddef;
-vardef drv_build=
- if not drv_checked:
- drv_check;
- fi
- for idx=0 upto root_num-1:
- drv_build_root[root[idx]];
- endfor
- drv_built:=true;
-enddef;
-
%
% Freezing
%
@@ -1766,28 +1729,31 @@ vardef drv_freeze_root[]=
enddef;
vardef drv_freeze=
- if not drv_built:
- drv_build;
+ if not drv_checked:
+ drv_check;
fi
save root_idx;
numeric root_idx;
- root_idx:=root[0];
- if unknown iln[root_idx].c:
- %
- % default math axis
- %
- if drv_axis_ref="iln":
- iln[root_idx].c=(0, axis_hg[drv_sty]);
- else: % drv_axis_ref="jdg"
- jdg[root_idx].c=(0, axis_hg[drv_sty]);
+ for root_rnk=0 upto root_num-1:
+ root_idx:=root[root_rnk];
+ drv_build_root[root_idx];
+ if unknown xpart jdg[root_idx].c:
+ if root_rnk=0:
+ xpart jdg[root_idx].c=0;
+ else:
+ sub_min_x[root_idx]=sub_max_x[root[root_rnk-1]]
+ +prm_skp_scl*prm_skp[drv_sty];
+ fi
fi
- drv_freeze_root[root_idx];
- fi
- for idx=1 upto root_num-1:
- root_idx:=root[idx];
- if unknown iln[root_idx].c:
- smin_x[root_idx]=smax_x[root[idx-1]]+prm_skp_scl*prm_skp[drv_sty];
- ypart iln[root_idx].c=ypart iln[root[idx-1]].c;
+ if unknown ypart jdg[root_idx].c:
+ %
+ % default math axis
+ %
+ if drv_axis_ref="iln":
+ ypart iln[root_idx].c=axis_hg[drv_sty];
+ else: % drv_axis_ref="jdg"
+ ypart jdg[root_idx].c=axis_hg[drv_sty];
+ fi
fi
drv_freeze_root[root_idx];
endfor
@@ -1892,12 +1858,12 @@ vardef drv_tree=
if not drv_frozen:
drv_freeze;
fi
- for root_idx=0 upto root_num-1:
+ for root_rnk=0 upto root_num-1:
if drv_proofmode_on:
- drv_tree_addto pct (root[root_idx]) withcolor prf_clr;
- prf_tree_addto pct (root[root_idx]);
+ drv_tree_addto pct (root[root_rnk]) withcolor prf_clr;
+ prf_tree_addto pct (root[root_rnk]);
else:
- drv_tree_addto pct (root[root_idx]);
+ drv_tree_addto pct (root[root_rnk]);
fi
endfor
pct
@@ -1914,13 +1880,13 @@ vardef drv_bbox[]=
if known l_dlm[@].r:
xpart l_dlm[@].r
else:
- smin_x[@]
+ sub_min_x[@]
fi-jdg_skp_scl*jdg_skp[jdg_sty[drv_sty]];
max_x:=
if known r_dlm[@].l:
xpart l_dlm[@].l
else:
- smax_x[@]
+ sub_max_x[@]
fi+jdg_skp_scl*jdg_skp[jdg_sty[drv_sty]];
mmy:=minmax_y[@];
min_y:=xpart mmy;
@@ -2158,7 +2124,8 @@ vardef drv_axis_reference suffix ref_sfx=
string ref_str;
ref_str:=str ref_sfx;
if (ref_str<>"iln") and (ref_str<>"jdg"):
- drv_errhelp "Valid identifiers are iln (inference line axis) and"&
+ drv_errhelp "Valid identifiers are"&
+ " iln (inference line axis) and"&
" jdg (judgment math-axis).";
drv_errmessage (ref_str&" is not a valid reference identifier");
else:
@@ -2168,9 +2135,9 @@ enddef;
vardef drv_delimiter (suffix pos_sfx) (expr dlm_str)=
if check_position_left (pos_sfx, true):
- drv_l_dlm:=dlm_str;
+ drv_ldlm_str:=dlm_str;
else:
- drv_r_dlm:=dlm_str;
+ drv_rdlm_str:=dlm_str;
fi
enddef;