summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost/mcf2graph
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-10-29 21:22:31 +0000
committerKarl Berry <karl@freefriends.org>2017-10-29 21:22:31 +0000
commit4a880a05106b56169406999325c28b45f4d6f345 (patch)
treec3dc76e8577836a051325b8f22d73c3376a17da5 /Master/texmf-dist/metapost/mcf2graph
parentdd5819eb47d32656c14739656d13b12a90015bd4 (diff)
mcf2graph (28oct17)
git-svn-id: svn://tug.org/texlive/trunk@45635 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost/mcf2graph')
-rw-r--r--Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf92
1 files changed, 43 insertions, 49 deletions
diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
index 4fd26918274..6c5ceb6e450 100644
--- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
+++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
@@ -1,5 +1,5 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% mcf2graph ver 4.28 Copyright (c) 2013-2017 Akira Yamaji
+% mcf2graph ver 4.29 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,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.9";
+message " This is mcf2graph ver 4.2 2017.10";
%-------------------------------------------------------------------------------------------------
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[],
@@ -224,11 +224,11 @@ enddef;
%=================================================================================================
vardef '(text s)= ''(incr sub_usr)(s); sub_usr enddef;
%-------------------------------------------------------------------------------------------------
-def ''(expr k)(text s)=
+def ''(expr k)(text TXT)=
begingroup
if unknown inside_def_MC:: set_def_MC fi
cntD[k]:=0;
- for list==s::
+ for list==TXT::
if known list::
if pair list:: comD[k][incr cntD[k]]:=xpart(list); parD[k][cntD[k]]:=ypart(list);
elseif numeric list::
@@ -246,17 +246,14 @@ def ''(expr k)(text s)=
endgroup
enddef;
%-------------------------------------------------------------------------------------------------
-vardef '''(text s)=
+vardef '''(text TXT)=
sub_int:=sub_int+1;
cntD[sub_int]:=0;
- for list==s::
- cntD[sub_int]:=cntD[sub_int]+1;
+ for list==TXT:: cntD[sub_int]:=cntD[sub_int]+1;
if numeric list::
- comD[sub_int][cntD[sub_int]]:=_numeric;
- parD[sub_int][cntD[sub_int]]:=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);
+ comD[sub_int][cntD[sub_int]]:=xpart(list); parD[sub_int][cntD[sub_int]]:=ypart(list);
fi
endfor
sub_int %------- Retern value -------
@@ -288,42 +285,40 @@ 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(text t)(expr e) =
+vardef change_bond(expr a)(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:: PP(t)(_dl) else:: PX(t)(_set_line,e) fi
+ 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)::
- 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)
+ 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:: 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
+ 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])
fi
fi
- elseif color e:: color_list[incr cntC]:=e; PX(t)(_set_colorB,cntC)
+ elseif color e:: color_list[incr cntC]:=e; PX(a)(_set_colorB,cntC)
fi fi
sub_int %------- Retern value -------
enddef;
%-------------------------------------------------------------------------------------------------
-vardef change_atom(text t)(expr e)=
+vardef change_atom(expr a)(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)
+ 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)
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)
+ 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)
fi
- 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)
+ 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)
fi fi
sub_int %------- Retern value -------
enddef;
@@ -379,13 +374,13 @@ def ext(text TXT)=
endgroup;
enddef;
%==================================================================================================
-def ext_puts(expr PA)(expr STR)=
+def ext_puts(expr a)(expr STR)=
begingroup
save cp,sA,pC;
pair cp;
string sA;
picture pC;
- cp:=PA;
+ cp:=a;
nB:=defaultscale*defaultsize;
nC:=0;
%------------------------------------------------------------------------------------------------
@@ -473,26 +468,25 @@ 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
+%-------------------------------------------------------------------------------------------------
+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
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
+ endfor
+ 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;
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;
@@ -1236,7 +1230,7 @@ def auxtag_out=
enddef;
%==================================================================================================
def proc_auxfile_out=
- message "%["&decimal(char_num)&"]:"&inf_EN;
+ message "["&decimal(char_num)&"]:"&inf_EN;
for i=1 upto aux_max: exitif tag[i]="";
if i=1: printf "" else: &aux_delimiter fi if sw_auxfix=0: &tag[i]&":" fi &
if string scantokens(var[i]): scantokens(var[i])