texlive[60428] Master/texmf-dist: mcf2graph (5sep21)

commits+karl at tug.org commits+karl at tug.org
Sun Sep 5 22:37:35 CEST 2021


Revision: 60428
          http://tug.org/svn/texlive?view=revision&revision=60428
Author:   karl
Date:     2021-09-05 22:37:35 +0200 (Sun, 05 Sep 2021)
Log Message:
-----------
mcf2graph (5sep21)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/metapost/mcf2graph/CHANGELOG
    trunk/Master/texmf-dist/doc/metapost/mcf2graph/README
    trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_data_base.mcf
    trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_exa_soc.mf
    trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.pdf
    trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.tex
    trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_man_soc.mf
    trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.pdf
    trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.tex
    trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.pdf
    trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.tex
    trunk/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf

Modified: trunk/Master/texmf-dist/doc/metapost/mcf2graph/CHANGELOG
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/mcf2graph/CHANGELOG	2021-09-05 06:01:03 UTC (rev 60427)
+++ trunk/Master/texmf-dist/doc/metapost/mcf2graph/CHANGELOG	2021-09-05 20:37:35 UTC (rev 60428)
@@ -1,6 +1,11 @@
 *******************************************************************************
- Changelog of mcf2graph software package          by Akira Yamaji 2021-08-01
+ Changelog of mcf2graph software package          by Akira Yamaji 2021-09-05
 *******************************************************************************
+[ver. 4.71  / 2021-09-05]
+  -add function query() for data base file
+  -update mcf_data_base.mcf
+  -update MCF manual,example
+
 [ver. 4.70  / 2021-08-01]
   -change syntax of @(x,y)
     @(x,y)  : Move (x,y) from current position

Modified: trunk/Master/texmf-dist/doc/metapost/mcf2graph/README
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/mcf2graph/README	2021-09-05 06:01:03 UTC (rev 60427)
+++ trunk/Master/texmf-dist/doc/metapost/mcf2graph/README	2021-09-05 20:37:35 UTC (rev 60428)
@@ -1,7 +1,7 @@
 ********************************************************************************
  mcf2graph  : Convert Molecular Coding Format to graphics with METAFONT/METAPOST
  Author     : Akira Yamaji
- version    : 4.70 2021-08-01
+ version    : 4.71 2021-09-05
  E-mail     : mcf2graph at gmail.com
  Located at : http://www.ctan.org/pkg/mcf2graph
 ********************************************************************************
@@ -41,7 +41,7 @@
  (13) mcf_mplib_exa.pdf   PDF of (11) typeset with LuaTeX(LaTeX)
 
 3. How to use mcf2graph with Metapost
- Minimum requirement to run mcf2graph : mpost.exe,mpost.dll,mpost.mp,plain.mp
+ Minimum requirement to use mcf2graph : mpost.exe,mpost.dll,mpost.mp,plain.mp
  ( 1) >mpost                  FILENAME  => output eps(.mps) file
  ( 2) >mpost -s bboxmargin=1  FILENAME  => output first font only (for test)
  ( 3) >mpost -s ahangle=1     FILENAME  => output png file (600dpi)

Modified: trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_data_base.mcf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_data_base.mcf	2021-09-05 06:01:03 UTC (rev 60427)
+++ trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_data_base.mcf	2021-09-05 20:37:35 UTC (rev 60428)
@@ -1,15 +1,16 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% molecular data base file    mcf_data_base.mcf   by Akira Yamaji   2021.08.01
+% molecular data base file    mcf_data_base.mcf   by Akira Yamaji   2021.09.05
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %  tag1:var1;tag2:var2;tag3:var3 .....
 %  first character of line "%" comment out
 %  first character of line "+"  begin MCF
 %  first string    of line "+-" end MCF
+%  first string    of line "%-" end header
 %  Cat = Category
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %==============================================================================
 % molecular data for mcf_example.tex   EXA=1(155)
-%==============================================================================
+%-=============================================================================
 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
@@ -214,7 +215,7 @@
 +
 hexose_hp,{1^$-90,2^$90,4^$-90}:/OH`-.5,3^$-90:/NH2,6^$90:/!OH`-.5
 +------------------------------------------------------------------------------
