summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-01-09 22:07:10 +0000
committerKarl Berry <karl@freefriends.org>2017-01-09 22:07:10 +0000
commitb7764eac99c5c012f905de1c41ea5e6fe9ca1a5f (patch)
tree9db865532c37ae1babd09db5e000c4b5e10372e3 /Master/texmf-dist/metapost
parentac7821c6408b8245c735759c3fa1c2d9a8ddfb5e (diff)
mcf2graph (9jan17)
git-svn-id: svn://tug.org/texlive/trunk@42908 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r--Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf40
1 files changed, 22 insertions, 18 deletions
diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
index 223757cbb3a..d89c74fa161 100644
--- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
+++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
@@ -1,5 +1,5 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% mcf2graph ver 4.06 Copyright (c) 2013-2017 Akira Yamaji
+% mcf2graph ver 4.07 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,
@@ -88,7 +88,7 @@ def_int_start:=3000; % 3000 => 4000 for internal definition (max 1000)
%--------------------------------------------------------------------------------------------------
def def_com(expr n)(text tx)= nA:=n; forsuffixes list=tx:: list:=nA; nA:=nA+1; endfor enddef;
def_com(-4000)(_term,_jp_atom,_jp_atom_abs,_jp_bond,_cyc,_cyc_sB,_cyc_eB,_set_line,_chg_line,
- _dl,_N,_O,_S,_H,_tmp_line,_chg_len,_get_len,_ring_len,_tmp_len,_rot_ang,_adj_ang,_chg_env,
+ _dl,_mb,_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,db,dm,tm,wf,wb,bd,bz,zf,zb,dt,wv,nl,vf,vb,si_,wf_,wb_,bd_);
@@ -161,7 +161,7 @@ def endfont=
enddef;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def set_def_MC=
- save /,*,//,/*,*/,**,~,~~,^,^^,`,'`,{,},<,>,>>,:>,&,&#,:,=,\,\\,*\,\*,@,$,#,|,||,
+ save /,*,//,/*,*/,**,~,~~,^,^^,`,'`,{,},<,>,>>,:>,&,&#,:,=,\,\\,*\,\*,@,$,#,|,||,_,
d,w,z,inside_def_MC;
inside_def_MC:=1; d:=db; w:=wf; z:=zf;
vardef $(text a)tertiary b == $$(a)(b) enddef; tertiarydef a=b == $$(a)(b) enddef;
@@ -179,6 +179,7 @@ def set_def_MC=
def { == (_push,1) enddef; def } == (_pop,1) enddef;
def {{ == (_push,0) enddef; def }} == (_pop,0) enddef;
def | == {,} enddef; def || == (_stack_reset,0) enddef;
+ def _ == Me enddef;
def /secondary n == (_postA,n) enddef; def //secondary n == (_postB,n) enddef;
def */secondary n == (_postC,n) enddef; def /*secondary n == (_postD,n) enddef;
def */*secondary n == (_postE,n) enddef; def **secondary n == (_postF,n) enddef;
@@ -503,6 +504,7 @@ def proc_bond_atom(expr n)=
elseif com=_tmp_len: lenT:=par;
elseif com=_set_line: lineB[getB(adrT)]:=par;
elseif com=_dl: lineB[getB(par)]:=dl;
+ elseif com=_mb: lineB[getB(-1)]:=par;
elseif (com=_chg_line)or(com=_tmp_line): lineT:=par;
elseif com=_tmp_rot: rotT:=par;
elseif com=_cyc: f_end:=getA(par); add_atom;
@@ -728,8 +730,9 @@ def ring expr n= <((-180 DIV n)-90),(_chg_len,0),
for i=3 upto 20: ?[i]:='({{,ring i,}}); endfor
Ph:=Ph1:='(?6,(_dl,-2),(_dl,-4),(_dl,-6)); Ph2:='(?6,(_dl,-1),(_dl,-3),(_dl,-5));
!:='((_mk_bond,_arg_ang)); !0:='(<180,180);
+!!:='(!,(_mb,db)); !!!:='(!,(_mb,tm));
for i=1 upto 20: ![i]:='({{,(_get_len,0),! for j==2 upto i::,! endfor,}}); endfor
-Me:='(); Et:=!; Pr:='(!2); Bu:='(!3);
+Me:='(); Et:=!; Pr:=!2; Bu:=!3;
for i=4,5,6: for j=2 upto i-2: ?[i][j]:='((_fuse,i),(j,0)); endfor endfor
for i=5,6,7,8: for j=11 upto 15: ?[i][j]:='((_fuse,i),(j,0)); endfor endfor
%=================================================================================================
@@ -741,16 +744,16 @@ Na:='("{Na}");Ca:='("{Ca}");Hg:='("{Hg}");Ni:='("{Ni}");Ti:='("{Ti}");U:='("U");
plus:='("+"); minus:='("-"); HH:='("H{_2_}"); NH:='(N,*/*H); NnoH:='(); SO:='(S,//O);
SOO :='(S,//O^-35,//O^35); CHO:='("CHO"); OH:='("OH"); COOH:='("COOH"); CH2:='("C{H_2_}");
CH3:='("C{H_3_}"); CN:='("CN"); NH2:='("N{H_2_}"); NO2:='("N{O_2_}"); SH:='("SH");
-SO3:='("S{O_3_}"); NMe:='(N,/Me); tBu:='(60,-2\,-3*,60); iPr:='(60,-2\);
-O!:='(O,!); OMe:=O!; O!2:='(O,!2); OEt:=O!2; O!3:='(O,!3); OPr:=O!3; OiPr:='(O,!,iPr);
-S!:='(S,!); SMe:=S!; S!2:='(S,!2); SEt:=S!2; S!3:='(S,!3); SPr:=S!3; SiPr:='(S,!,iPr);
-COO:='(//O,!,O); COO!:='(COO,!); COOMe:=COO!; CO!:='(//O,!); COMe:=CO!;
-OCO!:='(O,!,//O,!); OCOMe:=OCO!; COO!2:='(COO,!,Et); COOEt:=COO!2;
-COOiPr:='(COO,!,iPr); COO!3:='(COO,!3); COOPr:=COO!3;
-COOtBu:='(COO,!,tBu); NMeMe:='(N,/Me,!); NHCO!:='(NH,!,//O,!); NHCOMe:=NHCO!;
+SO3:='("S{O_3_}"); NMe:=N!:='(N,/Me); tBu:='(60,-2\,-3*,60); iPr:='(60,-2\);
+OMe:=O!:='(O,!); OEt:=O!2:='(O,!2); OPr:=O!3:='(O,!3); OiPr:='(O,!,iPr);
+SMe:=S!:='(S,!); SEt:=S!2:='(S,!2); SPr:=S!3:='(S,!3); SiPr:='(S,!,iPr);
+COOMe:=COO!:='(//O,!,O,!); COMe:=CO!:='(//O,!);
+OCOMe:=OCO!:='(O,!,//O,!); COOEt:=COO!2:='(//O,!,O,!2);
+COOiPr:='(//O,!,O,!,iPr); COOPr:=COO!3:='(//O,!,O,!3);
+COOtBu:='(//O,!,O,!,tBu); NMeMe:='(N,/Me,!); NHCOMe:=NHCO!:='(NH,!,//O,!);
NHiPr:='(NH,!,iPr); NHtBu:='(NH,!,tBu); NHH:='(N,/H,!,H);
-NH!:='(NH,!); NHMe:=NH!; NH!2:='(NH,!2); NHEt:=NH!2; !NH!:='(!,NH,!); !CO!:='(!,//O,!);
-!OH:='(!,OH); !SH:='(!,SH); !NH2:='(!,NH2); !O!:='(!,OMe); !OMe:=!O!; !COOH:='(!,COOH);
+NHMe:=NH!:='(NH,!); NHEt:=NH!2:='(NH,!2); !NH!:='(!,NH,!); !CO!:='(!,//O,!);
+!OH:='(!,OH); !SH:='(!,SH); !NH2:='(!,NH2); !OMe:=!O!:='(!,OMe); !COOH:='(!,COOH);
!CH3:='(!,"C{H_3_}"); !CN:='(!,CN); !iPr:='(!,iPr); !tBu:='(!,tBu); !Ph:='(!,Ph);
!?3:='(!,?3); !?4:='(!,?4); !?5:='(!,?5); !?6:='(!,?6);
CF2:='(/F,60,F); CCl2:='(/Cl,60,Cl); CBr2:='(/Br,60,Br); CF3:='(/F,/F^60,60,F);
@@ -952,10 +955,10 @@ def proc_calc_out=
save warning_cnt,cal_MW,cal_MWp,knownA,cal_FM,bondC,tmp_wtp,bond_cnt,cnt_hide_H,
inf_NO,inf_EN,inf_JN,inf_FM,inf_CAS,inf_USE,inf_EXA,inf_EXB,inf_MW;
numeric sumA[],bondC[],hideH[];
- string cal_FM,cal_MW_str,sumA,s_tag,s_var,
+ string cal_FM,cal_MW,cal_MW_str,sumA,s_tag,s_var,
inf_NO,inf_EN,inf_JN,inf_FM,inf_CAS,inf_USE,inf_EXA,inf_EXB,inf_MW;
inf_NO:=inf_EN:=inf_JN:=inf_FM:=inf_CAS:=inf_USE:=inf_EXA:=inf_EXB:=inf_MW:="";
- cal_MW_str:=cal_FM:=""; cnt_hide_H:=warning_cnt:=cal_MW:=cal_MWp:=0;
+ cal_MW:=cal_MW_str:=cal_FM:=""; cnt_hide_H:=warning_cnt:=cal_MW_num:=cal_MWp:=0;
%------------------------------------------------------------------------------------------
proc_get_info;
for i=1 upto tbl_cnt: sumA[i]:=0; endfor
@@ -999,10 +1002,11 @@ def proc_calc_out=
for i=1 upto tbl_cnt:
if sumA[i]>=1:
nA:=tbl_atom_wt[i]/100*sumA[i]; cal_MWp:=cal_MWp+nA;
- if (cal_MWp<40)and(nA<40): cal_MW:= cal_MW +tbl_atom_wt[i]*sumA[i]; fi
+ if (cal_MWp<40)and(nA<40): cal_MW_num:= cal_MW_num+tbl_atom_wt[i]*sumA[i]; fi
cal_FM:=cal_FM&stripP(tbl_atom_str[i]) if sumA[i]>=2: &decimal(sumA[i]) fi;
fi
endfor
+ cal_MW:=substring (0,8) of decimal(cal_MW_num);
if sw_auxout=1: proc_auxfile_out; fi
if sw_checklist=1: proc_checklist_out; fi
if sw_MOLout=1: proc_MOLfile_out; fi
@@ -1057,7 +1061,7 @@ def proc_checklist_out=
fi
endfor
message "%------------------------------------------------------------------";
- if cal_MWp<=40: cal_MW_str:=fdr(10)(cal_MW); else: cal_MW_str:=fdr(10)(cal_MWp)&" * 100"; fi
+ if cal_MWp<=40: cal_MW_str:=cal_MW; else: cal_MW_str:=fdr(10)(cal_MWp)&" * 100"; fi
for i=1 upto tbl_cnt:
if sumA[i]>=1:
nA:=tbl_atom_wt[i]/100*sumA[i];
@@ -1067,7 +1071,7 @@ def proc_checklist_out=
fi
endfor
message "% Weight Calc: " &cal_MW_str &" / Input: "
- if inf_MW<>"": &inf_MW &" / weight gap= " &decimal(cal_MW-scantokens(inf_MW)) fi;
+ if inf_MW<>"": &inf_MW &" / weight gap= " &decimal(cal_MW_num-scantokens(inf_MW)) fi;
message "% Fomula Calc: "&cal_FM&" / Input: "
if inf_FM<>"": &inf_FM&" / "& if inf_FM=cal_FM: "MACTCH" else: "NOT MACTCH" fi fi;
message "%==================================================================";