From fe8d843c0480ab3531127a9407e6bc6ad34aeb41 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 3 Oct 2015 23:09:44 +0000 Subject: mcf2graph (3oct15) git-svn-id: svn://tug.org/texlive/trunk@38536 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf | 56 +++++++++++------------ 1 file changed, 28 insertions(+), 28 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 2ecd92f90c3..7e6e0c53315 100644 --- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf +++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% mcf2graph ver 3.73 Copyright (c) 2013-2015 Akira Yamaji +% mcf2graph ver 3.74 Copyright (c) 2013-2015 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,14 +30,13 @@ % Set output checklist : mpost -s ahlength=2 FILENAME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tracingstats:=1; -message " This is mcf2graph ver 3.7 2015.9 "; -newinternal com,par,cntA,cntB,adrS,adrA,adrB,dx,nX,i,u,j,k,v,xp,yp,nA,nB; +message " This is mcf2graph ver 3.7 2015.10"; %------------------------------------------------------------------------------------------------- pair posB[],posA[],pairT,Ls,Le,pairA; -numeric angB[],angA[],br_ang[],sB[],eB[],f_FON[],atom_w[],atom_h[],atom_d[],strA[],stkB[], - stkA[],stkL[],stkM[],strW[],lineB[],lenB[],ps_com[],ps_adr[],ps_len[],ps_rot[], - ps_env[],comMC[][],parMC[][],stock_p[],cntMC[],colorA[],colorB[],tblN[],tblB[][], - wtA[],sumA[],CH[],NH[],NO[],SO[],CCl[],CF[],CBr[],?[],![],Ph[]; +numeric angB[],angA[],br_ang[],sB[],eB[],f_FON[],atom_w[],atom_h[],atom_d[],strA[],stkB[],stkA[], + stkL[],stkM[],strW[],lineB[],lenB[],ps_com[],ps_adr[],op_com[][],op_par[][],op_cnt[], + comMC[][],parMC[][],stock_p[],cntMC[],colorA[],colorB[],tblN[],tblB[][],wtA[],sumA[], + CH[],NH[],NO[],SO[],CCl[],CF[],CBr[],?[],![],Ph[]; path pA,pB,pC,pT; string info[],tblA[],com_str[],calc_formula,mp_log_name,mol_name,mol_formula,calc_weight_str; picture atom_font[],chem_structure,temp_picture; @@ -166,7 +165,7 @@ def resize(expr WD,HT)= ratio_bond_width:=ratio_bond_width*factor; len_x:=len_x*factor; len_y:=len_y*factor; enddef; %------------------------------------------------------------------------------------------------- -for i=1 upto 128: f_FON[i]=0; endfor asc0:=ASCII("0"); asc9:=ASCII("9"); +for i=1 upto 128: f_FON[i]:=0; endfor asc0:=ASCII("0"); asc9:=ASCII("9"); def font_use_check= for i=1 upto 128: if f_FON[i]<>0: f_FON[i]:=0; fi endfor if (sw_numberA>=1)or(sw_numberB>=1): for j=asc0 upto asc9: f_FON[j]:=1; endfor @@ -174,7 +173,6 @@ def font_use_check= f_FON[ASCII(pic_c(j,com_str[strA[i]]))]:=1; endfor fi endfor fi enddef; %------------------------------------------------------------------------------------------------- -vardef '(text s)= ''(incr mc_num)(s); mc_num enddef; def set_def_MC= save /,*,//,/*,*/,**,~,^,`,{,},<,>,&,&#,:,=,\,\\,*\,\*,@,$,#,|,d,w,z,inside_def_MC; inside_def_MC:=1; d:=dl; w:=wf; z:=zf; @@ -196,6 +194,7 @@ def set_def_MC= enddef; %------------------------------------------------------------------------------------------------- def PM(expr a,b,c)= comMC[a][incr cntMC[a]]:=b; parMC[a][cntMC[a]]:=c; enddef; +vardef '(text s)= ''(incr mc_num)(s); mc_num enddef; def ''(expr k)(text s)= begingroup if unknown inside_def_MC:: set_def_MC fi cntMC[k]:=0; for list==s:: @@ -226,7 +225,7 @@ def !!?(expr a)(expr b)(expr c) = PB(_pop,0) if ypart(a)<=0:: PB(_cyc_eB,ypart(a)-c+1) else:: PB(_cyc_eB,ypart(a)) fi enddef; %------------------------------------------------------------------------------------------------- -def PB(expr b,c)= comMC[ab_num][incr cntBS]:=b; parMC[ab_num][cntBS]:=c; enddef; +def PB(expr a,b)= cntBS:=cntBS+1; comMC[ab_num][cntBS]:=a; parMC[ab_num][cntBS]:=b; enddef; def $$(text t)(expr e) = begingroup save cntBS; cntBS:=0; ab_num:=ab_num+1; if known e:: if numeric e:: @@ -243,7 +242,7 @@ def $$(text t)(expr e) = endgroup enddef; %------------------------------------------------------------------------------------------------- -def PA(expr b,c)= comMC[ab_num][incr cntAS]:=b; parMC[ab_num][cntAS]:=c; enddef; +def PA(expr a,b)= cntAS:=cntAS+1; comMC[ab_num][cntAS]:=a; parMC[ab_num][cntAS]:=b; enddef; def @@(text t)(expr s)= begingroup save cntAS; cntAS:=0; ab_num:=ab_num+1; if known s:: if numeric s:: @@ -273,16 +272,14 @@ def @@(text t)(expr s)= endgroup enddef; %------------------------------------------------------------------------------------------------- -def PS(expr a,b)= comMC[0][incr cntMC[0]]:=a; parMC[0][cntMC[0]]:=b; enddef; -def ps_get(expr n)= cntC:=cntMC[0]; cntPS:=cntP; - for i=n upto cntP: PS(_jp_atom_abs,ps_adr[i]) PS(_push,1) - if ps_rot[i]<>0: PS(_rot_ang,ps_rot[i]) fi - if ps_env[i]<>hz: PS(_chg_env,ps_env[i]) fi - if (ps_line[i]<>0)and(ps_line[i]<>nl): PS(_tmp_line,ps_line[i]) fi - if ps_len[i]<>crR: PS(_tmp_len,ps_len[i]) fi PS(_chg_len,crR) - if ps_line[i]<>nl: if ps_line[i]=no: PS(_adj_ang,0) fi PS(_mk_bond,0) fi - for j=1 upto cntMC[ps_com[i]]: PS(comMC[ps_com[i]][j],parMC[ps_com[i]][j]) endfor - PS(_pop,1) PS(_term,0) +def PG(expr a,b)= comMC[0][incr cntMC[0]]:=a; parMC[0][cntMC[0]]:=b; enddef; +def ps_get(expr n)= + cntC:=cntMC[0]; cntPS:=cntP; + for i=n upto cntP: + PG(_jp_atom_abs,ps_adr[i]) PG(_push,1) + for j=1 upto op_cnt[i]: PG(op_com[i][j],op_par[i][j]) endfor + for j=1 upto cntMC[ps_com[i]]: PG(comMC[ps_com[i]][j],parMC[ps_com[i]][j]) endfor + PG(_pop,1) PG(_term,0) endfor proc_bond_atom(cntC+1); if cntP>cntPS: ps_get(cntPS+1); fi enddef; @@ -379,9 +376,12 @@ def proc_bond_atom(expr n)= endfor enddef; %------------------------------------------------------------------------------------------------- +def PP(expr a,b)= op_com[cntP][incr op_cnt[cntP]]:=a; op_par[cntP][op_cnt[cntP]]:=b; enddef; def ps_put(expr n,p)= - ps_adr[incr cntP]:=n; ps_com[cntP]:=p; ps_len[cntP]:=lenT; - ps_line[cntP]:=lineT; ps_rot[cntP]:=rotT; ps_env[cntP]:=envT; + ps_adr[incr cntP]:=n; ps_com[cntP]:=p; op_cnt[cntP]:=0; + if lineT<>0: PP(_tmp_line,lineT) fi if rotT<>0: PP(_rot_ang,rotT) fi + if lenT<>crR: PP(_chg_len,lenT) fi if envT<>hz: PP(_chg_env,envT) fi + if lineT<>nl: if lineT=no: PP(_adj_ang,0) fi PP(_mk_bond,0) fi if f_lineT=0: lineT:=si; fi if f_lenT=0: lenT:=crR; fi if f_rotT=0: rotT:=0; fi if f_envT=0: envT:=hz; fi enddef; @@ -731,10 +731,10 @@ def mol_check= hide_H:=warning_cnt:=calc_weight:=calc_weightp:=0; calc_formula:=""; for i=1 upto tbl_max: sumA[i]:=0; endfor for i=1 upto cntA: knownA:=nA:=0; - for j=1 upto cntB: if (lineB[j]=dl)or(lineB[j]=dr)or(lineB[j]=dm): nB:=2; - elseif (lineB[j]=tm): nB:=3; elseif lineB[j]=nl: nB:=0; - elseif lineB[j]=0: nB:=0; else: nB:=1; fi - if (sB[j]=i)or(eB[j]=i): nA:=nA+nB; fi endfor + for j=1 upto cntB: if (lineB[j]=dl)or(lineB[j]=dr)or(lineB[j]=dm): bondC[j]:=2; + elseif (lineB[j]=tm): bondC[j]:=3; elseif lineB[j]=nl: bondC[j]:=0; + elseif lineB[j]=0: bondC[j]:=0; else: bondC[j]:=1; fi + if (sB[j]=i)or(eB[j]=i): nA:=nA+bondC[j]; fi endfor Bcnt[i]:=nA; if com_str[strA[i]]="": com_str[strA[i]]:="C"; fi if com_str[strA[i]]="C": if nA<4: hide_H:=hide_H+(4-nA); fi fi @@ -773,7 +773,7 @@ def checklist_out= fdr(10)(ypart(posA[i])/BL)&" ) "&fixed_l(8)(com_str[strA[i]])&" "&fdr(3)(Bcnt[i]); endfor message "%Bond list---------------------------------------------------------"; for i=1 upto cntB: if lineB[i]<>0: message "% "&fdr(3)(incr nA)&" "&fdr(3)(sB[i])& - " -> "&fdr(3)(eB[i])&" ("&fdr(3)(lineB[i]-si+1)&")"; fi endfor + " -> "&fdr(3)(eB[i])&" ("&fdr(3)(bondC[i]-si+1)&")"; fi endfor message "%Fomula / Molecular weight ---------------------------------------"; if calc_weightp<=40: calc_weight_str:=fdr(10)(calc_weight); else: calc_weight_str:=fdr(10)(calc_weightp)&" * 100"; fi -- cgit v1.2.3