-Cat:biological;EN:N-acetyl-glucosamine;MW:221.21;EXA:-
+Cat:biological;EN:N-acetyl-Glucosamine;MW:221.21;EXA:1
 +
 hexose_hp,{1^$-90,2^$90,4^$-90}:/OH`-.5,3^$-90>lr:/NHCO!,6^$90:/!OH`-.5
 +------------------------------------------------------------------------------
@@ -258,7 +259,7 @@
 +
 <30,!8,OH,{2,6}=dr,{2,6}:/_
 +------------------------------------------------------------------------------
-Cat:biological;EN:Limonene;MW:136.24;EXA:1
+Cat:biological;EN:Limonene;MW:136.24;EXA:-
 +
 <30,?6,2=dl,2:/_, at 5,*\,/_,!!
 +------------------------------------------------------------------------------
@@ -652,7 +653,7 @@
 <45,?4,-3=?5,2:N,7:S,3^45:/*H,1://O^15,5:/*COOH^-18,6:??, 
  @4,*\^15,NH,!,//O,!,/*NH2,!,Ph       
 +------------------------------------------------------------------------------
-Cat:antibiotics;EN:Benzyl-Penicillin;MW:334.4;EXA:1
+Cat:antibiotics;EN:benzyl-Penicillin;MW:334.4;EXA:1
 +
 <45,?4,-3=?5,2:N,7:S,3^45:/*H,1://O^15,5:/*COOH^-18,6:??,
  @4,*\^15,NH,!,//O,!,!,Ph
@@ -733,14 +734,8 @@
 <-30,?6, at 1,\*,O,0~zb,?6,-5:O, at 5,\,O,0,?6,-5:O,
  {2,4,12}:*/NH2,{6,19}:*/OH,{11,13,18,20}:/*OH,10:*/!OH,17:*/!NH2
 +------------------------------------------------------------------------------
-Cat:antibiotics;EN:DihydroStreptmycin;MW:583.574;EXA:-
+Cat:antibiotics;EN:Neomycin;MW:614.644;EXA:1
 +
-<54,?5,3:O,4:/*_,5:/!OH^-48,5:/*OH^35, at 1,\*,O,-24~wb,?6,-5:O, at 2,*\,O,24~zb,?6,
- {10,15}:*/OH,{11,16,18}:/*OH,9:/*!OH,12:*/NH!,
- @17,*\^-18,NH,!,//NH,!,NH2, at 19,*\,NH,!,//NH,!,NH2
-+------------------------------------------------------------------------------
-Cat:antibiotics;EN:Fradiomycin;MW:614.644;EXA:1
-+
 <30,?6,3:O,2:/*!NH2,1:*/OH,6:/*OH,5:*/NH2,
  @4,*\,O,!~wb,?6,{-3,-5^15}:/*NH2,-2:*/OH^-15,
  @-1,\*,O,-72~wb,?5,-4:O,-1:/*OH>vt,-3:*/!OH>vt,
@@ -752,6 +747,22 @@
   @5,\^-48,!!,O,{10,15}:*/OH,{11,16,18}:/*OH,9:/*!OH,12:*/NH!,
   @17,*\^-18,NH,!,//NH,!,NH2, at 19,*\,NH,!,//NH,!,NH2
 +------------------------------------------------------------------------------
