summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-03-19 22:12:07 +0000
committerKarl Berry <karl@freefriends.org>2016-03-19 22:12:07 +0000
commitc0f4bb063b9735cb76250048611b97c78302d35e (patch)
treede232c429fca46c1b5eec948cd9b5a77d2a398b5 /Master/texmf-dist/metapost
parent25cd2a575de1f6ac289ed8045a856e1f5ca03059 (diff)
mcf2graph (19mar16)
git-svn-id: svn://tug.org/texlive/trunk@40075 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r--Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf56
1 files changed, 37 insertions, 19 deletions
diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
index 2b79e0b9c5c..86a70da2d4b 100644
--- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
+++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
@@ -1,5 +1,5 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% mcf2graph ver 3.83 Copyright (c) 2013-2016 Akira Yamaji
+% mcf2graph ver 3.84 Copyright (c) 2013-2016 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,8 @@ numeric angB[],angA[],br_ang[],sB[],eB[],f_FON[],atom_w[],atom_h[],atom_d[],strA
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;
+string info[],tblA[],com_str[],
+ calc_formula,mp_log_name,mol_name,mol_formula,calc_weight_str,info_str;
picture atom_font[],chem_structure,temp_picture;
%-------------------------------------------------------------------------------------------------
sw_numberA:=sw_numberB:=sw_mol_frame:=sw_auxout:=sw_solid:=sw_expand:=sw_start_vector:=0;
@@ -46,6 +47,7 @@ char_num:=str_cnt:=proc_end:=sw_font_frame:=sw_atom_frame:=sw_checklist:=sw_MOLo
sw_info_lenx:=sw_info_leny:=sw_info_weight:=sw_info_formula:=sw_subst_off:=sw_bond_single:=0;
sw_info_file:=sw_info_char:=1;
numberA_start:=numberB_start:=1; numberA_end:=numberB_end:=4095;
+info_str:="\INFO";
%-------------------------------------------------------------------------------------------------
if known green: f_MP:=1;
mp_log_name:=jobname&"-info.aux";
@@ -82,7 +84,7 @@ par_s=ASCII("{"); par_e=ASCII("}"); score_u=ASCII("_"); hat=ASCII("^");
max_info_num:=12; for i:=1 upto max_info_num: info[i]:=":"; endfor
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,_tmp_line,_chg_len,_get_len,_ring_len,_tmp_len,_rot_ang,_set_ang,_adj_ang,_chg_env,
+ _dl,_N,_O,_S,_H,_tmp_line,_chg_len,_get_len,_ring_len,_tmp_len,_rot_ang,_set_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,zf,zb,ov,dt,no,ar,vf,vb,wv,nl);
@@ -249,26 +251,38 @@ def $$(text t)(expr e) =
enddef;
%-------------------------------------------------------------------------------------------------
def PA(expr a,b)= cntAS:=cntAS+1; comMC[ab_num][cntAS]:=a; parMC[ab_num][cntAS]:=b; enddef;
+def PAs(text t)= for list==t:: PA(xpart(list),ypart(list)) endfor enddef;
def @@(text t)(expr s)=
- begingroup save cntAS; cntAS:=0; ab_num:=ab_num+1;
+ begingroup save cntAS,xs,ys; cntAS:=0; ab_num:=ab_num+1;
if known s:: if numeric s::
- if (s>=H)and(s<=U):: for list==t:: PA(_set_adr,list) PA(_chg_atom,s) endfor
- elseif s==NH:: for list==t::
- if numeric list:: PA(_set_adr,list) PA(_chg_atom,N)
- PA(_tmp_line,no) PA(_tmp_len,_size_a) PA(_set_psA,H)
- elseif pair list:: PA(xpart(list),ypart(list)) fi endfor
- elseif s==SOO:: for list==t:: PA(_set_adr,list) PA(_chg_atom,S)
- PA(_tmp_rot,35) PA(_tmp_line,dm) PA(_set_psA,O)
- PA(_tmp_rot,-35) PA(_tmp_line,dm) PA(_set_psA,O) endfor
+ if (s>=H)and(s<=U)::
+ for list==t::
+ if s==N:: PA(_N,list) elseif s==O:: PA(_O,list) elseif s==S:: PA(_S,list)
+ else:: PA(_set_adr,list) PA(_chg_atom,s) fi
+ endfor
+ elseif s==NH::
+ for list==t::
+ if numeric list:: PAs((_N,list),~~no,'`_size_a,(_H,list))
+ elseif pair list:: PAs(list) fi
+ endfor
+ elseif s==SOO::
+ for list==t::
+ PAs((_S,list),(_set_adr,list),^^35,~~dm,(_set_psA,O),^^-35,~~dm,(_set_psA,O))
+ endfor
+ elseif s==SO::
+ for list==t::
+ if numeric list:: PAs((_S,list),(_set_adr,list),~~dm,(_set_psA,O))
+ elseif pair list:: PAs(list) fi
+ endfor
fi
elseif pair s:: xs:=xpart(s); ys:=ypart(s); PA(_set_clr,1)
for list==t::
if numeric list::
- if xs==_postA:: elseif xs==_postB:: PA(_tmp_line,dm)
- elseif xs==_postC:: PA(_tmp_line,wf) elseif xs==_postD:: PA(_tmp_line,zf)
- elseif xs==_postE:: PA(_tmp_line,nl) elseif xs==_postF:: PA(_tmp_line,no) fi
- PA(_set_adr,list) PA(_set_psA,ys)
- elseif pair list:: PA(xpart(list),ypart(list)) fi
+ if xs==_postA:: elseif xs==_postB:: PAs(~~dm)
+ elseif xs==_postC:: PAs(~~wf) elseif xs==_postD:: PAs(~~zf)
+ elseif xs==_postE:: PAs(~~nl) elseif xs==_postF:: PAs(~~no) fi
+ PA(_set_adr,list) PA(_set_psA,ys)
+ elseif pair list:: PAs(list) fi
endfor
PA(_set_clr,0)
elseif color s:: color_list[incr cntC]:=s;
@@ -367,6 +381,10 @@ def proc_bond_atom(expr n)=
elseif com=0or_jp_atom: termA; sB[cntB+1]:=getA(par); f_bra:=1;
elseif com=_jp_atom_abs: sB[cntB+1]:=par; f_bra:=1; temp_cntB:=cntB;
elseif com=_chg_atom: strA[getA(adrT)]:=parMC[par][1];
+ elseif com=_N: strA[getA(par)]:=parMC[N][1];
+ elseif com=_O: strA[getA(par)]:=parMC[O][1];
+ elseif com=_S: strA[getA(par)]:=parMC[S][1];
+ elseif com=_H: ps_put(getA(par),H);
elseif com=_chg_len: if par=_ring_len: bondL:=ringL;
elseif par=0: if lenT<>crR: bondL:=lenT; else: if bondL<0: bondL:=1; fi fi
else: bondL:=par; fi
@@ -549,7 +567,7 @@ vardef fit_zero(expr n)=if n<=9: "00" elseif n<=99: "0" fi enddef;
def info_c(expr sw,c,cc)= if sw=1: &"{"&c&":"&cc&"}" fi enddef;
def info_n(expr sw,c,n)= if sw=1: &"{"&c&":"&decimal(n)&"}" fi enddef;
def auxfile_out=
- printf "\INFO{"
+ printf info_str&"{"
info_c(sw_info_file,"F",jobname) info_n(sw_info_char,"C",char_num)
info_n(sw_info_lenx,"Lx",len_x) info_n(sw_info_leny,"Ly",len_y)
info_n(sw_info_weight,"MWc",calc_weight) info_c(sw_info_formula,"FMc",calc_formula)
@@ -727,7 +745,7 @@ tbl_cnt:=0;
STa("C",12.0107); STa("H",1.00794); STa("{Al}",26.9815); STa("{As}",74.9236); STa("B",10.811);
STa("{Br}",79.904); STa("{Ca}",40.078); STa("{Cl}",35.453); STa("{Cu}",63.546); STa("D",2.012);
STa("F",18.9984); STa("{Fe}",55.845); STa("{Hg}",200.59); STa("I",126.90447); STa("K",39.0983);
-STa("{Li}",6.941); STa("{Mg}",24.305); STa("N",14.007); STa("{Na}",22.990); STa("{Ni}",58.693);
+STa("{Li}",6.941); STa("{Mg}",24.305); STa("N",14.0067); STa("{Na}",22.98977); STa("{Ni}",58.693);
STa("O",15.9994); STa("P",30.973761); STa("S",32.065); STa("{Si}",28.0855); STa("{Sn}",118.71);
STa("{Ti}",47.867); STa("{Zn}",65.409);
tbl_max:=tbl_cnt;;