diff options
author | Karl Berry <karl@freefriends.org> | 2021-05-23 20:34:20 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-05-23 20:34:20 +0000 |
commit | 270a202f205080a02a29dcdc70cb3980354a2115 (patch) | |
tree | 1cbea55d28e51497e7f92e978195c38930b8c5d7 /Master/texmf-dist/metapost | |
parent | ec6c34fd023b90e10ec4260b7dc211fd670957f6 (diff) |
mcf2graph (23may21)
git-svn-id: svn://tug.org/texlive/trunk@59314 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r-- | Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf | 75 |
1 files changed, 53 insertions, 22 deletions
diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf index 38086f87eb5..9cf47d31f87 100644 --- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf +++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% mcf2graph ver 4.64 Copyright (c) 2013-2021 Akira Yamaji +% mcf2graph ver 4.65 Copyright (c) 2013-2021 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, @@ -37,7 +37,7 @@ % Set to use plain.mp (label,arrow,atom) : mpost -s labeloffset=2 FILENAME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tracingstats:=1; -message "* This is mcf2graph ver 4.64 2021.05.05"; +message "* This is mcf2graph ver 4.65 2021.05.23"; %------------------------------------------------------------------------------------------------- newinternal cntA,cntB,cntM,minX,minY,maxX,maxY,sftX,sftY,com,par,envT,envB,lenT,lineT,angT,rotT, crR,nA,nB,nC,nD,nE,nF,nS,nL,nR,nU,nP,xpos,ypos,markA,markB,saveA,saveB,bondL; @@ -60,7 +60,8 @@ numberA_start:=numberB_start:=1; numberA_end:=numberB_end:=4095; %------------------------------------------------------------------------------------------------- aux_max:=max_inf_num:=20; aux_delimiter:=";"; blank_str:= " "; dum:=(-4091,0); for i=1 upto aux_max: tag[i]:=""; endfor -None:=11; Info1:=21; Info2:=22; Info_t:=23; Report:=31; MOL2k:=41; MOL3k:=42; +None:=11; None_Info_t:=12; None_Mcode_t:=13; None_Info_Mcode_t:=14; None_Report_t:=15; +Info1:=21; Info2:=22; Info_t:=23; Report:=31; Report_t:=32; MOL2k:=41; MOL3k:=42; Mfont:=51; Mcode:=61; Mcode_t:=62; Info_Mcode_t:=63; %------------------------------------------------------------------------------------------------- a_prn_s:=ASCII("("); a_prn_e:=ASCII(")"); a_brc_s:=ASCII("{"); a_brc_e:=ASCII("}"); @@ -94,6 +95,7 @@ def warning(expr s)= message "% "&decimal(char_num)&fdr(3)(incr warning_cnt)&")" if (known green)and(known ahlength): f_MP:=1; color color_list[]; + for i=1 upto 100: colorA[i]:=colorB[i]:=0; endfor prologues:=3; mpfont:="uhvr8r"; atomfont:=defaultfont:=""; @@ -116,7 +118,7 @@ if (known green)and(known ahlength): elseif ahlength=8: sw_output:=Mcode; % output aux mc fi %-- default bboxmargin=2------------------------------------------------------------------ - if bboxmargin=1: proc_end:=1; fi % output first font only + if bboxmargin=1: proc_end:=1; fi % output first font only %--default labeloffset=3------------------------------------------------------------------ if labeloffset=1: defaultfont:=mpfont; % mpost label elseif labeloffset=2: defaultfont:=atomfont:=mpfont; % mpost label,atom @@ -299,7 +301,10 @@ def beginfont(text s)= enddef; %================================================================================================== def endfont= - if ((sw_output=0)or(sw_output=None))and(f_EOF=0): + %-------------------------------------------------------------------------------------------- + if f_EOF=0: + %-------------------------------------------------------------------------------------------- + if sw_output<=None_Report_t: if cntM>=1: if sw_ext_all=1: ext_to_font(EXT_ALL); fi if sw_trimming>=1: @@ -343,20 +348,29 @@ def endfont= %----------------------------------------------------------------------------------------- endchar; clearit; + %----------------------------------------------------------------------------------------- + if sw_output=None_Info_t: proc_info_out(3); + ef sw_output=None_Mcode_t: proc_mc_out(2); + ef sw_output=None_Info_Mcode_t: proc_info_out(3); proc_mc_out(2); + ef sw_output=None_Report_t: proc_report_out(2); + fi + %----------------------------------------------------------------------------------------- + ef sw_output=Info1: proc_info_out(1); + ef sw_output=Info2: proc_info_out(2); + ef sw_output=Info_t: proc_info_out(3); + ef sw_output=Mcode: proc_mc_out(1); + ef sw_output=Mcode_t: proc_mc_out(2); + ef sw_output=Mfont: proc_mf_out(0); + ef sw_output=Report: proc_report_out(1); + ef sw_output=Report_t: proc_report_out(2); + ef sw_output=MOL2k: proc_mol_out(1); + ef sw_output=MOL3k: proc_mol_out(2); + ef sw_output=Info_Mcode_t: proc_info_out(3); proc_mc_out(2); + fi %----------------------------------------------------------------------------------------------- %% message "* parts_cnt (0)="& decimal(parts_cnt) &" "& decimal(parts_usr-parts_usr_start); %% message "* parts_int (0)="& decimal(parts_int) &" "& decimal(parts_int-parts_int_start); %----------------------------------------------------------------------------------------------- - ef sw_output=Info1: proc_info_out(1); - ef sw_output=Info2: proc_info_out(2); - ef sw_output=Info_t: proc_info_out(3); - ef sw_output=Mcode: proc_mc_out(1); - ef sw_output=Mcode_t: proc_mc_out(2); - ef sw_output=Mfont: proc_mf_out(0); - ef sw_output=Report: proc_report_out(0); - ef sw_output=MOL2k: proc_mol_out(1); - ef sw_output=MOL3k: proc_mol_out(2); - ef sw_output=Info_Mcode_t: proc_info_out(3); proc_mc_out(2); fi %----------------------------------------------------------------------------------------------- restore_par(parameter_list); @@ -370,7 +384,9 @@ def pickup_data_unit(expr t,v)= f_end:=data_unit_cnt:=semicol_cnt:=cond:=at_semicol[0]:=inf_num:=0; if t="n": n_var:=scantokens(v); fi forever: - temps:=readfrom file_name_input; if temps=EOF: f_EOF:=1; fi exitif temps=EOF; + temps:=readfrom file_name_input; + if temps=EOF: f_EOF:=1; fi + exitif temps=EOF; if subc(1,temps)="%": ef subc(1,temps)="+": data_unit_cnt:=data_unit_cnt+1; @@ -380,7 +396,10 @@ def pickup_data_unit(expr t,v)= fi if cond=1: forever: - temps:=readfrom file_name_input; exitif temps=EOF; exitif subc(1,temps)="+"; + temps:=readfrom file_name_input; + if temps=EOF: f_EOF:=1; fi + exitif temps=EOF; + exitif subc(1,temps)="+"; mc_row:=mc_row+1; n_fw:=scan_char(" ",temps,1,1); mc_indent[mc_row]:=n_fw-1; @@ -390,7 +409,10 @@ def pickup_data_unit(expr t,v)= f_end:=1; else: forever: - temps:=readfrom file_name_input; exitif temps=EOF; exitif subc(1,temps)="+"; + temps:=readfrom file_name_input; + if temps=EOF: f_EOF:=1; fi + exitif temps=EOF; + exitif subc(1,temps)="+"; endfor fi else: @@ -853,7 +875,7 @@ def MC(text TXT)= if (sw_expand=1)or(sw_output=MOL2k)or(sw_output=MOL3k): expand_set; crR:=1; else: crR:=-ratio_chain_ring; fi - cntA:=cntB:=cnt_group:=cntC:=0; strD[0]:="C"; str_cnt:=2000; + cntA:=cntB:=cntC:=cnt_group:=0; strD[0]:="C"; str_cnt:=2000; %----------------------------------------------------------------------------------------------- font_wd:=xpart(fsize); font_ht:=ypart(fsize); @@ -952,6 +974,12 @@ def MC(text TXT)= clearit; endgroup; if sw_output>0: proc_calc(0); fi + if cntC>0: + for i=1 upto cntA: + if colorA[i]<>0: colorA[i]:=0; fi + if colorB[i]<>0: colorB[i]:=0; fi + endfor + fi enddef; %------------------------------------------------------------------------------------------------- def add_group= @@ -1105,7 +1133,6 @@ def add_atom(expr n)= if f_bra=0: cntA:=cntA+1; sB[cntB]:=cntA; numS[cntA]:=strAT; addA[cntA]:=addAT; addAT:=strAT:=add_rot[cntA]:=0; if rotT<>0: add_rot[cntA]:=rotT; rotT:=0; fi - if f_MP=1: colorA[cntA]:=colorB[cntA]:=0; fi else: f_bra:=0; fi if n=0: eB[cntB]:=cntA+1; f_term:=0; else: eB[cntB]:=n; f_term:=1; fi enddef; @@ -1187,7 +1214,6 @@ def termA= if f_bra=0: cntA:=cntA+1; numS[cntA]:=strAT; addA[cntA]:=addAT; add_rot[cntA]:=rotT; addAT:=strAT:=rotT:=0; - if f_MP=1: colorA[cntA]:=0; fi else: f_bra:=0; fi f_term:=1; @@ -1653,7 +1679,9 @@ enddef; %================================================================================================= def proc_report_out(expr n)= message "["&decimal(char_num)&"]:"&inf_EN; - file_name_output:=jobname&"-report.txt"; + if n=2: file_name_output:="temp-report.aux"; + else: file_name_output:=jobname&"-report.txt"; + fi printf "==========================================================================="; printf " No."&fdr(4)(char_num)&" / Name = "& inf_EN&" / file = "& file_name_input; if mc_row>=1: @@ -1711,6 +1739,7 @@ def proc_report_out(expr n)= printf " Fomula Calc: "&cal_FM&" / Input: " if inf_FM<>"-": &inf_FM&" / "& iif(inf_FM=cal_FM,"MACTCH","NOT MACTCH") fi; printf "==========================================================================="; + if n=2: printf EOF; fi enddef; %------------------------------------------------------------------------------------------------- vardef round_auto(expr n)= @@ -2002,7 +2031,9 @@ vardef check(expr s)= for i=1 upto err_cnt: message "*"&fdr(3)(i)&" "&err_type[err_code[i]]&fdr(4)(err_adr[i])&" '"&err_str[i]&"'"; endfor + %--------------------------------------------------------------------------------------------- %%%%%%% if (f_MP=1)and(err_cnt>0): readstring; fi + %--------------------------------------------------------------------------------------------- err_cnt enddef; %------------------------------------------------------------------------------------------------- |