+Cat:antibiotics;EN:dihydro-Streptmycin;MW:583.574;EXA:1
++
+<54,?5,3:O,4:/*_,5:/!OH^-48,5:/*OH^35, at 1,\*,O,-24~wb,?6,-5:O, at 2,*\,O,24~zb,?6,
+ {10,15}:*/OH,{11,16,18}:/*OH,9:/*!OH,12:*/NH!,
+ @17,*\^-18,NH,!,//NH,!,NH2, at 19,*\,NH,!,//NH,!,NH2
++------------------------------------------------------------------------------
+Cat:antibiotics;EN:Spectinomycin;MW:332.35;EXA:1
++
+<30,?6,{3,9}=?6,7=zf,11=wb,{7,10,14}:O,,9^60:*/H,11://O,{1,8^-60}:*/OH,5:/*OH,
+ 13:/*_,{2,6}:*/NH!
++------------------------------------------------------------------------------
+Cat:antibiotics;EN:Tobramycin;MW:467.51;EXA:1
++
+<-30,?6, at 1,\*,O,0~zb,?6,-5:O, at 5,\,O,0,?6,-5:O,
+ {2,4,12}:*/NH2,20:/*NH2,6:*/OH,{11,13,18}:/*OH,10:*/!OH,17:*/!NH2
++------------------------------------------------------------------------------
 Cat:antibiotics;EN:Neospiramycin;MW:698.9;EXA:1
 +
 <-90,#1,60,60,-60,60,60,-60,60,60,-60,60,60,60,-60,60,-60,&1,##,
@@ -848,7 +859,7 @@
 %==============================================================================
 Cat:pesticide;EN:BHC;MW:290.83;EXA:1
 +
-<30,?6`1.2,{1,3,4,6}:*/Cl,{2,5}:/*Cl
+<30,?6,{1,3,4,6}:*/Cl,{2,5}:/*Cl
 +------------------------------------------------------------------------------
 Cat:pesticide;EN:pp-DDT;MW:354.49;EXA:1
 +
@@ -866,11 +877,11 @@
 +
 <30,Ph,6:/Cl, at 3,\,/CCl2~dm,!,Ph,-3:/Cl
 +------------------------------------------------------------------------------
-Cat:pesticide;EN:EPN;MW:323.303;EXA:1
+Cat:pesticide;EN:EPN;MW:323.303;EXA:-
 +
 <30,!2,O,!,P,//S,/Ph^170,!,O,!,|,Ph,4:/NO2
 +------------------------------------------------------------------------------
-Cat:pesticide;EN:XMC;MW:179.2;EXA:1
+Cat:pesticide;EN:XMC;MW:179.2;EXA:-
 +
 <30,Ph,{1,5}:/_, at 3,\,O,!,//O,!,NH,!
 +------------------------------------------------------------------------------
@@ -883,7 +894,7 @@
 +
 <30,Ph,{4,6}:/Cl, at 3,\,!2,?5,{-2,-4}=dl,{-2,-4,-5}:N, at 7,?5,{-1,-4}:O
 +------------------------------------------------------------------------------
-Cat:pesticide;EN:Acetochlor;MW:269.769;EXA:1
+Cat:pesticide;EN:Acetochlor;MW:269.769;EXA:-
 +
 <30,Ph,2:/_,4:/!, at 3,\,N,!2,O,!2, at 7,\,//O,!2,Cl
 +------------------------------------------------------------------------------
@@ -947,7 +958,7 @@
 +
 <-30,!,O,!,P,//S,/O!^160,!,O,!,|,Ph,{2,4}:N,5:/!,3:/O!2
 +------------------------------------------------------------------------------
-Cat:pesticide;EN:Endrin;MW:380.91;EXA:-
+Cat:pesticide;EN:Endrin;MW:380.91;EXA:1
 +
 <30,?6`1.3,3=?6,6=dl,9=?3,-1:O,
   @2,210~wf`1.5,&5~wb, at 7,210~zf`1.5,&10~zb,{1,2,5,6,12^-210,12^-150}:/Cl
@@ -1945,7 +1956,7 @@
 +
 ?5,3=?5,6=dl,2:S,{4,6}:N, at 7,\,Ph
 +------------------------------------------------------------------------------
-Cat:antibacterial;EN:5-(Propylsulphonyl)-1-H-Benzimidazole-2-Amine;MW:0;EXA:-
+Cat:antibacterial;EN:5-(Propylsulphonyl)-1-H-Benzimidazole-2-Amine;MW:239.29;EXA:-
 +
 <30,Ph,3=?6,8=dl,7:N,9:NH,6:/S!3,8:/NH2
 +------------------------------------------------------------------------------
@@ -2009,11 +2020,11 @@
 <30,Ph,-4=?6,9=dl,7:N,6:/F,9:/COOH,10://O, at 1,\,|,?6,{1,4}:N,4:/_,
  ||, at 7,\,Ph,-3:/F
 +------------------------------------------------------------------------------
