summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-01-03 21:58:43 +0000
committerKarl Berry <karl@freefriends.org>2018-01-03 21:58:43 +0000
commitfbfe7e9dd9a9c34097027af2457cad6cc2d8e255 (patch)
tree06a4405082d48ecbc7c5f62e5fc6fcf4843e2bf1 /Master/texmf-dist/metapost
parent476809c3771e673281ff37bb4cc1e1e1ec8890b0 (diff)
mcf2graph (3jan18)
git-svn-id: svn://tug.org/texlive/trunk@46199 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r--Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf207
1 files changed, 107 insertions, 100 deletions
diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
index 6c5ceb6e450..3dd99c950c4 100644
--- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
+++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
@@ -1,5 +1,5 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% mcf2graph ver 4.29 Copyright (c) 2013-2017 Akira Yamaji
+% mcf2graph ver 4.30 Copyright (c) 2013-2018 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,7 +31,7 @@
% Set to use plain.mp label,arrow : mpost -s ahlength=3 FILENAME
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tracingstats:=1;
-message " This is mcf2graph ver 4.2 2017.10";
+message " This is mcf2graph ver 4.3 2018.01";
%-------------------------------------------------------------------------------------------------
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[],
@@ -114,10 +114,10 @@ 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,
+ _dl,_mb,_N,_O,_S,_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,_postH,_stack_reset,
_set_clr,_set_adr,_mk_bond,_set_atom,_arg_ang,_chg_atom,_tmp_rot,_fuse,_push,_pop,
- _size_a,_numeric);
+ _size_a,_numeric,_jump_at,_connect_at);
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=
@@ -128,12 +128,13 @@ def parameter_list=
ratio_wedge_bond,ratio_atomgap_atom,ratio_bond_width,font_wd,font_ht,
bond_len,offset_atom,offset_wedge,max_bond_length,offset_zebra_gap,offset_bond_gap,
thickness_font_frame,offset_thickness,numberA_start,numberA_end,numberB_start,numberB_end,
- atomfontsize,defaultsize,defaultscale,labeloffset
+ atomfontsize,defaultsize,defaultscale,labeloffset,
+ Me,Et,Pr,Bu,iPr,tBu,CH3,CF3,CCl3,CBr3,NH,NH2,NO2,OH,CHO,COOH,CN,SH,OMe,OEt,SMe,SEt,
+ !CH3,!NH2,!OH,!CHO,!COOH,!CN,!SH,!NO2
enddef;
%--------------------------------------------------------------------------------------------------
vardef pic_c(expr i,s)= substring(i,i+1) of s enddef;
%--------------------------------------------------------------------------------------------------
-nA:=0; for list=parameter_list: save_para[incr nA]:=list; endfor
def store_par(text t)=
nA:=0; for list=t: if save_para[incr nA]<>list: save_para[nA]:=list; fi endfor enddef;
def restore_par(text t)= nA:=0;
@@ -196,23 +197,22 @@ def endfont=
enddef;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def set_def_MC=
- save /,//,/*,*/,**,~,~~,^,^^,`,'`,<,>,>>,:>,&,&$,:,=,\,\\,*\,\*,@,$,{,},
+ save /,//,/*,*/,**,~,~~,^,^^,`,'`,<,>,>>,:>,&,:,=,\,\\,*\,\*,@,$,{,},
|,||,|<,>|,|:,:|,_,d,w,z,inside_def_MC;
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;
+ 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;
def >>primary n == (_chg_env,n) enddef; def ``primary n == (_chg_len,n) enddef;
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 @ == JP_AT enddef; def \ == @,0 enddef;
+ def & == _connect_at enddef;
+ def @ == _jump_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;
@@ -234,9 +234,10 @@ def ''(expr k)(text TXT)=
elseif numeric list::
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
- else:: comD[k][incr cntD[k]]:=_mk_bond; parD[k][cntD[k]]:=list; fi
+ comD[k][incr cntD[k]]:=comD[list][i]; parD[k][cntD[k]]:=parD[list][i];
+ endfor
+ else:: comD[k][incr cntD[k]]:=_mk_bond; parD[k][cntD[k]]:=list;
+ fi
elseif string list:: strD[incr str_cnt]:=list;
comD[k][incr cntD[k]]:=_set_atom; parD[k][cntD[k]]:=str_cnt;
if pic_c(0,list)=="{":: tbl_str_wd[str_cnt]:=1.6; else:: tbl_str_wd[str_cnt]:=1; fi
@@ -259,13 +260,13 @@ vardef '''(text TXT)=
sub_int %------- Retern value -------
enddef;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-def FR(expr a)(expr b) =
+def FR(expr a,b) =
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) =
+def FFR(expr a,b,c) =
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)
@@ -274,7 +275,7 @@ def FFR(expr a)(expr b)(expr c) =
PA(_pop,0) if ypart(a)<=0:: PA(_cyc_eB,ypart(a)-c+1) else:: PA(_cyc_eB,ypart(a)) fi
enddef;
%-------------------------------------------------------------------------------------------------
-def FRR(expr a)(expr b)(expr c) =
+def FRR(expr a,b,c) =
PA(_jp_bond,a) PA(_rot_ang,180) PA(_push,0) PA(_chg_len,c DIV 10)
if b==5:: 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(_mk_bond,60-(c-8)) for i==1 upto 3:: PA(_mk_bond,60+((c-8) DIV 2)) endfor
@@ -285,40 +286,42 @@ def FRR(expr a)(expr b)(expr c) =
PA(_pop,0) if a>=1:: PA(_cyc_eB,0) else:: PA(_cyc_eB,list) fi
enddef;
%==================================================================================================
-vardef change_bond(expr a)(expr e) =
+vardef change_bond(expr a,b) =
sub_int:=sub_int+1;
cntD[sub_int]:=0;
- if known e:: if numeric e::
- if (e>=si)and(e<=bd_):: if e==dl:: PP(a)(_dl) else:: PX(a)(_set_line,e) fi
- elseif (e>=?3)and(e<=?20)::
- if a>=sub_int_start:: for i==1 upto cntD[a]:: FR(parD[a][i])(e-?3+3) endfor
- else:: FR(a)(e-?3+3)
- fi
- elseif e==Ph1:: FR(a)(6) PA(_dl,-2) PA(_dl,-4)
- elseif e==Ph2:: FR(a)(6) PA(_dl,-1) PA(_dl,-3) PA(_dl,-5)
- elseif e==JP_AT:: PA(_jp_bond,a)
- elseif comD[e][1]==_fuse::
- if comD[e][2]<=6:: FFR(a)(parD[e][1])(comD[e][2])
- elseif (comD[e][2]>=11)and(comD[e][2]<=15):: FRR(a)(parD[e][1])(comD[e][2])
+ if known b:: if numeric b::
+ if (b>=si)and(b<=bd_):: if b==dl:: PP(a,_dl) else:: PX(a)(_set_line,b) fi
+ elseif (b>=?3)and(b<=?20)::
+ if a>=sub_int_start:: for i==1 upto cntD[a]:: FR(parD[a][i],b-?3+3) endfor
+ else:: FR(a,b-?3+3)
+ fi
+ elseif b==Ph1:: FR(a,6) PA(_dl,-2) PA(_dl,-4)
+ elseif b==Ph2:: FR(a,6) PA(_dl,-1) PA(_dl,-3) PA(_dl,-5)
+ elseif b==_jump_at:: PA(_jp_bond,a)
+ elseif b==_connect_at:: PA(_cyc_sB,a)
+ elseif comD[b][1]==_fuse::
+ if comD[b][2]<=6:: FFR(a,parD[b][1],comD[b][2])
+ elseif (comD[b][2]>=11)and(comD[b][2]<=15):: FRR(a,parD[b][1],comD[b][2])
fi
fi
- elseif color e:: color_list[incr cntC]:=e; PX(a)(_set_colorB,cntC)
+ elseif color b:: color_list[incr cntC]:=b; PX(a)(_set_colorB,cntC)
fi fi
sub_int %------- Retern value -------
enddef;
%-------------------------------------------------------------------------------------------------
-vardef change_atom(expr a)(expr e)=
+vardef change_atom(expr a,b)=
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(a)(_N) elseif e==O:: PP(a)(_O) elseif e==S:: PP(a)(_S)
- else:: PX(a)(_chg_atom,e)
+ if known b:: if numeric b::
+ if (b>=H)and(b<=U):: if b==N:: PP(a,_N) elseif b==O:: PP(a,_O) elseif b==S:: PP(a,_S)
+ else:: PX(a)(_chg_atom,b)
fi
- elseif e==NH:: PA(_set_clr,1) PP(a)(_N) PX(a)(_postH,H) PA(_set_clr,0)
- elseif e==JP_AT:: PA(_jp_atom,a)
+ elseif b==NH:: PA(_set_clr,1) PP(a,_N) PX(a)(_postH,H) PA(_set_clr,0)
+ elseif b==_jump_at:: PA(_jp_atom,a)
+ elseif b==_connect_at:: PA(_cyc,a)
fi
- elseif pair e:: PA(_set_clr,1) PX(a)(xpart(e),ypart(e)) PA(_set_clr,0)
- elseif color e:: color_list[incr cntC]:=e; PX(a)(_set_colorA,cntC)
+ elseif pair b:: PA(_set_clr,1) PX(a)(xpart(b),ypart(b)) PA(_set_clr,0)
+ elseif color b:: color_list[incr cntC]:=b; PX(a)(_set_colorA,cntC)
fi fi
sub_int %------- Retern value -------
enddef;
@@ -473,18 +476,18 @@ 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(expr c)(expr a)=
- if c>=sub_int_start:: for i==1 upto cntD[c]:: sub_add(a,parD[c][i]) endfor
- else:: sub_add(a,c) fi
+def sub_pro(expr a,b)=
+ if a>=sub_int_start:: for i==1 upto cntD[a]:: sub_add(b,parD[a][i]) endfor else:: sub_add(b,a) fi
enddef;
%-------------------------------------------------------------------------------------------------
def sub_ext(expr c)(expr a,b)=
if c>=sub_int_start::
for i==1 upto cntD[c]::
- if comD[c][i]<>_numeric:: sub_add(comD[c][i],parD[c][i])
- else:: sub_add(_set_adr,parD[c][i]) sub_add(a,b) fi
+ if comD[c][i]==_numeric:: sub_add(_set_adr,parD[c][i]) sub_add(a,b)
+ else:: sub_add(comD[c][i],parD[c][i]) fi
endfor
- else:: sub_add(_set_adr,c) sub_add(a,b) fi
+ else:: sub_add(_set_adr,c) sub_add(a,b)
+ fi
enddef;
%=================================================================================================
def MCa(expr FW,FH)(text s)= MCd(1,1)(FW,FH)(s) enddef;
@@ -494,9 +497,9 @@ 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_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,PA,PO,PP,PX;
+ temp_cntB,f_end,f_term,rotT,adrS,f_at,f_lineT,f_rotT,f_lenT,f_envT,angT,tempB,tempA,
+ 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,PA,PO,PP,PX;
%-----------------------------------------------------------------------------------------------
def PA= sub_add enddef;
def PO= sub_add_op enddef;
@@ -564,8 +567,9 @@ def MCd(expr RW,RH)(expr FW,FH)(text TX)=
%-----------------------------------------------------------------------------------------------
enddef;
%-------------------------------------------------------------------------------------------------
-def ps_put(expr n,p)=
- ps_adr[incr cntP]:=n; ps_com[cntP]:=p; op_cnt[cntP]:=0;
+def ps_put=
+ if f_at=1: An:=getA(adrT); check_adrA(An); else: An:=cntA+1; fi
+ ps_adr[incr cntP]:=An; ps_com[cntP]:=par; op_cnt[cntP]:=0;
if lineT<>0: PO(_tmp_line,lineT) fi
if rotT<>0: PO(_rot_ang,rotT) fi
if lenT<>crR: PO(_chg_len,lenT) fi
@@ -580,9 +584,7 @@ enddef;
%-------------------------------------------------------------------------------------------------
def ps_get(expr n)=
save sub_int;
- sub_int:=0;
- nA:=cntP;
- nB:=cntD[0];
+ sub_int:=0; nA:=cntP; nB:=cntD[0];
for i=n upto cntP:
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
@@ -654,8 +656,7 @@ def proc_bond_atom(expr n)=
for i=0 upto 5: stkA[i]:=stkB[i]:=0; endfor
%-----------------------------------------------------------------------------------------------
for i=n upto cntD[0]:
- com:=comD[0][i];
- par:=parD[0][i];
+ com:=comD[0][i]; par:=parD[0][i];
if com=_push:
if par=1: stkL[adrS]:=bondL; stkA[incr adrS]:=adrA:=cntA; stkB[adrS]:=adrB:=cntB;
elseif par=0: temp_len:=bondL; fi
@@ -664,21 +665,20 @@ 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=_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=_postA: ps_put;
+ elseif com=_postB: lineT:=dm; ps_put;
+ elseif com=_postC: lineT:=wf; ps_put;
+ elseif com=_postD: lineT:=zf; ps_put;
+ elseif com=_postE: lineT:=nl; ps_put;
+ elseif com=_postF: lineT:=0; ps_put;
+ elseif com=_postH: lineT:=nl; lenT:=_size_a; ps_put;
+ elseif com=_jp_bond: termA; tempB:=getB(par); check_adrB(tempB); sB[cntB+1]:=sB[tempB]; f_bra:=1;
+ elseif com=_jp_atom: termA; tempA:=getA(par); check_adrA(tempA); sB[cntB+1]:=tempA; 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];
elseif com=_O: numS[getA(par)]:=parD[O][1];
elseif com=_S: numS[getA(par)]:=parD[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
@@ -689,7 +689,7 @@ def proc_bond_atom(expr n)=
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;
+ elseif com=_cyc: f_end:=getA(par); check_adrA(f_end); add_atom;
elseif com=_cyc_eB: f_end:=eB[getB(par)]; add_atom;
elseif com=_cyc_sB: f_end:=sB[getB(par)]; add_atom;
elseif com=_chg_env: envB:=par;
@@ -716,6 +716,11 @@ def add_atom=
if f_MP=1: colorA[cntA]:=colorB[cntA]:=0; fi else: f_bra:=0; fi
if f_end=0: eB[cntB]:=cntA+1; f_term:=0; else: eB[cntB]:=f_end; f_end:=0; f_term:=1; fi
enddef;
+%-------------------------------------------------------------------------------------------------
+def check_adrA(expr n)=
+ if (if f_term=0: n>(cntA+1) else: n>cntA fi)or(n<=0): errmessage("adrA=[ "&decimal(n)&" ]"); fi
+enddef;
+def check_adrB(expr n)= if (n>cntB)or(n<=0): errmessage("adrB=[ "&decimal(n)&" ]"); fi enddef;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def proc_skeleton=
adrA:=adrB:=cntA:=cntB:=angT:=adrS:=f_end:=f_bra:=rotT:=f_term:=f_at:=0;
@@ -776,19 +781,23 @@ def add_bond(expr m)=
enddef;
%==================================================================================================
vardef getA(expr n)=
- if n>=0: stkA[adrS+1]+n elseif n>=-999: cntA+n+1 else: stkA[adrS]+n+4095 fi enddef;
+ if n>=0: stkA[adrS+1]+n elseif n>=-999: cntA+n+1 else: stkA[adrS]+n+4095 fi
+enddef;
+%--------------------------------------------------------------------------------------------------
vardef getB(expr n)=
if n>=1: stkB[adrS+1]+n elseif n=0: tempB elseif n>=-999: cntB+n+1 else: stkB[adrS]+n+4095 fi
enddef;
+%--------------------------------------------------------------------------------------------------
def termA= if f_term=0: if f_bra=0: numS[incr cntA]:=strAT; strAT:=0;
if f_MP=1: colorA[cntA]:=0; fi else: f_bra:=0; fi f_term:=1; fi enddef;
-def termB=
- if f_term=0: if f_bra=0: ang_br[incr cntA]:=angT; else: f_bra:=0; fi f_term:=1; fi enddef;
+def termB= if f_term=0: if f_bra=0:ang_br[incr cntA]:=angT; else:f_bra:=0; fi f_term:=1; fi enddef;
+%--------------------------------------------------------------------------------------------------
def proc_cyc(expr n)= add_bond(angle(posA[n]-posBs)-angT); enddef;
-def glu_c(expr n)= if numS[n]<>0: nB:=angT mod 180; nC:=.5tbl_str_wd[numS[n]]*atom_wd;
- if (nB<45)or(nB>135):glu:=glu+((sind(nB)*nC)++nC);
- else :glu:=glu+((cosd(nB)*.5atom_wd)++.5atom_wd) fi fi
-enddef;
+%--------------------------------------------------------------------------------------------------
+def glu_c(expr n)= if numS[n]<>0: nB:=angT mod 180; nC:=.5tbl_str_wd[numS[n]]*atom_wd;
+ if (nB<45)or(nB>135):glu:=glu+((sind(nB)*nC)++nC);
+ 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>=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
@@ -924,16 +933,17 @@ def clipping(expr SA,SB,PA,PB,LEN)=
pB:=nA[PA,PB]--nA[PB,PA]; pC:=pA:=Ls--Le; fi
enddef;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+def ring expr n= <((-180 DIV n)-90),(_chg_len,0),
+ for i==2 upto n:: ,(360 DIV n) endfor,(_cyc_sB,1-n) enddef;
+%-------------------------------------------------------------------------------------------------
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),
- for i==2 upto n:: ,(360 DIV n) endfor,(_cyc_sB,1-n) enddef;
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));
-!:=!1:='((_mk_bond,_arg_ang)); !!:='(!,(_mb,db)); !!!:='(!,(_mb,tm)); !0:='(<180,180);
+!:=!1:='((_mk_bond,_arg_ang)); !!:='(!,(_mb,db)); !!!:='(!,(_mb,tm)); !0:='(<180,180);
for i=2 upto 20: ![i]:='(|:,(_get_len,0),! for j==2 upto i::,! endfor,:|); endfor
-Me:='(); Et:=!; Pr:=!2; Bu:=!3;
+Me:='(); Et:='(!); Pr:=!x2:='(!,!); Bu:=!x3:='(!,!,!);
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
%=================================================================================================
@@ -943,34 +953,31 @@ 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!:='(/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);
-OCOMe:=OCO!:='(O,!,//O,!); COOEt:=COO!2:='(//O,!,O,!2);
-COOiPr:=COOMe!:='(//O,!,O,!,iPr); COOPr:=COO!3:='(//O,!,O,!3);
-COOtBu:='(//O,!,O,!,tBu); NMeMe:=NMe!:='(N,/Me,!); NHCOMe:=NHCO!:='(NH,!,//O,!);
-NHiPr:=NHMe!:='(NH,!,iPr); NHtBu:='(NH,!,tBu); NHH:='(N,/H,!,H);
-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:=!Me!:='(!,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);
-CCl3:='(/Cl,/Cl^60,60,Cl);CBr3:='(/Br,/Br^60,60,Br);O_H:='(O,!,H);CO_H:='(//O,!,H);
+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_}"); NH:='(N,*/*H);
+NMe:=N!:='(N,/Me); iPr:=Me!:='(/Me,60); tBu:='(/Me,/Me^60,60); SO:='(S,//O);
+SOO :='(S,//O^-35,//O^35);
+OMe:=O!:='(O,!); OEt:=O!2:='(O,!x2); OPr:=O!3:='(O,!x3); OiPr:=OMe!:='(O,!,iPr);
+SMe:=S!:='(S,!); SEt:=S!2:='(S,!x2); SPr:=S!3:='(S,!x3); SiPr:=SMe!:='(S,!,iPr);
+COO:='(//O,!,O); COOMe:=COO!:='(COO,!); COOEt:=COO!2:='(COO,!x2); COOiPr:=COOMe!:='(COO,!,iPr);
+COOPr:=COO!3:='(COO,!x3); COOtBu:='(COO,!,tBu); COMe:=CO!:='(//O,!); COEt:=CO!2:='(//O,!x2);
+OCOMe:=OCO!:='(O,!,//O,!); NMeMe:=NMe!:='(N!,!); NHCOMe:=NHCO!:='(NH,!,//O,!);
+NHiPr:=NHMe!:='(NH,!,iPr); NHtBu:='(NH,!,tBu); NHMe:=NH!:='(NH,!); NHEt:=NH!2:='(NH,!x2);
+!NH!:='(!,NH,!); !CO!:='(!,//O,!); !OH:='(!,OH); !SH:='(!,SH); !NH2:='(!,NH2); !OMe:=!O!:='(!,OMe);
+!COOH:='(!,COOH); !CH3:='(!,CH3); !CN:='(!,CN); !iPr:=!Me!:='(!,iPr); !tBu:='(!,tBu); !Ph:='(!,Ph);
+!CHO:='(!,CHO); !NO2:='(!,NO2);
+!?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); CCl3:='(/Cl,/Cl^60,60,Cl); CBr3:='(/Br,/Br^60,60,Br);
%==================================================================================================
-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);
+nA:=0; for list=parameter_list: save_para[incr nA]:=list; endfor
%--------------------------------------------------------------------------------------------------
%%%%%%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;
+ CH3:='(/H,/H^60,60,H); NH:='(N,/H); NH2:='(N,/H,60,H); NO2:='(N,//O,60~dm,O); OH:='(O,!,H);
+ CHO:='(//O,!,H); COOH:='(//O,!,O,!,H); CN:='(!~tm,N); SH:='(S,!,H); !CH3:='(!,CH3); !OH:='(!,OH);
+ !NH2:='(!,NH2); !CHO:='(!,CHO); !COOH:='(!,COOH); !CN:='(!,CN); !SH:='(!,SH); !NO2:='(!,NO2);
enddef;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
def char_size_set(expr a)(expr b)(expr s)=