diff options
author | Karl Berry <karl@freefriends.org> | 2015-08-07 21:44:34 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-08-07 21:44:34 +0000 |
commit | ca94b24a2e8f17e576b1d2499a06e63b29f3ee14 (patch) | |
tree | c3912690319d4ced1609265015cb1d32cb49842c /Master/texmf-dist/metapost/mcf2graph | |
parent | 0c3e778e17510573c58cc88ba0f8370c20edd7cc (diff) |
mcf2graph (7aug15)
git-svn-id: svn://tug.org/texlive/trunk@38069 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost/mcf2graph')
-rw-r--r-- | Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf index 9aee49e6677..c1862e2cb2b 100644 --- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf +++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% mcf2graph ver 3.54 Copyright (c) 2013-2015 Akira Yamaji +% mcf2graph ver 3.55 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, @@ -426,8 +426,7 @@ vardef proc_env(expr n,m,a,b)= r:=(n mod 360); if m>=first_def_number: parMC[m][cntB-temp_cntB-1] else: if m=hz:if r=0:a elseif r<=90:b elseif r<=180:a elseif r<270:b else:a fi elseif m=vt:if r=0:b elseif r<90:a elseif r<=180:b elseif r<=271:a else:b fi - elseif (m>=-180)and(m<=180): m fi fi -enddef; + elseif (m>=-180)and(m<=180): m fi fi enddef; %------------------------------------------------------------------------------------------------- def pic_c(expr i,s)= substring(i,i+1) of s enddef; def put_string(expr n,p,r,s,w)= @@ -443,8 +442,7 @@ def put_string(expr n,p,r,s,w)= if (sw_numberA=1)or(sw_numberB=1): erase fill unitsquare xscaled nA yscaled AL shifted pairA wpcs 0.01pt; fi addto currentpicture also atom_font[nB] shifted (pairA-(0,atom_d[nB])) Cp(colorA[n]); - pairT:=pairT+(nA*dx,0); fi endfor -enddef; + pairT:=pairT+(nA*dx,0); fi endfor enddef; %------------------------------------------------------------------------------------------------- def wpcs expr n= withpen pencircle scaled n enddef; def sqr(expr WD,HT)= ((0,0)--(WD,0)--(WD,HT)--(0,HT)--cycle) enddef; @@ -453,8 +451,7 @@ def z_put(expr PA,PB,PD,CL)= save nA,nC,nD; nC:=length(Le-Ls); for i=0 upto nC/zebra_gap: nA:=zebra_gap*i/nC; nD:=(zebra_gap*i+ratio_zebra_black*zebra_gap)/nC; if nD>((nC-zebra_gap)/nC): nD:=1; fi - fill nA[PB,PA]--nA[PD,PA]--nD[PD,PA]--nD[PB,PA]--cycle Cp(CL); endfor -enddef; + fill nA[PB,PA]--nA[PD,PA]--nD[PD,PA]--nD[PB,PA]--cycle Cp(CL); endfor enddef; def cut_off(expr p,w,h,s)= p intersectionpoint sqr(1.1w,1.1h) shifted (s-(.5(1.1w),.5(1.1h))); enddef; def clipping(expr SA,SB,PA,PB,LEN)= pT:=PA--PB; tn:=0.6AL/LEN; @@ -501,8 +498,7 @@ def logfile_out= printf "%"; printf "\MOLinfo" for i=1 upto max_info_num: &"{"&info[i]&"}" endfor &"%"; printf "\MCFinfo{"&jobname&"}{"&decimal(char_num)&"}{"&mp_filename&"}{"&decimal(len_x) - &"}{"&decimal(len_y)&"}{"&decimal(ratio_bond_width)&"}{"&decimal(cntA)&"}{}{}%"; -enddef; + &"}{"&decimal(len_y)&"}{"&decimal(ratio_bond_width)&"}{"&decimal(cntA)&"}{}{}%"; enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% mc_num:=first_def_number; lr:='(60 for i==1 upto 10:: ,-60,60 endfor); rl:='(-60,lr); @@ -546,15 +542,13 @@ enddef; def font_size_set(expr m)(expr n)(expr o)(expr s)=% for j=0 upto length(s)-1: num_a:=ASCII(pic_c(j,s)); if f_FON[num_a]=1: atom_w[num_a]:=m*AL; atom_h[num_a]:=n*AL; atom_d[num_a]:=o*AL; fi - endfor -enddef; + endfor enddef; def font_size_setup= font_size_set( 1)( 1)(0)("CGHMNOQ"); font_size_set( .9)( 1)(0)("ABDEFIJKLPRSTUVWXYZ-+/><m"); font_size_set( .7)( 1)(0)(" ()0123456789nhj=*bdiltf"); font_size_set( .7)( 1)(.15)("pqg"); font_size_set( .7)( .8)(0)("acekosuvxzwry"); - font_size_set( .4)( 1)(0)(".,:;'`"); -enddef; + font_size_set( .4)( 1)(0)(".,:;'`"); enddef; %------------------------------------------------------------------------------------------------ def SP(expr a,b)expr p=subpath(a*length(p),b*length(p)) of p enddef; def vL= withpen penrazor scaled fP enddef; def hL= withpen penrazor rotated 90 scaled fP enddef; @@ -570,8 +564,7 @@ if f_FON[ASCII(c)]=1: z10=(fW,hH); z12=( 0,fH); z13=(hP,fH); z14=(hW,fH); z16=(aW,fH); z18=(hP,aH); z19=(hW,hP); s; atom_font[ASCII(c)]:=currentpicture shifted (font_gap*AL,font_gap*AL); - clearxy; save x,y; clearit; fi -enddef; + clearxy; save x,y; clearit; fi enddef; %------------------------------------------------------------------------------------------------- def font_setup= pickup pencircle scaled Apen_wd; fP:=Apen_wd; hP:=.5Apen_wd; FD(" ")(); @@ -670,8 +663,7 @@ def STa(expr a,b)= tblA[incr tbl_cnt]:=a; tblN[tbl_cnt]:=0; wtA[tbl_cnt]:=b; end def STb(expr a)(text s)= tblA[incr tbl_cnt]:=a; tblN[tbl_cnt]:=0; for list=s: tblN[tbl_cnt]:=tblN[tbl_cnt]+1; for j=1 upto tbl_max: if list=tblA[j]: tblB[tbl_cnt][tblN[tbl_cnt]]:=j; fi endfor - endfor -enddef; + endfor enddef; %------------------------------------------------------------------------------------------------- tbl_cnt:=0; STa("C",12.0107); STa("H",1.00794); STa("{Al}",26.9815); STa("{As}",74.9236); STa("B",10.811); @@ -704,8 +696,7 @@ def mol_check= hide_H:=warning_cnt:=0; for i=1 upto tbl_max: sumA[i]:=0; endfor knownA:=1; fi endfor if knownA=0: warning(" Unknown Str("&com_str[strA[i]]&") is used "&decimal(i)); fi endfor - sumA[2]:=sumA[2]+hide_H; -enddef; + sumA[2]:=sumA[2]+hide_H; enddef; %------------------------------------------------------------------------------------------------- def checklist_out= Mol_wt:=Mol_wtp:=nA:=0; fomula_str:=""; message "% There were "&fdr(3)(warning_cnt)&" warnings"; @@ -727,16 +718,14 @@ def checklist_out= Mol_wt:=Mol_wtp:=nA:=0; fomula_str:=""; else: Mol_wtp:=Mol_wtp+tmp_wtp; fi fomula_str:=fomula_str&stripP(tblA[i])&decimal(sumA[i]); message "% "&fixed_l(4)(stripP(tblA[i]))&"("&fdr(9)(wtA[i])&") * "&fdr(6)(sumA[i])&" = " - if tmp_wtp<=40: &fdr(12)(wtA[i]*sumA[i]); else: &fdr(12)(tmp_wtp)&" * 100"; fi fi - endfor + if tmp_wtp<=40: &fdr(12)(wtA[i]*sumA[i]); else: &fdr(12)(tmp_wtp)&" * 100"; fi fi endfor message "% Hide H = "&fdr(3)(hide_H); message "% Molecular Weight: " if Mol_wtp<=40: &fdr(10)(Mol_wt); else: &fdr(10)(Mol_wtp)&" * 100"; fi message "% --------------------------------------"; message "% Molecular Fomula: "&fomula_str; - message "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"; -enddef; -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + message "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"; enddef; +%------------------------------------------------------------------------------------------------ def MOL_out= mp_log_name:=jobname&"-"&fit_zero(char_num)&decimal(char_num)&"-"&mol_name&".mol"; printf ""; printf " -MCFtoMOL- "&fixed_l(20)(info[1]); printf ""; printf fdr(3)(cntA)&fdr(3)(cntB)&" 0 0 0 0 0 0 0 0999 V2000"; @@ -749,6 +738,5 @@ def MOL_out= mp_log_name:=jobname&"-"&fit_zero(char_num)&decimal(char_num)&"-"& elseif (lineB[i]=zf)or(lineB[i]=wb)or(lineB[i]=dt): nB:=6; elseif lineB[i]=wv: nB:=4; else: nA:=1; nB:=0; fi printf fdr(3)(sB[i])&fdr(3)(eB[i])&fdr(3)(nA)&fdr(3)(nB)&" 0 0"; fi endfor - printf "M END"; -enddef; -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + printf "M END"; enddef; +%------------------------------------------------------------------------------------------------ |