diff options
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r-- | Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf index f6aa34ab01b..8571096ba0b 100644 --- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf +++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% mcf2graph ver 4.75 Copyright (c) 2013-2021 Akira Yamaji +% mcf2graph ver 4.76 Copyright (c) 2013-2021 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.75 2021.12.12"; +message "* This is mcf2graph ver 4.76 2021.12.20"; %------------------------------------------------------------------------------------------------- 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; @@ -78,6 +78,7 @@ def fat(expr a,b)= mposition:=b; a enddef; def ext(text TXT)= sw_ext_all:=1; def EXT_ALL = TXT enddef; enddef; def ext_clear= sw_ext_all:=0; def EXT_ALL = enddef; enddef; %-------------------------------------------------------------------------------------------------- +vardef frac primary n= n-floor n enddef; vardef iif(expr a,b,c)=if a: b else: c fi enddef; vardef subc(expr i,s)= substring(i-1,i) of s enddef; vardef sfrt(expr a,b,c)= a shifted ((b,0) rotated c) enddef; @@ -451,7 +452,7 @@ def pickup_data_unit(expr t,v,f)= endgroup; enddef; %-------------------------------------------------------------------------------------------------- -vardef scan_bit(expr n,b)= if b=0: false else: odd(floor(n/b)) fi enddef; +vardef scan_bit(expr n,b)= if b>=1: odd(floor(n/b)) else: odd(floor((frac n)/b)) fi enddef; %-------------------------------------------------------------------------------------------------- vardef scan_char(expr c,s,d,n)= save k,n_s; @@ -491,7 +492,7 @@ tertiarydef a op_bq b = if known b:: (_tmp_len,b),a else:: _nop,a fi enddef; def rot_angle primary n = (_rot_ang,n) enddef; def cyc_atom primary n = (_cyc,n) enddef; def jump_atom_abs primary a = - if numeric a:: (_jp_atom,$a) elseif pair a:: (_jp_atom,$1),<$0,angle(a)~0`length(a),<$0 fi + 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 @@ -533,9 +534,9 @@ def read_mcf(expr n)(text TXT)= enddef; %------------------------------------------------------------------------------------------------- vardef read_number(text TXT)= - save --,-+,<,nA,nB,nC; - let -- == from_until; - def < == -3000 enddef; + save ',:,nA,nB,nC; + let : == from_until; + def ' == +0.5 enddef; parts_int:=parts_int+1; nA:=0; for list==TXT:: @@ -595,10 +596,11 @@ vardef change_bond(expr a,b) = if a>=parts_int_start:: for i==1 upto cntD[a]:: if comD[a][i]==_numeric:: - if parD[a][i]>=-999:: com_par(_set_adr,parD[a][i]) com_par(_set_line,b) - ef b==dl:: com_par(_set_adr,parD[a][i]+3000) com_par(_set_line,dr) - ef b==dr:: com_par(_set_adr,parD[a][i]+3000) com_par(_set_line,dl) - else:: com_par(_set_adr,parD[a][i]+3000) com_par(_set_line,b) + if frac parD[a][i]==0:: + com_par(_set_adr,parD[a][i]) com_par(_set_line,b) + ef b==dl:: com_par(_set_adr,floor parD[a][i]) com_par(_set_line,dr) + ef b==dr:: com_par(_set_adr,floor parD[a][i]) com_par(_set_line,dl) + else:: com_par(_set_adr,floor parD[a][i]) com_par(_set_line,b) fi fi endfor @@ -621,22 +623,19 @@ vardef change_bond(expr a,b) = else:: fuse_ring(parD[a][i],b-?3+3) fi else:: - if b==?6:: if (comD[a][i]>=-999)and(parD[a][i]>=-999):: - fuse_ring_bonds((comD[a][i],parD[a][i]),6,4) - ef comD[a][i]>=-999:: - fuse_ring_bonds((comD[a][i],parD[a][i]+3000),6,3) - ef parD[a][i]>=-999:: - fuse_ring_bonds((comD[a][i]+3000,parD[a][i]),6,3) - else:: - fuse_ring_bonds((comD[a][i]+3000,parD[a][i]+3000),6,2) - fi - ef b==?5:: if (comD[a][i]>=-999)and(parD[a][i]>=-999):: - fuse_ring_bonds((comD[a][i],parD[a][i]),5,3) - ef comD[a][i]>=-999:: - fuse_ring_bonds((comD[a][i],parD[a][i]+3000),5,2) - ef parD[a][i]>=-999:: - fuse_ring_bonds((comD[a][i]+3000,parD[a][i]),5,2) - fi + if b==?6:: + if (frac comD[a][i]==0)and(frac parD[a][i]==0):: + fuse_ring_bonds((comD[a][i],parD[a][i]),6,4) + ef frac comD[a][i]==0:: fuse_ring_bonds((comD[a][i],floor parD[a][i]),6,3) + ef frac parD[a][i]==0:: fuse_ring_bonds((floor comD[a][i],parD[a][i]),6,3) + else:: fuse_ring_bonds((floor comD[a][i],floor parD[a][i]),6,2) + fi + ef b==?5:: + if (frac comD[a][i]==0)and(frac parD[a][i]==0):: + fuse_ring_bonds((comD[a][i],parD[a][i]),5,3) + ef frac comD[a][i]==0:: fuse_ring_bonds((comD[a][i],floor parD[a][i]),5,2) + ef frac parD[a][i]==0:: fuse_ring_bonds((floor comD[a][i],floor parD[a][i]),5,2) + fi ef b==?4:: fuse_ring_bonds((comD[a][i],parD[a][i]),4,2) ef b==?6[3]:: fuse_ring_bonds((comD[a][i],parD[a][i]),6,3) ef b==?6[2]:: fuse_ring_bonds((comD[a][i],parD[a][i]),6,2) @@ -2005,8 +2004,10 @@ ONa:=STb("O{Na}")(O,Na); SO3Na:=STb("S{O_3_}{Na}")(S,O,O,O,Na); tbl_group_end:=tbl_cnt; parts_atom_end:=parts_cnt; %================================================================================================= -for i==3 upto 20: ?[i]:='((_com,_len_ss),(_get_len,_ring_len),<((-180 DIV i)-90) - for j==2 upto i:: ,(360 DIV i) endfor,(_cyc_sB,1-i),(_com,_len_ee)); endfor +for i=3 upto 20: + ?[i]:='((_com,_len_ss),(_get_len,_ring_len),<((-180 DIV i)-90) + for j==2 upto i:: ,(360 DIV i) endfor,(_cyc_sB,1-i),(_com,_len_ee)); +endfor Ph:=Ph1:='(?6,-2=dl,-4=dl,-6=dl); Ph2:='(?6,-1=dl,-3=dl,-5=dl); for i=4,5,6: for j=2 upto i-2: ?[i][j]:='(); endfor endfor for i=5,6,7,8: for j=11 upto 15: ?[i][j]:='(); endfor endfor |