summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/supp-fil.tex
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2008-06-12 10:42:53 +0000
committerTaco Hoekwater <taco@elvenkind.com>2008-06-12 10:42:53 +0000
commit0d01365d53c456d246da0ca1f0b3cd9868f02b35 (patch)
tree01a655c8028e17cfb371456b299c1848fe08c05b /Master/texmf-dist/tex/context/base/supp-fil.tex
parent44f3714442da07fdfc36a7f2a8dcd5d4294c5d26 (diff)
ConTeXt release 2008.05.21
git-svn-id: svn://tug.org/texlive/trunk@8691 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/supp-fil.tex')
-rw-r--r--Master/texmf-dist/tex/context/base/supp-fil.tex165
1 files changed, 46 insertions, 119 deletions
diff --git a/Master/texmf-dist/tex/context/base/supp-fil.tex b/Master/texmf-dist/tex/context/base/supp-fil.tex
index b41858396d2..4d31bfd280e 100644
--- a/Master/texmf-dist/tex/context/base/supp-fil.tex
+++ b/Master/texmf-dist/tex/context/base/supp-fil.tex
@@ -42,8 +42,14 @@
%D
%D We save a few primitives first.
-\let\normalwrite\write
+\let\normalwrite \write
\let\normalimmediate\immediate
+
+% \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}
%D \macros
%D {pushendofline,popendofline}
@@ -75,18 +81,18 @@
%
% support for nested usage:
-\newcounter \endoflinelevel
+\newcount \endoflinelevel
\ifx\newlinecode\undefined \chardef\newlinecode=`\^^M \fi
\def\pushendofline
- {\fastincrement\endoflinelevel
- \expandafter\chardef\csname :eol:\endoflinelevel\endcsname\catcode\newlinecode
+ {\advance\endoflinelevel\plusone
+ \expandafter\chardef\csname :eol:\number\endoflinelevel\endcsname\catcode\newlinecode
\catcode\newlinecode\@@comment\relax}
\def\popendofline
- {\catcode\newlinecode\csname :eol:\endoflinelevel\endcsname
- \fastdecrement\endoflinelevel}
+ {\catcode\newlinecode\csname :eol:\number\endoflinelevel\endcsname
+ \advance\endoflinelevel\minusone}
\def\restoreendofline
{\catcode\newlinecode\@@endofline}
@@ -109,7 +115,8 @@
%D one.
\def\unlinkfile#1%
- {\immediate\openout\scratchwrite=#1\immediate\closeout\scratchwrite}
+ {\openoutputfile \scratchwrite{#1}%
+ \closeoutputfile\scratchwrite}
%D \macros
%D {writeln}
@@ -121,12 +128,12 @@
\def\doiffileexistselse#1%
{\doifelsenothing{#1}
{\secondoftwoarguments}
- {\immediate\openin\scratchread=#1\relax
+ {\openinputfile\scratchread{#1}%
\ifeof\scratchread
- \immediate\closein\scratchread
+ \closeinputfile\scratchread
\expandafter\secondoftwoarguments
\else
- \immediate\closein\scratchread
+ \closeinputfile\scratchread
\expandafter\firstoftwoarguments
\fi}}
@@ -151,14 +158,14 @@
\let\fileline\empty
\def\doprocessfile#1#2#3%
- {\immediate\openin#1=#2\relax
+ {\openinputfile{#1}{#2}%
\ifeof#1%
\fileprocessedfalse
- \immediate\closein#1%
+ \closeinputfile#1%
\else
\fileprocessedtrue
\gdef\dofinishfile
- {\immediate\closein#1%
+ {\closeinputfile#1%
\global\let\doprocessline\relax}%
\gdef\doprocessline
{\ifeof#1%
@@ -214,6 +221,8 @@
\unexpanded\def\input{\normalinput}
+\def\inputgivenfile#1{\normalinput"#1"\relax}
+
%D \macros
%D {readfile,ReadFile,maxreadlevel}
%D
@@ -277,6 +286,8 @@
\newif\iftracefiles
+\newcount\readlevel
+
\def\maxreadlevel{3}
\newconditional\trackfilenames
@@ -329,7 +340,7 @@
\iftracefiles\writestatus\m!systems{#1 located}\fi
\def\next{#2\dodoreadfile}}%
{\iftracefiles\writestatus\m!systems{cannot locate #1}\fi
- \decrement\readlevel\relax
+ \advance\readlevel\minusone
\ifnum\readlevel>\zerocount
\edef\readfilename{\pathplusfile{\f!parentpath}{\readfilename}}%
\def\next{\redoreadfile\readfilename{#2}{#3}}%
@@ -343,13 +354,14 @@
\setxvalue{fn..\trackedfilename}{\readfilename}%
\fi
\the\everybeforereadfile
- \normalinput\readfilename\relax
+% \normalinput\readfilename\relax
+ \relax\inputgivenfile\readfilename\relax
\the\everyafterreadfile}
% too less:
%
% \unexpanded\def\readfile% #1%
-% {\let\readlevel\maxreadlevel
+% {\readlevel\maxreadlevel
% \doreadfile\empty} % {#1}
%
% too much:
@@ -388,15 +400,15 @@
%D Due to different needs, we decided to offer four alternative
%D loading commands. With \type{\readjobfile} we load a local
%D file and do no backtracking, while \type{\readlocfile}
-%D backtracks~\readlevel\ directories, including the current
+%D backtracks~\number\readlevel\ directories, including the current
%D one.
\unexpanded\def\readjobfile % #1% current path, no backtracking
- {\newcounter\readlevel
+ {\readlevel\zerocount
\doreadfile\f!currentpath} % {#1}}
\unexpanded\def\readlocfile % #1% current path, backtracking
- {\let\readlevel\maxreadlevel
+ {\readlevel\maxreadlevel
\doreadfile\f!currentpath} % {#1}}
%D System files can be anywhere and therefore
@@ -404,7 +416,7 @@
%D and obeys the \TEX\ implementation.
\unexpanded\def\readsysfile % #1% current path, obeys tex search
- {\newcounter\readlevel
+ {\readlevel\zerocount
\doreadfile\empty} % {#1}}
%D Of the last two, \type{\readfixfile} searches on the
@@ -412,11 +424,11 @@
%D \type{\readsetfile} does only search on the specified path.
\unexpanded\def\readfixfile % #1#2% specified path, backtracking
- {\let\readlevel\maxreadlevel
+ {\readlevel\maxreadlevel
\doreadfile} % {#1}{#2}}
\unexpanded\def\readsetfile % #1#2% specified path, no backtracking
- {\newcounter\readlevel
+ {\readlevel\zerocount
\doreadfile} % {#1}{#2}}
%D After having defined this commands, we reconsidered the
@@ -451,31 +463,31 @@
{\sanitizefilename#2\to\readfilename
\checkfilename\readfilename
\ifcase\kindoffile
- \increment\readlevel
- \immediate\openin#1=\readfilename\relax
+ \advance\readlevel\plusone
+ \openinputfile{#1}\readfilename
\ifeof#1% \relax
\ifnum\readlevel>\maxreadlevel % \relax
\else
- \immediate\closein#1% \relax
+ \closeinputfile#1% \relax
\doopenin{#1}{\pathplusfile\f!parentpath{#2}}%
\fi
\fi
\fi}
\def\openjobin#1#2%
- {\newcounter\readlevel
+ {\readlevel\zerocount
\doopenin{#1}{\pathplusfile\f!currentpath{#2}}}
\def\opensysin % #1#2%
- {\let\readlevel\maxreadlevel
+ {\readlevel\maxreadlevel
\doopenin} % {#1}{#2}}
\def\openlocin#1#2%
- {\let\readlevel\maxreadlevel
+ {\readlevel\maxreadlevel
\doopenin{#1}{\pathplusfile\f!currentpath{#2}}}
\def\openfixin#1#2#3%
- {\let\readlevel\maxreadlevel
+ {\readlevel\maxreadlevel
\doopenin{#1}{\pathplusfile{#2}{#3}}}
%D \macros
@@ -532,7 +544,8 @@
{\gobbleoneargument}}
\def\doinputonce#1%
- {\doonlyonce{#1}{\doiffileelse{#1}{\normalinput#1\relax}\donothing}}
+% {\doonlyonce{#1}{\doiffileelse{#1}{\normalinput#1\relax}\donothing}}
+ {\doonlyonce{#1}{\doiffileelse{#1}{\inputgivenfile{#1}}\donothing}}
\def\doendinputonce#1%
{\doifdefined{@@@#1@@@}\endinput}
@@ -565,7 +578,7 @@
\def\normalequal {=} % geen \let !
\def\normaldblquote{"} % geen \let !
-\newcounter\readingfilelevel
+\newcount\readingfilelevel
\def\popfilecharacter#1#2%
{\ifnum\catcode`#1=\@@other \ifnum#2=\@@other \else
@@ -585,43 +598,8 @@
\newtoks \everystartreadingfile
\newtoks \everystopreadingfile
-% \def\startreadingfile% beter een every en \setnormalcatcodes
-% {\doglobal\increment\readingfilelevel
-% \the\everystartreadingfile
-% \setxvalue{\string\readingfilelevel::\readingfilelevel}%
-% {\catcode`/ =\the\catcode`/%
-% %\catcode`_ =\the\catcode`_% math ! ! !
-% \catcode`" =\the\catcode`"%
-% \catcode`: =\the\catcode`:%
-% \catcode`; =\the\catcode`;%
-% \catcode`< =\the\catcode`<%
-% \catcode`> =\the\catcode`>%
-% \catcode`\noexpand\\=\the\catcode`\\%
-% \catcode`\noexpand\{=\the\catcode`\{%
-% \catcode`\noexpand\}=\the\catcode`\}%
-% \catcode`\noexpand\%=\the\catcode`\%}%
-% \catcode`/ =\@@other
-% %\catcode`_ =\@@other
-% \catcode`" =\@@other
-% \catcode`: =\@@other
-% \catcode`; =\@@other
-% \catcode`< =\@@other
-% \catcode`> =\@@other
-% \catcode`\\=\@@escape
-% \catcode`\{=\@@begingroup
-% \catcode`\}=\@@endgroup
-% \catcode`\%=\@@comment
-% \pushendofline
-% \restoreendofline}
-
-% \def\stopreadingfile
-% {\popendofline
-% \getvalue{\string\readingfilelevel::\readingfilelevel}%
-% \the\everystopreadingfile
-% \doglobal\decrement\readingfilelevel}
-
\def\startreadingfile% beter een every en \setnormalcatcodes
- {\doglobal\increment\readingfilelevel
+ {\global\advance\readingfilelevel\plusone
\the\everystartreadingfile
\beginrestorecatcodes
\setcatcodetable\prtcatcodes}
@@ -629,7 +607,7 @@
\def\stopreadingfile
{\endrestorecatcodes
\the\everystopreadingfile
- \doglobal\decrement\readingfilelevel}
+ \global\advance\readingfilelevel\minusone}
\let\normalstartreadingfile\startreadingfile
\let\normalstopreadingfile \stopreadingfile
@@ -671,57 +649,6 @@
\let\splitfilename\gobbleoneargument % defined in mk
\let\splitfiletype\gobbleoneargument % defined in mk
-
-%% % gebruikt voor normale (!) files, will change to proper
-%% % installer maybe combined with verb module push/popper
-%%
-%% \def\startreadingfile% beter een every
-%% {\doglobal\increment\readingfilelevel
-%% \setxvalue{popfilecharacters::\readingfilelevel}%
-%% {%\expnormalcatcodes
-%% \expspecialcatcodes}%
-%% %\setnormalcatcodes
-%% \setspecialcatcodes}
-%%
-%% \def\stopreadingfile%
-%% {\getvalue{popfilecharacters::\readingfilelevel}%
-%% \doglobal\decrement\readingfilelevel}
-%%
-%% \ifx\\\undefined \let\\\relax \fi
-%% \ifx\!\undefined \let\!\relax \fi
-%% \ifx\?\undefined \let\?\relax \fi
-%%
-%% \def\expnormalcatcodes%
-%% {\catcode`\noexpand\!=\the\catcode`\! \catcode`\noexpand\?=\the\catcode`\?%
-%% \catcode`\noexpand\&=\the\catcode`\&
-%% \catcode`\noexpand\#=\the\catcode`\# \catcode`\noexpand\$=\the\catcode`\$%
-%% \catcode`\noexpand\%=\the\catcode`\% \catcode`\noexpand\\=\the\catcode`\\%
-%% \catcode`\noexpand\^=\the\catcode`\^ \catcode`\noexpand\_=\the\catcode`\_%
-%% \catcode`\noexpand\{=\the\catcode`\{ \catcode`\noexpand\}=\the\catcode`\}}
-%%
-%% \def\setnormalcatcodes%
-%% {%\ifcase\protectionlevel
-%% \catcode`\!=\@@other \catcode`\?=\@@other
-%% %\else
-%% % \catcode`\!=\@@letter \catcode`\?=\@@letter
-%% %\fi
-%% \catcode`\&=\@@alignment
-%% \catcode`\#=\@@parameter \catcode`\$=\@@mathshift
-%% \catcode`\%=\@@comment \catcode`\\=\@@escape
-%% \catcode`\^=\@@superscript \catcode`\_=\@@subscript
-%% \catcode`\{=\@@begingroup \catcode`\}=\@@endgroup}
-%%
-%% \def\expspecialcatcodes%
-%% {\catcode`\noexpand/=\the\catcode`/%
-%% \catcode`\noexpand"=\the\catcode`"%
-%% \catcode`\noexpand<=\the\catcode`<%
-%% \catcode`\noexpand>=\the\catcode`>}
-%%
-%% \def\setspecialcatcodes%
-%% {\catcode`/=\@@other
-%% \catcode`"=\@@other
-%% \catcode`<=\@@other
-%% \catcode`>=\@@other}
\loadmarkfile{supp-fil}