From c061b43fe2aac482c627403d9f263760c21aec1a Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 18 Mar 2003 00:07:22 +0000 Subject: [PATCH] + latest version of listings. package (1.0) --- docs/styles/listings.cfg | 17 +- docs/styles/listings.sty | 1490 ++++++++++++++++++++++--------------- docs/styles/lstdoc.sty | 244 ++++++- docs/styles/lstlang1.sty | 375 ++++++++-- docs/styles/lstlang2.sty | 691 +++++++++++++++++- docs/styles/lstlang3.sty | 155 ++-- docs/styles/lstmisc.sty | 1499 +++++++++++++++++++------------------- docs/styles/lstpatch.sty | 843 +++++++++++---------- 8 files changed, 3425 insertions(+), 1889 deletions(-) diff --git a/docs/styles/listings.cfg b/docs/styles/listings.cfg index 73d9855bac..c416dd9035 100644 --- a/docs/styles/listings.cfg +++ b/docs/styles/listings.cfg @@ -6,8 +6,8 @@ %% %% lstdrvrs.dtx (with options: `config') %% -%% (w)(c) 1996/1997/1998/1999/2000 Carsten Heinz and/or any other author -%% listed elsewhere in this file. +%% (w)(c) 1996/1997/1998/1999/2000/2001/2002 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. @@ -15,29 +15,26 @@ %% %% This file is completely free and comes without any warranty. %% -%% 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 . %% +\ProvidesFile{listings.cfg}[2002/04/01 v1.0 listings configuration] \def\lstlanguagefiles {lstlang0.sty,lstlang1.sty,lstlang2.sty,lstlang3.sty} -\lstset{defaultdialect=[R/3 4.6C]ABAP, +\lstset{defaultdialect=[R/3 6.10]ABAP, defaultdialect=[95]Ada, defaultdialect=[68]Algol, - defaultdialect=[Visual]Basic, defaultdialect=[ANSI]C, defaultdialect=[light]Caml, defaultdialect=[1985]Cobol, - defaultdialect=[ANSI]C++, + defaultdialect=[ISO]C++, defaultdialect=[95]Fortran, defaultdialect=[3.0]Mathematica, defaultdialect=[OMG]OCL, defaultdialect=[Standard]Pascal, defaultdialect=[67]Simula, - defaultdialect=[plain]TeX} + defaultdialect=[plain]TeX, + defaultdialect=[97]VRML} \lstalias[]{TclTk}[tk]{tcl} \endinput %% diff --git a/docs/styles/listings.sty b/docs/styles/listings.sty index 0f6e6ed29e..fe13bedc36 100644 --- a/docs/styles/listings.sty +++ b/docs/styles/listings.sty @@ -8,35 +8,47 @@ %% %% 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 +%% (w)(c) 1996 -- 2002 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. %% +%% Permission is granted to modify the listings package as well as +%% lstdrvrs.dtx. You are not allowed to distribute a modified version +%% of the package or lstdrvrs.dtx unless you change the file names and +%% provide the original files. In any case it is better to contact the +%% address below; other users will welcome removed bugs, new features, +%% and additional programming languages. +%% %% 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. +%% product or if you use the package to prepare a commercial 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. For more +%% information about LaTeX see http://www.latex-project.org %% -%% 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. +%% No matter whether you use the package for a commercial or +%% non-commercial document, please send me a copy of the document (.dvi, +%% .ps, .pdf, hardcopy, etc.) to support further development---it is +%% easier to introduce new features or simplify things if I see how the +%% package is used by other people. %% %% Send comments and ideas on the package, error reports and additional %% programming languages to . %% +\def\filedate{2002/04/01} +\def\fileversion{1.0} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{listings}[2000/08/23 v0.21 (Carsten Heinz)] -\def\lst@version{0.21} +\ProvidesPackage{listings} + [\filedate\space\fileversion\space(Carsten Heinz)] +\def\lst@CheckVersion#1{\edef\reserved@a{#1}% + \ifx\lst@version\reserved@a \expandafter\@gobble + \else \expandafter\@firstofone \fi} +\let\lst@version\fileversion \def\lst@InputCatcodes{% \makeatletter \catcode`\"12% \catcode`\^^@\active @@ -51,6 +63,7 @@ \expandafter\lst@RestoreCatcodes \fi} \edef\lst@RestoreCatcodes{% + \noexpand\lccode`\noexpand\/`\noexpand\/% \lst@RestoreCatcodes\"\^^I\^^M\~\^^@\relax} \lst@InputCatcodes \AtEndOfPackage{\lst@RestoreCatcodes} @@ -99,6 +112,7 @@ \expandafter\lst@ReplaceIn@\expandafter#1% \fi} \providecommand*\@gobblethree[3]{} +\def\lst@GobbleNil#1\@nil{} \def\lst@Swap#1#2{#2#1} \def\lst@true{\let\lst@if\iftrue} \def\lst@false{\let\lst@if\iffalse} @@ -175,7 +189,7 @@ \def\lst@DefOther#1#2{% \begingroup \def#1{#2}\escapechar\m@ne \expandafter\endgroup \expandafter\lst@DefOther@\meaning#1\relax#1} -\def\lst@DefOther@#1->#2\relax#3{\edef#3{\zap@space#2 \@empty}} +\def\lst@DefOther@#1>#2\relax#3{\edef#3{\zap@space#2 \@empty}} \def\lst@InsideConvert#1{\lst@InsideConvert@#1 \@empty} \begingroup \lccode`\~=`\ \relax \lowercase{% \gdef\lst@InsideConvert@#1 #2{% @@ -187,33 +201,31 @@ \expandafter\lst@InsideConvert@ \fi #2} }\endgroup -\gdef\lst@FVConvert{\futurelet\@let@token\lst@FVConvert@@} -\gdef\lst@FVConvert@@{% - \ifcat\noexpand\@let@token\bgroup \expandafter\lst@FVConvertArg - \else \expandafter\lst@FVConvert@ \fi} -\gdef\lst@FVConvertArg#1{% - {\let\lst@arg\@empty - \lst@FVConvert#1\@nil +\def\lst@XConvert{\@ifnextchar\bgroup \lst@XConvertArg\lst@XConvert@} +\def\lst@XConvertArg#1{% + {\lst@false \let\lst@arg\@empty + \lst@XConvert#1\@nil \global\let\@gtempa\lst@arg}% - \lst@if - \lst@lExtend\lst@arg{\expandafter{\@gtempa\lst@PrintToken}}% - \else - \lst@lExtend\lst@arg{\expandafter{\@gtempa}}% - \fi - \lst@FVConvert} -\gdef\lst@FVConvert@#1{% - \ifx \@nil#1\else - \lst@if - \if\relax\noexpand#1% - \lst@lAddTo\lst@arg{\lst@UseLostSpace\lst@PrintToken#1}% - \else - \lccode`\~=`#1\lowercase{\lst@lAddTo\lst@arg~}% - \fi - \else - \lccode`\~=`#1\lowercase{\lst@lAddTo\lst@arg~}% - \fi - \expandafter\lst@FVConvert + \lst@lExtend\lst@arg{\expandafter{\@gtempa}}% + \lst@XConvertNext} +\def\lst@XConvert@#1{% + \ifx\@nil#1\else + \begingroup\lccode`\~=`#1\lowercase{\endgroup + \lst@lAddTo\lst@arg~}% + \expandafter\lst@XConvertNext \fi} +\def\lst@XConvertNext{% + \lst@if \expandafter\lst@XConvertX + \else \expandafter\lst@XConvert \fi} +\def\lst@XConvertX#1{% + \ifx\@nil#1\else + \lst@XConvertX@#1\relax + \expandafter\lst@XConvert + \fi} +\def\lst@XConvertX@#1#2\relax{% + \begingroup\lccode`\~=`#1\lowercase{\endgroup + \lst@XCConvertX@@~}{#2}} +\def\lst@XCConvertX@@#1#2{\lst@lAddTo\lst@arg{{#1#2}}} \def\lst@Require#1#2#3#4#5{% \begingroup \aftergroup\lst@true @@ -265,9 +277,8 @@ {\PackageError{Listings}% {#1 \ifx\@empty\lst@oalias\else \lst@oalias\space of \fi \lst@malias\space undefined}% - {The #1 is not loadable or just mispellt.^^J% - Type to proceed without changing the #1.}}% - {#6\csname lst#2@\lst@malias $\lst@oalias\endcsname #7}} + {The #1 is not loadable. \@ehc}}% + {#6\csname\@lst#2@\lst@malias $\lst@oalias\endcsname #7}} \def\lst@RequireAspects#1{% \lst@Require{aspect}{asp}{#1}\lst@NoAlias\lstaspectfiles} \let\lstloadaspects\lst@RequireAspects @@ -372,6 +383,15 @@ \def\lstKV@SetIf@#1#2\relax#3{\lowercase{% \expandafter\let\expandafter#3% \csname if\ifx #1t}true\else false\fi\endcsname} +\def\lstKV@SwitchCases#1#2#3{% + \def\lst@temp##1\\#1&##2\\##3##4\@nil{% + \ifx\@empty##3% + #3% + \else + ##2% + \fi + }% + \lst@temp\\#2\\#1&\\\@empty\@nil} \lst@UserCommand\lstset{\begingroup \lst@setcatcodes \lstset@} \def\lstset@#1{\endgroup \ifx\@empty#1\@empty\else\setkeys{lst}{#1}\fi} \def\lst@setcatcodes{\makeatletter \catcode`\"=12\relax} @@ -390,12 +410,9 @@ \edef\lst@dynamicmode{\the\@tempcnta}% \expandafter\lst@Swap\expandafter{\expandafter{\lst@dynamicmode}}} \lst@AddToHook{InitVars}{\let\lst@dynamicmode\lst@newmode} -\def\lst@modetrue{\let\lst@ifmode\iftrue \lsthk@ModeTrue} -\let\lst@ifmode\iffalse % init -\lst@AddToHook{ModeTrue}{}% init \def\lst@EnterMode#1#2{% \bgroup \lst@mode=#1\relax #2% - \lst@iffontadjust \lsthk@FontAdjust \fi + \lst@FontAdjust \lst@lAddTo\lst@entermodes{\lst@EnterMode{#1}{#2}}} \lst@AddToHook{InitVars}{\let\lst@entermodes\@empty} \def\lst@LeaveMode{% @@ -432,6 +449,12 @@ \lst@AddToHook{ExitVars}{\lst@LeaveAllModes} \lst@NewMode\lst@Pmode \lst@NewMode\lst@GPmode +\def\lst@modetrue{\let\lst@ifmode\iftrue \lsthk@ModeTrue} +\let\lst@ifmode\iffalse % init +\lst@AddToHook{ModeTrue}{}% init +\def\lst@Lmodetrue{\let\lst@ifLmode\iftrue} +\let\lst@ifLmode\iffalse % init +\lst@AddToHook{EOL}{\@whilesw \lst@ifLmode\fi \lst@LeaveMode} \def\lst@NormedDef#1#2{\lowercase{\edef#1{\zap@space#2 \@empty}}} \def\lst@NormedNameDef#1#2{% \lowercase{\edef\lst@temp{\zap@space#1 \@empty}% @@ -446,52 +469,305 @@ \advance\@tempcnta\@ne \expandafter\lst@GFM@ \fi} -\lst@AddToAtTop{\try@load@fontshape}{\def\space{ }} +\newbox\lst@gtempboxa \newtoks\lst@token \newcount\lst@length -\lst@AddToHook{InitVarsBOL}{\lst@token{}\lst@length\z@} -\lst@AddToHook{EndGroup}{\lst@token{}\lst@length\z@} -\lst@AddToHook{InitVarsBOL}{\let\lst@lastother\@empty} -\def\lst@Append#1{\advance\lst@length\@ne - \expandafter\lst@token\expandafter{\the\lst@token#1}} -\def\lst@AppendOther{\futurelet\lst@lastother\lst@Append} +\def\lst@ResetToken{\lst@token{}\lst@length\z@} +\lst@AddToHook{InitVarsBOL}{\lst@ResetToken \let\lst@lastother\@empty} +\lst@AddToHook{EndGroup}{\lst@ResetToken \let\lst@lastother\@empty} \def\lst@lettertrue{\let\lst@ifletter\iftrue} \def\lst@letterfalse{\let\lst@ifletter\iffalse} \lst@AddToHook{InitVars}{\lst@letterfalse} -\def\lst@PrintToken{% - \lst@ifletter - \lst@Output\lst@letterfalse - \else - \lst@OutputOther \let\lst@lastother\@empty +\def\lst@Append#1{\advance\lst@length\@ne + \lst@token=\expandafter{\the\lst@token#1}} +\def\lst@AppendOther{% + \lst@ifletter \lst@Output\lst@letterfalse \fi + \futurelet\lst@lastother\lst@Append} +\def\lst@AppendLetter{% + \lst@ifletter\else \lst@OutputOther\lst@lettertrue \fi + \lst@Append} +\def\lst@SaveToken{% + \global\let\lst@gthestyle\lst@thestyle + \xdef\lst@RestoreToken{\noexpand\lst@token{\the\lst@token}% + \noexpand\lst@length\the\lst@length\relax + \noexpand\let\noexpand\lst@thestyle + \noexpand\lst@gthestyle}} +\newdimen\lst@currlwidth % \global +\newcount\lst@column \newcount\lst@pos % \global +\lst@AddToHook{InitVarsBOL} + {\global\lst@currlwidth\z@ \global\lst@pos\z@ \global\lst@column\z@} +\def\lst@CalcColumn{% + \@tempcnta\lst@column + \advance\@tempcnta\lst@length + \advance\@tempcnta-\lst@pos} +\newdimen\lst@lostspace % \global +\lst@AddToHook{InitVarsBOL}{\global\lst@lostspace\z@} +\def\lst@UseLostSpace{\ifdim\lst@lostspace>\z@ \lst@InsertLostSpace \fi} +\def\lst@InsertLostSpace{% + \lst@Kern\lst@lostspace \global\lst@lostspace\z@} +\def\lst@InsertHalfLostSpace{% + \global\lst@lostspace.5\lst@lostspace \lst@Kern\lst@lostspace} +\newdimen\lst@width +\lst@Key{basewidth}{0.6em,0.45em}{\lstKV@CSTwoArg{#1}% + {\def\lst@widthfixed{##1}\def\lst@widthflexible{##2}% + \ifx\lst@widthflexible\@empty + \let\lst@widthflexible\lst@widthfixed + \fi + \def\lst@temp{\PackageError{Listings}% + {Negative value(s) treated as zero}% + \@ehc}% + \let\lst@error\@empty + \ifdim \lst@widthfixed<\z@ + \let\lst@error\lst@temp \let\lst@widthfixed\z@ + \fi + \ifdim \lst@widthflexible<\z@ + \let\lst@error\lst@temp \let\lst@widthflexible\z@ + \fi + \lst@error}} +\lst@AddToHook{FontAdjust} + {\lst@width=\lst@ifflexible\lst@widthflexible + \else\lst@widthfixed\fi \relax} +\lst@Key{fontadjust}{false}[t]{\lstKV@SetIf{#1}\lst@iffontadjust} +\def\lst@FontAdjust{\lst@iffontadjust \lsthk@FontAdjust \fi} +\lst@AddToHook{InitVars}{\lsthk@FontAdjust} +\def\lst@OutputBox#1{\lst@alloverstyle{\box#1}} +\def\lst@alloverstyle#1{#1}% init +\def\lst@Kern#1{% + \setbox\z@\hbox{{\lst@currstyle{\kern#1}}}% + \global\advance\lst@currlwidth \wd\z@ + \lst@OutputBox\z@} +\def\lst@CalcLostSpaceAndOutput{% + \global\advance\lst@lostspace \lst@length\lst@width + \global\advance\lst@lostspace-\wd\@tempboxa + \global\advance\lst@currlwidth \wd\@tempboxa + \global\advance\lst@pos -\lst@length + \setbox\@tempboxa\hbox{\let\lst@OutputBox\box + \ifdim\lst@lostspace>\z@ \lst@leftinsert \fi + \box\@tempboxa + \ifdim\lst@lostspace>\z@ \lst@rightinsert \fi}% + \lst@OutputBox\@tempboxa \lsthk@PostOutput} +\lst@AddToHook{PostOutput}{}% init +\def\lst@OutputToken{% + \lst@TrackNewLines \lst@OutputLostSpace + \lst@CheckMerge + {\lst@thestyle{\lst@FontAdjust + \setbox\@tempboxa\lst@hbox + {\lsthk@OutputBox + \lst@lefthss + \expandafter\lst@FillOutputBox\the\lst@token\@empty + \lst@righthss}% + \lst@CalcLostSpaceAndOutput}}% + \lst@ResetToken} +\lst@AddToHook{OutputBox}{}% init +\def\lst@Delay#1{% + \lst@CheckDelay + #1% + \lst@GetOutputMacro\lst@delayedoutput + \edef\lst@delayed{\the\lst@token}% + \edef\lst@delayedlength{\the\lst@length}% + \lst@ResetToken} +\def\lst@Merge#1{% + \lst@CheckMerge + #1% + \edef\lst@merged{\the\lst@token}% + \edef\lst@mergedlength{\the\lst@length}% + \lst@ResetToken} +\def\lst@MergeToken#1#2{% + \advance\lst@length#2% + \lst@lExtend#1{\the\lst@token}% + \expandafter\lst@token\expandafter{#1}% + \let#1\@empty} +\def\lst@CheckDelay{% + \ifx\lst@delayed\@empty\else + \lst@GetOutputMacro\@gtempa + \ifx\lst@delayedoutput\@gtempa + \lst@MergeToken\lst@delayed\lst@delayedlength + \else + {\lst@ResetToken + \lst@MergeToken\lst@delayed\lst@delayedlength + \lst@delayedoutput}% + \let\lst@delayed\@empty + \fi \fi} +\def\lst@CheckMerge{% + \ifx\lst@merged\@empty\else + \lst@MergeToken\lst@merged\lst@mergedlength + \fi} +\let\lst@delayed\@empty % init +\let\lst@merged\@empty % init +\def\lst@column@fixed{% + \lst@flexiblefalse + \lst@width\lst@widthfixed\relax + \let\lst@OutputLostSpace\lst@UseLostSpace + \let\lst@FillOutputBox\lst@FillFixed + \let\lst@hss\hss + \def\lst@hbox{\hbox to\lst@length\lst@width}} +\def\lst@FillFixed#1{#1\lst@FillFixed@} +\def\lst@FillFixed@#1{% + \ifx\@empty#1\else \lst@hss#1\expandafter\lst@FillFixed@ \fi} +\def\lst@column@flexible{% + \lst@flexibletrue + \lst@width\lst@widthflexible\relax + \let\lst@OutputLostSpace\lst@UseLostSpace + \let\lst@FillOutputBox\@empty + \let\lst@hss\@empty + \let\lst@hbox\hbox} +\def\lst@column@fullflexible{% + \lst@column@flexible + \def\lst@OutputLostSpace{\lst@ifnewline \lst@UseLostSpace\fi}% + \let\lst@leftinsert\@empty + \let\lst@rightinsert\@empty} +\def\lst@outputpos#1#2\relax{% + \def\lst@lefthss{\lst@hss}\let\lst@righthss\lst@lefthss + \let\lst@rightinsert\lst@InsertLostSpace + \ifx #1c% + \let\lst@leftinsert\lst@InsertHalfLostSpace + \else\ifx #1r% + \let\lst@righthss\@empty + \let\lst@leftinsert\lst@InsertLostSpace + \let\lst@rightinsert\@empty + \else + \let\lst@lefthss\@empty + \let\lst@leftinsert\@empty + \ifx #1l\else \PackageWarning{Listings}% + {Unknown positioning for output boxes}% + \fi + \fi\fi} +\def\lst@flexibletrue{\let\lst@ifflexible\iftrue} +\def\lst@flexiblefalse{\let\lst@ifflexible\iffalse} +\lst@Key{columns}{[c]fixed}{\lstKV@OptArg[]{#1}{% + \ifx\@empty##1\@empty\else \lst@outputpos##1\relax\relax \fi + \expandafter\let\expandafter\lst@arg + \csname\@lst @column@##2\endcsname + \lst@arg + \ifx\lst@arg\relax + \PackageWarning{Listings}{Unknown column format `##2'}% + \else + \lst@ifflexible + \let\lst@columnsflexible\lst@arg + \else + \let\lst@columnsfixed\lst@arg + \fi + \fi}} +\let\lst@columnsfixed\lst@column@fixed % init +\let\lst@columnsflexible\lst@column@flexible % init +\lst@Key{flexiblecolumns}\relax[t]{% + \lstKV@SetIf{#1}\lst@ifflexible + \lst@ifflexible \lst@columnsflexible + \else \lst@columnsfixed \fi} +\newcount\lst@newlines +\lst@AddToHook{InitVars}{\global\lst@newlines\z@} +\lst@AddToHook{InitVarsBOL}{\global\advance\lst@newlines\@ne} +\def\lst@NewLine{% + \ifx\lst@OutputBox\@gobble\else + \par\noindent \hbox{}% + \fi + \global\advance\lst@newlines\m@ne + \lst@newlinetrue} +\def\lst@newlinetrue{\global\let\lst@ifnewline\iftrue} +\lst@AddToHookExe{PostOutput}{\global\let\lst@ifnewline\iffalse}% init +\def\lst@TrackNewLines{% + \ifnum\lst@newlines>\z@ + \lsthk@OnNewLine + \lst@DoNewLines + \fi} +\lst@AddToHook{OnNewLine}{}% init +\lst@Key{emptylines}\maxdimen{% + \@ifstar{\lst@true\@tempcnta\@gobble#1\relax\lst@GobbleNil}% + {\lst@false\@tempcnta#1\relax\lst@GobbleNil}#1\@nil + \advance\@tempcnta\@ne + \edef\lst@maxempty{\the\@tempcnta\relax}% + \let\lst@ifpreservenumber\lst@if} +\def\lst@DoNewLines{ + \@whilenum\lst@newlines>\lst@maxempty \do + {\lst@ifpreservenumber + \lsthk@OnEmptyLine + \global\advance\c@lstnumber\lst@advancelstnum + \fi + \global\advance\lst@newlines\m@ne}% + \@whilenum \lst@newlines>\@ne \do + {\lsthk@OnEmptyLine \lst@NewLine}% + \ifnum\lst@newlines>\z@ \lst@NewLine \fi} +\lst@AddToHook{OnEmptyLine}{}% init +\lst@Key{identifierstyle}{}{\def\lst@identifierstyle{#1}} +\lst@AddToHook{EmptyStyle}{\let\lst@identifierstyle\@empty} +\def\lst@GotoTabStop{% + \ifnum\lst@newlines=\z@ + \setbox\@tempboxa\hbox{\lst@outputspace}% + \setbox\@tempboxa\hbox to\wd\@tempboxa{{\lst@currstyle{\hss}}}% + \lst@CalcLostSpaceAndOutput + \else + \global\advance\lst@lostspace \lst@length\lst@width + \global\advance\lst@column\lst@length \lst@length\z@ + \fi} +\def\lst@OutputOther{% + \lst@CheckDelay + \ifnum\lst@length=\z@\else + \let\lst@thestyle\lst@currstyle + \lsthk@OutputOther + \lst@OutputToken + \fi} +\lst@AddToHook{OutputOther}{}% init +\let\lst@currstyle\relax % init +\def\lst@Output{% + \lst@CheckDelay + \ifnum\lst@length=\z@\else + \ifx\lst@currstyle\relax + \let\lst@thestyle\lst@identifierstyle + \else + \let\lst@thestyle\lst@currstyle + \fi + \lsthk@Output + \lst@OutputToken + \fi + \let\lst@lastother\relax} +\lst@AddToHook{Output}{}% init +\def\lst@GetOutputMacro#1{% + \lst@ifletter \global\let#1\lst@Output + \else \global\let#1\lst@OutputOther\fi} +\def\lst@PrintToken{% + \lst@ifletter \lst@Output \lst@letterfalse + \else \lst@OutputOther \let\lst@lastother\@empty \fi} +\def\lst@XPrintToken{% + \lst@PrintToken \lst@CheckMerge + \ifnum\lst@length=\z@\else \lst@PrintToken \fi} +\def\lst@BeginDropOutput#1{% + \xdef\lst@BDOnewlines{\the\lst@newlines}% + \global\let\lst@BDOifnewline\lst@ifnewline + \lst@EnterMode{#1}% + {\lst@modetrue + \let\lst@OutputBox\@gobble + \aftergroup\lst@BDORestore}} +\def\lst@BDORestore{% + \global\lst@newlines\lst@BDOnewlines + \global\let\lst@ifnewline\lst@BDOifnewline} +\let\lst@EndDropOutput\lst@LeaveMode +\def\lst@ProcessLetter{\lst@whitespacefalse \lst@AppendLetter} +\def\lst@ProcessOther{\lst@whitespacefalse \lst@AppendOther} +\def\lst@ProcessDigit{% + \lst@whitespacefalse + \lst@ifletter \expandafter\lst@AppendLetter + \else \expandafter\lst@AppendOther\fi} \def\lst@whitespacetrue{\global\let\lst@ifwhitespace\iftrue} \def\lst@whitespacefalse{\global\let\lst@ifwhitespace\iffalse} \lst@AddToHook{InitVarsBOL}{\lst@whitespacetrue} -\def\lst@ProcessLetter{% - \lst@ifletter\else \lst@OutputOther\lst@lettertrue \fi - \lst@whitespacefalse \lst@Append} -\def\lst@ProcessOther{% - \lst@ifletter \lst@Output\lst@letterfalse \fi - \lst@whitespacefalse \lst@AppendOther} -\def\lst@ProcessDigit{% - \lst@whitespacefalse - \lst@ifletter \expandafter\lst@Append - \else \expandafter\lst@AppendOther\fi} \lst@Key{tabsize}{8} {\ifnum#1>\z@ \def\lst@tabsize{#1}\else \PackageError{Listings}{Strict positive integer expected}% - {You can't use `#1' as tabulator size.^^J% - Type to forget it and to proceed.}% + {You can't use `#1' as tabsize. \@ehc}% \fi} +\lst@Key{showtabs}f[t]{\lstKV@SetIf{#1}\lst@ifshowtabs} +\lst@Key{tab}{\kern.06em\hbox{\vrule\@height.3ex}% + \hrulefill\hbox{\vrule\@height.3ex}} + {\def\lst@tab{#1}} \def\lst@ProcessTabulator{% - \lst@PrintToken \lst@letterfalse + \lst@XPrintToken \lst@whitespacetrue \global\advance\lst@column -\lst@pos \@whilenum \lst@pos<\@ne \do {\global\advance\lst@pos\lst@tabsize}% \lst@length\lst@pos - \lst@whitespacetrue \lst@PreGotoTabStop} \def\lst@PreGotoTabStop{% - \lst@ifvisibletabs + \lst@ifshowtabs \lst@TrackNewLines \setbox\@tempboxa\hbox to\lst@length\lst@width {{\lst@currstyle{\hss\lst@tab}}}% @@ -508,27 +784,20 @@ \fi \fi \lst@length\z@ \global\lst@pos\z@} -\lst@Key{visibletabs}f[t]{\lstKV@SetIf{#1}\lst@ifvisibletabs} -\lst@Key{tab}{\kern.06em\hbox{\vrule\@height.3ex}% - \hrulefill\hbox{\vrule\@height.3ex}} - {\def\lst@tab{#1}} \def\lst@outputspace{\ } \def\lst@visiblespace{\lst@ttfamily{\char32}\textvisiblespace} -\lst@Key{visiblespaces}{false}[t]{\lstKV@SetIf{#1}\lst@ifvisiblespaces} +\lst@Key{showspaces}{false}[t]{\lstKV@SetIf{#1}\lst@ifshowspaces} \lst@Key{keepspaces}{false}[t]{\lstKV@SetIf{#1}\lst@ifkeepspaces} \lst@AddToHook{Init} - {\lst@ifvisiblespaces + {\lst@ifshowspaces \let\lst@outputspace\lst@visiblespace \lst@keepspacestrue \fi} \def\lst@keepspacestrue{\let\lst@ifkeepspaces\iftrue} \def\lst@ProcessSpace{% - \lst@ifletter - \lst@Output\lst@letterfalse + \lst@ifkeepspaces \lst@AppendOther\lst@outputspace - \else \lst@ifkeepspaces - \lst@AppendOther\lst@outputspace - \else \ifx\lst@newlines\@empty + \else \ifnum\lst@newlines=\z@ \lst@AppendSpecialSpace \else \ifnum\lst@length=\z@ \global\advance\lst@lostspace\lst@width @@ -536,11 +805,11 @@ \else \lst@AppendSpecialSpace \fi - \fi \fi \fi + \fi \fi \lst@whitespacetrue} \def\lst@AppendSpecialSpace{% \lst@ifwhitespace - \lst@OutputOther + \lst@PrintToken \global\advance\lst@lostspace\lst@width \global\advance\lst@pos\m@ne \else @@ -548,41 +817,35 @@ \fi} \lst@Key{formfeed}{\bigbreak}{\def\lst@formfeed{#1}} \def\lst@ProcessFormFeed{% - \lst@PrintToken - \ifx\lst@newlines\@empty - \lst@EOLUpdate \lst@formfeed - \else - \lst@lAddTo\lst@newlines{\lst@EOLUpdate \lst@formfeed}% + \lst@XPrintToken + \ifnum\lst@newlines=\z@ + \lst@EOLUpdate \lsthk@InitVarsBOL \fi + \lst@formfeed \lst@whitespacetrue} \def\lst@Def#1{\lccode`\~=#1\lowercase{\def~}} \def\lst@Let#1{\lccode`\~=#1\lowercase{\let~}} -\def\lst@SaveDef#1#2{% - \begingroup \lccode`\~=#1\relax \lowercase{\endgroup\let#2~}} -\def\lst@DefSaveDef#1#2{% - \begingroup \lccode`\~=#1\relax \lowercase{\endgroup\let#2~\def~}} -\def\lst@LetSaveDef#1#2{% - \begingroup \lccode`\~=#1\relax \lowercase{\endgroup\let#2~\let~}} +\lst@AddToAtTop{\try@load@fontshape}{\def\space{ }} \def\lst@SelectStdCharTable{% - \lst@Let{9}\lst@ProcessTabulator - \lst@Let{12}\lst@ProcessFormFeed - \lst@Let{32}\lst@ProcessSpace} -\def\lst@CCUse#1#2{% + \lst@Def{9}{\lst@ProcessTabulator}% + \lst@Def{12}{\lst@ProcessFormFeed}% + \lst@Def{32}{\lst@ProcessSpace}} +\def\lst@CCPut#1#2{% \ifnum#2=\z@ \expandafter\@gobbletwo \else - \lccode`\~=#2\lccode`\/=#2\lowercase{\lst@CCUse@~{#1/}}% + \lccode`\~=#2\lccode`\/=#2\lowercase{\lst@CCPut@~{#1/}}% \fi - \lst@CCUse#1} -\def\lst@CCUse@#1#2{\lst@lAddTo\lst@SelectStdCharTable{\def#1{#2}}} -\lst@CCUse \lst@ProcessOther + \lst@CCPut#1} +\def\lst@CCPut@#1#2{\lst@lAddTo\lst@SelectStdCharTable{\def#1{#2}}} +\lst@CCPut \lst@ProcessOther {"21}{"22}{"27}{"28}{"29}{"2B}{"2C}{"2E}{"2F} {"3A}{"3B}{"3D}{"3F}{"5B}{"5D}{"60} \z@ -\lst@CCUse \lst@ProcessDigit +\lst@CCPut \lst@ProcessDigit {"30}{"31}{"32}{"33}{"34}{"35}{"36}{"37}{"38}{"39} \z@ -\lst@CCUse \lst@ProcessLetter +\lst@CCPut \lst@ProcessLetter {"40}{"41}{"42}{"43}{"44}{"45}{"46}{"47} {"48}{"49}{"4A}{"4B}{"4C}{"4D}{"4E}{"4F} {"50}{"51}{"52}{"53}{"54}{"55}{"56}{"57} @@ -592,20 +855,20 @@ {"70}{"71}{"72}{"73}{"74}{"75}{"76}{"77} {"78}{"79}{"7A} \z@ -\def\lst@CCUseMacro#1#2#3{% +\def\lst@CCPutMacro#1#2#3{% \ifnum#2=\z@ \else \begingroup\lccode`\~=#2\relax \lccode`\/=#2\relax - \lowercase{\endgroup\expandafter\lst@CCUseMacro@ - \csname lstum@/\expandafter\endcsname - \csname lstum@/@\endcsname /~}#1{#3}% - \expandafter\lst@CCUseMacro + \lowercase{\endgroup\expandafter\lst@CCPutMacro@ + \csname\@lst @um/\expandafter\endcsname + \csname\@lst @um/@\endcsname /~}#1{#3}% + \expandafter\lst@CCPutMacro \fi} -\def\lst@CCUseMacro@#1#2#3#4#5#6{% +\def\lst@CCPutMacro@#1#2#3#4#5#6{% \lst@lAddTo\lst@SelectStdCharTable{\def#4{#5#1}}% \def#1{\lst@UM#3}% \def#2{#6}} -\def\lst@UM#1{\csname lstum@#1@\endcsname} -\lst@CCUseMacro +\def\lst@UM#1{\csname\@lst @um#1@\endcsname} +\lst@CCPutMacro \lst@ProcessOther {"23}\# \lst@ProcessLetter{"24}\textdollar \lst@ProcessOther {"25}\% @@ -625,25 +888,19 @@ \@empty\z@\@empty \def\lst@ttfamily#1#2{\ifx\f@family\ttdefault#1\relax\else#2\fi} \lst@AddToHook{Init}{\edef\ttdefault{\ttdefault}} -\def\lst@SaveOutputDef#1#2{% - \begingroup \lccode`\~=#1\relax \lowercase{% - \def\lst@temp##1\def~##2##3\relax}{% - \global\expandafter\let\expandafter#2\@gobble##2\relax}% - \expandafter\lst@temp\lst@SelectStdCharTable\relax - \endgroup} -\lst@SaveOutputDef{"5C}\lstum@backslash \def\lst@activecharstrue{\let\lst@ifactivechars\iftrue} \def\lst@activecharsfalse{\let\lst@ifactivechars\iffalse} \lst@activecharstrue \def\lst@SelectCharTable{% \lst@SelectStdCharTable - \lst@ifec \lst@DefEC \fi \lst@ifactivechars \catcode9\active \catcode12\active \catcode13\active \@tempcnta=32\relax \@whilenum\@tempcnta<128\do {\catcode\@tempcnta\active\advance\@tempcnta\@ne}% \fi + \lst@ifec \lst@DefEC \fi + \let\do@noligs\lst@do@noligs \verbatim@nolig@list \lsthk@SelectCharTable \lst@DeveloperSCT \ifx\lst@Backslash\relax\else @@ -652,55 +909,22 @@ \lst@Key{SelectCharTable}{}{\def\lst@DeveloperSCT{#1}} \lst@Key{MoreSelectCharTable}\relax{\lst@lAddTo\lst@DeveloperSCT{#1}} \lst@AddToHook{SetLanguage}{\let\lst@DeveloperSCT\@empty} -\lst@AddToHook{Init} - {\let\lsts@nfss@catcodes\nfss@catcodes - \let\nfss@catcodes\lst@nfss@catcodes} -\def\lst@nfss@catcodes{% - \lst@makeletter - ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\relax - \@makeother 0\@makeother 1\@makeother 2\@makeother 3\@makeother 4% - \@makeother 5\@makeother 6\@makeother 7\@makeother 8\@makeother 9% - \lsts@nfss@catcodes} -\def\lst@makeletter#1{% - \ifx\relax#1\else\catcode`#111\relax \expandafter\lst@makeletter\fi} -\lst@AddToHook{Init} - {\edef\lst@OldOutput{\the\output}% - \output{\begingroup \lsts@nfss@catcodes - \let\lst@ProcessLetter\@empty - \let\lst@ProcessOther\@empty - \let\lst@ProcessDigit\@empty - \lst@OldOutput - \endgroup}} -\lst@Key{alsoletter}\relax{\lst@DefOther\lst@arg{#1}% - \expandafter\lstalso@\lst@also \lst@arg\@empty\@empty} -\lst@Key{alsodigit}\relax{\lst@DefOther\lst@arg{#1}% - \expandafter\lstalso@\lst@also \@empty\lst@arg\@empty} -\lst@Key{alsoother}\relax{\lst@DefOther\lst@arg{#1}% - \expandafter\lstalso@\lst@also \@empty\@empty\lst@arg} -\def\lstalso@#1#2#3#4#5#6{% - \ifx#4\@empty \ifx#5\@empty \ifx#6\@empty \else - \edef\lst@also{{#1}{#2}{#6}}% - \fi\else - \edef\lst@also{{#1}{#5}{#3}}% - \fi\else - \edef\lst@also{{#4}{#2}{#3}}% - \fi} -\lst@AddToHook{SetLanguage}{\def\lst@also{{}{}{}}} -\def\lst@UseBasicClasses{\expandafter\lst@UBC@\lst@also} -\def\lst@UBC@#1#2#3#4#5#6{\def\lst@also{{#1#4}{#2#5}{#3#6}}} -\lst@AddToHook{SelectCharTable} - {\expandafter\lst@ChangeBasicClasses\lst@also} -\def\lst@ChangeBasicClasses#1#2#3{% - \lst@CBC@\lst@ProcessOther#3\relax - \lst@CBC@\lst@ProcessDigit#2\relax - \lst@CBC@\lst@ProcessLetter#1\relax} -\def\lst@CBC@#1#2{% - \ifx\relax#2\expandafter\@gobbletwo \else - \lccode`\~=`#2\lowercase - {\edef~{\noexpand#1\expandafter\lst@CBC@@~}}% - \fi - \lst@CBC@#1} -\def\lst@CBC@@#1#2{\noexpand#2} +\def\lst@do@noligs#1{% + \begingroup \lccode`\~=`#1\lowercase{\endgroup + \lst@do@noligs@~}} +\def\lst@do@noligs#1#2{% + \expandafter\expandafter\expandafter\def + \expandafter\expandafter\expandafter#1% + \expandafter\expandafter\expandafter{\expandafter\lst@NoLig#1}} +\def\lst@NoLig{\advance\lst@length\m@ne \lst@Append\lst@nolig} +\def\lst@nolig{\lst@UM\@empty}% +\@namedef{\@lst @um@}{\leavevmode\kern\z@} +\def\lst@SaveOutputDef#1#2{% + \begingroup \lccode`\~=#1\relax \lowercase{\endgroup + \def\lst@temp##1\def~##2##3\relax}{% + \global\expandafter\let\expandafter#2\@gobble##2\relax}% + \expandafter\lst@temp\lst@SelectStdCharTable\relax} +\lst@SaveOutputDef{"5C}\lstum@backslash \lst@Key{extendedchars}{false}[t]{\lstKV@SetIf{#1}\lst@ifec} \def\lst@DefEC{% \lst@CCECUse \lst@ProcessLetter @@ -726,99 +950,289 @@ \fi \lst@CCECUse#1} \def\lst@CCECUse@#1#2#3{% - \expandafter\def\csname lst@EC#3\endcsname{\lst@UM#3}% - \expandafter\let\csname lstum@#3@\endcsname #2% - \edef#2{\noexpand#1\expandafter\noexpand\csname lst@EC#3\endcsname}} -\def\lst@SAC[#1]#2#3#4#5#6#7#8#9{% - \ifx #9\@empty \let#7\@empty \fi - \ifx\@empty#2\@empty\else - \lst@IfOneOf#1\relax#5% - {\lst@IfOneOf#1\relax#6% - {\@ifundefined{\@lst @#3@#1}% - {\lst@lExtend#7{\expandafter\lst@UseDynamicMode - \csname\@lst @#3DM@#1\endcsname}}% - {\lst@lExtend#7{\csname\@lst @#3@#1\endcsname}}}% - {\lst@lExtend#7{\expandafter\lst@DefineSAC - \csname\@lst @Process#3@#1\endcsname #4}}% - \lst@false \let\lst@arg\@empty - \@ifnextchar[\lst@SAC@ #8% - #2\@nil - \lst@lExtend#7{\lst@arg\@empty}}% - {\PackageError{Listings}{Illegal type `#1'}{#3 types are #5.}}% - \fi} -\def\lst@SAC@[#1]#2{\def\lst@arg{[#1]}\reserved@b} -\def\lst@SACDelete[#1]#2#3#4#5#6#7{% - \lst@IfOneOf#1\relax#6% - {\@ifundefined{\@lst @#3@#1}% - {\edef\lst@temp{\noexpand\lst@UseDynamicMode\expandafter - \noexpand\csname\@lst @#3DM@#1\endcsname}}% - {\edef\lst@temp{\expandafter - \noexpand\csname\@lst @#3@#1\endcsname}}}% - {\edef\lst@temp{\noexpand\lst@DefineSAC\expandafter\noexpand - \csname\@lst @Process#3@#1\endcsname #4}}% - \expandafter\lst@SACDelete@\lst@temp\relax#7} -\def\lst@SACDelete@#1\relax#2{% - \def\lst@temp##1#1##2\@empty##3{% - \lst@lAddTo#2{##1}% - \ifx\relax##3\else - \expandafter\lst@temp - \fi ##3} - \let\@tempa#2\let#2\@empty - \expandafter\lst@temp\@tempa#1{}\@empty\relax} -\def\lst@DefineSAC#1#2#3{% - \ifx\@empty#3% - \expandafter\@gobblethree - \else - \lccode`\~=`#3\lccode`\/=`#3\lowercase{% - \expandafter\let\csname\@lst s@#2/\endcsname~% - \def~{#1/}}% + \expandafter\def\csname\@lst @EC#3\endcsname{\lst@UM#3}% + \expandafter\let\csname\@lst @um#3@\endcsname #2% + \edef#2{\noexpand#1% + \expandafter\noexpand\csname\@lst @EC#3\endcsname}} +\lst@AddToHook{Init} + {\let\lsts@nfss@catcodes\nfss@catcodes + \let\nfss@catcodes\lst@nfss@catcodes} +\def\lst@nfss@catcodes{% + \lst@makeletter + ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\relax + \@makeother 0\@makeother 1\@makeother 2\@makeother 3\@makeother 4% + \@makeother 5\@makeother 6\@makeother 7\@makeother 8\@makeother 9% + \@makeother =\lsts@nfss@catcodes} +\def\lst@makeletter#1{% + \ifx\relax#1\else\catcode`#111\relax \expandafter\lst@makeletter\fi} +\lst@AddToHook{Init} +{\edef\lst@OrgOutput{\the\output}% + \output{\global\setbox\lst@gtempboxa\box\@cclv + \expandafter\egroup + \lst@SaveToken + \lst@InterruptModes + \setbox\@cclv\box\lst@gtempboxa + \bgroup\lst@OrgOutput\egroup + \bgroup + \aftergroup\pagegoal\aftergroup\vsize + \aftergroup\lst@ReenterModes\aftergroup\lst@RestoreToken}} +\lst@Key{alsoletter}\relax{% + \lst@DoAlso{#1}\lst@alsoletter\lst@ProcessLetter} +\lst@Key{alsodigit}\relax{% + \lst@DoAlso{#1}\lst@alsodigit\lst@ProcessDigit} +\lst@Key{alsoother}\relax{% + \lst@DoAlso{#1}\lst@alsoother\lst@ProcessOther} +\lst@AddToHook{SelectCharTable} + {\lst@alsoother \lst@alsodigit \lst@alsoletter} +\lst@AddToHookExe{SetLanguage}% init + {\let\lst@alsoletter\@empty + \let\lst@alsodigit\@empty + \let\lst@alsoother\@empty} +\def\lst@DoAlso#1#2#3{% + \lst@DefOther\lst@arg{#1}\let#2\@empty + \expandafter\lst@DoAlso@\expandafter#2\expandafter#3\lst@arg\relax} +\def\lst@DoAlso@#1#2#3{% + \ifx\relax#3\expandafter\@gobblethree \else + \begingroup \lccode`\~=`#3\relax \lowercase{\endgroup + \def\lst@temp##1\def~##2##3\relax{% + \edef\lst@arg{\def\noexpand~{\noexpand#2\expandafter + \noexpand\@gobble##2}}}}% + \expandafter\lst@temp\lst@SelectStdCharTable\relax + \lst@lExtend#1{\lst@arg}% \fi - \lst@DefineSAC#1{#2}} + \lst@DoAlso@#1#2} +\def\lst@SaveDef#1#2{% + \begingroup \lccode`\~=#1\relax \lowercase{\endgroup\let#2~}} +\def\lst@DefSaveDef#1#2{% + \begingroup \lccode`\~=#1\relax \lowercase{\endgroup\let#2~\def~}} +\def\lst@LetSaveDef#1#2{% + \begingroup \lccode`\~=#1\relax \lowercase{\endgroup\let#2~\let~}} +\def\lst@CDef#1{\lst@CDef@#1} +\def\lst@CDef@#1#2#3#4{\lst@CDefIt#1{#2}{#3}{#4#2#3}#4} +\def\lst@CDefX#1{\lst@CDefX@#1} +\def\lst@CDefX@#1#2#3{\lst@CDefIt#1{#2}{#3}{}} +\def\lst@CDefIt#1#2#3#4#5#6#7#8{% + \ifx\@empty#2\@empty + \def#1{#6\def\lst@next{#7#4#8}\lst@next}% + \else \ifx\@empty#3\@empty + \def#1##1{% + #6% + \ifx##1#2\def\lst@next{#7#4#8}\else + \def\lst@next{#5##1}\fi + \lst@next}% + \else + \def#1{% + #6% + \lst@IfNextCharsArg{#2#3}{#7#4#8}% + {\expandafter#5\lst@eaten}}% + \fi \fi} \def\lst@CArgX#1#2\relax{% \lst@DefActive\lst@arg{#1#2}% \expandafter\lst@CArg\lst@arg\relax} \def\lst@CArg#1#2\relax{% \lccode`\/=`#1\lowercase{\def\lst@temp{/}}% - \lst@GetFreeMacro{lst@c\lst@temp d}% + \lst@GetFreeMacro{lst@c\lst@temp}% \expandafter\lst@CArg@\lst@freemacro#1#2\@empty\@empty\relax} -\def\lst@CArg@#1#2#3#4\@empty#5\relax#6{#6#2#3{#4}#1} -\def\lst@CDef#1#2#3#4#5#6#7{% - \let#4#1% - \ifx\@empty#2\@empty - \def#1{#5\def\lst@next{#6#4#7}\lst@next}% - \else \ifx\@empty#3\@empty - \def#1##1{% - #5% - \ifx##1#2\def\lst@next{#6#4#2#7}\else - \def\lst@next{#4##1}\fi - \lst@next}% +\def\lst@CArg@#1#2#3#4\@empty#5\relax#6{% + \let#1#2% + \ifx\@empty#3\@empty + \def\lst@next{#6{#2{}{}}}% \else - \def#1{% - #5% - \lst@IfNextCharsArg{#2#3}{#6#4#2#3#7}% - {\expandafter#4\lst@eaten}}% - \fi \fi} -\def\lst@CDefX#1#2#3#4#5#6#7{% - \let#4#1% - \ifx\@empty#2\@empty - \def#1{#5\def\lst@next{#6#7}\lst@next}% - \else \ifx\@empty#3\@empty - \def#1##1{% - #5% - \ifx##1#2\def\lst@next{#6#7}\else - \def\lst@next{#4##1}\fi - \lst@next}% - \else - \def#1{% - #5% - \lst@IfNextCharsArg{#2#3}{#6#7}% - {\expandafter#4\lst@eaten}}% - \fi \fi} + \def\lst@next{#6{#2#3{#4}}}% + \fi + \lst@next #1} \def\lst@CArgEmpty#1\@empty{#1} \lst@Key{excludedelims}\relax {\lsthk@ExcludeDelims \lst@NormedDef\lst@temp{#1}% \expandafter\lst@for\lst@temp\do {\expandafter\let\csname\@lst @ifex##1\endcsname\iftrue}} +\def\lst@DelimPrint#1#2{% + #1% + \begingroup + \lst@mode\lst@nomode \lst@modetrue + #2\lst@XPrintToken + \endgroup + \lst@ResetToken + \fi} +\def\lst@DelimOpen#1#2#3#4#5#6\@empty{% + \lst@TrackNewLines \lst@XPrintToken + \lst@DelimPrint#1{#6}% + \lst@EnterMode{#4}{\def\lst@currstyle#5}% + \lst@DelimPrint{#1#2}{#6}% + #3} +\def\lst@DelimClose#1#2#3\@empty{% + \lst@TrackNewLines \lst@XPrintToken + \lst@DelimPrint{#1#2}{#3}% + \lst@LeaveMode + \lst@DelimPrint{#1}{#3}} +\def\lst@BeginDelim{\lst@DelimOpen\iffalse\else{}} +\def\lst@EndDelim{\lst@DelimClose\iffalse\else} +\def\lst@BeginIDelim{\lst@DelimOpen\iffalse{}{}} +\def\lst@EndIDelim{\lst@DelimClose\iffalse{}} +\lst@AddToHook{SelectCharTable}{\lst@DefDelims} +\lst@AddToHookExe{SetLanguage}{\let\lst@DefDelims\@empty} +\def\lst@Delim#1{% + \lst@false \let\lst@cumulative\@empty \let\lst@arg\@empty + \@ifstar{\@ifstar{\lst@Delim@{#1}}% + {\let\lst@cumulative\relax + \lst@Delim@{#1}}}% + {\lst@true\lst@Delim@{#1}}} +\def\lst@Delim@#1[#2]{% + \gdef\lst@delimtype{#2}% + \@ifnextchar[\lst@Delim@sty + {\lst@Delim@sty[#1]}} +\def\lst@Delim@sty[#1]{% + \def\lst@delimstyle{#1}% + \ifx\@empty#1\@empty\else + \lst@Delim@sty@ #1\@nil + \fi + \@ifnextchar[\lst@Delim@option + \lst@Delim@delim} +\def\lst@Delim@option[#1]{\def\lst@arg{#1}\lst@Delim@delim} +\def\lst@Delim@sty@#1#2\@nil{% + \if\relax\noexpand#1\else + \edef\lst@delimstyle{\expandafter\noexpand + \csname\@lst @\lst@delimstyle\endcsname}% + \fi} +\def\lst@Delim@delim#1\relax#2#3#4#5#6#7#8{% + \ifx #4\@empty \lst@Delim@delall{#2}\fi + \ifx\@empty#1\@empty + \ifx #4\@nil + \@ifundefined{\@lst @#2DM@\lst@delimtype}% + {\lst@Delim@delall{#2@\lst@delimtype}}% + {\lst@Delim@delall{#2DM@\lst@delimtype}}% + \fi + \else + \expandafter\lst@Delim@args\expandafter + {\lst@delimtype}{#1}{#5}#6{#7}{#8}#4% + \let\lst@delim\@empty + \expandafter\lst@IfOneOf\lst@delimtype\relax#3% + {\@ifundefined{\@lst @#2DM@\lst@delimtype}% + {\lst@lExtend\lst@delim{\csname\@lst @#2@\lst@delimtype + \expandafter\endcsname\lst@arg}}% + {\lst@lExtend\lst@delim{\expandafter\lst@UseDynamicMode + \csname\@lst @#2DM@\lst@delimtype + \expandafter\endcsname\lst@arg}}% + \ifx #4\@nil + \let\lst@temp\lst@DefDelims \let\lst@DefDelims\@empty + \expandafter\lst@Delim@del\lst@temp\@empty\@nil\@nil\@nil + \else + \lst@lExtend\lst@DefDelims\lst@delim + \fi}% + {\PackageError{Listings}{Illegal type `\lst@delimtype'}% + {#2 types are #3.}}% + \fi} +\def\lst@Delim@args#1#2#3#4#5#6#7{% + \begingroup + \lst@false \let\lst@next\lst@XConvert + \@ifnextchar #4{\xdef\lst@delimtype{\expandafter\@gobble + \lst@delimtype}% + #5\lst@next#2\@nil + \lst@lAddTo\lst@arg{\@empty#6}% + \lst@GobbleNil}% + {\lst@next#2\@nil + \lst@lAddTo\lst@arg{\@empty#3}% + \lst@GobbleNil}% + #1\@nil + \global\let\@gtempa\lst@arg + \endgroup + \let\lst@arg\@gtempa + \ifx #7\@nil\else + \expandafter\lst@Delim@args@\expandafter{\lst@delimstyle}% + \fi} +\def\lst@Delim@args@#1{% + \lst@if + \lst@lAddTo\lst@arg{{{#1}\lst@modetrue}}% + \else + \ifx\lst@cumulative\@empty + \lst@lAddTo\lst@arg{{{}#1}}% + \else + \lst@lAddTo\lst@arg{{{#1}}}% + \fi + \fi} +\def\lst@Delim@del#1\@empty#2#3#4{% + \ifx #2\@nil\else + \def\lst@temp{#1\@empty#2#3}% + \ifx\lst@temp\lst@delim\else + \lst@lAddTo\lst@DefDelims{#1\@empty#2#3{#4}}% + \fi + \expandafter\lst@Delim@del + \fi} +\def\lst@Delim@delall#1{% + \begingroup + \edef\lst@delim{\expandafter\string\csname\@lst @#1\endcsname}% + \lst@false \global\let\@gtempa\@empty + \expandafter\lst@Delim@delall@\lst@DefDelims\@empty + \endgroup + \let\lst@DefDelims\@gtempa} +\def\lst@Delim@delall@#1{% + \ifx #1\@empty\else + \ifx #1\lst@UseDynamicMode + \lst@true + \let\lst@next\lst@Delim@delall@do + \else + \def\lst@next{\lst@Delim@delall@do#1}% + \fi + \expandafter\lst@next + \fi} +\def\lst@Delim@delall@do#1#2\@empty#3#4#5{% + \expandafter\lst@IfSubstring\expandafter{\lst@delim}{\string#1}% + {}% + {\lst@if \lst@AddTo\@gtempa\lst@UseDynamicMode \fi + \lst@AddTo\@gtempa{#1#2\@empty#3#4{#5}}}% + \lst@false \lst@Delim@delall@} +\gdef\lst@DefDelimB#1#2#3#4#5#6#7#8{% + \lst@CDef{#1}#2% + {#3}% + {\let\lst@bnext\lst@CArgEmpty + \lst@ifmode #4\else + #5% + \def\lst@bnext{#6{#7}{#8}}% + \fi + \lst@bnext}% + \@empty} +\gdef\lst@DefDelimE#1#2#3#4#5#6#7{% + \lst@CDef{#1}#2% + {#3}% + {\let\lst@enext\lst@CArgEmpty + \ifnum #7=\lst@mode% + #4% + \let\lst@enext#6% + \else + #5% + \fi + \lst@enext}% + \@empty} +\lst@AddToHook{Init}{\let\lst@bnext\relax \let\lst@enext\relax} +\gdef\lst@DefDelimBE#1#2#3#4#5#6#7#8#9{% + \lst@CDef{#1}#2% + {#3}% + {\let\lst@bnext\lst@CArgEmpty + \ifnum #7=\lst@mode + #4% + \let\lst@bnext#9% + \else + \lst@ifmode\else + #5% + \def\lst@bnext{#6{#7}{#8}}% + \fi + \fi + \lst@bnext}% + \@empty} +\gdef\lst@delimtypes{s,l} +\gdef\lst@DelimKey#1#2{% + \lst@Delim{}#2\relax + {Delim}\lst@delimtypes #1% + {\lst@BeginDelim\lst@EndDelim} + i\@empty{\lst@BeginIDelim\lst@EndIDelim}} +\lst@Key{delim}\relax{\lst@DelimKey\@empty{#1}} +\lst@Key{moredelim}\relax{\lst@DelimKey\relax{#1}} +\lst@Key{deletedelim}\relax{\lst@DelimKey\@nil{#1}} +\gdef\lst@DelimDM@l#1#2\@empty#3#4#5{% + \lst@CArg #2\relax\lst@DefDelimB{}{}{}#3{#1}{#5\lst@Lmodetrue}} +\gdef\lst@DelimDM@s#1#2#3\@empty#4#5#6{% + \lst@CArg #2\relax\lst@DefDelimB{}{}{}#4{#1}{#6}% + \lst@CArg #3\relax\lst@DefDelimE{}{}{}#5{#1}} \def\lst@ReplaceInput#1{\lst@CArgX #1\relax\lst@CDefX{}{}} \lst@Key{literate}{}{\def\lst@literate{#1}} \lst@AddToHook{SelectCharTable} @@ -828,212 +1242,46 @@ \def\lst@Literate#1#2#3{% \ifx\relax#2\@empty\else \lst@ReplaceInput{#1}% - {\lst@PrintToken \lst@letterfalse - \lst@token{#2}\lst@length#3\relax\lst@PrintToken}% + {\lst@XPrintToken \lst@letterfalse + \lst@token{#2}\lst@length#3\relax + \lst@XPrintToken}% \expandafter\lst@Literate \fi} \def\lst@BeginDropInput#1{% \lst@EnterMode{#1}% {\lst@modetrue + \let\lst@ifdropinput\iftrue \let\lst@ProcessLetter\@gobble \let\lst@ProcessDigit\@gobble \let\lst@ProcessOther\@gobble \let\lst@ProcessSpace\@empty \let\lst@ProcessTabulator\@empty \let\lst@ProcessFormFeed\@empty}} -\lst@Key{identifierstyle}{}{\def\lst@identifierstyle{#1}} -\lst@AddToHook{EmptyStyle}{\let\lst@identifierstyle\@empty} -\lst@Key{flexiblecolumns}{false}[t]{\lstKV@SetIf{#1}\lst@ifflexible} -\def\lst@flexibletrue{\let\lst@ifflexible\iftrue} -\def\lst@flexiblefalse{\let\lst@ifflexible\iffalse} -\lst@Key{columns}{fixed}{\def\lst@arg{#1}% - \def\lst@temp{fixed}% - \ifx\lst@arg\lst@temp - \lst@flexibletrue - \else - \def\lst@temp{flexible}% - \ifx\lst@arg\lst@temp - \lst@flexiblefalse - \else - \PackageWarning{Listings}{Unknown column format `#1'}% - \fi - \fi} -\newdimen\lst@width -\lst@Key{basewidth}{0.6em,0.45em}{\lstKV@CSTwoArg{#1}% - {\def\lst@widthfixed{##1}\def\lst@widthflexible{##2}% - \ifx\lst@widthflexible\@empty - \let\lst@widthflexible\lst@widthfixed - \fi - \gdef\lst@error{\PackageError{Listings}% - {Nonnegative value(s) treated as zero}% - {Type to proceed.}}% - \global\let\@gtempa\relax - \ifdim \lst@widthfixed<\z@ - \global\let\@gtempa\lst@error \let\lst@widthfixed\z@ - \fi - \ifdim \lst@widthflexible<\z@ - \global\let\@gtempa\lst@error \let\lst@widthflexible\z@ - \fi - \@gtempa}} -\lst@AddToHook{FontAdjust} - {\lst@width=\lst@ifflexible\lst@widthflexible - \else\lst@widthfixed\fi \relax} -\lst@Key{fontadjust}{false}[t]{\lstKV@SetIf{#1}\lst@iffontadjust} -\lst@AddToHook{InitVars}{\lsthk@FontAdjust} -\def\lst@FontAdjustPre{% - \lst@iffontadjust - \setbox\@tempboxa\hbox{{\lst@thestyle{\lsthk@FontAdjust - \xdef\@gtempa{\noexpand\lst@width\the\lst@width\relax}}}}% - \@gtempa - \fi} -\def\lst@FontAdjustPost{\lst@iffontadjust \lsthk@FontAdjust \fi} -\newdimen\lst@currlwidth % \global -\newcount\lst@column \newcount\lst@pos % \global -\lst@AddToHook{InitVarsBOL} - {\global\lst@currlwidth\z@ \global\lst@pos\z@ \global\lst@column\z@} -\def\lst@CalcLineLength{% - \@tempcnta\lst@column - \advance\@tempcnta\lst@length - \advance\@tempcnta-\lst@pos} -\newdimen\lst@lostspace % \global -\lst@AddToHook{InitVarsBOL}{\global\lst@lostspace\z@} -\def\lst@UseLostSpace{\ifdim\lst@lostspace>\z@ \lst@InsertLostSpace \fi} -\def\lst@InsertLostSpace{% - \lst@Kern\lst@lostspace \global\lst@lostspace\z@} -\def\lst@InsertHalfLostSpace{% - \global\lst@lostspace.5\lst@lostspace \lst@Kern\lst@lostspace} -\def\lstoutputpos@#1#2\relax{% - \ifx #1l% - \let\lst@lefthss\@empty \let\lst@righthss\hss - \let\lst@leftinsert\@empty - \else\ifx #1c% - \let\lst@lefthss\hss \let\lst@righthss\hss - \let\lst@leftinsert\lst@InsertHalfLostSpace - \else - \let\lst@lefthss\hss \let\lst@righthss\@empty - \let\lst@leftinsert\lst@InsertLostSpace - \ifx #1r\else \PackageWarning{Listings}% - {Unknown positioning for output boxes}% - \fi - \fi\fi} -\lst@Key{outputpos}{c}{\lstoutputpos@#1\relax\relax} -\def\lst@OutputBox#1{\lst@alloverstyle{\box#1}\lsthk@PostOutput} -\let\lst@alloverstyle\@empty % init -\lst@AddToHook{PostOutput}{}% init -\def\lst@Kern#1{% - \setbox\z@\hbox{{\lst@currstyle{\kern#1}}}% - \global\advance\lst@currlwidth \wd\z@ - \lst@OutputBox\z@} -\def\lst@CalcLostSpaceAndOutput{% - \global\advance\lst@lostspace \lst@length\lst@width - \global\advance\lst@lostspace-\wd\@tempboxa - \global\advance\lst@currlwidth \wd\@tempboxa - \global\advance\lst@pos -\lst@length - \ifdim\lst@lostspace>\z@ \lst@leftinsert \fi - \lst@OutputBox\@tempboxa} -\def\lst@OutputToken{% - \lst@TrackNewLines \lst@UseLostSpace - \lst@FontAdjustPre - \setbox\@tempboxa\lst@hbox - {\lsthk@OutputBox - {\lst@lefthss - \lst@thestyle - {\expandafter\lst@FillOutputBox\the\lst@token\@empty}% - \lst@righthss}}% - \lst@CalcLostSpaceAndOutput - \lst@FontAdjustPost - \lst@token{}\lst@length\z@} -\lst@AddToHook{OutputBox}{}% init -\def\lst@FillOutputBox#1{#1\lst@FillOutputBox@} -\def\lst@FillOutputBox@#1{% - \ifx\@empty#1\else \hss#1\expandafter\lst@FillOutputBox@ \fi} -\def\lst@hbox{\hbox to\lst@length\lst@width}% init -\def\lst@OutputOther{% - \ifnum\lst@length=\z@\else - \let\lst@thestyle\lst@currstyle - \lsthk@OutputOther - \lst@OutputToken - \fi} -\lst@AddToHook{OutputOther}{}% init -\let\lst@currstyle\relax % init -\def\lst@Output{% - \ifnum\lst@length=\z@\else - \ifx\lst@currstyle\relax - \let\lst@thestyle\lst@identifierstyle - \else - \let\lst@thestyle\lst@currstyle - \fi - \lsthk@Output - \lst@OutputToken - \fi - \let\lst@lastother\relax} -\lst@AddToHook{Output}{}% init -\def\lst@GotoTabStop{% - \ifx\lst@newlines\@empty - \setbox\@tempboxa\hbox{\lst@outputspace}% - \setbox\@tempboxa\hbox to\wd\@tempboxa{{\lst@currstyle{\hss}}}% - \lst@CalcLostSpaceAndOutput - \else - \global\advance\lst@lostspace \lst@length\lst@width - \global\advance\lst@column\lst@length \lst@length\z@ - \fi} -\lst@AddToHook{Init} - {\lst@ifflexible - \let\lst@FillOutputBox\@empty - \let\lst@lefthss\@empty - \let\lst@righthss\@empty - \let\lst@hbox\hbox - \fi} -\def\lst@NewLine{% - \ifx\lst@OutputBox\@gobble\else - \par\noindent \hbox{}% - \fi \lst@newlinetrue} -\lst@AddToHook{InitVars}{\global\let\lst@newlines\@empty} -\lst@AddToHook{InitVarsBOL}{\lst@AddTo\lst@newlines\lst@NewLine} -\def\lst@TrackNewLines{% - \ifx\lst@newlines\@empty\else - \lsthk@OnNewLine - \lst@newlines - \global\let\lst@newlines\@empty - \fi} -\lst@AddToHook{OnNewLine}{}% init -\def\lst@newlinetrue{\global\let\lst@ifnewline\iftrue} -\lst@AddToHook{PostOutput}{\global\let\lst@ifnewline\iffalse} -\global\let\lst@ifnewline\iffalse -\def\lst@RemoveNewLine{% - \def\lst@temp##1\lst@NewLine##2\@empty{% - \ifx\@empty##2\@empty \expandafter\@gobble \else - \expandafter\lst@RNL@\lst@newlines\@empty - \fi}% - \expandafter\lst@temp\lst@newlines\lst@NewLine\@empty} -\def\lst@RNL@#1\lst@NewLine#2\@empty#3{% - \gdef\lst@newlines{#1#2}#3} -\def\lst@BeginDropOutput#1{% - \global\let\lst@BDOnewlines\lst@newlines - \lst@EnterMode{#1}% - {\lst@modetrue - \let\lst@OutputBox\@gobble - \aftergroup\lst@BDORestore}} -\def\lst@BDORestore{\global\let\lst@newlines\lst@BDOnewlines} +\let\lst@ifdropinput\iffalse % init \lst@Key{basicstyle}\relax{\def\lst@basicstyle{#1}} -\lst@AddToHook{Init}{\lst@basicstyle} -\lst@AddToHookExe{EmptyStyle}{\let\lst@basicstyle\@empty} +\lst@Key{inputencoding}\relax{\def\lst@inputenc{#1}} +\lst@AddToHook{Init} + {\lst@basicstyle + \ifx\lst@inputenc\@empty\else + \@ifundefined{inputencoding}{}% + {\inputencoding\lst@inputenc}% + \fi} +\lst@AddToHookExe{EmptyStyle} + {\let\lst@basicstyle\@empty + \let\lst@inputenc\@empty} \def\lst@parshape{\parshape\@ne \z@ \linewidth} \lst@AddToHookAtTop{EveryLine}{\lst@parshape} \lst@AddToHookAtTop{EndGroup}{\lst@parshape} \newcount\lst@lineno % \global \lst@AddToHook{InitVars}{\global\lst@lineno\@ne} \lst@Key{print}{true}[t]{\lstKV@SetIf{#1}\lst@ifprint} -\lst@Key{first}\relax{\def\lst@firstline{#1\relax}} -\lst@Key{last}\relax{\def\lst@lastline{#1\relax}} +\lst@Key{firstline}\relax{\def\lst@firstline{#1\relax}} +\lst@Key{lastline}\relax{\def\lst@lastline{#1\relax}} \lst@AddToHook{PreSet} {\let\lst@firstline\@ne \def\lst@lastline{9999999\relax}} -\lst@Key{continue}\relax[t]{\lstKV@SetIf{#1}\lst@ifcontinue} -\def\lst@continuetrue{\let\lst@ifcontinue\iftrue} -\def\lst@continuefalse{\let\lst@ifcontinue\iffalse} -\lst@AddToHook{PreSet}{\let\lst@ifcontinue\@undefined} -\lst@AddToHook{PreInit} - {\ifx\lst@ifcontinue\@undefined \lst@continuefalse \fi} +\lst@Key{nolol}{false}[t]{\lstKV@SetIf{#1}\lst@ifnolol} +\def\lst@nololtrue{\let\lst@ifnolol\iftrue} +\let\lst@ifnolol\iffalse % init \lst@Key{captionpos}{t}{\def\lst@captionpos{#1}} \lst@Key{abovecaptionskip}\smallskipamount{\def\lst@abovecaption{#1}} \lst@Key{belowcaptionskip}\smallskipamount{\def\lst@belowcaption{#1}} @@ -1042,10 +1290,7 @@ \lst@Key{caption}\relax{\lstKV@OptArg[{#1}]{#1}% {\def\lst@caption{##2}\def\lst@@caption{##1}}% \let\lst@title\@empty} -\lst@AddToHook{PreSet} - {\let\lst@caption\@empty \let\lst@@caption\@empty - \let\lst@title\@empty \let\lst@label\@empty} -\lst@AddToHook{TextStyle} +\lst@AddToHookExe{TextStyle} {\let\lst@caption\@empty \let\lst@@caption\@empty \let\lst@title\@empty \let\lst@label\@empty} \@ifundefined{thechapter} @@ -1055,6 +1300,20 @@ \renewcommand\thelstlisting {\ifnum \c@chapter>\z@ \thechapter.\fi \@arabic\c@lstlisting}} \lst@UserCommand\lstlistingname{Listing} +\@ifundefined{abovecaptionskip} +{\newskip\abovecaptionskip + \newskip\belowcaptionskip + \long\def\@makecaption#1#2{% + \vskip\abovecaptionskip + \sbox\@tempboxa{#1: #2}% + \ifdim \wd\@tempboxa >\hsize + #1: #2\par + \else + \global \@minipagefalse + \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% + \fi + \vskip\belowcaptionskip}% +}{} \def\lst@MakeCaption#1{% \ifx #1t% \ifx\lst@@caption\@empty\expandafter\lst@HRefStepCounter \else @@ -1064,7 +1323,11 @@ \fi \ifx\lst@caption\@empty\else \lst@IfSubstring #1\lst@captionpos - {\par\normalsize\normalfont + {\begingroup \let\@@vskip\vskip + \def\vskip{\afterassignment\lst@vskip \@tempskipa}% + \def\lst@vskip{\nobreak\@@vskip\@tempskipa\nobreak}% + \par\normalsize\normalfont + \ifx #1t\allowbreak \fi \ifx\lst@title\@empty \expandafter\@makecaption \else @@ -1072,34 +1335,13 @@ \fi {\noindent\lstlistingname \ifx\lst@@caption\@empty\else~\thelstlisting\fi}% - \lst@caption}{}% + \lst@caption + \ifx #1b\allowbreak \fi + \endgroup}{}% \fi} -\def\lst@maketitle#1#2{% - \vskip\abovecaptionskip - \sbox\@tempboxa{\lst@title}% - \ifdim \wd\@tempboxa >\hsize - \lst@title\par - \else - \global \@minipagefalse - \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% - \fi - \vskip\belowcaptionskip} -\AtBeginDocument{\@ifundefined{as@makecaption}{}{% -\def\lst@maketitle#1#2{% - \vskip\abovecaptionskip - \setlength{\as@captionwidth}{\linewidth}% - \setlength{\leftskip}{\captionmargin}% - \setlength{\rightskip}{\captionmargin}% - \addtolength{\as@captionwidth}{-2\captionmargin}% - \captionfont - \sbox{\as@captionbox}{\lst@title}% - \ifdim \wd\as@captionbox >\as@captionwidth - \as@caption\ignorespaces\lst@title - \else - \as@shortcaption\ignorespaces\lst@title - \fi - \vskip\belowcaptionskip}% -}% +\def\lst@maketitle#1#2{\@makecaption\lst@title@dropdelim\lst@title} +\def\lst@title@dropdelim#1{\ignorespaces} +\AtBeginDocument{% \@ifundefined{caption@make}{}{% \def\lst@maketitle#1#2{% \begingroup @@ -1109,16 +1351,32 @@ \def\caption@@@lsttitle{\captiontext\par}% }} \def\lst@HRefStepCounter#1{% + \begingroup \c@lstlisting\lst@neglisting \advance\c@lstlisting\m@ne \xdef\lst@neglisting{\the\c@lstlisting}% \ifx\hyper@refstepcounter\@undefined\else \hyper@refstepcounter{#1}% - \fi} + \fi + \endgroup} \gdef\lst@neglisting{\z@}% init \lst@Key{boxpos}{c}{\def\lst@boxpos{#1}} \def\lst@boxtrue{\let\lst@ifbox\iftrue} \let\lst@ifbox\iffalse -\lst@Key{float}\relax[\lst@floatplacement]{\edef\lst@float{#1}} +\lst@Key{float}\relax[\lst@floatplacement]{% + \def\lst@next{\@ifstar{\let\lst@beginfloat\@dblfloat + \let\lst@endfloat\end@dblfloat + \lst@KFloat}% + {\let\lst@beginfloat\@float + \let\lst@endfloat\end@float + \lst@KFloat}} + \edef\lst@float{#1}% + \expandafter\lst@next\lst@float\relax} +\def\lst@KFloat#1\relax{% + \ifx\@empty#1\@empty + \let\lst@float\lst@floatplacement + \else + \def\lst@float{#1}% + \fi} \lst@Key{floatplacement}{tbp}{\def\lst@floatplacement{#1}} \lst@AddToHook{PreSet}{\let\lst@float\relax} \lst@AddToHook{TextStyle}{\let\lst@float\relax} @@ -1132,10 +1390,14 @@ \lst@Key{belowskip}\medskipamount{\def\lst@belowskip{#1}} \lst@AddToHook{TextStyle} {\let\lst@aboveskip\z@ \let\lst@belowskip\z@} +\lst@Key{everydisplay}{}{\def\lst@EveryDisplay{#1}} +\lst@AddToHook{TextStyle}{\let\lst@ifdisplaystyle\iffalse} +\lst@AddToHook{DisplayStyle}{\let\lst@ifdisplaystyle\iftrue} +\let\lst@ifdisplaystyle\iffalse \def\lst@Init#1{% \begingroup \ifx\lst@float\relax\else - \edef\@tempa{\noexpand\@float{lstlisting}[\lst@float]}% + \edef\@tempa{\noexpand\lst@beginfloat{lstlisting}[\lst@float]}% \expandafter\@tempa \fi \ifhmode\ifinner \lst@boxtrue \fi\fi @@ -1145,17 +1407,36 @@ $\if t\lst@boxpos \vtop \else \if b\lst@boxpos \vbox \else \vcenter \fi\fi - \bgroup + \bgroup \par\noindent \else - \par\penalty-50\relax - \vspace\lst@aboveskip + \lst@ifdisplaystyle + \lst@EveryDisplay + \par\penalty-50\relax + \vspace\lst@aboveskip + \fi \fi \normalbaselines \abovecaptionskip\lst@abovecaption\relax \belowcaptionskip\lst@belowcaption\relax \lst@MakeCaption t% \lsthk@PreInit \lsthk@Init - \everypar{\lsthk@EveryLine\lsthk@EveryPar}% + \lst@ifdisplaystyle + \global\let\lst@ltxlabel\@empty + \if@inlabel + \lst@ifresetmargins + \leavevmode + \else + \xdef\lst@ltxlabel{\the\everypar}% + \lst@AddTo\lst@ltxlabel{% + \global\let\lst@ltxlabel\@empty + \everypar{\lsthk@EveryLine\lsthk@EveryPar}}% + \fi + \fi + \everypar\expandafter{\lst@ltxlabel + \lsthk@EveryLine\lsthk@EveryPar}% + \else + \everypar{}\let\lst@NewLine\@empty + \fi \lsthk@InitVars \lsthk@InitVarsBOL \lst@Let{13}\lst@MProcessListing \let\lst@Backslash#1% @@ -1167,25 +1448,26 @@ \lst@AddToHook{EveryPar}{}% init \lst@Key{showlines}f[t]{\lstKV@SetIf{#1}\lst@ifshowlines} \def\lst@DeInit{% - \lst@PrintToken \lst@EOLUpdate - \lst@RemoveNewLine\@empty - \lst@RemoveNewLine{% - \lst@ifshowlines - \lst@TrackNewLines - \else - \setbox\@tempboxa\vbox{\lst@TrackNewLines}% - \fi}% - \par\removelastskip + \lst@XPrintToken \lst@EOLUpdate + \global\advance\lst@newlines\m@ne + \lst@ifshowlines + \lst@DoNewLines + \else + \setbox\@tempboxa\vbox{\lst@DoNewLines}% + \fi + \lst@ifdisplaystyle \par\removelastskip \fi \everypar{}\lsthk@ExitVars \lsthk@DeInit \lst@MakeCaption b% \lst@ifbox \egroup $\hss \egroup \vrule\@width\lst@maxwidth\@height\z@\@depth\z@ \else - \par\penalty-50\vspace\lst@belowskip + \lst@ifdisplaystyle + \par\penalty-50\vspace\lst@belowskip + \fi \fi \ifx\lst@float\relax\else - \expandafter\end@float + \expandafter\lst@endfloat \fi \endgroup} \newdimen\lst@maxwidth % \global @@ -1194,9 +1476,10 @@ {\ifdim\lst@currlwidth>\lst@maxwidth \global\lst@maxwidth\lst@currlwidth \fi} -\def\lst@EOLUpdate{\lsthk@EOL \lsthk@InitVarsEOL \lsthk@InitVarsBOL} +\def\lst@EOLUpdate{\lsthk@EOL \lsthk@InitVarsEOL} \def\lst@MProcessListing{% - \lst@PrintToken \lst@EOLUpdate \global\advance\lst@lineno\@ne + \lst@XPrintToken \lst@EOLUpdate \lsthk@InitVarsBOL + \global\advance\lst@lineno\@ne \ifnum \lst@lineno>\lst@lastline \expandafter\lst@EndProcessListing \else @@ -1235,25 +1518,26 @@ \fi \fi \fi \fi \fi \lst@next} +\lst@Key{name}\relax{\def\lst@intname{#1}} \lst@AddToHookExe{PreSet}{\global\let\lst@intname\@empty} \lst@AddToHook{PreInit}{% \let\lst@arg\lst@intname \lst@ReplaceIn\lst@arg\lst@filenamerpl - \global\let\lst@name\lst@arg} + \global\let\lst@name\lst@arg \global\let\lstname\lst@name} \def\lst@filenamerpl{_\textunderscore $\textdollar -\textendash} \def\l@lstlisting#1#2{\@dottedtocline{1}{1.5em}{2.3em}{#1}{#2}} \lst@AddToHook{Init} - {\ifx\lst@@caption\@empty - \ifx\lst@caption\@empty - \lst@ifcontinue\else + {\lst@ifnolol\else + \ifx\lst@@caption\@empty + \ifx\lst@caption\@empty \ifx\lst@intname\@empty \else \def\lst@temp{ }% \ifx\lst@intname\lst@temp \else \addcontentsline{lol}{lstlisting}\lst@name \fi\fi \fi - \fi - \else - \addcontentsline{lol}{lstlisting}% - {\protect\numberline{\thelstlisting}\lst@@caption}% + \else + \addcontentsline{lol}{lstlisting}% + {\protect\numberline{\thelstlisting}\lst@@caption}% + \fi \fi} \lst@UserCommand\lstlistlistingname{Listings} \lst@UserCommand\lstlistoflistings{\bgroup @@ -1261,18 +1545,20 @@ \let\lst@temp\@starttoc \def\@starttoc##1{\lst@temp{lol}}% \tableofcontents \egroup} \newcommand\lstinline[1][]{% - \leavevmode\hbox\bgroup - \def\lst@boxpos{b}\let\lst@ifflexible\iftrue - \lsthk@PreSet\lstset{#1}% - \lsthk@TextStyle \lst@Init\relax - \everypar{}\let\lsthk@Endgroup\@empty - \lstinline@} -\def\lstinline@#1{\lst@IfNextCharActive{\lst@InlineM#1}{\lst@InlineJ#1}} + \leavevmode\bgroup % \hbox\bgroup --> \bgroup + \def\lst@boxpos{b}% + \lsthk@PreSet\lstset{flexiblecolumns,#1}% + \lsthk@TextStyle + \@ifnextchar\bgroup{\afterassignment\lst@InlineG \let\@let@token}% + \lstinline@} +\def\lstinline@#1{% + \lst@Init\relax + \lst@IfNextCharActive{\lst@InlineM#1}{\lst@InlineJ#1}} \lst@AddToHook{TextStyle}{}% init \lst@AddToHook{SelectCharTable}{\lst@inlinechars} \global\let\lst@inlinechars\@empty \def\lst@InlineM#1{\gdef\lst@inlinechars{% - \lst@Def{`#1}{\lst@DeInit\egroup \global\let\lst@inlinechars\@empty}% + \lst@Def{`#1}{\lst@DeInit\egroup\global\let\lst@inlinechars\@empty}% \lst@Def{13}{\lst@DeInit\egroup \global\let\lst@inlinechars\@empty \PackageError{Listings}{lstinline ended by EOL}\@ehc}}% \lst@inlinechars} @@ -1281,6 +1567,30 @@ \let\lst@arg\@empty \lst@InsideConvert{##1}\lst@arg \lst@DeInit\egroup}% \lst@temp} +\def\lst@InlineG{% + \lst@Init\relax + \lst@IfNextCharActive{\lst@InlineM\}}% + {\let\lst@arg\@empty \lst@InlineGJ}} +\def\lst@InlineGJ{\futurelet\@let@token\lst@InlineGJTest} +\def\lst@InlineGJTest{% + \ifx\@let@token\egroup + \afterassignment\lst@InlineGJEnd + \expandafter\let\expandafter\@let@token + \else + \ifx\@let@token\@sptoken + \let\lst@next\lst@InlineGJReadSp + \else + \let\lst@next\lst@InlineGJRead + \fi + \expandafter\lst@next + \fi} +\def\lst@InlineGJEnd{\lst@arg\lst@DeInit\egroup} +\def\lst@InlineGJRead#1{% + \lccode`\~=`#1\lowercase{\lst@lAddTo\lst@arg~}% + \lst@InlineGJ} +\def\lst@InlineGJReadSp#1{% + \lccode`\~=`\ \lowercase{\lst@lAddTo\lst@arg~}% + \lst@InlineGJ#1} \newcommand\lstinputlisting[2][]{% \def\lst@set{#1}% \IfFileExists{#2}% @@ -1297,10 +1607,10 @@ or enter new name. (Default extension: #2)^^J}% \message{Enter file name: }% {\endlinechar\m@ne \global\read\m@ne to\@gtempa}% - \ifx\@gtempa\@empty \else % + \ifx\@gtempa\@empty \else \def\reserved@a{x}\ifx\reserved@a\@gtempa\batchmode\@@end\fi \def\reserved@a{X}\ifx\reserved@a\@gtempa\batchmode\@@end\fi - \filename@parse\@gtempa % + \filename@parse\@gtempa \edef\filename@ext{% \ifx\filename@ext\relax#2\else\filename@ext\fi}% \edef\reserved@a{\noexpand\IfFileExists % @@ -1311,18 +1621,24 @@ {\filename@area\filename@base}{\filename@ext}}}% \expandafter\reserved@a % \fi} +\let\lst@ifdraft\iffalse +\DeclareOption{draft}{\let\lst@ifdraft\iftrue} +\lst@AddToHook{PreSet} + {\lst@ifdraft + \let\lst@ifprint\iffalse + \@gobbletwo\fi\fi + \fi} \def\lst@InputListing#1{% \begingroup - \lsthk@PreSet \gdef\lst@intname{#1}% - \expandafter\lstset\expandafter{\lst@set}% - \lst@ifprint - \lst@Init\relax \let\lst@gobble\z@ - \lst@SkipToFirst \input{#1}\lst@DeInit - \else - \begin{center}% - \footnotesize --- Listing of #1 has been skipped. --- - \end{center}% - \fi + \lsthk@PreSet \gdef\lst@intname{#1}% + \expandafter\lstset\expandafter{\lst@set}% + \lsthk@DisplayStyle + \lst@Init\relax \let\lst@gobble\z@ + \lst@SkipToFirst + \lst@ifprint \def\lst@next{\input{#1}}% + \else \let\lst@next\@empty \fi + \lst@next + \lst@DeInit \endgroup} \def\lst@SkipToFirst{% \ifnum \lst@lineno<\lst@firstline @@ -1335,7 +1651,7 @@ \def\lst@MSkipToFirst{% \global\advance\lst@lineno\@ne \ifnum \lst@lineno=\lst@firstline - \lst@LeaveMode \global\let\lst@newlines\@empty + \lst@LeaveMode \global\lst@newlines\z@ \lsthk@InitVarsBOL \expandafter\lst@BOLGobble \fi} @@ -1393,17 +1709,19 @@ \lst@next} \lst@UserCommand\lstnewenvironment#1#2#{% \@ifundefined{#1}% - {\lst@false \let\lst@arg\@empty - \lst@FVConvert{#1}\@nil + {\let\lst@arg\@empty + \lst@XConvert{#1}\@nil \expandafter\lstnewenvironment@\lst@arg{#1}{#2}}% {\PackageError{Listings}{Environment `#1' already defined}\@eha \@gobbletwo}} \def\@tempa#1#2#3{% \gdef\lstnewenvironment@##1##2##3##4##5{% + \begingroup \global\@namedef{end##2}{\lstenv@Error{##2}}% \global\@namedef{##2}{\def\lstenv@name{##2}% \begingroup \catcode\active=\active \csname##2@\endcsname}% \let\l@ngrel@x\global + \let\@xargdef\lstenv@xargdef \expandafter\new@command\csname##2@\endcsname##3% {\lsthk@PreSet ##4% \ifx\@currenvir\lstenv@name @@ -1413,16 +1731,43 @@ \fi \@namedef{end##2}{\lst@DeInit ##5\endgroup \@doendpe \@ignoretrue}% + \lsthk@DisplayStyle \lst@Init\lstenv@backslash \let\lst@EndProcessListing\lstenv@SkipToEnd \lst@ifprint - \expandafter\lstenv@Process + \expandafter\expandafter\expandafter\lstenv@Process \else \expandafter\lstenv@SkipToEnd - \fi}}% + \fi + \lst@insertargs}% + \endgroup}% } -\let\lst@arg\@empty \lst@false \lst@FVConvert{end}\{\}\@nil +\let\lst@arg\@empty \lst@XConvert{end}\{\}\@nil \expandafter\@tempa\lst@arg +\let\lst@insertargs\@empty +\def\lstenv@xargdef#1{ + \expandafter\lstenv@xargdef@\csname\string#1\endcsname#1} +\def\lstenv@xargdef@#1#2[#3][#4]#5{% + \@ifdefinable#2{% + \gdef#2{% + \ifx\protect\@typeset@protect + \expandafter\lstenv@testopt + \else + \@x@protect#2% + \fi + #1% + {#4}}% + \@yargdef + #1% + \tw@ + {#3}% + {#5}}} +\long\def\lstenv@testopt#1#2{% + \@ifnextchar[{\catcode\active5\relax \lstenv@testopt@#1}% + {#1[{#2}]}} +\def\lstenv@testopt@#1[#2]{% + \catcode\active\active + #1[#2]} \begingroup \lccode`\~=`\\\lowercase{% \gdef\lstenv@SkipToEnd{% \long\expandafter\def\expandafter\lst@temp\expandafter##\expandafter @@ -1433,21 +1778,18 @@ {I'm ignoring this, since I wasn't doing a \csname#1\endcsname.}} \begingroup \lccode`\~=`\^^M\lowercase{% \gdef\lst@TestEOLChar#1{% - \ifx ~#1\@empty \lst@EOLCharError \else - \ifx^^J#1\@empty \lst@EOLCharError \else - \gdef\lst@intname{#1}% + \def\lst@insertargs{#1}% + \ifx ~#1\@empty \else + \ifx^^J#1\@empty \else + \global\let\lst@intname\lst@insertargs + \let\lst@insertargs\@empty \fi \fi} }\endgroup -\def\lst@EOLCharError{% - \PackageError{Listings}% - {Oops! It seems you've forgotten the argument to\MessageBreak - a listing environment. Assuming empty argument}% - {Type to proceed.}} \lstnewenvironment{lstlisting}[2][] {\lst@TestEOLChar{#2}% \lstset{#1}% - \csname lst@SetFirstLabel\endcsname} - {\csname lst@SaveFirstLabel\endcsname} + \csname\@lst @SetFirstNumber\endcsname} + {\csname\@lst @SaveFirstNumber\endcsname} \lst@Key{fancyvrb}\relax[t]{% \lstKV@SetIf{#1}\lst@iffancyvrb \lstFV@fancyvrb} @@ -1455,17 +1797,10 @@ \gdef\lstFV@fancyvrb{\lst@RequireAspects{fancyvrb}\lstFV@fancyvrb} \fi \@ifundefined{ocp}{} - {\lst@AddToHook{OutputBox}{\lsthk@OmegaOutputBox} - \lst@AddToHook{OmegaOutputBox}{}} -\lst@AddToHook{OmegaOutputBox} - {\let\lst@ProcessLetter\@firstofone - \let\lst@ProcessDigit\@firstofone - \let\lst@ProcessOther\@firstofone - \let\lst@ProcessString@b\@firstofone - \let\lst@ProcessString@d\@firstofone - \let\lst@ProcessString@m\@firstofone - \let\lst@ProcessString@bd\@firstofone - \let\lst@ProcessString@db\@firstofone} + {\lst@AddToHook{OutputBox}% + {\let\lst@ProcessLetter\@firstofone + \let\lst@ProcessDigit\@firstofone + \let\lst@ProcessOther\@firstofone}} \DeclareOption*{\expandafter\lst@ProcessOption\CurrentOption\relax} \def\lst@ProcessOption#1#2\relax{% \ifx #1!% @@ -1473,64 +1808,11 @@ \else \lst@lAddTo\lst@loadaspects{,#1#2}% \fi} -\ifx\lst@loadaspects\@undefined - \def\lst@loadaspects{strings,comments,escape,style,language,% - keywords,labels,lineshape,frames,emph,breaklines,index}% -\fi -\lst@AddToHook{DeInit}{\everypar{}} -\def\lst@DefineSAC#1#2#3{% - \ifx\@empty#3% - \expandafter\@gobblethree - \else - \lccode`\~=`#3\lccode`\/=`#3\lowercase{\def\lst@temp{#1/}}% - \lowercase{\ifx~}\lst@temp\else % not defined yet - \lowercase{\expandafter\let\csname\@lst s@#2/\endcsname~% - \let~}\lst@temp - \fi - \fi - \lst@DefineSAC#1{#2}} -\lst@AddToHook{Init}{\lst@ifactivechars \catcode13\active \fi} -\def\lst@MakeCaption#1{% - \ifx #1t% - \ifx\lst@@caption\@empty\expandafter\lst@HRefStepCounter \else - \expandafter\refstepcounter - \fi {lstlisting}% - \ifx\lst@label\@empty\else \label{\lst@label}\fi - \fi - \ifx\lst@caption\@empty\else - \lst@IfSubstring #1\lst@captionpos - {\lst@Let{13}\space - \protected@edef\lst@caption{\lst@caption}% - \protected@edef\lst@@caption{\lst@@caption}% - \par\normalsize\normalfont - \ifx\lst@title\@empty - \expandafter\@makecaption - \else - \expandafter\lst@maketitle - \fi - {\noindent\lstlistingname - \ifx\lst@@caption\@empty\else~\thelstlisting\fi}% - \lst@caption}{}% - \fi} -\lst@NewMode\lst@commentmode -\gdef\lst@BeginCDATA#1\@empty{% - \lst@TrackNewLines \lst@PrintToken - \lst@EnterMode\lst@GPmode{}\let\lst@ifmode\iffalse - \lst@mode\lst@insidemode #1\lst@mode\lst@GPmode\relax\lst@modetrue} -\IfFileExists{lstpatch.sty} - {\def\lst@topatch{0.19}\input{lstpatch.sty}% - \let\lst@next\relax - \ifx\lstlanguage@\@undefined\else \let\lst@next\@empty \fi - \ifx\lst@version\lst@topatch\else \let\lst@next\@empty \fi - \ifx\lst@next\relax\else - \typeout{^^J% - ***^^J% - *** Patch file `lstpatch.sty' for version \lst@topatch^^J% - *** is not suitable for `listings.sty' version \lst@version.^^J% - *** Please delete old patch files and try again.^^J% - ***^^J}% - \batchmode \@@end - \fi}{} +\@ifundefined{lst@loadaspects} + {\def\lst@loadaspects{strings,comments,escape,style,language,% + keywords,labels,lineshape,frames,emph,index}% + }{} +\InputIfFileExists{lstpatch.sty}{}{} \let\lst@ifsavemem\iffalse \DeclareOption{savemem}{\let\lst@ifsavemem\iftrue} \DeclareOption{noaspects}{\let\lst@loadaspects\@empty} diff --git a/docs/styles/lstdoc.sty b/docs/styles/lstdoc.sty index cb4a7fdc38..82f7b4728a 100644 --- a/docs/styles/lstdoc.sty +++ b/docs/styles/lstdoc.sty @@ -8,33 +8,57 @@ %% %% 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 +%% (w)(c) 1996 -- 2002 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. %% +%% Permission is granted to modify the listings package as well as +%% lstdrvrs.dtx. You are not allowed to distribute a modified version +%% of the package or lstdrvrs.dtx unless you change the file names and +%% provide the original files. In any case it is better to contact the +%% address below; other users will welcome removed bugs, new features, +%% and additional programming languages. +%% %% 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. +%% product or if you use the package to prepare a commercial 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. For more +%% information about LaTeX see http://www.latex-project.org %% -%% 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. +%% No matter whether you use the package for a commercial or +%% non-commercial document, please send me a copy of the document (.dvi, +%% .ps, .pdf, hardcopy, etc.) to support further development---it is +%% easier to introduce new features or simplify things if I see how the +%% package is used by other people. %% %% Send comments and ideas on the package, error reports and additional %% programming languages to . %% -\lst@AddToAtTop{\try@load@fontshape}{\def\space{ }} +\def\filedate{2002/04/01} +\def\fileversion{1.0} +\ProvidesPackage{lstdoc} + [\filedate\space\fileversion\space(Carsten Heinz)] +\let\lstdoc@currversion\fileversion +\RequirePackage[writefile]{listings}[2002/04/01] +\newif\iffancyvrb \IfFileExists{fancyvrb.sty}{\fancyvrbtrue}{} +\newif\ifcolor \IfFileExists{color.sty}{\colortrue}{} +\newif\ifhyper \@ifundefined{pdfoutput}{} + {\IfFileExists{hyperref.sty}{\hypertrue}{}} +\newif\ifalgorithmic \IfFileExists{algorithmic.sty}{\algorithmictrue}{} +\iffancyvrb \RequirePackage{fancyvrb}\fi +\ifhyper \RequirePackage[colorlinks]{hyperref}\else + \def\href#1{\texttt}\fi +\ifcolor \RequirePackage{color}\fi +\ifalgorithmic \RequirePackage{algorithmic}\fi +\RequirePackage{nameref} +\renewcommand\ref{\protect\T@ref} +\renewcommand\pageref{\protect\T@pageref} \def\lst@BeginRemark#1{% \begin{quote}\topsep0pt\let\small\footnotesize\small#1:} \def\lst@EndRemark{\end{quote}} @@ -46,6 +70,47 @@ {\lst@BeginRemark{Removed}}{\lst@EndRemark} \newenvironment{OLDDEF} {\lst@BeginRemark{Old definition}}{\lst@EndRemark} +\def\advise{\par\list\labeladvise + {\advance\linewidth\@totalleftmargin + \@totalleftmargin\z@ + \@listi + \let\small\footnotesize \small\sffamily + \parsep \z@ \@plus\z@ \@minus\z@ + \topsep6\p@ \@plus1\p@\@minus2\p@ + \def\makelabel##1{\hss\llap{##1}}}} +\let\endadvise\endlist +\def\advisespace{\hbox{}\qquad} +\def\labeladvise{$\to$} +\newenvironment{syntax} + {\list{}{\itemindent-\leftmargin + \def\makelabel##1{\hss\lst@syntaxlabel##1,,,,\relax}}} + {\endlist} +\def\lst@syntaxlabel#1,#2,#3,#4\relax{% + \llap{\scriptsize\itshape#3}% + \def\lst@temp{#2}% + \expandafter\lst@syntaxlabel@\meaning\lst@temp\relax + \rlap{\hskip-\itemindent\hskip\itemsep\hskip\linewidth + \llap{\ttfamily\lst@temp}\hskip\labelwidth + \def\lst@temp{#1}% + \ifx\lst@temp\lstdoc@currversion#1\fi}} +\def\lst@syntaxlabel@#1>#2\relax + {\edef\lst@temp{\zap@space#2 \@empty}} +\newcommand*\syntaxnewline{\newline\hbox{}\kern\labelwidth} +\newcommand*\syntaxor{\qquad or\qquad} +\newcommand*\syntaxbreak + {\hfill\kern0pt\discretionary{}{\kern\labelwidth}{}} +\let\syntaxfill\hfill +\def\alternative#1{\lst@true \alternative@#1,\relax,} +\def\alternative@#1,{% + \ifx\relax#1\@empty + \expandafter\@gobble + \else + \ifx\@empty#1\@empty\else + \lst@if \lst@false \else $\vert$\fi + \textup{\texttt{#1}}% + \fi + \fi + \alternative@} \long\def\m@cro@#1#2#3{\endgroup \topsep\MacroTopsep \trivlist \edef\saved@macroname{\string#3}% \def\makelabel##1{\llap{##1}}% @@ -98,7 +163,7 @@ \def\PrintKeyName#1{\strut\keyname{#1}\ } \def\SpecialMainKeyIndex#1{% \@bsphack - \index{keys:\levelchar\protect\keyname{#1}\encapchar main}% + \index{keys\levelchar\protect\keyname{#1}\encapchar main}% \@esphack} \newcounter{argcount} \def\labelargcount{\texttt{\#\arabic{argcount}}\hskip\labelsep$=$} @@ -111,20 +176,18 @@ \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}% +\lstnewenvironment{lstsample}[3][] + {\global\let\lst@intname\@empty + \gdef\lst@sample{#2}% \setbox\lst@samplebox=\hbox\bgroup \setkeys{lst}{language={},style={},tabsize=4,gobble=5,% - basicstyle=\small\ttfamily,basewidth=0.51em} - #2% + basicstyle=\small\ttfamily,basewidth=0.51em,point={#1}} + #3% \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 @@ -136,12 +199,147 @@ \end{minipage}% \end{center}% \fi} +\lst@InstallKeywords{p}{point}{pointstyle}\relax{keywordstyle}{}ld +\lstnewenvironment{lstxsample}[1][] + {\begingroup + \setkeys{lst}{belowskip=-\medskipamount,language={},style={},% + tabsize=4,gobble=5,basicstyle=\small\ttfamily,% + basewidth=0.51em,point={#1}} + \lst@BeginAlsoWriteFile{\jobname.tmp}} + {\endgroup + \endgroup} \def\lst@sampleInput{% \MakePercentComment\catcode`\^^M=10\relax \small\lst@sample {\setkeys{lst}{SelectCharTable=\lst@ReplaceInput{\^\^I}% {\lst@ProcessTabulator}}% \leavevmode \input{\jobname.tmp}}\MakePercentIgnore} +\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}% + {1.25ex \@plus1ex \@minus.2ex}% + {-1em}% + {\normalfont\normalsize\bfseries}} +\def\lstref#1{\emph{\ref{#1} \nameref{#1}}} +\def\@part[#1]#2{\addcontentsline{toc}{part}{#1}% + {\parindent\z@ \raggedright \interlinepenalty\@M + \normalfont \huge \bfseries #2\markboth{}{}\par}% + \nobreak\vskip 3ex\@afterheading} +\renewcommand*\l@section[2]{% + \addpenalty\@secpenalty + \addvspace{.25em \@plus\p@}% + \setlength\@tempdima{1.5em}% + \begingroup + \parindent \z@ \rightskip \@pnumwidth + \parfillskip -\@pnumwidth + \leavevmode + \advance\leftskip\@tempdima + \hskip -\leftskip + #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par + \endgroup} +\renewcommand*\l@subsection{\@dottedtocline{2}{0pt}{2.3em}} +\renewcommand*\l@subsubsection{\@dottedtocline{3}{0pt}{3.2em}} +\newcommand\ikeyname[1]{% + \lstkeyindex{#1}{}% + \lstaspectindex{#1}{}% + \keyname{#1}} +\newcommand\ekeyname[1]{% + \@bsphack + \lstkeyindex{#1}{\encapchar usage}% + \lstaspectindex{#1}{\encapchar usage}% + \@esphack} +\newcommand\rkeyname[1]{% + \@bsphack + \lstkeyindex{#1}{\encapchar main}% + \lstaspectindex{#1}{\encapchar main}% + \@esphack{\rstyle\keyname{#1}}} +\newcommand\icmdname[1]{% + \@bsphack + \lstaspectindex{#1}{}% + \@esphack\texttt{\string#1}} +\newcommand\rcmdname[1]{% + \@bsphack + \lstaspectindex{#1}{\encapchar main}% + \@esphack\texttt{\rstyle\string#1}} +\def\lstaspectindex#1#2{% + \global\@namedef{lstkandc@\string#1}{}% + \@ifundefined{lstisaspect@\string#1} + {\index{unknown\levelchar + \protect\texttt{\protect\string\string#1}#2}}% + {\index{\@nameuse{lstisaspect@\string#1}\levelchar + \protect\texttt{\protect\string\string#1}#2}}% +} +\def\lstkeyindex#1#2{% +} +\def\lstisaspect[#1]#2{% + \global\@namedef{lstaspect@#1}{#2}% + \lst@AddTo\lst@allkeysandcmds{,#2}% + \@for\lst@temp:=#2\do + {\ifx\@empty\lst@temp\else + \global\@namedef{lstisaspect@\lst@temp}{#1}% + \fi}} +\gdef\lst@allkeysandcmds{} +\def\lstprintaspectkeysandcmds#1{% + \lst@true + \expandafter\@for\expandafter\lst@temp + \expandafter:\expandafter=\csname lstaspect@#1\endcsname\do + {\lst@if\lst@false\else, \fi \texttt{\lst@temp}}} +\def\lstcheckreference{% + \@for\lst@temp:=\lst@allkeysandcmds\do + {\ifx\lst@temp\@empty\else + \@ifundefined{lstkandc@\lst@temp} + {\typeout{\lst@temp\space not in reference guide?}}{}% + \fi}} +\newcommand*\lst{\texttt{lst}} +\newcommand*\Cpp{C\texttt{++}} +\let\keyname\texttt +\let\keyvalue\texttt +\let\hookname\texttt +\newcommand*\aspectname[1]{{\normalfont\sffamily#1}} +\DeclareRobustCommand\packagename[1]{% + {\leavevmode\text@command{#1}% + \switchfontfamily\sfdefault\rmdefault + \check@icl #1\check@icr + \expandafter}}% +\def\switchfontfamily#1#2{% + \begingroup\xdef\@gtempa{#1}\endgroup + \ifx\f@family\@gtempa\fontfamily#2% + \else\fontfamily#1\fi + \selectfont} +\ifcolor + \definecolor{darkgreen}{rgb}{0,0.6,0} + \def\rstyle{\color{darkgreen}} +\else + \let\rstyle\empty +\fi +\gdef\lst@emails{} +\newcommand*\lstthanks[2] + {#1\lst@AddTo\lst@emails{,#1,<#2>}% + \ifx\@empty#2\@empty\typeout{Missing email for #1}\fi} +\newcommand*\lsthelper[3] + {{\let~\ #1}% + \lst@IfOneOf#1\relax\lst@emails + {}{\typeout{^^JWarning: Unknown helper #1.^^J}}} +\lstdefinelanguage[doc]{Pascal}{% + morekeywords={alfa,and,array,begin,boolean,byte,case,char,const,div,% + do,downto,else,end,false,file,for,function,get,goto,if,in,% + integer,label,maxint,mod,new,not,of,or,pack,packed,page,program,% + procedure,put,read,readln,real,record,repeat,reset,rewrite,set,% + text,then,to,true,type,unpack,until,var,while,with,write,writeln},% + sensitive=false,% + morecomment=[s]{(*}{*)},% + morecomment=[s]{\{}{\}},% + morestring=[d]{'}} +\lstdefinestyle{} + {basicstyle={},% + keywordstyle=\bfseries,identifierstyle={},% + commentstyle=\itshape,stringstyle={},% + numberstyle={},stepnumber=1,% + pointstyle=\pointstyle} +\def\pointstyle{% + {\let\lst@um\@empty \xdef\@gtempa{\the\lst@token}}% + \expandafter\lstkeyindex\expandafter{\@gtempa}{}% + \expandafter\lstaspectindex\expandafter{\@gtempa}{}% + \rstyle} +\lstset{defaultdialect=[doc]Pascal,language=Pascal,style={}} \def\lstscanlanguages#1#2#3{% \begingroup \def\lst@DefDriver@##1##2##3##4[##5]##6{% @@ -202,12 +400,12 @@ \lst@PrintDialects@} \def\lst@PrintDialects@(#1),{% \ifx\relax#1\else - ,\lst@PrintDialect{#1}% + , \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 + \expandafter\ifx\csname\@lst dd@\lst@language\endcsname\lst@temp \texttt{\underbar{#1}}% \else \texttt{#1}% diff --git a/docs/styles/lstlang1.sty b/docs/styles/lstlang1.sty index 4b88b99d8c..082e87c6d8 100644 --- a/docs/styles/lstlang1.sty +++ b/docs/styles/lstlang1.sty @@ -6,8 +6,8 @@ %% %% lstdrvrs.dtx (with options: `lang1') %% -%% (w)(c) 1996/1997/1998/1999/2000 Carsten Heinz and/or any other author -%% listed elsewhere in this file. +%% (w)(c) 1996/1997/1998/1999/2000/2001/2002 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. @@ -15,13 +15,22 @@ %% %% This file is completely free and comes without any warranty. %% -%% 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 . %% +\ProvidesFile{lstlang1} + [2002/07/31 v1.0d listings language file] +%% +%% ACSL definition (c) 2000 by Andreas Matthias +%% +\lst@definelanguage{ACSL}[90]{Fortran}% + {morekeywords={algorithm,cinterval,constant,derivative,discrete,% + dynamic,errtag,initial,interval,maxterval,minterval,% + merror,xerror,nsteps,procedural,save,schedule,sort,% + table,terminal,termt,variable},% + sensitive=false,% + morecomment=[l]!% + }[keywords, comments]% %% %% Ada 95 definition (c) Torsten Neuer %% @@ -40,19 +49,154 @@ morestring=[m]",% percent not defined as stringizer so far morestring=[m]'% }[keywords,comments,strings]% -\lst@definelanguage[Visual]{C++}[ANSI]{C++}% +%% +%% Visual Basic definition (c) 2002 Robert Frank +%% +\lst@definelanguage[Visual]{Basic} + {morekeywords={Abs,Array,Asc,AscB,AscW,Atn,Avg,CBool,CByte,CCur,% + CDate,CDbl,Cdec,Choose,Chr,ChrB,ChrW,CInt,CLng,Command,Cos,% + Count,CreateObject,CSng,CStr,CurDir,CVar,CVDate,CVErr,Date,% + DateAdd,DateDiff,DatePart,DateSerial,DateValue,Day,DDB,Dir,% + DoEvents,Environ,EOF,Error,Exp,FileAttr,FileDateTime,FileLen,% + Fix,Format,FreeFile,FV,GetAllStrings,GetAttr,% + GetAutoServerSettings,GetObject,GetSetting,Hex,Hour,IIf,% + IMEStatus,Input,InputB,InputBox,InStr,InstB,Int,Integer,IPmt,% + IsArray,IsDate,IsEmpty,IsError,IsMissing,IsNull,IsNumeric,% + IsObject,LBound,LCase,Left,LeftB,Len,LenB,LoadPicture,Loc,LOF,% + Log,Ltrim,Max,Mid,MidB,Min,Minute,MIRR,Month,MsgBox,Now,NPer,% + NPV,Oct,Partition,Pmt,PPmt,PV,QBColor,Rate,RGB,Right,RightB,Rnd,% + Rtrim,Second,Seek,Sgn,Shell,Sin,SLN,Space,Spc,Sqr,StDev,StDevP,% + Str,StrComp,StrConv,String,Switch,Sum,SYD,Tab,Tan,Time,Timer,% + TimeSerial,TimeValue,Trim,TypeName,UBound,Ucase,Val,Var,VarP,% + VarType,Weekday,Year},% functions + morekeywords=[2]{Accept,Activate,Add,AddCustom,AddFile,AddFromFile,% + AddFromTemplate,AddItem,AddNew,AddToAddInToolbar,% + AddToolboxProgID,Append,AppendChunk,Arrange,Assert,AsyncRead,% + BatchUpdate,BeginTrans,Bind,Cancel,CancelAsyncRead,CancelBatch,% + CancelUpdate,CanPropertyChange,CaptureImage,CellText,CellValue,% + Circle,Clear,ClearFields,ClearSel,ClearSelCols,Clone,Close,Cls,% + ColContaining,ColumnSize,CommitTrans,CompactDatabase,Compose,% + Connect,Copy,CopyQueryDef,CreateDatabase,CreateDragImage,% + CreateEmbed,CreateField,CreateGroup,CreateIndex,CreateLink,% + CreatePreparedStatement,CreatePropery,CreateQuery,% + CreateQueryDef,CreateRelation,CreateTableDef,CreateUser,% + CreateWorkspace,Customize,Delete,DeleteColumnLabels,% + DeleteColumns,DeleteRowLabels,DeleteRows,DoVerb,Drag,Draw,Edit,% + EditCopy,EditPaste,EndDoc,EnsureVisible,EstablishConnection,% + Execute,ExtractIcon,Fetch,FetchVerbs,Files,FillCache,Find,% + FindFirst,FindItem,FindLast,FindNext,FindPrevious,Forward,% + GetBookmark,GetChunk,GetClipString,GetData,GetFirstVisible,% + GetFormat,GetHeader,GetLineFromChar,GetNumTicks,GetRows,% + GetSelectedPart,GetText,GetVisibleCount,GoBack,GoForward,Hide,% + HitTest,HoldFields,Idle,InitializeLabels,InsertColumnLabels,% + InsertColumns,InsertObjDlg,InsertRowLabels,InsertRows,Item,% + KillDoc,Layout,Line,LinkExecute,LinkPoke,LinkRequest,LinkSend,% + Listen,LoadFile,LoadResData,LoadResPicture,LoadResString,% + LogEvent,MakeCompileFile,MakeReplica,MoreResults,Move,MoveData,% + MoveFirst,MoveLast,MoveNext,MovePrevious,NavigateTo,NewPage,% + NewPassword,NextRecordset,OLEDrag,OnAddinsUpdate,OnConnection,% + OnDisconnection,OnStartupComplete,Open,OpenConnection,% + OpenDatabase,OpenQueryDef,OpenRecordset,OpenResultset,OpenURL,% + Overlay,PaintPicture,Paste,PastSpecialDlg,PeekData,Play,Point,% + PopulatePartial,PopupMenu,Print,PrintForm,PropertyChanged,Pset,% + Quit,Raise,RandomDataFill,RandomFillColumns,RandomFillRows,% + rdoCreateEnvironment,rdoRegisterDataSource,ReadFromFile,% + ReadProperty,Rebind,ReFill,Refresh,RefreshLink,RegisterDatabase,% + Reload,Remove,RemoveAddInFromToolbar,RemoveItem,Render,% + RepairDatabase,Reply,ReplyAll,Requery,ResetCustom,% + ResetCustomLabel,ResolveName,RestoreToolbar,Resync,Rollback,% + RollbackTrans,RowBookmark,RowContaining,RowTop,Save,SaveAs,% + SaveFile,SaveToFile,SaveToolbar,SaveToOle1File,Scale,ScaleX,% + ScaleY,Scroll,Select,SelectAll,SelectPart,SelPrint,Send,% + SendData,Set,SetAutoServerSettings,SetData,SetFocus,SetOption,% + SetSize,SetText,SetViewport,Show,ShowColor,ShowFont,ShowHelp,% + ShowOpen,ShowPrinter,ShowSave,ShowWhatsThis,SignOff,SignOn,Size,% + Span,SplitContaining,StartLabelEdit,StartLogging,Stop,% + Synchronize,TextHeight,TextWidth,ToDefaults,TwipsToChartPart,% + TypeByChartType,Update,UpdateControls,UpdateRecord,UpdateRow,% + Upto,WhatsThisMode,WriteProperty,ZOrder},% methods + morekeywords=[3]{AccessKeyPress,AfterAddFile,AfterChangeFileName,% + AfterCloseFile,AfterColEdit,AfterColUpdate,AfterDelete,% + AfterInsert,AfterLabelEdit,AfterRemoveFile,AfterUpdate,% + AfterWriteFile,AmbienChanged,ApplyChanges,Associate,% + AsyncReadComplete,AxisActivated,AxisLabelActivated,% + AxisLabelSelected,AxisLabelUpdated,AxisSelected,% + AxisTitleActivated,AxisTitleSelected,AxisTitleUpdated,% + AxisUpdated,BeforeClick,BeforeColEdit,BeforeColUpdate,% + BeforeConnect,BeforeDelete,BeforeInsert,BeforeLabelEdit,% + BeforeLoadFile,BeforeUpdate,ButtonClick,ButtonCompleted,% + ButtonGotFocus,ButtonLostFocus,Change,ChartActivated,% + ChartSelected,ChartUpdated,Click,ColEdit,Collapse,ColResize,% + ColumnClick,Compare,ConfigChageCancelled,ConfigChanged,% + ConnectionRequest,DataArrival,DataChanged,DataUpdated,DblClick,% + Deactivate,DeviceArrival,DeviceOtherEvent,DeviceQueryRemove,% + DeviceQueryRemoveFailed,DeviceRemoveComplete,DeviceRemovePending,% + DevModeChange,Disconnect,DisplayChanged,Dissociate,% + DoGetNewFileName,Done,DonePainting,DownClick,DragDrop,DragOver,% + DropDown,EditProperty,EnterCell,EnterFocus,Event,ExitFocus,% + Expand,FootnoteActivated,FootnoteSelected,FootnoteUpdated,% + GotFocus,HeadClick,InfoMessage,Initialize,IniProperties,% + ItemActivated,ItemAdded,ItemCheck,ItemClick,ItemReloaded,% + ItemRemoved,ItemRenamed,ItemSeletected,KeyDown,KeyPress,KeyUp,% + LeaveCell,LegendActivated,LegendSelected,LegendUpdated,% + LinkClose,LinkError,LinkNotify,LinkOpen,Load,LostFocus,% + MouseDown,MouseMove,MouseUp,NodeClick,ObjectMove,% + OLECompleteDrag,OLEDragDrop,OLEDragOver,OLEGiveFeedback,% + OLESetData,OLEStartDrag,OnAddNew,OnComm,Paint,PanelClick,% + PanelDblClick,PathChange,PatternChange,PlotActivated,% + PlotSelected,PlotUpdated,PointActivated,PointLabelActivated,% + PointLabelSelected,PointLabelUpdated,PointSelected,% + PointUpdated,PowerQuerySuspend,PowerResume,PowerStatusChanged,% + PowerSuspend,QueryChangeConfig,QueryComplete,QueryCompleted,% + QueryTimeout,QueryUnload,ReadProperties,Reposition,% + RequestChangeFileName,RequestWriteFile,Resize,ResultsChanged,% + RowColChange,RowCurrencyChange,RowResize,RowStatusChanged,% + SelChange,SelectionChanged,SendComplete,SendProgress,% + SeriesActivated,SeriesSelected,SeriesUpdated,SettingChanged,% + SplitChange,StateChanged,StatusUpdate,SysColorsChanged,% + Terminate,TimeChanged,TitleActivated,TitleSelected,% + TitleActivated,UnboundAddData,UnboundDeleteRow,% + UnboundGetRelativeBookmark,UnboundReadData,UnboundWriteData,% + Unload,UpClick,Updated,Validate,ValidationError,WillAssociate,% + WillChangeData,WillDissociate,WillExecute,WillUpdateRows,% + WithEvents,WriteProperties},% VB-events + morekeywords=[4]{AppActivate,Base,Beep,Call,Case,ChDir,ChDrive,% + Const,Declare,DefBool,DefByte,DefCur,DefDate,DefDbl,DefDec,% + DefInt,DefLng,DefObj,DefSng,DefStr,Deftype,DefVar,DeleteSetting,% + Dim,Do,Else,ElseIf,End,Enum,Erase,Event,Exit,Explicit,FileCopy,% + For,ForEach,Friend,Function,Get,GoSub,GoTo,If,Implements,Kill,% + Let,LineInput,Lock,Lset,MkDir,Name,Next,OnError,On,Option,% + Private,Property,Public,Put,RaiseEvent,Randomize,ReDim,Rem,% + Reset,Resume,Return,RmDir,Rset,SavePicture,SaveSetting,% + SendKeys,SetAttr,Static,Sub,Then,Type,Unlock,Wend,While,Width,% + With,Write},% statements + sensitive=false, + keywordcomment=rem,% + MoreSelectCharTable=\def\lst@BeginKC@{% chmod + \lst@ResetToken + \lst@BeginComment\lst@GPmode{{\lst@commentstyle}% + \lst@Lmodetrue\lst@modetrue}\@empty}% + morecomment=[l]{'}, + morecomment=[s]{/*}{*/}, + morestring=[b]", + }[keywords,comments,strings,keywordcomments] +\lst@definelanguage[ANSI]{C++}[ISO]{C++}{}% +\lst@definelanguage[GNU]{C++}[ISO]{C++}% + {morekeywords={__attribute__,__extension__,__restrict,__restrict__,% + typeof,__typeof__},% + }% +\lst@definelanguage[Visual]{C++}[ISO]{C++}% {morekeywords={__asm,__based,__cdecl,__declspec,dllexport,% dllimport,__except,__fastcall,__finally,__inline,__int8,__int16,% __int32,__int64,naked,__stdcall,thread,__try,__leave},% }% -\lst@definelanguage[ANSI]{C++}[ANSI]{C}% - {morekeywords={asm,bad_cast,bad_typeid,bool,catch,class,const_cast,% - delete,dynamic_cast,false,friend,inline,namespace,new,operator,% - private,protected,public,reinterpret_cast,static_cast,template,% - this,throw,true,try,type_info,typeid,using,virtual,xalloc,% - __multiple_inheritance,__single_inheritance,% - __virtual_inheritance},% - morecomment=[l]//% +\lst@definelanguage[ISO]{C++}[ANSI]{C}% + {morekeywords={and,and_eq,asm,bad_cast,bad_typeid,bitand,bitor,bool,% + catch,class,compl,const_cast,delete,dynamic_cast,explicit,export,% + false,friend,inline,mutable,namespace,new,not,not_eq,operator,or,% + or_eq,private,protected,public,reinterpret_cast,static_cast,% + template,this,throw,true,try,typeid,type_info,typename,using,% + virtual,wchar_t,xor,xor_eq},% }% %% %% Objective-C definition (c) 1997 Detlev Droege @@ -62,7 +206,6 @@ {morekeywords={bycopy,id,in,inout,oneway,out,self,super,% @class,@defs,@encode,@end,@implementation,@interface,@private,% @protected,@protocol,@public,@selector},% - morecomment=[l]//,% moredirectives={import}% }% \lst@definelanguage[ANSI]{C}% @@ -72,12 +215,30 @@ void,volatile,while},% sensitive,% morecomment=[s]{/*}{*/},% + morecomment=[l]//,% nonstandard morestring=[b]",% morestring=[b]',% moredirectives={define,elif,else,endif,error,if,ifdef,ifndef,line,% include,pragma,undef,warning}% }[keywords,comments,strings,directives]% %% +%% C-Sharp definition (c) 2002 Martin Brodbeck +%% +\lst@definelanguage[Sharp]{C}% + {morekeywords={abstract,base,bool,break,byte,case,catch,char,checked,% + class,const,continue,decimal,default,delegate,do,double,else,% + enum,event,explicit,extern,false,finally,fixed,float,for,foreach,% + goto,if,implicit,in,int,interface,internal,is,lock,long,% + namespace,new,null,object,operator,out,override,params,private,% + protected,public,readonly,ref,return,sbyte,sealed,short,sizeof,% + static,string,struct,switch,this,throw,true,try,typeof,uint,% + ulong,unchecked,unsafe,ushort,using,virtual,void,while},% + sensitive,% + morecomment=[s]{/*}{*/},% + morecomment=[l]//,% + morestring=[b]" + }[keywords,comments,strings]% +%% %% csh definition (c) 1998 Kai Below %% \lst@definelanguage{csh} @@ -92,7 +253,7 @@ }[keywords,comments,strings]% \lst@definelanguage[90]{Fortran}[95]{Fortran}{} \lst@definelanguage[95]{Fortran}[77]{Fortran}% - {deletekeywords=SAVE, + {deletekeywords=SAVE,% morekeywords={ACTION,ADVANCE,ALLOCATE,ALLOCATABLE,ASSIGNMENT,CASE,% CONTAINS,CYCLE,DEALLOCATE,DEFAULT,DELIM,EXIT,INCLUDE,IN,NONE,IN,% OUT,INTENT,INTERFACE,IOLENGTH,KIND,LEN,MODULE,NAME,NAMELIST,NMT,% @@ -102,8 +263,8 @@ ENDBLOCKDATA,ENDDO,ENDFILE,ENDFUNCTION,ENDIF,ENDINTERFACE,% ENDMODULE,ENDPROGRAM,ENDSELECT,ENDSUBROUTINE,ENDTYPE,ENDWHERE,% GOTO,INOUT,SELECTCASE},% - morecomment=[l]!,% - deletecomment=[f]% no fixed comment line: 1998 Magne Rudshaug + deletecomment=[f],% no fixed comment line: 1998 Magne Rudshaug + morecomment=[l]!% }% \lst@definelanguage[77]{Fortran}% {morekeywords={ACCESS,ASSIGN,BACKSPACE,BLANK,BLOCK,CALL,CHARACTER,% @@ -115,7 +276,9 @@ RETURN,REWIND,SEQUENTIAL,STATUS,STOP,SUBROUTINE,THEN,TYPE,% UNFORMATTED,UNIT,WRITE,SAVE},% sensitive=f,%% not Fortran standard %% - morecomment=[f]*Cc,% + morecomment=[f]*,% + morecomment=[f]C,% + morecomment=[f]c,% morestring=[d]"% }[keywords,comments,strings]% \lst@definelanguage{HTML}% @@ -133,19 +296,21 @@ sensitive=f,% morestring=[d]",% ??? doubled MoreSelectCharTable=% - \lst@CArgX--\relax\lst@CommentB\lst@GPmode{}{}% + \lst@CArgX--\relax\lst@DefDelimB{}{}% {\ifnum\lst@mode=\lst@insidemode\else \expandafter\@gobblethree - \fi}\lst@commentstyle - \lst@CArgX--\relax\lst@CommentE\lst@GPmode{}{}{}% + \fi}% + \lst@BeginComment\lst@commentmode{{\lst@commentstyle}}% + \lst@CArgX--\relax\lst@DefDelimE{}{}{}% + \lst@EndComment\lst@commentmode }[keywords,comments,strings,html]% \lst@definelanguage{Java}% {morekeywords={abstract,boolean,break,byte,case,catch,char,class,% - const,continue,default,do,double,else,extends,final,finally,% - float,for,goto,if,implements,import,instanceof,int,interface,% - long,native,new,null,package,private,protected,public,return,% - short,static,super,switch,synchronized,this,throw,throws,% - transient,try,void,volatile,while,true,false},% + const,continue,default,do,double,else,extends,false,final,% + finally,float,for,goto,if,implements,import,instanceof,int,% + interface,label,long,native,new,null,package,private,protected,% + public,return,short,static,super,switch,synchronized,this,throw,% + throws,transient,true,try,void,volatile,while},% sensitive,% morecomment=[l]//,% morecomment=[s]{/*}{*/},% @@ -378,6 +543,84 @@ morecomment=[s]{(*}{*)},% morestring=[d]"% }[keywords,comments,strings]% +%% +%% Octave definition (c) 2001,2002 Ulrich G. Wortmann +%% +%% +\lst@definelanguage{Octave}% + {morekeywords={gt,lt,gt,lt,amp,abs,acos,acosh,acot,acoth,acsc,acsch,% + all,angle,ans,any,asec,asech,asin,asinh,atan,atan2,atanh,auread,% + auwrite,axes,axis,balance,bar,bessel,besselk,bessely,beta,% + betainc,betaln,blanks,bone,break,brighten,capture,cart2pol,% + cart2sph,caxis,cd,cdf2rdf,cedit,ceil,chol,cla,clabel,clc,clear,% + clf,clock,close,colmmd,Colon,colorbar,colormap,ColorSpec,colperm,% + comet,comet3,compan,compass,computer,cond,condest,conj,contour,% + contour3,contourc,contrast,conv,conv2,cool,copper,corrcoef,cos,% + cosh,cot,coth,cov,cplxpair,cputime,cross,csc,csch,csvread,% + csvwrite,cumprod,cumsum,cylinder,date,dbclear,dbcont,dbdown,% + dbquit,dbstack,dbstatus,dbstep,dbstop,dbtype,dbup,ddeadv,ddeexec,% + ddeinit,ddepoke,ddereq,ddeterm,ddeunadv,deblank,dec2hex,deconv,% + del2,delete,demo,det,diag,diary,diff,diffuse,dir,disp,dlmread,% + dlmwrite,dmperm,dot,drawnow,echo,eig,ellipj,ellipke,else,elseif,% + end,engClose,engEvalString,engGetFull,engGetMatrix,engOpen,% + engOutputBuffer,engPutFull,engPutMatrix,engSetEvalCallback,% + engSetEvalTimeout,engWinInit,eps,erf,erfc,erfcx,erfinv,% + errorbar,etime,etree,eval,exist,exp,expint,expm,expo,eye,fclose,% + feather,feof,ferror,feval,fft,fft2,fftshift,fgetl,fgets,figure,% + fill,fill3,filter,filter2,find,findstr,finite,fix,flag,fliplr,% + flipud,floor,flops,fmin,fmins,fopen,for,format,fplot,fprintf,% + fread,frewind,fscanf,fseek,ftell,full,function,funm,fwrite,fzero,% + gallery,gamma,gammainc,gammaln,gca,gcd,gcf,gco,get,getenv,% + getframe,ginput,global,gplot,gradient,gray,graymon,grid,griddata,% + gtext,hadamard,hankel,help,hess,hex2dec,hex2num,hidden,hilb,hist,% + hold,home,hostid,hot,hsv,hsv2rgb,if,ifft,ifft2,imag,image,% + imagesc,Inf,info,input,int2str,interp1,interp2,interpft,inv,% + invhilb,isempty,isglobal,ishold,isieee,isinf,isletter,isnan,% + isreal,isspace,issparse,isstr,jet,keyboard,kron,lasterr,lcm,% + legend,legendre,length,lin2mu,line,linspace,load,log,log10,log2,% + loglog,logm,logspace,lookfor,lower,ls,lscov,lu,magic,matClose,% + matDeleteMatrix,matGetDir,matGetFp,matGetFull,matGetMatrix,% + matGetNextMatrix,matGetString,matlabrc,matlabroot,matOpen,% + matPutFull,matPutMatrix,matPutString,max,mean,median,menu,mesh,% + meshc,meshgrid,meshz,mexAtExit,mexCallMATLAB,mexdebug,% + mexErrMsgTxt,mexEvalString,mexFunction,mexGetFull,mexGetMatrix,% + mexGetMatrixPtr,mexPrintf,mexPutFull,mexPutMatrix,mexSetTrapFlag,% + min,more,movie,moviein,mu2lin,mxCalloc,mxCopyCharacterToPtr,% + mxCopyComplex16ToPtr,mxCopyInteger4ToPtr,mxCopyPtrToCharacter,% + mxCopyPtrToComplex16,mxCopyPtrToInteger4,mxCopyPtrToReal8,% + mxCopyReal8ToPtr,mxCreateFull,mxCreateSparse,mxCreateString,% + mxFree,mxFreeMatrix,mxGetIr,mxGetJc,mxGetM,mxGetN,mxGetName,% + mxGetNzmax,mxGetPi,mxGetPr,mxGetScalar,mxGetString,mxIsComplex,% + mxIsFull,mxIsNumeric,mxIsSparse,mxIsString,mxIsTypeDouble,% + mxSetIr,mxSetJc,mxSetM,mxSetN,mxSetName,mxSetNzmax,mxSetPi,% + mxSetPr,NaN,nargchk,nargin,nargout,newplot,nextpow2,nnls,nnz,% + nonzeros,norm,normest,null,num2str,nzmax,ode23,ode45,orient,orth,% + pack,pascal,patch,path,pause,pcolor,pi,pink,pinv,plot,plot3,% + pol2cart,polar,poly,polyder,polyeig,polyfit,polyval,polyvalm,% + pow2,print,printopt,prism,prod,pwd,qr,qrdelete,qrinsert,quad,% + quad8,quit,quiver,qz,rand,randn,randperm,rank,rat,rats,rbbox,% + rcond,real,realmax,realmin,refresh,rem,reset,reshape,residue,% + return,rgb2hsv,rgbplot,rootobject,roots,rose,rosser,rot90,rotate,% + round,rref,rrefmovie,rsf2csf,save,saxis,schur,sec,sech,semilogx,% + semilogy,set,setstr,shading,sign,sin,sinh,size,slice,sort,sound,% + spalloc,sparse,spaugment,spconvert,spdiags,specular,speye,spfun,% + sph2cart,sphere,spinmap,spline,spones,spparms,sprandn,sprandsym,% + sprank,sprintf,spy,sqrt,sqrtm,sscanf,stairs,startup,std,stem,% + str2mat,str2num,strcmp,strings,strrep,strtok,subplot,subscribe,% + subspace,sum,surf,surface,surfc,surfl,surfnorm,svd,symbfact,% + symmmd,symrcm,tan,tanh,tempdir,tempname,terminal,text,tic,title,% + toc,toeplitz,trace,trapz,tril,triu,type,uicontrol,uigetfile,% + uimenu,uiputfile,unix,unwrap,upper,vander,ver,version,view,% + viewmtx,waitforbuttonpress,waterfall,wavread,wavwrite,what,% + whatsnew,which,while,white,whitebg,who,whos,wilkinson,wk1read,% + stderr,stdout,plot,set,endif,wk1write,xlabel,xor,ylabel,zeros,% + zlabel,zoom,endwhile,endfunction},% + sensitive=f,% + morecomment=[l]\#,% + morecomment=[l]\#\#,% + morestring=[m]',% + morestring=[m]"% + }[keywords,comments,strings]% \lst@definelanguage[XSC]{Pascal}[Standard]{Pascal} {deletekeywords={alfa,byte,pack,unpack},% 1998 Andreas Stephan morekeywords={dynamic,external,forward,global,module,nil,operator,% @@ -431,7 +674,8 @@ text,then,to,true,type,unpack,until,var,while,with,write,% writeln},% sensitive=f,% - morecomment=[d]{(*}{*)}{\{}{\}},% + morecomment=[s]{(*}{*)},% + morecomment=[s]{\{}{\}},% morestring=[d]'% }[keywords,comments,strings]% \lst@definelanguage{Perl}% @@ -468,7 +712,8 @@ \lst@ReplaceInput{\$\#}{\lst@ProcessOther\$\lst@ProcessOther\#}% }[keywords,comments,strings]% %% -%% POV definition (c) 1999 Berthold Höllmann +%% POV definition (c) 1999 Berthold H\"ollmann +%% %% \lst@definelanguage{POV}% {morekeywords={abs,absorption,acos,acosh,adaptive,adc_bailout,agate,% @@ -538,16 +783,18 @@ sensitive=true,% morecomment=[l]\#,% morecomment=[s]{'''}{'''},% used for documentation text - morestring=',% - morestring="% + morecomment=[s]{"""}{"""},% added by Philipp Matthias Hahn + morestring=[b]',% + morestring=[b]"% }% %% %% SQL definition (c) 1998 Christian Haul %% +%% and (c) 2002 Neil Conway %% \lst@definelanguage{SQL}% - {morekeywords={ABSOLUTE,ACTION,ADD,ALLOCATE,ALTER,ARE,ASSERTION,AT,% - BETWEEN,BIT,BIT_LENGTH,BOTH,BY,CASCADE,CASCADED,CASE,CAST,% + {morekeywords={ABSOLUTE,ACTION,ADD,ALLOCATE,ALTER,ARE,AS,ASSERTION,% + AT,BETWEEN,BIT,BIT_LENGTH,BOTH,BY,CASCADE,CASCADED,CASE,CAST,% CATALOG,CHAR,CHAR_LENGTH,CHARACTER_LENGTH,CLUSTER,COALESCE,% COLLATE,COLLATION,COLUMN,CONNECT,CONNECTION,CONSTRAINT,% CONSTRAINTS,CONVERT,CORRESPONDING,CREATE,CROSS,CURRENT_DATE,% @@ -556,16 +803,17 @@ DISCONNECT,DOMAIN,DROP,ELSE,END,EXEC,EXCEPT,EXCEPTION,EXECUTE,% EXTERNAL,EXTRACT,FALSE,FIRST,FLOAT,FOREIGN,FROM,FULL,GET,GLOBAL,% GRAPHIC,HAVING,HOUR,IDENTITY,IMMEDIATE,INDEX,INITIALLY,INNER,% - INPUT,INSENSITIVE,INT,INTEGER,INTERSECT,INTERVAL,ISOLATION,JOIN,% - KEY,LAST,LEADING,LEFT,LEVEL,LOCAL,LOWER,MATCH,MINUTE,MONTH,NAMES,% - NATIONAL,NATURAL,NCHAR,NEXT,NO,NOT,NULL,NULLIF,OCTET_LENGTH,ON,% - ONLY,ORDERED,OUTER,OUTPUT,OVERLAPS,PAD,PARTIAL,POSITION,PREPARE,% - PRESERVE,PRIMARY,PRIOR,READ,RELATIVE,RESTRICT,REVOKE,RIGHT,ROWS,% - SCROLL,SECOND,SELECT,SESSION,SESSION_USER,SIZE,SMALLINT,SPACE,% - SQLSTATE,SUBSTRING,SYSTEM_USER,TABLE,TEMPORARY,THEN,TIME,% - TIMESTAMP,TIMEZONE_HOUR,TIMEZONE_MINUTE,TRAILING,TRANSACTION,% - TRANSLATE,TRANSLATION,TRIM,TRUE,UNIQUE,UNKNOWN,UPPER,USAGE,USING,% - VALUE,VARCHAR,VARGRAPHIC,VARYING,WHEN,WHERE,WRITE,YEAR,ZONE},% + INPUT,INSENSITIVE,INSERT,INT,INTO,INTEGER,INTERSECT,INTERVAL,% + ISOLATION,JOIN,KEY,LAST,LEADING,LEFT,LEVEL,LIMIT,LOCAL,LOWER,% + MATCH,MINUTE,MONTH,NAMES,NATIONAL,NATURAL,NCHAR,NEXT,NO,NOT,NULL,% + NULLIF,OCTET_LENGTH,ON,ONLY,ORDER,ORDERED,OUTER,OUTPUT,OVERLAPS,% + PAD,PARTIAL,POSITION,PREPARE,PRESERVE,PRIMARY,PRIOR,READ,% + RELATIVE,RESTRICT,REVOKE,RIGHT,ROWS,SCROLL,SECOND,SELECT,SESSION,% + SESSION_USER,SIZE,SMALLINT,SPACE,SQLSTATE,SUBSTRING,SYSTEM_USER,% + TABLE,TEMPORARY,THEN,TIME,TIMESTAMP,TIMEZONE_HOUR,% + TIMEZONE_MINUTE,TRAILING,TRANSACTION,TRANSLATE,TRANSLATION,TRIM,% + TRUE,UNIQUE,UNKNOWN,UPPER,USAGE,USING,VALUE,VALUES,VARCHAR,% + VARGRAPHIC,VARYING,WHEN,WHERE,WRITE,YEAR,ZONE},% sensitive,% morecomment=[l]--,% morecomment=[s]{/*}{*/},% @@ -590,6 +838,45 @@ morecomment=[l]--,% morestring=[d]{"}% }[keywords,comments,strings]% +%% +%% VHDL-AMS definition (c) Steffen Klupsch +%% +\lst@definelanguage[AMS]{VHDL}[]{VHDL}% + {morekeywords={ACROSS,ARRAY,BREAK,DISCONNECT,NATURE,NOISE,PORT,% + PROCEDURAL,QUANTITY,SHARED,SPECTRUM,SUBNATURE,TERMINAL,THROUGH,% + TOLERANCE,UNAFFACTED,UNITS}} +\lst@definelanguage{XML}% + {keywords={,CDATA,DOCTYPE,ATTLIST,termdef,ELEMENT,EMPTY,ANY,ID,% + IDREF,IDREFS,ENTITY,ENTITIES,NMTOKEN,NMTOKENS,NOTATION,% + INCLUDE,IGNORE,SYSTEM,PUBLIC,NDATA,PUBLIC,% + PCDATA,REQUIRED,IMPLIED,FIXED,%%% preceded by # + xml,xml:space,xml:lang,version,standalone,default,preserve},% + alsoother=$,% + alsoletter=:,% + keywordsinside=<>,% + morestring=[d]",% ??? doubled + morestring=[d]',% ??? doubled + MoreSelectCharTable=% + \lst@CArgX--\relax\lst@DefDelimB{}{}% + {\ifnum\lst@mode=\lst@insidemode\else + \expandafter\@gobblethree + \fi}% + \lst@BeginComment\lst@commentmode{{\lst@commentstyle}}% + \lst@CArgX--\relax\lst@DefDelimE{}{}{}% + \lst@EndComment\lst@commentmode + \lst@CArgX[CDATA[\relax\lst@CDef{}% + {\ifnum\lst@mode=\lst@insidemode + \expandafter\lst@BeginCDATA + \else \expandafter\lst@CArgEmpty + \fi}% + \@empty + \lst@CArgX]]\relax\lst@CDef{}% + {\ifnum\lst@mode=\lst@GPmode + \expandafter\lst@EndComment + \else \expandafter\lst@CArgEmpty + \fi}% + \@empty + }[keywords,comments,strings,html]% \endinput %% %% End of file `lstlang1.sty'. diff --git a/docs/styles/lstlang2.sty b/docs/styles/lstlang2.sty index a226f4c690..6aed9ba8f6 100644 --- a/docs/styles/lstlang2.sty +++ b/docs/styles/lstlang2.sty @@ -6,8 +6,8 @@ %% %% lstdrvrs.dtx (with options: `lang2') %% -%% (w)(c) 1996/1997/1998/1999/2000 Carsten Heinz and/or any other author -%% listed elsewhere in this file. +%% (w)(c) 1996/1997/1998/1999/2000/2001/2002 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. @@ -15,23 +15,29 @@ %% %% This file is completely free and comes without any warranty. %% -%% 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 . %% +\ProvidesFile{lstlang2} + [2002/07/31 v1.0d listings language file] %% %% Abap definition by Knut Lickert %% +%%%%knut>>>>>new +\lst@definelanguage[R/3 6.10]{ABAP}[R/3 4.6C]{ABAP}% + {morekeywords={try,endtry},% + }[keywords,comments,strings] +%%%%knut<<<<}{{$\to$}}1,% + {morekeywords={method,ref,class,create,object,% + catch,system-exceptions,endcatch,%knut + },% + literate={->}{{$\rightarrow$}}1{=>}{{$\Rightarrow$}}1,%knut }[keywords,comments,strings] \lst@definelanguage[R/3 3.1]{ABAP}[R/2 5.0]{ABAP}{}% \lst@definelanguage[R/2 5.0]{ABAP}% {sensitive=f,% + procnamekeys={report,program,form,function},% morekeywords={*,add,after,alias,analyzer,and,append,area,assign,at,% authority-check,before,binary,blank,break-point,calendar,call,% case,change,changing,check,clear,cnt,co,collect,commit,common,% @@ -58,9 +64,10 @@ text,time,to,top-of-page,trace,transaction,transfer,% transfer-dynpro,translate,type,unpack,update,user-command,% using,value,when,where,while,window,with,workfile,write,},% - morecomment=[l]",% - morecomment=[f][0]*,% - }[keywords,comments,strings] + morecomment=[l]",% + morecomment=[f][0]*,% + morestring=[d]'% + }[keywords,comments,strings,procnames] \lst@definelanguage[R/2 4.3]{ABAP}[R/2 5.0]{ABAP}% {deletekeywords={function,importing,exporting,changing,exceptions,% raise,raising}% @@ -161,8 +168,9 @@ TERMINATE,TEXT,THAN,THROUGH,THRU,TIME,TIMES,TO,TOP,TRAILING,TYPE,% UNIT,UNSTRING,UNTIL,UP,UPON,USAGE,USE,USING,VALUE,VALUES,VARYING,% WHEN,WITH,WORDS,WORKING-STORAGE,WRITE,ZERO,ZEROES,ZEROS},% + alsodigit=-%, sensitive=f,% ??? - morecomment=[f][6]*,% + morecomment=[f][commentstyle][6]*,% morestring=[d]"% ??? doubled }[keywords,comments,strings]% \lst@definelanguage{Delphi}% @@ -207,7 +215,9 @@ TrackCursor,Trunc,Truncate,TypeOf,UpCase,UpperCase,Val,WhereX,% WhereY,Write,WriteBuf,WriteChar,Writeln},% sensitive=f,% - morecomment=[d]{(*}{*)}{\{}{\}},% + morecomment=[s]{(*}{*)},% + morecomment=[s]{\{}{\}},% + morecomment=[l]{//},% 2001 Christian Gudrian morestring=[d]'% }[keywords,comments,strings]% \lst@definelanguage{Eiffel}% @@ -222,7 +232,6 @@ sensitive,% morecomment=[l]--,% morestring=[d]",% - stringtest=false% }[keywords,comments,strings]% %% %% Euphoria definition (c) 1998 Detlef Reimers @@ -250,7 +259,7 @@ %% \lst@definelanguage{Haskell}% {otherkeywords={=>},% - keywords={abstype,if,then,else,case,class,data,default,deriving,% + morekeywords={abstype,if,then,else,case,class,data,default,deriving,% hiding,if,in,infix,infixl,infixr,import,instance,let,module,% newtype,of,qualified,type,where,do,AbsoluteSeek,AppendMode,% Array,BlockBuffering,Bool,BufferMode,Char,Complex,Double,Either,% @@ -318,7 +327,7 @@ sensitive,% morecomment=[l]--,% morecomment=[n]{\{-}{-\}},% - morestrings=[b]"% + morestring=[b]"% }[keywords,comments,strings]% %% %% IDL definition (c) 1998 Juergen Heim @@ -378,10 +387,106 @@ morestring=[b]"% }[keywords,comments,strings]% %% +%% AutoLISP/VisualLISP - Stefan Lagotzki, info@lagotzki.de +%% +\lst@definelanguage[Auto]{Lisp}% + {morekeywords={abs,acad_colordlg,acad_helpdlg,acad_strlsort,% + action_tile,add_list,alert,alloc,and,angle,angtof,angtos,append,% + apply,arx,arxload,arxunload,ascii,assoc,atan,atof,atoi,atom,% + atoms-family,autoarxload,autoload,Boole,boundp,caddr,cadr,car,% + cdr,chr,client_data_tile,close,command,cond,cons,cos,cvunit,% + defun,defun-q,defun-q-list-ref,defun-q-list-set,dictadd,dictnext,% + dictremove,dictrename,dictsearch,dimx_tile,dimy_tile,distance,% + distof,done_dialog,end_image,end_list,entdel,entget,entlast,% + entmake,entmakex,entmod,entnext,entsel,entupd,eq,equal,*error*,% + eval,exit,exp,expand,expt,fill_image,findfile,fix,float,foreach,% + function,gc,gcd,get_attr,get_tile,getangle,getcfg,getcname,% + getcorner,getdist,getenv,getfiled,getint,getkword,getorient,% + getpoint,getreal,getstring,getvar,graphscr,grclear,grdraw,grread,% + grtext,grvecs,handent,help,if,initdia,initget,inters,itoa,lambda,% + last,layoutlist,length,list,listp,load,load_dialog,log,logand,% + logior,lsh,mapcar,max,mem,member,menucmd,menugroup,min,minusp,% + mode_tile,namedobjdict,nentsel,nentselp,new_dialog,not,nth,% + null,numberp,open,or,osnap,polar,prin1,princ,print,progn,prompt,% + quit,quote,read,read-char,read-line,redraw,regapp,rem,repeat,% + reverse,rtos,set,set_tile,setcfg,setenv,setfunhelp,setq,% + setvar,setview,sin,slide_image,snvalid,sqrt,ssadd,ssdel,ssget,% + ssgetfirst,sslength,ssmemb,ssname,ssnamex,sssetfirst,startapp,% + start_dialog,start_image,start_list,strcase,strcat,strlen,subst,% + substr,tablet,tblnext,tblobjname,tblsearch,term_dialog,terpri,% + textbox,textpage,textscr,trace,trans,type,unload_dialog,untrace,% + vector_image,ver,vl-acad-defun,vl-acad-undefun,vl-arx-import,% + vl-bb-ref,vl-bb-set,vl-catch-all-apply,% + vl-catch-all-error-message,vl-catch-all-error-p,vl-cmdf,vl-consp,% + vl-directory-files,vl-doc-export,vl-doc-import,vl-doc-ref,% + vl-doc-set,vl-every,vl-exit-with-error,vl-exit-with-value,% + vl-file-copy,vl-file-delete,vl-file-directory-p,vl-file-rename,% + vl-file-size,vl-file-systime,vl-filename-base,% + vl-filename-directory,vl-filename-extension,vl-filename-mktemp,% + vl-get-resource,vl-list*,vl-list->string,% + vl-list-exported-functions,vl-list-length,vl-list-loaded-vlx,% + vl-load-all,vl-load-com,vl-load-reactors,vl-member-if,% + vl-member-if-not,vl-position,vl-prin1-to-string,% + vl-princ-to-string,vl-propagate,vl-registry-delete,% + vl-registry-descendents,vl-registry-read,vl-registry-write,% + vl-remove,vl-remove-if,vl-remove-if-not,vl-some,vl-sort,% + vl-sort-i,vl-string->list,vl-string-elt,vl-string-left-trim,% + vl-string-mismatch,vl-string-position,vl-string-right-trim,% + vl-string-search,vl-string-subst,vl-string-translate,% + vl-string-trim,vl-symbol-name,vl-symbol-value,vl-symbolp,% + vl-unload-vlx,vl-vbaload,vl-vbarun,vl-vlx-loaded-p,vlax-3D-point,% + vlax-add-cmd,vlax-create-object,vlax-curve-getArea,% + vlax-curve-getDistAtParam,vlax-curve-getDistAtPoint,% + vlax-curve-getEndParam,vlax-curve-getEndPoint,% + vlax-curve-getParamAtDist,vlax-curve-getParamAtPoint,% + vlax-curve-getPointAtDist,vlax-curve-getPointAtParam,% + vlax-curve-getStartParam,vlax-curve-getStartPoint,% + vlax-curve-isClosed,vlax-curve-isPeriodic,vlax-curve-isPlanar,% + vlax-curve-getClosestPointTo,% + vlax-curve-getClosestPointToProjection,vlax-curve-getFirstDeriv,% + vlax-curve-getSecondDeriv,vlax-dump-object,% + vlax-ename->vla-object,vlax-erased-p,vlax-for,% + vlax-get-acad-object,vlax-get-object,vlax-get-or-create-object,% + vlax-get-property,vlax-import-type-library,vlax-invoke-method,% + vlax-ldata-delete,vlax-ldata-get,vlax-ldata-list,vlax-ldata-put,% + vlax-ldata-test,vlax-make-safearray,vlax-make-variant,% + vlax-map-collection,vlax-method-applicable-p,% + vlax-object-released-p,vlax-product-key,% + vlax-property-available-p,vlax-put-property,vlax-read-enabled-p,% + vlax-release-object,vlax-remove-cmd,vlax-safearray-fill,% + vlax-safearray-get-dim,vlax-safearray-get-element,% + vlax-safearray-get-l-bound,vlax-safearray-get-u-bound,% + vlax-safearray-put-element,vlax-safearray-type,% + vlax-safearray->list,vlax-tmatrix,vlax-typeinfo-available-p,% + vlax-variant-change-type,vlax-variant-type,vlax-variant-value,% + vlax-vla-object->ename,vlax-write-enabled-p,vlisp-compile,% + vlr-acdb-reactor,vlr-add,vlr-added-p,vlr-beep-reaction,% + vlr-command-reactor,vlr-current-reaction-name,vlr-data,% + vlr-data-set,vlr-deepclone-reactor,vlr-docmanager-reactor,% + vlr-dwg-reactor,vlr-dxf-reactor,vlr-editor-reactor,% + vlr-insert-reactor,vlr-linker-reactor,vlr-lisp-reactor,% + vlr-miscellaneous-reactor,vlr-mouse-reactor,vlr-notification,% + vlr-object-reactor,vlr-owner-add,vlr-owner-remove,vlr-owners,% + vlr-pers,vlr-pers-list,vlr-pers-p,vlr-pers-release,% + vlr-reaction-names,vlr-reaction-set,vlr-reactions,vlr-reactors,% + vlr-remove,vlr-remove-all,vlr-set-notification,% + vlr-sysvar-reactor,vlr-toolbar-reactor,vlr-trace-reaction,% + vlr-type,vlr-types,vlr-undo-reactor,vlr-wblock-reactor,% + vlr-window-reactor,vlr-xref-reactor,vports,wcmatch,while,% + write-char,write-line,xdroom,xdsize,zerop},% + alsodigit=->,% + otherkeywords={1+,1-},% + sensitive=false,% + morecomment=[l];,% + morecomment=[l];;,% + morestring=[b]"% + }[keywords,comments,strings]% +%% %% Make definitions (c) 2000 Rolf Niepraschk %% \lst@definelanguage[gnu]{make}% {morekeywords={SHELL,MAKE,MAKEFLAGS,$@,$\%,$<,$?,$^,$+,$*,% + @,^,<,\%,+,?,*,% Markus Pahlow export,unexport,include,override,define,ifdef,ifneq,ifeq,else,% endif,vpath,subst,patsubst,strip,findstring,filter,filter-out,% sort,dir,notdir,suffix,basename,addsuffix,addprefix,join,word,% @@ -393,29 +498,37 @@ ARFLAGS,ASFLAGS,CFLAGS,CXXFLAGS,COFLAGS,CPPFLAGS,FFLAGS,GFLAGS,% LDFLAGS,LOADLIBES,LFLAGS,PFLAGS,RFLAGS,YFLAGS,M2FLAGS,MODFLAGS,% LINTFLAGS,MAKEINFO_FLAGS,TEXI2DVI_FLAGS,COFLAGS,GFLAGS,% - OUTPUT_OPTION,SCCS_OUTPUT_OPTION% + OUTPUT_OPTION,SCCS_OUTPUT_OPTION,% missing comma: Markus Pahlow .PHONY,.SUFFIXES,.DEFAULT,.PRECIOUS,.INTERMEDIATE,.SECONDARY,% .IGNORE,.SILENT,.EXPORT_ALL_VARIABLES,MAKEFILES,VPATH,MAKESHELL,% MAKELEVEL,MAKECMDGOALS,SUFFIXES},% sensitive=true, morecomment=[l]\#,% - morestring="% + morestring=[b]"% }[keywords,comments,strings,make]% \lst@definelanguage{make} {morekeywords={SHELL,MAKE,MAKEFLAGS,$@,$\%,$<,$?,$^,$+,$*},% sensitive=true,% morecomment=[l]\#,% - morestring="% + morestring=[b]"% }[keywords,comments,strings,make]% %% %% Mercury definition (c) 1997 Dominique de Waleffe +%% Extended (c) 2001 Ralph Becket %% \lst@definelanguage{Mercury}% - {otherkeywords={::,->,-->,--->,:-},% - morekeywords={pred,type,module,end_module,import_module,mode,% - pragma,func,lambda,det,semidet,erroneous,multi,true,fail,is,in,% - out,di,uo,ui,interface,implementation},% - sensitive=f,% + {otherkeywords={::,->,-->,--->,:-,==,=>,<=,<=>},% + morekeywords={module,include_module,import_module,interface,% + end_module,implementation,mode,is,failure,semidet,nondet,det,% + multi,erroneous,inst,in,out,di,uo,ui,type,typeclass,instance,% + where,with_type,pred,func,lambda,impure,semipure,if,then,else,% + some,all,not,true,fail,pragma,memo,no_inline,inline,loop_check,% + minimal_model,fact_table,type_spec,terminates,does_not_terminate,% + check_termination,promise_only_solution,unsafe_promise_unique,% + source_file,obsolete,import,export,c_header_code,c_code,% + foreign_code,foreign_proc,may_call_mercury,will_not_call_mercury,% + thread_safe,not_thread_safe},% + sensitive=t,% morecomment=[l]\%,% morecomment=[s]{/*}{*/},% morestring=[bd]",% @@ -457,6 +570,510 @@ morestring=[d]"% }[keywords,comments,strings]% %% +%% PHP definition by Luca Balzerani, +%% +\lst@definelanguage{PHP}% + {morekeywords={% + abs,acos,acosh,addcslashes,addslashes,apache_child_terminate,% + apache_note,apache_setenv,array_change_key_case,array_chunk,% + array_diff,array_fill,array_filter,array_flip,array_intersect,% + array_keys,array_map,array_merge_recursive,array_merge,% + array_pad,array_pop,array_push,array_rand,array_reduce,% + array_search,array_shift,array_slice,array_splice,array_sum,% + array_unshift,array_values,array_walk,array,arsort,ascii2ebcdic,% + asinh,asort,aspell_check_raw,aspell_check,aspell_new,% + assert_options,assert,atan,atan2,atanh,base_convert,% + base64_encode,basename,bcadd,bccomp,bcdiv,bcmod,bcmul,bcpow,% + bcsqrt,bcsub,bin2hex,bind_textdomain_codeset,bindec,% + bzclose,bzcompress,bzdecompress,bzerrno,bzerror,bzerrstr,% + bzopen,bzread,bzwrite,cal_days_in_month,cal_from_jd,cal_info,% + call_user_func_array,call_user_func,call_user_method_array,% + ccvs_add,ccvs_auth,ccvs_command,ccvs_count,ccvs_delete,% + ccvs_init,ccvs_lookup,ccvs_new,ccvs_report,ccvs_return,% + ccvs_sale,ccvs_status,ccvs_textvalue,ccvs_void,ceil,chdir,% + checkdnsrr,chgrp,chmod,chop,chown,chr,chroot,chunk_split,% + clearstatcache,closedir,closelog,com_addref,com_get,com_invoke,% + com_load_typelib,com_load,com_propget,com_propput,com_propset,% + com_set,compact,connection_aborted,connection_status,% + constant,convert_cyr_string,copy,cos,cosh,count_chars,count,% + cpdf_add_outline,cpdf_arc,cpdf_begin_text,cpdf_circle,cpdf_clip,% + cpdf_closepath_fill_stroke,cpdf_closepath_stroke,cpdf_closepath,% + cpdf_curveto,cpdf_end_text,cpdf_fill_stroke,cpdf_fill,% + cpdf_finalize,cpdf_global_set_document_limits,cpdf_import_jpeg,% + cpdf_moveto,cpdf_newpath,cpdf_open,cpdf_output_buffer,% + cpdf_place_inline_image,cpdf_rect,cpdf_restore,cpdf_rlineto,% + cpdf_rotate_text,cpdf_rotate,cpdf_save_to_file,cpdf_save,% + cpdf_set_action_url,cpdf_set_char_spacing,cpdf_set_creator,% + cpdf_set_font_directories,cpdf_set_font_map_file,cpdf_set_font,% + cpdf_set_keywords,cpdf_set_leading,cpdf_set_page_animation,% + cpdf_set_text_matrix,cpdf_set_text_pos,cpdf_set_text_rendering,% + cpdf_set_title,cpdf_set_viewer_preferences,% + cpdf_setdash,cpdf_setflat,cpdf_setgray_fill,cpdf_setgray_stroke,% + cpdf_setlinecap,cpdf_setlinejoin,cpdf_setlinewidth,% + cpdf_setrgbcolor_fill,cpdf_setrgbcolor_stroke,cpdf_setrgbcolor,% + cpdf_show,cpdf_stringwidth,cpdf_stroke,cpdf_text,cpdf_translate,% + crack_closedict,crack_getlastmessage,crack_opendict,crc32,% + crypt,ctype_alnum,ctype_alpha,ctype_cntrl,ctype_digit,% + ctype_lower,ctype_print,ctype_punct,ctype_space,ctype_upper,% + curl_close,curl_errno,curl_error,curl_exec,curl_getinfo,% + curl_setopt,curl_version,current,cybercash_base64_decode,% + cybercash_decr,cybercash_encr,cybermut_creerformulairecm,% + cybermut_testmac,cyrus_authenticate,cyrus_bind,cyrus_close,% + cyrus_query,cyrus_unbind,date,dba_close,dba_delete,dba_exists,% + dba_firstkey,dba_insert,dba_nextkey,dba_open,dba_optimize,% + dba_replace,dba_sync,dbase_add_record,dbase_close,dbase_create,% + dbase_get_record_with_names,dbase_get_record,dbase_numfields,% + dbase_open,dbase_pack,dbase_replace_record,dblist,dbmclose,% + dbmexists,dbmfetch,dbmfirstkey,dbminsert,dbmnextkey,dbmopen,% + dbplus_add,dbplus_aql,dbplus_chdir,dbplus_close,dbplus_curr,% + dbplus_errno,dbplus_find,dbplus_first,dbplus_flush,% + dbplus_freelock,dbplus_freerlocks,dbplus_getlock,% + dbplus_info,dbplus_last,dbplus_lockrel,dbplus_next,dbplus_open,% + dbplus_rchperm,dbplus_rcreate,dbplus_rcrtexact,dbplus_rcrtlike,% + dbplus_restorepos,dbplus_rkeys,dbplus_ropen,dbplus_rquery,% + dbplus_rsecindex,dbplus_runlink,dbplus_rzap,dbplus_savepos,% + dbplus_setindexbynumber,dbplus_sql,dbplus_tcl,dbplus_tremove,% + dbplus_undoprepare,dbplus_unlockrel,dbplus_unselect,% + dbplus_xlockrel,dbplus_xunlockrel,dbx_close,dbx_compare,% + dbx_error,dbx_query,dbx_sort,dcgettext,dcngettext,debugger_off,% + decbin,dechex,decoct,define_syslog_variables,define,defined,% + delete,dgettext,die,dio_close,dio_fcntl,dio_open,dio_read,% + dio_stat,dio_truncate,dio_write,dirname,disk_free_space,% + diskfreespace,dl,dngettext,domxml_add_root,domxml_attributes,% + domxml_dumpmem,domxml_get_attribute,domxml_new_child,% + domxml_node_set_content,domxml_node_unlink_node,domxml_node,% + domxml_set_attribute,domxml_version,dotnet_load,doubleval,each,% + easter_days,ebcdic2ascii,echo,empty,end,ereg_replace,ereg,% + eregi,error_log,error_reporting,escapeshellarg,escapeshellcmd,% + exec,exit,exp,explode,expm1,extension_loaded,extract,ezmlm_hash,% + fbsql_autocommit,fbsql_change_user,fbsql_close,fbsql_commit,% + fbsql_create_blob,fbsql_create_clob,fbsql_create_db,% + fbsql_database_password,fbsql_database,fbsql_db_query,% + fbsql_drop_db,fbsql_errno,fbsql_error,fbsql_fetch_array,% + fbsql_fetch_field,fbsql_fetch_lengths,fbsql_fetch_object,% + fbsql_field_flags,fbsql_field_len,fbsql_field_name,% + fbsql_field_table,fbsql_field_type,fbsql_free_result,% + fbsql_hostname,fbsql_insert_id,fbsql_list_dbs,fbsql_list_fields,% + fbsql_next_result,fbsql_num_fields,fbsql_num_rows,% + fbsql_pconnect,fbsql_query,fbsql_read_blob,fbsql_read_clob,% + fbsql_rollback,fbsql_select_db,fbsql_set_lob_mode,% + fbsql_start_db,fbsql_stop_db,fbsql_tablename,fbsql_username,% + fclose,fdf_add_template,fdf_close,fdf_create,fdf_get_file,% + fdf_get_value,fdf_next_field_name,fdf_open,fdf_save,fdf_set_ap,% + fdf_set_file,fdf_set_flags,fdf_set_javascript_action,% + fdf_set_status,fdf_set_submit_form_action,fdf_set_value,feof,% + fgetc,fgetcsv,fgets,fgetss,file_exists,file,fileatime,filectime,% + fileinode,filemtime,fileowner,fileperms,filepro_fieldcount,% + filepro_fieldtype,filepro_fieldwidth,filepro_retrieve,% + filepro,filesize,filetype,floatval,flock,floor,flush,fopen,% + fputs,fread,frenchtojd,fribidi_log2vis,fscanf,fseek,fsockopen,% + ftell,ftok,ftp_cdup,ftp_chdir,ftp_connect,ftp_delete,ftp_exec,% + ftp_fput,ftp_get,ftp_login,ftp_mdtm,ftp_mkdir,ftp_nlist,% + ftp_put,ftp_pwd,ftp_quit,ftp_rawlist,ftp_rename,ftp_rmdir,% + ftp_size,ftp_systype,ftruncate,func_get_arg,func_get_args,% + function_exists,fwrite,get_browser,get_cfg_var,% + get_class_vars,get_class,get_current_user,get_declared_classes,% + get_defined_functions,get_defined_vars,get_extension_funcs,% + get_included_files,get_loaded_extensions,get_magic_quotes_gpc,% + get_meta_tags,get_object_vars,get_parent_class,% + get_resource_type,getallheaders,getcwd,getdate,getenv,% + gethostbyname,gethostbynamel,getimagesize,getlastmod,getmxrr,% + getmyinode,getmypid,getmyuid,getprotobyname,getprotobynumber,% + getrusage,getservbyname,getservbyport,gettext,gettimeofday,% + gmdate,gmmktime,gmp_abs,gmp_add,gmp_and,gmp_clrbit,gmp_cmp,% + gmp_div_q,gmp_div_qr,gmp_div_r,gmp_div,gmp_divexact,gmp_fact,% + gmp_gcdext,gmp_hamdist,gmp_init,gmp_intval,gmp_invert,% + gmp_legendre,gmp_mod,gmp_mul,gmp_neg,gmp_or,gmp_perfect_square,% + gmp_pow,gmp_powm,gmp_prob_prime,gmp_random,gmp_scan0,gmp_scan1,% + gmp_sign,gmp_sqrt,gmp_sqrtrem,gmp_strval,gmp_sub,gmp_xor,% + gregoriantojd,gzclose,gzcompress,gzdeflate,gzencode,gzeof,% + gzgetc,gzgets,gzgetss,gzinflate,gzopen,gzpassthru,gzputs,gzread,% + gzseek,gztell,gzuncompress,gzwrite,header,headers_sent,hebrev,% + hexdec,highlight_file,highlight_string,htmlentities,% + hw_array2objrec,hw_changeobject,hw_children,hw_childrenobj,% + hw_connect,hw_connection_info,hw_cp,hw_deleteobject,% + hw_docbyanchorobj,hw_document_attributes,hw_document_bodytag,% + hw_document_setcontent,hw_document_size,hw_dummy,hw_edittext,% + hw_errormsg,hw_free_document,hw_getanchors,hw_getanchorsobj,% + hw_getchildcoll,hw_getchildcollobj,hw_getchilddoccoll,% + hw_getobject,hw_getobjectbyquery,hw_getobjectbyquerycoll,% + hw_getobjectbyqueryobj,hw_getparents,hw_getparentsobj,% + hw_getremote,hw_getremotechildren,hw_getsrcbydestobj,hw_gettext,% + hw_identify,hw_incollections,hw_info,hw_inscoll,hw_insdoc,% + hw_insertdocument,hw_insertobject,hw_mapid,hw_modifyobject,% + hw_new_document,hw_objrec2array,hw_output_document,hw_pconnect,% + hw_root,hw_setlinkroot,hw_stat,hw_unlock,hw_who,hypot,% + ibase_blob_cancel,ibase_blob_close,ibase_blob_create,% + ibase_blob_get,ibase_blob_import,ibase_blob_info,% + ibase_close,ibase_commit,ibase_connect,ibase_errmsg,% + ibase_fetch_object,ibase_fetch_row,ibase_field_info,% + ibase_free_result,ibase_num_fields,ibase_pconnect,ibase_prepare,% + ibase_rollback,ibase_timefmt,ibase_trans,icap_close,% + icap_delete_calendar,icap_delete_event,icap_fetch_event,% + icap_list_events,icap_open,icap_rename_calendar,icap_reopen,% + icap_store_event,iconv_get_encoding,iconv_set_encoding,iconv,% + ifx_blobinfile_mode,ifx_byteasvarchar,ifx_close,ifx_connect,% + ifx_create_blob,ifx_create_char,ifx_do,ifx_error,ifx_errormsg,% + ifx_fieldproperties,ifx_fieldtypes,ifx_free_blob,ifx_free_char,% + ifx_get_blob,ifx_get_char,ifx_getsqlca,ifx_htmltbl_result,% + ifx_num_fields,ifx_num_rows,ifx_pconnect,ifx_prepare,ifx_query,% + ifx_update_blob,ifx_update_char,ifxus_close_slob,% + ifxus_free_slob,ifxus_open_slob,ifxus_read_slob,ifxus_seek_slob,% + ifxus_write_slob,ignore_user_abort,image2wbmp,% + imagearc,imagechar,imagecharup,imagecolorallocate,imagecolorat,% + imagecolorclosestalpha,imagecolorclosesthwb,% + imagecolorexact,imagecolorexactalpha,imagecolorresolve,% + imagecolorset,imagecolorsforindex,imagecolorstotal,% + imagecopy,imagecopymerge,imagecopymergegray,imagecopyresampled,% + imagecreate,imagecreatefromgd,imagecreatefromgd2,% + imagecreatefromgif,imagecreatefromjpeg,imagecreatefrompng,% + imagecreatefromwbmp,imagecreatefromxbm,imagecreatefromxpm,% + imagedashedline,imagedestroy,imageellipse,imagefill,% + imagefilledellipse,imagefilledpolygon,imagefilledrectangle,% + imagefontheight,imagefontwidth,imageftbbox,imagefttext,% + imagegd,imagegd2,imagegif,imageinterlace,imagejpeg,imageline,% + imagepalettecopy,imagepng,imagepolygon,imagepsbbox,% + imagepsextendfont,imagepsfreefont,imagepsloadfont,% + imagepstext,imagerectangle,imagesetbrush,imagesetpixel,% + imagesetthickness,imagesettile,imagestring,imagestringup,% + imagesy,imagetruecolortopalette,imagettfbbox,imagettftext,% + imagewbmp,imap_8bit,imap_alerts,imap_append,imap_base64,% + imap_body,imap_bodystruct,imap_check,imap_clearflag_full,% + imap_createmailbox,imap_delete,imap_deletemailbox,imap_errors,% + imap_fetch_overview,imap_fetchbody,imap_fetchheader,% + imap_get_quota,imap_getmailboxes,imap_getsubscribed,imap_header,% + imap_headers,imap_last_error,imap_listmailbox,% + imap_mail_compose,imap_mail_copy,imap_mail_move,imap_mail,% + imap_mime_header_decode,imap_msgno,imap_num_msg,imap_num_recent,% + imap_ping,imap_popen,imap_qprint,imap_renamemailbox,imap_reopen,% + imap_rfc822_parse_headers,imap_rfc822_write_address,% + imap_search,imap_set_quota,imap_setacl,imap_setflag_full,% + imap_status,imap_subscribe,imap_thread,imap_uid,imap_undelete,% + imap_utf7_decode,imap_utf7_encode,imap_utf8,implode,% + in_array,include_once,include,ingres_autocommit,ingres_close,% + ingres_connect,ingres_fetch_array,ingres_fetch_object,% + ingres_field_length,ingres_field_name,ingres_field_nullable,% + ingres_field_scale,ingres_field_type,ingres_num_fields,% + ingres_pconnect,ingres_query,ingres_rollback,ini_alter,% + ini_get,ini_restore,ini_set,intval,ip2long,iptcembed,iptcparse,% + ircg_disconnect,ircg_fetch_error_msg,ircg_get_username,% + ircg_ignore_add,ircg_ignore_del,ircg_is_conn_alive,ircg_join,% + ircg_lookup_format_messages,ircg_msg,ircg_nick,% + ircg_nickname_unescape,ircg_notice,ircg_part,ircg_pconnect,% + ircg_set_current,ircg_set_file,ircg_set_on_die,ircg_topic,% + is_array,is_bool,is_dir,is_double,is_executable,is_file,% + is_int,is_integer,is_link,is_long,is_null,is_numeric,is_object,% + is_real,is_resource,is_scalar,is_string,is_subclass_of,% + is_writable,is_writeable,isset,java_last_exception_clear,% + jddayofweek,jdmonthname,jdtofrench,jdtogregorian,jdtojewish,% + jdtounix,jewishtojd,join,jpeg2wbmp,juliantojd,key,krsort,ksort,% + ldap_8859_to_t61,ldap_add,ldap_bind,ldap_close,ldap_compare,% + ldap_count_entries,ldap_delete,ldap_dn2ufn,ldap_err2str,% + ldap_error,ldap_explode_dn,ldap_first_attribute,% + ldap_first_reference,ldap_free_result,ldap_get_attributes,% + ldap_get_entries,ldap_get_option,ldap_get_values_len,% + ldap_list,ldap_mod_add,ldap_mod_del,ldap_mod_replace,% + ldap_next_attribute,ldap_next_entry,ldap_next_reference,% + ldap_parse_result,ldap_read,ldap_rename,ldap_search,% + ldap_set_rebind_proc,ldap_sort,ldap_start_tls,ldap_t61_to_8859,% + leak,levenshtein,link,linkinfo,list,localeconv,localtime,log,% + log1p,long2ip,lstat,ltrim,mail,% + mailparse_msg_create,mailparse_msg_extract_part_file,% + mailparse_msg_free,mailparse_msg_get_part_data,% + mailparse_msg_get_structure,mailparse_msg_parse_file,% + mailparse_rfc822_parse_addresses,mailparse_stream_encode,% + max,mb_convert_encoding,mb_convert_kana,mb_convert_variables,% + mb_decode_numericentity,mb_detect_encoding,mb_detect_order,% + mb_encode_numericentity,mb_http_input,mb_http_output,% + mb_language,mb_output_handler,mb_parse_str,% + mb_send_mail,mb_strcut,mb_strimwidth,mb_strlen,mb_strpos,% + mb_strwidth,mb_substitute_character,mb_substr,mcal_append_event,% + mcal_create_calendar,mcal_date_compare,mcal_date_valid,% + mcal_day_of_year,mcal_days_in_month,mcal_delete_calendar,% + mcal_event_add_attribute,mcal_event_init,mcal_event_set_alarm,% + mcal_event_set_class,mcal_event_set_description,% + mcal_event_set_recur_daily,mcal_event_set_recur_monthly_mday,% + mcal_event_set_recur_none,mcal_event_set_recur_weekly,% + mcal_event_set_start,mcal_event_set_title,mcal_expunge,% + mcal_fetch_event,mcal_is_leap_year,mcal_list_alarms,% + mcal_next_recurrence,mcal_open,mcal_popen,mcal_rename_calendar,% + mcal_snooze,mcal_store_event,mcal_time_valid,mcal_week_of_year,% + mcrypt_cfb,mcrypt_create_iv,mcrypt_decrypt,mcrypt_ecb,% + mcrypt_enc_get_block_size,mcrypt_enc_get_iv_size,% + mcrypt_enc_get_modes_name,mcrypt_enc_get_supported_key_sizes,% + mcrypt_enc_is_block_algorithm,mcrypt_enc_is_block_mode,% + mcrypt_encrypt,mcrypt_generic_deinit,mcrypt_generic_end,% + mcrypt_generic,mcrypt_get_block_size,mcrypt_get_cipher_name,% + mcrypt_get_key_size,mcrypt_list_algorithms,mcrypt_list_modes,% + mcrypt_module_get_algo_block_size,% + mcrypt_module_get_supported_key_sizes,% + mcrypt_module_is_block_algorithm,mcrypt_module_is_block_mode,% + mcrypt_module_self_test,mcrypt_ofb,md5_file,md5,% + metaphone,method_exists,mhash_count,mhash_get_block_size,% + mhash_keygen_s2k,mhash,microtime,min,ming_setcubicthreshold,% + ming_useswfversion,mkdir,mktime,move_uploaded_file,% + msession_count,msession_create,msession_destroy,% + msession_find,msession_get_array,msession_get,msession_getdata,% + msession_list,msession_listvar,msession_lock,msession_plugin,% + msession_set_array,msession_set,msession_setdata,% + msession_uniq,msession_unlock,msql_affected_rows,msql_close,% + msql_create_db,msql_createdb,msql_data_seek,msql_dbname,% + msql_dropdb,msql_error,msql_fetch_array,msql_fetch_field,% + msql_fetch_row,msql_field_seek,msql_fieldflags,msql_fieldlen,% + msql_fieldtable,msql_fieldtype,msql_free_result,msql_freeresult,% + msql_list_fields,msql_list_tables,msql_listdbs,msql_listfields,% + msql_num_fields,msql_num_rows,msql_numfields,msql_numrows,% + msql_query,msql_regcase,msql_result,msql_select_db,% + msql_tablename,msql,mssql_bind,mssql_close,mssql_connect,% + mssql_execute,mssql_fetch_array,mssql_fetch_assoc,% + mssql_fetch_field,mssql_fetch_object,mssql_fetch_row,% + mssql_field_name,mssql_field_seek,mssql_field_type,% + mssql_get_last_message,mssql_guid_string,mssql_init,% + mssql_min_message_severity,mssql_next_result,mssql_num_fields,% + mssql_pconnect,mssql_query,mssql_result,mssql_rows_affected,% + mt_getrandmax,mt_rand,mt_srand,muscat_close,muscat_get,% + muscat_setup_net,muscat_setup,mysql_affected_rows,% + mysql_close,mysql_connect,mysql_create_db,mysql_data_seek,% + mysql_db_query,mysql_drop_db,mysql_errno,mysql_error,% + mysql_fetch_array,mysql_fetch_assoc,mysql_fetch_field,% + mysql_fetch_object,mysql_fetch_row,mysql_field_flags,% + mysql_field_name,mysql_field_seek,mysql_field_table,% + mysql_free_result,mysql_get_client_info,mysql_get_host_info,% + mysql_get_server_info,mysql_insert_id,mysql_list_dbs,% + mysql_list_tables,mysql_num_fields,mysql_num_rows,% + mysql_query,mysql_result,mysql_select_db,mysql_tablename,% + natcasesort,natsort,ncurses_addch,ncurses_addchnstr,% + ncurses_addnstr,ncurses_addstr,ncurses_assume_default_colors,% + ncurses_attron,ncurses_attrset,ncurses_baudrate,ncurses_beep,% + ncurses_bkgdset,ncurses_border,ncurses_can_change_color,% + ncurses_clear,ncurses_clrtobot,ncurses_clrtoeol,% + ncurses_curs_set,ncurses_def_prog_mode,ncurses_def_shell_mode,% + ncurses_delay_output,ncurses_delch,ncurses_deleteln,% + ncurses_doupdate,ncurses_echo,ncurses_echochar,ncurses_end,% + ncurses_erasechar,ncurses_filter,ncurses_flash,ncurses_flushinp,% + ncurses_halfdelay,ncurses_has_colors,ncurses_has_ic,% + ncurses_has_key,ncurses_hline,ncurses_inch,ncurses_init_color,% + ncurses_init,ncurses_insch,ncurses_insdelln,ncurses_insertln,% + ncurses_instr,ncurses_isendwin,ncurses_keyok,ncurses_killchar,% + ncurses_move,ncurses_mvaddch,ncurses_mvaddchnstr,% + ncurses_mvaddnstr,ncurses_mvaddstr,ncurses_mvcur,% + ncurses_mvgetch,ncurses_mvhline,ncurses_mvinch,ncurses_mvvline,% + ncurses_napms,ncurses_newwin,ncurses_nl,ncurses_nocbreak,% + ncurses_nonl,ncurses_noqiflush,ncurses_noraw,ncurses_putp,% + ncurses_raw,ncurses_refresh,ncurses_resetty,ncurses_savetty,% + ncurses_scr_init,ncurses_scr_restore,ncurses_scr_set,% + ncurses_slk_attr,ncurses_slk_attroff,ncurses_slk_attron,% + ncurses_slk_clear,ncurses_slk_color,ncurses_slk_init,% + ncurses_slk_refresh,ncurses_slk_restore,ncurses_slk_touch,% + ncurses_standout,ncurses_start_color,ncurses_termattrs,% + ncurses_typeahead,ncurses_ungetch,ncurses_use_default_colors,% + ncurses_use_extended_names,ncurses_vidattr,ncurses_vline,% + next,ngettext,nl_langinfo,nl2br,notes_body,notes_copy_db,% + notes_create_note,notes_drop_db,notes_find_note,% + notes_list_msgs,notes_mark_read,notes_mark_unread,% + notes_search,notes_unread,notes_version,number_format,ob_clean,% + ob_end_flush,ob_flush,ob_get_contents,ob_get_length,% + ob_gzhandler,ob_iconv_handler,ob_implicit_flush,ob_start,% + ocicancel,ocicollappend,ocicollassign,ocicollassignelem,% + ocicollmax,ocicollsize,ocicolltrim,ocicolumnisnull,% + ocicolumnprecision,ocicolumnscale,ocicolumnsize,ocicolumntype,% + ocicommit,ocidefinebyname,ocierror,ociexecute,ocifetch,% + ocifetchstatement,ocifreecollection,ocifreecursor,ocifreedesc,% + ociinternaldebug,ociloadlob,ocilogoff,ocilogon,ocinewcollection,% + ocinewdescriptor,ocinlogon,ocinumcols,ociparse,ociplogon,% + ocirollback,ocirowcount,ocisavelob,ocisavelobfile,% + ocisetprefetch,ocistatementtype,ociwritelobtofile,octdec,% + odbc_binmode,odbc_close_all,odbc_close,odbc_columnprivileges,% + odbc_commit,odbc_connect,odbc_cursor,odbc_do,odbc_error,% + odbc_exec,odbc_execute,odbc_fetch_array,odbc_fetch_into,% + odbc_fetch_row,odbc_field_len,odbc_field_name,odbc_field_num,% + odbc_field_scale,odbc_field_type,odbc_foreignkeys,% + odbc_gettypeinfo,odbc_longreadlen,odbc_next_result,% + odbc_num_rows,odbc_pconnect,odbc_prepare,odbc_primarykeys,% + odbc_procedures,odbc_result_all,odbc_result,odbc_rollback,% + odbc_specialcolumns,odbc_statistics,odbc_tableprivileges,% + opendir,openlog,openssl_csr_export_to_file,openssl_csr_export,% + openssl_csr_sign,openssl_error_string,openssl_free_key,% + openssl_get_publickey,openssl_open,openssl_pkcs7_decrypt,% + openssl_pkcs7_sign,openssl_pkcs7_verify,% + openssl_pkey_export,openssl_pkey_new,openssl_private_decrypt,% + openssl_public_decrypt,openssl_public_encrypt,openssl_seal,% + openssl_verify,openssl_x509_check_private_key,% + openssl_x509_export_to_file,openssl_x509_export,% + openssl_x509_parse,openssl_x509_read,ora_bind,ora_close,% + ora_columnsize,ora_columntype,ora_commit,ora_commitoff,% + ora_do,ora_error,ora_errorcode,ora_exec,ora_fetch_into,% + ora_getcolumn,ora_logoff,ora_logon,ora_numcols,ora_numrows,% + ora_parse,ora_plogon,ora_rollback,ord,overload,ovrimos_close,% + ovrimos_connect,ovrimos_cursor,ovrimos_exec,ovrimos_execute,% + ovrimos_fetch_row,ovrimos_field_len,ovrimos_field_name,% + ovrimos_field_type,ovrimos_free_result,ovrimos_longreadlen,% + ovrimos_num_rows,ovrimos_prepare,ovrimos_result_all,% + ovrimos_rollback,pack,parse_ini_file,parse_str,parse_url,% + pathinfo,pclose,pdf_add_annotation,pdf_add_bookmark,% + pdf_add_locallink,pdf_add_note,pdf_add_outline,pdf_add_pdflink,% + pdf_add_weblink,pdf_arc,pdf_arcn,pdf_attach_file,pdf_begin_page,% + pdf_begin_template,pdf_circle,pdf_clip,pdf_close_image,% + pdf_close_pdi,pdf_close,pdf_closepath_fill_stroke,% + pdf_closepath,pdf_concat,pdf_continue_text,pdf_curveto,% + pdf_end_page,pdf_end_pattern,pdf_end_template,pdf_endpath,% + pdf_fill,pdf_findfont,pdf_get_buffer,pdf_get_font,% + pdf_get_fontsize,pdf_get_image_height,pdf_get_image_width,% + pdf_get_minorversion,pdf_get_parameter,pdf_get_pdi_parameter,% + pdf_get_value,pdf_initgraphics,pdf_lineto,pdf_makespotcolor,% + pdf_new,pdf_open_ccitt,pdf_open_file,pdf_open_gif,% + pdf_open_image,pdf_open_jpeg,pdf_open_memory_image,% + pdf_open_pdi,pdf_open_png,pdf_open_tiff,pdf_open,% + pdf_place_pdi_page,pdf_rect,pdf_restore,pdf_rotate,pdf_save,% + pdf_set_border_color,pdf_set_border_dash,pdf_set_border_style,% + pdf_set_duration,pdf_set_font,pdf_set_horiz_scaling,% + pdf_set_info_creator,pdf_set_info_keywords,pdf_set_info_subject,% + pdf_set_info,pdf_set_leading,pdf_set_parameter,pdf_set_text_pos,% + pdf_set_text_rise,pdf_set_transition,pdf_set_value,% + pdf_setcolor,pdf_setdash,pdf_setflat,pdf_setfont,% + pdf_setgray_stroke,pdf_setgray,pdf_setlinecap,pdf_setlinejoin,% + pdf_setmatrix,pdf_setmiterlimit,pdf_setpolydash,% + pdf_setrgbcolor_stroke,pdf_setrgbcolor,pdf_show_boxed,% + pdf_show,pdf_skew,pdf_stringwidth,pdf_stroke,pdf_translate,% + pfpro_init,pfpro_process_raw,pfpro_process,pfpro_version,% + pg_cancel_query,pg_client_encoding,pg_close,pg_cmdtuples,% + pg_connection_busy,pg_connection_reset,pg_connection_status,% + pg_copy_to,pg_dbname,pg_end_copy,pg_errormessage,% + pg_escape_string,pg_exec,pg_fetch_array,pg_fetch_object,% + pg_fieldisnull,pg_fieldname,pg_fieldnum,pg_fieldprtlen,% + pg_fieldtype,pg_freeresult,pg_get_result,pg_getlastoid,pg_host,% + pg_last_notice,pg_lo_close,pg_lo_seek,pg_lo_tell,pg_loclose,% + pg_loexport,pg_loimport,pg_loopen,pg_loread,pg_loreadall,% + pg_lowrite,pg_numfields,pg_numrows,pg_options,pg_pconnect,% + pg_put_line,pg_request_cancel,pg_result_error,pg_result_status,% + pg_send_query,pg_set_client_encoding,pg_trace,pg_tty,pg_untrace,% + php_sapi_name,php_uname,phpcredits,phpinfo, %% \lst@definelanguage{Prolog}% @@ -575,10 +1192,12 @@ },% morestring=[d]",% MoreSelectCharTable=% - \lst@CArgX\#\relax\lst@CommentB\lst@CLmode{}{}% + \lst@CArgX\#\relax\lst@DefDelimB{}{}% {\ifx\lst@lastother\lstum@backslash \expandafter\@gobblethree - \fi}\lst@commentstyle + \fi}% + \lst@BeginComment\lst@commentmode + {{\lst@commentstyle}\lst@Lmodetrue}% }[keywords,comments,strings]% %% %% VBScript definition (c) 2000 Sonja Weidmann @@ -629,6 +1248,26 @@ morecomment=[l]',% morestring=[d]"% }[keywords,comments,strings]% +%% +%% VRML definition (c) 2001 Oliver Baum +%% +\lst@definelanguage[97]{VRML} + {morekeywords={DEF,EXTERNPROTO,FALSE,IS,NULL,PROTO,ROUTE,TO,TRUE,USE,% + eventIn,eventOut,exposedField,field,Introduction,Anchor,% + Appearance,AudioClip,Background,Billboard,Box,Collision,Color,% + ColorInterpolator,Cone,Coordinate,CoordinateInterpolator,% + Cylinder,CylinderSensor,DirectionalLight,ElevationGrid,Extrusion,% + Fog,FontStyle,Group,ImageTexture,IndexedFaceSet,IndexedLineSet,% + Inline,LOD,Material,MovieTexture,NavigationInfo,Normal,% + NormalInterpolator,OrientationInterpolator,PixelTexture,% + PlaneSensor,PointLight,PointSet,PositionInterpolator,% + ProximitySensor,ScalarInterpolator,Script,Shape,Sound,Sphere,% + SphereSensor,SpotLight,Switch,Text,TextureCoordinate,% + TextureTransform,TimeSensor,TouchSensor,Transform,Viewpoint,% + VisibilitySensor,WorldInfo},% + morecomment=[l]\#,% bug: starts comment in the first column + morestring=[b]"% + }[keywords,comments,strings] \endinput %% %% End of file `lstlang2.sty'. diff --git a/docs/styles/lstlang3.sty b/docs/styles/lstlang3.sty index 2c22a8ed6a..c1edd77393 100644 --- a/docs/styles/lstlang3.sty +++ b/docs/styles/lstlang3.sty @@ -6,8 +6,8 @@ %% %% lstdrvrs.dtx (with options: `lang3') %% -%% (w)(c) 1996/1997/1998/1999/2000 Carsten Heinz and/or any other author -%% listed elsewhere in this file. +%% (w)(c) 1996/1997/1998/1999/2000/2001/2002 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. @@ -15,13 +15,11 @@ %% %% This file is completely free and comes without any warranty. %% -%% 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 . %% +\ProvidesFile{lstlang3} + [2002/07/31 v1.0d listings language file] \lst@definelanguage[68]{Algol}% {morekeywords={abs,and,arg,begin,bin,bits,bool,by,bytes,case,channel,% char,co,comment,compl,conj,divab,do,down,elem,elif,else,empty,% @@ -43,54 +41,68 @@ keywordcommentsemicolon={end}{else,end}{comment}% }[keywords,keywordcomments]% %% -%% Visual Basic definition (c) 2001 Frédéric Jacquet -%% +%% x86masm definition (c) 2002 Andrew Zabolotny %% -\lstdefinelanguage[Visual]{Basic} - {morekeywords={AddressOf,Abs,And,AppActivate,Array,As,Asc,Atn,Base,% - Beep,Binary,ByRef,ByVal,CVErr,Call,CallByName,Case,ChDir,ChDrive,% - Choose,Chr,Close,Command,Compare,Comparison,Const,Cos,% - CreateObject,CurDir,DDB,Date,DateAdd,DateDiff,DatePart,% - DateSerial,DateValue,Day,Declare,Deftype,DeleteSetting,Dim,Dir,% - Do,DoEvents,EOF,Each,Else,Empty,End,Enum,Environ,Eqv,Erase,Error,% - Event,Exit,Exp,Explicit,FV,False,FileAttr,FileCopy,FileDateTime,% - FileLen,Filter,Fix,For,Format,FormatCurrency,FormatDateRime,% - FormatNumber,FormatPercent,Friend,Function,Get,GetAllSettings,% - GetAttr,GetAutoServerSettings,GetObject,GetSetting,GoSub,GoTo,% - Hex,Hour,IIf,IMEStatus,IPmt,IRR,If,Imp,Implements,InStr,InStrRev,% - Input,InputBox,Int,Is,IsArray,IsDate,IsEmpty,IsError,IsMissing,% - IsNull,IsNumeric,IsObject,Join,Kill,LBound,LCase,LOF,LSet,LTrim,% - Left,Len,Let,Like,Line,Load,LoadPicture,LoadResData,% - LoadResPicture,LoadResString,Loc,Lock,Lock,Log,Loop,MIRR,Math,Me,% - Mid,Minute,MkDir,Mod,Month,MonthName,MsgBox,NPV,NPer,Name,New,% - Next,Not,Nothing,Now,Null,Oct,On,Open,Option,Optional,Or,PPmt,PV,% - Paramarray,Partition,Pmt,Print,Private,Property,Public,Put,% - QBColor,RGB,RSet,RTrim,RaiseEvent,Randomize,Rate,ReDim,Rem,% - Replace,Resume,Return,Right,RmDir,Rnd,Round,SLN,SYD,SavePicture,% - SaveSetting,Second,Seek,Select,SendKeys,Set,SetAttr,Sgn,Shell,% - Sin,Space,Spc,Split,Sqr,Static,Step,Stop,Str,StrComp,StrConv,% - StrReverse,String,Sub,Switch,Tab,Tan,Then,Time,TimeSerial,% - TimeValue,Timer,Trim,True,Type,TypeName,UBound,UCase,Unload,% - Unlock,Val,VarType,Weekday,WeekdayName,Wend,While,Width,With,% - Withevents,Write,Xor,Year},% - sensitive=false,% - morecomment=[l]\',% - morestring=[b]"% - }% +\lst@definelanguage[x86masm]{Assembler}% + {morekeywords={al,ah,ax,eax,bl,bh,bx,ebx,cl,ch,cx,ecx,dl,dh,dx,edx,% + si,esi,di,edi,bp,ebp,sp,esp,cs,ds,es,ss,fs,gs,cr0,cr1,cr2,cr3,% + db0,db1,db2,db3,db4,db5,db6,db7,tr0,tr1,tr2,tr3,tr4,tr5,tr6,tr7,% + st,aaa,aad,aam,aas,adc,add,and,arpl,bound,bsf,bsr,bswap,bt,btc,% + btr,bts,call,cbw,cdq,clc,cld,cli,clts,cmc,cmp,cmps,cmpsb,cmpsw,% + cmpsd,cmpxchg,cwd,cwde,daa,das,dec,div,enter,hlt,idiv,imul,in,% + inc,ins,int,into,invd,invlpg,iret,ja,jae,jb,jbe,jc,jcxz,jecxz,% + je,jg,jge,jl,jle,jna,jnae,jnb,jnbe,jnc,jne,jng,jnge,jnl,jnle,% + jno,jnp,jns,jnz,jo,jp,jpe,jpo,js,jz,jmp,lahf,lar,lea,leave,lgdt,% + lidt,lldt,lmsw,lock,lods,lodsb,lodsw,lodsd,loop,loopz,loopnz,% + loope,loopne,lds,les,lfs,lgs,lss,lsl,ltr,mov,movs,movsb,movsw,% + movsd,movsx,movzx,mul,neg,nop,not,or,out,outs,pop,popa,popad,% + popf,popfd,push,pusha,pushad,pushf,pushfd,rcl,rcr,rep,repe,% + repne,repz,repnz,ret,retf,rol,ror,sahf,sal,sar,sbb,scas,seta,% + setae,setb,setbe,setc,sete,setg,setge,setl,setle,setna,setnae,% + setnb,setnbe,setnc,setne,setng,setnge,setnl,setnle,setno,setnp,% + setns,setnz,seto,setp,setpe,setpo,sets,setz,sgdt,shl,shld,shr,% + shrd,sidt,sldt,smsw,stc,std,sti,stos,stosb,stosw,stosd,str,sub,% + test,verr,verw,wait,wbinvd,xadd,xchg,xlatb,xor,fabs,fadd,fbld,% + fbstp,fchs,fclex,fcom,fcos,fdecstp,fdiv,fdivr,ffree,fiadd,ficom,% + fidiv,fidivr,fild,fimul,fincstp,finit,fist,fisub,fisubr,fld,fld1,% + fldl2e,fldl2t,fldlg2,fldln2,fldpi,fldz,fldcw,fldenv,fmul,fnop,% + fpatan,fprem,fprem1,fptan,frndint,frstor,fsave,fscale,fsetpm,% + fsin,fsincos,fsqrt,fst,fstcw,fstenv,fstsw,fsub,fsubr,ftst,fucom,% + fwait,fxam,fxch,fxtract,fyl2x,fyl2xp1,f2xm1},% + morekeywords=[2]{.align,.alpha,assume,byte,code,comm,comment,.const,% + .cref,.data,.data?,db,dd,df,dosseg,dq,dt,dw,dword,else,end,endif,% + endm,endp,ends,eq,equ,.err,.err1,.err2,.errb,.errdef,.errdif,% + .erre,.erridn,.errnb,.errndef,.errnz,event,exitm,extrn,far,% + .fardata,.fardata?,fword,ge,group,gt,high,if,if1,if2,ifb,ifdef,% + ifdif,ife,ifidn,ifnb,ifndef,include,includelib,irp,irpc,label,% + .lall,le,length,.lfcond,.list,local,low,lt,macro,mask,mod,.model,% + name,ne,near,offset,org,out,page,proc,ptr,public,purge,qword,.% + radix,record,rept,.sall,seg,segment,.seq,.sfcond,short,size,% + .stack,struc,subttl,tbyte,.tfcond,this,title,type,.type,width,% + word,.xall,.xcref,.xlist},% + alsoletter=.,alsodigit=?,% + sensitive=f,% + morestring=[b]",% + morestring=[b]',% + morecomment=[l];% + }[directives,keywords,comments,strings] %% -%% Clean definition (c) 1999 José Romildo Malaquias +%% Clean definition (c) 1999 Jos\'e Romildo Malaquias +%% %% %% Clean 1.3 : some standard functional language: pure, lazy, %% polymorphic type system, modules, type classes, %% garbage collection, functions as first class citizens %% \lst@definelanguage{Clean}% - {otherkeywords={:,::,=,:==,=:,=>,->,<-,<-:,\{,\},\{|,|\},\#,\#!,|,\&,[,],!,.,\\\\,;,_},% - keywords={from,definition,implementation,import,module,system,case,code,% - if,in,let,let!,of,where,with,infix,infixl,infixr},% - ndkeywords={True,False,Start,Int,Real,Char,Bool,String,World,File,ProcId},% + {otherkeywords={:,::,=,:==,=:,=>,->,<-,<-:,\{,\},\{|,|\},\#,\#!,|,\&,% + [,],!,.,\\\\,;,_},% + morekeywords={from,definition,implementation,import,module,system,% + case,code,if,in,let,let!,of,where,with,infix,infixl,infixr},% + morendkeywords={True,False,Start,Int,Real,Char,Bool,String,World,% + File,ProcId},% sensitive,% - morecomment=[l]//% + morecomment=[l]//,% missing comma: Markus Pahlow morecomment=[n]{/*}{*/},% morestring=[b]"% }[keywords,comments,strings]% @@ -121,6 +133,19 @@ sensitive,% morestring=[d]"% }[keywords,strings]% +\lst@definelanguage{ksh} + {morekeywords={alias,awk,cat,echo,else,elif,fi,exec,exit,% + for,in,do,done,select,case,esac,while,until,function,% + time,export,cd,eval,fc,fg,kill,let,pwd,read,return,rm,% + glob,goto,history,if,logout,nice,nohup,onintr,repeat,sed,% + set,setenv,shift,source,switch,then,umask,unalias,% + unset,wait,@,env,argv,child,home,ignoreeof,noclobber,% + noglob,nomatch,path,prompt,shell,status,verbose,print,printf,% + sqrt,BEGIN,END},% + morecomment=[l]\#,% + morestring=[d]",% + morestring=[d]'% + }[keywords,comments,strings]% \lst@definelanguage{Logo}% {morekeywords={and,atan,arctan,both,break,bf,bl,butfirst,butlast,% cbreak, close,co,continue,cos,count,clearscreen,cs,debquit,% @@ -158,6 +183,19 @@ morestring=[d]',% morestring=[d]"% }[keywords,comments,strings]% +\lst@definelanguage{NASTRAN} + {morekeywords={ENDDATA},% + morecomment=[l]$,% + MoreSelectCharTable=% + \lst@CArgX BEGIN\ BULK\relax\lst@CDef{}% + {\lst@ifmode\else \ifnum\lst@length=\z@ + \lst@EnterMode{\lst@GPmode}{\lst@modetrue + \let\lst@currstyle\lst@gkeywords@sty}% + \fi \fi}% + {\ifnum\lst@mode=\lst@GPmode + \lst@XPrintToken \lst@LeaveMode + \fi}% + }[keywords,comments]% \lst@definelanguage{Oberon-2}% {morekeywords={ARRAY,BEGIN,BOOLEAN,BY,CASE,CHAR,CONST,DIV,DO,ELSE,% ELSIF,END,EXIT,FALSE,FOR,IF,IMPORT,IN,INTEGER,IS,LONGINT,% @@ -171,14 +209,12 @@ morestring=[d]"% }[keywords,comments,strings]% %% -%% OCL definition (c) 2000 Achim D. Brucker -%% You are allowed to use, modify and distribute this code either under -%% the terms of the LPPL (version 1.0 or later) or the GPL (version 2.0 or later). +%% OCL definition (c) 2000 Achim D. Brucker +%% %% -%% First we define are very decorative style. In the OMG standard only the boolean (infix (?)) -%% operations are highlighted, but I think all OCL-defined operations should be -%% highlighted, because they are \emph{guaranteed} to be side-effect-free (in OCL only side effect -%% free evaluations or path expressions are allowed). +%% You are allowed to use, modify and distribute this code either under +%% the terms of the LPPL (version 1.0 or later) or the GPL (version 2.0 +%% or later). %% \lst@definelanguage[decorative]{OCL}[OMG]{OCL} {otherkeywords={@pre},% @@ -192,14 +228,8 @@ asSequence,asBag,asSequence,asSet,append,prepend,subSequence,at,% first,last,true,false,isQuery}% }% -%% Remark: "isQuery" is not real OCL, but a important Attribute of the -%% underlying UML model. -%% -%% The dialect called \texttt{OMG} is a very spare version. If you use -%% this variant with bold style for first and second order keywords you -%% get the look and feel of the OMG standard. \lst@definelanguage[OMG]{OCL}% - {morekeywords={context,pre,inv,post}, + {morekeywords={context,pre,inv,post},% ndkeywords={or,xor,and,not,implies,if,then,else,endif},% morerdkeywords={Boolean,Integer,Real,String,Set,Sequence,Bag,% OclType,OclAny,OclExpression,Enumeration,Collection,},% @@ -322,10 +352,11 @@ alsoother={._$},% sensitive,% morecomment=[l]\#,% - morestring=[d]"% + morestring=[d]",% + morestring=[d]'% 2001 Robert Denham }% \lst@definelanguage{SAS}% - {prockeywords={proc},% + {procnamekeys={proc},% morekeywords={DATA,AND,OR,NOT,EQ,GT,LT,GE,LE,NE,INFILE,INPUT,DO,BY,% TO,SIN,COS,OUTPUT,END,PLOT,RUN,LIBNAME,VAR,TITLE,FIRSTOBS,OBS,% DELIMITER,DLM,EOF,ABS,DIM,HBOUND,LBOUND,MAX,MIN,MOD,SIGN,SQRT,% @@ -342,7 +373,7 @@ SHOW},% otherkeywords={!,!=,~,$,*,\&,_,/,<,>=,=<,>},% morestring=[d]'% - }% + }[keywords,comments,strings,procnames]% \lst@definelanguage[AlLaTeX]{TeX}[LaTeX]{TeX}% {moretexcs={AtBeginDocument,AtBeginDvi,AtEndDocument,AtEndOfClass,% AtEndOfPackage,ClassError,ClassInfo,ClassWarning,% diff --git a/docs/styles/lstmisc.sty b/docs/styles/lstmisc.sty index 18f669c9b5..55c9c68bad 100644 --- a/docs/styles/lstmisc.sty +++ b/docs/styles/lstmisc.sty @@ -4,240 +4,209 @@ %% %% The original source files were: %% -%% listings.dtx (with options: `misc') +%% listings.dtx (with options: `misc,0.21') %% %% 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 +%% (w)(c) 1996 -- 2002 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. %% +%% Permission is granted to modify the listings package as well as +%% lstdrvrs.dtx. You are not allowed to distribute a modified version +%% of the package or lstdrvrs.dtx unless you change the file names and +%% provide the original files. In any case it is better to contact the +%% address below; other users will welcome removed bugs, new features, +%% and additional programming languages. +%% %% 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. +%% product or if you use the package to prepare a commercial 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. For more +%% information about LaTeX see http://www.latex-project.org %% -%% 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. +%% No matter whether you use the package for a commercial or +%% non-commercial document, please send me a copy of the document (.dvi, +%% .ps, .pdf, hardcopy, etc.) to support further development---it is +%% easier to introduce new features or simplify things if I see how the +%% package is used by other people. %% %% Send comments and ideas on the package, error reports and additional %% programming languages to . %% -\ProvidesFile{lstmisc.sty}[2000/08/23 v0.21 (Carsten Heinz)] -\lst@AddToAtTop{\try@load@fontshape}{\def\space{ }} +\def\filedate{2002/04/01} +\def\fileversion{1.0} +\ProvidesFile{lstmisc.sty} + [\filedate\space\fileversion\space(Carsten Heinz)] +\lst@CheckVersion\fileversion + {\typeout{^^J% + ***^^J% + *** This file requires `listings.sty' version \fileversion.^^J% + *** You have a serious problem, so I'm exiting ...^^J% + ***^^J}% + \batchmode \@@end} +\lst@BeginAspect{writefile} +\newtoks\lst@WFtoken % global +\lst@AddToHook{InitVarsBOL}{\global\lst@WFtoken{}} +\newwrite\lst@WF +\global\let\lst@WFifopen\iffalse % init +\gdef\lst@WFWriteToFile{% + \begingroup + \let\lst@UM\@empty + \expandafter\edef\expandafter\lst@temp\expandafter{\the\lst@WFtoken}% + \immediate\write\lst@WF{\lst@temp}% + \endgroup + \global\lst@WFtoken{}} +\gdef\lst@WFAppend#1{% + \global\lst@WFtoken=\expandafter{\the\lst@WFtoken#1}} +\gdef\lst@BeginWriteFile{\lst@WFBegin\@gobble} +\gdef\lst@BeginAlsoWriteFile{\lst@WFBegin\lst@OutputBox} +\begingroup \catcode`\^^I=11 +\gdef\lst@WFBegin#1#2{% + \begingroup + \let\lst@OutputBox#1% + \def\lst@Append##1{% + \advance\lst@length\@ne + \expandafter\lst@token\expandafter{\the\lst@token##1}% + \ifx ##1\lst@outputspace \else + \lst@WFAppend##1% + \fi}% + \lst@lAddTo\lst@PreGotoTabStop{\lst@WFAppend{^^I}}% + \lst@lAddTo\lst@ProcessSpace{\lst@WFAppend{ }}% + \let\lst@DeInit\lst@WFDeInit + \let\lst@MProcessListing\lst@WFMProcessListing + \lst@WFifopen\else + \immediate\openout\lst@WF=#2\relax + \global\let\lst@WFifopen\iftrue + \@gobbletwo\fi\fi + \fi} +\endgroup +\gdef\lst@EndWriteFile{% + \immediate\closeout\lst@WF \endgroup + \global\let\lst@WFifopen\iffalse} +\global\let\lst@WFMProcessListing\lst@MProcessListing +\global\let\lst@WFDeInit\lst@DeInit +\lst@AddToAtTop\lst@WFMProcessListing{\lst@WFWriteToFile} +\lst@AddToAtTop\lst@WFDeInit{% + \ifnum\lst@length=\z@\else \lst@WFWriteToFile \fi} +\lst@EndAspect \lst@BeginAspect{strings} \gdef\lst@stringtypes{d,b,m,bd,db} -\global\let\lst@xstringtypes\@empty -\lst@Key{string}\relax{% - \lstKV@XOptArg[d]{#1}\lst@SAC - {String}s\lst@stringtypes\lst@xstringtypes - \lst@DefStrings\lst@FVConvert \@empty} -\lst@Key{morestring}\relax{% - \lstKV@XOptArg[d]{#1}\lst@SAC - {String}s\lst@stringtypes\lst@xstringtypes - \lst@DefStrings\lst@FVConvert \relax} -\lst@Key{deletestring}\relax{% - \lstKV@XOptArg[d]{#1}\lst@SACDelete - {String}s\lst@stringtypes\lst@xstringtypes - \lst@DefStrings} -\lst@AddToHook{SetLanguage}{\let\lst@DefStrings\@empty} -\lst@AddToHook{SelectCharTable}{\lst@DefStrings} +\gdef\lst@StringKey#1#2{% + \lst@Delim\lst@stringstyle #2\relax + {String}\lst@stringtypes #1% + {\lst@BeginString\lst@EndString}% + \@@end\@empty{}} +\lst@Key{string}\relax{\lst@StringKey\@empty{#1}} +\lst@Key{morestring}\relax{\lst@StringKey\relax{#1}} +\lst@Key{deletestring}\relax{\lst@StringKey\@nil{#1}} \lst@Key{stringstyle}{}{\def\lst@stringstyle{#1}} \lst@AddToHook{EmptyStyle}{\let\lst@stringstyle\@empty} -\lst@Key{stringspaces}{true}[t]{\lstKV@SetIf{#1}\lst@ifstringspaces} -\lst@NewMode\lst@stringmode -\gdef\lst@BeginString#1#2{% - \lst@TrackNewLines - \lst@ifexstrings #2\lst@PrintToken \fi - \lst@EnterMode{#1}% - {\lst@modetrue \let\lst@currstyle\lst@stringstyle}% - \lst@ifexstrings\else #2\lst@PrintToken \fi - \lst@ifstringspaces - \lst@keepspacestrue - \let\lst@outputspace\lst@visiblespace - \fi} +\lst@Key{showstringspaces}t[t]{\lstKV@SetIf{#1}\lst@ifshowstringspaces} +\gdef\lst@BeginString{% + \lst@DelimOpen + \lst@ifexstrings\else + {\lst@ifshowstringspaces + \lst@keepspacestrue + \let\lst@outputspace\lst@visiblespace + \fi}} \lst@AddToHookExe{ExcludeDelims}{\let\lst@ifexstrings\iffalse} -\gdef\lst@EndString#1{% - \lst@ifexstrings - \lst@PrintToken \lst@LeaveMode - #1\lst@PrintToken - \else - #1\lst@PrintToken \lst@LeaveMode +\gdef\lst@EndString{\lst@DelimClose\lst@ifexstrings\else} +\gdef\lst@StringDM@d#1#2\@empty#3#4#5{% + \lst@CArg #2\relax\lst@DefDelimBE{}{}{}#3{#1}{#5}#4} +\gdef\lst@StringDM@b#1#2\@empty#3#4#5{% + \let\lst@ifbstring\iftrue + \lst@CArg #2\relax\lst@DefDelimBE + {\lst@ifletter \lst@Output \lst@letterfalse \fi}% + {\ifx\lst@lastother\lstum@backslash + \expandafter\@gobblethree + \fi}{}#3{#1}{#5}#4} +\global\let\lst@ifbstring\iffalse % init +\lst@AddToHook{SelectCharTable}{% + \lst@ifbstring + \lst@CArgX \\\\\relax \lst@CDefX{}% + {\lst@ProcessOther\lstum@backslash + \lst@ProcessOther\lstum@backslash}% + {}% \fi} -\lst@Key{stringtest}\relax[t]{\lstKV@SetIf{#1}\lst@ifstringtest} -\lst@AddToHook{SetLanguage}{\let\lst@ifstringtest\iftrue} -\lst@AddToHook{Init} - {\lst@ifstringtest\else \let\lst@TestStringMode\@empty \fi} -\gdef\lst@TestStringMode{% - \ifnum\lst@mode=\lst@stringmode - \PackageWarning{Listings}{String constant exceeds line}% - \lst@EndString{}% - \fi} -\lst@AddToHook{EOL}{\lst@TestStringMode} -\gdef\lst@ProcessString@d#1{% - \lst@ifletter \lst@Output\lst@letterfalse \fi - \let\lst@next\@empty - \ifnum\lst@mode=\lst@stringmode - \ifx #1\lst@closestring - \let\lst@next\lst@EndString - \fi - \else - \lst@ifmode\else - \let\lst@closestring#1% - \def\lst@next{\lst@BeginString\lst@stringmode}% - \fi - \fi - \expandafter\lst@next\csname\@lst s@s#1\endcsname} -\gdef\lst@ProcessString@b#1{% - \lst@ifletter \lst@Output\lst@letterfalse \fi - \let\lst@next\@empty - \ifnum\lst@mode=\lst@stringmode - \ifx\lst@lastother\lstum@backslash\else - \ifx #1\lst@closestring - \let\lst@next\lst@EndString - \fi - \fi - \else - \lst@ifmode\else - \let\lst@closestring#1% - \def\lst@next{\lst@BeginString\lst@stringmode}% - \fi - \fi - \expandafter\lst@next\csname lsts@s#1\endcsname} -\global\let\lst@ProcessString@bd\lst@ProcessString@b -\global\let\lst@ProcessString@db\lst@ProcessString@bd -\gdef\lst@ProcessString@m#1{% - \let\lst@next\@empty - \ifnum\lst@mode=\lst@stringmode - \lst@ifletter \lst@Output\lst@letterfalse \fi - \ifx #1\lst@closestring - \let\lst@next\lst@EndString - \fi - \else - \lst@ifletter - \lst@Output\lst@letterfalse - \else - \ifx\lst@lastother)\else \lst@ifmode\else - \let\lst@closestring#1% - \def\lst@next{\lst@BeginString\lst@stringmode}% - \fi \fi - \fi - \fi - \expandafter\lst@next\csname lsts@s#1\endcsname} +\global\let\lst@StringDM@bd\lst@StringDM@b +\global\let\lst@StringDM@db\lst@StringDM@bd +\gdef\lst@StringDM@m#1#2\@empty#3#4#5{% + \lst@CArg #2\relax\lst@DefDelimBE{}{}% + {\let\lst@next\@gobblethree + \lst@ifletter\else + \ifx\lst@lastother)\else \ifx\lst@lastother]\else + \let\lst@next\@empty + \fi \fi \fi + \lst@next}#3{#1}{#5}#4} \lst@EndAspect \lst@BeginAspect{comments} -\gdef\lst@commenttypes{l,f,s,d,n} -\gdef\lst@xcommenttypes{l,f,s,d,n} -\lst@Key{comment}{} - {\lstKV@XOptArg[]{#1}\lst@SAC - {Comment}c\lst@commenttypes\lst@xcommenttypes - \lst@DefComments\lst@FVConvert \@empty} -\lst@Key{morecomment}\relax - {\lstKV@XOptArg[]{#1}\lst@SAC - {Comment}c\lst@commenttypes\lst@xcommenttypes - \lst@DefComments\lst@FVConvert \relax} -\lst@Key{deletecomment}\relax{% - \lstKV@XOptArg[]{#1}\lst@SACDelete - {Comment}c\lst@commenttypes\lst@xcommenttypes - \lst@DefComments} -\lst@AddToHook{SelectCharTable}{\lst@DefComments} -\lst@AddToHook{SetLanguage}{\let\lst@DefComments\@empty} +\gdef\lst@commenttypes{l,f,s,n} +\gdef\lst@CommentKey#1#2{% + \lst@Delim\lst@commentstyle #2\relax + {Comment}\lst@commenttypes #1% + {\lst@BeginComment\lst@EndComment}% + i\@empty{\lst@BeginInvisible\lst@EndInvisible}} +\lst@Key{comment}\relax{\lst@CommentKey\@empty{#1}} +\lst@Key{morecomment}\relax{\lst@CommentKey\relax{#1}} +\lst@Key{deletecomment}\relax{\lst@CommentKey\@nil{#1}} \lst@Key{commentstyle}{}{\def\lst@commentstyle{#1}} -\lst@AddToHook{EmptyStyle}{\let\lst@commenstyle\itshape} -\gdef\lst@BeginComment#1#2#3\@empty{% - \lst@TrackNewLines \lst@PrintToken - \lst@EnterMode{#1}{\lst@modetrue \let\lst@currstyle#2}% - \lst@mode\lst@nomode #3\lst@mode#1\relax - \lsthk@AfterBeginComment} +\lst@AddToHook{EmptyStyle}{\let\lst@commentstyle\itshape} +\gdef\lst@BeginComment{% + \lst@DelimOpen + \lst@ifexcomments\else + \lsthk@AfterBeginComment} +\gdef\lst@EndComment{\lst@DelimClose\lst@ifexcomments\else} \lst@AddToHook{AfterBeginComment}{} -\gdef\lst@EndComment#1\@empty{% - #1% - \lst@PrintToken \lst@LeaveMode - \let\lst@lastother\@empty} -\gdef\lst@CommentB#1#2#3#4#5#6#7#8#9{% - \lst@CDef#1#2{#3}#4% - {#6}% - {\let\lst@bnext\lst@CArgEmpty - \lst@ifmode #7\else - #8% - \def\lst@bnext{\lst@BeginComment#5#9}% - \fi - \lst@bnext}% - \@empty} -\gdef\lst@CommentE#1#2#3#4#5#6#7#8{% - \lst@CDef#1#2{#3}#4% - {#6}% - {\let\lst@enext\lst@CArgEmpty - \ifnum\lst@mode=#5% - #7% - \let\lst@enext\lst@EndComment - \else - #8% - \fi - \lst@enext}% - \@empty} -\lst@AddToHook{Init}{\let\lst@bnext\relax \let\lst@enext\relax} -\lst@NewMode\lst@CLmode -\lst@AddToHook{EOL}{\ifnum\lst@mode=\lst@CLmode \lst@LeaveMode \fi} -\gdef\lst@Comment@l#1\@empty{% - \lst@CArg #1\relax - \lst@CommentB\lst@CLmode{}{}{}\lst@commentstyle} -\gdef\lst@Comment@f{\@ifnextchar[\lst@Comment@@f{\lst@Comment@@f[0]}} -\gdef\lst@Comment@@f[#1]#2{% - \ifx\@empty#2\@empty\else - \lst@CArg #2\relax\lst@CommentB\lst@CLmode{}{}% - {\lst@CalcLineLength - \ifnum\@tempcnta=#1\else - \expandafter\@gobblethree - \fi}% - \lst@commentstyle - \def\lst@next{\lst@Comment@@f[#1]}% - \expandafter\lst@next +\lst@AddToHookExe{ExcludeDelims}{\let\lst@ifexcomments\iffalse} +\gdef\lst@BeginInvisible#1#2#3\@empty{% + \lst@TrackNewLines \lst@XPrintToken + \lst@BeginDropOutput{#1}} +\gdef\lst@EndInvisible#1\@empty{\lst@EndDropOutput} +\gdef\lst@CommentDM@l#1#2\@empty#3#4#5{% + \lst@CArg #2\relax\lst@DefDelimB{}{}{}#3{#1}{#5\lst@Lmodetrue}} +\gdef\lst@CommentDM@f#1{% + \@ifnextchar[{\lst@Comment@@f{#1}}% + {\lst@Comment@@f{#1}[0]}} +\gdef\lst@Comment@@f#1[#2]#3\@empty#4#5#6{% + \lst@CArg #3\relax\lst@DefDelimB{}{}% + {\lst@CalcColumn + \ifnum #2=\@tempcnta\else + \expandafter\@gobblethree + \fi}% + #4{#1}{#6\lst@Lmodetrue}} +\gdef\lst@CommentDM@s#1#2#3\@empty#4#5#6{% + \lst@CArg #2\relax\lst@DefDelimB{}{}{}#4{#1}{#6}% + \lst@CArg #3\relax\lst@DefDelimE{}{}{}#5{#1}} +\gdef\lst@CommentDM@n#1#2#3\@empty#4#5#6{% + \ifx\@empty#3\@empty\else + \def\@tempa{#2}\def\@tempb{#3}% + \ifx\@tempa\@tempb + \PackageError{Listings}{Identical delimiters}% + {These delimiters make no sense with nested comments.}% + \else + \lst@CArg #2\relax\lst@DefDelimB + {}% + {\ifnum\lst@mode=#1\relax \expandafter\@gobble \fi}% + {}#4{#1}{#6}% + \lst@CArg #3\relax\lst@DefDelimE{}{}{}#5{#1}% + \fi \fi} -\gdef\lst@CommentDM@s#1#2#3\@empty{% - \lst@CArg #2\relax\lst@CommentB{#1}{}{}{}\lst@commentstyle - \lst@CArg #3\relax\lst@CommentE{#1}{}{}{}} -\gdef\lst@Comment@d#1\@empty{\lstKV@FourArg{#1}% - {\ifx\@empty##4\@empty\else - \lst@UseDynamicMode\lst@CommentDM@s{##1}{##2}\@empty - \lst@UseDynamicMode\lst@CommentDM@s{##3}{##4}\@empty - \fi}} -\gdef\lst@CommentDM@n#1#2\@empty{\lstKV@TwoArg{#2}% - {\ifx\@empty##2\@empty\else - \def\@tempa{##1}\def\@tempb{##2}% - \ifx\@tempa\@tempb - \PackageError{Listings}{Identical delimiters}% - {These delimiters make no sense with nested comments.}% - \else - \lst@CArg ##1\relax\lst@CommentB{#1}% - {}% - {\ifnum\lst@mode=#1\relax \expandafter\@gobble \fi}% - {}\lst@commentstyle - \lst@CArg ##2\relax\lst@CommentE{#1}{}{}{}% - \fi - \fi}} \lst@EndAspect \lst@BeginAspect{pod} \lst@Key{printpod}{false}[t]{\lstKV@SetIf{#1}\lst@ifprintpod} \lst@Key{podcomment}{false}[t]{\lstKV@SetIf{#1}\lst@ifpodcomment} \lst@AddToHookExe{SetLanguage}{\let\lst@ifpodcomment\iffalse} \lst@NewMode\lst@PODmode -\lst@NewMode\lst@PODmode \lst@AddToHook{SelectCharTable} {\lst@ifpodcomment - \lst@CArgX =\relax\lst@CommentB\lst@PODmode - {}{}% + \lst@CArgX =\relax\lst@DefDelimB{}{}% {\ifnum\@tempcnta=\z@ \lst@ifprintpod\else \def\lst@bnext{\lst@BeginDropOutput\lst@PODmode}% @@ -246,53 +215,42 @@ \else \expandafter\@gobblethree \fi}% - \lst@commentstyle - \lst@CArgX =cut\^^M\relax\lst@CommentE\lst@PODmode - {\lst@CalcLineLength}% + \lst@BeginComment\lst@PODmode\lst@commentstyle + \lst@CArgX =cut\^^M\relax\lst@DefDelimE + {\lst@CalcColumn}% {\ifnum\@tempcnta=\z@\else \expandafter\@gobblethree \fi}% {}% + \lst@EndComment\lst@PODmode \fi} \lst@EndAspect \lst@BeginAspect{escape} \lst@Key{texcl}{false}[t]{\lstKV@SetIf{#1}\lst@iftexcl} \lst@AddToHook{TextStyle}{\let\lst@iftexcl\iffalse} \lst@AddToHook{EOL} - {\ifnum\lst@mode=\lst@TeXCLmode + {\ifnum\lst@mode=\lst@TeXLmode \expandafter\lst@escapeend \expandafter\lst@LeaveAllModes \expandafter\lst@ReenterModes \fi} \lst@AddToHook{AfterBeginComment} - {\lst@iftexcl \ifnum\lst@mode=\lst@CLmode + {\lst@iftexcl \lst@ifLmode \lst@ifdropinput\else \lst@PrintToken \lst@LeaveMode \lst@InterruptModes - \lst@EnterMode{\lst@TeXCLmode}{\lst@modetrue\lst@commentstyle}% + \lst@EnterMode{\lst@TeXLmode}{\lst@modetrue\lst@commentstyle}% \expandafter\expandafter\expandafter\lst@escapebegin - \fi \fi} -\lst@NewMode\lst@TeXCLmode -\gdef\lst@ActiveCDefX#1#2#3#4#5#6#7{% - \let#4#1% + \fi \fi \fi} +\lst@NewMode\lst@TeXLmode +\gdef\lst@ActiveCDefX#1{\lst@ActiveCDefX@#1} +\gdef\lst@ActiveCDefX@#1#2#3{ \catcode`#1\active\lccode`\~=`#1% - \ifx\@empty#2\@empty - \lowercase{\def~}{#5\def\lst@next{#6#7}\lst@next}% - \else \ifx\@empty#3\@empty - \lowercase{\def~}##1{% - #5% - \ifx##1#2\def\lst@next{#6#7}\else - \def\lst@next{#4##1}\fi - \lst@next}% - \else - \lowercase{\def~}{% - #5% - \lst@IfNextCharsArg{#2#3}{#6#7}% - {\expandafter#4\lst@eaten}}% - \fi \fi} + \lowercase{\lst@CDefIt~}{#2}{#3}{}} \gdef\lst@Escape#1#2#3#4{% \lst@CArgX #1\relax\lst@CDefX {}% - {\lst@TrackNewLines\lst@UseLostSpace \lst@PrintToken + {\lst@ifdropinput\else + \lst@TrackNewLines\lst@OutputLostSpace \lst@XPrintToken \lst@InterruptModes \lst@EnterMode{\lst@TeXmode}{\lst@modetrue}% \ifx\^^M#2% @@ -303,10 +261,12 @@ \else \lst@CArg #2\relax\lst@ActiveCDefX {}% - {\lst@escapeend #4\lst@LeaveAllModes\lst@ReenterModes}% + {\lst@escapeend #4\lst@LeaveAllModes\lst@ReenterModes + \lst@whitespacefalse}% {}% \fi - #3\lst@escapebegin}% + #3\lst@escapebegin + \fi}% {}} \lst@NewMode\lst@TeXmode \lst@Key{escapebegin}{}{\def\lst@escapebegin{#1}} @@ -330,57 +290,14 @@ {\setbox\@tempboxa=\hbox\bgroup$}% {$\egroup \lst@CalcLostSpaceAndOutput}\fi} \lst@EndAspect -\lst@BeginAspect{writefile} -\newwrite\lst@WF \newtoks\lst@WFtoken -\lst@AddToHook{InitVarsBOL}{\global\lst@WFtoken{}} -\gdef\lst@WFWriteToFile{% - \begingroup - \let\lst@UM\@empty - \expandafter\edef\expandafter\lst@temp\expandafter{\the\lst@WFtoken}% - \immediate\write\lst@WF{\lst@temp}% - \endgroup - \global\lst@WFtoken{}} -\gdef\lst@WFAppend#1{% - \global\expandafter\lst@WFtoken\expandafter{\the\lst@WFtoken#1}} -\gdef\lst@BeginWriteFile{% - \begingroup - \let\lst@OutputBox\@gobble - \lst@WFBegin} -\gdef\lst@BeginAlsoWriteFile{\begingroup \lst@WFBegin} -\begingroup \catcode`\^^I=11 -\gdef\lst@WFBegin#1{% - \def\lst@Append##1{\advance\lst@length\@ne - \expandafter\lst@token\expandafter{\the\lst@token##1}% - \lst@WFAppend##1}% - \def\lst@AppendOther##1{% - \let\lst@lastother=##1\advance\lst@length\@ne - \expandafter\lst@token\expandafter{\the\lst@token##1}% - \ifx ##1\lst@outputspace - \lst@WFAppend{ }% - \else - \lst@WFAppend##1% - \fi}% - \lst@lAddTo\lst@PreGotoTabStop{\lst@WFAppend{^^I}}% - \def\lst@ProcessSpace{% - \lst@ifletter \lst@Output\lst@letterfalse \fi - \lst@AppendOther\lst@outputspace}% - \let\lst@DeInit\lst@WFDeInit - \let\lst@MProcessListing\lst@WFMProcessListing - \immediate\openout\lst@WF=#1\relax}% -\endgroup -\gdef\lst@EndWriteFile{\immediate\closeout\lst@WF \endgroup} -\global\let\lst@WFMProcessListing\lst@MProcessListing -\global\let\lst@WFDeInit\lst@DeInit -\lst@AddToAtTop\lst@WFMProcessListing{\lst@WFWriteToFile} -\lst@AddToAtTop\lst@WFDeInit{% - \ifnum\lst@length=\z@\else \lst@WFWriteToFile \fi} -\lst@EndAspect \lst@BeginAspect{keywords} +\global\let\lst@ifsensitive\iftrue % init +\global\let\lst@ifsensitivedefed\iffalse % init % \global \lst@ifsavemem\else \gdef\lst@KeywordTest#1#2#3{% \begingroup \let\lst@UM\@empty \global\expandafter\let\expandafter\@gtempa - \csname lst#1@\the\lst@token\endcsname + \csname\@lst#1@\the\lst@token\endcsname \endgroup \ifx\@gtempa\relax\else \let\lst@thestyle\@gtempa @@ -391,7 +308,7 @@ \gdef\lst@KEYWORDTEST@#1\relax#2#3#4{% \begingroup \let\lst@UM\@empty \global\expandafter\let\expandafter\@gtempa - \csname lst#2@#1\endcsname + \csname\@lst#2@#1\endcsname \endgroup \ifx\@gtempa\relax\else \let\lst@thestyle\@gtempa @@ -399,7 +316,7 @@ \gdef\lst@WorkingTest#1#2#3{% \begingroup \let\lst@UM\@empty \global\expandafter\let\expandafter\@gtempa - \csname lst#1@\the\lst@token\endcsname + \csname\@lst#1@\the\lst@token\endcsname \endgroup \@gtempa} \gdef\lst@WORKINGTEST{% @@ -408,7 +325,7 @@ \gdef\lst@WORKINGTEST@#1\relax#2#3#4{% \begingroup \let\lst@UM\@empty \global\expandafter\let\expandafter\@gtempa - \csname lst#2@#1\endcsname + \csname\@lst#2@#1\endcsname \endgroup \@gtempa} \gdef\lst@DefineKeywords#1#2#3{% @@ -418,8 +335,8 @@ \def\lst@next{\uppercase\expandafter{\expandafter\lst@for#2}}% \fi \lst@next\do - {\expandafter\ifx\csname lst#1@##1\endcsname\relax - \global\expandafter\let\csname lst#1@##1\endcsname#3% + {\expandafter\ifx\csname\@lst#1@##1\endcsname\relax + \global\expandafter\let\csname\@lst#1@##1\endcsname#3% \fi}} \gdef\lst@UndefineKeywords#1#2#3{% \lst@ifsensitivedefed @@ -428,8 +345,8 @@ \def\lst@next{\uppercase\expandafter{\expandafter\lst@for#2}}% \fi \lst@next\do - {\expandafter\ifx\csname lst#1@##1\endcsname#3% - \global\expandafter\let\csname lst#1@##1\endcsname\relax + {\expandafter\ifx\csname\@lst#1@##1\endcsname#3% + \global\expandafter\let\csname\@lst#1@##1\endcsname\relax \fi}} \fi \lst@ifsavemem @@ -471,7 +388,7 @@ \global\let\lst@WORKINGTEST\lst@WorkingTest \fi \lst@Key{sensitive}\relax[t]{\lstKV@SetIf{#1}\lst@ifsensitive} -\lst@AddToHookExe{SetLanguage}{\let\lst@ifsensitive\iftrue} +\lst@AddToHook{SetLanguage}{\let\lst@ifsensitive\iftrue} \lst@AddToHook{Init} {\lst@ifsensitive\else \let\lst@KeywordTest\lst@KEYWORDTEST @@ -503,8 +420,8 @@ \lst@ifsavemem \@tempa \else - \@ifundefined{lst@if#1@ins}% - {\@tempa \global\@namedef{lst@if#1@ins}{}}% + \@ifundefined{\@lst#1@if@ins}% + {\@tempa \global\@namedef{\@lst#1@if@ins}{}}% {}% \fi} {}} @@ -553,13 +470,12 @@ \lst@TK@@{#1}#2#3} \lst@AddToHook{InitVars} {\global\let\lst@ifsensitivedefed\lst@ifsensitive} -\global\let\lst@ifsensitivedefed\iffalse % init % \global \gdef\lst@PostTrackKeywords#1#2#3#4{% \lst@ifsavemem\else \global\let#3#1% \global\let#4#2% \fi} -\lst@Key{defaultclass}\@ne{\def\lst@defaultclass{#1}} +\lst@Key{classoffset}\z@{\def\lst@classoffset{#1}} \gdef\lst@InstallFamily#1#2#3#4#5{% \lst@Key{#2}\relax{\lst@UseFamily{#2}##1\relax\lst@MakeKeywords}% \lst@Key{more#2}\relax @@ -567,14 +483,14 @@ \lst@Key{delete#2}\relax {\lst@UseFamily{#2}##1\relax\lst@DeleteKeywords}% \ifx\@empty#3\@empty\else - \lst@Key{#3}{#4}{\lstKV@OptArg[\lst@defaultclass]{##1}% - {\@tempcnta####1\relax + \lst@Key{#3}{#4}{\lstKV@OptArg[\@ne]{##1}% + {\@tempcnta\lst@classoffset \advance\@tempcnta####1\relax \@namedef{lst@#3\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}{####2}}}% \fi \expandafter\lst@InstallFamily@ - \csname lst@#2@data\expandafter\endcsname - \csname lst@#5\endcsname {#1}{#2}{#3}} + \csname\@lst @#2@data\expandafter\endcsname + \csname\@lst @#5\endcsname {#1}{#2}{#3}} \gdef\lst@InstallFamily@#1#2#3#4#5#6#7#8{% \gdef#1{{#3}{#4}{#5}#2#7}% \long\def\lst@temp##1{#6}% @@ -584,56 +500,55 @@ \lst@AddTo#1{w#8}% \global\@namedef{lst@g#4@wp}##1{#6}% \fi} -\gdef\lst@ProvideFamily#1{% - \@ifundefined{lst@#1\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}% - {\expandafter\expandafter\expandafter\lst@ProvideFamily@ - \csname lst@#1@data\endcsname - {\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}}% - {}} -\gdef\lst@ProvideFamily@#1#2#3#4#5#6#7#8{% - \expandafter\xdef\csname lst@g#2#8@sty\endcsname - {\if #6w% - \expandafter\noexpand\csname lst@g#2@wp\endcsname{#8}% - \else - \expandafter\noexpand\csname lst@#3#8\endcsname - \fi}% - \ifx\@empty#3\@empty\else - \edef\lst@temp{\noexpand\lst@AddToHook{Init}{% - \noexpand\lst@ProvideStyle\expandafter\noexpand - \csname lst@#3#8\endcsname\noexpand#4}}% - \lst@temp - \fi - \expandafter\lst@ProvideFamily@@ - \csname lst@#2#8@list\expandafter\endcsname - \csname lst@#2#8\expandafter\endcsname - \csname lst@#2#8@also\expandafter\endcsname - \csname lst@g#2#8@list\expandafter\endcsname - \csname lst@g#2#8\expandafter\endcsname - \csname lst@g#2#8@sty\expandafter\endcsname - {#1}#5#6#7} -\gdef\lst@ProvideFamily@@#1#2#3#4#5#6#7#8{% - \gdef#1{#2#5}\global\let#2\@empty \global\let#3\@empty % init - \gdef#4{#2#5}\global\let#5\@empty % init - \lst@AddToHook{Init}{\expandafter\lst@UseBasicClasses#3{}{}{}}% - \if #8l\relax - \lst@AddToHook{SetLanguage}{\def#1{#2#5}\let#2\@empty}% - \fi - \lst@InstallTest{#7}#1#2#4#5#6} \gdef\lst@UseFamily#1{% \def\lst@family{#1}% - \@ifnextchar[\lst@UseFamily@{\lst@UseFamily@[\lst@defaultclass]}} + \@ifnextchar[\lst@UseFamily@{\lst@UseFamily@[\@ne]}} \gdef\lst@UseFamily@[#1]{% - \@tempcnta#1\relax + \@tempcnta\lst@classoffset \advance\@tempcnta#1\relax \lst@ProvideFamily\lst@family \lst@UseFamily@a {\lst@family\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}} \gdef\lst@UseFamily@a#1{% \expandafter\lst@UseFamily@b - \csname lst@#1@list\expandafter\endcsname - \csname lst@#1\expandafter\endcsname - \csname lst@#1@also\expandafter\endcsname - \csname lst@g#1\endcsname} + \csname\@lst @#1@list\expandafter\endcsname + \csname\@lst @#1\expandafter\endcsname + \csname\@lst @#1@also\expandafter\endcsname + \csname\@lst @g#1\endcsname} \gdef\lst@UseFamily@b#1#2#3#4#5\relax#6{\lstKV@XOptArg[]{#5}#6#1#2#3#4} +\gdef\lst@ProvideFamily#1{% + \@ifundefined{lst@#1\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}% + {\expandafter\expandafter\expandafter\lst@ProvideFamily@ + \csname\@lst @#1@data\endcsname + {\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}}% + {}} +\gdef\lst@ProvideFamily@#1#2#3#4#5#6#7#8{% + \expandafter\xdef\csname\@lst @g#2#8@sty\endcsname + {\if #6w% + \expandafter\noexpand\csname\@lst @g#2@wp\endcsname{#8}% + \else + \expandafter\noexpand\csname\@lst @#3#8\endcsname + \fi}% + \ifx\@empty#3\@empty\else + \edef\lst@temp{\noexpand\lst@AddToHook{Init}{% + \noexpand\lst@ProvideStyle\expandafter\noexpand + \csname\@lst @#3#8\endcsname\noexpand#4}}% + \lst@temp + \fi + \expandafter\lst@ProvideFamily@@ + \csname\@lst @#2#8@list\expandafter\endcsname + \csname\@lst @#2#8\expandafter\endcsname + \csname\@lst @#2#8@also\expandafter\endcsname + \csname\@lst @g#2#8@list\expandafter\endcsname + \csname\@lst @g#2#8\expandafter\endcsname + \csname\@lst @g#2#8@sty\expandafter\endcsname + {#1}#5#6#7} +\gdef\lst@ProvideFamily@@#1#2#3#4#5#6#7#8{% + \gdef#1{#2#5}\global\let#2\@empty \global\let#3\@empty % init + \gdef#4{#2#5}\global\let#5\@empty % init + \if #8l\relax + \lst@AddToHook{SetLanguage}{\def#1{#2#5}\let#2\@empty}% + \fi + \lst@InstallTest{#7}#1#2#4#5#6} \gdef\lst@InstallKeywords#1#2#3#4#5{% \lst@Key{#2}\relax {\lst@UseFamily{#2}[\@ne]##1\relax\lst@MakeKeywords}% @@ -645,16 +560,16 @@ \lst@Key{#3}{#4}{\@namedef{lst@#3}{##1}}% \fi \expandafter\lst@InstallFamily@ - \csname lst@#2@data\expandafter\endcsname - \csname lst@#5\endcsname {#1}{#2}{#3}} + \csname\@lst @#2@data\expandafter\endcsname + \csname\@lst @#5\endcsname {#1}{#2}{#3}} \gdef\lst@ProvideStyle#1#2{% \ifx#1\@undefined \let#1#2% \else\ifx#1\relax \let#1#2\fi\fi} \gdef\lst@BuildClassList#1#2,{% \ifx\relax#2\@empty\else \ifx\@empty#2\@empty\else - \lst@lExtend#1{\csname lst@#2\expandafter\endcsname - \csname lst@g#2\endcsname}% + \lst@lExtend#1{\csname\@lst @#2\expandafter\endcsname + \csname\@lst @g#2\endcsname}% \fi \expandafter\lst@BuildClassList\expandafter#1 \fi} @@ -678,51 +593,11 @@ \lst@MakeMoreKeywords[#1]{#2}#3#4#5#6} \gdef\lst@MakeMoreKeywords[#1]#2#3#4#5#6{% \lst@BuildClassList#3#1,\relax,% - \lst@DefOther\lst@temp{,#2}\lst@lExtend#4\lst@temp - \expandafter\lst@SpecialKeywordScan\expandafter - #4\expandafter#5#5{}{}} + \lst@DefOther\lst@temp{,#2}\lst@lExtend#4\lst@temp} \gdef\lst@DeleteKeywords[#1]#2#3#4#5#6{% \lst@MakeKeywords[#1]{#2}\@tempa\@tempb#5#6% \lst@DeleteClassesIn#3\@tempa - \lst@DeleteKeysIn#4\@tempb - \lst@SpecialKeywordScan#4#5{}{}} -\lst@Key{specialscan}t[t]{\lstKV@SetIf{#1}\lst@ifspecialscan} -\lst@AddToHook{SelectLanguage}{\let\lst@ifspecialscan\iftrue} -\lst@DefOther\lst@others{!"\#\%&'()*+-./0123456789:;<=>?[\]^`\{|\}~} -\global\let\lst@others\lst@others % init -\gdef\lst@SpecialKeywordScan#1#2#3#4{% - \lst@ifspecialscan - \def\lst@ialsoletter{#3}\def\lst@ialsodigit{#4}% - \expandafter\lst@SKS@\expandafter#1\lst@others\relax - \edef#2{{\lst@ialsoletter}{\lst@ialsodigit}}% - \fi} -\gdef\lst@SKS@#1#2{% - \ifx\relax#2% - \expandafter\@gobbletwo - \else - \def\lst@temp##1#2##2##3\relax{% - \ifx\@empty##2\else - \def\lst@temp####1,#2####2####3\relax{% - \ifx\@empty####2% - \lst@SKS@@#2% - \else - \lst@SKSAdd\lst@ialsoletter#2% - \fi}% - \expandafter\lst@temp\expandafter,#1,#2\@empty\relax - \fi}% - \expandafter\lst@temp #1#2\@empty\relax - \fi - \lst@SKS@#1} -\gdef\lst@SKS@@#1{% - \ifnum`#1<`0% - \lst@SKSAdd\lst@ialsodigit#1% - \else\ifnum`#1>`9% - \lst@SKSAdd\lst@ialsodigit#1% - \fi \fi} -\gdef\lst@SKSAdd#1#2{% - \def\lst@temp##1#2##2\relax{% - \ifx\@empty##2\@empty \lst@lAddTo#1{#2}\fi}% - \expandafter\lst@temp#1#2\relax} + \lst@DeleteKeysIn#4\@tempb} \lst@InstallFamily k{keywords}{keywordstyle}\bfseries{keywordstyle}{}ld \lst@Key{ndkeywords}\relax {\lst@UseFamily{keywords}[\tw@]#1\relax\lst@MakeKeywords}% @@ -731,28 +606,43 @@ \lst@Key{deletendkeywords}\relax {\lst@UseFamily{keywords}[\tw@]#1\relax\lst@DeleteKeywords}% \lst@Key{ndkeywordstyle}\relax{\@namedef{lst@keywordstyle2}{#1}}% -\lst@Key{otherkeywords}{}{\lst@DefActive\lst@otherkeywords{#1}} +\lst@Key{keywordsprefix}\relax{\lst@DefActive\lst@keywordsprefix{#1}} +\global\let\lst@keywordsprefix\@empty \lst@AddToHook{SelectCharTable} - {\expandafter\lst@DefineOtherKeywords\lst@otherkeywords,\relax,} -\gdef\lst@DefineOtherKeywords#1,{% - \ifx\relax#1\@empty\else - \ifx\@empty#1\@empty\else - \lst@CArg#1\relax\lst@CDef {}\lst@PrintOtherKeyword\@empty - \fi - \expandafter\lst@DefineOtherKeywords - \fi} + {\ifx\lst@keywordsprefix\@empty\else + \expandafter\lst@CArg\lst@keywordsprefix\relax + \lst@CDef{}% + {\lst@ifletter\else + \global\let\lst@prefixkeyword\@empty + \fi}% + {}% + \fi} +\lst@AddToHook{Init}{\global\let\lst@prefixkeyword\relax} +\lst@AddToHook{Output} + {\ifx\lst@prefixkeyword\@empty + \let\lst@thestyle\lst@gkeywords@sty + \global\let\lst@prefixkeyword\relax + \fi}% +\lst@Key{otherkeywords}{}{% + \let\lst@otherkeywords\@empty + \lst@for{#1}\do{% + \lst@MakeActive{##1}% + \lst@lExtend\lst@otherkeywords{% + \expandafter\lst@CArg\lst@temp\relax\lst@CDef + {}\lst@PrintOtherKeyword\@empty}}} +\lst@AddToHook{SelectCharTable}{\lst@otherkeywords} \gdef\lst@PrintOtherKeyword#1\@empty{% - \lst@PrintToken + \lst@XPrintToken \begingroup - \lst@modetrue \lsthk@TextStyle - \let\lst@ProcessDigit\lst@ProcessLetter - \let\lst@ProcessOther\lst@ProcessLetter - \lst@lettertrue - \lst@gkeywords@sty{#1\lst@PrintToken}% + \lst@modetrue \lsthk@TextStyle + \let\lst@ProcessDigit\lst@ProcessLetter + \let\lst@ProcessOther\lst@ProcessLetter + \lst@lettertrue + \lst@gkeywords@sty{#1\lst@XPrintToken}% \endgroup} \lst@EndAspect \lst@BeginAspect[keywords]{emph} -\lst@InstallFamily e{emph}{emphstyle}\relax{empty}{}od +\lst@InstallFamily e{emph}{emphstyle}{}{emphstyle}{}od \lst@EndAspect \lst@BeginAspect[keywords]{tex} \lst@InstallKeywords{cs}{texcs}{texcsstyle}\relax{keywordstyle} @@ -772,7 +662,7 @@ \lst@AddToHook{SelectCharTable} {\ifx\lst@directives\@empty\else \lst@DefSaveDef{`\#}\lsts@CCD - {\lst@CalcLineLength + {\lst@CalcColumn \lst@ifmode\else \ifnum\@tempcnta=\z@ \lst@EnterMode{\lst@CDmode}{}% @@ -780,7 +670,7 @@ \fi \ifnum\lst@mode=\lst@CDmode \ifnum\@tempcnta=\z@ - \lst@PrintToken + \lst@XPrintToken {\let\lst@currstyle\lst@directivestyle \lsts@CCD\lst@PrintToken}% \else \lsts@CCD @@ -789,26 +679,23 @@ \fi}% \fi} \lst@AddTo\lst@stringtypes{,directive} -\lst@AddTo\lst@xstringtypes{,directive} \gdef\lst@StringDM@directive#1#2#3\@empty{% \lst@CArg #2\relax\lst@CDef {}% {\let\lst@bnext\lst@CArgEmpty \ifnum\lst@mode=\lst@CDmode - \def\lst@bnext{\lst@EnterMode#1{\lst@modetrue - \let\lst@currstyle\lst@stringstyle}}% + \def\lst@bnext{\lst@BeginString{#1}}% \fi \lst@bnext}% \@empty \lst@CArg #3\relax\lst@CDef {}% {\let\lst@enext\lst@CArgEmpty - \ifnum\lst@mode=#1% - \let\lst@bnext\lst@EndXString + \ifnum #1=\lst@mode + \let\lst@bnext\lst@EndString \fi \lst@bnext}% \@empty} -\gdef\lst@EndXString#1\@empty{#1\lst@EndString} \lst@EndAspect \lst@BeginAspect[keywords]{html} \lst@NewMode\lst@insidemode @@ -818,18 +705,19 @@ \def\lst@DefInside{% \lst@DefSaveDef{`##1}\lsts@insideb {\lst@ifmode\else \ifnum\lst@mode=\lst@insidemode\else - \lst@PrintToken + \lst@XPrintToken \lst@EnterMode\lst@insidemode{}% \fi\fi \lsts@insideb}% \lst@DefSaveDef{`##2}\lsts@insidee {\ifnum\lst@mode=\lst@insidemode - \lsts@insidee \lst@PrintToken\lst@LeaveMode + \lsts@insidee \lst@XPrintToken\lst@LeaveMode \else \expandafter\lsts@insidee \fi}}% \fi\fi}} \lst@AddToHook{SelectCharTable}{\lst@DefInside} +\lst@AddToHook{SetLanguage}{\let\lst@DefInside\@empty} \lst@AddToHook{Output} {\ifx\lst@DefInside\@empty\else \ifx\lst@thestyle\lst@gkeywords@sty \ifnum\lst@mode=\lst@insidemode\else @@ -841,22 +729,22 @@ {\ifnum\lst@mode=\lst@insidemode \lst@ifusekeysinside\else \let\lst@thestyle\lst@gkeywords@sty \fi\fi} +\gdef\lst@BeginCDATA#1\@empty{% + \lst@TrackNewLines \lst@PrintToken + \lst@EnterMode\lst@GPmode{}\let\lst@ifmode\iffalse + \lst@mode\lst@insidemode #1\lst@mode\lst@GPmode\relax\lst@modetrue} \lst@EndAspect \lst@BeginAspect[keywords,comments]{keywordcomments} \lst@NewMode\lst@KCmode \lst@NewMode\lst@KCSmode \gdef\lst@BeginKC{% - \lst@token{}\lst@length\z@ + \lst@ResetToken \lst@BeginComment\lst@KCmode\lst@commentstyle\@empty} \gdef\lst@BeginKCS{% - \lst@token{}\lst@length\z@ + \lst@ResetToken \lst@BeginComment\lst@KCSmode\lst@commentstyle\@empty} \lst@AddToHook{PostOutput}{\lst@KCpost \global\let\lst@KCpost\@empty} -\global\let\lst@KCpost\@empty -\gdef\lst@EndKC{% - \xdef\@gtempa{% - \noexpand\lst@token{\the\lst@token}% - \noexpand\lst@length\the\lst@length\relax}% - \aftergroup\@gtempa \lst@LeaveMode} +\global\let\lst@KCpost\@empty % init +\gdef\lst@EndKC{\lst@SaveToken \lst@LeaveMode \lst@RestoreToken} \lst@InstallKeywords{kc}{keywordcomment}{}\relax{} {\ifnum\lst@mode=\lst@KCmode \edef\lst@temp{\the\lst@token}% @@ -878,9 +766,9 @@ \lst@AddToHook{SelectCharTable} {\ifx\lst@KCkeywords\@empty\else \lst@DefSaveDef{`\;}\lsts@EKC - {\lst@ifletter \lst@Output\lst@letterfalse \fi - \ifnum\lst@mode=\lst@KCmode \lst@EndComment \else - \ifnum\lst@mode=\lst@KCSmode \lst@EndComment + {\lst@XPrintToken + \ifnum\lst@mode=\lst@KCmode \lst@EndComment\@empty \else + \ifnum\lst@mode=\lst@KCSmode \lst@EndComment\@empty \fi \fi \lsts@EKC}% \fi} @@ -903,8 +791,8 @@ {kcs}owo \lst@EndAspect \lst@BeginAspect[keywords]{index} -\lst@InstallFamily w{index}{indexstyle}\lstindexmacro{indexstyle1} - {\csname lst@indexstyle#1\expandafter\endcsname +\lst@InstallFamily w{index}{indexstyle}\lstindexmacro{indexstyle} + {\csname\@lst @indexstyle#1\expandafter\endcsname \expandafter{\the\lst@token}} od \lst@UserCommand\lstindexmacro#1{\index{{\ttfamily#1}}} @@ -916,17 +804,16 @@ \lst@AddToHook{DetectKeywords} {\lst@ifprocname \let\lst@thestyle\lst@procnamestyle - \lst@ifindexproc \csname lst@gindex@sty\endcsname \fi + \lst@ifindexproc \csname\@lst @gindex@sty\endcsname \fi \lst@procnamefalse \fi} \lst@Key{procnamestyle}{}{\def\lst@procnamestyle{#1}} \lst@Key{indexprocnames}{false}[t]{\lstKV@SetIf{#1}\lst@ifindexproc} -\lst@AddToHook{Init} - {\lst@ifindexproc - \@ifundefined{lst@indexstyle1}% - {\@namedef{lst@indexstyle1}##1{}}% - {}% - \fi \fi} +\lst@AddToHook{Init}{\lst@ifindexproc \lst@indexproc \fi} +\gdef\lst@indexproc{% + \@ifundefined{lst@indexstyle1}% + {\@namedef{lst@indexstyle1}##1{}}% + {}} \lst@InstallKeywords w{procnamekeys}{}\relax{} {\global\let\lst@PNpost\lst@procnametrue} od @@ -976,18 +863,18 @@ \lst@NormedDef\lst@oalias{#1}% \lst@NormedDef\lst@malias{#2}% \@ifundefined{lsta@\lst@malias}{}% - {\edef\lst@malias{\csname lsta@\lst@malias\endcsname}}% + {\edef\lst@malias{\csname\@lst a@\lst@malias\endcsname}}% \ifx\@empty\lst@oalias \@ifundefined{lstdd@\lst@malias}{}% - {\edef\lst@oalias{\csname lstdd@\lst@malias\endcsname}}% + {\edef\lst@oalias{\csname\@lst dd@\lst@malias\endcsname}}% \fi \edef\lst@temp{\lst@malias $\lst@oalias}% \@ifundefined{lsta@\lst@temp}{}% - {\edef\lst@temp{\csname lsta@\lst@temp\endcsname}}% + {\edef\lst@temp{\csname\@lst a@\lst@temp\endcsname}}% \expandafter\lst@FindAlias@\lst@temp $} \gdef\lst@FindAlias@#1$#2${% \def\lst@malias{#1}\def\lst@oalias{#2}% \ifx\@empty\lst@oalias \@ifundefined{lstdd@\lst@malias}{}% - {\edef\lst@oalias{\csname lstdd@\lst@malias\endcsname}}% + {\edef\lst@oalias{\csname\@lst dd@\lst@malias\endcsname}}% \fi} \gdef\lst@RequireLanguages#1{% \lst@Require{language}{lang}{#1}\lst@FindAlias\lstlanguagefiles @@ -1027,7 +914,7 @@ \lst@IfSubstring#3\lst@whitespaces{#1}{#2}#3} \begingroup \catcode`\^^I=12\catcode`\^^J=12\catcode`\^^M=12\catcode`\^^L=12\relax% -\lst@DefActive\lst@whitespaces{\ ^^I^^J^^M}% ^^L removed +\lst@DefActive\lst@whitespaces{\ ^^I^^J^^M}% add ^^L \global\let\lst@whitespaces\lst@whitespaces% \endgroup \gdef\lst@fmtIfIdentifier#1{% @@ -1054,27 +941,14 @@ \ifx \@empty##2\expandafter\@secondoftwo \else \expandafter\@firstoftwo \fi}% \lst@temp#1#4\@empty\relax{#2}{#3}#4} -\gdef\lst@fmtCDef#1#2#3#4#5#6#7{% - \let#4#1% - \ifx\@empty#2\@empty - \def#1{\lst@fmtIfNextCharIn{#5}{#4}{#6#4#7}}% - \else \ifx\@empty#3\@empty - \def#1##1{% - \ifx##1#2% - \def\lst@next{\lst@fmtIfNextCharIn{#5}{#4##1}% - {#6#4#2#7}}% - \else - \def\lst@next{#4##1}% - \fi - \lst@next}% - \else - \def#1{% - \lst@IfNextCharsArg{#2#3}% - {\lst@fmtIfNextCharIn{#5}{\expandafter#4\lst@eaten}% - {#6#4#2#3#7}}% - {\expandafter#4\lst@eaten}}% - \fi \fi} -\gdef\lst@fmtCDefX#1#2#3#4#5#6#7{% +\gdef\lst@fmtCDef#1{\lst@fmtCDef@#1} +\gdef\lst@fmtCDef@#1#2#3#4#5#6#7{% + \lst@CDefIt#1{#2}{#3}% + {\lst@fmtIfNextCharIn{#5}{#4#2#3}{#6#4#2#3#7}}% + #4% + {}{}{}} +\gdef\lst@fmtCDefX#1{\lst@fmtCDefX@#1} +\gdef\lst@fmtCDefX@#1#2#3#4#5#6#7{% \let#4#1% \ifx\@empty#2\@empty \def#1{\lst@fmtIfNextCharIn{#5}{#4}{#6#7}}% @@ -1174,16 +1048,16 @@ \gdef\lst@fmtIndent{\global\advance\lst@fmtcurrindent\lst@fmtindent} \gdef\lst@fmtNoindent{\global\advance\lst@fmtcurrindent-\lst@fmtindent} \gdef\lst@fmtEnsureNewLine{% - \ifx\lst@newlines\@empty - \lst@AddTo\lst@newlines\lst@EnsuredNewLine - \fi + \global\advance\lst@newlines\@ne + \global\advance\lst@newlinesensured\@ne \lst@fmtignoretrue} -\gdef\lst@EnsuredNewLine#1{% - \lst@ifnewline\else - \ifx#1\lst@NewLine\else \lst@NewLine \fi +\lst@AddToAtTop\lst@DoNewLines{% + \ifnum\lst@newlines>\lst@newlinesensured + \global\advance\lst@newlines-\lst@newlinesensured \fi - #1} -\lst@AddToHook{PostOutput}{\global\let\lst@ifnewline\iffalse} + \global\lst@newlinesensured\z@} +\newcount\lst@newlinesensured % global +\lst@AddToHook{Init}{\global\lst@newlinesensured\z@} \gdef\lst@fmtignoretrue{\let\lst@fmtifignore\iftrue} \gdef\lst@fmtignorefalse{\let\lst@fmtifignore\iffalse} \lst@AddToHook{InitVars}{\lst@fmtignorefalse} @@ -1191,24 +1065,25 @@ \gdef\lst@fmtUseLostSpace{% \lst@ifnewline \kern\lst@fmtcurrindent \global\lst@lostspace\z@ \else - \ifdim\lst@lostspace>\z@ \lst@InsertLostSpace \fi + \lst@OldOLS \fi} \lst@AddToHook{Init} {\lst@true \ifx\lst@fmtformat\@empty \ifx\lst@fmt\@empty \lst@false \fi\fi \lst@if - \let\lst@UseLostSpace\lst@fmtUseLostSpace + \let\lst@OldOLS\lst@OutputLostSpace + \let\lst@OutputLostSpace\lst@fmtUseLostSpace \let\lst@ProcessSpace\lst@fmtProcessSpace \fi} \gdef\lst@fmtProcessSpace{% \lst@ifletter - \lst@Output\lst@letterfalse + \lst@Output \lst@fmtifignore\else \lst@AppendOther\lst@outputspace \fi \else \lst@ifkeepspaces \lst@AppendOther\lst@outputspace - \else \ifx\lst@newlines\@empty + \else \ifnum\lst@newlines=\z@ \lst@AppendSpecialSpace \else \ifnum\lst@length=\z@ \global\advance\lst@lostspace\lst@width @@ -1234,103 +1109,126 @@ \@namedef{\lst@ @fmt$\lst@fmta}{#3#4}} \lst@EndAspect \lst@BeginAspect{labels} -\lst@Key{labelstyle}{}{\def\lst@labelstyle{#1}} -\lst@Key{labelsep}{10pt}{\def\lst@labelsep{#1}} -\lst@Key{labelstep}{0}{\def\lst@labelstep{#1\relax}} -\lst@Key{firstlabel}\relax{\def\lst@firstlabel{#1\relax}} -\lst@Key{advancelabel}\relax{\def\lst@advancelabel{#1\relax}} -\lst@AddToHook{EmptyStyle}{\let\lst@labelstep\z@} -\lst@AddToHook{PreSet} - {\let\lst@firstlabel\@undefined \let\lst@advancelabel\z@} +\lst@Key{numbers}{none}{% + \let\lst@PlaceNumber\@empty + \lstKV@SwitchCases{#1}% + {none&\\% + left&\def\lst@PlaceNumber{\llap{\normalfont + \lst@numberstyle{\thelstnumber}\kern\lst@numbersep}}\\% + right&\def\lst@PlaceNumber{\rlap{\normalfont + \kern\linewidth \kern\lst@numbersep + \lst@numberstyle{\thelstnumber}}}% + }{\PackageError{Listings}{Numbers #1 unknown}\@ehc}} +\lst@Key{numberstyle}{}{\def\lst@numberstyle{#1}} +\lst@Key{numbersep}{10pt}{\def\lst@numbersep{#1}} +\lst@Key{stepnumber}{1}{\def\lst@stepnumber{#1\relax}} +\lst@AddToHook{EmptyStyle}{\let\lst@stepnumber\@ne} +\lst@Key{numberblanklines}{true}[t] + {\lstKV@SetIf{#1}\lst@ifnumberblanklines} +\lst@Key{firstnumber}{auto}{% + \lstKV@SwitchCases{#1}% + {auto&\let\lst@firstnumber\@undefined\\% + last&\let\lst@firstnumber\c@lstnumber + }{\def\lst@firstnumber{#1\relax}}} +\lst@AddToHook{PreSet}{\let\lst@advancenumber\z@} \lst@AddToHook{PreInit} - {\ifx\lst@firstlabel\@undefined - \let\lst@firstlabel\lst@firstline + {\ifx\lst@firstnumber\@undefined + \let\lst@firstnumber\lst@firstline \fi} -\gdef\lst@SetFirstLabel{% - \ifx\lst@firstlabel\@undefined - \@tempcnta 0\csname lstno@\lst@intname\endcsname\relax - \ifnum\@tempcnta=\z@ \@tempcnta\@ne \else \lst@continuetrue \fi - \advance\@tempcnta\lst@advancelabel - \edef\lst@firstlabel{\the\@tempcnta\relax}% +\gdef\lst@SetFirstNumber{% + \ifx\lst@firstnumber\@undefined + \@tempcnta 0\csname\@lst no@\lst@intname\endcsname\relax + \ifnum\@tempcnta=\z@ \@tempcnta\lst@firstline + \else \lst@nololtrue \fi + \advance\@tempcnta\lst@advancenumber + \edef\lst@firstnumber{\the\@tempcnta\relax}% \fi} -\gdef\lst@SaveFirstLabel{% +\gdef\lst@SaveFirstNumber{% \expandafter\xdef - \csname lstno\ifx\lst@intname\@empty @ \else @\lst@intname\fi - \endcsname{\the\c@lstlabel}} -\newcounter{lstlabel}% \global -\renewcommand*\thelstlabel{\@arabic\c@lstlabel} + \csname\@lst no\ifx\lst@intname\@empty @ \else @\lst@intname\fi + \endcsname{\the\c@lstnumber}} +\newcounter{lstnumber}% \global +\global\c@lstnumber\@ne % init +\renewcommand*\thelstnumber{\@arabic\c@lstnumber} \lst@AddToHook{EveryPar} - {\global\advance\c@lstlabel\lst@labeladvance \lst@SkipOrPrintLabel} -\global\let\lst@labeladvance\@ne -\lst@AddToHook{Init}{\def\@currentlabel{\thelstlabel}} + {\global\advance\c@lstnumber\lst@advancelstnum + \global\advance\c@lstnumber\m@ne \refstepcounter{lstnumber}% + \lst@SkipOrPrintLabel}% +\global\let\lst@advancelstnum\@ne +\lst@AddToHook{Init}{\def\@currentlabel{\thelstnumber}} \lst@AddToHook{InitVars} - {\global\c@lstlabel\lst@firstlabel - \global\advance\c@lstlabel\lst@advancelabel - \global\advance\c@lstlabel-\lst@labeladvance} + {\global\c@lstnumber\lst@firstnumber + \global\advance\c@lstnumber\lst@advancenumber + \global\advance\c@lstnumber-\lst@advancelstnum + \ifx \lst@firstnumber\c@lstnumber + \global\advance\c@lstnumber-\lst@advancelstnum + \fi} \lst@AddToHook{ExitVars} - {\global\advance\c@lstlabel\lst@labeladvance} -\newcount\lst@skiplabels % \global + {\global\advance\c@lstnumber\lst@advancelstnum} +\AtBeginDocument{% + \def\theHlstnumber{\ifx\lst@@caption\@empty \lst@neglisting + \else \thelstlisting \fi + .\thelstnumber}} +\newcount\lst@skipnumbers % \global \lst@AddToHook{Init} - {\ifnum \z@>\lst@labelstep - \let\lst@labeladvance\m@ne - \edef\lst@labelstep{-\lst@labelstep}% + {\ifnum \z@>\lst@stepnumber + \let\lst@advancelstnum\m@ne + \edef\lst@stepnumber{-\lst@stepnumber}% \fi - \ifnum \z@<\lst@labelstep - \global\lst@skiplabels\lst@firstlabel - \global\divide\lst@skiplabels\lst@labelstep - \global\multiply\lst@skiplabels-\lst@labelstep - \global\advance\lst@skiplabels\lst@firstlabel - \ifnum\lst@skiplabels>\z@ - \global\advance\lst@skiplabels -\lst@labelstep + \ifnum \z@<\lst@stepnumber + \global\lst@skipnumbers\lst@firstnumber + \global\divide\lst@skipnumbers\lst@stepnumber + \global\multiply\lst@skipnumbers-\lst@stepnumber + \global\advance\lst@skipnumbers\lst@firstnumber + \ifnum\lst@skipnumbers>\z@ + \global\advance\lst@skipnumbers -\lst@stepnumber \fi \else \let\lst@SkipOrPrintLabel\relax \fi} \gdef\lst@SkipOrPrintLabel{% - \ifnum\lst@skiplabels=\z@ - \global\advance\lst@skiplabels-\lst@labelstep\relax - \llap{\normalfont\lst@labelstyle{\thelstlabel}% - \kern\lst@labelsep}% + \ifnum\lst@skipnumbers=\z@ + \global\advance\lst@skipnumbers-\lst@stepnumber\relax + \lst@PlaceNumber \fi - \global\advance\lst@skiplabels\@ne} + \global\advance\lst@skipnumbers\@ne} +\lst@AddToHook{OnEmptyLine}{% + \lst@ifnumberblanklines\else \ifnum\lst@skipnumbers=\z@ + \global\advance\lst@skipnumbers-\lst@stepnumber\relax + \fi\fi} \lst@EndAspect \lst@BeginAspect{lineshape} -\newdimen\lst@innerspread \newdimen\lst@outerspread -\lst@AddToHook{BoxUnsafe}{\lst@outerspread\z@ \lst@innerspread\z@} -\lst@Key{wholeline}{false}[t]{\lstKV@SetIf{#1}\lst@ifwholeline} +\lst@Key{xleftmargin}{\z@}{\def\lst@xleftmargin{#1}} +\lst@Key{xrightmargin}{\z@}{\def\lst@xrightmargin{#1}} +\lst@Key{resetmargins}{false}[t]{\lstKV@SetIf{#1}\lst@ifresetmargins} +\lst@AddToHook{BoxUnsafe}{\let\lst@xleftmargin\z@ + \let\lst@xrightmargin\z@} +\lst@AddToHook{TextStyle}{% + \let\lst@xleftmargin\z@ \let\lst@xrightmargin\z@ + \let\lst@ifresetmargins\iftrue} \lst@Key{linewidth}\linewidth{\def\lst@linewidth{#1}} \lst@AddToHook{PreInit}{\linewidth\lst@linewidth\relax} -\lst@Key{indent}{\z@}{\def\lst@indent{#1}} -\lst@AddToHook{TextStyle}{\let\lst@indent\z@ \let\lst@ifwholeline\iftrue} -\lst@Key{spread}{\z@,\z@}{\lstKV@CSTwoArg{#1}% - {\lst@innerspread##1\relax - \ifx\@empty##2\@empty - \divide\lst@innerspread\tw@\relax - \lst@outerspread\lst@innerspread - \else - \lst@outerspread##2\relax - \fi}} \gdef\lst@parshape{% - \parshape\@ne - \ifodd\c@page -\lst@innerspread\else -\lst@outerspread\fi - \linewidth} + \parshape\@ne \@totalleftmargin \linewidth} \lst@AddToHook{Init} - {\advance\linewidth\lst@innerspread - \advance\linewidth\lst@outerspread - \advance\linewidth-\lst@indent\relax - \advance\lst@innerspread-\lst@indent\relax - \advance\lst@outerspread-\lst@indent\relax - \lst@ifwholeline + {\lst@ifresetmargins \advance\linewidth\@totalleftmargin - \else - \advance\lst@innerspread-\@totalleftmargin - \advance\lst@outerspread-\@totalleftmargin + \advance\linewidth\rightmargin + \@totalleftmargin\z@ \fi - \if@twoside\else \lst@outerspread\lst@innerspread \fi} + \advance\linewidth-\lst@xleftmargin + \advance\linewidth-\lst@xrightmargin + \advance\@totalleftmargin\lst@xleftmargin\relax} \lst@Key{lineskip}{\z@}{\def\lst@lineskip{#1\relax}} -\lst@AddToHook{Init}{\parskip\lst@lineskip} -\lst@EndAspect -\lst@BeginAspect[lineshape]{breaklines} +\lst@AddToHook{Init} + {\parskip\z@ + \ifdim\z@=\lst@lineskip\else + \@tempdima\baselineskip + \advance\@tempdima\lst@lineskip + \divide\@tempdima\strip@pt\baselineskip\relax + \edef\baselinestretch{\strip@pt\@tempdima}% + \selectfont + \fi} \lst@Key{breaklines}{false}[t]{\lstKV@SetIf{#1}\lst@ifbreaklines} \lst@Key{breakindent}{20pt}{\def\lst@breakindent{#1}} \lst@Key{breakautoindent}{t}[t]{\lstKV@SetIf{#1}\lst@ifbreakautoindent} @@ -1339,12 +1237,10 @@ \lst@AddToHook{Init} {\lst@ifbreaklines \hbadness\@M \pretolerance\@M - \def\lst@parshape{\parshape\tw@ - \ifodd\c@page -\lst@innerspread\else -\lst@outerspread\fi - \linewidth % - \lst@breakshape}% + \def\lst@parshape{\parshape\tw@ \@totalleftmargin\linewidth + \lst@breakshape}% \else - \let\lst@discretionary\relax + \let\lst@discretionary\@empty \fi} \lst@AddToHook{OnNewLine} {\lst@ifbreaklines \lst@breakNewLine \fi} @@ -1357,26 +1253,37 @@ \gdef\lst@breakNewLine{% \@tempdima\lst@breakindent\relax \lst@ifbreakautoindent \advance\@tempdima\lst@lostspace \fi - \@tempdimb\@tempdima \@tempdimc-\@tempdima - \advance\@tempdima-\lst@innerspread - \advance\@tempdimb-\lst@outerspread - \advance\@tempdimc\linewidth + \@tempdimc-\@tempdima \advance\@tempdimc\linewidth + \advance\@tempdima\@totalleftmargin \xdef\lst@breakshape{\noexpand\lst@breakcurrindent \the\@tempdimc}% - \xdef\lst@breakcurrindent{% - \noexpand\ifodd\c@page \the\@tempdima - \noexpand\else \the\@tempdimb \noexpand\fi}} -\gdef\lst@breakProcessOther#1{% - \lst@ifletter \lst@Output\lst@letterfalse \fi - \lst@AppendOther#1\lst@OutputOther} + \xdef\lst@breakcurrindent{\the\@tempdima}} +\gdef\lst@breakshape{\@totalleftmargin \linewidth} +\gdef\lst@breakProcessOther#1{\lst@ProcessOther#1\lst@OutputOther} \lst@AddToHook{SelectCharTable} {\lst@ifbreaklines \lst@Def{`)}{\lst@breakProcessOther)}\fi} \lst@EndAspect \lst@BeginAspect[lineshape]{frames} -\lst@Key{framerulewidth}{.4pt}{\def\lst@framerulewidth{#1}} -\lst@Key{framerulesep}{2pt}{\def\lst@framerulesep{#1}} -\lst@Key{frametextsep}{3pt}{\def\lst@frametextsep{#1}} -\lst@Key{framespread}{\z@}{\def\lst@framespread{#1}} -\lst@Key{frameshape}{}{\lstKV@FourArg{#1}% +\lst@Key{framexleftmargin}{\z@}{\def\lst@framexleftmargin{#1}} +\lst@Key{framexrightmargin}{\z@}{\def\lst@framexrightmargin{#1}} +\lst@Key{framextopmargin}{\z@}{\def\lst@framextopmargin{#1}} +\lst@Key{framexbottommargin}{\z@}{\def\lst@framexbottommargin{#1}} +\lst@Key{backgroundcolor}{}{\def\lst@bkgcolor{#1}} +\lst@Key{fillcolor}{}{\def\lst@fillcolor{#1}} +\lst@Key{rulecolor}{}{\def\lst@rulecolor{#1}} +\lst@Key{rulesepcolor}{}{\def\lst@rulesepcolor{#1}} +\lst@AddToHook{Init}{% + \ifx\lst@fillcolor\@empty + \let\lst@fillcolor\lst@bkgcolor + \fi + \ifx\lst@rulesepcolor\@empty + \let\lst@rulesepcolor\lst@fillcolor + \fi} +\lst@Key{rulesep}{2pt}{\def\lst@rulesep{#1}} +\lst@Key{framerule}{.4pt}{\def\lst@framerulewidth{#1}} +\lst@Key{framesep}{3pt}{\def\lst@frametextsep{#1}} +\lst@Key{frameshape}{}{% + \let\lst@xrulecolor\@empty + \lstKV@FourArg{#1}% {\uppercase{\def\lst@frametshape{##1}}% \uppercase{\def\lst@framelshape{##2}}% \uppercase{\def\lst@framershape{##3}}% @@ -1389,9 +1296,20 @@ {\uppercase{\def\lst@frameround{#1}}% \expandafter\lstframe@\lst@frameround ffff\relax} \global\let\lst@frameround\@empty -\lst@Key{frame}\relax - {\def\lst@frame{#1}% - \expandafter\lstframe@\lst@frameround ffff\relax} +\lst@Key{frame}\relax{% + \let\lst@xrulecolor\@empty + \lstKV@SwitchCases{#1}% + {none&\let\lst@frame\@empty\\% + leftline&\def\lst@frame{l}\\% + topline&\def\lst@frame{t}\\% + bottomline&\def\lst@frame{b}\\% + lines&\def\lst@frame{tb}\\% + single&\def\lst@frame{trbl}\\% + shadowbox&\def\lst@frame{tRBl}% + \def\lst@xrulecolor{\lst@rulesepcolor}% + \def\lst@rulesep{\lst@frametextsep}% + }{\def\lst@frame{#1}}% + \expandafter\lstframe@\lst@frameround ffff\relax} \gdef\lstframe@#1#2#3#4#5\relax{% \lst@IfSubstring T\lst@frame{\edef\lst@frame{t\lst@frame}}{}% \lst@IfSubstring R\lst@frame{\edef\lst@frame{r\lst@frame}}{}% @@ -1424,55 +1342,72 @@ {\if #8T\def#6{R}\else \def#6{Y}\fi}% {\def#6{N}}% \lst@IfSubstring #2\lst@frame{\edef#5{#5#4Y#6}}{}} -\lst@Key{backgroundcolor}{}{\lstKV@OptArg[]{#1}% - {\ifx\@empty##2\@empty - \let\lst@bkgcolor\@empty - \else - \ifx\@empty##1\@empty - \def\lst@bkgcolor{\color{##2}}% - \else - \def\lst@bkgcolor{\color[##1]{##2}}% - \fi - \fi}} -\lst@Key{framerulecolor}{}{\lstKV@OptArg[]{#1}% - {\ifx\@empty##2\@empty - \let\lst@framerulecolor\@empty - \else - \ifx\@empty##1\@empty - \def\lst@framerulecolor{\color{##2}}% - \else - \def\lst@framerulecolor{\color[##1]{##2}}% - \fi - \fi}} -\lst@AddToHook{EveryLine} - {\ifx\lst@bkgcolor\@empty\else - \@tempdima\linewidth \advance\@tempdima\lst@indent - \rlap{\begingroup \lst@bkgcolor - \kern-\lst@indent\relax - \color@block{\@tempdima}{\ht\strutbox}{\dp\strutbox}% - \endgroup}% - \fi} -\gdef\lst@frameBkgBox#1{% - \ifx\lst@bkgcolor\@empty\else - \setbox#1\hbox{\begingroup \lst@bkgcolor - \color@block{\wd#1}{\ht#1}{\dp#1}% - \endgroup \box#1}% - \fi} +\gdef\lst@frameMakeBoxV#1#2#3{% + \setbox#1\hbox{% + \color@begingroup \lst@rulecolor + \llap{\setbox\z@\hbox{\vrule\@width\z@\@height#2\@depth#3% + \lst@frameL}% + \rlap{\lst@frameBlock\lst@rulesepcolor{\wd\z@}% + {\ht\z@}{\dp\z@}}% + \box\z@ + \ifx\lst@framelshape\@empty + \kern\lst@frametextsep\relax + \else + \lst@frameBlock\lst@fillcolor\lst@frametextsep{#2}{#3}% + \fi + \kern\lst@framexleftmargin}% + \rlap{\kern-\lst@framexleftmargin + \@tempdima\linewidth + \advance\@tempdima\lst@framexleftmargin + \advance\@tempdima\lst@framexrightmargin + \lst@frameBlock\lst@bkgcolor\@tempdima{#2}{#3}% + \ifx\lst@framershape\@empty + \kern\lst@frametextsep\relax + \else + \lst@frameBlock\lst@fillcolor\lst@frametextsep{#2}{#3}% + \fi + \setbox\z@\hbox{\vrule\@width\z@\@height#2\@depth#3% + \lst@frameR}% + \rlap{\lst@frameBlock\lst@rulesepcolor{\wd\z@}% + {\ht\z@}{\dp\z@}}% + \box\z@}% + \color@endgroup}} +\gdef\lst@frameBlock#1#2#3#4{% + \color@begingroup + #1% + \setbox\z@\hbox{\vrule\@height#3\@depth#4% + \ifx#1\@empty \@width\z@ \kern#2\relax + \else \@width#2\relax \fi}% + \box\z@ + \color@endgroup} \gdef\lst@frameR{% - \strut\smash{\expandafter\lst@frameR@\lst@framershape\relax}% - \kern-\lst@framerulesep} + \expandafter\lst@frameR@\lst@framershape\relax + \kern-\lst@rulesep} \gdef\lst@frameR@#1{% \ifx\relax#1\@empty\else \if #1Y\lst@framevrule \else \kern\lst@framerulewidth \fi - \kern\lst@framerulesep + \kern\lst@rulesep + \expandafter\lst@frameR@b + \fi} +\gdef\lst@frameR@b#1{% + \ifx\relax#1\@empty + \else + \if #1Y\color@begingroup + \lst@xrulecolor + \lst@framevrule + \color@endgroup + \else + \kern\lst@framerulewidth + \fi + \kern\lst@rulesep \expandafter\lst@frameR@ \fi} \gdef\lst@frameL{% - \kern-\lst@framerulesep - \strut\smash{\expandafter\lst@frameL@\lst@framelshape\relax}} + \kern-\lst@rulesep + \expandafter\lst@frameL@\lst@framelshape\relax} \gdef\lst@frameL@#1{% \ifx\relax#1\@empty\else - \kern\lst@framerulesep + \kern\lst@rulesep \if#1Y\lst@framevrule \else \kern\lst@framerulewidth \fi \expandafter\lst@frameL@ \fi} @@ -1480,153 +1415,154 @@ \global\let\lst@framediml\z@ \global\let\lst@framedimr\z@ \setbox\z@\hbox{}\@tempcntb\z@ \expandafter\lst@frameH@\expandafter#1#2\relax\relax\relax - \ifx\lst@bkgcolor\@empty\else - \@tempdima\lst@framediml - \advance\@tempdima\lst@indent - \setbox\z@\hbox{\rlap{% - \kern-\@tempdima - \kern-\ifodd\c@page\lst@innerspread\else\lst@outerspread\fi - \kern-\lst@framehalfspread - \advance\@tempdima\linewidth - \advance\@tempdima\lst@framedimr - \advance\@tempdima\lst@framespread - \begingroup \lst@bkgcolor - \color@block{\@tempdima}{\ht\z@}{\dp\z@}% - \endgroup}% - \box\z@}% - \fi} + \@tempdimb\lst@frametextsep\relax + \advance\@tempdimb\lst@framerulewidth\relax + \@tempdimc-\@tempdimb + \advance\@tempdimc\ht\z@ + \advance\@tempdimc\dp\z@ + \setbox\z@=\hbox{% + \lst@frameHBkg\lst@fillcolor\@tempdimb\@firstoftwo + \if#1T\rlap{\raise\dp\@tempboxa\box\@tempboxa}% + \else\rlap{\lower\ht\@tempboxa\box\@tempboxa}\fi + \lst@frameHBkg\lst@rulesepcolor\@tempdimc\@secondoftwo + \advance\@tempdimb\ht\@tempboxa + \if#1T\rlap{\raise\lst@frametextsep\box\@tempboxa}% + \else\rlap{\lower\@tempdimb\box\@tempboxa}\fi + \rlap{\box\z@}% + }} \gdef\lst@frameH@#1#2#3#4{% \ifx\relax#4\@empty\else \lst@frameh \@tempcntb#1#2#3#4% \advance\@tempcntb\@ne \expandafter\lst@frameH@\expandafter#1% \fi} +\gdef\lst@frameHBkg#1#2#3{% + \setbox\@tempboxa\hbox{% + \kern-\lst@framexleftmargin + #3{\kern-\lst@framediml\relax}{\@tempdima\z@}% + \ifdim\lst@framediml>\@tempdimb + #3{\@tempdima\lst@framediml \advance\@tempdima-\@tempdimb + \lst@frameBlock\lst@rulesepcolor\@tempdima\@tempdimb\z@}% + {\kern-\lst@framediml + \advance\@tempdima\lst@framediml\relax}% + \fi + #3{\@tempdima\z@ + \ifx\lst@framelshape\@empty\else + \advance\@tempdima\@tempdimb + \fi + \ifx\lst@framershape\@empty\else + \advance\@tempdima\@tempdimb + \fi}% + {\ifdim\lst@framedimr>\@tempdimb + \advance\@tempdima\lst@framedimr\relax + \fi}% + \advance\@tempdima\linewidth + \advance\@tempdima\lst@framexleftmargin + \advance\@tempdima\lst@framexrightmargin + \lst@frameBlock#1\@tempdima#2\z@ + #3{\ifdim\lst@framedimr>\@tempdimb + \@tempdima-\@tempdimb + \advance\@tempdima\lst@framedimr\relax + \lst@frameBlock\lst@rulesepcolor\@tempdima\@tempdimb\z@ + \fi}{}% + }} \gdef\lst@frameh#1#2#3#4#5{% \lst@frameCalcDimA#1% \lst@ifframeround \@getcirc\@tempdima \fi - \setbox\z@=\hbox{\rlap{\copy\z@}% - \setbox\z@=\hbox{% - \begingroup \lst@framerulecolor - \kern-\lst@indent - \kern\ifodd\c@page -\lst@innerspread\else -\lst@outerspread\fi - \kern-\lst@framehalfspread - \lst@frameCornerX\llap{#2L}#3% + \setbox\z@\hbox{% + \begingroup + \setbox\z@\hbox{% + \kern-\lst@framexleftmargin + \color@begingroup + \ifnum#1=\z@ \lst@rulecolor \else \lst@xrulecolor \fi + \lst@frameCornerX\llap{#2L}#3#1% \ifdim\lst@framediml<\@tempdimb \xdef\lst@framediml{\the\@tempdimb}% \fi \begingroup - \if#4Y\else\let\lst@framerulewidth\z@ \fi - \vrule\@width\lst@framespread\@height\lst@framerulewidth - \@depth\z@ - \vrule\@width\lst@indent\@height\lst@framerulewidth\@depth\z@ - \vrule\@width\linewidth\@height\lst@framerulewidth\@depth\z@ + \if#4Y\else \let\lst@framerulewidth\z@ \fi + \@tempdima\lst@framexleftmargin + \advance\@tempdima\lst@framexrightmargin + \advance\@tempdima\linewidth + \vrule\@width\@tempdima\@height\lst@framerulewidth \@depth\z@ \endgroup - \lst@frameCornerX\rlap{#2R}#5% + \lst@frameCornerX\rlap{#2R}#5#1% \ifdim\lst@framedimr<\@tempdimb \xdef\lst@framedimr{\the\@tempdimb}% \fi - \kern-\lst@framehalfspread - \endgroup}% - \if#2T\raise\dp\z@\copy\z@ - \else\lower\ht\z@\copy\z@ \fi}} -\gdef\lst@frameCornerX#1#2#3{% - \setbox\@tempboxa\hbox{\csname lst@frame\if#3RR\fi #2\endcsname}% + \color@endgroup}% + \if#2T\rlap{\raise\dp\z@\box\z@}% + \else\rlap{\lower\ht\z@\box\z@}\fi + \endgroup + \box\z@}} +\gdef\lst@frameCornerX#1#2#3#4{% + \setbox\@tempboxa\hbox{\csname\@lst @frame\if#3RR\fi #2\endcsname}% \@tempdimb\wd\@tempboxa \if #3R% #1{\box\@tempboxa}% \else \if #3Y\expandafter#1\else \@tempdimb\z@ \expandafter\vphantom \fi - {\box\@tempboxa} + {\box\@tempboxa}% \fi} \gdef\lst@frameCalcDimA#1{% - \@tempdima\lst@framerulesep + \@tempdima\lst@rulesep \advance\@tempdima\lst@framerulewidth \multiply\@tempdima#1\relax \advance\@tempdima\lst@frametextsep \advance\@tempdima\lst@framerulewidth \multiply\@tempdima\tw@} -\lst@AddToHook{Init}{\ifx\lst@frame\@empty\else \lst@frameInit \fi} +\lst@AddToHook{Init}{\lst@frameInit} +\newbox\lst@framebox \gdef\lst@frameInit{% - \ifx\lst@framelshape\@empty \let\lst@frameL\relax \fi - \ifx\lst@framershape\@empty \let\lst@frameR\relax \fi - \def\lst@framelr{% - \begingroup \lst@framerulecolor - \setbox\z@\hbox{\lst@frameL \kern\lst@frametextsep - \kern\lst@framehalfspread}% - \lst@frameBkgBox\z@ - \llap{\box\z@ \kern\lst@indent}% - \setbox\z@\hbox{\kern\lst@framehalfspread \kern\lst@frametextsep - \lst@frameR}% - \lst@frameBkgBox\z@ - \rlap{\kern\linewidth \box\z@}% - \endgroup}% - \ifx\lst@frameL\relax \ifx\lst@frameR\relax - \let\lst@framelr\strut - \fi \fi - \@tempdima\ht\strutbox \advance\@tempdima\lst@lineskip - \@tempdimb\dp\strutbox \advance\@tempdimb\lst@lineskip - \edef\lst@framevrule{% - \vrule\noexpand\@height\the\@tempdima - \noexpand\@depth\the\@tempdimb - \noexpand\@width\noexpand\lst@framerulewidth}% - \@tempdima\lst@framerulewidth \divide\@tempdima\tw@ - \edef\lst@framerulehalfwidth{\the\@tempdima}% - \@tempdima\lst@framespread\relax \divide\@tempdima\tw@ - \edef\lst@framehalfspread{\the\@tempdima}% + \ifx\lst@framelshape\@empty \let\lst@frameL\@empty \fi + \ifx\lst@framershape\@empty \let\lst@frameR\@empty \fi + \def\lst@framevrule{\vrule\@width\lst@framerulewidth\relax}% \lst@ifframeround \lst@frameCalcDimA\z@ \@getcirc\@tempdima \@tempdimb\@tempdima \divide\@tempdimb\tw@ \advance\@tempdimb -\@wholewidth \edef\lst@frametextsep{\the\@tempdimb}% \edef\lst@framerulewidth{\the\@wholewidth}% - \edef\lst@framerulehalfwidth{\the\@halfwidth}% \lst@frameCalcDimA\@ne \@getcirc\@tempdima \@tempdimb\@tempdima \divide\@tempdimb\tw@ \advance\@tempdimb -\tw@\@wholewidth \advance\@tempdimb -\lst@frametextsep - \edef\lst@framerulesep{\the\@tempdimb}% + \edef\lst@rulesep{\the\@tempdimb}% \fi - \expandafter\lst@frameH T\lst@frametshape - \ifvoid\z@\else - \par\parshape\z@ - \@tempdima-\baselineskip \advance\@tempdima\ht\z@ - \ifdim\prevdepth<\@cclvi\p@\else - \advance\@tempdima\prevdepth + \lst@frameMakeBoxV\lst@framebox{\ht\strutbox}{\dp\strutbox}% + \def\lst@framelr{\copy\lst@framebox}% + \ifx\lst@frametshape\@empty\else + \lst@frameH T\lst@frametshape + \ifvoid\z@\else + \par\lst@parshape + \@tempdima-\baselineskip \advance\@tempdima\ht\z@ + \ifdim\prevdepth<\@cclvi\p@\else + \advance\@tempdima\prevdepth + \fi + \ifdim\@tempdima<\z@ + \vskip\@tempdima\vskip\lineskip + \fi + \noindent\box\z@\par + \lineskiplimit\maxdimen \lineskip\z@ \fi - \ifdim\@tempdima<\z@ - \vskip\@tempdima\vskip\lineskip - \fi - \noindent\box\z@\par - \lineskiplimit\maxdimen \lineskip\z@ - \fi - \lst@frameSpreadV} + \lst@frameSpreadV\lst@framextopmargin + \fi} \lst@AddToHook{EveryLine}{\lst@framelr} \global\let\lst@framelr\@empty -\lst@AddToHook{DeInit}{\ifx\lst@frame\@empty\else \lst@frameExit \fi} +\lst@AddToHook{DeInit} + {\ifx\lst@framebshape\@empty\else \lst@frameExit \fi} \gdef\lst@frameExit{% - \lst@frameSpreadV + \lst@frameSpreadV\lst@framexbottommargin \lst@frameH B\lst@framebshape \ifvoid\z@\else - \everypar{}\par\nointerlineskip\noindent\box\z@ + \everypar{}\par\lst@parshape\nointerlineskip\noindent\box\z@ \fi} -\gdef\lst@frameSpreadV{% - \ifdim\z@=\lst@framespread\else +\gdef\lst@frameSpreadV#1{% + \ifdim\z@=#1\else \everypar{}\par\lst@parshape\nointerlineskip\noindent - \setbox\z@=\hbox{% - \def\lst@framevrule{\vrule\@height\lst@framehalfspread - \@depth\z@\@width\lst@framerulewidth}% - \def\strut{\vrule\@height\lst@framehalfspread - \@depth\z@\@width\z@}% - \lst@framelr - \kern-\lst@indent - \ifx\lst@bkgcolor\@empty\else - \begingroup \lst@bkgcolor - \vrule\@height\lst@framehalfspread\@depth\z@\@width\linewidth - \vrule\@height\lst@framehalfspread\@depth\z@\@width\lst@indent - \endgroup - \fi}% - \rlap{\box\z@}% + \lst@frameMakeBoxV\z@{#1}{\z@}% + \box\z@ \fi} \gdef\lst@frameTR{% \vrule\@width.5\@tempdima\@height\lst@framerulewidth\@depth\z@ @@ -1669,52 +1605,115 @@ \lst@EndAspect \lst@BeginAspect[keywords]{make} \lst@NewMode\lst@makemode -\gdef\lst@makekeyfalse{\let\lst@ifmakekey\iffalse} -\gdef\lst@makekeytrue{\let\lst@ifmakekey\iftrue} -\global\lst@makekeyfalse -\lst@Key{makemacrouse}f[t]{\lstKV@SetIf{#1}\lst@ifmakemacrouse} -\lst@AddToHook{SelectCharTable} - {\lst@ifmakemacrouse - \lst@ReplaceInput{$(}{% - \lst@PrintToken - \lst@EnterMode\lst@makemode{\lst@makekeyfalse}% - \def\lst@aside{\lst@ProcessOther\$\lst@ProcessOther(}}% - \lst@ReplaceInput{)}{% - \ifnum\lst@mode=\lst@makemode - \lst@PrintToken - \begingroup - \lst@ProcessOther)% - \lst@ifmakekey - \lst@gkeywords@sty\lst@OutputOther - \else - \lst@OutputOther - \fi - \endgroup - \lst@LeaveMode - \else - \expandafter\lst@ProcessOther\expandafter)% - \fi}% - \else \ifx\lst@language\lst@make - \lst@ReplaceInput{$(}{\lst@ProcessOther\$\lst@ProcessOther(}% - \fi \fi} -\gdef\lst@make{make} -\lst@AddToHook{InitVars}{\let\lst@aside\@empty} -\gdef\lst@makePrintAside#1{% - \ifx\lst@aside\@empty\else - \begingroup - \lst@token{}\lst@length\z@ \lst@aside \let\lst@aside\@empty - #1{\lst@OutputOther}% - \endgroup - \let\lst@aside\@empty - \fi} -\lst@AddToHook{OutputOther}{\lst@makePrintAside\relax} \lst@AddToHook{Output}{% \ifnum\lst@mode=\lst@makemode \ifx\lst@thestyle\lst@gkeywords@sty \lst@makekeytrue \fi - \fi - \lst@makePrintAside\lst@thestyle} + \fi} +\gdef\lst@makekeytrue{\let\lst@ifmakekey\iftrue} +\gdef\lst@makekeyfalse{\let\lst@ifmakekey\iffalse} +\global\lst@makekeyfalse % init +\lst@Key{makemacrouse}f[t]{\lstKV@SetIf{#1}\lst@ifmakemacrouse} +\gdef\lst@MakeSCT{% + \lst@ifmakemacrouse + \lst@ReplaceInput{$(}{% + \lst@PrintToken + \lst@EnterMode\lst@makemode{\lst@makekeyfalse}% + \lst@Merge{\lst@ProcessOther\$\lst@ProcessOther(}}% + \lst@ReplaceInput{)}{% + \ifnum\lst@mode=\lst@makemode + \lst@PrintToken + \begingroup + \lst@ProcessOther)% + \lst@ifmakekey + \let\lst@currstyle\lst@gkeywords@sty + \fi + \lst@OutputOther + \endgroup + \lst@LeaveMode + \else + \expandafter\lst@ProcessOther\expandafter)% + \fi}% + \else + \lst@ReplaceInput{$(}{\lst@ProcessOther\$\lst@ProcessOther(}% + \fi} +\lst@EndAspect +\lst@BeginAspect{0.21} +\lst@Key{labelstyle}{}{\def\lst@numberstyle{#1}} +\lst@Key{labelsep}{10pt}{\def\lst@numbersep{#1}} +\lst@Key{labelstep}{0}{% + \ifnum #1=\z@ \KV@lst@numbers{none}% + \else \KV@lst@numbers{left}\fi + \def\lst@stepnumber{#1\relax}} +\lst@Key{firstlabel}\relax{\def\lst@firstnumber{#1\relax}} +\lst@Key{advancelabel}\relax{\def\lst@advancenumber{#1\relax}} +\let\c@lstlabel\c@lstnumber +\lst@AddToHook{Init}{\let\thelstnumber\thelstlabel} +\newcommand*\thelstlabel{\@arabic\c@lstlabel} +\lst@Key{first}\relax{\def\lst@firstline{#1\relax}} +\lst@Key{last}\relax{\def\lst@lastline{#1\relax}} +\lst@Key{framerulewidth}{.4pt}{\def\lst@framerulewidth{#1}} +\lst@Key{framerulesep}{2pt}{\def\lst@rulesep{#1}} +\lst@Key{frametextsep}{3pt}{\def\lst@frametextsep{#1}} +\lst@Key{framerulecolor}{}{\lstKV@OptArg[]{#1}% + {\ifx\@empty##2\@empty + \let\lst@rulecolor\@empty + \else + \ifx\@empty##1\@empty + \def\lst@rulecolor{\color{##2}}% + \else + \def\lst@rulecolor{\color[##1]{##2}}% + \fi + \fi}} +\lst@Key{backgroundcolor}{}{\lstKV@OptArg[]{#1}% + {\ifx\@empty##2\@empty + \let\lst@bkgcolor\@empty + \else + \ifx\@empty##1\@empty + \def\lst@bkgcolor{\color{##2}}% + \else + \def\lst@bkgcolor{\color[##1]{##2}}% + \fi + \fi}} +\lst@Key{framespread}{\z@}{\def\lst@framespread{#1}} +\lst@AddToHook{PreInit} + {\@tempdima\lst@framespread\relax \divide\@tempdima\tw@ + \edef\lst@framextopmargin{\the\@tempdima}% + \let\lst@framexrightmargin\lst@framextopmargin + \let\lst@framexbottommargin\lst@framextopmargin + \advance\@tempdima\lst@xleftmargin\relax + \edef\lst@framexleftmargin{\the\@tempdima}} +\newdimen\lst@innerspread \newdimen\lst@outerspread +\lst@Key{spread}{\z@,\z@}{\lstKV@CSTwoArg{#1}% + {\lst@innerspread##1\relax + \ifx\@empty##2\@empty + \divide\lst@innerspread\tw@\relax + \lst@outerspread\lst@innerspread + \else + \lst@outerspread##2\relax + \fi}} +\lst@AddToHook{BoxUnsafe}{\lst@outerspread\z@ \lst@innerspread\z@} +\lst@Key{wholeline}{false}[t]{\lstKV@SetIf{#1}\lst@ifresetmargins} +\lst@Key{indent}{\z@}{\def\lst@xleftmargin{#1}} +\lst@AddToHook{PreInit} + {\lst@innerspread=-\lst@innerspread + \lst@outerspread=-\lst@outerspread + \ifodd\c@page \advance\lst@innerspread\lst@xleftmargin + \else \advance\lst@outerspread\lst@xleftmargin \fi + \ifodd\c@page + \edef\lst@xleftmargin{\the\lst@innerspread}% + \edef\lst@xrightmargin{\the\lst@outerspread}% + \else + \edef\lst@xleftmargin{\the\lst@outerspread}% + \edef\lst@xrightmargin{\the\lst@innerspread}% + \fi} +\lst@Key{defaultclass}\relax{\def\lst@classoffset{#1}} +\lst@Key{stringtest}\relax{}% dummy +\lst@Key{outputpos}\relax{\lst@outputpos#1\relax\relax} +\lst@Key{stringspaces}\relax[t]{\lstKV@SetIf{#1}\lst@ifshowstringspaces} +\lst@Key{visisblespaces}\relax[t]{\lstKV@SetIf{#1}\lst@ifshowspaces} +\lst@Key{visibletabs}\relax[t]{\lstKV@SetIf{#1}\lst@ifshowtabs} \lst@EndAspect \lst@BeginAspect{fancyvrb} \@ifundefined{FancyVerbFormatLine} @@ -1743,8 +1742,8 @@ \lst@activecharsfalse \let\normalbaselines\relax \lst@Init\relax - \lst@ifwholeline \advance\linewidth-\@totalleftmargin \fi - \everypar{}\global\let\lst@newlines\@empty + \lst@ifresetmargins \advance\linewidth-\@totalleftmargin \fi + \everypar{}\global\lst@newlines\z@ \lst@mode\lst@nomode \let\lst@entermodes\@empty \lst@InterruptModes %% D.G. modification begin - Nov. 25, 1998 @@ -1768,12 +1767,31 @@ \lst@AddTo\FV@BVerbatimBegin\lstFV@VerbatimBegin \lst@AddToAtTop\FV@BVerbatimEnd\lstFV@VerbatimEnd \gdef\lstFV@FancyVerbFormatLine#1{% - \let\lst@arg\@empty \lst@true \lst@FVConvert#1\@nil - \global\let\lst@newlines\@empty + \let\lst@arg\@empty \lst@FVConvert#1\@nil + \global\lst@newlines\z@ \vtop{\leavevmode\lst@parshape \lst@ReenterModes - \lst@arg \lst@PrintToken\lst@EOLUpdate + \lst@arg \lst@PrintToken\lst@EOLUpdate\lsthk@InitVarsBOL \lst@InterruptModes}} +\gdef\lst@FVConvert{\futurelet\@let@token\lst@FVConvert@@} +\gdef\lst@FVConvert@@{% + \ifcat\noexpand\@let@token\bgroup \expandafter\lst@FVConvertArg + \else \expandafter\lst@FVConvert@ \fi} +\gdef\lst@FVConvertArg#1{% + {\let\lst@arg\@empty + \lst@FVConvert#1\@nil + \global\let\@gtempa\lst@arg}% + \lst@lExtend\lst@arg{\expandafter{\@gtempa\lst@PrintToken}}% + \lst@FVConvert} +\gdef\lst@FVConvert@#1{% + \ifx \@nil#1\else + \if\relax\noexpand#1% + \lst@lAddTo\lst@arg{\lst@OutputLostSpace\lst@PrintToken#1}% + \else + \lccode`\~=`#1\lowercase{\lst@lAddTo\lst@arg~}% + \fi + \expandafter\lst@FVConvert + \fi} \lst@EndAspect \lst@BeginAspect[keywords,comments,strings,language]{lgrind} \gdef\lst@LGGetNames#1:#2\relax{% @@ -1860,7 +1878,7 @@ \lst@if \edef\lstlang@{\lstlang@,lgrindef=\lst@LGvalue}% \fi - \expandafter\xdef\csname lstLGlang@\lst@language@\endcsname + \expandafter\xdef\csname\@lst LGlang@\lst@language@\endcsname {\noexpand\lstset{\lstlang@}}% \lst@ReplaceInArg\lst@arg{{: :}:}\let\lst@LGvalue\@empty \expandafter\lst@LGDroppedCaps\lst@arg\relax\relax @@ -1909,10 +1927,9 @@ \@ifundefined{lstLGlang@\lst@language@}% {\PackageError{Listings}% {LGrind language \lst@language@\space undefined}% - {The language is not loadable or just mispellt.^^J% - Type to proceed without changing the language.}}% + {The language is not loadable. \@ehc}}% {\lsthk@SetLanguage - \csname lstLGlang@\lst@language@\endcsname}} + \csname\@lst LGlang@\lst@language@\endcsname}} \@ifundefined{lstlgrindeffile} {\lst@UserCommand\lstlgrindeffile{lgrindef.}}{} \lst@EndAspect diff --git a/docs/styles/lstpatch.sty b/docs/styles/lstpatch.sty index ea1a9d6a80..df942c9704 100644 --- a/docs/styles/lstpatch.sty +++ b/docs/styles/lstpatch.sty @@ -1,379 +1,464 @@ -%% -%% This is file `lstpatch.sty', generated manually :-) -%% -%% Please read the software license in listings.dtx or listings.dvi. -%% -%% (w)(c) 2000,2001 Carsten Heinz -%% -%% 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. -%% -%% 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 . -%% -%% -%% This patch file does *not* include any experimental material I sent to -%% various people. These people will have to copy and paste the definitions. -%% -%% This patch file will remove the following bugs from the listings package. -%% Each item contains the bug finder with date of report and first bug fix -%% version, a short description of the problem, and the reason for the bug -%% in parenthesis. -%% -%% 1) Andreas Deininger, 2000/08/25, 0.21a -%% -%% `breaklines,first>1' leads to ``undefined control sequence'' error -%% (\lst@breakshape undefined in this case) -%% -%% 2) Vespe Savikko, 2000/09/27, 0.21a (2000/11/02) -%% -%% stringstyle used also on previous other characters -%% (missing \lst@PrintToken in \lst@BeginString) -%% -%% 3) Richard Hoefter, 2000/11/03, 0.21b (2000/11/04) -%% -%% no keyword detection in case of language=HTML,language=Java -%% (missing deactivation of `keywordsinside' in hook `SetLanguage') -%% -%% 4) Vespe Savikko, 2000/11/06, 0.21c (2000/11/06) -%% -%% bad output of doc-strings if HTML and Python are loaded -%% (missing group braces around mode argument in \lst@CommentB causes -%% a number `0' appearing in the output) -%% -%% 5) Christian Gudrian, 2000/11/13, 0.21d (2000/11/16) -%% -%% \ref{lst:line} jumps to top of listing and not to the line -%% (\refstepcounter not used on \c@lstlabel) -%% -%% 6) Dr. Jobst Hoffmann, 2000/11/17, 0.21e (2000/11/20) -%% -%% incompatibility with typehtml package -%% (bad lccode of /) -%% -%% 7) Kalle Tuulos, 2001/01/14, 0.21f (2001/01/17) -%% -%% formfeed characters gobbles next output unit -%% (\lst@newlines contains \lst@EOLUpdate, which calls \lst@ResetToken) -%% -%% 8) Adam Prugel-Bennett, 2001/02/19, 0.21g -%% -%% \abovecaptionskip undefined in slides.cls -%% -%% 9) Gabriel Tauro, 2001/04/18, 0.21g -%% -%% unexpected `)' if the character appears before first printed line -%% (\lst@breakProcessOther is active) -%% -%% 10) Jens Schwarzer, 2001/05/29, 0.21g -%% -%% wrong line numbering of lstlisting with first>1 -%% (\lst@firstline not taken into accout in this case) -%% -%% 11) Jens Schwarzer, 2001/05/29, 0.21g (2001/06/21) -%% -%% caption and title font are not equal -%% (\lst@maketitle not suitable for koma script) -%% -%% 12) Thorsten Vitt, 2001/06/25, 0.21h -%% -%% fancyhdr + listings crossing pages ==> ~ in header, not space -%% (old problem with \output: explicitly redefine ~) -%% -%% 13) Martin Steffen, 2001/04/07, 0.21h -%% -%% mathescape drops following space -%% (bad \lst@ifwhitespace) -%% -%% 14) Walter E. Brown, 2001/05/22, 0.21h (2001/06/27) -%% -%% pdftex 3.14159-14f warning: destination with the same identifier -%% (bad default of \theHlstlabel) -%% -%% 15) Bradford Chamberlain, 2001/07/07, 0.21i -%% -%% otherkeywords={@,@^} does not work -%% (argument treated as one long keyword) -%% -%% 16) GP Gores, 2001/07/11, 0.21i (2001/07/11) -%% -%% a) inserts \par after each \lstinline -%% (\lst@Init has been modified, but I missed \lst@DeInit) -%% -%% 17) Carsten Heinz, 2001/07/16, 0.21j (2001/07/22) -%% -%% 16) makes first line of lstlisting textstyle -%% (bad modification of \lst@DeInit) -%% -%% -%% Moreover the following functionality is added. -%% -%% a) allow line breaks in \lstinline (experimental) -%% -%% b) everydisplay= -%% -%% c) nolol= is mainly equivalent to the continue key, but -%% it will also drop lol-entries for lstlisting in the next version -%% -%% -\ProvidesFile{lstpatch}[2001/07/22 v0.21j (Carsten Heinz)] -\def\lst@topatch{0.21} -\ifx\lst@version\lst@topatch\else - \typeout{^^J% - ***^^J% - *** Patch file `lstpatch.sty' for version \lst@topatch^^J% - *** is not suitable for `listings.sty' version \lst@version.^^J% - ***^^J - *** Patch file not loaded.^^J% - ***^^J}% - \let\lst@topatch\lst@version - \expandafter\endinput -\fi -%% -%% 1) Just define \lst@breakshape. -\gdef\lst@breakshape{% - \ifodd \c@page -\lst@innerspread \else -\lst@outerspread \fi - \linewidth} -%% -%% 2) Add \lst@PrintToken after \lst@TrackNewLines. -\def\lstpatch@strings{% -\gdef\lst@BeginString##1##2{% - \lst@TrackNewLines \lst@PrintToken - \lst@ifexstrings ##2\lst@PrintToken \fi - \lst@EnterMode{##1}% - {\lst@modetrue \let\lst@currstyle\lst@stringstyle}% - \lst@ifexstrings\else ##2\lst@PrintToken \fi - \lst@ifstringspaces - \lst@keepspacestrue - \let\lst@outputspace\lst@visiblespace - \fi} -} -%% -%% 3) Insert deactivation. -\def\lstpatch@html{% - \lst@AddToHook{SetLanguage}{\let\lst@DefInside\@empty}% -} -%% -%% 4) Insert argument braces around ##5. -\def\lstpatch@comments{% -\gdef\lst@CommentB##1##2##3##4##5##6##7##8##9{% - \lst@CDef##1##2{##3}##4% - {##6}% - {\let\lst@bnext\lst@CArgEmpty - \lst@ifmode ##7\else - ##8% - \def\lst@bnext{\lst@BeginComment{##5}##9}% - \fi - \lst@bnext}% - \@empty}% -} -%% -%% 5) Use `lstlabel' with \refstepcounter. -\def\lstpatch@labels{% -\lst@AddToHook{EveryPar} - {\global\advance\c@lstlabel\m@ne \refstepcounter{lstlabel}}% -%% -%% 14) Define appropriate \theHlstlabel. -\AtBeginDocument{\def\theHlstlabel{\thelstlisting.\thelstlabel}}% -} -%% -%% 6) Restore lccode. -\lccode`\/=`\/ -%% -%% 7) Don't add \lst@EOLUpdate to \lst@newlines. Since I don't know the -%% reason for adding it a long time ago :-(, it's probably better to -%% remove \lst@ResetToken (v0.22) from `InitVarsBOL' hook. Well, I'll -%% just wait for other bug reports ... -\def\lst@ProcessFormFeed{% - \lst@PrintToken - \ifx\lst@newlines\@empty - \lst@EOLUpdate \lst@formfeed - \else -% \lst@lAddTo\lst@newlines{\lst@EOLUpdate \lst@formfeed}% - \lst@lAddTo\lst@newlines{\lst@formfeed}% - \fi - \lst@whitespacetrue} -%% -%% 8) Allocate \abovecaptionskip and \belowcaptionskip if necessary. -%% Additionally define \@makecaption (exact copy from report.cls). -\@ifundefined{abovecaptionskip} -{\newskip\abovecaptionskip - \newskip\belowcaptionskip - \long\def\@makecaption#1#2{% - \vskip\abovecaptionskip - \sbox\@tempboxa{#1: #2}% - \ifdim \wd\@tempboxa >\hsize - #1: #2\par - \else - \global \@minipagefalse - \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% - \fi - \vskip\belowcaptionskip}% -}{} -%% -%% 9) Also deactivate \lst@breakProcessOther. -\def\lst@BeginDropInput#1{% - \lst@EnterMode{#1}% - {\lst@modetrue - \let\lst@ProcessLetter\@gobble - \let\lst@ProcessDigit\@gobble - \let\lst@ProcessOther\@gobble - \let\lst@breakProcessOther\@gobble - \let\lst@ProcessSpace\@empty - \let\lst@ProcessTabulator\@empty - \let\lst@ProcessFormFeed\@empty}} -%% -%% 10) Replace \@tempcnta\@ne by \@tempcnta\lst@firstline. -\def\lstpatch@labels{% -\gdef\lst@SetFirstLabel{% - \ifx\lst@firstlabel\@undefined - \@tempcnta 0\csname lstno@\lst@intname\endcsname\relax - \ifnum\@tempcnta=\z@ \@tempcnta\lst@firstline - \else \lst@continuetrue \fi - \advance\@tempcnta\lst@advancelabel - \edef\lst@firstlabel{\the\@tempcnta\relax}% - \fi}% -} -%% -%% 11) Define \lst@maketitle in terms of \@makecaption. Note -%% thet this need not to work for all packages and classes. -%% The \let command here is especially for koma script. -\def\lst@maketitle#1#2{% - {\let\captionformat\@empty - \@makecaption{}\lst@title}} -%% -%% 12) Redefine ~ in output routine. -\lst@AddToHook{Init} - {\let\lsts@OldOutput\lst@OldOutput - \def\lst@OldOutput{\def~{\nobreakspace{}}% - \lsts@OldOutput}% - } -%% -%% 13) Use \lst@whitespacefalse at end of escape. -\def\lstpatch@escape{% - \lst@Key{escapeend}{}{\def\lst@escapeend{##1\lst@whitespacefalse}}% -} -%% -%% 15) Make `other keywords' active iteratively. -\def\lstpatch@keywords{% -\gdef\lst@AddOtherKey##1,{% - \ifx\relax##1\@empty\else - \ifx\@empty##1\@empty\else - \lst@MakeActive{##1}% - \lst@lExtend\lst@otherkeywords{\expandafter,\lst@temp}% - \fi - \expandafter\lst@AddOtherKey - \fi}% -\lst@Key{otherkeywords}{}% - {\let\lst@otherkeywords\@empty - \lst@AddOtherKey##1,\relax,} -} -%% -%% a) Remove \hbox in front of \bgroup and ... -\renewcommand\lstinline[1][]{% - \leavevmode\bgroup - \def\lst@boxpos{b}\let\lst@ifflexible\iftrue - \lsthk@PreSet\lstset{#1}% - \lsthk@TextStyle \lst@Init\relax - \everypar{}\let\lsthk@Endgroup\@empty - \let\lst@newlines\@empty \let\lst@breakcurrindent\z@ - \lstinline@} -%% 17) Add switch to distinguish text and display style listings. -\lst@AddToHook{TextStyle}{\let\lst@iftextstyle\iftrue} -\lst@AddToHook{DisplayStyle}{\let\lst@iftextstyle\iffalse} -\let\lst@iftextstyle\iffalse -% ... back to a): -\def\lst@InputListing#1{% - \begingroup - \lsthk@PreSet \gdef\lst@intname{#1}% - \expandafter\lstset\expandafter{\lst@set}% - \lst@ifprint - \par % inserted to switch to vmode - \lst@Init\relax \let\lst@gobble\z@ - \lst@SkipToFirst \input{#1}\lst@DeInit - \else - \begin{center}% - \footnotesize --- Listing of #1 has been skipped. --- - \end{center}% - \fi - \endgroup} -\def\lst@Init#1{% - \begingroup - \ifx\lst@float\relax\else - \edef\@tempa{\noexpand\@float{lstlisting}[\lst@float]}% - \expandafter\@tempa - \fi - \ifhmode\ifinner \lst@boxtrue \fi\fi - \lst@ifbox - \lsthk@BoxUnsafe - \hbox to\z@\bgroup - $\if t\lst@boxpos \vtop - \else \if b\lst@boxpos \vbox - \else \vcenter \fi\fi - \bgroup - \else -%% 17) Don't check for vertical mode, use \lst@iftextstyle. - \lst@iftextstyle\else -\lst@EveryDisplay - \par\penalty-50\relax - \vspace\lst@aboveskip - \fi - \fi - \normalbaselines - \abovecaptionskip\lst@abovecaption\relax - \belowcaptionskip\lst@belowcaption\relax - \lst@MakeCaption t% - \lsthk@PreInit \lsthk@Init - \everypar{\lsthk@EveryLine\lsthk@EveryPar}% - \lsthk@InitVars - \lsthk@InitVarsBOL - \lst@Let{13}\lst@MProcessListing - \let\lst@Backslash#1% - \lst@EnterMode{\lst@Pmode}{\lst@SelectCharTable}} -%% -%% 16) Adjust \lst@DeInit accordingly. -\def\lst@DeInit{% - \lst@PrintToken \lst@EOLUpdate - \lst@RemoveNewLine\@empty - \lst@RemoveNewLine{% - \lst@ifshowlines - \lst@TrackNewLines - \else - \setbox\@tempboxa\vbox{\lst@TrackNewLines}% - \fi}% -%% 17) Don't check for vertical mode, use \lst@iftextstyle. - \lst@iftextstyle\else - \par\removelastskip - \fi - \everypar{}\lsthk@ExitVars \lsthk@DeInit - \lst@MakeCaption b% - \lst@ifbox - \egroup $\hss \egroup - \vrule\@width\lst@maxwidth\@height\z@\@depth\z@ - \else -%% check for vertical mode. - \ifvmode - \par\penalty-50\vspace\lst@belowskip - \fi - \fi - \ifx\lst@float\relax\else - \expandafter\end@float - \fi - \endgroup} -%% -%% b) Define key, the material is inserted above. -\lst@Key{everydisplay}{}{\def\lst@EveryDisplay{#1}} -%% -%% c) New key sets value of continue key. -\lst@Key{nolol}{false}[t]{\lstKV@SetIf{#1}\lst@ifnolol} -\lst@AddToHook{PreInit}{\lst@ifcontinue\else \lst@SetIfContinue \fi} -\def\lst@SetIfContinue{\let\lst@ifcontinue\lst@ifnolol} -%% -\endinput -%% -%% End of file `lstpatch.sty'. +%% +%% This is file `lstpatch.sty', generated manually. +%% +%% Please read the software license in listings.dtx or listings.dvi. +%% +%% (w)(c) 2002 Carsten Heinz +%% +%% 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. +%% +%% Send comments and ideas on the package, error reports and additional +%% programming languages to . +%% +%% This patch file will remove the following bugs from the listings package. +%% Each item contains the bug finder with date of report and first bug fix +%% version, a short description of the problem, and the reason for the bug +%% in parenthesis. +%% +%% 1) Jochen Schneider, 2002/04/03, 1.0a (2002/04/05) +%% +%% undefined control sequence \lst@CommentB with HTML, XML, tcl +%% (I didn't renamed them to \lst@DefDelimB|E) +%% +%% 2) Michael Niedermair, 2002/04/07, 1.0b +%% +%% undefined control sequence \lst@commentmode with XML +%% (mode not defined any more) +%% +%% 3) Carsten Heinz, 2002/04/08, 1.0b +%% +%% bad PODs (investigating bugs 1 and 2) +%% (definition doesn't use 1.0 style) +%% +%% 4) Peter Bartke, 2002/04/10, 1.0b +%% +%% various problems with fancyvrb interface: string ".5" at beginning +%% of first line when using lineskip; ditto "perhaps a missing \item +%% error"; wrong placed characters , and - when using fancyvrb +%% (bad use of \strip@pt; TeX is not in vertical mode when leaving +%% Verbatim; bad `noligs' handling) +%% +%% 5) Rolf Niepraschk, 2002/04/12, 1.0b +%% +%% \RequirePackage is missing keywordstyle when near the top of a page +%% (\lst@lastother not saved away across page breaks) +%% +%% 6) Peter Ruckdeschel, 2002/04/12, 1.0b +%% Timothy Van Zandt analyzed and fixed the bug +%% +%% incompatibility with seminar class +%% (bad assignment of \lst@do@noligs in \lst@SelectCharTable) +%% +%% 7) Rene H. Larsen, 2002/04/12, 1.0b +%% +%% \lstinputlistings and texcl conflict +%% (^^M not active to reenter modes) +%% +%% 8) Carsten Heinz, 2002/04/15, 1.0b (2002/04/15) +%% +%% gobble doesn't always work (investigating problem with VTeX) +%% (\lst@BOLGobble@ must test against \lst@Process{FormFeed|Tabulator}X) +%% +%% 9) Peter Bartke, 2002/04/17, 1.0c +%% +%% TeX capacity exceeded with fancyvrb +%% (\let\lst@entermodes\@empty must stay in \lstFV@VerbatimBegin) +%% +%% 10) Svend Tollak Munkejord, 2002/04/17, 1.0c +%% Heiko Oberdiek analyzed and fixed the bug +%% +%% package incompatible with Lucida .fd files +%% (parentheses have active catcodes when reading the file) +%% +%% 11) Carsten Hamm, 2002/04/19, 1.0c (2002/04/24) +%% +%% wrong frame rules with breaklines and xleftmargin>0pt +%% (missing \kern-\lst@xleftmargin in \lst@discretionary) +%% +%% 12) Michael Niedermair, 2002/05/14, 1.0d +%% +%% backgroundcolor take effect on bottom captions +%% (wrong order of \everypar{} and \lsthk@ExitVars in \lst@DeInit) +%% +%% 13) Georg Rehm, 2002/05/14, 1.0d +%% +%% bad baselineskip with captionpos=b +%% (missing \normalbaselines) +%% +%% 14) Herfried Karl Wagner, 2002/05/11, 1.0d +%% +%% undefined control sequence \lst@entermodes +%% (\output called before first \lst@EnterMode) +%% +%% 15) Peter K\"oller, 2002/05/24, 1.0d +%% +%% XML keywords don't have keywordstyle +%% (missing \ifx... in implementation of contentsstyle) +%% +%% 16) Stephen Reindl, 2002/05/28, 1.0d +%% +%% \inaccessible using Cobol +%% (\lst@Delim@option didn't enclose option in []) +%% +%% 17) Stephen Reindl, 2002/06/04, 1.0d (2002/06/12) +%% +%% frames not deactivated for text style listings +%% +%% 18) Carsten Heinz, 2002/07/27, 1.0e (2002/07/31) +%% +%% broken keywordcomments +%% (\lst@KCpost inside group level 2; bad \lst@BeginComment call) +%% +%% 19) Kris Luyten, 2002/07/30, 1.0f (2002/08/03) +%% +%% Undefined control sequence \lst@thestyle +%% (undefined \lst@directives after _loading_ C) +%% +%% 20) Kris Luyten, 2002/08/03, 1.0g (2002/08/06) +%% +%% Undefined control sequence \lst@thestyle +%% (side effect of 19-bugfix on \lst@ProvideFamily) +%% +%% 21) Venkatesh Prasad Ranganath, 2002/08/31, 1.0h +%% +%% Undefined control sequence \thelstnumber with 0.21-option +%% (\let must be changed to a \def inition) +%% +%% 22) Fermin Reig, 2002/09/04, 1.0h (2002/09/09) +%% +%% Bad top frame inside figure+centering +%% (reset of leftskip, rightskip and parfillskip comes too late) +%% +%% 23) Hermann H\"uttler, 2002/10/05, 1.0i (2002/10/13) +%% +%% C++-string "... \\" does not end with second double quote +%% (missing \let\lst@lastother\@empty in old fix) +%% +%% +%% Moreover the following functionality is added. +%% +%% a) option "final" (Rolf Niepraschk, Enrico Straube) +%% +%% b) keys "fvcmdparams" and "morefvcmdparams" (Denis Girou) +%% +%% c) key "contentstyle" (Peter K\"oller) +%% +%% d) key "numberfirstline" (Georg Rehm) +%% +%% +\ProvidesFile{lstpatch.sty}[2002/10/13 1.0i (Carsten Heinz)] +\lst@CheckVersion{1.0} +{\typeout{^^J% + ***^^J% + *** This is a patch for `listings.sty' version 1.0, but^^J% + *** you're using version \lst@version.^^J% + ***^^J + *** Patch file not loaded.^^J% + ***^^J}% + \endinput +} +% +% 1) Define the missing control sequences. (Not needed any more.) +\def\lstpatch@comments{% + \global\let\lst@CommentB\lst@DefDelimB + \global\let\lst@CommentE\lst@DefDelimE} +% +% 2) Define \lst@commentmode. +\lst@NewMode\lst@commentmode +% +% 3) Introduce \lst@ifxpodcomment as master-clause and define 1.0 style +% contents for SelectCharTable. +\def\lstpatch@pod{% +\lst@Key{podcomment}{false}[t]{\lstKV@SetIf{##1}\lst@ifxpodcomment}% +\lst@AddToHookExe{SetLanguage}{\let\lst@ifxpodcomment\iffalse}% +\lst@AddToHook{SelectCharTable}% + {\lst@ifxpodcomment + \lst@CArgX =\relax\lst@DefDelimB{}{}% + {\ifnum\@tempcnta=\z@ + \lst@ifprintpod\else + \def\lst@bnext{\lst@BeginDropOutput\lst@PODmode}% + \expandafter\expandafter\expandafter\@gobblethree + \fi + \else + \expandafter\@gobblethree + \fi}% + \lst@BeginComment\lst@PODmode{{\lst@commentstyle}}% modified + \lst@CArgX =cut\^^M\relax\lst@DefDelimE + {\lst@CalcColumn}% + {\ifnum\@tempcnta=\z@\else + \expandafter\@gobblethree + \fi}% + {}% + \lst@EndComment\lst@PODmode + \fi}% +} +% +% 4) Redefine lineskip like podcomment above and don't use \strip@pt +% together with \divide. +\def\lstpatch@lineshape{% +\lst@Key{lineskip}{\z@}{\def\lst@xlineskip{##1\relax}} +\lst@AddToHook{Init} + {\ifdim\z@=\lst@xlineskip\else + \@tempdima\baselineskip + \advance\@tempdima\lst@xlineskip + \multiply\@tempdima\@cclvi + \divide\@tempdima\baselineskip\relax + \multiply\@tempdima\@cclvi + \edef\baselinestretch{\strip@pt\@tempdima}% + \selectfont + \fi}% +% 11) Add \kern-\lst@xleftmargin. +\gdef\lst@discretionary{% + \discretionary{\let\space\lst@spacekern\lst@prebreak}% + {\llap{\lsthk@EveryLine + \kern\lst@breakcurrindent\kern-\lst@xleftmargin}% + \let\space\lst@spacekern\lst@postbreak}{}}% +} +% Back to 4): Insert \par for vertical mode. +\def\lstpatch@fancyvrb{% +\gdef\lstFV@VerbatimEnd{% + \ifx\FancyVerbFormatLine\lstFV@FancyVerbFormatLine + \global\setbox\lstFV@gtempboxa\box\@tempboxa + \global\let\@gtempa\FV@ProcessLine + \lst@mode\lst@Pmode + \lst@DeInit + \let\FV@ProcessLine\@gtempa + \setbox\@tempboxa\box\lstFV@gtempboxa + \par % modified + \fi}% +% 9) Redefined \lstFV@VerbatimBegin removed. +% b) Refine conversion definitions to either work as usual or to ... +\gdef\lst@FVConvert{\@tempcnta\z@ \lst@FVConvertO@}% +\gdef\lst@FVConvertO@{% + \ifcase\@tempcnta \expandafter + \futurelet\expandafter\@let@token\expandafter\lst@FVConvert@@ + \else +% append arguments as they are. + \expandafter\lst@FVConvertO@a + \fi}% +\gdef\lst@FVConvertO@a##1{% + \lst@lAddTo\lst@arg{{##1}}\advance\@tempcnta\m@ne + \lst@FVConvertO@}% +% Here, ... +\gdef\lst@FVConvert@##1{% + \ifx \@nil##1\else + \if\relax\noexpand##1% + \lst@lAddTo\lst@arg{\lst@OutputLostSpace\lst@PrintToken##1}% +% ... actually here, we check for commands with arguments and set the +% value of \@tempcnta as required. + \def\lst@temp####1,##1####2,####3####4\relax{% + \ifx####3\@empty \else \@tempcnta####2\relax \fi}% + \expandafter\lst@temp\lst@FVcmdparams,##1\z@,\@empty\relax + \else + \lccode`\~=`##1\lowercase{\lst@lAddTo\lst@arg~}% + \fi + \expandafter\lst@FVConvertO@ + \fi} +% Eventually we define user keys to adjust \lst@FVcmdparams. The base +% set of commands and parameter numbers was provided by Denis Girou. +\lst@Key{fvcmdparams}% +% D.G. suggestion begin - 2002/05/31 + {\overlay\@ne}% +% D.G. suggestion end + {\def\lst@FVcmdparams{,##1}}% +\lst@Key{morefvcmdparams}\relax{\lst@lAddTo\lst@FVcmdparams{,##1}}% +} +% +% 5) Extend \lst@SaveToken to save \lst@lastother. +\def\lst@SaveToken{% + \global\let\lst@gthestyle\lst@thestyle + \global\let\lst@glastother\lst@lastother + \xdef\lst@RestoreToken{\noexpand\lst@token{\the\lst@token}% + \noexpand\lst@length\the\lst@length\relax + \noexpand\let\noexpand\lst@thestyle + \noexpand\lst@gthestyle + \noexpand\let\noexpand\lst@lastother + \noexpand\lst@glastother}% +} +% +% 6) Assign \lst@do@noligs to \do. +\def\lst@SelectCharTable{% + \lst@SelectStdCharTable + \lst@ifactivechars + \catcode9\active \catcode12\active \catcode13\active + \@tempcnta=32\relax + \@whilenum\@tempcnta<128\do + {\catcode\@tempcnta\active\advance\@tempcnta\@ne}% + \fi + \lst@ifec \lst@DefEC \fi + \let\do\lst@do@noligs \verbatim@nolig@list % modified + \lsthk@SelectCharTable + \lst@DeveloperSCT + \ifx\lst@Backslash\relax\else + \lst@LetSaveDef{"5C}\lsts@backslash\lst@Backslash + \fi} +% 4)+6) And we need correct versions of \lst@do@noligs[@]. +\def\lst@do@noligs#1{% + \begingroup \lccode`\~=`#1\lowercase{\endgroup + \lst@do@noligs@~}} +\def\lst@do@noligs@#1{% + \expandafter\expandafter\expandafter\def + \expandafter\expandafter\expandafter#1% + \expandafter\expandafter\expandafter{\expandafter\lst@NoLig#1}} +% +% 7) Make ^^M active. +\def\lst@InputListing#1{% + \begingroup + \lsthk@PreSet \gdef\lst@intname{#1}% + \expandafter\lstset\expandafter{\lst@set}% + \lsthk@DisplayStyle + \catcode\active=\active % added + \lst@Init\relax \let\lst@gobble\z@ + \lst@SkipToFirst + \lst@ifprint \def\lst@next{\input{#1}}% + \else \let\lst@next\@empty \fi + \lst@next + \lst@DeInit + \endgroup} +% +% 8) Replace \lst@Process{FormFeed|Tabulator}. +\def\lst@ProcessFormFeedX{\lst@ProcessFormFeed} +\def\lst@ProcessTabulatorX{\lst@ProcessTabulator} +\def\lst@BOLGobble@#1{% + \let\lst@next#1% + \ifx \lst@next\relax\else + \ifx \lst@next\lst@MProcessListing\else + \ifx \lst@next\lst@ProcessFormFeedX\else + \ifx \lst@next\lstenv@backslash + \let\lst@next\lstenv@BOLGobble@@ + \else + \let\lst@next\lst@BOLGobble@@ + \ifx #1\lst@ProcessTabulatorX + \advance\@tempcnta-\lst@tabsize\relax + \ifnum\@tempcnta<\z@ + \lst@length-\@tempcnta \lst@PreGotoTabStop + \fi + \else + \advance\@tempcnta\m@ne + \fi + \fi \fi \fi \fi + \lst@next} +% +% 10) Add some \@makeother to \lst@nfss@catcodes. +\def\lst@nfss@catcodes{% + \lst@makeletter + ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\relax + \@makeother (\@makeother )\@makeother ,\@makeother :\@makeother &% + \@makeother 0\@makeother 1\@makeother 2\@makeother 3\@makeother 4% + \@makeother 5\@makeother 6\@makeother 7\@makeother 8\@makeother 9% + \@makeother =\lsts@nfss@catcodes} +% +% 12) and 13) Deactivate \everypar and use normal baseline parameters. +\lst@AddToHook{DeInit}{\everypar{}\normalbaselines} +% +% 14) Define \lst@entermodes. +\let\lst@entermodes\@empty +% +% 16) Insert [ and ] in replacement text. +\def\lst@Delim@option[#1]{\def\lst@arg{[#1]}\lst@Delim@delim} +% +% 17) Just empty `frame' and top, right, bottom, and left shape. +\lst@AddToHook{TextStyle} + {\let\lst@frame\@empty + \let\lst@frametshape\@empty + \let\lst@framershape\@empty + \let\lst@framebshape\@empty + \let\lst@framelshape\@empty} +% +% 18) Execute \lst@BeginKC and \lst@BeginKCS outside the two groups. +% Modify third argument to \lst@BeginComment to work properly. +\def\lstpatch@keywordcomments{% +\gdef\lst@BeginKC{\aftergroup\aftergroup\aftergroup\lst@BeginKC@}% +\gdef\lst@BeginKC@{% + \lst@ResetToken + \lst@BeginComment\lst@KCmode{{\lst@commentstyle}\lst@modetrue}\@empty}% +\gdef\lst@BeginKCS{\aftergroup\aftergroup\aftergroup\lst@BeginKCS@}% +\gdef\lst@BeginKCS@{% + \lst@ResetToken + \lst@BeginComment\lst@KCSmode{{\lst@commentstyle}\lst@modetrue}\@empty}% +\gdef\lst@EndKC{\lst@SaveToken \lst@LeaveMode \lst@RestoreToken + \let\lst@thestyle\lst@identifierstyle \lsthk@Output}% renew style selection +} +% +% 19) Init \lst@directives. +\def\lstpatch@directives{% + \global\let\lst@directives\@empty} +% +% 20) Use new prefix for a family -- the now initialized \lst@directives +% clashes with the default. +\def\lstpatch@keywords{% +\gdef\lst@ProvideFamily##1{% + \@ifundefined{lstfam@##1\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}% + {\@namedef{lstfam@##1\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}{}% + \expandafter\expandafter\expandafter\lst@ProvideFamily@ + \csname\@lst @##1@data\endcsname + {\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}}% + {}}% +} +% 21) Define \thelstnumber every listing via \def. +\@namedef{lstpatch@021}{% + \lst@AddToHook{Init}{\def\thelstnumber{\thelstlabel}}% +} +% 22) Reset the registers in PreInit hook +\lst@AddToHook{PreInit} + {\rightskip\z@ \leftskip\z@ \parfillskip\z@ plus 1fil} +% +% 23) Add \let\lst@lastother\@empty +\lst@AddToHook{SelectCharTable}{% + \lst@ifbstring + \lst@CArgX \\\\\relax \lst@CDefX{}% + {\lst@ProcessOther\lstum@backslash + \lst@ProcessOther\lstum@backslash + \let\lst@lastother\@empty}% + {}% + \fi} +% +% a) Just declare the option. +\DeclareOption{final}{\let\lst@ifdraft\iffalse} +% +% c) Define contentstyle and use it. +\def\lstpatch@html{% +\lst@Key{contentstyle}{}{\def\lst@contentstyle{##1}}% +\lst@AddToHook{Init}% + {\ifx\lst@DefInside\@empty\else + \let\lst@tagstyle\lst@identifierstyle + \let\lst@identifierstyle\lst@contentstyle + \fi}% +\lst@AddToHook{Output}% + {\ifnum\lst@mode=\lst@insidemode +% 15) Check for keywordstyle. + \ifx\lst@thestyle\lst@gkeywords@sty\else + \lst@ifusekeysinside \let\lst@thestyle\lst@tagstyle + \else \let\lst@thestyle\lst@gkeywords@sty \fi + \fi\fi}% +\lst@AddToHook{OutputOther}% + {\lst@ifmode\else \ifnum\lst@mode=\lst@insidemode\else + \ifx\lst@DefInside\@empty\else + \let\lst@thestyle\lst@contentstyle + \fi + \fi\fi}% +} +% +% d) Define key and adjust \lst@SkipOrPrintLabel. +\def\lstpatch@labels{% +\lst@Key{numberfirstline}{f}[t]{\lstKV@SetIf{##1}\lst@ifnumberfirstline}% +\gdef\lst@numberfirstlinefalse{\let\lst@ifnumberfirstline\iffalse} +\gdef\lst@SkipOrPrintLabel{% + \ifnum\lst@skipnumbers=\z@ + \global\advance\lst@skipnumbers-\lst@stepnumber\relax + \lst@PlaceNumber + \lst@numberfirstlinefalse + \else + \lst@ifnumberfirstline + \lst@PlaceNumber + \lst@numberfirstlinefalse + \fi + \fi + \global\advance\lst@skipnumbers\@ne}% +} +%% +\endinput +%% +%% End of file `lstpatch.sty'. \ No newline at end of file