summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/supp-fil.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/supp-fil.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/supp-fil.mkiv66
1 files changed, 32 insertions, 34 deletions
diff --git a/Master/texmf-dist/tex/context/base/supp-fil.mkiv b/Master/texmf-dist/tex/context/base/supp-fil.mkiv
index 872612eab0b..6b9af21cee2 100644
--- a/Master/texmf-dist/tex/context/base/supp-fil.mkiv
+++ b/Master/texmf-dist/tex/context/base/supp-fil.mkiv
@@ -12,7 +12,7 @@
%C details.
%D \TEX\ operates on files, so one wouldn't wonder that there
-%D is a separate module for file support. In \CONTEXT\ files
+%D is a separate module for file commands. In \CONTEXT\ files
%D are used for several purposes:
%D
%D \startitemize[packed]
@@ -39,11 +39,8 @@
\def\f!parentpath {..}
\fi
-% \def\openinputfile #1#2{\immediate\openin #1="#2"\relax} \def\closeinputfile #1{\immediate\closein #1}
-% \def\openoutputfile#1#2{\immediate\openout#1="#2"\relax} \def\closeoutputfile#1{\immediate\closeout#1}
-
-\def\openinputfile #1#2{\immediate\openin #1=#2\relax} \def\closeinputfile #1{\immediate\closein #1}
-\def\openoutputfile#1#2{\immediate\openout#1=#2\relax} \def\closeoutputfile#1{\immediate\closeout#1}
+\def\openinputfile #1#2{\immediate\openin #1={#2}} \def\closeinputfile #1{\immediate\closein #1}
+\def\openoutputfile#1#2{\immediate\openout#1={#2}} \def\closeoutputfile#1{\immediate\closeout#1}
%D \macros
%D {pushendofline,popendofline}
@@ -60,25 +57,20 @@
%D ... reading ...
%D \popendofline
%D \stoptyping
-%D
-%D Just to be sure, we save the current meaning of \type{^^M}
-%D in \type{\poppedendofline}.
\newcount \endoflinelevel
-\ifx\newlinecode\undefined \chardef\newlinecode=`\^^M \fi
-
\def\pushendofline
{\advance\endoflinelevel\plusone
- \expandafter\chardef\csname :eol:\number\endoflinelevel\endcsname\catcode\newlinecode
- \catcode\newlinecode\@@comment\relax}
+ \expandafter\chardef\csname :eol:\number\endoflinelevel\endcsname\catcode\endoflineasciicode
+ \catcode\endoflineasciicode\commentcatcode\relax}
\def\popendofline
- {\catcode\newlinecode\csname :eol:\number\endoflinelevel\endcsname
+ {\catcode\endoflineasciicode\csname :eol:\number\endoflinelevel\endcsname
\advance\endoflinelevel\minusone}
\def\restoreendofline
- {\catcode\newlinecode\@@endofline}
+ {\catcode\endoflineasciicode\endoflinecatcode}
%D \macros
%D {scratchread, scratchwrite}
@@ -106,8 +98,8 @@
\def\writeln#1{\write#1{}}
-\def\doiffileexistselse #1{\ctxlua{support.doiffileexistelse([[#1]])}}
-\def\lastfoundexistingfile {\ctxlua{support.lastexistingfile()}}
+\def\doiffileexistselse #1{\ctxcommand{doiffileexistelse([[#1]])}}
+\def\lastfoundexistingfile {\ctxcommand{lastexistingfile()}}
%D \macros
%D {doprocessfile,fileline,fileprocessedtrue,dofinishfile}
@@ -172,13 +164,13 @@
{\edef#3{#2}}
{\edef#3{#1\f!pathseparator#2}}}
-\def\sanitizefilename#1\to#2{\edef#2{\ctxlua{support.thesanitizedfilename([[#1]])}}}
+\def\sanitizefilename#1\to#2{\edef#2{\ctxcommand{thesanitizedfilename([[#1]])}}}
%D NEW:
-\chardef\kindoffile=0 % 0=normal 1=full path spec (or http) / set at the lua end
+\newconstant\kindoffile % 0=normal 1=full path spec (or http) / set at the lua end
-\def\checkfilename#1{\ctxlua{support.checkfilename([[#1]])}}
+\def\checkfilename#1{\ctxcommand{checkfilename([[#1]])}}
%D \macros
%D {input, normalinput}
@@ -191,7 +183,7 @@
\unexpanded\def\input{\normalinput}
-\def\inputgivenfile#1{\normalinput"#1"\relax}
+\def\inputgivenfile#1{\normalinput{#1}}
%D \macros
%D {readfile,ReadFile}
@@ -248,13 +240,13 @@
\let \everyreadfile \everybeforereadfile
-\def\maxreadlevel{\ctxlua{commands.maxreadlevel()}}
+\def\maxreadlevel{\ctxcommand{maxreadlevel()}}
% We need to postpone loading, else we got frozen type-* files and so when
% a format is generated on a source path.
\def\doreadfile#1#2#3% protocol path filename true false
- {\edef\readfilename{\ctxlua{support.doreadfile("#1","#2","#3")}}%
+ {\edef\readfilename{\ctxcommand{doreadfile("#1","#2","#3")}}%
\ifx\readfilename\empty
\expandafter\doreadfilenop
\else
@@ -318,10 +310,14 @@
\readfile{#1}{#2}{#3}%
\popcatcodetable}
-\def\readxmlfile#1#2#3%
- {\pushcatcodetable \catcodetable \xmlcatcodes
- \readfile{#1}{#2}{#3}%
- \popcatcodetable}
+\ifdefined \xmlcatcodes
+
+ \def\readxmlfile#1#2#3%
+ {\pushcatcodetable \catcodetable \xmlcatcodes
+ \readfile{#1}{#2}{#3}%
+ \popcatcodetable}
+
+\fi
%D \macros
%D {doiffileelse,doiflocfileelse}
@@ -403,7 +399,7 @@
\ifx\outputfilename\undefined \def\outputfilename{\jobname} \fi
-\def\doifparentfileelse#1{\ctxlua{support.doifparentfileelse([[#1]])}}
+\def\doifparentfileelse#1{\ctxcommand{doifparentfileelse([[#1]])}}
\newcount\readingfilelevel
@@ -415,11 +411,13 @@
\unexpanded\def\startreadingfile% beter een every en \setnormalcatcodes
{\global\advance\readingfilelevel\plusone
\the\everystartreadingfile
- \beginrestorecatcodes
- \setcatcodetable\prtcatcodes}
+ \pushcatcodetable % saveguard
+ \ctxlua{regimes.push()}% temporarily this way
+ }% \setcatcodetable\prtcatcodes % no longer in mkiv, has to be done explictly
\unexpanded\def\stopreadingfile
- {\endrestorecatcodes
+ {\popcatcodetable % saveguard
+ \ctxlua{regimes.pop()}% temporarily this way
\the\everystopreadingfile
\global\advance\readingfilelevel\minusone}
@@ -450,7 +448,7 @@
%D
%D \start \typebuffer \getbuffer \stop
-\def\splitoffroot{.} \chardef\splitoffkind\zerocount
+\def\splitoffroot{.} \newconstant\splitoffkind
\let\splitofffull\empty
\let\splitoffpath\empty
@@ -458,7 +456,7 @@
\let\splitoffname\empty
\let\splitofftype\empty
-\def\splitfilename#1{\ctxlua{support.splitfilename([[#1]])}}
-\def\splitfiletype#1{\ctxlua{support.splitfiletype([[#1]])}}
+\def\splitfilename#1{\ctxcommand{splitfilename([[#1]])}}
+\def\splitfiletype#1{\ctxcommand{splitfiletype([[#1]])}}
\protect \endinput