%%
%% 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.
%%
%% Copyright 1993 1994 1995 1996 1997 1998 1999
%% The LaTeX3 Project and any individual authors listed elsewhere
%% in this file.
%%
%% This file is part of the LaTeX2e system.
%% ----------------------------------------
%%
%% It may be distributed under the terms of the LaTeX Project Public
%% License, as described in lppl.txt in the base LaTeX distribution.
%% Either version 1.0 or, at your option, any later version.
\catcode`\{=1
\catcode`\}=2
\def\filename{docstrip.dtx}
\def\fileversion{2.5b}
\def\filedate{1998/04/28}
\def\docdate {1998/04/03}
%% \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
%% Lower-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
%% Digits \0\1\2\3\4\5\6\7\8\9
%% Exclamation \! Double quote \" Hash (number) \#
%% Dollar \$ Percent \% Ampersand \&
%% Acute accent \' Left paren \( Right paren \)
%% Asterisk \* Plus \+ Comma \,
%% Minus \- Point \. Solidus \/
%% Colon \: Semicolon \; Less than \<
%% Equals \= Greater than \> Question mark \?
%% Commercial at \@ Left bracket \[ Backslash \\
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%%
%% 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 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@ne=22 \m@ne=-1
Z \countdef\count@=255
Z
Z \def\wlog{\immediate\write\m@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@0\countdef} \def\newtoks{\alloc@5\toksdef}
Z \def\newread{\alloc@6\chardef} \def\newwrite{\alloc@7\chardef}
Z
Z \def\newif#1{%
Z \count@\escapechar \escapechar\m@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
\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@preamble
\usepostamble\org@postamble
\let\destdir\WriteToDir
\processbatchFile
\endgroup
}
\def\skip@input#1 {}
\let\input\skip@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@do\relax
\edef\@outputstreams{%
\s@do\Name\noexpand{s@0}\s@do\Name\noexpand{s@1}%
\s@do\Name\noexpand{s@2}\s@do\Name\noexpand{s@3}%
\s@do\Name\noexpand{s@4}\s@do\Name\noexpand{s@5}%
\s@do\Name\noexpand{s@6}\s@do\Name\noexpand{s@7}%
\s@do\Name\noexpand{s@8}\s@do\Name\noexpand{s@9}%
\s@do\Name\noexpand{s@10}\s@do\Name\noexpand{s@11}%
\s@do\Name\noexpand{s@12}\s@do\Name\noexpand{s@13}%
\s@do\Name\noexpand{s@14}\s@do\Name\noexpand{s@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@closed=16
\def\StreamOpen#1{%
\chardef#1=\stream@closed
\def\s@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@do##1{\ifnum#1=\expandafter\@stripstr\string##1 %
\global\chardef##1=0 %
\@streamfound
\fi}
\@outputstreams
\chardef#1=\stream@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 asssume `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@a{\ifx\reserved@c #1 \aftergroup\@firstoftwo
\else \aftergroup\@secondoftwo\fi\egroup
{#2}{#3}}%
\futurelet\reserved@c\@ifnch
}
\def\@ifnch{\ifx \reserved@c \@sptoken \expandafter\@xifnch
\else \expandafter\reserved@a
\fi}
\def\@firstoftwo#1#2{#1}
\def\@secondoftwo#1#2{#2}
\iden{\let\@sptoken= } %
\iden{\def\@xifnch} {\futurelet\reserved@c\@ifnch}
\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@do
\activefiles
}
\def\putline@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@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@do
\outputfiles
\let\do\findactive@do
\edef\activefiles{\activefiles}
}
\def\checkguard@do#1#2#3{%
\ifnum#3>0
\advance#3\@ne
\else
\if1\Expr{#2}\else
\advance#3\@ne\fi
\fi}
\def\findactive@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@ne
\let\do\closeguard@do
\outputfiles
\let\do\findactive@do
\edef\activefiles{\outputfiles}
\fi
}
\def\closeguard@do#1#2#3{%
\ifnum#3>0
\advance#3\m@ne
\fi}
\def\verbOption<#1\endLine{{%
\edef\verbStop{\perCent#1}\maybeMsg{<<<}%
\let\do\putline@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@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@from \let\needed\err@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@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@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@needed\needed
\def\@needed#1{%
\edef\reserved@a{#1}%
\expandafter\@need@d\expandafter{\reserved@a}}
\def\@need@d#1{%
\@ifpresent{(#1)}\curinfiles
{\@need@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@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@msg{%
\edef\@msg{\@spaces\@spaces\@spaces\space
\expandafter\tospaces\uptospace#1 \qStop\secapsot}
\let\change@msg\relax}
\let\do\showfiles@do
\let\refusedfiles\empty
\csname o@#1\endcsname
\ifx\refusedfiles\empty\else
\@addto\newinputfiles{\noexpand\readsource(#1)}
\fi
\let\do\makeoutlist@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
\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@do#1#2{%
\ifnum#1=\stream@closed
\@addto\refusedfiles{\noexpand\do#1{#2}}%
\else
\Msg{\@msg
\ifx>#2>\else\space(#2)\fi
\space -> \@stripstring#1}
\change@msg
\csname off@\number#1\endcsname=\z@
\fi
}
\def\makeoutlist@do#1#2{%
\ifnum#1=\stream@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@ne
\advance\@maxoutfiles\m@ne
\StreamOpen#1%
\WritePreamble#1%
\else
\@addto\refusedfiles{\noexpand\openoutput#1}%
\fi
}
\def\closeoutput#1{%
\ifnum#1=\stream@closed\else
\WritePostamble#1%
\StreamClose#1%
\advance\@maxfiles\@ne
\advance\@maxoutfiles\@ne
\fi}
\def\ds@heading{%
\MetaPrefix ^^J%
\MetaPrefix\space This is file `\outFileName',^^J%
\MetaPrefix\space generated with the docstrip utility.^^J%
}
\def\AddGenerationDate{%
\def\ds@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@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@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@postamble{\string\endinput^^J%
\MetaPrefix ^^J%
\MetaPrefix\space End of file `\outFileName'.%
}
\let\defaultpreamble\org@preamble
\let\defaultpostamble\org@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@usedir
\let\showdirectory\showalt@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@usedir#1{%
\Name\ifx{dir@#1}\relax
\undefined@directory{#1}%
\else
\edef\destdir{\csname dir@#1\endcsname}%
\fi}
\def\showalt@directory#1{%
\Name\ifx{dir@#1}\relax
\showundef@directory{#1}%
\else\csname dir@#1\endcsname\fi}
\def\undefined@directory#1{%
\errhelp{docstrip.cfg should specify a target directory for^^J%
#1 using \DeclareDir or \UseTDS.}%
\errmessage{You haven't defined output directory for `#1'.^^J%
Subsequent files will be written to the current directory.}%
\let\destdir\WriteToDir
}
\def\showundef@directory#1{UNDEFINED (label is #1)}
\def\undefined@TDSdirectory#1{%
\edef\destdir{%
\basedir\convsep#1/\qStop
}}
\def\showundef@TDSdirectory#1{\basedir\convsep#1/\qStop}
\def\UseTDS{%
\@setwritetodir
\let\undefined@directory\undefined@TDSdirectory
\let\showundef@directory\showundef@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@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@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 seperated 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@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@meaning\meaning\@docstrip}
\Defaultfalse
\ifx\undefined\batchfile
\ifx\@jobname\@docstrip
\let\batchfile\DefaultbatchFile
\Defaulttrue
\else
\let\process@first@batchfile\relax
\fi
\fi
\process@first@batchfile
\endinput
%%
%% End of file `docstrip.tex'.
|