summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/checklistings/checklistings.sty249
1 files changed, 249 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/checklistings/checklistings.sty b/Master/texmf-dist/tex/latex/checklistings/checklistings.sty
new file mode 100644
index 00000000000..35ce3a30794
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/checklistings/checklistings.sty
@@ -0,0 +1,249 @@
+%%
+%% This is file `checklistings.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% checklistings.dtx (with options: `package')
+%%
+%% This is a generated file.
+%%
+%% Copyright (C) 2015 by Timothy Bourke <tim@tbrk.org>
+%% and Marc Pouzet <pouzet@ens.fr>
+%%
+%% This file may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License, either version 1.2 of this license
+%% or (at your option) any later version. The latest version of this
+%% license is in:
+%%
+%% http://www.latex-project.org/lppl.txt
+%%
+%% and version 1.2 or later is part of all distributions of LaTeX version
+%% 1999/12/01 or later.
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{checklistings}
+ [2015/09/01 v1.0 compile code samples and insert the results]
+\RequirePackage{keyval}
+\RequirePackage{kvoptions}
+\RequirePackage{fancyvrb}
+\RequirePackage{color}
+\RequirePackage{listings}
+\makeatletter
+\lst@RequireAspects{writefile}
+\SetupKeyvalOptions{family=CHKL,prefix=CHKL@}
+\makeatother
+
+\makeatletter
+\newcounter{chklisting}
+\ifdefined\resetcounteronoverlays
+\resetcounteronoverlays{chklisting}
+\fi
+\newif\ifCHKL@fileexists
+\def\CHKL@pkg@verbopts{}
+\def\CHKL@pkg@globalskip{0}
+
+\DeclareBoolOption{withresult}
+\DeclareComplementaryOption{withoutresult}{withresult}
+\DeclareBoolOption[true]{showproblems}
+\DeclareComplementaryOption{hideproblems}{showproblems}
+\DeclareVoidOption{skipone}
+ {\edef\CHKL@pkg@globalskip{1}%
+ \edef\CHKL@pkg@verbopts{\CHKL@pkg@verbopts,firstline=2}}
+\DeclareVoidOption{skiptwo}
+ {\edef\CHKL@pkg@globalskip{2}%
+ \edef\CHKL@pkg@verbopts{\CHKL@pkg@verbopts,firstline=3}}
+\DeclareDefaultOption
+ {\edef\CHKL@pkg@verbopts{\CHKL@pkg@verbopts,\CurrentOption}}
+\DeclareStringOption[]{codestyle}
+\DeclareStringOption[formatcom=\em]{msgstyle}
+\DeclareStringOption[formatcom=\em]{errstyle}
+\DeclareStringOption{codelst}
+\DeclareStringOption{msglst}
+\DeclareStringOption{errlst}
+\DeclareStringOption{emptyoption}
+\DeclareStringOption[.]{subdir}
+\DeclareStringOption[chklisting]{prefix}
+\DeclareStringOption[.ml]{ext}
+\DeclareStringOption[\#]{prompt}
+\DeclareStringOption[ocamlc]{compiler}
+\DeclareStringOption{compilerflags}
+\DeclareStringOption[-i]{lastflags}
+\DeclareStringOption[open]{includecmd}
+\DeclareStringOption[]{html}
+\ProcessKeyvalOptions*
+\def\checklistings{\kvsetkeys{CHKL}}
+\newwrite\CHKL@samplefile
+\openout\CHKL@samplefile=\jobname.chkl
+\AtEndDocument{\closeout\CHKL@samplefile}
+\write\CHKL@samplefile{subdir=\CHKL@subdir/}
+\write\CHKL@samplefile{prefix=\CHKL@prefix}
+\write\CHKL@samplefile{ext=\CHKL@ext}
+\write\CHKL@samplefile{compiler=\CHKL@compiler}
+\write\CHKL@samplefile{compilerflags=\CHKL@compilerflags}
+\write\CHKL@samplefile{lastflags=\CHKL@lastflags}
+\write\CHKL@samplefile{includecmd=\CHKL@includecmd}
+\write\CHKL@samplefile{htmlfilter=\CHKL@html}
+\DeclareRobustCommand{\CHKL@logsample}[2]{%
+ \edef\CHKL@tolog{#1:#2 [page=\noexpand\thepage] [line=\the\inputlineno]}%
+ \expandafter\write\expandafter\CHKL@samplefile\expandafter{\CHKL@tolog}%
+}
+\newif\ifchklisting
+\DeclareRobustCommand{\setchklistingcmd}[1]{%
+ \global\def\chklistingcmd{\emph{\CHKL@prompt{#1}}}}
+
+\def\ChkListingMsg{\FV@Environment{}{ChkListingMsg}}
+\def\FVB@ChkListingMsg{\FVB@SaveVerbatim{ChkListingMsg}}
+\let\FVE@ChkListingMsg\FVE@SaveVerbatim
+\DefineVerbatimEnvironment{ChkListingMsg}{ChkListingMsg}{}
+
+\def\ChkListingErr{\FV@Environment{}{ChkListingErr}}
+\def\FVB@ChkListingErr{\FVB@SaveVerbatim{ChkListingErr}}
+\let\FVE@ChkListingErr\FVE@SaveVerbatim
+\DefineVerbatimEnvironment{ChkListingErr}{ChkListingErr}{}
+
+\DeclareRobustCommand{\chklistingfile}{\CHKL@prefix\CHKL@ext}
+\newif\ifCHKL@shouldfail
+\newif\ifCHKL@showcode
+\def\CHKL@skip{0}
+\edef\CHKL@precontinue{}
+\define@key{CHKL@envkeys}{continue}[]{\edef\CHKL@continue{\CHKL@precontinue}}
+\define@key{CHKL@envkeys}{include}{%
+ \edef\CHKL@continue{\CHKL@continue\space\@ifundefined{CHKL@deps@#1}%
+ {#1}{\csname CHKL@deps@#1\endcsname}}}
+\define@key{CHKL@envkeys}{fail}[]{\CHKL@shouldfailtrue}
+\define@key{CHKL@envkeys}{label}{\edef\CHKL@label{#1}}
+\define@key{CHKL@envkeys}{skipnone}[]{%
+ \edef\CHKL@skip{0}\edef\CHKL@verbopts{\CHKL@verbopts,firstline=1}}
+\define@key{CHKL@envkeys}{skipone}[]{%
+ \edef\CHKL@skip{1}\edef\CHKL@verbopts{\CHKL@verbopts,firstline=2}}
+\define@key{CHKL@envkeys}{skiptwo}[]{%
+ \edef\CHKL@skip{2}\edef\CHKL@verbopts{\CHKL@verbopts,firstline=3}}
+\define@key{CHKL@envkeys}{hide}[]{\CHKL@showcodefalse}
+\define@key{CHKL@envkeys}{withresult}[]{\CHKL@withresulttrue}
+\define@key{CHKL@envkeys}{withoutresult}[]{\CHKL@withresultfalse}
+\define@key{CHKL@envkeys}{showproblems}[]{\CHKL@showproblemstrue}
+\define@key{CHKL@envkeys}{hideproblems}[]{\CHKL@showproblemsfalse}
+\DeclareRobustCommand{\chklistingmsg}[1]{
+ \bgroup%
+ \ifx\CHKL@msglst\CHKL@emptyoption\else
+ \expandafter\lstset\expandafter{\CHKL@msglst,fancyvrb=true}\fi%
+ \@ifundefined{FV@SV@CHKL@MSG@#1}
+ {\def\@tempa{#1}
+ \ifx\@tempa\empty
+ \CHKL@none
+ \else
+ $\langle$No message found for the label `#1'!$\rangle$
+ \fi}
+ {\expandafter\UseVerbatim\expandafter[\CHKL@msgstyle]{CHKL@MSG@#1}}%
+ \egroup}
+\DeclareRobustCommand{\chklistingerr}[1]{
+ \bgroup%
+ \ifx\CHKL@errlst\CHKL@emptyoption\else
+ \expandafter\lstset\expandafter{\CHKL@errlst,fancyvrb=true}\fi%
+ \@ifundefined{FV@SV@CHKL@ERR@#1}
+ {\def\@tempa{#1}
+ \ifx\@tempa\empty
+ \CHKL@none
+ \else
+ $\langle$No message found for the label `#1'!$\rangle$
+ \fi}
+ {\expandafter\UseVerbatim\expandafter[\CHKL@errstyle]{CHKL@ERR@#1}}%
+ \egroup}
+\lstnewenvironment{chklisting}[1][]
+ {%
+ \CHKL@shouldfailfalse%
+ \CHKL@showcodetrue%
+ \let\CHKL@label\@undefined%
+ \edef\CHKL@continue{}%
+ \def\CHKL@skip{\CHKL@pkg@globalskip}%
+ \let\CHKL@verbopts\CHKL@pkg@verbopts%
+ \def\@currentlabel{\thechklisting}%
+ \setkeys{CHKL@envkeys}{#1}%
+ \CHKL@logsample{\arabic{chklisting}}{\CHKL@continue%
+ \space\ifnum\CHKL@skip>0[skip=\CHKL@skip]\fi%
+ \ifCHKL@shouldfail\space[fail]\fi}%
+ \global\edef\CHKL@precontinue{\CHKL@continue\space\arabic{chklisting}}%
+ \@ifundefined{CHKL@label}{}{%
+ \global\expandafter\edef\csname CHKL@deps@\CHKL@label\endcsname{\CHKL@precontinue}}%
+ \edef\CHKL@num{%
+ \ifnum\value{chklisting}<1000 0\fi
+ \ifnum\value{chklisting}<100 0\fi
+ \ifnum\value{chklisting}<10 0\fi
+ \arabic{chklisting}}%
+ \stepcounter{chklisting}%
+ \def\CHKL@file{\CHKL@subdir/\CHKL@prefix\CHKL@num}%
+ \global\let\chklistingcmd\@undefined%
+ \global\let\FV@SV@ChkListingMsg\@undefined%
+ \global\let\FV@SV@ChkListingErr\@undefined%
+ \chklistingtrue%
+ \setbox\@tempboxa\hbox\bgroup%
+ \lst@BeginWriteFile{\CHKL@file\CHKL@ext}%
+ }
+ {%
+ \lst@EndWriteFile%
+ \egroup%
+ \ifCHKL@showcode%
+ \bgroup%
+ \ifx\CHKL@codelst\CHKL@emptyoption\else%
+ \expandafter\lstset\expandafter{\CHKL@codelst,fancyvrb=true}%
+ \fi%
+ \expandafter\fvset\expandafter{\CHKL@verbopts}%
+ \expandafter\VerbatimInput\expandafter[\CHKL@codestyle]{\CHKL@file\CHKL@ext}%
+ \egroup%
+ \fi%
+ \global\edef\CHKL@none{$\langle$Cannot load \CHKL@file.tex!$\rangle$}%
+ \InputIfFileExists{\CHKL@file.tex}{\CHKL@fileexiststrue}{\CHKL@fileexistsfalse}%
+ \ifCHKL@fileexists%
+ \@ifundefined{FV@SV@ChkListingMsg}%
+ {}{\global\let\FV@SV@CHKL@MSG@=\FV@SV@ChkListingMsg}%
+ \@ifundefined{FV@SV@ChkListingErr}%
+ {}{\global\let\FV@SV@CHKL@ERR@=\FV@SV@ChkListingErr}%
+ \ifCHKL@shouldfail%
+ \ifchklisting%
+ \PackageWarning{checklistings}%
+ {Compilation of \CHKL@file\CHKL@ext\space should have failed}%
+ \ifCHKL@showproblems%
+ \UseVerbatim[frame=single,
+ label=Unexpected success,
+ rulecolor=\color{red}]{ChkListingMsg}%
+ \fi%
+ \else%
+ \ifCHKL@withresult%
+ {\setlength{\partopsep}{0em}\chklistingerr{}}%
+ \fi%
+ \fi%
+ \else%
+ \ifchklisting%
+ \ifCHKL@withresult%
+ {%\vspace{\dimexpr-2\topsep-2\partopsep+.5em\relax}%
+ \setlength{\partopsep}{0em}\chklistingmsg{}}%
+ \fi%
+ \else%
+ \PackageWarning{checklistings}%
+ {Compilation of \CHKL@file\CHKL@ext\space should not have failed}%
+ \ifCHKL@showproblems%
+ \UseVerbatim[frame=single,
+ label=Unexpected failure,
+ rulecolor=\color{red}]{ChkListingErr}%
+ \fi%
+ \fi%
+ \fi%
+ \else%
+ \PackageWarning{checklistings}{Cannot load \CHKL@file.tex}%
+ \global\let\chklistingcmd\CHKL@none%
+ \global\let\FV@SV@CHKL@MSG@\@undefined%
+ \global\let\FV@SV@CHKL@ERR@\@undefined%
+ \fi%
+ \@ifundefined{CHKL@label}{}{%
+ \global\expandafter\let%
+ \csname FV@SV@CHKL@MSG@\CHKL@label\endcsname=\FV@SV@CHKL@MSG@%
+ \global\expandafter\let%
+ \csname FV@SV@CHKL@ERR@\CHKL@label\endcsname=\FV@SV@CHKL@ERR@%
+ }%
+ }%
+\makeatother
+\clearpage
+\endinput
+%%
+%% End of file `checklistings.sty'.