summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/core-job.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/core-job.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/core-job.mkiv144
1 files changed, 74 insertions, 70 deletions
diff --git a/Master/texmf-dist/tex/context/base/core-job.mkiv b/Master/texmf-dist/tex/context/base/core-job.mkiv
index de328c92bca..db8d3ed933e 100644
--- a/Master/texmf-dist/tex/context/base/core-job.mkiv
+++ b/Master/texmf-dist/tex/context/base/core-job.mkiv
@@ -43,7 +43,7 @@
\def\dostarttextfile#1%
{\global\advance\fileprocesslevel\plusone
\setxvalue{\c!file::\number\fileprocesslevel}{#1}%
- \@EA\doglobal\@EA\addtocommalist\@EA{#1}\processedfiles}
+ \doglobal\addtocommalist{#1}\processedfiles}
\def\dostoptextfile
{\global\advance\fileprocesslevel\minusone}
@@ -51,53 +51,35 @@
\def\processlocalfile#1#2%
{#1{#2}\donothing{\readfile{#2}\donothing\donothing}}
-\def\processfile #1{\ctxlua{commands.processfile("#1")}}
-\def\doifinputfileelse #1{\ctxlua{commands.doifinputfileelse("#1")}}
-\def\locatefilepath #1{\edef\locatedfilepath{\ctxlua{commands.locatefilepath("#1")}}}
-\def\usepath [#1]{\edef\allinputpaths{\ctxlua{commands.usepath("#1")}}}
-\def\usesubpath [#1]{\edef\allinputpaths{\ctxlua{commands.usesubpath("#1")}}}
+\def\processfile #1{\ctxcommand{processfile("#1")}}
+\def\doifinputfileelse #1{\ctxcommand{doifinputfileelse("#1")}}
+\def\locatefilepath #1{\edef\locatedfilepath{\ctxcommand{locatefilepath("#1")}}}
+\def\usepath [#1]{\edef\allinputpaths{\ctxcommand{usepath("#1")}}}
+\def\usesubpath [#1]{\edef\allinputpaths{\ctxcommand{usesubpath("#1")}}}
\def\usezipfile {\dodoubleempty\dousezipfile}
-\def\dousezipfile[#1][#2]{\ctxlua{commands.usezipfile("#1","#2")}} % [filename] [optional subtree]
-
+\def\dousezipfile[#1][#2]{\ctxcommand{usezipfile("#1","#2")}} % [filename] [optional subtree]
\def\loadexamodes {\dosingleempty\doloadexamodes}
-\def\doloadexamodes [#1]{\ctxlua{commands.loadexamodes("#1")}}
+\def\doloadexamodes [#1]{\ctxcommand{loadexamodes("#1")}}
\def\registerfileinfo[#1#2]#3% geen \showmessage ?
- {\writestatus\m!systems{#1#2 file #3 at line \the\inputlineno}}
-
-\ifx\preloadfonts \undefined \let\preloadfonts \relax \fi
-\ifx\preloadspecials\undefined \let\preloadspecials\relax \fi
-
-\def\loadallsystemfiles#1#2%
- {\ifx\@@svdirectory\empty
- \readsysfile{#1}{\showmessage\m!systems2{#1}}{#2}%
- \else% yet undocumented
- \def\doloadsystemfile##1%
- {\readsetfile{##1}{#1}{\showmessage\m!systems2{#1}}{#2}}%
- \processcommacommand[\@@svdirectory]\doloadsystemfile
- \fi}
+ {\writestatus\m!system{#1#2 file #3 at line \the\inputlineno}}
-\ifx\disableXML\undefined \let\disableXML\relax \fi
+\def\doloadsystemfile#1% only mkiv files
+ {\readsysfile{#1.\mksuffix}{\showmessage\m!system2{#1.\mksuffix}}\donothing}
\def\loadsystemfiles
- {\reportprotectionstate
- \readsysfile\f!newfilename{\showmessage\m!systems2\f!newfilename}\donothing
- %\readsysfile\f!oldfilename{\showmessage\m!systems2\f!oldfilename}\donothing
- \loadallsystemfiles\f!filfilename
- \donothing
- \loadallsystemfiles\f!sysfilename
- {\loadallsystemfiles{\f!sysfilename.rme}\donothing % new, fall back
- \doglobal\appendtoks % brrr better \setcatcodetable\ctxcatcodes % % test
- \bgroup\disableXML\loadallsystemfiles\f!errfilename\donothing\egroup
- \to\everygoodbye}}
+ {\doloadsystemfile\f!newfilename % new code, to be integrated at some point, plus fixes posted on the list
+ \doloadsystemfile\f!locfilename % new code, somewhat experimental, not distributed (outside the dev group)
+ \doloadsystemfile\f!expfilename % new code, very experimental, can be engine specific, mostly for me only
+ \doloadsystemfile\f!sysfilename} % local settings, but probably not that good an idea to use
%D We don't want multiple jobfiles to interfere.
-\def\loadoptionfile
+\def\loadoptionfile % todo : mark document.* tables as storage
{\readjobfile{\jobname.\f!optionextension}
- {\showmessage\m!systems2{\jobname.\f!optionextension}%
- \ctxlua{commands.logoptionfile("\jobname.\f!optionextension")}}%
- {\writestatus\m!systems {no \jobname.\f!optionextension}}}
+ {\writestatus\m!system{\jobname.\f!optionextension\space loaded}%
+ \ctxcommand{logoptionfile("\jobname.\f!optionextension")}}%
+ {\writestatus\m!system{no \jobname.\f!optionextension}}}
% Most natural ...
%
@@ -137,7 +119,7 @@
\fi}
\def\forcequitjob#1%
- {\writestatus\m!systems{forcing quit: #1}%
+ {\writestatus\m!system{forcing quit: #1}%
\batchmode
\dorecurse\textlevel{\stoptext}
\normalend}
@@ -147,7 +129,7 @@
\def\autostarttext
{\ifcase\textlevel
\starttext
- \writestatus\m!systems{auto \string\starttext..\string\stoptext}%
+ \writestatus\m!system{auto \string\starttext..\string\stoptext}%
\let\autostoptext\stoptext
\fi}
@@ -164,15 +146,15 @@
\let\end\finalend
\def\emergencyend
- {\writestatus\m!systems{invalid \@EA\string\csname\e!start\v!text\endcsname...\@EA\string\csname\e!stop\v!text\endcsname\space structure}%
+ {\writestatus\m!system{invalid \@EA\string\csname\e!start\v!text\endcsname...\@EA\string\csname\e!stop\v!text\endcsname\space structure}%
\stoptext}
\def\currentfile{\inputfilename}
\def\doexecutefileonce#1%
{\beforesplitstring#1\at.\to\currentfile
- \fullexpandtwoargsafter\doifnotinset\currentfile\loadedfiles
- {\fullexpandoneargafter\addtocommalist\currentfile\loadedfiles
+ \doifnotinset\currentfile\loadedfiles
+ {\addtocommalist\currentfile\loadedfiles
\doexecutefile{#1}}}
\def\doexecutefile#1%
@@ -185,21 +167,34 @@
\def\donotexecutefile#1%
{}
-\def\useenvironment[#1]% maybe commalist
- {\environment #1 \relax}
+\unexpanded\def\project {\doifnextoptionalelse\useproject \redoproject}
+\unexpanded\def\environment{\doifnextoptionalelse\useenvironment\redoenvironment}
+\unexpanded\def\product {\doifnextoptionalelse\useproduct \redoproduct}
+\unexpanded\def\component {\doifnextoptionalelse\usecomponent \redocomponent}
+
+\def\redoproject #1 {\useproject [#1]}
+\def\redoenvironment #1 {\useenvironment[#1]}
+\def\redoproduct #1 {\useproduct [#1]}
+\def\redocomponent #1 {\usecomponent [#1]}
-\def\environment #1 % at outermost level only (load only once)
- {\pushmacro\startenvironment
+\def\useproject[#1]%
+ {}
+
+\def\useenvironment[#1]% maybe commalist
+ {\pushmacro\dostartenvironment % we could use a depth counter
\pushmacro\stopenvironment
- \unexpanded\def\startenvironment ##1 {}%
+ \unexpanded\def\dostartenvironment[##1]{}%
\let\stopenvironment\relax
\startreadingfile
\doexecutefileonce{#1}
\stopreadingfile
\popmacro\stopenvironment
- \popmacro\startenvironment}
+ \popmacro\dostartenvironment}
-\def\component #1 % at outermost level only
+\def\useproduct[#1]%
+ {}
+
+\def\usecomponent[#1]%
{\dostarttextfile{#1}%
\processfile{#1}%
\dostoptextfile}
@@ -209,7 +204,7 @@
\let\currentcomponent \v!text
\let\currentcomponentpath\f!currentpath
-\def\donextlevel#1#2#3#4#5#6#7\\%
+\def\donextlevel#1#2#3#4#5#6#7\\% we will move this to lua
{\pushmacro\currentcomponent
\pushmacro\currentcomponentpath
\let\currentcomponent#1%
@@ -223,13 +218,13 @@
\beforesplitstring#7\at.\to#2\relax % can become path + base
\ifcase\filelevel\relax
\starttext
- \def\project ##1 {#3{##1}}%
- \def\environment ##1 {#4{##1}}%
- \def\product ##1 {#5{##1}}%
- \def\component ##1 {#6{##1}}%
+ \unexpanded\def\useproject [##1]{#3{##1}}%
+ \unexpanded\def\useenvironment[##1]{#4{##1}}%
+ \unexpanded\def\useproduct [##1]{#5{##1}}%
+ \unexpanded\def\usecomponent [##1]{#6{##1}}%
\fi
\advance\filelevel\plusone
- \fullexpandoneargafter\addtocommalist{#1}\loadedfiles}
+ \addtocommalist{#1}\loadedfiles}
\def\doprevlevel
{\popmacro\currentcomponentpath
@@ -242,24 +237,34 @@
\expandafter\endinput
\fi}
-\unexpanded\def\startproject #1 %
+\unexpanded\def\startproject {\doifnextoptionalelse\dostartproject \redostartproject}
+\unexpanded\def\startenvironment{\doifnextoptionalelse\dostartenvironment\redostartenvironment}
+\unexpanded\def\startproduct {\doifnextoptionalelse\dostartproduct \redostartproduct}
+\unexpanded\def\startcomponent {\doifnextoptionalelse\dostartcomponent \redostartcomponent}
+
+\def\redostartproject #1 {\dostartproject [#1]}
+\def\redostartenvironment #1 {\dostartenvironment[#1]}
+\def\redostartproduct #1 {\dostartproduct [#1]}
+\def\redostartcomponent #1 {\dostartcomponent [#1]}
+
+\def\dostartproject[#1]%
{\donextlevel\v!project\currentproject
\donotexecutefile\doexecutefileonce
\doexecutefileonce\doexecutefile#1\\}
-\unexpanded\def\startproduct #1 %
+\def\dostartproduct[#1]%
{\doateverystarttext
\donextlevel\v!product\currentproduct
\doexecutefileonce\doexecutefileonce
\donotexecutefile\doexecutefile#1\\}
-\unexpanded\def\startcomponent #1 %
+\def\dostartcomponent[#1]%
{\doateverystarttext
\donextlevel\v!component\currentcomponent
\doexecutefileonce\doexecutefileonce
\donotexecutefile\doexecutefile#1\\}
-\unexpanded\def\startenvironment #1 %
+\def\dostartenvironment[#1]%
{\donextlevel\v!environment\currentenvironment
\donotexecutefile\doexecutefileonce
\donotexecutefile\donotexecutefile#1\\}
@@ -280,26 +285,25 @@
{\let\loadedlocalenvironments\empty
\def\docommand##1%
{\beforesplitstring##1\at.\to\someevironment
- \fullexpandoneargafter\addtocommalist\someevironment\loadedlocalenvironments}%
+ \addtocommalist\someevironment\loadedlocalenvironments}%
\processcommalist[#1]\docommand
- \fullexpandtwoargsafter\doifcommonelse % no longer next needed
- {\currentproject,\currentproduct,%
- \currentcomponent,\currentenvironment}
- {\loadedlocalenvironments}
+ \doifcommonelse{\currentproject,\currentproduct,\currentcomponent,\currentenvironment}\loadedlocalenvironments
{\letvalue{\e!stop\v!localenvironment}\relax}
- {\grabuntil{\e!stop\v!localenvironment}\gobbleoneargument}} % TH: fixed, was \relax
+ {\grabuntil{\e!stop\v!localenvironment}\gobbleoneargument}}
+
+\setvalue{\v!localenvironment}{\doifnextoptionalelse\uselocalenvironment\redolocalenvironment}
+
+\def\redolocalenvironment#1 {\uselocalenvironment[#1]}
-\setvalue{\v!localenvironment}#1 {\doexecutefileonce{#1}}
-
-% NOT TOEVOEGEN: \the\everytrace
+\def\uselocalenvironment[#1]{\doexecutefileonce{#1}}
-\neverypar\emptytoks
+\neverypar\emptytoks % here ?
% \appendtoks \flushnotes \to \everypar
% \appendtoks \synchronizesidefloats \to \everypar
% \appendtoks \checkindentation \to \everypar
% \appendtoks \showparagraphnumber \to \everypar
-% \appendtoks \flushmargincontents \to \everypar
+% %appendtoks \flushmargincontents \to \everypar
% \appendtoks \flushcommentanchors \to \everypar
% \appendtoks \synchronizenotes \to \everypar