[latex3-commits] [git/LaTeX3-latex3-latex2e] lthooks: removed use of l3docstrip (7de13ceb)
Frank Mittelbach
frank.mittelbach at latex-project.org
Thu Jul 16 16:09:40 CEST 2020
Repository : https://github.com/latex3/latex2e
On branch : lthooks
Link : https://github.com/latex3/latex2e/commit/7de13ceb4168b8ceb18d82913a82c90fe7a0c473
>---------------------------------------------------------------
commit 7de13ceb4168b8ceb18d82913a82c90fe7a0c473
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date: Thu Jul 16 16:09:40 2020 +0200
removed use of l3docstrip
>---------------------------------------------------------------
7de13ceb4168b8ceb18d82913a82c90fe7a0c473
base/build.lua | 1 -
base/lthooks.ins | 2 +-
base/unpack.ins | 2 +-
support/l3docstrip.tex | 1187 ------------------------------------------------
4 files changed, 2 insertions(+), 1190 deletions(-)
diff --git a/base/build.lua b/base/build.lua
index 69ba64f1..018de78d 100644
--- a/base/build.lua
+++ b/base/build.lua
@@ -131,7 +131,6 @@ unpacksuppfiles =
"t1lmtt.fd",
"ts1lmr.fd",
"pdflatex.ini",
- "l3docstrip.tex",
"pdftexconfig.tex"
}
diff --git a/base/lthooks.ins b/base/lthooks.ins
index 75cd512a..4218fb8b 100644
--- a/base/lthooks.ins
+++ b/base/lthooks.ins
@@ -25,7 +25,7 @@
%%
%% --------------- start of docstrip commands ------------------
%%
-\input l3docstrip
+\input docstrip
\keepsilent
diff --git a/base/unpack.ins b/base/unpack.ins
index f73603b4..ed8cb572 100644
--- a/base/unpack.ins
+++ b/base/unpack.ins
@@ -40,7 +40,7 @@
%% LaTeX 2e installation script (concurrent version)
\let\documentclass\undefined
\input ltdirchk.dtx
-\input ../local/l3docstrip.tex
+\input docstrip.dtx
{
\def\ProvidesFile#1\end#2{}
diff --git a/support/l3docstrip.tex b/support/l3docstrip.tex
deleted file mode 100644
index 08dd7ad6..00000000
--- a/support/l3docstrip.tex
+++ /dev/null
@@ -1,1187 +0,0 @@
-%%
-%% This is file `l3docstrip.tex',
-%% generated with the docstrip utility.
-%%
-%% The original source files were:
-%%
-%% l3docstrip.dtx (with options: `program')
-%%
-%% Copyright (C) 1990-2020 The LaTeX3 Project
-%%
-%% It may be distributed and/or modified under the conditions of
-%% the LaTeX Project Public License (LPPL), either version 1.3c of
-%% this license or (at your option) any later version. The latest
-%% version of this license is in the file:
-%%
-%% https://www.latex-project.org/lppl.txt
-%%
-%% This file is part of the "l3kernel bundle" (The Work in LPPL)
-%% and all files in that bundle must be distributed together.
-%%
-%% File l3dosctrip.dtx
-%%
-%% This is file `docstrip.tex',
-%% generated with the docstrip utility.
-%%
-%% The original source files were:
-%%
-%% docstrip.dtx (with options: `initex,program,stats')
-%%
-%% This is a generated file.
-%%
-%% The source is maintained by the LaTeX Project team and bug
-%% reports for it can be opened at https://latex-project.org/bugs.html
-%% (but please observe conditions on bug reports sent to that address!)
-%%
-%%
-%% Copyright (C) 1993-2020
-%% The LaTeX3 Project and any individual authors listed elsewhere
-%% in this file.
-%%
-%% This file was generated from file(s) of the LaTeX base system.
-%% --------------------------------------------------------------
-%%
-%% It may be distributed and/or modified under the
-%% conditions of the LaTeX Project Public License, either version 1.3c
-%% of this license or (at your option) any later version.
-%% The latest version of this license is in
-%% https://www.latex-project.org/lppl.txt
-%% and version 1.3c or later is part of all distributions of LaTeX
-%% version 2008 or later.
-%%
-%% This file has the LPPL maintenance status "maintained".
-%%
-%% This file may only be distributed together with a copy of the LaTeX
-%% base system. You may however distribute the LaTeX base system without
-%% such generated files.
-%%
-%% The list of all files belonging to the LaTeX base distribution is
-%% given in the file `manifest.txt'. See also `legal.txt' for additional
-%% information.
-%%
-%% The list of derived (unpacked) files belonging to the distribution
-%% and covered by LPPL is defined by the unpacking scripts (with
-%% extension .ins) which are part of the distribution.
-\catcode`\{=1
-\catcode`\}=2
-\def\filename{docstrip.dtx}
-\def\fileversion{2.5g}
-\def\filedate{2018/05/03}
-\def\docdate {2018/05/03}
-%%
-%% The docstrip program for use with TeX.
-%% Copyright (C) 1989-1991 Frank Mittelbach
-%% Copyright (C) 1992-1995 Johannes Braams, Denys Duchier,
-%% Frank Mittelbach
-%% Copyright (C) 1995 Marcin Woli\'nski
-%% Copyright (C) 1996-1997 Mark Wooding, Marcin Woli\'nski
-%% Copyright (C) 1998-2003 LaTeX3 project and the above authors
-%% All rights are reserved.
-%%
-\catcode`\Z=\catcode`\%
-\ifnum13=\catcode`\~{\egroup\else
- \catcode`\Z=9
-Z
-Z \catcode`\{=1 \catcode`\}=2
-Z \catcode`\#=6 \catcode`\^=7
-Z \catcode`\@=11 \catcode`\^^L=13
-Z \let\bgroup={ \let\egroup=}
-Z
-Z \dimendef\z@=10 \z@=0pt \chardef\@ne=1 \countdef\m at ne=22 \m at ne=-1
-Z \countdef\count@=255
-Z
-Z \def\wlog{\immediate\write\m at ne} \def\space{ }
-Z
-Z \count10=22 % allocates \count registers 23, 24, ...
-Z \count15=9 % allocates \toks registers 10, 11, ...
-Z \count16=-1 % allocates input streams 0, 1, ...
-Z \count17=-1 % allocates output streams 0, 1, ...
-Z
-Z \def\alloc@#1#2#3{\advance\count1#1\@ne#2#3\count1#1\relax}
-Z
-Z \def\newcount{\alloc at 0\countdef} \def\newtoks{\alloc at 5\toksdef}
-Z \def\newread{\alloc at 6\chardef} \def\newwrite{\alloc at 7\chardef}
-Z
-Z \def\newif#1{%
-Z \count@\escapechar \escapechar\m at ne
-Z \let#1\iffalse
-Z \@if#1\iftrue
-Z \@if#1\iffalse
-Z \escapechar\count@}
-Z \def\@if#1#2{%
-Z \expandafter\def\csname\expandafter\@gobbletwo\string#1%
-Z \expandafter\@gobbletwo\string#2\endcsname
-Z {\let#1#2}}
-Z
-Z \def\@gobbletwo#1#2{}
-Z \def\@gobblethree#1#2#3{}
-Z
-Z \def\loop#1\repeat{\def\body{#1}\iterate}
-Z \def\iterate{\body \let\next\iterate \else\let\next\relax\fi \next}
-Z \let\repeat\fi
-Z
-Z \def\empty{}
-Z
-Z \def\tracingall{\tracingcommands2 \tracingstats2
-Z \tracingpages1 \tracingoutput1 \tracinglostchars1
-Z \tracingmacros2 \tracingparagraphs1 \tracingrestores1
-Z \showboxbreadth 10000 \showboxdepth 10000 \errorstopmode
-Z \errorcontextlines 10000 \tracingonline1 }
-Z
-\bgroup}\fi\catcode`\Z=11
-\let\bgroup={ \let\egroup=}
-\catcode`\@=11
-\newlinechar=`\^^J
-\count@=128\relax
-\loop
- \catcode\count@ 12\relax
-\ifnum\count@ <255\relax
- \advance\count@\@ne
-\repeat
-\newif\ifGenerate
-\newif\ifContinue
-\newif\ifForlist
-\newif\ifDefault
-\newif\ifMoreFiles \MoreFilestrue
-\newif\ifaskforoverwrite \askforoverwritetrue
-\newcount\blockLevel \blockLevel\z@
-\newcount\emptyLines \emptyLines \z@
-\newcount\processedLines \processedLines \z@
-\newcount\commentsRemoved \commentsRemoved \z@
-\newcount\commentsPassed \commentsPassed \z@
-\newcount\codeLinesPassed \codeLinesPassed \z@
-\newcount\TotalprocessedLines \TotalprocessedLines \z@
-\newcount\TotalcommentsRemoved \TotalcommentsRemoved \z@
-\newcount\TotalcommentsPassed \TotalcommentsPassed \z@
-\newcount\TotalcodeLinesPassed \TotalcodeLinesPassed \z@
-\newcount\NumberOfFiles \NumberOfFiles\z@
-\newread\inFile
-\chardef\ttyin16
-\chardef\ttyout16
-\newread\inputcheck
-\newif\iftopbatchfile \topbatchfiletrue
-\def\ifToplevel{\relax\iftopbatchfile
- \expandafter\iden \else \expandafter\@gobble\fi}
-\ifx\undefined\@@input \let\@@input\input\fi
-\def\batchinput#1{%
- \begingroup
- \def\batchfile{#1}%
- \topbatchfilefalse
- \Defaultfalse
- \usepreamble\org at preamble
- \usepostamble\org at postamble
- \let\destdir\WriteToDir
- \processbatchFile
- \endgroup
-}
-\def\skip at input#1 {}
-\let\input\skip at input
-\def\guardStack{}
-\def\blockHead{}
-\def\yes{yes}
-\def\y{y}
-\def\n{n}
-\def\DefaultbatchFile{docstrip.cmd}
-{\catcode`\%=12
- \gdef\perCent{%}
- \gdef\DoubleperCent{%%}
-}
-\let\MetaPrefix\DoubleperCent
-\def^^L{ }
-\def\Name#1#2{\expandafter#1\csname#2\endcsname}
-\def\@stripstring{\expandafter\@gobble\string}
-\def\eltStart{}
-\def\eltEnd{}
-\def\qStop{\qStop}
-\def\pop#1#2{%
- \ifx#1\empty
- \Msg{Warning: Found end guard without matching begin}%
- \let#2\empty
- \else
- \def\tmp{\expandafter\popX #1\qStop #1#2}%
- \expandafter\tmp\fi}
-\def\popX\eltStart #1\eltEnd #2\qStop #3#4{\def#3{#2}\def#4{#1}}
-\def\push#1#2{\expandafter\pushX #1\qStop #1{\eltStart #2\eltEnd}}
-\def\pushX #1\qStop #2#3{\def #2{#3#1}}
-\def\forlist#1:=#2\do#3\od{%
- \edef\ListCondition{#2}%
- \Forlisttrue
- \loop
- \edef#1{\expandafter\FirstElt\ListCondition,\empty.}%
- \edef\ListCondition{\expandafter\OtherElts\ListCondition,\empty.}%
- \ifx#1\empty \Forlistfalse \else#3\fi
- \ifForlist
- \repeat}
-\def\FirstElt#1,#2.{#1}
-\def\OtherElts#1,#2.{#2}
-\def\whileswitch#1\fi#2{#1\loop#2#1\repeat\fi}
-\ifx\@tempcnta\undefined \newcount\@tempcnta \fi
-\@tempcnta=0
-\loop
-\Name\chardef{s@\number\@tempcnta}=0
-\csname newcount\expandafter\endcsname%
- \csname off@\number\@tempcnta\endcsname
-\advance\@tempcnta1
-\ifnum\@tempcnta<16\repeat
-\let\s at do\relax
-\edef\@outputstreams{%
- \s at do\Name\noexpand{s at 0}\s at do\Name\noexpand{s at 1}%
- \s at do\Name\noexpand{s at 2}\s at do\Name\noexpand{s at 3}%
- \s at do\Name\noexpand{s at 4}\s at do\Name\noexpand{s at 5}%
- \s at do\Name\noexpand{s at 6}\s at do\Name\noexpand{s at 7}%
- \s at do\Name\noexpand{s at 8}\s at do\Name\noexpand{s at 9}%
- \s at do\Name\noexpand{s at 10}\s at do\Name\noexpand{s at 11}%
- \s at do\Name\noexpand{s at 12}\s at do\Name\noexpand{s at 13}%
- \s at do\Name\noexpand{s at 14}\s at do\Name\noexpand{s at 15}%
- \noexpand\@nostreamerror
- }
-\def\@nostreamerror{\errmessage{No more output streams!}}
-\def\@streamfound#1\@nostreamerror{\fi}
-\bgroup\edef\x{\egroup
- \def\noexpand\@stripstr\string\s@{}}
-\x
-\chardef\stream at closed=16
-\def\StreamOpen#1{%
- \chardef#1=\stream at closed
- \def\s at do##1{\ifnum##1=0
- \chardef#1=\expandafter\@stripstr\string##1 %
- \global\chardef##1=1 %
- \immediate\openout#1=\csname pth@\@stripstring#1\endcsname %
- \@streamfound
- \fi}
- \@outputstreams
- }
-\def\StreamClose#1{%
- \immediate\closeout#1%
- \def\s at do##1{\ifnum#1=\expandafter\@stripstr\string##1 %
- \global\chardef##1=0 %
- \@streamfound
- \fi}
- \@outputstreams
- \chardef#1=\stream at closed
- }
-\def\StreamPut{\immediate\write}
-\def\showprogress{\let\maybeMsg\message}
-\def\keepsilent{\let\maybeMsg\@gobble}
-\showprogress
-\def\Msg{\immediate\write\ttyout}
-\def\iden#1{#1}
-\def\strip#1#2 \@gobble{\def #1{#2}}
-\def\@defpar{\par}
-\def\Ask#1#2{%
- \message{#2}\read\ttyin to #1\ifx#1\@defpar\def#1{}\else
- \iden{\expandafter\strip
- \expandafter#1#1\@gobble\@gobble} \@gobble\fi}
-\let\OriginalAsk=\Ask
-\def\askonceonly{%
- \def\Ask##1##2{%
- \OriginalAsk{##1}{##2}%
- \global\let\Ask\OriginalAsk
- \Ask\noprompt{%
- By default you will be asked this question for every file.^^J%
- If you enter `y' now,^^J%
- I will assume `y' for all future questions^^J%
- without prompting.}%
- \ifx\y\noprompt\let\noprompt\yes\fi
- \ifx\yes\noprompt\gdef\Ask####1####2{\def####1{y}}\fi}}
-\def\@gobble#1{}
-\edef\Endinput{\expandafter\@gobble\string\\endinput}
-\def\makeOther#1{\catcode`#1=12\relax}
-\ifx\undefined\@@end\else\let\end\@@end\fi
-\ifx\@temptokena\undefined \csname newtoks\endcsname\@temptokena\fi
-\def\@addto#1#2{%
- \@temptokena\expandafter{#1}%
- \edef#1{\the\@temptokena#2}}
-\def\@ifpresent#1#2#3#4{%
- \def\tmp##1#1##2\qStop{\ifx!##2!}%
- \expandafter\tmp#2#1\qStop #4\else #3\fi
- }
-\def\tospaces#1{%
- \ifx#1\secapsot\secapsot\fi\space\tospaces}
-\def\secapsot\fi\space\tospaces{\fi}
-\def\@spaces{\space\space\space\space\space}
-\def\uptospace#1 #2\qStop{#1}
-\def\afterfi#1#2\fi{\fi#1}
-\def\@ifnextchar#1#2#3{\bgroup
- \def\reserved at a{\ifx\reserved at c #1 \aftergroup\@firstoftwo
- \else \aftergroup\@secondoftwo\fi\egroup
- {#2}{#3}}%
- \futurelet\reserved at c\@ifnch
- }
-\def\@ifnch{\ifx \reserved at c \@sptoken \expandafter\@xifnch
- \else \expandafter\reserved at a
- \fi}
-\def\@firstoftwo#1#2{#1}
-\def\@secondoftwo#1#2{#2}
-\iden{\let\@sptoken= } %
-\iden{\def\@xifnch} {\futurelet\reserved at c\@ifnch}
-\let\kernel at ifnextchar\@ifnextchar
-\def\Terminal#1#2#3{%
- \expandafter\ifx\csname eT@#3\endcsname\relax
- \afterfi{\Terminal{#1}{#2#3}}\else
- \afterfi{\TerminalX{#1}{#2}#3}\fi
- }
-\Name\let{eT@>}=1
-\Name\let{eT@&}=1 \Name\let{eT@!}=1
-\Name\let{eT@|}=1 \Name\let{eT@,}=1
-\Name\let{eT@(}=1 \Name\let{eT@)}=1
-\def\TerminalX#1#2{%
- \ifx>#2> \errmessage{Error in expression: empty terminal}\fi
- \Name\def{t@#2}##1,#2,##2\qStop{\ifx>##2>0\else1\fi}%
- #1{\Name\noexpand{t@#2},##1,#2,\noexpand\qStop}%
- }
-\def\Primary#1#2{%
- \ifcase \ifx!#20\else\ifx(#21\else2\fi\fi\space
- \afterfi{\Primary{\NPrimary{#1}}}\or
- \afterfi{\Expression{\PExpression{#1}}}\or
- \afterfi{\Terminal{#1}{}#2}\fi
- }
-\def\NPrimary#1#2{%
- #1{\noexpand\if1#20\noexpand\else1\noexpand\fi}%
- }
-\def\PExpression#1#2#3{%
- \ifx)#3\else
- \errmessage{Error in expression: expected right parenthesis}\fi
- #1{#2}}
-\def\Secondary#1{%
- \Primary{\SecondaryX{#1}}}
-\bgroup\catcode`\&=12
-\gdef\SecondaryX#1#2#3{%
- \ifx%
- \afterfi{\Secondary{\SecondaryXX{#1}{#2}}}\else
- \afterfi{#1{#2}#3}\fi
- }
-\egroup
-\def\SecondaryXX#1#2#3{%
- #1{\noexpand\if0#20\noexpand\else#3\noexpand\fi}}
-\def\Expression#1{%
- \Secondary{\ExpressionX{#1}}}
-\def\ExpressionX#1#2#3{%
- \if0\ifx|#31\else\ifx,#31\fi\fi0
- \afterfi{#1{#2}#3}\else
- \afterfi{\Expression{\ExpressionXX{#1}{#2}}}\fi
- }
-\def\ExpressionXX#1#2#3{%
- #1{\noexpand\if1#21\noexpand\else#3\noexpand\fi}}
-\def\StopParse#1#2{%
- \ifx>#2 \else\errmessage{Error in expression: spurious #2}\fi
- \edef\Expr##1{#1}}
-\def\Evaluate#1{%
- \Expression\StopParse#1>}
-\def\normalLine#1\endLine{%
- \advance\codeLinesPassed\@ne
- \maybeMsg{.}%
- \def\inLine{#1}%
- \let\do\putline at do
- \activefiles
- }
-\def\putline at do#1#2#3{%
- \StreamPut#1{\inLine}}
-\def\removeComment#1\endLine{%
- \advance\commentsRemoved\@ne
- \maybeMsg{\perCent}}
-\bgroup\catcode`\%=12
-\iden{\egroup
-\def\putMetaComment%}#1\endLine{%
- \advance\commentsPassed\@ne
- \edef\inLine{\MetaPrefix#1}%
- \let\do\putline at do
- \activefiles
- }
-\begingroup
-\catcode`\%=12 \catcode`\*=14
-\gdef\processLine#1{*
- \advance\processedLines\@ne
- \ifx%#1
- \expandafter\processLineX
- \else
- \expandafter\normalLine
- \fi
- #1}
-\endgroup
-\begingroup
-\catcode`\%=12 \catcode`\*=14
-\gdef\processLineX%#1{*
- \ifcase\ifx%#10\else
- \ifx<#11\else 2\fi\fi\relax
- \expandafter\putMetaComment\or
- \expandafter\checkOption\or
- \expandafter\removeComment\fi
- #1}
-\endgroup
-\def\checkOption<#1{%
- \ifcase
- \ifx*#10\else \ifx/#11\else
- \ifx+#12\else \ifx-#13\else
- \ifx<#14\else 5\fi\fi\fi\fi\fi\relax
- \expandafter\starOption\or
- \expandafter\slashOption\or
- \expandafter\plusOption\or
- \expandafter\minusOption\or
- \expandafter\verbOption\or
- \expandafter\doOption\fi
- #1}
-\def\doOption#1>#2\endLine{%
- \maybeMsg{<#1 . >}%
- \Evaluate{#1}%
- \def\do##1##2##3{%
- \if1\Expr{##2}\StreamPut##1{#2}\fi
- }%
- \activefiles
- }
-\def\plusOption+#1>#2\endLine{%
- \maybeMsg{<+#1 . >}%
- \Evaluate{#1}%
- \def\do##1##2##3{%
- \if1\Expr{##2}\StreamPut##1{#2}\fi
- }%
- \activefiles
- }
-\def\minusOption-#1>#2\endLine{%
- \maybeMsg{<-#1 . >}%
- \Evaluate{#1}%
- \def\do##1##2##3{%
- \if1\Expr{##2}\else \StreamPut##1{#2}\fi
- }%
- \activefiles
- }
-\def\starOption*#1>#2\endLine{%
- \maybeMsg{<*#1}%
- \expandafter\push\expandafter\guardStack\expandafter{\blockHead}%
- \advance\blockLevel\@ne
- \def\blockHead{#1}%
- \Evaluate{#1}%
- \let\do\checkguard at do
- \outputfiles
- \let\do\findactive at do
- \edef\activefiles{\activefiles}
- }
-\def\checkguard at do#1#2#3{%
- \ifnum#3>0
- \advance#3\@ne
- \else
- \if1\Expr{#2}\else
- \advance#3\@ne\fi
- \fi}
-\def\findactive at do#1#2#3{%
- \ifnum#3=0
- \noexpand\do#1{#2}#3\fi}
-\def\slashOption/#1>#2\endLine{%
- \def\tmp{#1}%
- \ifnum\blockLevel<\@ne
- \errmessage{Spurious end block </\tmp> ignored}%
- \else
- \ifx\tmp\blockHead
- \pop\guardStack\blockHead
- \else
- \errmessage{Found </\tmp> instead of </\blockHead>}%
- \fi
- \maybeMsg{>}%
- \advance\blockLevel\m at ne
- \let\do\closeguard at do
- \outputfiles
- \let\do\findactive at do
- \edef\activefiles{\outputfiles}
- \fi
- }
-\def\closeguard at do#1#2#3{%
- \ifnum#3>0
- \advance#3\m at ne
- \fi}
-\def\verbOption<#1\endLine{{%
- \edef\verbStop{\perCent#1}\maybeMsg{<<<}%
- \let\do\putline at do
- \loop
- \ifeof\inFile\errmessage{Source file ended while in verbatim
- mode!}\fi
- \read\inFile to \inLine
- \if 1\ifx\inLine\verbStop 0\fi 1% if not inLine==verbStop
- \activefiles
- \maybeMsg{.}%
- \repeat
- \maybeMsg{>}%
- }}
-\def\generate#1{\begingroup
- \let\inputfiles\empty \let\filestogenerate\empty
- \let\file\@file
- #1
- \ifx\filestogenerate\empty\else
- \Msg{^^JGenerating file(s) \filestogenerate}\fi
- \def\inFileName{\csname in@\outFileName\endcsname}%
- \def\ReferenceLines{\csname ref@\outFileName\endcsname}%
- \processinputfiles
- \endgroup}
-\def\processinputfiles{%
- \let\newinputfiles\empty
- \inputfiles
- \let\inputfiles\newinputfiles
- \ifx\inputfiles\empty\else
- \expandafter\processinputfiles
- \fi
- }
-\def\file#1#2{\errmessage{Command `\string\file' only allowed in
- argument to `\string\generate'}}
-\def\@file#1{%
- \Generatetrue
- \makepathname{#1}%
- \ifaskforoverwrite
- \immediate\openin\inFile\@pathname\relax
- \ifeof\inFile\else
- \Ask\answer{File \@pathname\space already exists
- \ifx\empty\destdir somewhere \fi
- on the system.^^J%
- Overwrite it%
- \ifx\empty\destdir\space if necessary\fi
- ? [y/n]}%
- \ifx\y \answer \else
- \ifx\yes\answer \else
- \Generatefalse\fi\fi\fi
- \closein\inFile
- \fi
- \ifGenerate
- \Name\let{pth@#1}\@pathname
- \@addto\filestogenerate{\@pathname\space}%
- \Name\@fileX{#1\expandafter}%
- \else
- \Msg{Not generating file \@pathname^^J}%
- \expandafter\@gobble
- \fi
- }
-\def\@fileX#1#2{%
- \chardef#1=\stream at closed
- \def\curout{#1}%
- \let\curinfiles\empty
- \let\curinnames\empty
- \def\curref{\MetaPrefix ^^J%
- \MetaPrefix\space The original source files were:^^J%
- \MetaPrefix ^^J}%
- \let\from\@from \let\needed\@needed
- #2%
- \let\from\err at from \let\needed\err at needed
- \checkorder
- \Name\@addto{e@\curin}{\noexpand\closeoutput{#1}}%
- \Name\let{pre@\@stripstring#1\expandafter}\currentpreamble
- \Name\let{post@\@stripstring#1\expandafter}\currentpostamble
- \Name\edef{in@\@stripstring#1}{\expandafter\iden\curinnames}
- \Name\edef{ref@\@stripstring#1}{\curref}
- }
-\def\checkorder{%
- \expandafter\expandafter\expandafter
- \checkorderX\expandafter\curinfiles
- \expandafter\qStop\inputfiles\qStop
- }
-\def\checkorderX(#1)#2\qStop#3\qStop{%
- \def\tmp##1\readsource(#1)##2\qStop{%
- \ifx!##2! \order at error
- \else\ifx!#2!\else
- \checkorderXX##2%
- \fi\fi}%
- \def\checkorderXX##1\readsource(#1)\fi\fi{\fi\fi
- \checkorderX#2\qStop##1\qStop}%
- \tmp#3\readsource(#1)\qStop
- }
-\def\order at error#1\fi\fi{\fi
- \errmessage{DOCSTRIP error: Incompatible order of input
- files specified for file
- `\iden{\expandafter\uptospace\curin} \qStop'.^^J
- Read DOCSTRIP documentation for explanation.^^J
- This is a serious problem, I'm exiting}\end
- }
-\def\needed#1{\errmessage{\string\needed\space can only be used in
- argument to \string\file}}
-\let\err at needed\needed
-\def\@needed#1{%
- \edef\reserved at a{#1}%
- \expandafter\@need at d\expandafter{\reserved at a}}
-\def\@need at d#1{%
- \@ifpresent{(#1)}\curinfiles
- {\@need at d{#1 }}%
- {\@ifpresent{\readsource(#1)}\inputfiles
- {}{\@addto\inputfiles{\noexpand\readsource(#1)}%
- \Name\let{b@#1}\empty
- \Name\let{o@#1}\empty
- \Name\let{e@#1}\empty}%
- \@addto\curinfiles{(#1)}%
- \def\curin{#1}}%
- }
-\def\from#1#2{\errmessage{Command `\string\from' only allowed in
- argument to `\string\file'}}
-\let\err at from\from
-\def\@from#1#2{%
- \@addto\curref{\MetaPrefix\space #1 \if>#2>\else
- \space (with options: `#2')\fi^^J}%
- \needed{#1}%
- \ifx\curinnames\empty
- \Name\@addto{b@\curin}{\noexpand\openoutput\curout}%
- \fi
- \@addto\curinnames{ #1}%
- \Name\@addto{o@\curin}{\noexpand\do\curout{#2}}%
- }
-\def\readsource(#1){%
- \immediate\openin\inFile\uptospace#1 \qStop\relax
- \ifeof\inFile
- \errmessage{Cannot find file \uptospace#1 \qStop}%
- \else
- \processedLines\z@
- \commentsRemoved\z@
- \commentsPassed\z@
- \codeLinesPassed\z@
- \let\refusedfiles\empty
- \csname b@#1\endcsname
- \Name\let{b@#1}\refusedfiles
- \Msg{} \def\@msg{Processing file \uptospace#1 \qStop}
- \def\change at msg{%
- \edef\@msg{\@spaces\@spaces\@spaces\space
- \expandafter\tospaces\uptospace#1 \qStop\secapsot}
- \let\change at msg\relax}
- \let\do\showfiles at do
- \let\refusedfiles\empty
- \csname o@#1\endcsname
- \ifx\refusedfiles\empty\else
- \@addto\newinputfiles{\noexpand\readsource(#1)}
- \fi
- \let\do\makeoutlist at do
- \edef\outputfiles{\csname o@#1\endcsname}%
- \let\activefiles\outputfiles
- \Name\let{o@#1}\refusedfiles
- \makeOther\ \makeOther\\\makeOther\$%
- \makeOther\#\makeOther\^\makeOther\^^K%
- \makeOther\_\makeOther\^^A\makeOther\%%
- \makeOther\~\makeOther\{\makeOther\}\makeOther\&%
- \endlinechar-1\relax
- \@tempcnta=128\relax
- \loop
- \catcode\@tempcnta 12\relax
- \ifnum\@tempcnta <255\relax
- \advance\@tempcnta\@ne
- \repeat
- \loop
- \read\inFile to\inLine
- \ifx\inLine\Endinput
- \Msg{File #1 ended by \string\endinput.}%
- \Continuefalse
- \else
- \ifeof\inFile
- \Continuefalse
- \else
- \Continuetrue
- \ifx\inLine\empty
- \advance\emptyLines\@ne
- \else
- \emptyLines\z@
- \fi
- \ifnum \emptyLines<2
- \expandafter\processLine\inLine\endLine
- \else
- \maybeMsg{/}%
- \fi
- \fi
- \fi
- \ifContinue
- \repeat
- \closein\inFile
- \csname e@#1\endcsname
- \Msg{Lines \space processed: \the\processedLines^^J%
- Comments removed: \the\commentsRemoved^^J%
- Comments \space passed: \the\commentsPassed^^J%
- Codelines passed: \the\codeLinesPassed^^J}%
- \global\advance\TotalprocessedLines by \processedLines
- \global\advance\TotalcommentsRemoved by \commentsRemoved
- \global\advance\TotalcommentsPassed by \commentsPassed
- \global\advance\TotalcodeLinesPassed by \codeLinesPassed
- \global\advance\NumberOfFiles by \@ne
- \fi}
-\def\showfiles at do#1#2{%
- \ifnum#1=\stream at closed
- \@addto\refusedfiles{\noexpand\do#1{#2}}%
- \else
- \Msg{\@msg
- \ifx>#2>\else\space(#2)\fi
- \space -> \@stripstring#1}
- \change at msg
- \csname off@\number#1\endcsname=\z@
- \fi
-}
-\def\makeoutlist at do#1#2{%
- \ifnum#1=\stream at closed\else
- \noexpand\do#1{#2}\csname off@\number#1\endcsname
- \fi}
-\def\openoutput#1{%
- \if 1\ifnum\@maxfiles=\z@ 0\fi
- \ifnum\@maxoutfiles=\z@ 0\fi1%
- \advance\@maxfiles\m at ne
- \advance\@maxoutfiles\m at ne
- \StreamOpen#1%
- \WritePreamble#1%
- \else
- \@addto\refusedfiles{\noexpand\openoutput#1}%
- \fi
- }
-\def\closeoutput#1{%
- \ifnum#1=\stream at closed\else
- \WritePostamble#1%
- \StreamClose#1%
- \advance\@maxfiles\@ne
- \advance\@maxoutfiles\@ne
- \fi}
-\def\ds at heading{%
- \MetaPrefix ^^J%
- \MetaPrefix\space This is file `\outFileName',^^J%
- \MetaPrefix\space generated with the docstrip utility.^^J%
- }
-\def\AddGenerationDate{%
- \def\ds at heading{%
- \MetaPrefix ^^J%
- \MetaPrefix\space This is file `\outFileName', generated %
- on <\the\year/\the\month/\the\day> ^^J%
- \MetaPrefix\space with the docstrip utility (\fileversion).^^J%
- }}
-\let\inFileName\relax
-\let\outFileName\relax
-\let\ReferenceLines\relax
-\def\declarepreamble{\begingroup
-\catcode`\^^M=13 \catcode`\ =12 %
-\declarepreambleX}
-{\catcode`\^^M=13 %
-\gdef\declarepreambleX#1#2
-\endpreamble{\endgroup%
- \def^^M{^^J\MetaPrefix\space}%
- \edef#1{\ds at heading%
- \ReferenceLines%
- \MetaPrefix\space\checkeoln#2\empty}}%
-\gdef\checkeoln#1{\ifx^^M#1\else\expandafter#1\fi}%
-}
-\def\declarepostamble{\begingroup
-\catcode`\ =12 \catcode`\^^M=13
-\declarepostambleX}
-{\catcode`\^^M=13 %
-\gdef\declarepostambleX#1#2
-\endpostamble{\endgroup%
- \def^^M{^^J\MetaPrefix\space}%
- \edef#1{\MetaPrefix\space\checkeoln#2\empty^^J%
- \MetaPrefix ^^J%
- \MetaPrefix\space End of file `\outFileName'.%
- }}%
-}
-\def\usepreamble#1{\def\currentpreamble{#1}}
-\def\usepostamble#1{\def\currentpostamble{#1}}
-\def\nopreamble{\usepreamble\empty}
-\def\nopostamble{\usepostamble\empty}
-\def\preamble{\usepreamble\defaultpreamble
- \declarepreamble\defaultpreamble}
-\def\postamble{\usepostamble\defaultpostamble
- \declarepostamble\defaultpostamble}
-\declarepreamble\org at preamble
-
-IMPORTANT NOTICE:
-
-For the copyright see the source file.
-
-Any modified versions of this file must be renamed
-with new filenames distinct from \outFileName.
-
-For distribution of the original source see the terms
-for copying and modification in the file \inFileName.
-
-This generated file may be distributed as long as the
-original source files, as listed above, are part of the
-same distribution. (The sources need not necessarily be
-in the same archive or directory.)
-\endpreamble
-\edef\org at postamble{\string\endinput^^J%
- \MetaPrefix ^^J%
- \MetaPrefix\space End of file `\outFileName'.%
- }
-\let\defaultpreamble\org at preamble
-\let\defaultpostamble\org at postamble
-\usepreamble\defaultpreamble
-\usepostamble\defaultpostamble
-\declarepreamble\originaldefault
-
-IMPORTANT NOTICE:
-
-For the copyright see the source file.
-
-You are *not* allowed to modify this file.
-
-You are *not* allowed to distribute this file.
-For distribution of the original source see the terms
-for copying and modification in the file \inFileName.
-
-\endpreamble
-\def\WritePreamble#1{%
- \expandafter\ifx\csname pre@\@stripstring#1\endcsname\empty
- \else
- \edef\outFileName{\@stripstring#1}%
- \StreamPut#1{\csname pre@\@stripstring#1\endcsname}%
- \fi}
-\def\WritePostamble#1{%
- \expandafter\ifx\csname post@\@stripstring#1\endcsname\empty
- \else
- \edef\outFileName{\@stripstring#1}%
- \StreamPut#1{\csname post@\@stripstring#1\endcsname}%
- \fi}
-\def\usedir#1{\edef\destdir{\WriteToDir}}
-\def\showdirectory#1{\WriteToDir}
-\def\BaseDirectory#1{%
- \@setwritetodir
- \let\usedir\alt at usedir
- \let\showdirectory\showalt at directory
- \edef\basedir{#1\dirsep}}
-\def\convsep#1/#2\qStop{%
- #1\ifx\qStop#2\qStop \pesvnoc\fi\convsep\dirsep#2\qStop}
-\def\pesvnoc#1\qStop{\fi}
-\def\alt at usedir#1{%
- \Name\ifx{dir@#1}\relax
- \undefined at directory{#1}%
- \else
- \edef\destdir{\csname dir@#1\endcsname}%
- \fi}
-\def\showalt at directory#1{%
- \Name\ifx{dir@#1}\relax
- \showundef at directory{#1}%
- \else\csname dir@#1\endcsname\fi}
-\def\undefined at directory#1{%
- \errhelp{docstrip.cfg should specify a target directory for^^J%
- #1 using \DeclareDir or \UseTDS.}%
- \errmessage{You haven't defined the output directory for `#1'.^^J%
- Subsequent files will be written to the current directory}%
- \let\destdir\WriteToDir
- }
-\def\showundef at directory#1{UNDEFINED (label is #1)}
-\def\undefined at TDSdirectory#1{%
- \edef\destdir{%
- \basedir\convsep#1/\qStop
- }}
-\def\showundef at TDSdirectory#1{\basedir\convsep#1/\qStop}
-\def\UseTDS{%
- \@setwritetodir
- \let\undefined at directory\undefined at TDSdirectory
- \let\showundef at directory\showundef at TDSdirectory
- }
-\def\DeclareDir{\@ifnextchar*{\DeclareDirX}{\DeclareDirX\basedir*}}
-\def\DeclareDirX#1*#2#3{%
- \@setwritetodir
- \Name\edef{dir@#2}{#1#3}}
-\def\generateFile#1#2#3{{%
- \ifx t#2\askforoverwritetrue
- \else\askforoverwritefalse\fi
- \generate{\file{#1}{#3}}%
- }}
-\def\include#1{\def\Options{#1}}
-\def\processFile#1#2#3#4{%
- \generateFile{#1.#3}{#4}{\from{#1.#2}{\Options}}}
-\def\processfile{\Msg{%
- ^^Jplease use \string\processFile\space instead of
- \string\processfile!^^J}%
- \processFile}
-\def\generatefile{\Msg{%
- ^^Jplease use \string\generateFile\space instead of
- \string\generatefile!^^J}%
- \generateFile}
-\newcount\@maxfiles
-\def\maxfiles#1{%
- \@maxfiles#1\relax
- \ifnum\@maxfiles<4
- \errhelp{I'm not a magician. I need at least four^^J%
- streams to be able to work properly, but^^J%
- you've only let me use \the\@maxfiles.}%
- \errmessage{\noexpand\maxfiles limit is too strict.}%
- \@maxfiles4
- \fi
-}
-\maxfiles{1972} % year of my birth (MW)
-\newcount\@maxoutfiles
-\def\maxoutfiles#1{%
- \@maxoutfiles=#1\relax
- \ifnum\@maxoutfiles<1
- \@maxoutfiles1
- \errhelp{I'm not a magician. I need at least one output^^J%
- stream to be able to do anything useful at all.^^J%
- Please be reasonable.}%
- \errmessage{\noexpand\maxoutfiles limit is insane}%
- \fi
-}
-\maxoutfiles{16}
-\def\checkfilelimit{%
- \advance\@maxfiles\m at ne
- \ifnum\@maxfiles<2 %
- \errhelp{There aren't enough streams left to do any unpacking.^^J%
- I can't do anything about this, so complain at the^^J%
- person who made such a complicated installation.}%
- \errmessage{Too few streams left.}%
- \end
- \fi
-}
-\def\strip at meaning#1>{}
-\def\processbatchFile{%
- \checkfilelimit
- \let\next\relax
- \openin\inputcheck \batchfile\relax
- \ifeof\inputcheck
- \ifDefault
- \else
- \errhelp
- {A batchfile specified in \batchinput could not be found.}%
- \errmessage{^^J%
- **************************************************^^J%
- * Could not find your \string\batchfile=\batchfile.^^J%
- **************************************************}%
- \fi
- \else
- \ifDefault
- \Msg{**************************************************^^J%
- * Batchfile \DefaultbatchFile\space found Use it? (y/n)?}%
- \Ask\answer{%
- **************************************************}%
- \else
- \let\answer\y
- \fi
- \ifx\answer\y
- \closein\inputcheck
- \def\next{\@@input\batchfile\relax}%
- \fi
- \fi
- \next}
-\def\ReportTotals{%
- \ifnum\NumberOfFiles>\@ne
- \Msg{Overall statistics:^^J%
- Files \space processed: \the\NumberOfFiles^^J%
- Lines \space processed: \the\TotalprocessedLines^^J%
- Comments removed: \the\TotalcommentsRemoved^^J%
- Comments \space passed: \the\TotalcommentsPassed^^J%
- Codelines passed: \the\TotalcodeLinesPassed}%
- \fi}
-\def\SetFileNames{%
- \edef\sourceFileName{\MainFileName.\infileext}%
- \edef\destFileName{\MainFileName.\outfileext}}
-\def\CheckFileNames{%
- \ifx\sourceFileName\destFileName
- \Msg{^^J%
- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J%
- ! It is not possible to read from and write to the same file !^^J%
- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J}%
- \Continuefalse
- \else
- \Continuetrue
- \immediate\openin\inFile \sourceFileName\relax
- \ifeof\inFile
- \Msg{^^J%
- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J%
- ! Your input file `\sourceFileName' was not found !^^J%
- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J}%
- \Continuefalse
- \else
- \immediate\closein\inFile
- \immediate\openin\inFile\destdir \destFileName\relax
- \ifeof\inFile
- \Continuetrue
- \else
- \Continuefalse
- \Ask\answer{File \destdir\destFileName\space already
- exists
- \ifx\empty\destdir somewhere \fi
- on the system.^^J%
- Overwrite it%
- \ifx\empty\destdir\space if necessary\fi
- ? [y/n]}%
- \ifx\y \answer \Continuetrue \else
- \ifx\yes\answer \Continuetrue \else
- \fi\fi
- \fi
- \fi
- \fi
- \closein\inFile}
-\def\interactive{%
- \whileswitch\ifMoreFiles\fi%
- {\begingroup
- \AskQuestions
- \forlist\MainFileName:=\filelist
- \do
- \SetFileNames
- \CheckFileNames
- \ifContinue
- \generateFile{\destFileName}{f}%
- {\from{\sourceFileName}{\Options}}
- \fi%
- \od
- \endgroup
- \Ask\answer{More files to process (y/n)?}%
- \ifx\y \answer\MoreFilestrue \else
- \ifx\yes\answer\MoreFilestrue \else
- \MoreFilesfalse\fi\fi
- }}
-\def\AskQuestions{%
- \Msg{^^J%
- ****************************************************}%
- \Ask\infileext{%
- * First type the extension of your input file(s): \space *}%
- \Msg{****************************************************^^J^^J%
- ****************************************************}%
- \Ask\outfileext{%
- * Now type the extension of your output file(s) \space: *}%
- \Msg{****************************************************^^J^^J%
- ****************************************************}%
- \Ask\Options{%
- * Now type the name(s) of option(s) to include \space\space: *}%
- \Msg{****************************************************^^J^^J%
- ****************************************************^^J%
- * Finally give the list of input file(s) without \space\space*}%
- \Ask\filelist{%
- * extension separated by commas if necessary %
- \space\space\space\space: *}%
- \Msg{****************************************************^^J}}%
-\Msg{Utility: `docstrip' \fileversion\space <\filedate>^^J%
- English documentation \space\space\space <\docdate>}%
-\Msg{^^J%
- **********************************************************^^J%
- * This program converts documented macro-files into fast *^^J%
- * loadable files by stripping off (nearly) all comments! *^^J%
- **********************************************************^^J}%
-\def\@setwritetodir{%
- \let\setwritetodir\relax
- \ifx\WriteToDir\@undefined
- \ifx\@currdir\@undefined
- \def\WriteToDir{}%
- \else
- \let\WriteToDir\@currdir
- \fi
- \fi
- \let\destdir\WriteToDir
- \def\tmp{[]}%
- \ifx\tmp\WriteToDir
- \ifx\dirsep\@undefined
- \def\dirsep{.}%
- \fi
- \ifx\makepathname\@undefined
- \def\makepathname##1{%
- \edef\@pathname{\ifx\WriteToDir\destdir
- \WriteToDir\else[\destdir]\fi##1}}%
- \fi
- \fi
- \ifx\dirsep\@undefined
- \def\dirsep{/}%
- \def\tmp{:}%
- \ifx\tmp\WriteToDir
- \def\dirsep{:}%
- \fi
- \fi
- \ifx\makepathname\@undefined
- \def\makepathname##1{%
- \edef\@pathname{\destdir\ifx\empty\destdir\else
- \ifx\WriteToDir\destdir\else\dirsep\fi\fi##1}}%
- \fi}
-\immediate\openin\inputcheck=docstrip.cfg\relax
-\ifeof\inputcheck
- \Msg{%
- ********************************************************^^J%
- * No Configuration file found, using default settings. *^^J%
- ********************************************************^^J}%
-\else
- \Msg{%
- ******************************************^^J%
- * Using Configuration file docstrip.cfg. *^^J%
- ******************************************^^J}%
- \closein\inputcheck
- \afterfi{\@@input docstrip.cfg\relax}
-\fi
-\@setwritetodir
-\def\process at first@batchfile{%
- \processbatchFile
- \ifnum\NumberOfFiles=\z@
- \interactive
- \fi
- \endbatchfile}
-\def\endbatchfile{%
- \iftopbatchfile
- \ReportTotals
- \expandafter\end
- \else
- \endinput
- \fi}
-\edef\@jobname{\lowercase{\def\noexpand\@jobname{\jobname}}}%
-\@jobname
-\def\@docstrip{docstrip}%
-\edef\@docstrip{\expandafter\strip at meaning\meaning\@docstrip}
-\Defaultfalse
-\ifx\undefined\batchfile
- \ifx\@jobname\@docstrip
- \let\batchfile\DefaultbatchFile
- \Defaulttrue
- \else
- \let\process at first@batchfile\relax
- \fi
-\fi
-\process at first@batchfile
-%\endinput
-%%
-%% End of file `docstrip.tex'.
-
-\def\checkOption<#1{%
- \ifcase
- \ifx*#10\else \ifx/#11\else
- \ifx+#12\else \ifx-#13\else
- \ifx<#14\else \ifx @#15\else 6\fi\fi\fi\fi\fi\fi\relax
- \expandafter\starOption\or
- \expandafter\slashOption\or
- \expandafter\plusOption\or
- \expandafter\minusOption\or
- \expandafter\verbOption\or
- \expandafter\moduleOption\or
- \expandafter\doOption\fi
- #1%
-}
-\def\moduleOption @@=#1>#2\endLine{%
- \maybeMsg{<@@=#1>}%
- \prepareActiveModule{#1}%
-}
-\begingroup
- \catcode`\_ = 12 %
- \long\gdef\prepareActiveModule#1{%
- \ifx\relax#1\relax
- \let\replaceModuleInLine\empty
- \else
- \edef\replaceModuleInLine{%
- \noexpand\replaceAllIn\noexpand\inLine{@@@@}{\string aa}%
- \noexpand\replaceAllIn\noexpand\inLine{__@@}{__#1}%
- \noexpand\replaceAllIn\noexpand\inLine{_@@}{__#1}%
- \noexpand\replaceAllIn\noexpand\inLine{@@}{__#1}%
- \noexpand\replaceAllIn\noexpand\inLine{\string aa}{@@}%
- }%
- \fi
- }
-\endgroup
-\let\replaceModuleInLine\empty
-\long\def\replaceAllIn#1#2#3{%
- \long\def\tempa##1##2#2{%
- ##2\qMark\replaceAllInAuxIII#3##1%
- }%
- \edef#1{\expandafter\replaceAllInAuxI#1\qMark#2\qStop}%
-}
-\def\replaceAllInAuxI{%
- \expandafter\replaceAllInAuxII\tempa\replaceAllInAuxI\empty
-}
-\long\def\replaceAllInAuxII#1\qMark#2{#1}
-\long\def\replaceAllInAuxIII#1\qStop{}
-\def\normalLine#1\endLine{%
- \maybeMsg{.}%
- \def\inLine{#1}%
- \replaceModuleInLine
- \let\do\putline at do
- \activefiles
-}
-\def\doOption#1>#2\endLine{%
- \maybeMsg{<#1 . >}%
- \Evaluate{#1}%
- \def\do##1##2##3{%
- \if1\Expr{##2}%
- \def\inLine{#2}%
- \replaceModuleInLine
- \StreamPut##1{\inLine}%
- \fi
- }%
- \activefiles
-}
-%%
-%%
-%% End of file `l3docstrip.tex'.
More information about the latex3-commits
mailing list.