%D \module %D [ file=core-two, % moved from core-uti %D version=1997.03.31, % stripped down 2023-03-21 %D title=\CONTEXT\ Core Macros, %D subtitle=Two Pass Data, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. %D The public interface is replaced by datasets and two pass data is now private %D to the engine. For the moment we keep some commands commented. The unused %D (second) argument is an inheritance from \MKII. If needed we can bring back %D a compatible interface. \writestatus{loading}{ConTeXt Core Macros / Two Pass Data} \unprotect \registerctxluafile{core-two}{autosuffix} % %D This is a rather old mechanism which has not changed much over time, apart from % %D adding a few more selectors. This code used to be part of \type {core-uti}. The % %D following examples demonstrate the interface. % %D % %D \startbuffer % %D \definetwopasslist{test-1} % %D % %D \gettwopassdatalist{test-1} [\twopassdatalist=] % %D \checktwopassdata {test-1} [\twopassdata=] % %D \checktwopassdata {test-1} [\twopassdata=] % %D \gettwopassdata {test-1} [\twopassdata=] % %D \gettwopassdata {test-1} [\twopassdata=] % %D % %D \definetwopasslist{test-2} % %D % %D \lazysavetwopassdata{test-2}{1}{x} % %D \lazysavetwopassdata{test-2}{2}{y} % %D \lazysavetwopassdata{test-2}{3}{z} % %D % %D \gettwopassdatalist{test-2} [\twopassdatalist=x,y,z] % %D \checktwopassdata {test-2} [\twopassdata=x] % %D \checktwopassdata {test-2} [\twopassdata=x] % %D \gettwopassdata {test-2} [\twopassdata=x] % %D \gettwopassdata {test-2} [\twopassdata=y] % %D \gettwopassdata {test-2} [\twopassdata=z] % %D \gettwopassdata {test-2} [\twopassdata=] % %D % %D \definetwopasslist{test-3} % %D % %D \lazysavetaggedtwopassdata{test-3}{1}{x}{a} % %D \lazysavetaggedtwopassdata{test-3}{2}{y}{b} % %D \lazysavetaggedtwopassdata{test-3}{3}{z}{c} % %D % %D \findtwopassdata{test-3}{x} [\twopassdata=a] % %D \findtwopassdata{test-3}{y} [\twopassdata=b] % %D \findtwopassdata{test-3}{z} [\twopassdata=c] % %D \findtwopassdata{test-3}{w} [\twopassdata=] % %D % %D \definetwopasslist{test-4} % %D % %D \lazysavetwopassdata{test-4}{1}{A} % %D \lazysavetwopassdata{test-4}{2}{B} % %D \lazysavetwopassdata{test-4}{3}{C} % %D % %D \getfirsttwopassdata{test-4} [\twopassdata=A] % %D \getlasttwopassdata {test-4} [\twopassdata=C] % %D \getfirsttwopassdata{test-4} [\twopassdata=A] % %D \getlasttwopassdata {test-4} [\twopassdata=C] % %D \getfromtwopassdata {test-4}{1} [\twopassdata=A] % %D \getfromtwopassdata {test-4}{3} [\twopassdata=C] % %D \getfromtwopassdata {test-4}{2} [\twopassdata=B] % %D \stopbuffer % %D % %D \getbuffer \typebuffer % % %D The next code can be simplified (read: defined at the \LUA\ end) but we never use this % %D mechanism which has been replaced by datasets so it's not worth the effort. % % \permanent\def\immediatesavetwopassdata #1#2#3{\normalexpanded{\noexpand\clf_savetwopassdata{#1}{#3}}} % \permanent\def \lazysavetwopassdata #1#2#3{\normalexpanded{\noexpand\ctxlatecommand{savetwopassdata("#1","#3")}}} % \permanent\let \savetwopassdata \lazysavetwopassdata % \permanent\def \savetaggedtwopassdata#1#2#3#4{\normalexpanded{\noexpand\clf_savetaggedtwopassdata{#1}{#3}{#4}}} % \permanent\def\lazysavetaggedtwopassdata#1#2#3#4{\normalexpanded{\noexpand\ctxlatecommand{savetaggedtwopassdata("#1","#3","#4")}}} % % % temp hack: needs a proper \starteverytimeluacode % % \newconditional\twopassdatafound % % \mutable\lettonothing\twopassdata % \mutable\lettonothing\twopassdatalist % % \mutable\let\noftwopassitems\!!zeropoint % % \def\syst_twopass_check % can be delegated to lua once obsolete is gone % {\ifempty\twopassdata % \twopassdatafound\conditionalfalse % \else % \twopassdatafound\conditionaltrue % \fi} % % \permanent\protected\def\definetwopasslist #1{\clf_definetwopasslist{#1}} % \permanent\protected\def\gettwopassdata #1{\edef\twopassdata {\clf_gettwopassdata {#1}}\syst_twopass_check} % \permanent\protected\def\checktwopassdata #1{\edef\twopassdata {\clf_checktwopassdata {#1}}\syst_twopass_check} % \permanent\protected\def\findtwopassdata #1#2{\edef\twopassdata {\clf_findtwopassdata {#1}{#2}}\syst_twopass_check} % \permanent\protected\def\getfirsttwopassdata #1{\edef\twopassdata {\clf_getfirsttwopassdata {#1}}\syst_twopass_check} % \permanent\protected\def\getlasttwopassdata #1{\edef\twopassdata {\clf_getlasttwopassdata {#1}}% % \edef\noftwopassitems{\clf_counttwopassdata {#1}}\syst_twopass_check} % \permanent\protected\def\getnamedtwopassdatalist#1#2{\edef #1{\clf_gettwopassdatalist {#2}}} % \permanent\protected\def\gettwopassdatalist #1{\edef\twopassdatalist{\clf_gettwopassdatalist {#1}}} % % \permanent\protected\def\doifelseintwopassdata #1#2{\clf_doifelseintwopassdata{#1}{#2}} % % \aliased\let\doifintwopassdataelse\doifelseintwopassdata % \aliased\let\getfromtwopassdata \findtwopassdata \protect \endinput