summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-07-07 20:21:04 +0000
committerKarl Berry <karl@freefriends.org>2019-07-07 20:21:04 +0000
commitd2feb6daf6bb87d92a2a816be0e5c0633ea29e3a (patch)
tree24d09196dff839c031cd7e0836eb5b4cc1fbd507 /Master/texmf-dist/metapost
parent59fcd85455eef2a9cdbd43dc16283f4b24c115a2 (diff)
mcf2graph (7jul19)
git-svn-id: svn://tug.org/texlive/trunk@51573 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r--Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf139
1 files changed, 99 insertions, 40 deletions
diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
index 289739d439b..0906454eb51 100644
--- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
+++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
@@ -1,5 +1,5 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% mcf2graph ver 4.43 Copyright (c) 2013-2019 Akira Yamaji
+% mcf2graph ver 4.44 Copyright (c) 2013-2019 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,
@@ -36,7 +36,6 @@
% Set to use plain.mp (label,arrow,atom) : mpost -s labeloffset=2 FILENAME
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tracingstats:=1;
-message " This is mcf2graph ver 4.43 2019.06";
%-------------------------------------------------------------------------------------------------
newinternal char_num,str_cnt,sub_usr,sub_int,tbl_cnt,sharp_char;
numeric save_num[],comD[][],parD[][],cntD[],tbl_atom[],tbl_subst[][],
@@ -65,10 +64,6 @@ if (known green)and(known ahlength):
out_file_aux:=jobname&"-info.aux";
out_file_rep:=jobname&"-report.txt";
def out_file_mol= jobname&"-"&fit_zero(char_num)&"-"&inf_EN&".mol" enddef;
- %-- default bboxmargin=2------------------------------------------------------------------
- if bboxmargin=0: def shipit = enddef; % No image file
- elseif bboxmargin=1: proc_end:=1; % output first font only
- fi
%--default ahangle=45---------------------------------------------------------------------
if ahangle=0: outputformat:="eps"; % eps format(.mps)
elseif ahangle=1: outputformat:="png"; hppp:=vppp:=0.12; % png format(600dpi)
@@ -80,10 +75,14 @@ if (known green)and(known ahlength):
elseif ahangle=13: outputformat:="png"; hppp:=vppp:=0.06; % png format(1200dpi)
fi
%--default ahlength=4---------------------------------------------------------------------
- if ahlength=1: sw_aux_out:=1; def shipit = enddef; % output aux file
- elseif ahlength=2: sw_rep_out:=1; def shipit = enddef; % output report
- elseif ahlength=5: sw_mol_out:=1; def shipit = enddef; % output MOL(V2000)
- elseif ahlength=6: sw_mol_out:=2; def shipit = enddef; % output MOL(V3000)
+ if ahlength=1: sw_aux_out:=1; bboxmargin:=0; % output aux file
+ elseif ahlength=2: sw_rep_out:=1; bboxmargin:=0; % output report
+ elseif ahlength=5: sw_mol_out:=1; bboxmargin:=0; % output MOL(V2000)
+ elseif ahlength=6: sw_mol_out:=2; bboxmargin:=0; % output MOL(V3000)
+ fi
+ %-- default bboxmargin=2------------------------------------------------------------------
+ if bboxmargin=0: def shipit = enddef; % No image file
+ elseif bboxmargin=1: proc_end:=1; % output first font only
fi
%--default labeloffset=3------------------------------------------------------------------
if labeloffset=1: sw_arrow:=1; defaultfont:="uhvr8r"; % plain.mp label
@@ -104,7 +103,7 @@ if (known green)and(known ahlength):
if defaultfont="": defaultfont:="draw"; fi % default label font
%-----------------------------------------------------------------------------------------
else: f_MP:=0;
- %-----------------------------------
+ %------------------------------------
def image = image_emu enddef;
def llcorner = llcorner_emu enddef;
def lrcorner = lrcorner_emu enddef;
@@ -122,6 +121,32 @@ else: f_MP:=0;
fi
clearit;
%--------------------------------------------------------------------------------------------------
+message "---------------------------------------------";
+message "This is mcf2graph ver 4.44 2019.07";
+if f_MP=1:
+ message "numbersystem="&numbersystem;
+ if ahlength=1: message "output aux file";
+ message "out_file_aux="&out_file_aux;
+ elseif ahlength=2: message "output report file";
+ message "out_file_rep="&out_file_rep;
+ elseif ahlength=5: message "output MOL file(V2000)";
+ message jobname&"-nnn-"&"inf_EN"&".mol";
+ elseif ahlength=6: message "output MOL file(V3000)";
+ message jobname&"-nnn-"&"inf_EN"&".mol";
+ fi
+ if bboxmargin=0:
+ message "No image file";
+ else:
+ if outputformat="png":
+ message "outputformat="&outputformat &" / ppp="&decimal(hppp);
+ else:
+ message "outputformat="&outputformat;
+ fi
+ message "outputtemplate="&outputtemplate;
+ fi
+fi
+message "---------------------------------------------";
+%--------------------------------------------------------------------------------------------------
let DIV= /; let MUL= *; let LT= <; let GT= >; let AND= &; let :: = : ; let == = =; let ef=elseif;
%--------------------------------------------------------------------------------------------------
primarydef a at b = fat(a,b) enddef;
@@ -157,7 +182,7 @@ def_com(-4000)(_term,_jp_atom,_jp_atom_abs,_jp_bond,_cyc,_cyc_sB,_cyc_eB,_set_li
_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,_postG,_postH,
_set_clr,_set_adr,_mk_bond,_set_atom,_arg_ang,_chg_atom,_tmp_rot,_fuse,_push,_pop,
- _size_a,_numeric,_jump_at,_connect_at,_set_and,_chg_charge);
+ _size_a,_numeric,_jump_at,_connect_at,_set_and,_chg_charge,_nop);
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=
@@ -287,44 +312,64 @@ def set_def_MC=
|,||,|<,>|,|<=,|=,=|,|:,:|,_,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;
- def { == '''( enddef; let } == );
+ tertiarydef a=b == if (known a)and(known b):: change_bond(a,b) else:: _nop fi enddef;
+ tertiarydef a:b == if (known a)and(known b):: change_atom(a,b) else:: _nop fi enddef;
+ def { == '''( enddef;
+ let } == );
def &primary s == (_set_and,ASCII(s)) enddef;
vardef $primary a == a-4095 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 == (_tmp_rot,n) enddef;
+ def ``primary n == (_chg_len,n) enddef;
+ def '`primary n == (_tmp_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 # == _connect_at enddef; def @ == _jump_at enddef; def \ == @,0 enddef;
- def \\ == \~dm enddef; def *\ == \~wf enddef; def \* == \~zf enddef; def *\* == \~wv enddef;
- def |: == (_push,0) enddef; def :| == (_pop,0) enddef;
- def |< == (_push,1) enddef; def >| == (_pop,1) enddef;
- def |<=primary n == ``n,(_push,0) enddef;
+ def >>primary n == (_chg_env,n) enddef;
+ def ~~primary n == (_tmp_line,n) enddef;
+ def :>primary n == (_tmp_env,n) enddef;
+ tertiarydef a^b == if known b:: ^^b,a else:: _nop,a fi enddef;
+ tertiarydef a`b == if known b:: '`b,a else:: _nop,a fi enddef;
+ tertiarydef a~b == if known b:: ~~b,a else:: _nop,a fi enddef;
+ tertiarydef a>b == if known b:: :>b,a else:: _nop,a fi enddef;
+ def # == _connect_at enddef;
+ def @ == _jump_at enddef;
+ def \ == @,0 enddef;
+ def \\ == \~dm enddef;
+ def *\ == \~wf enddef;
+ def \* == \~zf enddef;
+ def *\* == \~wv enddef;
+ def |: == (_push,0) enddef;
+ def :| == (_pop,0) enddef;
+ def |< == (_push,1) enddef;
+ def >| == (_pop,1) enddef;
def |=primary n == (_push,0),``n enddef;
- def =| == (_pop,0) enddef;
- def | == (_push,2) enddef; def || == (_pop,2) 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 == (_postF,n) enddef; def */*secondary n == (_postG,n) enddef;
+ def =| == (_pop,0) enddef;
+ def | == (_push,2) enddef;
+ def || == (_pop,2) enddef;
+ def /secondary n == if known n:: (_postA,n) else:: _nop fi enddef;
+ def //secondary n == if known n:: (_postB,n) else:: _nop fi enddef;
+ def */secondary n == if known n:: (_postC,n) else:: _nop fi enddef;
+ def /*secondary n == if known n:: (_postD,n) else:: _nop fi enddef;
+ def **secondary n == if known n:: (_postF,n) else:: _nop fi enddef;
+ def */*secondary n == if known n:: (_postG,n) else:: _nop fi enddef;
enddef;
%=================================================================================================
vardef '(text TXT)= ''(incr sub_usr)(TXT); sub_usr enddef;
%-------------------------------------------------------------------------------------------------
def ''(expr ADR)(text TXT)=
begingroup
+ save list_cnt;
if unknown inside_def_MC:: set_def_MC fi
- cntD[ADR]:=0;
+ cntD[ADR]:=list_cnt:=0;
for list==TXT::
+ list_cnt:=list_cnt+1;
if known list::
if pair list::
cntD[ADR]:=cntD[ADR]+1;
comD[ADR][cntD[ADR]]:=xpart(list);
parD[ADR][cntD[ADR]]:=ypart(list);
elseif numeric list::
- if list>=sub_emb_start::
+ if list==_nop::
+ message "unknown command in "AND decimal(list_cnt);
+ elseif list>=sub_emb_start::
for i==1 upto cntD[list]::
cntD[ADR]:=cntD[ADR]+1;
comD[ADR][cntD[ADR]]:=comD[list][i];
@@ -342,6 +387,8 @@ def ''(expr ADR)(text TXT)=
comD[ADR][cntD[ADR]]:=_set_atom;
parD[ADR][cntD[ADR]]:=str_cnt;
fi
+ else::
+ message "unknown command in "AND decimal(list_cnt);
fi
endfor
endgroup
@@ -350,13 +397,23 @@ enddef;
vardef '''(text TXT)=
sub_int:=sub_int+1;
cntD[sub_int]:=0;
- 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;
- elseif pair list::
- comD[sub_int][cntD[sub_int]]:=xpart(list);
- parD[sub_int][cntD[sub_int]]:=ypart(list);
+ for list==TXT::
+ if known list::
+ if numeric list::
+ if list==_nop::
+ message "unknown command in "AND decimal(sub_int);
+ else::
+ cntD[sub_int]:=cntD[sub_int]+1;
+ comD[sub_int][cntD[sub_int]]:=_numeric;
+ parD[sub_int][cntD[sub_int]]:=list;
+ fi
+ elseif pair list::
+ cntD[sub_int]:=cntD[sub_int]+1;
+ comD[sub_int][cntD[sub_int]]:=xpart(list);
+ parD[sub_int][cntD[sub_int]]:=ypart(list);
+ fi
+ else::
+ message "unknown command in "AND decimal(sub_int);
fi
endfor
sub_int %------- Retern value -------
@@ -852,7 +909,7 @@ def post_put=
begingroup
save nA;
if f_at=1: nA:=getA(adrT); check_adrA(nA); else: nA:=cntA+1; fi
- cntP:=cntP+1; ps_adr[cntP]:=nA; ps_com[cntP]:=par; op_cnt[cntP]:=0;
+ cntP:=cntP+1; ps_adr[cntP]:=nA; 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
@@ -997,6 +1054,7 @@ def proc_bond_atom(expr n)=
ef nC=_set_colorB: colorB[getB(adrT)]:=par;
ef nC=_set_and: andAT:=par;
ef nC=_chg_charge: andA[getA(par)]:=andAT; andAT:=0; if rotT<>0: and_rot[getA(par)]:=rotT; fi
+ else:
fi
endfor
enddef;
@@ -1056,6 +1114,7 @@ def proc_skeleton=
ef nC=_cyc_sB: f_end:=1; proc_cyc(sB[getB(par)]);
ef nC=_cyc_eB: f_end:=1; proc_cyc(eB[getB(par)]);
ef nC=_term: termB;
+ else:
fi
endfor
endgroup