-Cat:antibacterial;EN:Sulfamonomethoxine;MW:280.302;EXA:-
+Cat:antibacterial;EN:Sulfamonomethoxine;MW:280.302;EXA:1
 +
 <30,Ph,1:/NH2, at 4,\,SOO,!,NH,!,|,Ph,{2,4}:N,3:/O!
 +------------------------------------------------------------------------------
-Cat:antibacterial;EN:Sulfachlorpyridazine;MW:284.723;EXA:-
+Cat:antibacterial;EN:Sulfachlorpyridazine;MW:284.723;EXA:1
 +
 <30,Ph,1:/NH2, at 4,\,SOO,!,NH,!,|,Ph,{5,6}:N,4:/Cl
 +------------------------------------------------------------------------------
@@ -2029,11 +2040,11 @@
 +
 <30,?6,{1,4}=dl,{1,5}:N,4:/!,6://NH, at 3,\,Ph,-3:/Cl
 +------------------------------------------------------------------------------
-Cat:antibacterial;EN:Oxibendazole;MW:249.27;EXA:1
+Cat:antibacterial;EN:Oxibendazole;MW:249.27;EXA:-
 +
 <30,Ph,-4=?5,9=dl,7:NH,9:N,1:/O!3, at 8,\,NH,!,COOH
 +------------------------------------------------------------------------------
-Cat:antibacterial;EN:Oxolinic acid;MW:261.233;EXA:1
+Cat:antibacterial;EN:Oxolinic acid;MW:261.233;EXA:-
 +
 <30,Ph,3=?6,6=?5,9=dl,7:N,{11,13}:O,10://O,7:/!,9:/COOH
 +------------------------------------------------------------------------------
@@ -2077,7 +2088,7 @@
 +
 <-30,!,O,!,P,//S,/O!^160,!,O,!,Ph, at -3,\,SOO,!,N!,!
 +------------------------------------------------------------------------------
-Cat:antibacterial;EN:Lincomycin;MW:406.54;EXA:1
+Cat:antibacterial;EN:Lincomycin;MW:406.54;EXA:-
 +
 <6,?5,5:N,5:*/_,2:*/!2,
  @3,\*,//O,!,NH,!,!~wb,?6,-1:O,-3:/*OH,{-4,-5}:*/OH,-2:/*S!,

Modified: trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_exa_soc.mf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_exa_soc.mf	2021-09-05 06:01:03 UTC (rev 60427)
+++ trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_exa_soc.mf	2021-09-05 20:37:35 UTC (rev 60428)
@@ -1,15 +1,15 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Molecular Coding Format for mcf_example.tex   by Akira Yamaji  2021.08.01
+% Molecular Coding Format for mcf_example.tex   by Akira Yamaji  2021.09.05
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-input mcf2graph.mf;   %%% it must be version 4.70
-message "* mcf_exa_soc 2021.08.01";
+input mcf2graph.mf;   %%% it must be version 4.71
+message "* mcf_exa_soc 2021.09.05";
 message "";
 %------------------------------------------------------------------------------
 fsize:=(35mm,24mm);
-max_blength:=4.5mm;
+max_blength:=4mm;
+%%%%sw_frame:=Outside;
 tag1:="J"; tag2:="C"; tag3:="fm"; tag4:="mw"; tag5:="EN"; tag6:="MW";
 %------------------------------------------------------------------------------
-%%%%sw_fframe:=1;
 %%%% outputformat:="png"; hppp:=vppp:=0.1; outputtemplate:="%j-%3c.png";
 %ext(defaultfont:="uhvr8r"; defaultscale:=.6; label.lrt(inf_EN,(-2bp,1.5bp));)
 %sw_output:=Font;
@@ -21,30 +21,14 @@
 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
 %------------------------------------------------------------------------------
-%%message "counr unit= "&decimal(count_data_unit("mcf_data_base"));
+%%%%%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");
 %******************************************************************************
