summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-06-05 23:09:24 +0000
committerKarl Berry <karl@freefriends.org>2017-06-05 23:09:24 +0000
commit3b20e2fc53faaae132472dfb561107e62079a95e (patch)
tree4b3048ef5fd6fe9ae25c86567619139521171881 /Master/texmf-dist/metapost
parent6afa909860685ca8cfbb23c904dc140fbdcef926 (diff)
mcf2graph (5jun17)
git-svn-id: svn://tug.org/texlive/trunk@44468 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r--Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf271
1 files changed, 155 insertions, 116 deletions
diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
index 1dff2e0bc02..4747e63571f 100644
--- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
+++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
@@ -1,5 +1,5 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% mcf2graph ver 4.21 Copyright (c) 2013-2017 Akira Yamaji
+% mcf2graph ver 4.23 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,
@@ -31,9 +31,9 @@
% Set to use plain.mp label,arrow : mpost -s ahlength=3 FILENAME
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tracingstats:=1;
-message " This is mcf2graph ver 4.2 2017.5";
+message " This is mcf2graph ver 4.2 2017.6";
%-------------------------------------------------------------------------------------------------
-newinternal nA,nB,nC,nD,nE,nF,char_num,str_cnt,def_num,def_int,tbl_cnt;
+newinternal nA,nB,nC,nD,nE,nF,char_num,str_cnt,sub_usr,sub_int,tbl_cnt;
numeric save_para[],comD[][],parD[][],cntD[],tbl_str_wd[],tbl_atom[],tbl_subst[][],tbl_atom_wt[],
tbl_atom_mi[],tbl_char_wd[],tbl_char_ht[],tbl_char_dp[];
string tbl_atom_str[],strD[],var[],tag[],mp_log_name,aux_delimiter;
@@ -106,15 +106,16 @@ ext_defaultline:=0.5bp;
ext_defaultscale:=defaultscale:=1;
labeloffset:=3bp;
%==================================================================================================
-def_emb_start:=500; % 500 => 2499 for embedded definition (max 2000)
-def_usr_start:=2500; % 2500 => 2999 for user definition (max 500)
-def_int_start:=3000; % 3000 => 4000 for internal definition (max 1000)
+sub_emb_start:=500; % 500 => 2499 for embedded sub structure (max 2000)
+sub_usr_start:=2500; % 2500 => 2999 for user sub structure (max 500)
+sub_int_start:=3000; % 3000 => 4000 for internal sub structure (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,_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);
+ _tmp_env,_set_colorA,_set_colorB,_postA,_postB,_postC,_postD,_postE,_postF,_postH,_stack_reset,
+ _set_clr,_set_adr,_mk_bond,_set_atom,_arg_ang,_chg_atom,_tmp_rot,_fuse,_push,_pop,
+ _size_a,_numeric);
def_com(1)(si,dl,dr,db,dm,tm,wf,wb,bd,bz,zf,zb,dt,wv,nl,vf,vb,si_,wf_,wb_,bd_);
%--------------------------------------------------------------------------------------------------
def parameter_list=
@@ -186,12 +187,14 @@ 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;
- vardef @(text a)tertiary b == @@(a)(b) enddef; tertiarydef a:b == @@(a)(b) enddef;
- vardef #primary a == if numeric a:: a-4095 elseif pair a:: a+(0,-4095) fi enddef;
+ inside_def_MC:=1;
+ _:=Me; d:=db; w:=wf; z:=zf;
+ tertiarydef a=b == change_bond(a)(b) enddef;
+ tertiarydef a:b == change_atom(a)(b) enddef;
+ def { == '''( enddef; let } == );
+ vardef #primary a == a-4095 enddef;
def &primary n ==(_cyc,n) enddef; def &# == & # enddef;
def ^^primary n == (_tmp_rot,n) enddef; def ~~primary n == (_tmp_line,n) enddef;
def '`primary n == (_tmp_len,n) enddef; def :>primary n == (_tmp_env,n) enddef;
@@ -199,18 +202,17 @@ def set_def_MC=
def <primary n == (_rot_ang,n) enddef;
tertiarydef a^b == ^^b,a enddef; tertiarydef a`b == '`b,a enddef;
tertiarydef a~b == ~~b,a enddef; tertiarydef a>b == :>b,a enddef;
- def * == (0,1) enddef; def \ == *,0 enddef; def \\ == *,0~dm enddef;
- def *\ == *,0~wf enddef; def \* == *,0~zf enddef;
+ def @ == JP_AT enddef; def \ == @,0 enddef;
+ def \\ == \~dm enddef; def *\ == \~wf enddef; def \* == \~zf enddef;
def |< == (_push,1) enddef; def >| == (_pop,1) enddef;
def | == |<,>| enddef; def || == (_stack_reset,0) enddef;
def |: == (_push,0) enddef; def :| == (_pop,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;
enddef;
%=================================================================================================
-vardef '(text s)= ''(incr def_num)(s); def_num enddef;
+vardef '(text s)= ''(incr sub_usr)(s); sub_usr enddef;
%-------------------------------------------------------------------------------------------------
def ''(expr k)(text s)=
begingroup
@@ -220,7 +222,7 @@ def ''(expr k)(text s)=
if known list::
if pair list:: comD[k][incr cntD[k]]:=xpart(list); parD[k][cntD[k]]:=ypart(list);
elseif numeric list::
- if list>=def_emb_start::
+ if list>=sub_emb_start::
for i==1 upto cntD[list]::
comD[k][incr cntD[k]]:=comD[list][i]; parD[k][cntD[k]]:=parD[list][i];
endfor
@@ -233,15 +235,31 @@ def ''(expr k)(text s)=
endfor
endgroup
enddef;
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%-------------------------------------------------------------------------------------------------
+vardef '''(text s)=
+ sub_int:=sub_int+1;
+ cntD[sub_int]:=0;
+ for list==s::
+ cntD[sub_int]:=cntD[sub_int]+1;
+ if numeric list::
+ comD[sub_int][cntD[sub_int]]:=_numeric;
+ parD[sub_int][cntD[sub_int]]:=list;
+ elseif pair list::
+ comD[sub_int][cntD[sub_int]]:=xpart(list);
+ parD[sub_int][cntD[sub_int]]:=ypart(list);
+ fi
+ endfor
+ sub_int %------- Retern value -------
+enddef;
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def FR(expr a)(expr b) =
- PA(_jp_bond,a) PA(_get_len,a) PA(_push,0)
+ PA(_jp_bond,a) PA(_rot_ang,180) PA(_get_len,a) PA(_push,0)
PA(_chg_len,_ring_len) for i==1 upto b-2:: PA(_mk_bond,360 DIV b) endfor PA(_pop,0)
if a>=1:: PA(_cyc_eB,0) elseif a>=-999:: PA(_cyc_eB,a-b+2) else:: PA(_cyc_eB,a) fi
enddef;
%-------------------------------------------------------------------------------------------------
def FFR(expr a)(expr b)(expr c) =
- PA(_jp_bond,xpart(a)) PA(_push,0)
+ PA(_jp_bond,xpart(a)) PA(_rot_ang,180) PA(_push,0)
if b==6:: PA(_chg_len,0) for i==1 upto c-1:: PA(_mk_bond,60) endfor
elseif b==5:: if c==2:: PA(_chg_len,1.25) PA(_mk_bond,80)
elseif c==3:: PA(_chg_len,1.1) PA(_mk_bond,78) PA(_mk_bond,72) fi
@@ -250,80 +268,64 @@ def FFR(expr a)(expr b)(expr c) =
enddef;
%-------------------------------------------------------------------------------------------------
def FRR(expr a)(expr b)(expr c) =
+ PA(_jp_bond,a) PA(_rot_ang,180) PA(_push,0) PA(_chg_len,c DIV 10)
if b==5::
- PA(_jp_bond,a) PA(_push,0) PA(_chg_len,c DIV 10) PA(_mk_bond,72-((c-9) MUL 1.5))
- PA(_mk_bond,72+(c-9)) PA(_mk_bond,72+(c-9)) PA(_pop,0)
- if a>=1:: PA(_cyc_eB,0) else:: PA(_cyc_eB,list) fi
+ PA(_mk_bond,72-((c-9) MUL 1.5)) PA(_mk_bond,72+(c-9)) PA(_mk_bond,72+(c-9))
elseif b==6::
- PA(_jp_bond,a) PA(_push,0) PA(_chg_len,c DIV 10) PA(_mk_bond,60-(c-8))
+ PA(_mk_bond,60-(c-8))
PA(_mk_bond,60+((c-8) DIV 2)) PA(_mk_bond,60+((c-8) DIV 2)) PA(_mk_bond,60+((c-8) DIV 2))
- PA(_pop,0) if a>=1:: PA(_cyc_eB,0) else:: PA(_cyc_eB,list) fi
elseif b==7::
- PA(_jp_bond,a) PA(_push,0) PA(_chg_len,c DIV 10) PA(_mk_bond,(360 DIV 7)-(c-8))
+ PA(_mk_bond,(360 DIV 7)-(c-8))
PA(_mk_bond,360 DIV 7+((c-8) DIV 2.5)) PA(_mk_bond,360 DIV 7+((c-8) DIV 2.5))
PA(_mk_bond,360 DIV 7+((c-8) DIV 2.5)) PA(_mk_bond,360 DIV 7+((c-8) DIV 2.5))
- PA(_pop,0) if a>=1:: PA(_cyc_eB,0) else:: PA(_cyc_eB,list) fi
elseif b==8::
- PA(_jp_bond,a) PA(_push,0) PA(_chg_len,c DIV 10) PA(_mk_bond,45-(c-8))
+ PA(_mk_bond,45-(c-8)) PA(_mk_bond,45+((c-8) DIV 3)) PA(_mk_bond,45+((c-8) DIV 3))
PA(_mk_bond,45+((c-8) DIV 3)) PA(_mk_bond,45+((c-8) DIV 3)) PA(_mk_bond,45+((c-8) DIV 3))
- PA(_mk_bond,45+((c-8) DIV 3)) PA(_mk_bond,45+((c-8) DIV 3))
- PA(_pop,0) if a>=1:: PA(_cyc_eB,0) else:: PA(_cyc_eB,list) fi
fi
+ PA(_pop,0) if a>=1:: PA(_cyc_eB,0) else:: PA(_cyc_eB,list) fi
enddef;
%==================================================================================================
-vardef $$(text t)(expr e) =
- nA:=0;
- def_int:=def_int+1;
+vardef change_bond(text t)(expr e) =
+ sub_int:=sub_int+1;
+ cntD[sub_int]:=0;
if known e:: if numeric e::
- if (e>=si)and(e<=bd_):: if e==dl:: for list==t:: PA(_dl,list) endfor
- else:: for list==t:: PA(_set_adr,list) PA(_set_line,e) endfor fi
- elseif (e>=?3)and(e<=?20):: for list==t:: FR(list)(e-?3+3) endfor
+ if (e>=si)and(e<=bd_):: if e==dl:: PP(t)(_dl) else:: PX(t)(_set_line,e) fi
+ elseif (e>=?3)and(e<=?20)::
+ for list==t::
+ if list>=sub_int_start:: for i==1 upto cntD[list]:: FR(parD[list][i])(e-?3+3) endfor
+ else:: FR(list)(e-?3+3) fi
+ endfor
elseif e==Ph1:: FR(t)(6) PA(_dl,-2) PA(_dl,-4)
elseif e==Ph2:: FR(t)(6) PA(_dl,-1) PA(_dl,-3) PA(_dl,-5)
+ elseif e==JP_AT:: PA(_jp_bond,t)
elseif comD[e][1]==_fuse::
if comD[e][2]<=6:: for list==t:: FFR(list)(parD[e][1])(comD[e][2]) endfor
elseif (comD[e][2]>=11)and(comD[e][2]<=15)::
for list==t:: FRR(list)(parD[e][1])(comD[e][2]) endfor
fi
fi
- elseif color e:: color_list[incr cntC]:=e;
- for list==t:: PA(_set_adr,list) PA(_set_colorB,cntC) endfor
+ elseif color e:: color_list[incr cntC]:=e; PX(t)(_set_colorB,cntC)
fi fi
- cntD[def_int]:=nA;
- def_int %------- Retern value -------
+ sub_int %------- Retern value -------
enddef;
%-------------------------------------------------------------------------------------------------
-vardef @@(text t)(expr s)=
- nA:=0;
- def_int:=def_int+1;
- if known s:: if numeric s::
- 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),~~nl,'`_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
+vardef change_atom(text t)(expr e)=
+ sub_int:=sub_int+1;
+ cntD[sub_int]:=0;
+ if known e:: if numeric e::
+ if (e>=H)and(e<=U)::
+ if e==N:: PP(t)(_N)
+ elseif e==O:: PP(t)(_O)
+ elseif e==S:: PP(t)(_S)
+ else:: PX(t)(_chg_atom,e)
+ fi
+ elseif e==NH:: PA(_set_clr,1) PP(t)(_N) PX(t)(_postH,H) PA(_set_clr,0)
+ elseif e==JP_AT:: PA(_jp_atom,t)
fi
- elseif pair s:: nE:=xpart(s); nF:=ypart(s); PA(_set_clr,1)
- for list==t::
- if numeric list::
- if nE==_postA:: elseif nE==_postB:: PAs(~~dm)
- elseif nE==_postC:: PAs(~~wf) elseif nE==_postD:: PAs(~~zf)
- elseif nE==_postE:: PAs(~~nl) elseif nE==_postF:: PAs(~~0)
- fi
- PA(_set_adr,list) PA(_set_psA,nF)
- elseif pair list:: PAs(list) fi
- endfor
- PA(_set_clr,0)
- elseif color s:: color_list[incr cntC]:=s;
- for list==t:: PA(_set_adr,list) PA(_set_colorA,cntC) endfor fi fi
- cntD[def_int]:=nA;
- def_int %------- Retern value -------
+ elseif pair e:: PA(_set_clr,1) PX(t)(xpart(e),ypart(e)) PA(_set_clr,0)
+ elseif color e:: color_list[incr cntC]:=e; PX(t)(_set_colorA,cntC)
+ fi fi
+ sub_int %------- Retern value -------
enddef;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def ext_setup=
@@ -362,9 +364,9 @@ enddef;
%--------------------------------------------------------------------------------------------------
def ext(text s)=
begingroup
- save wd,ht,n,l,p,sp,ep,am,em,aw,A,B,currentscale;
+ save wd,ht,n,l,p,am,em,aw,A,B,Bs,Be,currentscale;
numeric A[]bra,B[]ang;
- pair p[],A[],B[],sp,ep;
+ pair p[],A[],B[],Bs[],Be[];
ext_setup;
wd:=mol_wd;
ht:=mol_ht;
@@ -374,7 +376,11 @@ def ext(text s)=
An:=cntA;
Bn:=cntB;
for i=1 upto An: A[i]:=posA[i]; A[i]bra:=ang_br[i]; endfor
- for i=1 upto Bn: sp:=posA[sB[i]]; ep:=posA[eB[i]]; B[i]:=0.5[sp,ep]; B[i]ang:=angB[i]; endfor
+ for i=1 upto Bn:
+ Bs[i]:=posA[sB[i]]; Be[i]:=posA[eB[i]];
+ B[i]:=0.5[Bs[i],Be[i]];
+ B[i]ang:=angB[i];
+ endfor
s addto mol_stru[cntM] also currentpicture; clearit;
endgroup;
enddef;
@@ -460,6 +466,29 @@ def ahead_angle(expr p) =
angle direction .5ahlength/length(point 1 of p - point 0 of p) of p
enddef;
%=================================================================================================
+def sub_add(expr a,b)=
+ cntD[sub_int]:=cntD[sub_int]+1; comD[sub_int][cntD[sub_int]]:=a; parD[sub_int][cntD[sub_int]]:=b;
+enddef;
+def sub_add_op(expr a,b)=
+ op_cnt[cntP]:=op_cnt[cntP]+1; op_com[cntP][op_cnt[cntP]]:=a; op_par[cntP][op_cnt[cntP]]:=b;
+enddef;
+def sub_pro(text t)(expr a)=
+ for list==t::
+ if list>=sub_int_start:: for i==1 upto cntD[list]:: sub_add(a,parD[list][i]) endfor
+ else:: sub_add(a,list) fi
+ endfor
+enddef;
+def sub_ext(text t)(expr a,b)=
+ for list==t::
+ if list>=sub_int_start::
+ for i==1 upto cntD[list]::
+ if comD[list][i]<>_numeric:: sub_add(comD[list][i],parD[list][i])
+ else:: sub_add(_set_adr,parD[list][i]) sub_add(a,b) fi
+ endfor
+ else:: sub_add(_set_adr,list) sub_add(a,b) fi
+ endfor
+enddef;
+%-------------------------------------------------------------------------------------------------
def MCa(expr FW,FH)(text s)= MCd(1,1)(FW,FH)(s) enddef;
def MCc(expr RW,RH)(text s)= MCd(RW,RH)(0.5,0.5)(s) enddef;
def MCf(text s)= MCd(1,1)(0.5,0.5)(s) enddef;
@@ -467,23 +496,22 @@ def MCf(text s)= MCd(1,1)(0.5,0.5)(s) enddef;
def MCd(expr RW,RH)(expr FW,FH)(text TX)=
begingroup
save com,par,adrA,adrB,f_bra,envT,envB,lenT,lineT,strAT,stkA,stkB,stkL,stkM,cntP,bondL,temp_len,
- temp_cntB,f_end,f_term,rotT,adrS,f_lineT,f_rotT,f_lenT,f_envT,angT,tempB,glu,xpos,ypos,
+ temp_cntB,f_end,f_term,rotT,adrS,f_at,f_lineT,f_rotT,f_lenT,f_envT,angT,tempB,glu,xpos,ypos,
str_len,max_x,max_y,par_s,par_e,score_u,hat,f_char,ps_adr,ps_com,op_com,op_par,op_cnt,crR,
- colorA,colorB;
+ colorA,colorB,PA,PO,PP,PX;
%-----------------------------------------------------------------------------------------------
- save PA,PAs,PP,PG;
- def PA(expr a,b)= comD[def_int][incr nA]:=a; parD[def_int][nA]:=b; enddef;
- def PAs(text t)= for list==t:: PA(xpart(list),ypart(list)) endfor enddef;
- def PP(expr a,b)= op_com[cntP][incr op_cnt[cntP]]:=a; op_par[cntP][op_cnt[cntP]]:=b; enddef;
- def PG(expr a,b)= comD[0][incr cntD[0]]:=a; parD[0][cntD[0]]:=b; enddef;
+ def PA= sub_add enddef;
+ def PO= sub_add_op enddef;
+ def PP= sub_pro enddef;
+ def PX= sub_ext enddef;
%-----------------------------------------------------------------------------------------------
numeric stkB[],stkA[],stkL[],stkM[],f_char[],ps_adr[],ps_com[],colorA[],colorB[],
op_com[][],op_par[][],op_cnt[];
%-----------------------------------------------------------------------------------------------
if (sw_numberA>=1)or(sw_numberB>=1): ratio_atom_bond:=0.25; fi
if (sw_expand=1)or(sw_MOLout=1): expand_set; fi
- def_num:=def_usr_start;
- def_int:=def_int_start;
+ sub_usr:=sub_usr_start;
+ sub_int:=sub_int_start;
par_s:=ASCII("{"); par_e:=ASCII("}"); score_u:=ASCII("_"); hat:=ASCII("^");
cntA:=cntB:=cntP:=cntC:=0; strD[0]:=""; str_cnt:=2000; crR:=-ratio_chain_ring;
%===============================================================================================
@@ -514,7 +542,7 @@ def MCd(expr RW,RH)(expr FW,FH)(text TX)=
if (sw_numberA>=1)and(i>=numberA_start)and(i<=numberA_end):
if sw_numberA=2: nA:=i-numberA_start+1;
elseif sw_numberA=3: if numberA_end<cntA: nA:=numberA_end-i+1; else: nA:=cntA-i+1; fi
- else: nA:=i; fi
+ else: nA:=i; fi
if i<10: draw_atom(i,posA[i],0,decimal(nA),1);
else: draw_atom(i,posA[i]+(-.2atom_wd,0),0,decimal(nA),1); fi
elseif sw_numberB>=1:
@@ -530,16 +558,20 @@ def MCd(expr RW,RH)(expr FW,FH)(text TX)=
addto mol_stru[cntM] also currentpicture;
clearit;
endgroup;
+ %--------------------------------------------------------------------------------------------------
+%%%% message "count of usr ="& decimal(sub_usr) &" "& decimal(sub_usr-sub_usr_start);
+%%%% message "count of int ="& decimal(sub_int) &" "& decimal(sub_int-sub_int_start);
+ %--------------------------------------------------------------------------------------------------
enddef;
%-------------------------------------------------------------------------------------------------
def ps_put(expr n,p)=
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: PP(_chg_len,_size_a) PP(_adj_ang,0) fi
- if lineT<>0: PP(_mk_bond,0) fi
+ if lineT<>0: PO(_tmp_line,lineT) fi
+ if rotT<>0: PO(_rot_ang,rotT) fi
+ if lenT<>crR: PO(_chg_len,lenT) fi
+ if envT<>hz: PO(_chg_env,envT) fi
+ if lineT=nl: PO(_chg_len,_size_a) PO(_adj_ang,0) fi
+ if lineT<>0: PO(_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
@@ -547,13 +579,15 @@ def ps_put(expr n,p)=
enddef;
%-------------------------------------------------------------------------------------------------
def ps_get(expr n)=
+ save sub_int;
+ sub_int:=0;
nA:=cntP;
nB:=cntD[0];
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 cntD[ps_com[i]]: PG(comD[ps_com[i]][j],parD[ps_com[i]][j]) endfor
- PG(_pop,1) PG(_term,0)
+ PA(_jp_atom_abs,ps_adr[i]) PA(_push,1)
+ for j=1 upto op_cnt[i]: PA(op_com[i][j],op_par[i][j]) endfor
+ for j=1 upto cntD[ps_com[i]]: PA(comD[ps_com[i]][j],parD[ps_com[i]][j]) endfor
+ PA(_pop,1) PA(_term,0)
endfor
proc_bond_atom(nB+1); if cntP>nA: ps_get(nA+1); fi
enddef;
@@ -615,7 +649,7 @@ def char_use_check=
enddef;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def proc_bond_atom(expr n)=
- f_bra:=f_end:=f_term:=rotT:=adrS:=f_lineT:=f_rotT:=f_lenT:=f_envT:=envT:=envB:=strAT:=0;
+ f_bra:=f_end:=f_term:=rotT:=adrS:=f_lineT:=f_rotT:=f_lenT:=f_envT:=envT:=envB:=strAT:=f_at:=0;
stkL[0]:=bondL:=crR; lenT:=crR; sB[0]:=0; eB[0]:=1; lineT:=si;
for i=0 upto 5: stkA[i]:=stkB[i]:=0; endfor
%-----------------------------------------------------------------------------------------------
@@ -630,15 +664,15 @@ def proc_bond_atom(expr n)=
elseif com=_mk_bond: if (par=0)and(rotT<>0): rotT:=0; fi add_atom;
elseif com=_set_adr: adrT:=par;
elseif com=_set_atom: strAT:=par;
- elseif com=_set_psA: ps_put(getA(adrT),par);
- elseif com=_postA: ps_put(cntA+1,par);
- elseif com=_postB: lineT:=dm; ps_put(cntA+1,par);
- elseif com=_postC: lineT:=wf; ps_put(cntA+1,par);
- elseif com=_postD: lineT:=zf; ps_put(cntA+1,par);
- elseif com=_postE: lineT:=nl; ps_put(cntA+1,par);
- elseif com=_postF: lineT:=0; ps_put(cntA+1,par);
- elseif com=_jp_bond: tempB:=getB(par); sB[cntB+1]:=sB[tempB]; f_bra:=1;
- elseif com=0or_jp_atom: termA; sB[cntB+1]:=getA(par); f_bra:=1;
+ elseif com=_postA: if f_at=1: ps_put(getA(adrT),par); else: ps_put(cntA+1,par); fi
+ elseif com=_postB: lineT:=dm; if f_at=1: ps_put(getA(adrT),par); else: ps_put(cntA+1,par); fi
+ elseif com=_postC: lineT:=wf; if f_at=1: ps_put(getA(adrT),par); else: ps_put(cntA+1,par); fi
+ elseif com=_postD: lineT:=zf; if f_at=1: ps_put(getA(adrT),par); else: ps_put(cntA+1,par); fi
+ elseif com=_postE: lineT:=nl; if f_at=1: ps_put(getA(adrT),par); else: ps_put(cntA+1,par); fi
+ elseif com=_postF: lineT:=0; if f_at=1: ps_put(getA(adrT),par); else: ps_put(cntA+1,par); fi
+ elseif com=_postH: lineT:=nl; lenT:=_size_a; ps_put(getA(adrT),par);
+ elseif com=_jp_bond: termA; tempB:=getB(par); sB[cntB+1]:=sB[tempB]; f_bra:=1;
+ elseif com=_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: numS[getA(adrT)]:=parD[par][1];
elseif com=_N: numS[getA(par)]:=parD[N][1];
@@ -661,9 +695,11 @@ def proc_bond_atom(expr n)=
elseif com=_chg_env: envB:=par;
elseif com=_tmp_env: envT:=par;
elseif com=_set_clr:
- if par=1: if lineT<>si: f_lineT:=1; fi if rotT<>0: f_rotT:=1; fi
- if lenT<>crR: f_lenT:=1; fi if envT<>hz: f_envT:=1; fi fi
- if par=0: f_lineT:=f_rotT:=f_lenT:=f_envT:=rotT:=envT:=0; lineT:=si; lenT:=crR; fi
+ f_at:=par;
+ if par=1: if lineT<>si: f_lineT:=1; fi if rotT<>0: f_rotT:=1; fi
+ if lenT<>crR: f_lenT:=1; fi if envT<>hz: f_envT:=1; fi
+ elseif par=0: f_lineT:=f_rotT:=f_lenT:=f_envT:=rotT:=envT:=0; lineT:=si; lenT:=crR;
+ fi
elseif com=_stack_reset: stkA[adrS+1]:=0;
elseif com=_term: termA;
elseif com=_set_colorA: colorA[getA(adrT)]:=par;
@@ -682,7 +718,7 @@ def add_atom=
enddef;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def proc_skeleton=
- adrA:=adrB:=cntA:=cntB:=angT:=adrS:=f_end:=f_bra:=rotT:=f_term:=0;
+ adrA:=adrB:=cntA:=cntB:=angT:=adrS:=f_end:=f_bra:=rotT:=f_term:=f_at:=0;
envT:=envB:=f_lineT:=f_rotT:=f_lenT:=f_envT:=stkM[0]:=0; lineT:=si;
angA[0]:=angB[0]:=ang_br[0]:=0; posA[0]:=posBs:=posBe:=(0,0);
for i=0 upto 5: stkA[i]:=stkB[i]:=0; endfor
@@ -694,9 +730,9 @@ def proc_skeleton=
elseif par=0: temp_len:=bondL; fi
elseif com=_pop: if par=1: adrA:=stkA[decr adrS]; adrB:=stkB[adrS]; envB:=stkM[adrS];
elseif par=0: temp_len:=bondL; fi
- elseif com=_jp_bond: tempB:=getB(par); posBs:=posA[sB[tempB]];
- angT:=angB[tempB]-180; f_bra:=1; rotT:=0;
- elseif com=0or_jp_atom: termB; adrT:=getA(par); posBs:=posA[adrT];
+ elseif com=_jp_bond: termB; tempB:=getB(par); posBs:=posA[sB[tempB]];
+ angT:=angB[tempB]; f_bra:=1; rotT:=0;
+ elseif com=_jp_atom: termB; adrT:=getA(par); posBs:=posA[adrT];
angT:=ang_br[adrT]; f_bra:=1; rotT:=0;
elseif com=_jp_atom_abs: adrT:=par; posBs:=posA[adrT];
angT:=ang_br[adrT]; f_bra:=1; rotT:=0; temp_cntB:=cntB;
@@ -705,10 +741,10 @@ def proc_skeleton=
elseif com=_mk_bond: if (par=0)and(rotT<>0):par:=rotT; rotT:=0; fi add_bond(par);
elseif com=_rot_ang: angT:=(angT+par) mod 360;
elseif com=_tmp_rot: rotT:=par;
- elseif (com>=_postA)and(com<=_postE): rotT:=0;
+ elseif (com>=_postA)and(com<=_postH): rotT:=0;
elseif com=_chg_env: envB:=par;
elseif com=_tmp_env: envT:=par;
- elseif com=_set_clr: f_clr:=par; if par=0: lineT:=si; lenT:=crR; rotT:=envT:=0; fi
+ elseif com=_set_clr: f_at:=par; if par=0: lineT:=si; lenT:=crR; rotT:=envT:=0; fi
elseif com=_cyc: f_end:=1; proc_cyc(getA(par));
elseif com=_cyc_sB: f_end:=1; proc_cyc(sB[getB(par)]);
elseif com=_cyc_eB: f_end:=1; proc_cyc(eB[getB(par)]);
@@ -754,7 +790,7 @@ def glu_c(expr n)= if numS[n]<>0: nB:=angT mod 180; nC:=.5tbl_str_wd[numS[n]]*a
else :glu:=glu+((cosd(nB)*.5atom_wd)++.5atom_wd) fi fi
enddef;
vardef proc_env(expr n,m,a,b)= r:=(n mod 360);
- if m>=def_emb_start: parD[m][cntB-temp_cntB] else:
+ if m>=sub_emb_start: parD[m][cntB-temp_cntB] 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
@@ -871,7 +907,7 @@ def clipping(expr SA,SB,PA,PB,LEN)=
pB:=nA[PA,PB]--nA[PB,PA]; pC:=pA:=Ls--Le; fi
enddef;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-def_num:=def_emb_start;
+sub_usr:=sub_emb_start;
%-------------------------------------------------------------------------------------------------
lr:='(60 for i==1 upto 10:: ,-60,60 endfor); rl:='(-60,lr);
def ring expr n= <((-180 DIV n)-90),(_chg_len,0),
@@ -896,11 +932,12 @@ Ag:='("{Ag}");Au:='("{Au}");Sn:='("{Sn}");Cl:='("{Cl}");Br:='("{Br}");Li:='("{Li
Na:='("{Na}");Ca:='("{Ca}");Hg:='("{Hg}");Ni:='("{Ni}");Ti:='("{Ti}");U:='("U");
%-------------------------------------------------------------------------------------------------
R:='("R"); R1:='("{R^1^}"); R2:='("{R^2^}"); R3:='("{R^3^}"); R4:='("R^4^"); R5:='("{R^5^}");
+JP_AT:='();
%-------------------------------------------------------------------------------------------------
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!:='(N,/Me); iPr:=Me!:='(60,-2\); tBu:='(60,-2\,-3*,60);
+SO3:='("S{O_3_}"); NMe:=N!:='(N,/Me); iPr:=Me!:='(/Me,60); tBu:='(/Me,/Me^60,60);
OMe:=O!:='(O,!); OEt:=O!2:='(O,!2); OPr:=O!3:='(O,!3); OiPr:=OMe!:='(O,!,iPr);
SMe:=S!:='(S,!); SEt:=S!2:='(S,!2); SPr:=S!3:='(S,!3); SiPr:=SMe!:='(S,!,iPr);
COOMe:=COO!:='(//O,!,O,!); COMe:=CO!:='(//O,!); COEt:=CO!2:='(//O,!2);
@@ -918,6 +955,8 @@ CCl3:='(/Cl,/Cl^60,60,Cl);CBr3:='(/Br,/Br^60,60,Br);O_H:='(O,!,H);CO_H:='(//O,!,
CO_OH:='(//O,!,O,!,H); C_N:='(!~tm,N); N_HH:='(N,/H,60,H); N_OO:='(N,//O,60~dm,O);
S_H:='(S,!,H); N_H:='(N,/H); C_HHH:='(/H,/H^60,60,H);
%--------------------------------------------------------------------------------------------------
+%%%%%%message "count of sub_usr =" & decimal(sub_usr);
+%--------------------------------------------------------------------------------------------------
def expand_set=
save CH,NH,NO,OH,CHO,COOH,CN,SH;
CH3:=C_HHH; NH:=N_H; NH2:=N_HH; NO2:=N_OO; OH:=O_H; CHO:=CO_H; COOH:=CO_OH; CN:=C_N; SH:=S_H;