summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf')
-rw-r--r--Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf74
1 files changed, 53 insertions, 21 deletions
diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
index 8571096ba0b..0a89d9de33c 100644
--- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
+++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
@@ -1,5 +1,5 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% mcf2graph ver 4.76 Copyright (c) 2013-2021 Akira Yamaji
+% mcf2graph ver 4.77 Copyright (c) 2013-2022 Akira Yamaji
%
% Permission is hereby granted, free of charge, to any person obtaining a copy of this software
% and associated documentation files (the "Software"), to deal in the Software without restriction,
@@ -38,7 +38,7 @@
% Set to use plain.mp (label,arrow,atom) : mpost -s labeloffset=2 FILENAME
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tracingstats:=1;
-message "* This is mcf2graph ver 4.76 2021.12.20";
+message "* This is mcf2graph ver 4.77 2022.01.02";
%-------------------------------------------------------------------------------------------------
newinternal cntA,cntB,cntM,minX,minY,maxX,maxY,sftX,sftY,com,par,envT,envB,lenT,lineT,angT,rotT,
crR,nA,nB,nC,nD,nE,nF,nS,nL,nR,nU,nP,xpos,ypos,markA,markB,saveA,saveB,bondL;
@@ -214,8 +214,9 @@ parts_int_start:=3000; % 3001 => 4000 for internal parts (max 1000)
%--------------------------------------------------------------------------------------------------
def def_com(expr n)(text tx)= nA:=n; forsuffixes list=tx:: list:=nA; nA:=nA+1; endfor enddef;
def_com(-4090)(_com,_jp_atom,_jp_absA,_jp_bond,_cyc,_cyc_sB,_cyc_eB,_set_line,_tmp_line,
- _chg_len,_get_len,_ring_len,_tmp_len,_rot_ang,_adj_ang,_chg_env,_tmp_env,_set_colorA,_set_colorB,
- _group_si,_set_adr,_mk_bond,_set_atom,_arrange_ang,_chg_atom,_tmp_rot,_fuse,_size_atom,_numeric,
+ _chg_len,_get_len,_ring_len,_tmp_len,_rot_ang,_adj_ang,_chg_env,_tmp_env,
+ _set_colorA,_set_colorB,_group_si,_group_dm,_group_wf,_group_zf,
+ _set_adr,_mk_bond,_set_atom,_arrange_ang,_chg_atom,_tmp_rot,_fuse,_size_atom,_numeric,
_jump_at,_set_add,_chg_add,_nop,_mark,_moff,_term,_len_s,_len_e,_len_ss,_len_ee,
_group_s,_group_e,_rest,_charge,_from,_until,
si,dl,dl_,dr,dr_,db,dm,dm_,tm,wf,wb,bd,bz,zf,zb,dt,wv,nl,vf,vb,nb,wf_r,wb_r,bd_r,
@@ -495,12 +496,14 @@ def jump_atom_abs primary a =
if numeric a:: (_jp_atom,$a) ef pair a:: (_jp_atom,$1),<$0,angle(a)~0`length(a),<$0 fi
enddef;
def jump_atom primary a =
- if numeric a:: (_jp_atom,a) elseif pair a:: <$0,angle(a)~0`length(a),<$0 fi
+ if numeric a:: (_jp_atom,a) ef pair a:: <$0,angle(a)~0`length(a),<$0 fi
enddef;
-def chg_length primary n = (_com,_len_s),(_chg_len,n) enddef;
+def chg_length primary n = (_com,_len_s),(_chg_len,n) enddef;
def group_si secondary n = if known n:: (_group_si,n) else:: _nop fi enddef;
-def group_dm secondary n = /n~dm enddef; def group_wf secondary n = /n~wf enddef;
-def group_zf secondary n = /n~zf enddef; def group_wv secondary n = /n~wv enddef;
+def group_dm secondary n = if known n:: (_group_dm,n) else:: _nop fi enddef;
+def group_wf secondary n = if known n:: (_group_wf,n) else:: _nop fi enddef;
+def group_zf secondary n = if known n:: (_group_zf,n) else:: _nop fi enddef;
+def group_wv secondary n = /n~wv enddef;
def group_nb secondary n = /n~nb enddef;
%-------------------------------------------------------------------------------------------------
def CP = com_par enddef; def CPe = com_par_ex(0) enddef; def CPx = com_par_ex(1) enddef;
@@ -534,9 +537,10 @@ def read_mcf(expr n)(text TXT)=
enddef;
%-------------------------------------------------------------------------------------------------
vardef read_number(text TXT)=
- save ',:,nA,nB,nC;
+ save ','`,:,nA,nB,nC;
let : == from_until;
def ' == +0.5 enddef;
+ def '` == +0.5` enddef;
parts_int:=parts_int+1;
nA:=0;
for list==TXT::
@@ -562,8 +566,8 @@ vardef read_number(text TXT)=
enddef;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def fuse_ring(expr a,b) =
- CP(_jp_bond,a) CP(_rot_ang,180) CP(_get_len,a) CP(_com,_len_s)
- CP(_chg_len,_ring_len) for i==1 upto b-2:: CP(_mk_bond,360 DIV b) endfor
+ CP(_jp_bond,a) CP(_rot_ang,180) CP(_get_len,a) CP(_com,_len_s) CP(_chg_len,_ring_len)
+ for i==1 upto b-2:: CP(_mk_bond,360 DIV b) endfor
CP(_com,_len_e) if a<=0:: CP(_cyc_eB,a-b+2) else:: CP(_cyc_eB,a) fi
enddef;
%-------------------------------------------------------------------------------------------------
@@ -693,15 +697,35 @@ vardef change_atom(expr a,b)=
ef b==N!2:: CPe(a)(_chg_atom,N) CP(_com,_group_s) CPx(a)(_group_si,!) CP(_com,_group_e)
ef b==??:: CP(_com,_group_s) CP(_tmp_rot,35) CPx(a)(_group_si,_)
CP(_tmp_rot,-35) CPx(a)(_group_si,_) CP(_com,_group_e)
- ef b==SOO:: CPe(a)(_chg_atom,S) CP(_com,_group_s)
- CP(_tmp_line,dm) CP(_tmp_rot,35) CPx(a)(_group_si,O)
- CP(_tmp_line,dm) CP(_tmp_rot,-35) CPx(a)(_group_si,O) CP(_com,_group_e)
- ef b==SO:: CPe(a)(_chg_atom,S) CP(_com,_group_s) CP(_tmp_line,dm)
- CPx(a)(_group_si,O) CP(_com,_group_e)
+ ef b==SOO:: CPe(a)(_chg_atom,S) CP(_com,_group_s) CP(_tmp_rot,35) CPx(a)(_group_dm,O)
+ CP(_tmp_rot,-35) CPx(a)(_group_dm,O) CP(_com,_group_e)
+ ef b==SO:: CPe(a)(_chg_atom,S) CP(_com,_group_s) CPx(a)(_group_dm,O) CP(_com,_group_e)
ef b==n_:: CP(_com,_group_s) CP(_set_add,a_minus) CP(_chg_add,a) CP(_com,_group_e)
ef b==p_:: CP(_com,_group_s) CP(_set_add,a_plus) CP(_chg_add,a) CP(_com,_group_e)
fi
- ef pair b:: CP(_com,_group_s) CPx(a)(xpart(b),ypart(b)) CP(_com,_group_e)
+ ef pair b::
+ CP(_com,_group_s)
+ if a>=parts_emb_start::
+ for i==1 upto cntD[a]::
+ if comD[a][i]==_numeric::
+ if xpart(b)==_group_wf::
+ if frac parD[a][i]==0:: CP(_set_adr,parD[a][i]) CP(_group_wf,ypart(b))
+ else:: CP(_set_adr,floor parD[a][i]) CP(_group_zf,ypart(b))
+ fi
+ ef xpart(b)==_group_zf::
+ if frac parD[a][i]==0:: CP(_set_adr,parD[a][i]) CP(_group_zf,ypart(b))
+ else:: CP(_set_adr,floor parD[a][i]) CP(_group_wf,ypart(b))
+ fi
+ else::
+ CP(_set_adr,parD[a][i]) CP(xpart(b),ypart(b))
+ fi
+ else::
+ CP(comD[a][i],parD[a][i])
+ fi
+ endfor
+ else:: CP(_set_adr,a) CP(xpart(b),ypart(b))
+ fi
+ CP(_com,_group_e)
ef color b:: color_list[incr cntC]:=b; CPe(a)(_set_colorA,cntC)
fi
cntD[parts_int]:=nCP;
@@ -1097,7 +1121,9 @@ def add_group=
store_group(_com,_len_s)
if lineT<>nb: store_group(_tmp_line,lineT) fi
if rotT<>0: store_group(_rot_ang,rotT) fi
- if lenT<>crR: store_group(_chg_len,lenT) fi
+ if lenT<>crR: store_group(_chg_len,lenT)
+ ef bondL<>crR: if bondL>=0: store_group(_chg_len,-bondL) else: store_group(_chg_len,bondL) fi
+ fi
if envT<>hz: store_group(_chg_env,envT) fi
if lineT=nl: store_group(_chg_len,_size_atom) store_group(_adj_ang,0) fi
if lineT<>nb: store_group(_mk_bond,0) fi
@@ -1209,6 +1235,9 @@ def proc_bond_atom(expr a)(expr n)=
fi
ef com=_set_atom: strAT:=par;
ef com=_group_si: add_group;
+ ef com=_group_dm: lineT:=dm; add_group;
+ ef com=_group_wf: lineT:=wf; add_group;
+ ef com=_group_zf: lineT:=zf; add_group;
ef com=_jp_bond: termA; nA:=getB(par); check_adrB(nA); sB[cntB+1]:=sB[nA]; f_bra:=1;
ef com=_jp_atom: termA; nA:=getA(par); check_adrA(nA); sB[cntB+1]:=nA; f_bra:=1;
ef com=_jp_absA: sB[cntB+1]:=par; f_bra:=1; temp_cntB:=cntB;
@@ -1260,7 +1289,8 @@ def proc_skeleton(expr a)=
ef com=_com: if par=_mark: saveA:=markA; saveB:=markB; markA:=cntA; markB:=cntB;
ef par=_rest: markA:=saveA; markB:=saveB;
ef par=_moff: markA:=markB:=0; ef par=_term: termB;
- ef par=_group_e: lineT:=si; lenT:=crR; rotT:=envT:=0; fi
+ ef par=_group_e: lineT:=si; lenT:=crR; rotT:=envT:=0;
+ fi
ef com=_jp_bond: termB; nA:=getB(par); posBs:=posA[sB[nA]]; angT:=angB[nA]; f_bra:=1; rotT:=0;
ef com=_jp_atom: termB; adrT:=getA(par); posBs:=posA[adrT]; angT:=angX[adrT]; f_bra:=1; rotT:=0;
ef com=_jp_absA: adrT:=par; posBs:=posA[adrT];
@@ -1269,6 +1299,7 @@ def proc_skeleton(expr a)=
ef com=_rot_ang: if par>-3700: angT:=(angT+par) mod 360; else: angT:=(par+4095) mod 360; fi
ef com=_tmp_rot: rotT:=par;
ef com=_group_si: rotT:=0;
+ ef com=_group_wf: rotT:=0;
ef com=_chg_env: envB:=par;
ef com=_tmp_env: envT:=par;
ef com=_cyc: add_bond(angle(posA[getA(par)]-posBs)-angT,0);
@@ -2016,12 +2047,13 @@ for i=5,6,7,8: for j=11 upto 15: ?[i][j]:='(); endfor endfor
for i==2 upto 20:
![i]:='((_com,_len_ss),(_get_len,_tmp_len),! for j==2 upto i::,! endfor ,(_com,_len_ee));
endfor
-Me:='(); Et:='(!); iPr:=?!:='(/_,!); tBu:=??!:='(/_,/_^60,60); !?!:='(!,?!); !??!:='(!,??!);
+Me:='(); Et:='(!); iPr:=?!:='(/_,!); ?!2:='(/_,!2); tBu:=??!:='(/_,/_^60,60);
+!?:='(!,/_); !?!:='(!,/_,!);
n_:='((_set_add,a_minus)); p_:='((_set_add,a_plus));
zero_wf:='(0~wf); zero_zf:='(0~zf); zero_dm:='(0~dm); zero_wv:='(0~wv);
%-------------------------------------------------------------------------------------------------
NH:='(N,/H~nl); N!:='(N,/_); N!2:='(N,/!); SO:='(S,//O); SOO:='(S,//O^-35,//O^35);
-O!:='(O,!); O!2:='(O,!,!); O!3:='(O,!,!,!); O!?!:='(O,!,?!); O!??!:='(O,!,??!);
+O!:='(O,!); O!2:='(O,!,!); O!3:='(O,!,!,!); O!?!:='(O,!,?!); O!??!:='(O,!,??!); OPh:='(O,!,Ph);
S!:='(S,!); S!2:='(S,!,!); S!3:='(S,!,!,!); S!?!:='(S,!,?!); S!??!:='(S,!,??!);
%-------------------------------------------------------------------------------------------------
COO:='(//O,!,O); COO!:='(COO,!); COO!2:='(COO,!,!); COO!??:='(COO,!,?!); COO!3:='(COO,!,!,!);