-beginfont("f:mcf_data_base","t:EN","v:Adenine")         % select EN=Adenine
-  if check(mc)=0: MC(scantokens(mc)) fi
-endfont
-%******************************************************************************
-beginfont("f:mcf_data_base","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")        % select EN=Cytosine
-  if check(mc)=0: MC(scantokens(mc)) fi
-endfont
-%******************************************************************************
-beginfont("f:mcf_data_base","t:EN","v:Thymine")          % select EN=Thymine
-  if check(mc)=0: MC(scantokens(mc)) fi
-endfont
-%******************************************************************************
-beginfont("f+:mcf_data_base","t:n","v:5")                % 'f+'=keep file open
-  if check(mc)=0: MC(scantokens(mc)) fi                  % 'v:5' select No.5
-endfont
-%******************************************************************************
 forever:
-%%%%%%%%%%  beginfont("f+:mcf_data_base","v:*")          % select all
+%%%%%%%  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                                                %

Modified: trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.tex
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.tex	2021-09-05 06:01:03 UTC (rev 60427)
+++ trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_example.tex	2021-09-05 20:37:35 UTC (rev 60428)
@@ -10,7 +10,7 @@
 %--------------------------------
 %%%%\pdfpkresolution=1200
 %--------------------------------
-%%%\edef\f at ext{pk}%
+%%%%\edef\f at ext{pk}%
 \edef\f at ext{mps}%
 %--------------------------------
 \pagestyle{empty}
@@ -50,9 +50,9 @@
 \ifeof\@auxf\CONT at false\else%
   \infotovar{\info}%
   \begin{picture}(3750,3350)%
-     \put(20,3000){\footnotesize\bf \the\f at num:\EN}%
+     \put(20,3000){\footnotesize\bf \EN}%
      \put(20,2750){\labelM MW:\mw { / }FM:\fm}%
