summaryrefslogtreecommitdiff
path: root/tex/context/base/core-job.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/core-job.mkiv')
-rw-r--r--tex/context/base/core-job.mkiv94
1 files changed, 53 insertions, 41 deletions
diff --git a/tex/context/base/core-job.mkiv b/tex/context/base/core-job.mkiv
index e7771e22c..ad75cd079 100644
--- a/tex/context/base/core-job.mkiv
+++ b/tex/context/base/core-job.mkiv
@@ -58,31 +58,21 @@
\def\usesubpath [#1]{\edef\allinputpaths{\ctxlua{commands.usesubpath("#1")}}}
\def\usezipfile {\dodoubleempty\dousezipfile}
\def\dousezipfile[#1][#2]{\ctxlua{commands.usezipfile("#1","#2")}} % [filename] [optional subtree]
-
\def\loadexamodes {\dosingleempty\doloadexamodes}
\def\doloadexamodes [#1]{\ctxlua{commands.loadexamodes("#1")}}
\def\registerfileinfo[#1#2]#3% geen \showmessage ?
{\writestatus\m!systems{#1#2 file #3 at line \the\inputlineno}}
-\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}
+\def\doloadsystemfile#1% only mkiv files
+ {\readsysfile{#1.\mksuffix}{\showmessage\m!systems2{#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 % this will move to lua and get preloaded
- \donothing
- \loadallsystemfiles\f!sysfilename
- {\loadallsystemfiles{\f!sysfilename.rme}\donothing % new, fall back
- \loadallsystemfiles \f!errfilename \donothing}}
+ \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.
@@ -178,21 +168,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}
@@ -202,7 +205,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%
@@ -216,10 +219,10 @@
\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}
@@ -235,24 +238,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\\}
@@ -275,18 +288,17 @@
{\beforesplitstring##1\at.\to\someevironment
\fullexpandoneargafter\addtocommalist\someevironment\loadedlocalenvironments}%
\processcommalist[#1]\docommand
- \fullexpandtwoargsafter\doifcommonelse % no longer next needed
- {\currentproject,\currentproduct,%
- \currentcomponent,\currentenvironment}
- {\loadedlocalenvironments}
+ \expanded{\doifcommonelse{\currentproject,\currentproduct,\currentcomponent,\currentenvironment}{\loadedlocalenvironments}} % \expanded not needed
{\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