From e5bd1a71b2d73673d39428bdd10199da042ae49b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 3 Jan 2017 22:12:39 +0000 Subject: mcf2graph (3jan17) git-svn-id: svn://tug.org/texlive/trunk@42854 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf | 66 +++++++++++++---------- 1 file changed, 37 insertions(+), 29 deletions(-) (limited to 'Master/texmf-dist/metapost') diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf index 01d2d083e29..223757cbb3a 100644 --- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf +++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% mcf2graph ver 4.05 Copyright (c) 2013-2016 Akira Yamaji +% mcf2graph ver 4.06 Copyright (c) 2013-2017 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, @@ -30,7 +30,7 @@ % Set output checklist : mpost -s ahlength=2 FILENAME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tracingstats:=1; -message " This is mcf2graph ver 4.0 2016.11"; +message " This is mcf2graph ver 4.0 2017.1"; %------------------------------------------------------------------------------------------------- newinternal nA,nB,nC,nD,nE,nF,char_num,str_cnt,def_num,def_int,tbl_cnt; numeric save_para[],comD[][],parD[][],cntD[],tbl_str_wd[],tbl_atom[],tbl_subst[][],tbl_atom_wt[], @@ -91,7 +91,7 @@ def_com(-4000)(_term,_jp_atom,_jp_atom_abs,_jp_bond,_cyc,_cyc_sB,_cyc_eB,_set_li _dl,_N,_O,_S,_H,_tmp_line,_chg_len,_get_len,_ring_len,_tmp_len,_rot_ang,_adj_ang,_chg_env, _tmp_env,_set_colorA,_set_colorB,_postA,_postB,_postC,_postD,_postE,_postF,_set_psA,_stack_reset, _set_clr,_set_adr,_mk_bond,_set_atom,_arg_ang,_chg_atom,_tmp_rot,_fuse,_push,_pop,_size_a); -def_com(1)(si,dl,dr,dm,tm,wf,wb,bd,bz,zf,zb,dt,wv,nl,vf,vb,si_,wf_,wb_,bd_); +def_com(1)(si,dl,dr,db,dm,tm,wf,wb,bd,bz,zf,zb,dt,wv,nl,vf,vb,si_,wf_,wb_,bd_); %-------------------------------------------------------------------------------------------------- def parameter_list= sw_checklist,sw_numberA,sw_numberB,sw_mol_frame,sw_auxout,sw_solid,sw_expand,sw_MOLout, @@ -163,7 +163,7 @@ enddef; def set_def_MC= save /,*,//,/*,*/,**,~,~~,^,^^,`,'`,{,},<,>,>>,:>,&,&#,:,=,\,\\,*\,\*,@,$,#,|,||, d,w,z,inside_def_MC; - inside_def_MC:=1; d:=dl; w:=wf; z:=zf; + inside_def_MC:=1; d:=db; w:=wf; z:=zf; vardef $(text a)tertiary b == $$(a)(b) enddef; tertiarydef a=b == $$(a)(b) enddef; vardef @(text a)tertiary b == @@(a)(b) enddef; tertiarydef a:b == @@(a)(b) enddef; vardef #primary a == if numeric a:: a-4095 elseif pair a:: a+(0,-4095) fi enddef; @@ -208,13 +208,13 @@ def ''(expr k)(text s)= endgroup enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -def !?(expr a)(expr b) = +def FR(expr a)(expr b) = PA(_jp_bond,a) PA(_get_len,a) PA(_push,0) PA(_chg_len,_ring_len) for i==1 upto b-2:: PA(_mk_bond,360 DIV b) endfor PA(_pop,0) if a>=1:: PA(_cyc_eB,0) elseif a>=-999:: PA(_cyc_eB,a-b+2) else:: PA(_cyc_eB,a) fi enddef; %------------------------------------------------------------------------------------------------- -def !!?(expr a)(expr b)(expr c) = +def FFR(expr a)(expr b)(expr c) = PA(_jp_bond,xpart(a)) PA(_push,0) if b==6:: PA(_chg_len,0) for i==1 upto c-1:: PA(_mk_bond,60) endfor elseif b==5:: if c==2:: PA(_chg_len,1.25) PA(_mk_bond,80) @@ -223,7 +223,7 @@ def !!?(expr a)(expr b)(expr c) = PA(_pop,0) if ypart(a)<=0:: PA(_cyc_eB,ypart(a)-c+1) else:: PA(_cyc_eB,ypart(a)) fi enddef; %------------------------------------------------------------------------------------------------- -def !??(expr a)(expr b)(expr c) = +def FRR(expr a)(expr b)(expr c) = if b==5:: PA(_jp_bond,a) PA(_push,0) PA(_chg_len,c DIV 10) PA(_mk_bond,72-((c-9) MUL 1.5)) PA(_mk_bond,72+(c-9)) PA(_mk_bond,72+(c-9)) PA(_pop,0) @@ -250,13 +250,13 @@ vardef $$(text t)(expr e) = if known e:: if numeric e:: if (e>=si)and(e<=bd_):: if e==dl:: for list==t:: PA(_dl,list) endfor else:: for list==t:: PA(_set_adr,list) PA(_set_line,e) endfor fi - elseif (e>=?3)and(e<=?20):: for list==t:: !?(list)(e-?3+3) endfor - elseif e==Ph1:: !?(t)(6) PA(_dl,-2) PA(_dl,-4) - elseif e==Ph2:: !?(t)(6) PA(_dl,-1) PA(_dl,-3) PA(_dl,-5) + elseif (e>=?3)and(e<=?20):: for list==t:: FR(list)(e-?3+3) endfor + elseif e==Ph1:: FR(t)(6) PA(_dl,-2) PA(_dl,-4) + elseif e==Ph2:: FR(t)(6) PA(_dl,-1) PA(_dl,-3) PA(_dl,-5) elseif comD[e][1]==_fuse:: - if comD[e][2]<=6:: for list==t:: !!?(list)(parD[e][1])(comD[e][2]) endfor + if comD[e][2]<=6:: for list==t:: FFR(list)(parD[e][1])(comD[e][2]) endfor elseif (comD[e][2]>=11)and(comD[e][2]<=15):: - for list==t:: !??(list)(parD[e][1])(comD[e][2]) endfor + for list==t:: FRR(list)(parD[e][1])(comD[e][2]) endfor fi fi elseif color e:: color_list[incr cntC]:=e; @@ -638,7 +638,7 @@ def draw_atom(expr NUM,POS,ANG,STR,WD)= endgroup enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -def draw_bond(expr n,BP,EP,ANG,LN)= +def draw_bond(expr NN,BP,EP,ANG,LN)= begingroup save ww,ap,am,hpt,Ls,Le,pA,pB,pC,pT; pair Ls,Le; @@ -650,12 +650,14 @@ def draw_bond(expr n,BP,EP,ANG,LN)= if sw_numberB>=1: clipping(0,0,posA[BP],posA[EP],nC); else: clipping(numS[BP],numS[EP],posA[BP],posA[EP],nC); fi pickup pencircle scaled bond_pen_wd; - if known colorB[n]: nB:=colorB[n]; fi + if known colorB[NN]: nB:=colorB[NN]; fi %--------------------------------------------------------------------------------------------- if (LN=si)or(sw_bond_single=1): draw pA Cp(nB); elseif LN=dl:draw pA Cp(nB); draw sfB(pC,bondgap,ap) Cp(nB); elseif LN=dr:draw pA Cp(nB); draw sfB(pC,bondgap,am) Cp(nB); elseif LN=dm:draw sfB(pB,bondgap/1.75,ap) Cp(nB); draw sfB(pB,bondgap/1.75,am) Cp(nB); + elseif LN=db:if ((ANG-ang_br[BP]) mod 360)<=180: nA:=ap; else: nA:=am; fi + draw pA Cp(nB); draw sfB(pC,bondgap,nA) Cp(nB); elseif LN=tm:draw pA Cp(nB);draw sfB(pA,bondgap,ap) Cp(nB); draw sfB(pA,bondgap,am) Cp(nB); elseif LN=wf:fill Ls--sfB(Le,ww,am)--sfB(Le,ww,ap)--cycle; elseif LN=wb:fill sfB(Ls,ww,am)--Le--sfB(Ls,ww,ap)--cycle; @@ -677,11 +679,11 @@ def draw_bond(expr n,BP,EP,ANG,LN)= elseif LN=bd_:erase draw 0.15[Ls,Le]--0.85[Ls,Le] wpcs 1.6bondgap; draw pA withpen penrazor rotated ap scaled bondgap Cp(nB); fi - if (sw_numberB>=1)and(n>=numberB_start)and(n<=numberB_end): - if sw_numberB=2: nB:=n-numberB_start+1; - elseif sw_numberB=3: if numberB_end=1)and(NN>=numberB_start)and(NN<=numberB_end): + if sw_numberB=2: nB:=NN-numberB_start+1; + elseif sw_numberB=3: if numberB_end=dl)and(lineB[j]<=dm): bondC[j]:=2; + elseif lineB[j]=tm: bondC[j]:=3; + elseif (lineB[j]=vf)or(lineB[j]=vb): bondC[j]:=0; + else: bondC[j]:=1; fi if (sB[j]=i)or(eB[j]=i): bond_cnt:=bond_cnt+bondC[j]; fi endfor -- cgit v1.2.3