-     \put(20,2530){\labelM MW:\MW(data)}%
+     \put(20,2530){\labelM MW:\MW(data){ / }[\the\f at num]}%
      \put( 0,0){%
        \makebox(3750,2530){%
          \ifx\f at ext\@pk{\font\@font=\jobname\@font\char\f at num}%

Modified: trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_man_soc.mf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_man_soc.mf	2021-09-05 06:01:03 UTC (rev 60427)
+++ trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_man_soc.mf	2021-09-05 20:37:35 UTC (rev 60428)
@@ -1,9 +1,9 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Molecular Coding Format file for mcf_manual.tex  by Akira.Yamaji 2021.08.01
+% Molecular Coding Format file for mcf_manual.tex  by Akira.Yamaji 2021.09.05
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-input mcf2graph.mf;   %% it must be version 4.70
+input mcf2graph.mf;   %% it must be version 4.71
 % ** use data base file 'mcf_data_base.mcf'
-message "mcf_man_soc 2021.08.01"; message "";
+message "mcf_man_soc 2021.09.05"; message "";
 %------------------------------------------------------------------------
 sw_mframe:=0;
 sw_expand:=0;

Modified: trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.tex
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.tex	2021-09-05 06:01:03 UTC (rev 60427)
+++ trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_manual.tex	2021-09-05 20:37:35 UTC (rev 60428)
@@ -1,5 +1,5 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%  Molecular Coding Format manual                by  Akira Yamaji 2021.08.01
+%  Molecular Coding Format manual                by  Akira Yamaji 2021.09.05
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \documentclass[a4paper]{article}
 \usepackage[pdftex]{graphicx}
@@ -1629,9 +1629,67 @@
 <30,!5,-30,-30,!,-30,-30,!7,COOH,{6,9}=dr
 +------------------------------------------------------------------------------
 \end{verbatim}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%------------------------------------------------------------------------------
 \noindent%
 \newpage
+\subsection{Function query()}
+\index{query()}%
+\paragraph{(Example)}
+\begin{verbatim}
+%--------------------------------------------------------------
+% query()
+%
+% "i:filename" : input file name  (default "mcf_data_base.mcf")
+% "o:filename" : output file name (default "temp.mcf")
+% "s:sort-key" : sort by sort-key 
+%
+%  = , <> , <= , >= , < , >
+%
+% 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",
+      "Cat=biological","MW>=285","MW<=295");
+%--------------------------------------------------------------
+forever:
+  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);
+endfor
+%---------------------------------------------------------------
+\end{verbatim}
+%---------------------------------------------------------------
+\paragraph{(output)}
+\begin{verbatim}
+Cat:biological;EN:Atoropin;MW:289.375;EXA:1
++
+<30,O,!,//O,!,!,Ph,@$1,\~zb^-60,|,?7`1.1, at 6,*\^190`1.25,N!,&3~wb,$3:/!OH~wv 
++------------------------------------------------------------------------------
+Cat:biological;EN:Cianidanol;MW:290.27;EXA:1
++
+<30,Ph,3=?6, at 8,*\,Ph,7:O,{1,5,13,14}:/OH,9:/*OH
++------------------------------------------------------------------------------
+Cat:biological;EN:Lycorine;MW:287.315;EXA:1
++
+<30,Ph,-4=?6,-2=?6,6=?5,(9,12)=?5[3],13=dl,8:N,{15,17}:O,
+ 9:/*H^180,10:*/H^60,13:*/OH,14:/*OH
++------------------------------------------------------------------------------
+Cat:biological;EN:Morphine;MW:285.343;EXA:1
++
+<30,Ph,2=?6,-4=?6,(1,12)=?5[2],-1:O,-1=zb,
+ @7,60~wf`0.75,70~si_`1.3,45,N!,&9~wb,15=dl,6:/OH,8^180:*/H,12:/*OH
++------------------------------------------------------------------------------
+Cat:biological;EN:Piperine;MW:285.343;EXA:1
++
+<30,Ph,|,-1=?5,{1,3}:O,@$4,\,!!,!,!!,!,//O,!,|,?6,1:N
++------------------------------------------------------------------------------
+\end{verbatim}
+%------------------------------------------------------------------------------
+\noindent%
+\newpage
 \subsection{Information aux file output}
 \paragraph{(Insert option parameter setting)}
 \index{J}%

Modified: trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.tex
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.tex	2021-09-05 06:01:03 UTC (rev 60427)
+++ trunk/Master/texmf-dist/doc/metapost/mcf2graph/mcf_mplib_exa.tex	2021-09-05 20:37:35 UTC (rev 60428)
@@ -1,7 +1,7 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Example of  MCF typest with LuaLaTeX(luamplib)     by A.Yamaji    2021.08.01
+% Example of  MCF typest with LuaLaTeX(luamplib)    by A.Yamaji    2021.09.05
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% ** mcf2graph.mf must be version 4.70
+% ** mcf2graph.mf must be version 4.71
 % ** use mcf_data_base.mcf
 \documentclass{article}
 %------------------------------------------------------------------------------
@@ -355,9 +355,3 @@
 \end{verbatim}
 %----------------------------------------------------------------------------
 \end{document}
-le",(0.5w,0.5h));
-)
-endfont
-\end{verbatim}
-%----------------------------------------------------------------------------
-\end{document}

Modified: trunk/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
===================================================================
--- trunk/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf	2021-09-05 06:01:03 UTC (rev 60427)
+++ trunk/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf	2021-09-05 20:37:35 UTC (rev 60428)
@@ -1,5 +1,5 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% mcf2graph ver 4.70    Copyright (c) 2013-2021   Akira Yamaji
+% mcf2graph ver 4.71    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.70  2021.08.01";
+message "* This is mcf2graph ver 4.71  2021.09.05";
 %-------------------------------------------------------------------------------------------------
 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;
@@ -46,7 +46,7 @@
         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[];
 string  save_str[],tbl_atom_str[],strD[],tag[],file_name_output,blank_str,aux_delimiter,atomfont,
-        mpfont,s_tag,s_var,cal_FM,cal_MW,cal_MI,
+        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;
 pair    save_pair[],posA[],posM[][],msize,mposition,fsize,fmargin,save_mposition,posBs,posBe,dum;
 picture mol_stru[],atom_picture,save_picture,temp_picture;
@@ -94,6 +94,8 @@
   color color_list[];
   for i=1 upto 100: colorA[i]:=colorB[i]:=0; endfor
   prologues:=3;
+  default_data_file:="mcf_data_base.mcf";
+  default_temp_file:="temp.mcf";
   mpfont:="uhvr8r";
   atomfont:=defaultfont:="";
   %--default ahangle=45---------------------------------------------------------------------
@@ -253,9 +255,9 @@
 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,
-        mc,info,file_name_input,bond_cnt,warning_cnt,hideH_cnt,bondC;
+        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;
+  string info[],mc[],mc,temps,file_name_input,t_tag,filter_s;
   %------------------------------------------------------------------------------------------------
   def ext=ext_to_font enddef;
   def add=add_to_molecule enddef;
@@ -262,7 +264,7 @@
   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:="";
+  mc:=t_tag:=file_name_input:=cal_MW:=cal_MI:=cal_FM:=filter_s:="";
   %------------------------------------------------------------------------------------------------
   parts_cnt:=parts_usr_start;
   parts_int:=parts_int_start;
@@ -376,8 +378,8 @@
 %-------------------------------------------------------------------------------------------------
 def pickup_data_unit(expr t,v)=
   begingroup
-  save data_unit_cnt,f_end,semicol_cnt,cond,n_var;
-  f_end:=data_unit_cnt:=semicol_cnt:=cond:=at_semicol[0]:=inf_num:=0;
+  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
   forever:
     temps:=readfrom file_name_input;
@@ -385,9 +387,9 @@
     exitif temps=EOF;
     if subc(1,temps)="%":
     ef (subc(1,temps)="+")and(subc(2,temps)<>"-"):
-      data_unit_cnt:=data_unit_cnt+1;
+      unit_cnt:=unit_cnt+1;
       if v="*": cond:=1;
-      ef t="n": if data_unit_cnt=n_var: cond:=1; fi
+      ef t="n": if unit_cnt=n_var: cond:=1; fi
       else: if v=scantokens("inf_"&t): cond:=1; fi
       fi
       if cond=1:
@@ -414,10 +416,7 @@
         endfor
       fi
     else:
-      semicol_cnt:=0;
-      for i=1 upto length(temps):
-        if subc(i,temps)=";": semicol_cnt:=semicol_cnt+1; at_semicol[semicol_cnt]:=i; fi
-      endfor
+      semicol_cnt:=count_char(";",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;
@@ -446,6 +445,13 @@
   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;
@@ -454,9 +460,7 @@
   | :=(_com,_mark); || := (_com,_moff); ##:=(_com,_len_e);
   _:=Me; \:=0; \\:=zero_dm; *\:=zero_wf; \*:=zero_zf; *\*:=zero_wv;
   let = ==op_equ; let : ==op_col; let ^ ==op_hat; let ~ ==op_til; let > ==op_lt; let ` ==op_bq;
-%%%%%%%%%  def @$ == @.$ enddef;
-  def @$ == jump_atom_abs enddef;
-  def { == read_number( enddef; let } == ); def '==read_id enddef;
+  def @$ == jump_atom_abs enddef; def { == read_number( enddef; let } == ); def '==read_id enddef;
   def < == rot_angle enddef; def @ == jump_atom enddef; def & == cyc_atom enddef;
   def # == chg_length enddef; def $ == abs_adress enddef; def &$ == &.$ enddef;
   def / == group_si enddef; def // == group_dm enddef; def */ == group_wf enddef;
