summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/oberdiek/catchfile.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/catchfile.dtx')
-rw-r--r--Master/texmf-dist/source/latex/oberdiek/catchfile.dtx188
1 files changed, 177 insertions, 11 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/catchfile.dtx b/Master/texmf-dist/source/latex/oberdiek/catchfile.dtx
index 5067d0ae62f..5e50a738477 100644
--- a/Master/texmf-dist/source/latex/oberdiek/catchfile.dtx
+++ b/Master/texmf-dist/source/latex/oberdiek/catchfile.dtx
@@ -79,7 +79,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: catchfile 2010/04/08 v1.4 Catches the contents of a file (HO)}
+\Msg{* Package: catchfile 2010/04/28 v1.5 Catches the contents of a file (HO)}
\Msg{************************************************************************}
\keepsilent
@@ -158,7 +158,7 @@ and the derived files
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{catchfile.drv}%
- [2010/04/08 v1.4 Catches the contents of a file (HO)]%
+ [2010/04/28 v1.5 Catches the contents of a file (HO)]%
\documentclass{ltxdoc}
\usepackage{holtxdoc}[2008/08/11]
\begin{document}
@@ -167,7 +167,7 @@ and the derived files
%</driver>
% \fi
%
-% \CheckSum{591}
+% \CheckSum{833}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -188,7 +188,7 @@ and the derived files
% \GetFileInfo{catchfile.drv}
%
% \title{The \xpackage{catchfile} package}
-% \date{2010/04/08 v1.4}
+% \date{2010/04/28 v1.5}
% \author{Heiko Oberdiek\\\xemail{heiko.oberdiek at googlemail.com}}
%
% \maketitle
@@ -291,7 +291,7 @@ and the derived files
\fi
\expandafter\x\csname ver@catchfile.sty\endcsname
\ProvidesPackage{catchfile}%
- [2010/04/08 v1.4 Catches the contents of a file (HO)]
+ [2010/04/28 v1.5 Catches the contents of a file (HO)]
% \end{macrocode}
%
% \subsection{Catcodes}
@@ -335,8 +335,10 @@ and the derived files
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname RequirePackage\endcsname\relax
\input infwarerr.sty\relax
+ \input ltxcmds.sty\relax
\else
\RequirePackage{infwarerr}[2007/09/09]%
+ \RequirePackage{ltxcmds}[2010/03/09]%
\fi
% \end{macrocode}
%
@@ -449,7 +451,7 @@ and the derived files
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\CatchFileNotFound}
+% \begin{macro}{\CatchFile@NotFound}
% \begin{macrocode}
\def\CatchFile@NotFound#1#2{%
\def#1{}%
@@ -462,6 +464,14 @@ and the derived files
%
% \subsection{Catch file contents}
%
+% \begin{macrocode}
+\ltx@IfUndefined{RequirePackage}{%
+ \input etexcmds.sty\relax
+}{%
+ \RequirePackage{etexcmds}[2010/01/28]%
+}
+% \end{macrocode}
+%
% \begin{macro}{\CatchFileEdef}
% \begin{macrocode}
\long\def\CatchFileEdef#1#2#3{%
@@ -490,12 +500,30 @@ and the derived files
\begingroup
\everyeof\expandafter{%
\CatchFile@EOF
+ \expandafter\CatchFile@Finish
\noexpand
}%
- \expandafter\long\expandafter\def\expandafter\CatchFile@Do
- \expandafter##\expandafter1\CatchFile@EOF{%
- \endgroup
- \def#1{##1}%
+ \ltx@ifundefined{etex@unexpanded}{%
+ \expandafter\long\expandafter\def\expandafter\CatchFile@Do
+ \expandafter##\expandafter1\CatchFile@EOF{%
+ \toks\ltx@zero{##1}%
+ \xdef\CatchFile@gtemp{\the\toks\ltx@zero}%
+ \def\CatchFile@Finish{%
+ \endgroup
+ \let#1\CatchFile@gtemp
+ \global\let\CatchFile@gtemp\ltx@undefined
+ }%
+ }%
+ }{%
+ \expandafter\long\expandafter\def\expandafter\CatchFile@Do
+ \expandafter##\expandafter1\CatchFile@EOF{%
+ \edef\CatchFile@Finish{%
+ \endgroup
+ \etex@unexpanded{%
+ \edef#1{\etex@unexpanded{##1}}%
+ }%
+ }%
+ }%
}%
#3%
\expandafter\expandafter\expandafter\CatchFile@Do
@@ -623,18 +651,69 @@ and the derived files
\NeedsTeXFormat{LaTeX2e}
\nofiles
\listfiles
+\tracingnesting=2 %
\documentclass{minimal}
-\usepackage{catchfile}[2010/04/08]
+\usepackage{catchfile}[2010/04/28]
\makeatletter
\def\mysetup{%
\let\do\@makeother
\dospecials
}
+\def\CheckContents{%
+ \begingroup
+ \expandafter\ifx\csname contents\endcsname\relax
+ \PackageError{TEST}{\string\contents\space is not defined}\@ehc
+ \fi
+ \endgroup
+}
+\def\StartDisableUnexpanded{%
+ \begingroup
+ \let\etex@unexpanded\@undefined
+}
+\def\StopDisableUnexpanded{%
+ \endgroup
+}
+\def\CheckCleanup{%
+ \begingroup
+ \edef\x{\the\toks0}%
+ \def\y{ABC}%
+ \ifx\x\y
+ \else
+ \PackageError{TEST}{\string\toks0 has changed}\@ehc
+ \fi
+ \ifx\CatchFile@gtemp\@undefined
+ \else
+ \PackageError{TEST}{Left over \string\CatchFile@gtemp}\@ehc
+ \fi
+ \endgroup
+}
+\def\Check{%
+ \CheckContents
+ \CheckCleanup
+}
\makeatother
\begin{document}
+\toks0{ABC}
\CatchFileDef\contents{catchfile.sty}\mysetup
\typeout{\meaning\contents}
+\Check
+\typeout{***********************************************************}%
+\CatchFileDef\contents{catchfile.sty}{}
+\typeout{\meaning\contents}
+\Check
+\typeout{***********************************************************}%
+
+\StartDisableUnexpanded
+\CatchFileDef\contents{catchfile.sty}\mysetup
+\typeout{\meaning\contents}
+\Check
+\typeout{***********************************************************}%
+\CatchFileDef\contents{catchfile.sty}{}
+\typeout{\meaning\contents}
+\Check
+\typeout{***********************************************************}%
+\StopDisableUnexpanded
\CatchFileEdef\contents{catchfile.sty}{%
\mysetup
@@ -642,6 +721,17 @@ and the derived files
\obeylines
}
\typeout{\contents}
+\Check
+\typeout{***********************************************************}%
+\CatchFileEdef\contents{catchfile.sty}{%
+ \catcode`\\=12 %
+ \catcode`\#=12 %
+ \def\par{^^J}%
+ \obeylines
+}
+\typeout{\contents}
+\Check
+\typeout{***********************************************************}%
\end{document}
%</test2>
% \end{macrocode}
@@ -652,6 +742,7 @@ and the derived files
%<*test3>
\def\msg#{\immediate\write16}
\newlinechar=10 %
+\tracingnesting=2 %
\input catchfile.sty\relax
\def\mysetup{%
@@ -660,9 +751,63 @@ and the derived files
}%
\dospecials
}
+\def\CheckContents{%
+ \begingroup
+ \expandafter\ifx\csname contents\endcsname\relax
+ \def\space{ }%
+ \errmessage{\string\contents\space is not defined.}%
+ \fi
+ \endgroup
+}
+\catcode`\@=11 %
+\def\CheckCleanup{%
+ \begingroup
+ \edef\x{\the\toks0}%
+ \def\y{ABC}%
+ \ifx\x\y
+ \else
+ \errmessage{\string\toks0 has changed}%
+ \fi
+ \ifx\CatchFile@gtemp\@undefined
+ \else
+ \errmessage{Left over \string\CatchFile@gtemp}%
+ \fi
+ \endgroup
+}
+\def\Check{%
+ \CheckContents
+ \CheckCleanup
+}
+\def\StartDisableUnexpanded{%
+ \begingroup
+ \let\etex@unexpanded\@undefined
+}
+\def\StopDisableUnexpanded{%
+ \endgroup
+}
+\catcode`\@=12 %
+
+\toks0{ABC}
\CatchFileDef\contents{catchfile.sty}\mysetup
\msg{\meaning\contents}
+\Check
+\msg{***********************************************************}%
+\CatchFileDef\contents{catchfile.sty}{}
+\msg{\meaning\contents}
+\Check
+\msg{***********************************************************}%
+
+\StartDisableUnexpanded
+\CatchFileDef\contents{catchfile.sty}\mysetup
+\msg{\meaning\contents}
+\Check
+\msg{***********************************************************}%
+\CatchFileDef\contents{catchfile.sty}{}
+\msg{\meaning\contents}
+\Check
+\msg{***********************************************************}%
+\StopDisableUnexpanded
\CatchFileEdef\contents{catchfile.sty}{%
\mysetup
@@ -670,6 +815,17 @@ and the derived files
\obeylines
}
\msg{\contents}
+\Check
+\msg{***********************************************************}%
+\CatchFileEdef\contents{catchfile.sty}{%
+ \catcode`\\=12 %
+ \catcode`\#=12 %
+ \def\par{^^J}%
+ \obeylines
+}
+\msg{\contents}
+\Check
+\msg{***********************************************************}%
\csname @@end\endcsname
\end
@@ -881,6 +1037,16 @@ and the derived files
% \item
% \cs{closein} also added if \cs{ifeof} is true.
% \end{Version}
+% \begin{Version}{2010/04/28 v1.5}
+% \item
+% \cs{CatchFileDef}: Getting rid of warning `end of semi simple group
+% entered at line \dots\ of
+% a different file (Florent Chervet).
+% \item
+% \cs{CatchFileDef}: Fix for error `Illegal parameter number in
+% definition of \dots' (HO) including improvement that uses
+% \cs{unexpanded} if available (Florent Chervet).
+% \end{Version}
% \end{History}
%
% \PrintIndex