From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- .../contrib/koma-script/source/scrdocstrip.tex | 324 +++++++++++++++++++++ 1 file changed, 324 insertions(+) create mode 100644 macros/latex/contrib/koma-script/source/scrdocstrip.tex (limited to 'macros/latex/contrib/koma-script/source/scrdocstrip.tex') diff --git a/macros/latex/contrib/koma-script/source/scrdocstrip.tex b/macros/latex/contrib/koma-script/source/scrdocstrip.tex new file mode 100644 index 0000000000..0c96d0f00d --- /dev/null +++ b/macros/latex/contrib/koma-script/source/scrdocstrip.tex @@ -0,0 +1,324 @@ +% ====================================================================== +% scrdocstrip.tex +% Copyright (c) Markus Kohm, 2013-2018 +% +% This file is part of the LaTeX2e KOMA-Script bundle. +% +% This work may be distributed and/or modified under the conditions of +% the LaTeX Project Public License, version 1.3c of the license. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later and of this work. +% +% This work has the LPPL maintenance status "author-maintained". +% +% The Current Maintainer and author of this work is Markus Kohm. +% +% This work consists of all files listed in manifest.txt. +% ---------------------------------------------------------------------- +% scrdocstrip.tex +% Copyright (c) Markus Kohm, 2013-2018 +% +% Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz, +% Version 1.3c, verteilt und/oder veraendert werden. +% Die neuste Version dieser Lizenz ist +% http://www.latex-project.org/lppl.txt +% und Version 1.3c ist Teil aller Verteilungen von LaTeX +% Version 2005/12/01 oder spaeter und dieses Werks. +% +% Dieses Werk hat den LPPL-Verwaltungs-Status "author-maintained" +% (allein durch den Autor verwaltet). +% +% Der Aktuelle Verwalter und Autor dieses Werkes ist Markus Kohm. +% +% Dieses Werk besteht aus den in manifest.txt aufgefuehrten Dateien. +% ====================================================================== + +\expandafter\ifx\csname scrdocstripversion\endcsname\relax + \let\KOMAbatchfile\batchfile + \let\batchfile\undefined +\fi + +\expandafter\ifx\csname ifbeta\endcsname\undefined + \expandafterlet\csname ifbeta\expandafter\csname iftrue\endcsname +\fi + +\input docstrip.tex + +\ifx\generate\undefined + \errhelp{| This installation requires docstrip version 2.3c or * later,^^J% + | but an old version of docstrip has been input.^^J% + | This error is fatal, because You have to update docstrip and maybe LaTeX + fist!} + \errmessage{| Fatal error: Old docstrip in input path} + \batchmode + \csname @@end\endcsname +\fi + +\expandafter\ifx\csname scrdocstripversion\endcsname\relax +\else \expandafter\endinput +\fi +\Msg{| Using KOMA-Script's docstrip extensions.}%| +% Support for variables: +\def\KOMAdefVariable#1#2{% + \expandafter\def\csname KOMAvar@#1\endcsname{#2}% +} +\def\KOMAifVariable#1{% + \expandafter\ifx\csname KOMAvar@#1\endcsname\relax + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi +} +\def\KOMAuseVariable#1{% + \KOMAifVariable{#1}{% + \csname KOMAvar@#1\endcsname + }{% + variable #1\undefined + }% +} +\KOMAdefVariable{AUTHOR}{Markus Kohm} +\KOMAdefVariable{COPYRIGHT}{% + Copyright (c) + \KOMAifVariable{COPYRIGHTFROM}{\KOMAuseVariable{COPYRIGHTFROM}-}{}% + \KOMAifVariable{COPYRIGHTTILL}{\KOMAuseVariable{COPYRIGHTTILL}}{} + \KOMAuseVariable{AUTHOR}% + \KOMAifVariable{EMAIL}{ \KOMAuseVariable{EMAIL}}{}% +} +\KOMAdefVariable{COPYRIGHTCOMMENT}{% + \MetaPrefix\space\KOMAuseVariable{COPYRIGHT}% +} +% Provide validity test: All files listed in a file must exists. +% You should note, that some TeX distributions cannot find files without +% extension! +\def\defuppercase#1#2{% + \edef\reserved@a{\noexpand\def\noexpand#1{#2}}% + \expandafter\uppercase\expandafter{\reserved@a}% +} +\def\KOMAdocExtensions{HTML,PDF,TXT} +\let\KOMAdocFilesMissing\empty +\let\KOMAnoFilesMissing\empty +\let\KOMAFilesMissing\empty +\def\getlastextension#1.#2.#3\@nil{% + \ifx\relax#2\relax + \ifx\relax#3\relax + \else + #1% + \fi + \else + \getlastextension#2.#3..\@nil + \fi +} +\def\KOMAvalidityTest#1{% + \maybeMsg{^^J| Testing validity of distribution: }%| + \begingroup + \def\readloop{% + \ifeof\inFile\else + \read\inFile to \input@testfile\relax + \ifx\input@testfile\empty + \maybeMsg{\space}% + \else + \openin\inputcheck \input@testfile\relax + \ifeof\inputcheck + \maybeMsg{-}% + \defuppercase\reserved@a{% + \expandafter\getlastextension\input@testfile..\@nil + }% + \ifx\reserved@a\empty + \@addto\KOMAnoFilesMissing{\noexpand\do{\input@testfile}}% + \let\reserved@a\empty + \else + \forlist\reserved@b:=\KOMAdocExtensions\do + \ifx\reserved@a\reserved@b + \@addto\KOMAdocFilesMissing{\noexpand\do{\input@testfile}}% + \let\reserved@a\empty + \Forlistfalse + \fi + \od + \fi + \ifx\reserved@a\empty\else + \@addto\KOMAFilesMissing{\noexpand\do{\input@testfile}}% + \fi + \else + \maybeMsg{+}% + \fi + \closein\inputcheck + \fi + \expandafter\readloop + \fi + }% + \endlinechar=-1 + \openin\inFile #1\relax + \ifeof\inFile + \global\@addto\KOMAFilesMissing{\noexpand\do{#1}}% + \else + \readloop + \closein\inFile + \fi + \ifx\KOMAFilesMissing\empty + \ifx\KOMAdocFilesMissing\empty + \ifx\KOMAnoFilesMissing\empty + \maybeMsg{\space OK.^^J}% + \fi + \fi + \else + \def\do##1{,^^J| \@spaces\@spaces\@spaces##1}% + \errhelp{| You should ask your distributor for a valid and legal + distribution.}%| + \errmessage{^^J% + | Missing files: \expandafter\expandafter\expandafter\@gobble + \KOMAFilesMissing\KOMAdocFilesMissing\KOMAnoFilesMissing^^J% + | Distribution seems to be invalid.^^J% + | This error is fatal}%| + \batchmode + \csname @@end\endcsname + \fi + \global\let\KOMAnoFilesMissing\KOMAnoFilesMissing + \global\let\KOMAdocFilesMissing\KOMAdocFilesMissing + \endgroup +} +\def\@gobbletwo#1#2{} +\expandafter\def\expandafter\ReportTotals\expandafter{\ReportTotals + \ifx\KOMAnoFilesMissing\empty\else + \Msg{% + +----------------------------------------------------------------------% + ^^J% + | Following files without extension seem to be missing:} + \begingroup + \def\do##1{,^^J| \space\space##1}% + \Msg{\expandafter\expandafter\expandafter\@gobbletwo\KOMAnoFilesMissing} + \endgroup + \Msg{% + | PLEASE NOTE, THAT DISTRIBUTIONS WITHOUT THOSE FILES ARE NOT ALLOWED!^^J% + | But maybe those files are there and you're TeX distribution simply^^J% + | cannot open files without extension.^^J% + +----------------------------------------------------------------------}%| + \fi + \ifx\KOMAdocFilesMissing\empty\else + \Msg{% + +----------------------------------------------------------------------% + ^^J% + | Following documentations files are missing:} + \begingroup + \def\do##1{,^^J| \space\space##1}% + \Msg{\expandafter\expandafter\expandafter\@gobbletwo\KOMAdocFilesMissing} + \endgroup + \Msg{% + | PLEASE NOTE, THAT DISTRIBUTIONS WITHOUT THOSE FILES ARE NOT ALLOWED!^^J% + | MAYBE YOU CAN GENERATE THOSE FILES FROM OTHER PARTS OF THE SOURCES.^^J% + +----------------------------------------------------------------------} + \fi +} +% Extend line scanner by: +% - %!VARIABLE : to write variable into files +% - %?VARIABLE=VALUE : to setup a new variable +\begingroup +\catcode`\%=12 \catcode`\*=14 +\gdef\processLineX%#1{* + \ifcase\ifx%#10\else + \ifx<#11\else + \ifx!#12\else 3\fi\fi\fi\relax + \expandafter\putMetaComment\or + \expandafter\checkOption\or + \expandafter\KOMAexpandVariable\or + \expandafter\removeComment\fi + #1} +\gdef\KprocessLineX%#1{* + \ifcase\ifx%#10\else + \ifx<#11\else + \ifx!#12\else + \ifx?#13\else 4\fi\fi\fi\fi\relax + \expandafter\putMetaComment\or + \expandafter\checkOption\or + \expandafter\KOMAexpandVariable\or + \expandafter\KOMAsetVariable\or + \expandafter\removeComment\fi + #1} +\endgroup +\def\KOMAexpandVariable!#1\endLine{% + \advance\codeLinesPassed\@ne + \maybeMsg{x}% + \edef\inLine{\KOMAuseVariable{#1}}% + \let\do\putline@do + \activefiles +} +\def\KOMAsetVariable?#1=#2\endLine{% + \expandafter\gdef\csname KOMAvar@#1\endcsname{#2}% +} +% Extend heading +\def\ds@heading{% + \expandafter\ifx\csname ifbeta\expandafter\endcsname + \csname iftrue\endcsname + \use@Warning{\outFileName}{% + YOU SHOULD NOTE, THAT THIS IS NOT AN OFFICIAL RELEASE!^^J% + THIS VERSION IS INTENDED TO BE USED FOR TESTING ONLY!^^J% + USAGE FOR PURPOSES OTHER THAN INTENDED IS DANGEROUS!^^J% + DON'T EXPECT ANY SUPPORT FOR THIS VERSION!% + }% + \fi + \MetaPrefix ^^J% + \MetaPrefix\space This is file `\outFileName',^^J% + \MetaPrefix\space generated with the docstrip utility, extended by + scrdocstrip.^^J% +} +\def\commentWarning#1#2{% + \MetaPrefix\space + -------------------------------------------------------------------------^^J% + \@commentWarning#2^^J\@nil + \MetaPrefix\space + -------------------------------------------------------------------------^^J% +} +\def\@commentWarning#1^^J#2\@nil{% + \MetaPrefix\space #1^^J% + \ifx\relax#2\relax\else\@commentWarning#2\@nil\fi +} +\def\KNL{^\empty^J\perCent^^J} +\def\XKNL{^\empty^J\perCent|^^J} +\def\genericWarning#1#2{% + \string\immediate\string\write17{\KNL + +----------------------------------------------------------------------\KNL + | WARNING (`#1'):\XKNL + +----------------------------------------------------------------------\KNL + \@genericWarning#2^^J\@nil + +----------------------------------------------------------------------\KNL + }^^J% +} +\def\@genericWarning#1^^J#2\@nil{% + | #1\XKNL + \ifx\relax#2\relax\else\@genericWarning#2\@nil\fi +}%| +\def\useWarning#1{\let\use@Warning#1} +\useWarning\genericWarning + +% Now, we need some code from docstrip to start old docstrip-processing +\ifx\undefined\KOMAbatchfile\else + \Defaultfalse + \let\batchfile\KOMAbatchfile + \def\process@first@batchfile{% + \processbatchFile + \ifnum\NumberOfFiles=\z@ + \interactive + \fi + \endbatchfile + } +\fi + +\chardef\scrdocstripversion 1\relax + +\def\fromoptional#1{% + \immediate\openin\inputcheck\uptospace#1 \qStop\relax + \ifeof\inputcheck + \Msg{Ignorring not existing optional file `#1'.}% + \expandafter\@gobbletwo + \else + \immediate\closein\inputcheck + \expandafter\from + \fi + {#1}% +} + +\process@first@batchfile +\endinput +% +% end of file `scrdocstrip.tex' -- cgit v1.2.3