@@ -2074,24 +2078,161 @@
   fi
 enddef;
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-vardef count_data_unit(expr f)=
-  save temps,file_name,f_mcf,f_error,line_cnt,unit_cnt;
-  string temps,file_name;
-  line_cnt:=unit_cnt:=f_mcf:=f_error:=0;
-  file_name:=f&".mcf";
-  forever:
-    temps:=readfrom file_name;
-    exitif temps=EOF;
-    line_cnt:=line_cnt+1;
-    if subc(1,temps)="%":
+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;
+  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);
+    %---------------------------------------------------------------------------------------------
+    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;
+                      ef (at_equal-1)=at_greater: sign_at:=at_equal;   sign_n:=6; at_n:=2;
+                      else:                       sign_at:=at_equal;   sign_n:=1; at_n:=1; fi
+    ef at_greater>=2: if (at_greater-1)=at_less:  sign_at:=at_greater; sign_n:=2; at_n:=2;
+                      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];
+    %---------------------------------------------------------------------------------------------
+    if sign_n=0:
+      if tag_s="i": file_name_input:=var_s;
+      ef tag_s="o": file_name_output:=var_s;
+      ef tag_s="s": key_cnt:=key_cnt+1; key_s[key_cnt]:=var_s;
+      fi
+    %---------------------------------------------------------------------------------------------
     else:
