From d291f73c830f767b003eabd72656e171ef0e4597 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 20 Sep 2021 20:04:12 +0000 Subject: mcf2graph (20sep21) git-svn-id: svn://tug.org/texlive/trunk@60565 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/metapost/mcf2graph/CHANGELOG | 14 +- Master/texmf-dist/doc/metapost/mcf2graph/README | 19 +- .../doc/metapost/mcf2graph/mcf_data_base.mcf | 10 +- .../doc/metapost/mcf2graph/mcf_exa_soc.mf | 27 +- .../doc/metapost/mcf2graph/mcf_example.pdf | Bin 314296 -> 314077 bytes .../doc/metapost/mcf2graph/mcf_example.tex | 4 +- .../doc/metapost/mcf2graph/mcf_man_soc.mf | 8 +- .../doc/metapost/mcf2graph/mcf_manual.pdf | Bin 383098 -> 344886 bytes .../doc/metapost/mcf2graph/mcf_manual.tex | 85 +-- .../doc/metapost/mcf2graph/mcf_mplib_exa.pdf | Bin 184493 -> 184158 bytes .../doc/metapost/mcf2graph/mcf_mplib_exa.tex | 22 +- Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf | 617 +++++++++++---------- .../texmf-dist/tex/latex/mcf2graph/mcf_setup.sty | 5 +- 13 files changed, 440 insertions(+), 371 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/CHANGELOG b/Master/texmf-dist/doc/metapost/mcf2graph/CHANGELOG index bb647d91458..4ed3c84848c 100644 --- a/Master/texmf-dist/doc/metapost/mcf2graph/CHANGELOG +++ b/Master/texmf-dist/doc/metapost/mcf2graph/CHANGELOG @@ -1,6 +1,18 @@ ******************************************************************************* - Changelog of mcf2graph software package by Akira Yamaji 2021-09-05 + Changelog of mcf2graph software package by Akira Yamaji 2021-09-20 ******************************************************************************* +[ver. 4.72 / 2021-09-20] + -change syntax of beginfont() + keep file open 'f+' => 'v+' + enable to use default input file name + -change syntax of query() + input file name 'i:' => 'f:' + -fix bug in beginfont(),endfont + -fix bug in query() + -fix bug in expand mode + -update mcf_data_base.mcf + -update MCF manual,example + [ver. 4.71 / 2021-09-05] -add function query() for data base file -update mcf_data_base.mcf diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/README b/Master/texmf-dist/doc/metapost/mcf2graph/README index 1fe6d2a6321..aa2aee88f55 100644 --- a/Master/texmf-dist/doc/metapost/mcf2graph/README +++ b/Master/texmf-dist/doc/metapost/mcf2graph/README @@ -1,7 +1,7 @@ ******************************************************************************** mcf2graph : Convert Molecular Coding Format to graphics with METAFONT/METAPOST Author : Akira Yamaji - version : 4.71 2021-09-05 + version : 4.72 2021-09-20 E-mail : mcf2graph@gmail.com Located at : http://www.ctan.org/pkg/mcf2graph ******************************************************************************** @@ -26,7 +26,7 @@ make file 'mcf_man_soc-***.mps' before typeset >mpost mcf_man_soc.mf ( 7) mcf_man_soc.mf Molecular definition file for mcf_manual.tex - ( 8) mcf_manual.pdf PDF of (4) (used pdftex(LaTeX),makeindex) + ( 8) mcf_manual.pdf PDF of (6) (used pdftex(LaTeX),makeindex) ( 9) mcf_example.tex LaTeX example make file 'mcf_exa_soc-info.aux' before typeset >mpost -s ahlength=1 mcf_exa_soc.mf @@ -36,9 +36,9 @@ make file 'mcf_exa_soc-mf.aux' before typeset >mpost -s ahlength=7 mcf_exa_soc.mf (10) mcf_exa_soc.mf Metafont/Metapost souce file for mcf_example.tex - (11) mcf_example.pdf PDF of (8) typeset with pdftex(LaTeX) + (11) mcf_example.pdf PDF of (9) typeset with pdftex(LaTeX) (12) mcf_mplib_exa.tex luamplib(LuaLaTeX) example - (13) mcf_mplib_exa.pdf PDF of (11) typeset with LuaTeX(LaTeX) + (13) mcf_mplib_exa.pdf PDF of (12) typeset with LuaTeX(LaTeX) 3. How to use mcf2graph with Metapost Minimum requirement to use mcf2graph : mpost.exe,mpost.dll,mpost.mp,plain.mp @@ -48,17 +48,18 @@ ( 4) >mpost -s ahangle=11 FILENAME => output png file (1200dpi) ( 5) >mpost -s ahangle=2 FILENAME => output svg file ( 6) >mpost -s ahangle=3 FILENAME => output eps(.eps) file - ( 7) >mpost -s ahlength=1 FILENAME => output info-aux file + ( 7) >mpost -s ahlength=1 FILENAME => output information-aux file tag1:var1;tag2:var2; - ( 8) >mpost -s ahlength=2 FILENAME => output aux file + ( 8) >mpost -s ahlength=2 FILENAME => output information-aux file tag1;tag2; var1;var2; ( 9) >mpost -s ahlength=3 FILENAME => output report file (10) >mpost -s ahlength=5 FILENAME => output mol file(V2000) (11) >mpost -s ahlength=6 FILENAME => output mol file(V3000) - (12) >mpost -s ahlength=7 FILENAME => output mf-aux file - (13) >mpost -s labeloffset=1 FILENAME => use plain.mp 'label','drawarrow' - (14) >mpost -s labeloffset=2 FILENAME => atomfont="uhvr8r" + (12) >mpost -s ahlength=7 FILENAME => output metafont-aux file + (13) >mpost -s ahlength=8 FILENAME => output data-base-aux file + (14) >mpost -s labeloffset=1 FILENAME => use plain.mp 'label','drawarrow' + (15) >mpost -s labeloffset=2 FILENAME => atomfont="uhvr8r" 4. License Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_data_base.mcf b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_data_base.mcf index cb535a710fd..8d415675701 100644 --- a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_data_base.mcf +++ b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_data_base.mcf @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% molecular data base file mcf_data_base.mcf by Akira Yamaji 2021.09.05 +% molecular data base file mcf_data_base.mcf by Akira Yamaji 2021.09.20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % tag1:var1;tag2:var2;tag3:var3 ..... % first character of line "%" comment out @@ -36,6 +36,10 @@ Cat:biological;EN:Glycine;MW:75.07;EXA:- + <30,NH2,!2,COOH +------------------------------------------------------------------------------ +Cat:biological;EN:Glycine;MW:75.07;EXA:- ++ +<30,NH2,!2,COOH ++------------------------------------------------------------------------------ Cat:biological;EN:L-Alanine;MW:89.10;EXA:- + <30,NH2,!~wb,/_,!,COOH @@ -46,9 +50,9 @@ Cat:biological;EN:L-Valine;MW:117.15;EXA:- +------------------------------------------------------------------------------ Cat:biological;EN:L-Leucine;MW:131.16;EXA:1 + -<30,NH2,!~wb,/'(!,?!),!,COOH +<30,NH2,!~wb,/!?!,!,COOH +------------------------------------------------------------------------------ -Cat:biological;EN:L-Isoleucine;MW:131.16;EXA:- +Cat:biological;EN:L-Isoleucine;MW:131.16;EXA:9 + <30,NH2,!~wb,/'(/*_,!2),!,COOH +------------------------------------------------------------------------------ diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_exa_soc.mf b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_exa_soc.mf index 5f0d263bbb6..b5513ffbf03 100644 --- a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_exa_soc.mf +++ b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_exa_soc.mf @@ -1,8 +1,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Molecular Coding Format for mcf_example.tex by Akira Yamaji 2021.09.05 +% Molecular Coding Format for mcf_example.tex by Akira Yamaji 2021.09.20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -input mcf2graph.mf; %%% it must be version 4.71 -message "* mcf_exa_soc 2021.09.05"; +input mcf2graph.mf; %%% it must be version 4.72 +message "* mcf_exa_soc 2021.09.20"; message ""; %------------------------------------------------------------------------------ fsize:=(35mm,24mm); @@ -21,18 +21,19 @@ tag1:="J"; tag2:="C"; tag3:="fm"; tag4:="mw"; tag5:="EN"; tag6:="MW"; if f_MP=0: input mcf_exa_soc-mf.aux; % (metafont) make aux file before typeset else: % mpost -s ahlength=7 mcf_exa_soc.mf %------------------------------------------------------------------------------ -%%%%%query("Cat=biological","MW<150","s:MW"); -%%%%%query("Cat=biological","MW<150.0","s:EN"); -%%%%%query("MW>=150","MW<=300","s:MW"); -%%%%%query("i:mcf_data_base","o:temp","s:MW","s:EN"); +%%%%query("Cat=biological","MW<200","s:MW"); +%%%%query("Cat=biological","MW<150.0","s:EN"); +%%%%query("MW>=150","MW<=200","s:MW"); %****************************************************************************** +%%%% beginfont("t:EN","v:Caffeine") % select EN=Caffeine forever: -%%%%%%% beginfont("f+:temp","v:*") % use query output -%%%%%%% beginfont("f+:mcf_data_base","v:*") % select all - beginfont("f+:mcf_data_base","t:EXA","v:1") % 'f+'=keep file open - if f_EOF=0: if check(mc)=0: MC(scantokens(mc)) fi fi % 'v:1' select EXA=1 - endfont % - exitif (f_EOF=1)or(f_close=1); % exit if file end +%%%% beginfont("f:mcf_data_base","v+:*") % 'mcf_data_base.mcf'(default) +%%%% beginfont("f:temp","v+:*") % use query output +%%%% beginfont("v+:*") % select all + beginfont("t:EXA","v+:1") % 'v+:1': select EXA=1 + if f_EOF=0: if check(mc)=0: MC(scantokens(mc)) fi fi + endfont + exitif f_EOF=1; % exit if file end endfor %****************************************************************************** fi diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.pdf b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.pdf index 7ed3fd35fae..6d2b88c7e0f 100644 Binary files a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.pdf and b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.pdf differ diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.tex b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.tex index 46401394dd3..a61439d39b5 100644 --- a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.tex +++ b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.tex @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Example of MCF typeset by LaTeX mcf_examples.tex by A.Yamaji 2021.08.01 +% Example of MCF typeset by LaTeX mcf_examples.tex by A.Yamaji 2021.09.20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \documentclass[a4paper]{article} \usepackage{graphicx} @@ -10,7 +10,7 @@ %-------------------------------- %%%%\pdfpkresolution=1200 %-------------------------------- -%%%%\edef\f@ext{pk}% +%%%%%\edef\f@ext{pk}% \edef\f@ext{mps}% %-------------------------------- \pagestyle{empty} diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_man_soc.mf b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_man_soc.mf index c9339f4fad7..3b5e2ce3073 100644 --- a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_man_soc.mf +++ b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_man_soc.mf @@ -1,9 +1,9 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Molecular Coding Format file for mcf_manual.tex by Akira.Yamaji 2021.09.05 +% Molecular Coding Format file for mcf_manual.tex by Akira.Yamaji 2021.09.20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -input mcf2graph.mf; %% it must be version 4.71 +input mcf2graph.mf; %% it must be version 4.72 % ** use data base file 'mcf_data_base.mcf' -message "mcf_man_soc 2021.09.05"; message ""; +message "mcf_man_soc 2021.09.20"; message ""; %------------------------------------------------------------------------ sw_mframe:=0; sw_expand:=0; @@ -1240,7 +1240,7 @@ beginfont("EN:?6") endfont defaultsize:=save_defaultsize; %*************************************************************************** -beginfont("f:mcf_data_base","t:EN","v:Luciferin") +beginfont("t:EN","v:Luciferin") fsize:=(50mm,15mm); if check(mc)=0: MC(scantokens(mc)) fi endfont diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.pdf b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.pdf index 58e5597e797..070738c2345 100644 Binary files a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.pdf and b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.pdf differ diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.tex b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.tex index dceb5999f31..59745ac19ad 100644 --- a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.tex +++ b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.tex @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Molecular Coding Format manual by Akira Yamaji 2021.09.05 +% Molecular Coding Format manual by Akira Yamaji 2021.09.20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \documentclass[a4paper]{article} \usepackage[pdftex]{graphicx} @@ -7,8 +7,8 @@ \usepackage{makeidx} \makeindex \hypersetup{colorlinks=true,linkcolor=blue} -\makeatletter \usepackage{mcf_setup} +\edef\MCFjobname{mcf_man_soc}% %---------------------------------------------------------------------------- %%%%\pdfpkresolution=1200 %---------------------------------------------------------------------------- @@ -38,7 +38,7 @@ \htmans=42mm% \fnum=1% %---------------------------------------------------------------------------- -\edef\MCFjobname{mcf_man_soc}% +\makeatletter %---------------------------------------------------------------------------- \font\@strufont=\MCFjobname\relax% %---------------------------------------------------------------------------- @@ -52,7 +52,7 @@ \fi% \global\advance\fnum\@ne\relax% }% -%--------------------------------------------------------------------------- +%---------------------------------------------------------------------------- \def\put@char{% \begin{picture}(75,100)% \put(0,95){\bf [\NO]\EN}% @@ -1542,27 +1542,27 @@ beginfont("EN:Cholesterol","MW:386.65", >information if check(mc)=0: MC(scantokens(mc)) fi > mc=mc1 - mc4 endfont > %------------------------------------------------------------------------------ -beginfont("f:mcf_data_base","t:EN","v:Adenine") > from mcf_data_base.mcf +beginfont("f:mcf_data_base.mcf","t:EN","v:Adenine") > from mcf_data_base.mcf if check(mc)=0: MC(scantokens(mc)) fi > select EN="Adenine" endfont > %------------------------------------------------------------------------------ -beginfont("f:mcf_data_base","t:EN","v:Guanine") > from mcf_data_base.mcf - if check(mc)=0: MC(scantokens(mc)) fi > select EN="Guanine" +beginfont("t:EN","v:Guanine") > select EN="Guanine" + if check(mc)=0: MC(scantokens(mc)) fi endfont %------------------------------------------------------------------------------ -beginfont("f:mcf_data_base","t:EN","v:Cytosine") > from mcf_data_base.mcf - if check(mc)=0: MC(scantokens(mc)) fi > select EN="Cytosine" +beginfont("t:EN","v:Cytosine") > select EN="Cytosine" + if check(mc)=0: MC(scantokens(mc)) fi > endfont > %------------------------------------------------------------------------------ -beginfont("f+:mcf_data_base","t:n","v:4") > from mcf_data_base.mcf - if check(mc)=0: MC(scantokens(mc)) fi > v:4 select No.4 -endfont > 'f+' keep file open +beginfont("t:n","v+:4") > v+:4 = select No.4 + if check(mc)=0: MC(scantokens(mc)) fi > keep file open +endfont > %------------------------------------------------------------------------------ forever: -%%%%%%%%%% beginfont("f+:mcf_data_base","v:*") > select all - beginfont("f+:mcf_data_base","t:EXA","v:1") > 'f+'=keep file open - if f_EOF=0: if check(mc)=0: MC(scantokens(mc)) fi fi > 'v:1' select EXA=1 - endfont > +%%%%%%%%%% beginfont("f:mcf_data_base","v+:*") > select all + beginfont("f:mcf_data_base","t:EXA","v+:1") > 'v+:1'= select EXA=1 + if f_EOF=0: if check(mc)=0: MC(scantokens(mc)) fi fi > keep file open + endfont > exitif (f_EOF=1)or(f_close=1); > exit if file end endfor %------------------------------------------------------------------------------ @@ -1639,25 +1639,25 @@ Cat:biological;EN:Linoleic acid;MW:280.45 %-------------------------------------------------------------- % query() % -% "i:filename" : input file name (default "mcf_data_base.mcf") +% "f:filename" : input file name (default "mcf_data_base.mcf") % "o:filename" : output file name (default "temp.mcf") % "s:sort-key" : sort by sort-key % -% = , <> , <= , >= , < , > +% operator : = , <> , <= , >= , < , > % -% filter 1 : Cat=biological -% filter 2 : MW>=285 -% filter 3 : MW<=295 +% filter 1 : Cat=biological +% filter 2 : MW>=285 +% filter 3 : MW<=295 %-------------------------------------------------------------- query("s:EN", -%%%%% "i:mcf_data_base.mcf","o:temp.mcf","s:EN", +%%%%% "f:mcf_data_base.mcf","o:temp.mcf","s:EN", "Cat=biological","MW>=285","MW<=295"); %-------------------------------------------------------------- forever: - beginfont("f+:temp","v:*") % use file temp.mcf / select all + beginfont("f:temp","v+:*") % use file temp.mcf / select all if f_EOF=0: if check(mc)=0: MC(scantokens(mc)) fi fi endfont - exitif (f_EOF=1)or(f_close=1); + exitif f_EOF=1; endfor %--------------------------------------------------------------- \end{verbatim} @@ -1713,6 +1713,7 @@ Cat:biological;EN:Piperine;MW:285.343;EXA:1 sw_output:=Info; %% tag1:var1;tag2:var2 sw_output:=Info+Table; %% tag1;tag2 var1;var2 sw_output:=Info+Temp; %% tag1:var1;tag2:var2 / output 'temp-info.aux' + sw_output:=Info+Mcode; %% output jobname&'.aux' sw_output:=Info+Mcode+Temp; %% output 'temp-info.aux','temp-mc.aux' sw_output:=Font+Info+Temp; %% output font,'temp-info.aux','temp-mc.aux' \end{verbatim} @@ -1843,29 +1844,42 @@ endfont \index{Mcode}% \index{Temp}% \begin{verbatim} -sw_output:=Mcode; +sw_output:=Mcode; %% output 'jobname-nnn-EN-mc.aux' sw_output:=Mcode+Temp; %% output 'temp-mc.aux' +sw_output:=Info+Mcode; %% output 'jobname-data.aux' sw_output:=Info+Mcode+Temp; %% output 'temp-info.aux','temp-mc.aux' sw_output:=Font+Mcode+Temp; %% output font,'temp-mc.aux' sw_output:=Font+Info+Mcode+Temp; %% output font,'temp-info.aux','temp-mc.aux' \end{verbatim} \paragraph{(Command line)} \begin{verbatim} - >mpost -s ahlength=8 FILENAME (sw_output=Mcode) + >mpost -s ahlength=8 FILENAME (sw_output=Info+Mcode) \end{verbatim} -\paragraph{(file name)} +\paragraph{(Output temporary file)} \begin{verbatim} sw_output=Mcode ** file name = 'jobname-nnn-EN-mc.aux' sw_output=Mcode+Temp ** file name = 'temp-mc.aux' (result) <30,?6,3=?5,{1,3,5,9}=dl,{2,6,9}:N,5:/NH2,7:NH + +\end{verbatim} +\paragraph{(Output data-base file)} +\begin{verbatim} +sw_output=Mcode+Info ** file name = 'jobname-data.aux' + +(result) +Cat:biological;EN:Adenine;MW:135.13;EXA:1 ++ +<30,?6,3=?5,{1,3,5,9}=dl,{2,6,9}:N,5:/NH2,7:NH ++-------------------------------------------------- + \end{verbatim} %------------------------------------------------------------------------ \paragraph{(Lualatex example)} %----------------------------------------------------------------------- \begin{verbatim} -beginfont("f:mcf_data_base","t:EN","v:Adenine") +beginfont("t:EN","v:Adenine") sw_output:=Mcode+Temp; endfont \end{verbatim} @@ -1873,7 +1887,7 @@ endfont \begin{verbatim} %----------------------------------------------------------------------- \begin{mplibcode} - beginfont("f:mcf_data_base","t:EN","v:Vancomycin") + beginfont("t:EN","v:Vancomycin") sw_output:=Mcode+Temp; %%%% output temp-mc.aux %%%% endfont; \end{mplibcode} @@ -1884,17 +1898,12 @@ endfont %----------------------------------------------------------------------- \begin{verbatim} (result) - file name = 'temp-mc.aux' -<-30,#1,!12,{1,3,12}=zf,7=wf,/H^-60,60,*/OH,60, - Ph,-4:/Cl,@-3,\,O,!,Ph,@-4,\,O,!,Ph,-1^15:/Cl,@-3,\,/*OH,*/H^-60,&1, - @7,&26,@$1,60,//O,60,NH,60,/*H,*/COOH^180,-60, - Ph,{-2,-4}:/OH,@-1,\,Ph,-5:/OH,@-2,&4,##, - {3^40,6,9,12}://O,{2,5,8,11}:NH,{1,4^180}:*/H,{7^-60,10^60,14^60}:/*H, - @10,*\^-60,60,//O,!,NH2,@13,*\,NH,!,//O,!,/??!,*/H^60,!~zf,NH,!, - @23,\,O,!,|,?6`.7,2:O,3^10:/!OH,{4,5}:/OH, - @-1,\,O,!,|,?6`.7,6:O,{3^35,5}:/_,3^-35:/NH2,4:/OH +<30,?6,@4,?6,@-4,\,!3,<-12,?5,@-3,<-12,?6,-3=?6,@-3,*\,!3, + ?6,@-4,?6,@6,\,!,/*Me^-40,*/OH^20,!,//O,!1,OH, + 3=wb,11=dl,15=dr,17=wf,19=wf,38=wb,{5,7,16,24,25,33,42}:O, + 32:*/H^60,10:/Me,{12,31}:*/_,27://_,37:/*_,28:/OH,{3,29}:/*OH \end{verbatim} %------------------------------------------------------------------------ \newpage diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.pdf b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.pdf index 0e527592ebf..cb28688db61 100644 Binary files a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.pdf and b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.pdf differ diff --git a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.tex b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.tex index 825152629b1..b204383651a 100644 --- a/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.tex +++ b/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.tex @@ -1,7 +1,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Example of MCF typest with LuaLaTeX(luamplib) by A.Yamaji 2021.09.05 +% Example of MCF typest with LuaLaTeX(luamplib) by A.Yamaji 2021.09.20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% ** mcf2graph.mf must be version 4.71 +% ** mcf2graph.mf must be version 4.72 % ** use mcf_data_base.mcf \documentclass{article} %------------------------------------------------------------------------------ @@ -14,7 +14,7 @@ \everymplib{% if unknown Ph1: input mcf2graph.mf; fi outputformat:="eps"; - sw_output:=Font; + sw_output:=Font+Info+Temp; tag1:="J"; tag2:="C"; tag3:="fm"; tag4:="mw"; tag5:="EN"; tag6:="MW"; max_blength:=4.5mm; defaultfont:="uhvr8r"; @@ -47,7 +47,7 @@ \subsection{Chlorophyll a} \noindent% \begin{verbatim} -beginfont("f:mcf_data_base","t:EN","v:Chlorophyll a","NO:-", +beginfont("f:mcf_data_base.mcf","t:EN","v:Chlorophyll a","NO:-", ":,||,{4,11,17,23}:red,27:green") %%%% change color of atoms %%%% fsize:=(100mm,45mm); if check(mc)=0: MC(scantokens(mc)) fi @@ -59,7 +59,7 @@ endfont \end{verbatim} %------------------------------------------------------------------------------------ \begin{mplibcode} -beginfont("f:mcf_data_base","t:EN","v:Chlorophyll a","NO:-", +beginfont("f:mcf_data_base.mcf","t:EN","v:Chlorophyll a","NO:-", ":,||,{4,11,17,23}:red,27:green") %%%% change color of atoms %%%% fsize:=(100mm,45mm); if check(mc)=0: MC(scantokens(mc)) fi @@ -73,7 +73,7 @@ endfont \subsection{Dinophysistoxin-1} \noindent% \begin{verbatim} -beginfont("f:mcf_data_base","t:EN","v:Okadaic acid","EN:Dinophysistoxin-1", +beginfont("t:EN","v:Okadaic acid","EN:Dinophysistoxin-1", "MW:819",":,38:*/_,65=red") %%%% add methyl group (color red) %%%% fsize:=(150mm,35mm); if check(mc)=0: MC(scantokens(mc)) fi @@ -85,7 +85,7 @@ endfont; \end{verbatim} %---------------------------------------------------------------------------- \begin{mplibcode} -beginfont("f:mcf_data_base","t:EN","v:Okadaic acid","EN:Dinophysistoxin-1", +beginfont("t:EN","v:Okadaic acid","EN:Dinophysistoxin-1", "MW:819",":,38:*/_,65=red") %%%% add methyl group (color red) %%%% fsize:=(150mm,35mm); if check(mc)=0: MC(scantokens(mc)) fi @@ -198,13 +198,13 @@ endfont \begin{verbatim} %-------------------------------------------------------------------------------- \begin{mplibcode} - beginfont("f:mcf_data_base","t:EN","v:Maitotoxin") + beginfont("t:EN","v:Maitotoxin") sw_output:=Info+Mcode+Temp; %%%% output temp-info,temp-mc.aux %%%% endfont; \end{mplibcode} \verbatiminput{temp-mc.aux} %%%% input temp-mc.aux %%%% \begin{mplibcode} - beginfont("f:mcf_data_base","t:EN","v:Maitotoxin") + beginfont("t:EN","v:Maitotoxin") fsize:=(120mm,60mm); fmargin:=(0,3mm); sw_frame:=Outside; if check(mc)=0: MC(scantokens(mc)) fi %%%% output font %%%% endfont @@ -220,13 +220,13 @@ endfont \end{verbatim} %-------------------------------------------------------------------------------- \begin{mplibcode} - beginfont("f:mcf_data_base","t:EN","v:Maitotoxin") + beginfont("t:EN","v:Maitotoxin") sw_output:=Info+Mcode+Temp; %%%% output temp-info.aux %%%% if check(mc)=0: MC(scantokens(mc)) fi endfont \end{mplibcode} \begin{mplibcode} - beginfont("f:mcf_data_base","t:EN","v:Maitotoxin") + beginfont("t:EN","v:Maitotoxin") fsize:=(120mm,60mm); fmargin:=(0,3mm); sw_frame:=Outside; if check(mc)=0: MC(scantokens(mc)) fi %%%% output font %%%% endfont diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf index ff1cb14b3d0..2dfefbba648 100644 --- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf +++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% mcf2graph ver 4.71 Copyright (c) 2013-2021 Akira Yamaji +% mcf2graph ver 4.72 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, @@ -22,42 +22,44 @@ % This package is located at : http://www.ctan.org/pkg/mcf2graph % Suggestion or request mail to : mcf2graph@gmail.com %-------------------------------------------------------------------------------------------------- -% Set outputformat to "eps"(.mps) : mpost FILENAME -% Set output first font only : mpost -s bboxmargin=1 FILENAME -% Set outputformat to "png" : mpost -s ahangle=1 FILENAME -% Set outputformat to "svg" : mpost -s ahangle=2 FILENAME -% Set outputformat to "eps" (.eps) : mpost -s ahangle=3 FILENAME -% Set output aux file (tag1:var1;tag2:var2) : mpost -s ahlength=1 FILENAME -% Set output aux file (tag1;tag2 var1;var2) : mpost -s ahlength=2 FILENAME -% Set output report : mpost -s ahlength=3 FILENAME -% Set output MOL(V2000) : mpost -s ahlength=5 FILENAME -% Set output MOL(V3000) : mpost -s ahlength=6 FILENAME -% Set output aux file for metafont : mpost -s ahlength=7 FILENAME -% Set to use plain.mp (label,arrow) : mpost -s labeloffset=1 FILENAME -% Set to use plain.mp (label,arrow,atom) : mpost -s labeloffset=2 FILENAME +% Set outputformat to "eps"(.mps) : mpost FILENAME +% Set output first font only : mpost -s bboxmargin=1 FILENAME +% Set outputformat to "png" : mpost -s ahangle=1 FILENAME +% Set outputformat to "svg" : mpost -s ahangle=2 FILENAME +% Set outputformat to "eps" (.eps) : mpost -s ahangle=3 FILENAME +% Set output information aux file (tag1:var1;tag2:var2) : mpost -s ahlength=1 FILENAME +% Set output information aux file (tag1;tag2 var1;var2) : mpost -s ahlength=2 FILENAME +% Set output report : mpost -s ahlength=3 FILENAME +% Set output MOL file (V2000) : mpost -s ahlength=5 FILENAME +% Set output MOL file (V3000) : mpost -s ahlength=6 FILENAME +% Set output aux metafont file : mpost -s ahlength=7 FILENAME +% Set output aux data-base file : mpost -s ahlength=8 FILENAME +% Set to use plain.mp (label,arrow) : mpost -s labeloffset=1 FILENAME +% Set to use plain.mp (label,arrow,atom) : mpost -s labeloffset=2 FILENAME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tracingstats:=1; -message "* This is mcf2graph ver 4.71 2021.09.05"; +message "* This is mcf2graph ver 4.72 2021.09.20"; %------------------------------------------------------------------------------------------------- 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; numeric save_num[],comD[][],parD[][],adrD[][],cntD[],tbl_atom[],tbl_group[][],f_char[], tbl_atom_wt[],tbl_atom_mi[],tbl_char_wd[],tbl_char_ht[],addA[],add_rot[],chargeA[], com_group[][],par_group[][],cnt_group[],colorA[],colorB[],sumA[],bondC[],hideH[],lineB[], - sB[],eB[],angB[],angA[],lenB[],angX[],numS[],wdM[],htM[],wdA[],dxA[],cmm_adr[],mc_indent[]; + sB[],eB[],angB[],angA[],lenB[],angX[],numS[],wdM[],htM[],wdA[],dxA[], + cmm_adr[],mc_indent[],at_semicol[]; string save_str[],tbl_atom_str[],strD[],tag[],file_name_output,blank_str,aux_delimiter,atomfont, - default_data_file,default_temp_file,mpfont,s_tag,s_var,cal_FM,cal_MW,cal_MI, - inf_NO,inf_EN,inf_JN,inf_FM,inf_CAS,inf_USE,inf_EXA,inf_EXB,inf_MW; + temps,default_data_file,default_temp_file,mpfont,tag_s,var_s,cal_FM,cal_MW,cal_MI, + inf_Cat,inf_NO,inf_EN,inf_JN,inf_FM,inf_CAS,inf_USE,inf_EXA,inf_EXB,inf_MW; pair save_pair[],posA[],posM[][],msize,mposition,fsize,fmargin,save_mposition,posBs,posBe,dum; picture mol_stru[],atom_picture,save_picture,temp_picture; path arrow_path,dottedline_path,line_path,arrow_head; %------------------------------------------------------------------------------------------------- char_num:=str_cnt:=tbl_cnt:=proc_end:=mangle:=sw_expand:=sw_frame:=sw_trimming:=sw_ext_all:=0; -sw_abbreviate:=sw_arrow_emu:=sw_output:=sw_numbering:=0; numbering_start:=1; numbering_end:=4095; +sw_abbreviate:=sw_arrow_emu:=sw_numbering:=sw_output:=0; numbering_start:=1; numbering_end:=4095; %------------------------------------------------------------------------------------------------- aux_max:=max_inf_num:=20; aux_delimiter:=";"; blank_str:= " "; dum:=(-4091,0); for i=1 upto aux_max: tag[i]:=""; endfor -Font:=1; Temp:=2; Info:=4; Table:=8; Report:=16; MOL2k:=32; MOL3k:=64; Mfont:=128; Mcode:=256; +Font:=1; Mfont:=2; Mcode:=4; Temp:=8; Info:=16; Table:=32; Report:=64; MOL2k:=128; MOL3k:=256; Atom:=8; Bond:=16; Brock:=32; Inverse:=64; Group:=32; Mol:=64; Outside:=1; Inside:=2; Bothside:=Outside+Inside; %------------------------------------------------------------------------------------------------- @@ -110,11 +112,11 @@ if (known green)and(known ahlength): if ahlength=1: sw_output:=Info; % output aux file elseif ahlength=2: sw_output:=Info+Table; % output aux file(Table mode) elseif ahlength=3: sw_output:=Report; % output report - elseif ahlength=4: sw_output:=0; % *default + elseif ahlength=4: sw_output:=Font; % *default elseif ahlength=5: sw_output:=MOL2k; % output MOL(V2000) elseif ahlength=6: sw_output:=MOL3k; % output MOL(V3000) elseif ahlength=7: sw_output:=Mfont; % output aux mf - elseif ahlength=8: sw_output:=Mcode; % output aux mc + elseif ahlength=8: sw_output:=Mcode+Info; % output aux data-base fi %-- default bboxmargin=2------------------------------------------------------------------ if bboxmargin=1: proc_end:=1; fi % output first font only @@ -135,6 +137,31 @@ if (known green)and(known ahlength): if atomfont="": atomfont:="draw"; fi % default atom font if defaultfont="": defaultfont:="draw"; fi % default label font %----------------------------------------------------------------------------------------- + if sw_output>=Info: + if bboxmargin=1: message "* output first font only"; fi + message "* jobname="&jobname; + message "* numbersystem="&numbersystem; + if (ahlength=1)or(ahlength=2): + message "* output information file"; + message "* file name="&jobname&"-info.aux"; + message "* info delimiter="&aux_delimiter; + ef ahlength=3: message "* output report file"; + message "* file name="&jobname&"-report.txt"; + ef ahlength=5: message "* output MOL file(V2000)"; + message "* "&jobname&"-nnn-"&"inf_EN"&".mol"; + ef ahlength=6: message "* output MOL file(V3000)"; + message "* "&jobname&"-nnn-"&"inf_EN"&".mol"; + ef ahlength=7: message "* output metafont file"; + message "* mf file name="&jobname&"-mf.aux"; + ef ahlength=8: message "* output data-base file"; + message "* data-base file name="&jobname&"-data.aux"; + fi + message "* outputformat="&outputformat; + if outputformat="png": message "* hppp="&decimal(hppp)&"/vppp="&decimal(vppp); fi + message "* outputtemplate="&outputtemplate; + message "* atomfont="&atomfont; + message "* defaultfont="&defaultfont; + fi else: f_MP:=0; def image = image_emu enddef; @@ -149,34 +176,11 @@ else: def color = transform enddef; atomfont:="draw"; defaultfont:="draw"; + sw_output:=Font; mode_setup; fi clearit; %-------------------------------------------------------------------------------------------------- -if f_MP=1: - if bboxmargin=1: message "* output first font only"; fi - message "* jobname="&jobname; - message "* numbersystem="&numbersystem; - if (ahlength=1)or(ahlength=2): - message "* output info file"; - message "* file name="&jobname&"-info.aux"; - message "* info delimiter="&aux_delimiter; - ef ahlength=3: message "* output report file"; - message "* file name="&jobname&"-report.txt"; - ef ahlength=5: message "* output MOL file(V2000)"; - message "* "&jobname&"-nnn-"&"inf_EN"&".mol"; - ef ahlength=6: message "* output MOL file(V3000)"; - message "* "&jobname&"-nnn-"&"inf_EN"&".mol"; - ef ahlength=7: message "* output mf file"; - message "* mf file name="&jobname&"-mf.aux"; - fi - message "* outputformat="&outputformat; - if outputformat="png": message "* hppp="&decimal(hppp)&"/vppp="&decimal(vppp); fi - message "* outputtemplate="&outputtemplate; - message "* atomfont="&atomfont; - message "* defaultfont="&defaultfont; -fi -%-------------------------------------------------------------------------------------------------- ?3:=?20:=Ph:=Ph1:=Ph2:=hz:=0; vt:=1; ratio_chain_ring:=0.66; ratio_atom_bond:=0.36; ratio_thickness_bond:=0.015; ratio_thickness_char:=0.1; ratio_char_bond:=1.5; ratio_bondgap_bond:=0.15; @@ -254,43 +258,47 @@ enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def beginfont(text s)= begingroup - save ',f_beginchar,f_ext,blen,ext,add,ang_br,n_fw,n_bw,at_colon,at_semicol,temps,t_tag, + save ',f_beginchar,f_ext,blen,ext,add,ang_br,fw_n,bw_n,at_colon,temp_tag, mc,info,file_name_input,bond_cnt,warning_cnt,hideH_cnt,bondC,filter_s; - numeric at_semicol[]; - string info[],mc[],mc,temps,file_name_input,t_tag,filter_s; + string info[],mc[],mc,file_name_input,temp_tag,filter_s; %------------------------------------------------------------------------------------------------ def ext=ext_to_font enddef; def add=add_to_molecule enddef; def '=read_ud enddef; %------------------------------------------------------------------------------------------------ - inf_NO:=inf_EN:=inf_JN:=inf_MW:=inf_FM:=inf_CAS:=inf_USE:=inf_EXA:=inf_EXB:="-"; - mc:=t_tag:=file_name_input:=cal_MW:=cal_MI:=cal_FM:=filter_s:=""; + inf_NO:=inf_EN:=inf_JN:=inf_MW:=inf_FM:=inf_CAS:=inf_Cat:=inf_EXA:=inf_EXB:="-"; + mc:=temp_tag:=cal_MW:=cal_MI:=cal_FM:=filter_s:=""; + file_name_input:=default_data_file; %------------------------------------------------------------------------------------------------ parts_cnt:=parts_usr_start; parts_int:=parts_int_start; %------------------------------------------------------------------------------------------------ char_num:=char_num+1; store_par(parameter_list); - f_ext:=cntM:=mc_row:=inf_num:=f_EOF:=f_close:=0; - for list=s: inf_num:=inf_num+1; info[inf_num]:=list; mc[inf_num]:=""; endfor + f_ext:=cntM:=mc_row:=inf_num:=f_EOF:=0; %------------------------------------------------------------------------------------------------ - for j=1 upto inf_num: - at_colon:=scan_char(":",info[j],0,1); + for list=s: + at_colon:=scan_char(":",list,0,1); if at_colon=1: - n_fw:=scan_char(" ",info[j],1,2); - n_bw:=scan_char(" ",info[j],-1,2); + fw_n:=scan_char(" ",list,1,2); + bw_n:=scan_char(" ",list,-1,2); mc_row:=mc_row+1; - mc_indent[mc_row]:=n_fw-2; - mc[mc_row]:=substring (n_fw-1,n_bw) of info[j]; + mc_indent[mc_row]:=fw_n-2; + mc[mc_row]:=substring (fw_n-1,bw_n) of list; mc:=mc&mc[mc_row]; ef at_colon>=1: - s_tag:=substring (0,at_colon-1) of info[j]; - s_var:=substring (at_colon,length(info[j])) of info[j]; - if s_tag="f": if f_MP=1: file_name_input:=s_var&".mcf"; f_close:=1; fi - ef s_tag="f+": if f_MP=1: file_name_input:=s_var&".mcf"; fi - ef s_tag="t": if f_MP=1: t_tag:=s_var; fi - ef s_tag="v": if f_MP=1: pickup_data_unit(t_tag,s_var); fi - else: if known scantokens("inf_"&s_tag): scantokens("inf_"&s_tag):=s_var; fi + tag_s:=substring (0,at_colon-1) of list; + var_s:=substring (at_colon,length(list)) of list; + if tag_s="f": + if f_MP=1: + if scan_char(".",var_s,0,1)=0: file_name_input:=var_s&".mcf"; + else: file_name_input:=var_s; + fi + fi + ef tag_s="t": if f_MP=1: temp_tag:=var_s; fi + ef tag_s="v": if f_MP=1: pickup_data_unit(temp_tag,var_s,1); fi + ef tag_s="v+": if f_MP=1: pickup_data_unit(temp_tag,var_s,0); fi + else: if known scantokens("inf_"&tag_s): scantokens("inf_"&tag_s):=var_s; fi fi fi endfor @@ -299,88 +307,89 @@ def beginfont(text s)= enddef; %================================================================================================== def endfont= - %-------------------------------------------------------------------------------------------- if f_EOF=0: - %-------------------------------------------------------------------------------------------- - if (sw_output=0)or(scan_bit(sw_output,Font)): - if cntM>=1: - if sw_ext_all=1: ext_to_font(EXT_ALL); fi - if sw_trimming>=1: - nA:=nC:=4095; nB:=nD:=-4095; - for i=1 upto cntM: - if xpart(posM[1][i])nB: nB:=xpart(posM[2][i]); fi - if ypart(posM[1][i])nD: nD:=ypart(posM[2][i]); fi - endfor - font_wd:=nB-nA+2margin_lr; - font_ht:=nD-nC+2margin_tb; - fsize:=(font_wd,font_ht); + %-------------------------------------------------------------------------------------------- + if scan_bit(sw_output,Font): + if cntM>=1: + if sw_ext_all=1: ext_to_font(EXT_ALL); fi + if sw_trimming>=1: + nA:=nC:=4095; nB:=nD:=-4095; + for i=1 upto cntM: + if xpart(posM[1][i])nB: nB:=xpart(posM[2][i]); fi + if ypart(posM[1][i])nD: nD:=ypart(posM[2][i]); fi + endfor + font_wd:=nB-nA+2margin_lr; + font_ht:=nD-nC+2margin_tb; + fsize:=(font_wd,font_ht); + for i=1 upto cntM: + posM[0][i]:=posM[0][i]+(margin_lr-nA,margin_tb-nC); + posM[1][i]:=posM[1][i]+(margin_lr-nA,margin_tb-nC); + endfor + fi + %---------------------------------------------------------------------------------------- + if f_MP=0: beginchar(char_num,font_wd/bp*bp#,font_ht/bp*bp#,0) + else: beginfig(char_num) w:=charwd:=font_wd; h:=charht:=font_ht; chardp:=0; + if scan_bit(sw_frame,Outside): else: draw_corner((0,0),w,h,0.05bp); fi + fi + if scan_bit(sw_frame,Outside): draw_frame((0,0),w,h,thickness_frame); fi + if scan_bit(sw_frame,Inside): + draw_frame((margin_lr,margin_tb),w-2margin_lr,h-2margin_tb,thickness_frame); + fi for i=1 upto cntM: - posM[0][i]:=posM[0][i]+(margin_lr-nA,margin_tb-nC); - posM[1][i]:=posM[1][i]+(margin_lr-nA,margin_tb-nC); + addto currentpicture also mol_stru[i] shifted posM[0][i]; mol_stru[i]:=nullpicture; + if scan_bit(sw_frame,Mol): ext(draw_frame(p[i],w[i],h[i],thickness_frame)) fi endfor + if f_ext=1: addto currentpicture also mol_stru[0]; mol_stru[0]:=nullpicture; fi + %---------------------------------------------------------------------------------------- + else: + font_wd:=xpart(fsize); font_ht:=ypart(fsize); + if f_MP=0: beginchar(char_num,font_wd/bp*bp#,font_ht/bp*bp#,0) + else: beginfig(char_num) w:=charwd:=font_wd; h:=charht:=font_ht; + fi + draw (0,h)--(0,0)--(w,0)--(w,h)--(0,h)--(w,0) wpcs thickness_frame; fi - %---------------------------------------------------------------------------------------- - if f_MP=0: beginchar(char_num,font_wd/bp*bp#,font_ht/bp*bp#,0) - else: beginfig(char_num) w:=charwd:=font_wd; h:=charht:=font_ht; chardp:=0; - if scan_bit(sw_frame,Outside): else: draw_corner((0,0),w,h,0.05bp); fi - fi - if scan_bit(sw_frame,Outside): draw_frame((0,0),w,h,thickness_frame); fi - if scan_bit(sw_frame,Inside): - draw_frame((margin_lr,margin_tb),w-2margin_lr,h-2margin_tb,thickness_frame); - fi - for i=1 upto cntM: - addto currentpicture also mol_stru[i] shifted posM[0][i]; mol_stru[i]:=nullpicture; - if scan_bit(sw_frame,Mol): ext(draw_frame(p[i],w[i],h[i],thickness_frame)) fi - endfor - if f_ext=1: addto currentpicture also mol_stru[0]; mol_stru[0]:=nullpicture; fi %----------------------------------------------------------------------------------------- - else: - font_wd:=xpart(fsize); font_ht:=ypart(fsize); - if f_MP=0: beginchar(char_num,font_wd/bp*bp#,font_ht/bp*bp#,0) - else: beginfig(char_num) w:=charwd:=font_wd; h:=charht:=font_ht; + endchar; + clearit; + %----------------------------------------------------------------------------------------- + if sw_output=Font+Info+Temp: proc_info_out(1,1); + ef sw_output=Font+Mcode+Temp: proc_mc_out(1); + ef sw_output=Font+Info+Mcode+Temp: proc_info_out(1,1); proc_mc_out(1); + ef sw_output=Font+Report+Temp: proc_report_out(1); fi - draw (0,h)--(0,0)--(w,0)--(w,h)--(0,h)--(w,0) wpcs thickness_frame; - fi - %----------------------------------------------------------------------------------------- - endchar; - clearit; - %----------------------------------------------------------------------------------------- - if sw_output=Font+Info+Temp: proc_info_out(1,1); - ef sw_output=Font+Mcode+Temp: proc_mc_out(1); - ef sw_output=Font+Info+Mcode+Temp: proc_info_out(1,1); proc_mc_out(1); - ef sw_output=Font+Report+Temp: proc_report_out(1); + %----------------------------------------------------------------------------------------- + ef sw_output=Info: proc_info_out(1,0); + ef sw_output=Info+Table: proc_info_out(2,0); + ef sw_output=Info+Temp: proc_info_out(1,1); + ef sw_output=Info+Mcode: proc_info_out(1,2); + ef sw_output=Mcode: proc_mc_out(0); + ef sw_output=Mcode+Temp: proc_mc_out(1); + ef sw_output=Mfont: proc_mf_out(1); + ef sw_output=Report: proc_report_out(0); + ef sw_output=Report+Temp: proc_report_out(1); + ef sw_output=MOL2k: proc_mol_out(1); + ef sw_output=MOL3k: proc_mol_out(2); + ef sw_output=Info+Mcode+Temp: proc_mc_out(1); proc_info_out(1,1); fi - %----------------------------------------------------------------------------------------- - ef sw_output=Info: proc_info_out(1,0); - ef sw_output=Info+Table: proc_info_out(2,0); - ef sw_output=Info+Temp: proc_info_out(1,1); - ef sw_output=Mcode: proc_mc_out(0); - ef sw_output=Mcode+Temp: proc_mc_out(1); - ef sw_output=Mfont: proc_mf_out(0); - ef sw_output=Report: proc_report_out(0); - ef sw_output=Report+Temp: proc_report_out(1); - ef sw_output=MOL2k: proc_mol_out(1); - ef sw_output=MOL3k: proc_mol_out(2); - ef sw_output=Info+Mcode+Temp: proc_mc_out(1); proc_info_out(1,1); - 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); - %----------------------------------------------------------------------------------------------- + %--------------------------------------------------------------------------------------------- + %% 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); + %--------------------------------------------------------------------------------------------- fi - %----------------------------------------------------------------------------------------------- + %--------------------------------------------------------------------------------------------- restore_par(parameter_list); if proc_end=1: scantokens("bye"); fi endgroup; enddef; %------------------------------------------------------------------------------------------------- -def pickup_data_unit(expr t,v)= +def pickup_data_unit(expr t,v,f)= begingroup - save unit_cnt,f_end,semicol_cnt,cond,n_var; - f_end:=unit_cnt:=semicol_cnt:=cond:=at_semicol[0]:=inf_num:=0; - if t="n": n_var:=scantokens(v); fi + save unit_cnt,f_end,semicol_cnt,f_match,var_n,info_s,tag_a,var_a; + string tag_a[],var_a[],info_s; + f_end:=unit_cnt:=semicol_cnt:=f_match:=inf_num:=0; + if t="n": var_n:=scantokens(v); fi forever: temps:=readfrom file_name_input; if temps=EOF: f_EOF:=1; fi @@ -388,11 +397,10 @@ def pickup_data_unit(expr t,v)= if subc(1,temps)="%": ef (subc(1,temps)="+")and(subc(2,temps)<>"-"): unit_cnt:=unit_cnt+1; - if v="*": cond:=1; - ef t="n": if unit_cnt=n_var: cond:=1; fi - else: if v=scantokens("inf_"&t): cond:=1; fi + if v="*": f_match:=1; + ef t="n": if unit_cnt=var_n: f_match:=1; fi fi - if cond=1: + if f_match=1: forever: temps:=readfrom file_name_input; if temps=EOF: f_EOF:=1; fi @@ -400,12 +408,15 @@ def pickup_data_unit(expr t,v)= exitif subc(1,temps)="+"; if subc(1,temps)<>"%": mc_row:=mc_row+1; - n_fw:=scan_char(" ",temps,1,1); - mc_indent[mc_row]:=n_fw-1; - mc[mc_row]:=substring (n_fw-1,length(temps)) of temps; + fw_n:=scan_char(" ",temps,1,1); + mc_indent[mc_row]:=fw_n-1; + mc[mc_row]:=substring (fw_n-1,length(temps)) of temps; mc:=mc&mc[mc_row]; fi endfor + for i=1 upto inf_num: + if known scantokens("inf_"&tag_a[i]): scantokens("inf_"&tag_a[i]):=var_a[i]; fi + endfor f_end:=1; else: forever: @@ -416,21 +427,21 @@ def pickup_data_unit(expr t,v)= endfor fi else: - semicol_cnt:=count_char(";",temps); + semicol_cnt:=count_semicol(temps); inf_num:=semicol_cnt+1; for i=1 upto inf_num: - if i<=semicol_cnt: info[i]:=substring (at_semicol[i-1],at_semicol[i]-1) of temps; - else: info[i]:=substring (at_semicol[semicol_cnt],length(temps)) of temps; + if i<=semicol_cnt: info_s:=substring (at_semicol[i-1],at_semicol[i]-1) of temps; + else: info_s:=substring (at_semicol[semicol_cnt],length(temps)) of temps; fi - at_colon:=scan_char(":",info[i],0,1); - s_tag:=substring (0,at_colon-1) of info[i]; - s_var:=substring (at_colon,length(info[i])) of info[i]; - if known scantokens("inf_"&s_tag): scantokens("inf_"&s_tag):=s_var; fi + at_colon:=scan_char(":",info_s,0,1); + tag_a[i]:=substring (0,at_colon-1) of info_s; + var_a[i]:=substring (at_colon,length(info_s)) of info_s; + if t=tag_a[i]: if v=var_a[i]: f_match:=1; fi fi endfor fi exitif f_end=1; endfor - if f_close=1: closefrom file_name_input; fi + if f=1: closefrom file_name_input; fi endgroup; enddef; %-------------------------------------------------------------------------------------------------- @@ -445,13 +456,6 @@ vardef scan_char(expr c,s,d,n)= fi n_s enddef; -%-------------------------------------------------------------------------------------------------- -vardef count_char(expr c,s)= - save nS; - nS:=0; - for i=1 upto length(s): if subc(i,s)=c: nS:=nS+1; at_semicol[nS]:=i; fi endfor - nS -enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def set_def_MC= save /,//,/*,*/,**,*/*,~,^,',`,<,>,:,=,\,\\,*\,\*,*\*,@,@$,$,&,&$,#,##,{,},|,||,_,inside_def_MC; @@ -890,7 +894,7 @@ def MC(text TXT)= pair temp_p; %----------------------------------------------------------------------------------------------- if sw_numbering>=1: ratio_atom_bond:=0.25; fi - if (sw_expand=1)or(sw_output=MOL2k)or(sw_output=MOL3k): + if (sw_expand=1)or(scan_bit(sw_output,MOL2k))or(scan_bit(sw_output,MOL3k)): expand_set; crR:=1; else: crR:=-ratio_chain_ring; fi cntA:=cntB:=cntC:=cnt_group:=0; strD[0]:="C"; str_cnt:=2000; @@ -927,77 +931,86 @@ def MC(text TXT)= endfor if blen>max_blength: blen:=max_blength; proc_size_setup; proc_skeleton(0); proc_scaling; fi fi - %-draw atom------------------------------------------------------------------------------------- - if sw_numbering=0: for i=1 upto cntA: draw_atom(i); endfor fi - %-draw add to atom------------------------------------------------------------------------------ + %----------------------------------------------------------------------------------------------- for i=1 upto cntA: if addA[i]<>0: - temp_c:=char(addA[i]); nA:=angX[i]+add_rot[i]; nC:=nA mod 90; + temp_c:=char(addA[i]); if temp_c="+": chargeA[i]:=1; elseif temp_c="-": chargeA[i]:=-1; else: chargeA[i]:=0; fi - if numS[i]=0: nB:=.5atom_wd; - else: nB:=.85wdA[i]+iif(nC<45,sind(nC),cosd(nC))*.5wdA[i]; - fi - temp_p:=sfrt(posA[i]-(.35atom_wd,.35atom_wd),nB,nA); - draw_char(temp_c,temp_p,atom_wd,bond_pen_wd*ratio_char_bond,0); else: chargeA[i]:=0; fi endfor - %-draw bond------------------------------------------------------------------------------------- - for i=1 upto cntB: if lineB[i]=si_: draw_bond(i); fi endfor - %-atom numbering-------------------------------------------------------------------------------- - if scan_bit(sw_numbering,Atom): + %=============================================================================================== + if scan_bit(sw_output,Font): + %-draw atom----------------------------------------------------------------------------------- + if sw_numbering=0: for i=1 upto cntA: draw_atom(i); endfor fi + %-draw add to atom---------------------------------------------------------------------------- for i=1 upto cntA: - if (i>=numbering_start)and(i<=numbering_end): - if scan_bit(sw_numbering,Brock): nA:=i-numbering_start+1; - elseif scan_bit(sw_numbering,Inverse): - nA:=iif(numbering_end0: + nA:=angX[i]+add_rot[i]; nC:=nA mod 90; + if numS[i]=0: nB:=.5atom_wd; + else: nB:=.85wdA[i]+iif(nC<45,sind(nC),cosd(nC))*.5wdA[i]; fi - erase fill unitsquare xscaled (.8atom_wd*length(decimal(nA))) - yscaled atom_wd shifted (posA[i]-(.5atom_wd,.5atom_wd)); - defaultsize:=atom_wd; defaultscale:=1; - puts(posA[i]-(.5atom_wd,.5atom_wd))(decimal(nA)); + temp_p:=sfrt(posA[i]-(.35atom_wd,.35atom_wd),nB,nA); + draw_char(temp_c,temp_p,atom_wd,bond_pen_wd*ratio_char_bond,0); fi endfor - fi - %-bond numbering-------------------------------------------------------------------------------- - if scan_bit(sw_numbering,Bond): - for i=1 upto cntB: - if (i>=numbering_start)and(i<=numbering_end): - if scan_bit(sw_numbering,Brock): nB:=i-numbering_start+1; - elseif scan_bit(sw_numbering,Inverse): - nB:=iif(numbering_end=si_: draw_bond(i); fi endfor + %-atom numbering------------------------------------------------------------------------------ + if scan_bit(sw_numbering,Atom): + for i=1 upto cntA: + if (i>=numbering_start)and(i<=numbering_end): + if scan_bit(sw_numbering,Brock): nA:=i-numbering_start+1; + elseif scan_bit(sw_numbering,Inverse): + nA:=iif(numbering_end1: sftX:=xpart(mposition)-minX; - else: sftX:=margin_lr-minX+(font_wd-mol_wd-2margin_lr)*xpart(mposition); - fi - if ypart(mposition)>1: sftY:=ypart(mposition)-minY; - else: sftY:=margin_tb-minY+(font_ht-mol_ht-2margin_tb)*ypart(mposition); - fi - cntM:=cntM+1; - posM[0][cntM]:=(sftX,sftY); - posM[1][cntM]:=(minX+sftX,minY+sftY); - posM[2][cntM]:=(maxX+sftX,maxY+sftY); - wdM[cntM]:=mol_wd; - htM[cntM]:=mol_ht; - mol_stru[cntM]:=currentpicture; - clearit; - endgroup; - if sw_output>=1: proc_calc(0); fi - if cntC>=1: + endfor + fi + %-bond numbering------------------------------------------------------------------------------ + if scan_bit(sw_numbering,Bond): + for i=1 upto cntB: + if (i>=numbering_start)and(i<=numbering_end): + if scan_bit(sw_numbering,Brock): nB:=i-numbering_start+1; + elseif scan_bit(sw_numbering,Inverse): + nB:=iif(numbering_end1: sftX:=xpart(mposition)-minX; + else: sftX:=margin_lr-minX+(font_wd-mol_wd-2margin_lr)*xpart(mposition); + fi + if ypart(mposition)>1: sftY:=ypart(mposition)-minY; + else: sftY:=margin_tb-minY+(font_ht-mol_ht-2margin_tb)*ypart(mposition); + fi + cntM:=cntM+1; + posM[0][cntM]:=(sftX,sftY); + posM[1][cntM]:=(minX+sftX,minY+sftY); + posM[2][cntM]:=(maxX+sftX,maxY+sftY); + wdM[cntM]:=mol_wd; + htM[cntM]:=mol_ht; + mol_stru[cntM]:=currentpicture; + clearit; + if cntC>=1: for i=1 upto cntA: if colorA[i]<>0: colorA[i]:=0; fi endfor for i=1 upto cntB: if colorB[i]<>0: colorB[i]:=0; fi endfor + fi fi + if sw_output>=Info: proc_check_structure(0); fi + endgroup; enddef; %------------------------------------------------------------------------------------------------- def add_group= @@ -1591,7 +1604,7 @@ vardef erase_space(expr TXT)= temp_s enddef; %================================================================================================= -def proc_calc(expr n)= +def proc_check_structure(expr n)= begingroup save knownA,tmp_wtp; num_MW:=num_MI:=cen_MW:=cen_MI:=tbl_atom_max:=warning_cnt:=hideH_cnt:=0; @@ -1669,6 +1682,7 @@ enddef; def proc_info_out(expr n,f)= message "["&decimal(char_num)&"]:"&inf_EN; if f=1: file_name_output:="temp-info.aux"; + ef f=2: file_name_output:=jobname&"-data.aux"; else: file_name_output:=jobname&"-info.aux"; fi %-------------------------------------------------------------------------------------- @@ -1705,7 +1719,11 @@ def proc_info_out(expr n,f)= ef tag[i]="MC": & inf_MC fi endfor ; - if f=1: printf EOF; fi + if f=1: printf EOF; + ef f=2: printf "+"; + for i=1 upto mc_row: printf (substring(0,mc_indent[i]) of blank_str)&mc[i]; endfor + printf "+-----------------------------------------------------------------------------"; + fi enddef; %================================================================================================= def proc_report_out(expr f)= @@ -1823,12 +1841,10 @@ enddef; def proc_mf_out(expr f)= message "["&decimal(char_num)&"]:"&inf_EN; file_name_output:=jobname&"-mf.aux"; - printf "beginfont(" - for i=1 upto inf_num: &ditto&info[i]&ditto&"," endfor ; - for i=1 upto mc_row: - printf ditto&": " if i=mc_row: &mc[i]&ditto&")"; else: &mc[i]&ditto&","; fi - endfor - printf "if check(mc)=0: MC(scantokens(mc)) fi"; + printf "beginfont()"; + printf "MC("; + for i=1 upto mc_row: printf mc[i]; endfor + printf ")"; printf "endfont"; if f=1: printf "%-------------------------------------------------------------------------"; fi enddef; @@ -1952,9 +1968,11 @@ R6:='("R6"); R7:='("{R^7^}"); R8:='("{R^8^}"); R9:='("{R^9^}"); R10:='("R^10^"); hexose_hp:='(#1.4,-30~wf_r,30~bd_r`1,30~wb_r,120,O,30,&1,##); Pyranose_hp:='(#1.4,-35~wf_r,35~bd_r`1,30~wb_r,130`1.66,O,&1,##); %------------------------------------------------------------------------------------------------- -xCH3:='(/H,/H^60,60,H); xNH:='(N,/H); xNH2:='(N,/H,60,H); xNO2:='(N,//O,60~dm,O); xNO:='(N,!~dm,O); -xSO2H:='(S,//O,!,O,!,H); xSO3H:='(S,//O^35,//O^-35,!,O,!,H); xCOO:='(//O,!,O); -xOH:='(O,!,H); xCHO:='(//O,!,H); xCOOH:='(//O,!,O,!,H); xCN:='(!~tm,N); xSH:='(S,!,H); +xCH3:='(/H,/H^60,/H^-60); xNH:='(N,/H); xNH2:='(N,/H^60,/H^-60); xNO2:='(N,//O^60,//O^-60); +xOH:='(O,/H); xNO:='(N,//O); xSO2H:='(S,//O^60,/OH^-60); xSO3H:='(S,/OH,//O^60,//O^-60); +xCHO:='(//O^-60,/H^60); xCOOH:='(//O^-60,/xOH^60); xCN:='(/N~tm); xSH:='(S,/H); +!xOH:='(!,xOH); !xCHO:='(!,xCHO); !xCOOH:='(!,xCOOH); !xCH3:='(!,xCH3); !xCN:='(!,xCN); +!xNH2:='(!,xNH2); !xNO2:='(!,xNO2); !xSH:='(!,xSH); %================================================================================================= init_par(parameter_list); %------------------------------------------------------------------------------------------------- @@ -1963,9 +1981,8 @@ init_par(parameter_list); %------------------------------------------------------------------------------------------------- def expand_set= CH3:=xCH3; NH:=xNH; NH2:=xNH2; NO:=xNO; NO2:=xNO2; OH:=xOH; CHO:=xCHO; COOH:=xCOOH; CN:=xCN; - SH:=xSH; SO2H:=xSO2H; SO3H:=xSO3H; COO[-1]:=xCOO; - !CH3:='(!,CH3); !OH:='(!,OH); !NH2:='(!,NH2); !CHO:='(!,CHO); !COOH:='(!,COOH); !CN:='(!,CN); - !SH:='(!,SH); !NO2:='(!,NO2); + SH:=xSH; SO2H:=xSO2H; SO3H:=xSO3H; !SH:=!xSH; + !CH3:=!xCH3; !OH:=!xOH; !NH2:=!xNH2; !CHO:=!xCHO; !COOH:=!xCOOH; !CN:=!xCN; !NO2:=!xNO2; enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% vardef check(expr s)= @@ -2080,25 +2097,24 @@ enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def query(text s)= begingroup - save temps,file_name,f_mcf,f_line,unit_row,unit_cnt,line_s,unit_row_cnt,mc_row,line_cnt, - semicol_cnt,inf_num,info_s,filter_n,tag_s,var_s,order,min_s,min_n,par_cnt,key_cnt,var_n, - sign_at,sign_n,filter_tag,filter_var,filter_sign,filter_cnt,temp_s, - at_semicol,at_colon,at_equal,at_less,at_greater,at_n; - string line_s[][],sort_s[],par_list[],sort_all[],key_s[],filter_s[],filter_tag[],filter_var[], - temps,file_name_input,info_s,tag_s,var_s,temp_s,min_s; - numeric unit_row_cnt[],at_semicol[],order[],order_tbl[],filter_sign[]; - unit_row:=f_mcf:=mc_row:=line_cnt:=inf_num:=par_cnt:=key_cnt:=filter_cnt:=at_semicol[0]:=0; + save file_name,f_mcf,f_line,unit_row,unit_cnt,line_s,unit_row_cnt,mc_row,line_cnt, + semicol_cnt,info_cnt,info_s,filter_n,order,min_s,min_n,par_cnt,key_cnt,var_n,info_s, + sign_at,sign_n,filter_tag,filter_var,filter_sign,filter_cnt,filter_p,temp_s,par_s, + at_colon,at_equal,at_less,at_greater,at_n,info_cnt; + string line_s[][],sort_s[],par_s[],sort_all[],key_s[],filter_s[],filter_tag[],filter_var[], + info_s[],file_name_input,temp_s,min_s; + numeric unit_row_cnt[],order[],order_tbl[],filter_sign[],filter_p[]; + unit_row:=f_mcf:=mc_row:=line_cnt:=info_cnt:=par_cnt:=key_cnt:=filter_cnt:=0; unit_cnt:=1; - for list=s: par_cnt:=par_cnt+1; par_list[par_cnt]:=list; endfor %------------------------------------------------------------------------------------------------ file_name_input:=default_data_file; file_name_output:=default_temp_file; %------------------------------------------------------------------------------------------------ - for j=1 upto par_cnt: - at_colon:=scan_char(":",par_list[j],0,1); - at_equal:=scan_char("=",par_list[j],0,1); - at_less:=scan_char("<",par_list[j],0,1); - at_greater:=scan_char(">",par_list[j],0,1); + for list=s: + at_colon:=scan_char(":",list,0,1); + at_equal:=scan_char("=",list,0,1); + at_less:=scan_char("<",list,0,1); + at_greater:=scan_char(">",list,0,1); %--------------------------------------------------------------------------------------------- if at_colon>=2: sign_at:=at_colon; sign_n:=0; at_n:=1; ef at_equal>=2: if (at_equal-1)=at_less: sign_at:=at_equal; sign_n:=5; at_n:=2; @@ -2108,12 +2124,18 @@ def query(text s)= else: sign_at:=at_greater; sign_n:=4; at_n:=1; fi ef at_less>=2: sign_at:=at_less; sign_n:=3; at_n:=1; fi - tag_s:=substring (0,sign_at-at_n) of par_list[j]; - var_s:=substring (sign_at,length(par_list[j])) of par_list[j]; + tag_s:=substring (0,sign_at-at_n) of list; + var_s:=substring (sign_at,length(list)) of list; %--------------------------------------------------------------------------------------------- if sign_n=0: - if tag_s="i": file_name_input:=var_s; - ef tag_s="o": file_name_output:=var_s; + if tag_s="f": + if scan_char(".",var_s,0,1)=0: file_name_input:=var_s&".mcf"; + else: file_name_input:=var_s; + fi + ef tag_s="o": + if scan_char(".",var_s,0,1)=0: file_name_output:=var_s&".aux"; + else: file_name_output:=var_s; + fi ef tag_s="s": key_cnt:=key_cnt+1; key_s[key_cnt]:=var_s; fi %--------------------------------------------------------------------------------------------- @@ -2121,12 +2143,12 @@ def query(text s)= filter_cnt:=filter_cnt+1; filter_tag[filter_cnt]:=tag_s; filter_sign[filter_cnt]:=sign_n; - if (sign_n>=3)and(is_num(var_s)=1): filter_var[filter_cnt]:=fix_n(var_s); + if (sign_n>=3)and(is_num(var_s)=1): filter_var[filter_cnt]:=fix_num(var_s); else: filter_var[filter_cnt]:=var_s; fi fi endfor - %------------------------------------------------------------------------------------------------ + %----------------------------------------------------------------------------------------------- forever: temps:=readfrom file_name_input; exitif temps=EOF; if subc(1,temps)<>"%": @@ -2136,51 +2158,61 @@ def query(text s)= ef (subc(1,temps)="+")and(subc(2,temps)="-"): unit_row_cnt[unit_cnt]:=unit_row; f_mcf:=unit_row:=0; - if filter_n=1: unit_cnt:=unit_cnt+1; fi - ef (subc(1,temps)<>"+")and(subc(1,temps)<>"%"): - if f_mcf=1: mc_row:=mc_row+1; - else: - semicol_cnt:=count_char(";",temps); - inf_num:=semicol_cnt+1; - filter_n:=1; - %--------------------------------------------------------------------------------------- - for i=1 upto inf_num: - if i<=semicol_cnt: info_s:=substring (at_semicol[i-1],at_semicol[i]-1) of temps; - else: info_s:=substring (at_semicol[semicol_cnt],length(temps)) of temps; + filter_n:=1; + for i=1 upto filter_cnt: filter_p[i]:=0; endfor + for i=1 upto key_cnt: sort_s[i]:=""; endfor + %--------------------------------------------------------------------------------------- + for i=1 upto info_cnt: + at_colon:=scan_char(":",info_s[i],0,1); + tag_s:=substring (0,at_colon-1) of info_s[i]; + var_s:=substring (at_colon,length(info_s[i])) of info_s[i]; + %------------------------------------------------------------------------------------- + for j=1 upto key_cnt: + if key_s[j]=tag_s: + if is_num(var_s)=1: sort_s[j]:=fix_num(var_s); else: sort_s[j]:=var_s; fi fi - at_colon:=scan_char(":",info_s,0,1); - tag_s:=substring (0,at_colon-1) of info_s; - var_s:=substring (at_colon,length(info_s)) of info_s; - %------------------------------------------------------------------------------------- - for j=1 upto key_cnt: - if key_s[j]=tag_s: - if is_num(var_s)=1: sort_s[j]:=fix_n(var_s); else: sort_s[j]:=var_s; fi + endfor + %------------------------------------------------------------------------------------- + for j=1 upto filter_cnt: + if filter_tag[j]=tag_s: + filter_p[j]:=1; + if (filter_sign[j]>=3)and(is_num(var_s)=1): temp_s:=fix_num(var_s); + else: temp_s:=var_s; fi - endfor - %------------------------------------------------------------------------------------- - for j=1 upto filter_cnt: - if filter_tag[j]=tag_s: - if (filter_sign[j]>=3)and(is_num(var_s)=1): temp_s:=fix_n(var_s); - else: temp_s:=var_s; - fi - if filter_sign[j]=1: if not(temp_s= filter_var[j]): filter_n:=0; fi - ef filter_sign[j]=2: if not(temp_s<>filter_var[j]): filter_n:=0; fi - ef filter_sign[j]=3: if not(temp_s< filter_var[j]): filter_n:=0; fi - ef filter_sign[j]=4: if not(temp_s> filter_var[j]): filter_n:=0; fi - ef filter_sign[j]=5: if not(temp_s<=filter_var[j]): filter_n:=0; fi - ef filter_sign[j]=6: if not(temp_s>=filter_var[j]): filter_n:=0; fi - fi + if filter_sign[j]=1: if not(temp_s= filter_var[j]): filter_n:=0; fi + ef filter_sign[j]=2: if not(temp_s<>filter_var[j]): filter_n:=0; fi + ef filter_sign[j]=3: if not(temp_s< filter_var[j]): filter_n:=0; fi + ef filter_sign[j]=4: if not(temp_s> filter_var[j]): filter_n:=0; fi + ef filter_sign[j]=5: if not(temp_s<=filter_var[j]): filter_n:=0; fi + ef filter_sign[j]=6: if not(temp_s>=filter_var[j]): filter_n:=0; fi fi - endfor + fi endfor - %------------------------------------------------------------------------------------- - sort_all[unit_cnt]:=""; - for j=1 upto key_cnt: - if j=key_cnt: sort_all[unit_cnt]:=sort_all[unit_cnt]&sort_s[j]; - else: sort_all[unit_cnt]:=fix_s(15,sort_s[1]); + endfor + for i=1 upto filter_cnt: if filter_p[i]=0: filter_n:=0; fi endfor + %------------------------------------------------------------------------------------- + sort_all[unit_cnt]:=""; + for j=1 upto key_cnt: + if j=key_cnt: sort_all[unit_cnt]:=sort_all[unit_cnt]&sort_s[j]; + else: sort_all[unit_cnt]:=fix_str(15,sort_s[1]); + fi + endfor + %------------------------------------------------------------------------------------- + info_cnt:=0; + if filter_n=1: unit_cnt:=unit_cnt+1; fi + %------------------------------------------------------------------------------------- + ef (subc(1,temps)<>"+")and(subc(1,temps)<>"%"): + if f_mcf=1: mc_row:=mc_row+1; + else: + semicol_cnt:=count_semicol(temps); + for i=1 upto semicol_cnt+1: + info_cnt:=info_cnt+1; + if i<=semicol_cnt: + info_s[info_cnt]:=substring (at_semicol[i-1],at_semicol[i]-1) of temps; + else: + info_s[info_cnt]:=substring (at_semicol[semicol_cnt],length(temps)) of temps; fi endfor - %------------------------------------------------------------------------------------- fi fi fi @@ -2206,7 +2238,7 @@ def query(text s)= endgroup; enddef; %============================================================================================= -vardef fix_s(expr n,s)= +vardef fix_str(expr n,s)= save temp_s; string temp_s; if length(s)