fpc/docs/styles/lstdoc.sty
peter 356a3d1609 * support for hevea
* provided local copies or required styles since debian does not
    supply the listings.sty anymore
2003-03-16 15:22:18 +00:00

269 lines
9.1 KiB
TeX

%%
%% This is file `lstdoc.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% listings.dtx (with options: `doc')
%%
%% Please read the software license in listings.dtx or listings.dvi.
%%
%% (w)(c) 1996/1997/1998/1999/2000 Carsten Heinz and/or any other author
%% listed elsewhere in this file.
%%
%% This file is distributed under the terms of the LaTeX Project Public
%% License from CTAN archives in directory macros/latex/base/lppl.txt.
%% Either version 1.0 or, at your option, any later version.
%%
%% The listings package is free software.
%%
%% However, if you distribute the package as part of a commercial
%% product or if you use the package to prepare a document and sell the
%% document (books, journals, and so on), I'd like to encourage you to
%% make a donation to the LaTeX3 fund. The size of this `license fee'
%% should depend on the value of the package for your product.
%%
%% If you use the package to typeset a non-commercial document, please
%% send me a copy of the document (.dvi, .ps, .pdf, hardcopy, etc.) to
%% support further development.
%%
%% Permission is granted to change this file. You are not allowed to
%% distribute any changed version of this file, neither under the same
%% name nor under a different one.
%%
%% Send comments and ideas on the package, error reports and additional
%% programming languages to <cheinz@gmx.de>.
%%
\lst@AddToAtTop{\try@load@fontshape}{\def\space{ }}
\def\lst@BeginRemark#1{%
\begin{quote}\topsep0pt\let\small\footnotesize\small#1:}
\def\lst@EndRemark{\end{quote}}
\newenvironment{TODO}
{\lst@BeginRemark{To do}}{\lst@EndRemark}
\newenvironment{ALTERNATIVE}
{\lst@BeginRemark{Alternative}}{\lst@EndRemark}
\newenvironment{REMOVED}
{\lst@BeginRemark{Removed}}{\lst@EndRemark}
\newenvironment{OLDDEF}
{\lst@BeginRemark{Old definition}}{\lst@EndRemark}
\long\def\m@cro@#1#2#3{\endgroup \topsep\MacroTopsep \trivlist
\edef\saved@macroname{\string#3}%
\def\makelabel##1{\llap{##1}}%
\if@inlabel
\let\@tempa\@empty \count@\macro@cnt
\loop \ifnum\count@>\z@
\edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne \repeat
\edef\makelabel##1{\llap{\vtop to\baselineskip
{\@tempa\hbox{##1}\vss}}}%
\advance \macro@cnt \@ne
\else \macro@cnt\@ne \fi
\edef\@tempa{\noexpand\item[%
#1%
\noexpand\PrintMacroName
\else
\expandafter\noexpand\csname Print#2Name\endcsname % MODIFIED
\fi
{\string#3}]}%
\@tempa
\global\advance\c@CodelineNo\@ne
#1%
\SpecialMainIndex{#3}\nobreak
\DoNotIndex{#3}%
\else
\csname SpecialMain#2Index\endcsname{#3}\nobreak % MODIFIED
\fi
\global\advance\c@CodelineNo\m@ne
\ignorespaces}
\def\macro{\begingroup
\catcode`\\12
\MakePrivateLetters \m@cro@ \iftrue {Macro}}% MODIFIED
\def\environment{\begingroup
\catcode`\\12
\MakePrivateLetters \m@cro@ \iffalse {Env}}% MODIFIED
\def\newdocenvironment#1#2#3#4{%
\@namedef{#1}{#3\begingroup \catcode`\\12\relax
\MakePrivateLetters \m@cro@ \iffalse {#2}}%
\@namedef{end#1}{#4\endmacro}%
\@ifundefined{Print#2Name}{\expandafter
\let\csname Print#2Name\endcsname\PrintMacroName}{}%
\@ifundefined{SpecialMain#2Index}{\expandafter
\let\csname SpecialMain#2Index\endcsname\SpecialMainIndex}{}}
\newdocenvironment{aspect}{Aspect}{}{}
\def\PrintAspectName#1{}
\def\SpecialMainAspectIndex#1{%
\@bsphack
\index{aspects:\levelchar\protect\aspectname{#1}\encapchar main}%
\@esphack}
\newdocenvironment{lstkey}{Key}{}{}
\def\PrintKeyName#1{\strut\keyname{#1}\ }
\def\SpecialMainKeyIndex#1{%
\@bsphack
\index{keys:\levelchar\protect\keyname{#1}\encapchar main}%
\@esphack}
\newcounter{argcount}
\def\labelargcount{\texttt{\#\arabic{argcount}}\hskip\labelsep$=$}
\def\macroargs{\list\labelargcount
{\usecounter{argcount}\leftmargin=2\leftmargin
\parsep \z@ \@plus\z@ \@minus\z@
\topsep4\p@ \@plus\p@ \@minus2\p@
\itemsep\z@ \@plus\z@ \@minus\z@
\def\makelabel##1{\hss\llap{##1}}}}
\def\endmacroargs{\endlist\@endparenv}
\lst@RequireAspects{writefile}
\newbox\lst@samplebox
\lstnewenvironment{lstsample}[2]
{\lst@TestEOLChar{#1}\global\let\lst@intname\@empty
\gdef\lst@sample{#1}%
\setbox\lst@samplebox=\hbox\bgroup
\setkeys{lst}{language={},style={},tabsize=4,gobble=5,%
basicstyle=\small\ttfamily,basewidth=0.51em}
#2%
\lst@BeginAlsoWriteFile{\jobname.tmp}}
{\lst@EndWriteFile\egroup
\ifdim \wd\lst@samplebox>.5\linewidth
\begin{center}%
\begin{minipage}{0.9\linewidth}%
\hbox to\linewidth{\box\lst@samplebox\hss}%
\end{minipage}%
\end{center}%
\lst@sampleInput
\else
\begin{center}%
\begin{minipage}{0.45\linewidth}\lst@sampleInput\end{minipage}%
\qquad
\begin{minipage}{0.45\linewidth}%
\hbox to\linewidth{\box\lst@samplebox\hss}%
\end{minipage}%
\end{center}%
\fi}
\def\lst@sampleInput{%
\MakePercentComment\catcode`\^^M=10\relax
\small\lst@sample
{\setkeys{lst}{SelectCharTable=\lst@ReplaceInput{\^\^I}%
{\lst@ProcessTabulator}}%
\leavevmode \input{\jobname.tmp}}\MakePercentIgnore}
\def\lstscanlanguages#1#2#3{%
\begingroup
\def\lst@DefDriver@##1##2##3##4[##5]##6{%
\lst@false
\lst@lAddTo\lst@scan{##6(##5),}%
\begingroup
\@ifnextchar[{\lst@XDefDriver{##1}##3}{\lst@DefDriver@@##3}}%
\def\lst@XXDefDriver[##1]{}%
\lst@InputCatcodes
\def\lst@dontinput{#3}%
\let\lst@scan\@empty
\lst@for{#2}\do{%
\lst@IfOneOf##1\relax\lst@dontinput
{}%
{\InputIfFileExists{##1}{}{}}}%
\global\let\@gtempa\lst@scan
\endgroup
\let#1\@gtempa}
\def\lstprintlanguages#1{%
\def\do##1{\setbox\@tempboxa\hbox{##1\space\space}%
\ifdim\wd\@tempboxa<.5\linewidth \wd\@tempboxa.5\linewidth
\else \wd\@tempboxa\linewidth \fi
\box\@tempboxa\allowbreak}%
\begin{quote}
\par\noindent
\hyphenpenalty=\@M \rightskip=\z@\@plus\linewidth\relax
\lst@BubbleSort#1%
\expandafter\lst@NextLanguage#1\relax(\relax),%
\end{quote}}
\def\lst@NextLanguage#1(#2),{%
\ifx\relax#1\else
\def\lst@language{#1}\def\lst@dialects{(#2),}%
\expandafter\lst@NextLanguage@
\fi}
\def\lst@NextLanguage@#1(#2),{%
\def\lst@temp{#1}%
\ifx\lst@temp\lst@language
\lst@lAddTo\lst@dialects{(#2),}%
\expandafter\lst@NextLanguage@
\else
\do{\lst@language
\ifx\lst@dialects\lst@emptydialect\else
\expandafter\lst@NormedDef\expandafter\lst@language
\expandafter{\lst@language}%
\space(%
\lst@BubbleSort\lst@dialects
\expandafter\lst@PrintDialects\lst@dialects(\relax),%
)%
\fi}%
\def\lst@next{\lst@NextLanguage#1(#2),}%
\expandafter\lst@next
\fi}
\def\lst@emptydialect{(),}
\def\lst@PrintDialects(#1),{%
\ifx\@empty#1\@empty empty\else
\lst@PrintDialect{#1}%
\fi
\lst@PrintDialects@}
\def\lst@PrintDialects@(#1),{%
\ifx\relax#1\else
,\lst@PrintDialect{#1}%
\expandafter\lst@PrintDialects@
\fi}
\def\lst@PrintDialect#1{%
\lst@NormedDef\lst@temp{#1}%
\expandafter\ifx\csname lstdd@\lst@language\endcsname\lst@temp
\texttt{\underbar{#1}}%
\else
\texttt{#1}%
\fi}
\def\lst@IfLE#1#2\@empty#3#4\@empty{%
\ifx #1\relax
\let\lst@next\@firstoftwo
\else \ifx #3\relax
\let\lst@next\@secondoftwo
\else
\lowercase{\ifx#1#3}%
\def\lst@next{\lst@IfLE#2\@empty#4\@empty}%
\else
\lowercase{\ifnum`#1<`#3}\relax
\let\lst@next\@firstoftwo
\else
\let\lst@next\@secondoftwo
\fi
\fi
\fi \fi
\lst@next}
\def\lst@BubbleSort#1{%
\ifx\@empty#1\else
\lst@false
\expandafter\lst@BubbleSort@#1\relax,\relax,%
\expandafter\lst@BubbleSort@\expandafter,\lst@sorted
\relax,\relax,%
\let#1\lst@sorted
\lst@if
\def\lst@next{\lst@BubbleSort#1}%
\expandafter\expandafter\expandafter\lst@next
\fi
\fi}
\def\lst@BubbleSort@#1,#2,{%
\ifx\@empty#1\@empty
\def\lst@sorted{#2,}%
\def\lst@next{\lst@BubbleSort@@}%
\else
\let\lst@sorted\@empty
\def\lst@next{\lst@BubbleSort@@#1,#2,}%
\fi
\lst@next}
\def\lst@BubbleSort@@#1,#2,{%
\ifx\relax#1\else
\ifx\relax#2%
\lst@lAddTo\lst@sorted{#1,}%
\expandafter\expandafter\expandafter\lst@BubbleSort@@@
\else
\lst@IfLE #1\relax\@empty #2\relax\@empty
{\lst@lAddTo\lst@sorted{#1,#2,}}%
{\lst@true \lst@lAddTo\lst@sorted{#2,#1,}}%
\expandafter\expandafter\expandafter\lst@BubbleSort@@
\fi
\fi}
\def\lst@BubbleSort@@@#1\relax,{}
\endinput
%%
%% End of file `lstdoc.sty'.