-      if (subc(1,temps)="+")and(subc(2,temps)<>"-"): if f_mcf=1: f_error:=1; fi f_mcf:=1; fi
-      if (subc(1,temps)="+")and(subc(2,temps)="-"):
-        if f_mcf=0: f_error:=1; else: f_mcf:=0; unit_cnt:=unit_cnt+1; fi
+      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);
+      else:                               filter_var[filter_cnt]:=var_s;
       fi
-      exitif f_error=1;
     fi
   endfor
-  if f_error=1: -line_cnt else: unit_cnt fi
+  %------------------------------------------------------------------------------------------------
+  forever:
+    temps:=readfrom file_name_input; exitif temps=EOF;
+    if subc(1,temps)<>"%":
+      line_cnt:=line_cnt+1; unit_row:=unit_row+1;
+      line_s[unit_cnt][unit_row]:=temps;
+      if (subc(1,temps)="+")and(subc(2,temps)<>"-"): f_mcf:=1; mc_row:=1;
+      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;
+            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
+              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
+              fi
+            endfor
+          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]);
+            fi
+          endfor
+          %-------------------------------------------------------------------------------------
+        fi
+      fi
+    fi
+  endfor
+  %=============================================================================================
+  unit_cnt:=unit_cnt-1;
+  %---------------------------------------------------------------------------------------------
+  if key_cnt>=1:
+    for i=1 upto unit_cnt: order[i]:=0; endfor
+    for i=1 upto unit_cnt: min_s:="~";
+      for j=1 upto unit_cnt:
+        if order[j]=0: if sort_all[j]<min_s: min_s:=sort_all[j]; min_n:=j; fi fi
+      endfor
+      order[min_n]:=i; order_tbl[i]:=min_n;
+    endfor
+    for i=1 upto unit_cnt:
+      for j=1 upto unit_row_cnt[order_tbl[i]]: printf line_s[order_tbl[i]][j]; endfor
+    endfor
+  else:
+    for i=1 upto unit_cnt: for j=1 upto unit_row_cnt[i]: printf line_s[i][j]; endfor endfor
+  fi
+  closefrom file_name_input; closefrom file_name_output;
+  endgroup;
 enddef;
+%=============================================================================================
+vardef fix_s(expr n,s)=
+  save temp_s;
+  string temp_s;
+  if length(s)<n: temp_s:=s&substring(0,n-length(s)) of blank_str;
+  ef length(s)>n: temp_s:=substring(0,n) of s;
+  fi
+  temp_s
+enddef;
+%---------------------------------------------------------------------------------------------
+vardef fix_n(expr s)=
+  save temp_s,at_dot;
+  string temp_s;
+  temp_s:=s;
+  at_dot:=scan_char(".",temp_s,0,1);
+  if at_dot=0: temp_s:=fsr(4)(temp_s);  ef at_dot=1: temp_s:="   0"&temp_s;
+  ef at_dot=2: temp_s:="   "&temp_s;    ef at_dot=3: temp_s:="  "&temp_s;
+  ef at_dot=4: temp_s:=" "&temp_s;
+  fi
+  temp_s
+enddef;
+%---------------------------------------------------------------------------------------------
+vardef is_num(expr s)=
+  save numeric_n;
+  numeric_n:=1;
+  for i=1 upto length(s):
+    if ((subc(i,s)>="0")and(subc(i,s)<="9"))or(subc(i,s)="."): else: numeric_n:=0; fi
+  endfor
+  numeric_n
+enddef;
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



More information about the tex-live-commits mailing list.