90ef93b763
much of README.alpha in the release notes). This commit was SVN r5145.
1960 строки
71 KiB
TeX
1960 строки
71 KiB
TeX
%%
|
|
%% This is file `lstmisc.sty',
|
|
%% generated with the docstrip utility.
|
|
%%
|
|
%% The original source files were:
|
|
%%
|
|
%% listings.dtx (with options: `misc,0.21')
|
|
%%
|
|
%% Please read the software license in listings.dtx or listings.dvi.
|
|
%%
|
|
%% (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 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
|
|
%%
|
|
%% 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 <cheinz@gmx.de>.
|
|
%%
|
|
\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}
|
|
\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{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{\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}
|
|
\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,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@commentstyle\itshape}
|
|
\gdef\lst@BeginComment{%
|
|
\lst@DelimOpen
|
|
\lst@ifexcomments\else
|
|
\lsthk@AfterBeginComment}
|
|
\gdef\lst@EndComment{\lst@DelimClose\lst@ifexcomments\else}
|
|
\lst@AddToHook{AfterBeginComment}{}
|
|
\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}
|
|
\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@AddToHook{SelectCharTable}
|
|
{\lst@ifpodcomment
|
|
\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
|
|
\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@TeXLmode
|
|
\expandafter\lst@escapeend
|
|
\expandafter\lst@LeaveAllModes
|
|
\expandafter\lst@ReenterModes
|
|
\fi}
|
|
\lst@AddToHook{AfterBeginComment}
|
|
{\lst@iftexcl \lst@ifLmode \lst@ifdropinput\else
|
|
\lst@PrintToken
|
|
\lst@LeaveMode \lst@InterruptModes
|
|
\lst@EnterMode{\lst@TeXLmode}{\lst@modetrue\lst@commentstyle}%
|
|
\expandafter\expandafter\expandafter\lst@escapebegin
|
|
\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%
|
|
\lowercase{\lst@CDefIt~}{#2}{#3}{}}
|
|
\gdef\lst@Escape#1#2#3#4{%
|
|
\lst@CArgX #1\relax\lst@CDefX
|
|
{}%
|
|
{\lst@ifdropinput\else
|
|
\lst@TrackNewLines\lst@OutputLostSpace \lst@XPrintToken
|
|
\lst@InterruptModes
|
|
\lst@EnterMode{\lst@TeXmode}{\lst@modetrue}%
|
|
\ifx\^^M#2%
|
|
\lst@CArg #2\relax\lst@ActiveCDefX
|
|
{}%
|
|
{\lst@escapeend #4\lst@LeaveAllModes\lst@ReenterModes}%
|
|
{\lst@MProcessListing}%
|
|
\else
|
|
\lst@CArg #2\relax\lst@ActiveCDefX
|
|
{}%
|
|
{\lst@escapeend #4\lst@LeaveAllModes\lst@ReenterModes
|
|
\lst@whitespacefalse}%
|
|
{}%
|
|
\fi
|
|
#3\lst@escapebegin
|
|
\fi}%
|
|
{}}
|
|
\lst@NewMode\lst@TeXmode
|
|
\lst@Key{escapebegin}{}{\def\lst@escapebegin{#1}}
|
|
\lst@Key{escapeend}{}{\def\lst@escapeend{#1}}
|
|
\lst@Key{escapechar}{}
|
|
{\ifx\@empty#1\@empty
|
|
\let\lst@DefEsc\relax
|
|
\else
|
|
\def\lst@DefEsc{\lst@Escape{#1}{#1}{}{}}%
|
|
\fi}
|
|
\lst@AddToHook{TextStyle}{\let\lst@DefEsc\@empty}
|
|
\lst@AddToHook{SelectCharTable}{\lst@DefEsc}
|
|
\lst@Key{escapeinside}{}{\lstKV@TwoArg{#1}%
|
|
{\let\lst@DefEsc\@empty
|
|
\ifx\@empty##1@empty\else \ifx\@empty##2\@empty\else
|
|
\def\lst@DefEsc{\lst@Escape{##1}{##2}{}{}}%
|
|
\fi\fi}}
|
|
\lst@Key{mathescape}{false}[t]{\lstKV@SetIf{#1}\lst@ifmathescape}
|
|
\lst@AddToHook{SelectCharTable}
|
|
{\lst@ifmathescape \lst@Escape{\$}{\$}%
|
|
{\setbox\@tempboxa=\hbox\bgroup$}%
|
|
{$\egroup \lst@CalcLostSpaceAndOutput}\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
|
|
\endgroup
|
|
\ifx\@gtempa\relax\else
|
|
\let\lst@thestyle\@gtempa
|
|
\fi}
|
|
\gdef\lst@KEYWORDTEST{%
|
|
\uppercase\expandafter{\expandafter
|
|
\lst@KEYWORDTEST@\the\lst@token}\relax}
|
|
\gdef\lst@KEYWORDTEST@#1\relax#2#3#4{%
|
|
\begingroup \let\lst@UM\@empty
|
|
\global\expandafter\let\expandafter\@gtempa
|
|
\csname\@lst#2@#1\endcsname
|
|
\endgroup
|
|
\ifx\@gtempa\relax\else
|
|
\let\lst@thestyle\@gtempa
|
|
\fi}
|
|
\gdef\lst@WorkingTest#1#2#3{%
|
|
\begingroup \let\lst@UM\@empty
|
|
\global\expandafter\let\expandafter\@gtempa
|
|
\csname\@lst#1@\the\lst@token\endcsname
|
|
\endgroup
|
|
\@gtempa}
|
|
\gdef\lst@WORKINGTEST{%
|
|
\uppercase\expandafter{\expandafter
|
|
\lst@WORKINGTEST@\the\lst@token}\relax}
|
|
\gdef\lst@WORKINGTEST@#1\relax#2#3#4{%
|
|
\begingroup \let\lst@UM\@empty
|
|
\global\expandafter\let\expandafter\@gtempa
|
|
\csname\@lst#2@#1\endcsname
|
|
\endgroup
|
|
\@gtempa}
|
|
\gdef\lst@DefineKeywords#1#2#3{%
|
|
\lst@ifsensitive
|
|
\def\lst@next{\lst@for#2}%
|
|
\else
|
|
\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%
|
|
\fi}}
|
|
\gdef\lst@UndefineKeywords#1#2#3{%
|
|
\lst@ifsensitivedefed
|
|
\def\lst@next{\lst@for#2}%
|
|
\else
|
|
\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
|
|
\fi}}
|
|
\fi
|
|
\lst@ifsavemem
|
|
\gdef\lst@IfOneOutOf#1\relax#2{%
|
|
\def\lst@temp##1,#1,##2##3\relax{%
|
|
\ifx\@empty##2\else \expandafter\lst@IOOOfirst \fi}%
|
|
\def\lst@next{\lst@IfOneOutOf@#1\relax}%
|
|
\expandafter\lst@next#2\relax\relax}
|
|
\gdef\lst@IfOneOutOf@#1\relax#2#3{%
|
|
\ifx#2\relax
|
|
\expandafter\@secondoftwo
|
|
\else
|
|
\expandafter\lst@temp\expandafter,#2,#1,\@empty\relax
|
|
\expandafter\lst@next
|
|
\fi}
|
|
\ifx\iffalse\else\fi
|
|
\gdef\lst@IOOOfirst#1\relax#2#3{\fi#2}
|
|
\gdef\lst@IFONEOUTOF#1\relax#2{%
|
|
\uppercase{\def\lst@temp##1,#1},##2##3\relax{%
|
|
\ifx\@empty##2\else \expandafter\lst@IOOOfirst \fi}%
|
|
\def\lst@next{\lst@IFONEOUTOF@#1\relax}%
|
|
\expandafter\lst@next#2\relax}
|
|
\gdef\lst@IFONEOUTOF@#1\relax#2#3{%
|
|
\ifx#2\relax
|
|
\expandafter\@secondoftwo
|
|
\else
|
|
\uppercase
|
|
{\expandafter\lst@temp\expandafter,#2,#1,\@empty\relax}%
|
|
\expandafter\lst@next
|
|
\fi}
|
|
\gdef\lst@KWTest{%
|
|
\begingroup \let\lst@UM\@empty
|
|
\expandafter\xdef\expandafter\@gtempa\expandafter{\the\lst@token}%
|
|
\endgroup
|
|
\expandafter\lst@IfOneOutOf\@gtempa\relax}
|
|
\gdef\lst@KeywordTest#1#2#3{\lst@KWTest #2{\let\lst@thestyle#3}{}}
|
|
\global\let\lst@KEYWORDTEST\lst@KeywordTest
|
|
\gdef\lst@WorkingTest#1#2#3{\lst@KWTest #2#3{}}
|
|
\global\let\lst@WORKINGTEST\lst@WorkingTest
|
|
\fi
|
|
\lst@Key{sensitive}\relax[t]{\lstKV@SetIf{#1}\lst@ifsensitive}
|
|
\lst@AddToHook{SetLanguage}{\let\lst@ifsensitive\iftrue}
|
|
\lst@AddToHook{Init}
|
|
{\lst@ifsensitive\else
|
|
\let\lst@KeywordTest\lst@KEYWORDTEST
|
|
\let\lst@WorkingTest\lst@WORKINGTEST
|
|
\let\lst@IfOneOutOf\lst@IFONEOUTOF
|
|
\fi}
|
|
\gdef\lst@MakeMacroUppercase#1{%
|
|
\ifx\@undefined#1\else \uppercase\expandafter
|
|
{\expandafter\def\expandafter#1\expandafter{#1}}%
|
|
\fi}
|
|
\gdef\lst@InstallTest#1#2#3#4#5#6#7#8{%
|
|
\lst@AddToHook{TrackKeywords}{\lst@TrackKeywords{#1}#2#4#6#7#8}%
|
|
\lst@AddToHook{PostTrackKeywords}{\lst@PostTrackKeywords#2#3#4#5}}
|
|
\lst@AddToHook{Init}{\lsthk@TrackKeywords\lsthk@PostTrackKeywords}
|
|
\lst@AddToHook{TrackKeywords}{}% init
|
|
\lst@AddToHook{PostTrackKeywords}{}% init
|
|
\lst@AddToHook{Output}{\lst@ifkeywords \lsthk@DetectKeywords \fi}
|
|
\lst@AddToHook{DetectKeywords}{}% init
|
|
\lst@AddToHook{ModeTrue}{\let\lst@ifkeywords\iffalse}
|
|
\lst@AddToHook{Init}{\let\lst@ifkeywords\iftrue}
|
|
\gdef\lst@InstallTestNow#1#2#3#4#5{%
|
|
\@ifundefined{\string#2#1}%
|
|
{\global\@namedef{\string#2#1}{}%
|
|
\edef\@tempa{%
|
|
\noexpand\lst@AddToHook{\ifx#5dDetectKeywords\else Output\fi}%
|
|
{\ifx #4w\noexpand\lst@WorkingTest
|
|
\else\noexpand\lst@KeywordTest \fi
|
|
{#1}\noexpand#2\noexpand#3}}%
|
|
\lst@ifsavemem
|
|
\@tempa
|
|
\else
|
|
\@ifundefined{\@lst#1@if@ins}%
|
|
{\@tempa \global\@namedef{\@lst#1@if@ins}{}}%
|
|
{}%
|
|
\fi}
|
|
{}}
|
|
\gdef\lst@TrackKeywords#1#2#3#4#5#6{%
|
|
\lst@false
|
|
\def\lst@arg{{#1}#4}%
|
|
\expandafter\expandafter\expandafter\lst@TK@
|
|
\expandafter\lst@arg#2\relax\relax
|
|
\lst@ifsavemem\else
|
|
\def\lst@arg{{#1}#4#2}%
|
|
\expandafter\expandafter\expandafter\lst@TK@@
|
|
\expandafter\lst@arg#3\relax\relax
|
|
\fi
|
|
\lst@if \lst@InstallTestNow{#1}#2#4#5#6\fi}
|
|
\gdef\lst@TK@#1#2#3#4{%
|
|
\ifx\lst@ifsensitive\lst@ifsensitivedefed
|
|
\ifx#3#4\else
|
|
\lst@true
|
|
\lst@ifsavemem\else
|
|
\lst@UndefineKeywords{#1}#4#2%
|
|
\lst@DefineKeywords{#1}#3#2%
|
|
\fi
|
|
\fi
|
|
\else
|
|
\ifx#3\relax\else
|
|
\lst@true
|
|
\lst@ifsavemem\else
|
|
\lst@UndefineKeywords{#1}#4#2%
|
|
\lst@DefineKeywords{#1}#3#2%
|
|
\fi
|
|
\fi
|
|
\fi
|
|
\lst@ifsavemem \ifx#3\relax\else
|
|
\lst@ifsensitive\else \lst@MakeMacroUppercase#3\fi
|
|
\fi \fi
|
|
\ifx#3\relax
|
|
\expandafter\@gobblethree
|
|
\fi
|
|
\lst@TK@{#1}#2}
|
|
\gdef\lst@TK@@#1#2#3#4#5{%
|
|
\ifx#4\relax
|
|
\expandafter\@gobblefour
|
|
\else
|
|
\lst@IfSubstring{#4#5}#3{}{\lst@UndefineKeywords{#1}#5#2}%
|
|
\fi
|
|
\lst@TK@@{#1}#2#3}
|
|
\lst@AddToHook{InitVars}
|
|
{\global\let\lst@ifsensitivedefed\lst@ifsensitive}
|
|
\gdef\lst@PostTrackKeywords#1#2#3#4{%
|
|
\lst@ifsavemem\else
|
|
\global\let#3#1%
|
|
\global\let#4#2%
|
|
\fi}
|
|
\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
|
|
{\lst@UseFamily{#2}##1\relax\lst@MakeMoreKeywords}%
|
|
\lst@Key{delete#2}\relax
|
|
{\lst@UseFamily{#2}##1\relax\lst@DeleteKeywords}%
|
|
\ifx\@empty#3\@empty\else
|
|
\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}}
|
|
\gdef\lst@InstallFamily@#1#2#3#4#5#6#7#8{%
|
|
\gdef#1{{#3}{#4}{#5}#2#7}%
|
|
\long\def\lst@temp##1{#6}%
|
|
\ifx\lst@temp\@gobble
|
|
\lst@AddTo#1{s#8}%
|
|
\else
|
|
\lst@AddTo#1{w#8}%
|
|
\global\@namedef{lst@g#4@wp}##1{#6}%
|
|
\fi}
|
|
\gdef\lst@UseFamily#1{%
|
|
\def\lst@family{#1}%
|
|
\@ifnextchar[\lst@UseFamily@{\lst@UseFamily@[\@ne]}}
|
|
\gdef\lst@UseFamily@[#1]{%
|
|
\@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}
|
|
\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}%
|
|
\lst@Key{more#2}\relax
|
|
{\lst@UseFamily{#2}[\@ne]##1\relax\lst@MakeMoreKeywords}%
|
|
\lst@Key{delete#2}\relax
|
|
{\lst@UseFamily{#2}[\@ne]##1\relax\lst@DeleteKeywords}%
|
|
\ifx\@empty#3\@empty\else
|
|
\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}}
|
|
\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}%
|
|
\fi
|
|
\expandafter\lst@BuildClassList\expandafter#1
|
|
\fi}
|
|
\gdef\lst@DeleteClassesIn#1#2{%
|
|
\expandafter\lst@DCI@\expandafter#1#2\relax\relax}
|
|
\gdef\lst@DCI@#1#2#3{%
|
|
\ifx#2\relax
|
|
\expandafter\@gobbletwo
|
|
\else
|
|
\def\lst@temp##1#2#3##2{%
|
|
\lst@lAddTo#1{##1}%
|
|
\ifx ##2\relax\else
|
|
\expandafter\lst@temp
|
|
\fi ##2}%
|
|
\let\@tempa#1\let#1\@empty
|
|
\expandafter\lst@temp\@tempa#2#3\relax
|
|
\fi
|
|
\lst@DCI@#1}
|
|
\gdef\lst@MakeKeywords[#1]#2#3#4#5#6{%
|
|
\def#3{#4#6}\let#4\@empty \let#5\@empty
|
|
\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}
|
|
\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@InstallFamily k{keywords}{keywordstyle}\bfseries{keywordstyle}{}ld
|
|
\lst@Key{ndkeywords}\relax
|
|
{\lst@UseFamily{keywords}[\tw@]#1\relax\lst@MakeKeywords}%
|
|
\lst@Key{morendkeywords}\relax
|
|
{\lst@UseFamily{keywords}[\tw@]#1\relax\lst@MakeMoreKeywords}%
|
|
\lst@Key{deletendkeywords}\relax
|
|
{\lst@UseFamily{keywords}[\tw@]#1\relax\lst@DeleteKeywords}%
|
|
\lst@Key{ndkeywordstyle}\relax{\@namedef{lst@keywordstyle2}{#1}}%
|
|
\lst@Key{keywordsprefix}\relax{\lst@DefActive\lst@keywordsprefix{#1}}
|
|
\global\let\lst@keywordsprefix\@empty
|
|
\lst@AddToHook{SelectCharTable}
|
|
{\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@XPrintToken
|
|
\begingroup
|
|
\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}{}{emphstyle}{}od
|
|
\lst@EndAspect
|
|
\lst@BeginAspect[keywords]{tex}
|
|
\lst@InstallKeywords{cs}{texcs}{texcsstyle}\relax{keywordstyle}
|
|
{\ifx\lst@lastother\lstum@backslash
|
|
\let\lst@thestyle\lst@texcsstyle
|
|
\fi}
|
|
ld
|
|
\lst@EndAspect
|
|
\lst@BeginAspect[keywords]{directives}
|
|
\lst@NewMode\lst@CDmode
|
|
\lst@AddToHook{EOL}{\ifnum\lst@mode=\lst@CDmode \lst@LeaveMode \fi}
|
|
\lst@InstallKeywords{d}{directives}{directivestyle}\relax{keywordstyle}
|
|
{\ifnum\lst@mode=\lst@CDmode
|
|
\let\lst@thestyle\lst@directivestyle
|
|
\fi}
|
|
ld
|
|
\lst@AddToHook{SelectCharTable}
|
|
{\ifx\lst@directives\@empty\else
|
|
\lst@DefSaveDef{`\#}\lsts@CCD
|
|
{\lst@CalcColumn
|
|
\lst@ifmode\else
|
|
\ifnum\@tempcnta=\z@
|
|
\lst@EnterMode{\lst@CDmode}{}%
|
|
\fi
|
|
\fi
|
|
\ifnum\lst@mode=\lst@CDmode
|
|
\ifnum\@tempcnta=\z@
|
|
\lst@XPrintToken
|
|
{\let\lst@currstyle\lst@directivestyle
|
|
\lsts@CCD\lst@PrintToken}%
|
|
\else \lsts@CCD
|
|
\fi
|
|
\else \lsts@CCD
|
|
\fi}%
|
|
\fi}
|
|
\lst@AddTo\lst@stringtypes{,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@BeginString{#1}}%
|
|
\fi
|
|
\lst@bnext}%
|
|
\@empty
|
|
\lst@CArg #3\relax\lst@CDef
|
|
{}%
|
|
{\let\lst@enext\lst@CArgEmpty
|
|
\ifnum #1=\lst@mode
|
|
\let\lst@bnext\lst@EndString
|
|
\fi
|
|
\lst@bnext}%
|
|
\@empty}
|
|
\lst@EndAspect
|
|
\lst@BeginAspect[keywords]{html}
|
|
\lst@NewMode\lst@insidemode
|
|
\lst@Key{keywordsinside}{}{\lstKV@TwoArg{#1}
|
|
{\let\lst@DefInside\@empty
|
|
\ifx\@empty##1\@empty\else \ifx\@empty##2\@empty\else
|
|
\def\lst@DefInside{%
|
|
\lst@DefSaveDef{`##1}\lsts@insideb
|
|
{\lst@ifmode\else \ifnum\lst@mode=\lst@insidemode\else
|
|
\lst@XPrintToken
|
|
\lst@EnterMode\lst@insidemode{}%
|
|
\fi\fi
|
|
\lsts@insideb}%
|
|
\lst@DefSaveDef{`##2}\lsts@insidee
|
|
{\ifnum\lst@mode=\lst@insidemode
|
|
\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
|
|
\let\lst@thestyle\@empty
|
|
\fi
|
|
\fi\fi}
|
|
\lst@Key{usekeywordsinside}t[t]{\lstKV@SetIf{#1}\lst@ifusekeysinside}
|
|
\lst@AddToHook{Output}
|
|
{\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@ResetToken
|
|
\lst@BeginComment\lst@KCmode\lst@commentstyle\@empty}
|
|
\gdef\lst@BeginKCS{%
|
|
\lst@ResetToken
|
|
\lst@BeginComment\lst@KCSmode\lst@commentstyle\@empty}
|
|
\lst@AddToHook{PostOutput}{\lst@KCpost \global\let\lst@KCpost\@empty}
|
|
\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}%
|
|
\ifx\lst@temp\lst@KCmatch
|
|
\lst@EndKC
|
|
\fi
|
|
\else
|
|
\lst@ifmode\else
|
|
\xdef\lst@KCmatch{\the\lst@token}%
|
|
\global\let\lst@KCpost\lst@BeginKC
|
|
\fi
|
|
\fi}
|
|
lo
|
|
\lst@Key{keywordcommentsemicolon}{}{\lstKV@ThreeArg{#1}%
|
|
{\def\lst@KCAkeywordsB{##1}%
|
|
\def\lst@KCAkeywordsE{##2}%
|
|
\def\lst@KCBkeywordsB{##3}%
|
|
\def\lst@KCkeywords{##1##2##3}}}
|
|
\lst@AddToHook{SelectCharTable}
|
|
{\ifx\lst@KCkeywords\@empty\else
|
|
\lst@DefSaveDef{`\;}\lsts@EKC
|
|
{\lst@XPrintToken
|
|
\ifnum\lst@mode=\lst@KCmode \lst@EndComment\@empty \else
|
|
\ifnum\lst@mode=\lst@KCSmode \lst@EndComment\@empty
|
|
\fi \fi
|
|
\lsts@EKC}%
|
|
\fi}
|
|
\gdef\lst@KCAWorkB{%
|
|
\lst@ifmode\else \global\let\lst@KCpost\lst@BeginKC \fi}
|
|
\gdef\lst@KCBWorkB{%
|
|
\lst@ifmode\else \global\let\lst@KCpost\lst@BeginKCS \fi}
|
|
\gdef\lst@KCAWorkE{\ifnum\lst@mode=\lst@KCmode \lst@EndKC \fi}
|
|
\lst@ProvideFamily@@
|
|
\lst@KCAkeywordsB@list\lst@KCAkeywordsB \lst@KC@also
|
|
\lst@gKCAkeywordsB@list\lst@gKCAkeywordsB \lst@KCAWorkB
|
|
{kcb}owo % prefix, other key, working procedure, Output hook
|
|
\lst@ProvideFamily@@
|
|
\lst@KCAkeywordsE@list\lst@KCAkeywordsE \lst@KC@also
|
|
\lst@gKCAkeywordsE@list\lst@gKCAkeywordsE \lst@KCAWorkE
|
|
{kce}owo
|
|
\lst@ProvideFamily@@
|
|
\lst@KCBkeywordsB@list\lst@KCBkeywordsB \lst@KC@also
|
|
\lst@gKCBkeywordsB@list\lst@gKCBkeywordsB \lst@KCBWorkB
|
|
{kcs}owo
|
|
\lst@EndAspect
|
|
\lst@BeginAspect[keywords]{index}
|
|
\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}}}
|
|
\lst@EndAspect
|
|
\lst@BeginAspect[keywords]{procnames}
|
|
\gdef\lst@procnametrue{\global\let\lst@ifprocname\iftrue}
|
|
\gdef\lst@procnamefalse{\global\let\lst@ifprocname\iffalse}
|
|
\lst@AddToHook{Init}{\lst@procnamefalse}
|
|
\lst@AddToHook{DetectKeywords}
|
|
{\lst@ifprocname
|
|
\let\lst@thestyle\lst@procnamestyle
|
|
\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 \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
|
|
\lst@AddToHook{PostOutput}{\lst@PNpost\global\let\lst@PNpost\@empty}
|
|
\global\let\lst@PNpost\@empty % init
|
|
\lst@EndAspect
|
|
\lst@BeginAspect{style}
|
|
\@ifundefined{lststylefiles}
|
|
{\lst@UserCommand\lststylefiles{lststy0.sty}}{}
|
|
\lst@UserCommand\lstdefinestyle{\lst@DefStyle\iftrue}
|
|
\lst@UserCommand\lst@definestyle{\lst@DefStyle\iffalse}
|
|
\gdef\lst@DefStyle{\lst@DefDriver{style}{sty}\lstset}
|
|
\global\@namedef{lststy@$}{\lsthk@EmptyStyle}
|
|
\lst@AddToHook{EmptyStyle}{}% init
|
|
\lst@Key{style}\relax{%
|
|
\lst@LAS{style}{sty}{[]{#1}}\lst@NoAlias\lststylefiles
|
|
\lsthk@SetStyle
|
|
{}}
|
|
\lst@AddToHook{SetStyle}{}% init
|
|
\lst@EndAspect
|
|
\lst@BeginAspect{language}
|
|
\@ifundefined{lstdriverfiles}
|
|
{\lst@UserCommand\lstlanguagefiles{lstlang0.sty}}{}
|
|
\lst@UserCommand\lstdefinelanguage{\lst@DefLang\iftrue}
|
|
\lst@UserCommand\lst@definelanguage{\lst@DefLang\iffalse}
|
|
\gdef\lst@DefLang{\lst@DefDriver{language}{lang}\lstset}
|
|
\lstdefinelanguage{}{}
|
|
\lst@Key{language}\relax{\lstKV@OptArg[]{#1}%
|
|
{\lst@LAS{language}{lang}{[##1]{##2}}\lst@FindAlias\lstlanguagefiles
|
|
\lsthk@SetLanguage
|
|
{\lst@FindAlias[##1]{##2}%
|
|
\let\lst@language\lst@malias
|
|
\let\lst@dialect\lst@oalias}}}
|
|
\lst@Key{alsolanguage}\relax{\lstKV@OptArg[]{#1}%
|
|
{\lst@LAS{language}{lang}{[##1]{##2}}\lst@FindAlias\lstlanguagefiles
|
|
{}%
|
|
{\lst@FindAlias[##1]{##2}%
|
|
\let\lst@language\lst@malias
|
|
\let\lst@dialect\lst@oalias}}}
|
|
\lst@AddToHook{SetLanguage}{}% init
|
|
\lst@UserCommand\lstalias{\@ifnextchar[\lstalias@\lstalias@@}
|
|
\gdef\lstalias@[#1]#2[#3]#4{\lst@NormedNameDef{lsta@#2$#1}{#4$#3}}
|
|
\gdef\lstalias@@#1#2{\lst@NormedNameDef{lsta@#1}{#2}}
|
|
\lst@Key{defaultdialect}\relax
|
|
{\lstKV@OptArg[]{#1}{\lst@NormedNameDef{lstdd@##2}{##1}}}
|
|
\gdef\lst@FindAlias[#1]#2{%
|
|
\lst@NormedDef\lst@oalias{#1}%
|
|
\lst@NormedDef\lst@malias{#2}%
|
|
\@ifundefined{lsta@\lst@malias}{}%
|
|
{\edef\lst@malias{\csname\@lst a@\lst@malias\endcsname}}%
|
|
\ifx\@empty\lst@oalias \@ifundefined{lstdd@\lst@malias}{}%
|
|
{\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\@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\@lst dd@\lst@malias\endcsname}}%
|
|
\fi}
|
|
\gdef\lst@RequireLanguages#1{%
|
|
\lst@Require{language}{lang}{#1}\lst@FindAlias\lstlanguagefiles
|
|
\ifx\lst@loadaspects\@empty\else
|
|
\lst@RequireAspects\lst@loadaspects
|
|
\fi}
|
|
\global\let\lstloadlanguages\lst@RequireLanguages
|
|
\lst@EndAspect
|
|
\lst@BeginAspect{formats}
|
|
\@ifundefined{lstformatfiles}
|
|
{\lst@UserCommand\lstformatfiles{lstfmt0.sty}}{}
|
|
\lst@UserCommand\lstdefineformat{\lst@DefFormat\iftrue}
|
|
\lst@UserCommand\lst@defineformat{\lst@DefFormat\iffalse}
|
|
\gdef\lst@DefFormat{\lst@DefDriver{format}{fmt}\lst@UseFormat}
|
|
\lstdefineformat{}{}
|
|
\lst@Key{format}\relax{%
|
|
\lst@LAS{format}{fmt}{[]{#1}}\lst@NoAlias\lstformatfiles
|
|
\lsthk@SetFormat
|
|
{}}
|
|
\lst@AddToHook{SetFormat}{\let\lst@fmtformat\@empty}% init
|
|
\gdef\lst@fmtSplit#1#2{%
|
|
\def\lst@temp##1#2##2\relax##3{%
|
|
\ifnum##3=\z@
|
|
\ifx\@empty##2\@empty
|
|
\lst@false
|
|
\let\lst@fmta#1%
|
|
\let\lst@fmtb\@empty
|
|
\else
|
|
\expandafter\lst@temp#1\relax\@ne
|
|
\fi
|
|
\else
|
|
\def\lst@fmta{##1}\def\lst@fmtb{##2}%
|
|
\fi}%
|
|
\lst@true
|
|
\expandafter\lst@temp#1#2\relax\z@}
|
|
\gdef\lst@IfNextCharWhitespace#1#2#3{%
|
|
\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}% add ^^L
|
|
\global\let\lst@whitespaces\lst@whitespaces%
|
|
\endgroup
|
|
\gdef\lst@fmtIfIdentifier#1{%
|
|
\ifx\relax#1\@empty
|
|
\expandafter\@secondoftwo
|
|
\else
|
|
\expandafter\lst@fmtIfIdentifier@\expandafter#1%
|
|
\fi}
|
|
\gdef\lst@fmtIfIdentifier@#1#2\relax{%
|
|
\let\lst@next\@secondoftwo
|
|
\ifnum`#1=`_\else
|
|
\ifnum`#1<64\else
|
|
\ifnum`#1<91\let\lst@next\@firstoftwo\else
|
|
\ifnum`#1<97\else
|
|
\ifnum`#1<123\let\lst@next\@firstoftwo\else
|
|
\fi \fi \fi \fi \fi
|
|
\lst@next}
|
|
\gdef\lst@fmtIfNextCharIn#1{%
|
|
\ifx\@empty#1\@empty \expandafter\@secondoftwo \else
|
|
\def\lst@next{\lst@fmtIfNextCharIn@{#1}}%
|
|
\expandafter\lst@next\fi}
|
|
\gdef\lst@fmtIfNextCharIn@#1#2#3#4{%
|
|
\def\lst@temp##1#4##2##3\relax{%
|
|
\ifx \@empty##2\expandafter\@secondoftwo
|
|
\else \expandafter\@firstoftwo \fi}%
|
|
\lst@temp#1#4\@empty\relax{#2}{#3}#4}
|
|
\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}}%
|
|
\else \ifx\@empty#3\@empty
|
|
\def#1##1{%
|
|
\ifx##1#2%
|
|
\def\lst@next{\lst@fmtIfNextCharIn{#5}{#4##1}%
|
|
{#6#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#7}}%
|
|
{\expandafter#4\lst@eaten}}%
|
|
\fi \fi}
|
|
\gdef\lst@UseFormat#1{%
|
|
\def\lst@fmtwhole{#1}%
|
|
\lst@UseFormat@}
|
|
\gdef\lst@UseFormat@{%
|
|
\lst@fmtSplit\lst@fmtwhole,%
|
|
\let\lst@fmtwhole\lst@fmtb
|
|
\ifx\lst@fmta\@empty\else
|
|
\lst@fmtSplit\lst@fmta=%
|
|
\ifx\@empty\lst@fmta\else
|
|
\expandafter\lstKV@XOptArg\expandafter[\expandafter]%
|
|
\expandafter{\lst@fmtb}\lst@UseFormat@b
|
|
\fi
|
|
\fi
|
|
\ifx\lst@fmtwhole\@empty\else
|
|
\expandafter\lst@UseFormat@
|
|
\fi}
|
|
\gdef\lst@UseFormat@b[#1]#2{%
|
|
\def\lst@fmtc{{#1}}\lst@lExtend\lst@fmtc{\expandafter{\lst@fmta}}%
|
|
\def\lst@fmtb{#2}%
|
|
\lst@fmtSplit\lst@fmtb\string
|
|
\ifx\@empty\lst@fmta
|
|
\lst@lAddTo\lst@fmtc{{}}%
|
|
\else
|
|
\lst@lExtend\lst@fmtc{\expandafter
|
|
{\expandafter\lst@fmtPre\expandafter{\lst@fmta}}}%
|
|
\fi
|
|
\ifx\@empty\lst@fmtb
|
|
\lst@lAddTo\lst@fmtc{{}}%
|
|
\else
|
|
\lst@lExtend\lst@fmtc{\expandafter
|
|
{\expandafter\lst@fmtPost\expandafter{\lst@fmtb}}}%
|
|
\fi
|
|
\expandafter\lst@UseFormat@c\lst@fmtc}
|
|
\gdef\lst@UseFormat@c#1#2#3#4{%
|
|
\lst@fmtIfIdentifier#2\relax
|
|
{\lst@fmtIdentifier{#2}%
|
|
\lst@if\else \PackageWarning{Listings}%
|
|
{Cannot drop identifier in format definition}%
|
|
\fi}%
|
|
{\lst@if
|
|
\lst@lAddTo\lst@fmtformat{\lst@CArgX#2\relax\lst@fmtCDef}%
|
|
\else
|
|
\lst@lAddTo\lst@fmtformat{\lst@CArgX#2\relax\lst@fmtCDefX}%
|
|
\fi
|
|
\lst@DefActive\lst@fmtc{#1}%
|
|
\lst@lExtend\lst@fmtformat{\expandafter{\lst@fmtc}{#3}{#4}}}}
|
|
\lst@AddToHook{SelectCharTable}{\lst@fmtformat}
|
|
\global\let\lst@fmtformat\@empty
|
|
\gdef\lst@fmtPre#1{%
|
|
\lst@PrintToken
|
|
\begingroup
|
|
\let\newline\lst@fmtEnsureNewLine
|
|
\let\space\lst@fmtEnsureSpace
|
|
\let\indent\lst@fmtIndent
|
|
\let\noindent\lst@fmtNoindent
|
|
#1%
|
|
\endgroup}
|
|
\gdef\lst@fmtPost#1{%
|
|
\global\let\lst@fmtPostOutput\@empty
|
|
\begingroup
|
|
\def\newline{\lst@AddTo\lst@fmtPostOutput\lst@fmtEnsureNewLine}%
|
|
\def\space{\aftergroup\lst@fmtEnsurePostSpace}%
|
|
\def\indent{\lst@AddTo\lst@fmtPostOutput\lst@fmtIndent}%
|
|
\def\noindent{\lst@AddTo\lst@fmtPostOutput\lst@fmtNoindent}%
|
|
\aftergroup\lst@PrintToken
|
|
#1%
|
|
\endgroup}
|
|
\lst@AddToHook{Init}{\global\let\lst@fmtPostOutput\@empty}
|
|
\lst@AddToHook{PostOutput}
|
|
{\lst@fmtPostOutput \global\let\lst@fmtPostOutput\@empty}
|
|
\gdef\lst@fmtEnsureSpace{%
|
|
\lst@ifwhitespace\else \expandafter\lst@ProcessSpace \fi}
|
|
\gdef\lst@fmtEnsurePostSpace{%
|
|
\lst@IfNextCharWhitespace{}{\lst@ProcessSpace}}
|
|
\lst@Key{fmtindent}{20pt}{\def\lst@fmtindent{#1}}
|
|
\newdimen\lst@fmtcurrindent
|
|
\lst@AddToHook{InitVars}{\global\lst@fmtcurrindent\z@}
|
|
\gdef\lst@fmtIndent{\global\advance\lst@fmtcurrindent\lst@fmtindent}
|
|
\gdef\lst@fmtNoindent{\global\advance\lst@fmtcurrindent-\lst@fmtindent}
|
|
\gdef\lst@fmtEnsureNewLine{%
|
|
\global\advance\lst@newlines\@ne
|
|
\global\advance\lst@newlinesensured\@ne
|
|
\lst@fmtignoretrue}
|
|
\lst@AddToAtTop\lst@DoNewLines{%
|
|
\ifnum\lst@newlines>\lst@newlinesensured
|
|
\global\advance\lst@newlines-\lst@newlinesensured
|
|
\fi
|
|
\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}
|
|
\lst@AddToHook{Output}{\lst@fmtignorefalse}
|
|
\gdef\lst@fmtUseLostSpace{%
|
|
\lst@ifnewline \kern\lst@fmtcurrindent \global\lst@lostspace\z@
|
|
\else
|
|
\lst@OldOLS
|
|
\fi}
|
|
\lst@AddToHook{Init}
|
|
{\lst@true
|
|
\ifx\lst@fmtformat\@empty \ifx\lst@fmt\@empty \lst@false \fi\fi
|
|
\lst@if
|
|
\let\lst@OldOLS\lst@OutputLostSpace
|
|
\let\lst@OutputLostSpace\lst@fmtUseLostSpace
|
|
\let\lst@ProcessSpace\lst@fmtProcessSpace
|
|
\fi}
|
|
\gdef\lst@fmtProcessSpace{%
|
|
\lst@ifletter
|
|
\lst@Output
|
|
\lst@fmtifignore\else
|
|
\lst@AppendOther\lst@outputspace
|
|
\fi
|
|
\else \lst@ifkeepspaces
|
|
\lst@AppendOther\lst@outputspace
|
|
\else \ifnum\lst@newlines=\z@
|
|
\lst@AppendSpecialSpace
|
|
\else \ifnum\lst@length=\z@
|
|
\global\advance\lst@lostspace\lst@width
|
|
\global\advance\lst@pos\m@ne
|
|
\else
|
|
\lst@AppendSpecialSpace
|
|
\fi
|
|
\fi \fi \fi
|
|
\lst@whitespacetrue}
|
|
\lst@InstallTest{f}
|
|
\lst@fmt@list\lst@fmt \lst@gfmt@list\lst@gfmt
|
|
\lst@gfmt@wp
|
|
wd
|
|
\gdef\lst@fmt@list{\lst@fmt\lst@gfmt}\global\let\lst@fmt\@empty
|
|
\gdef\lst@gfmt@list{\lst@fmt\lst@gfmt}\global\let\lst@gfmt\@empty
|
|
\gdef\lst@gfmt@wp{%
|
|
\begingroup \let\lst@UM\@empty
|
|
\let\lst@PrintToken\@empty
|
|
\csname\lst@ @fmt$\the\lst@token\endcsname
|
|
\endgroup}
|
|
\gdef\lst@fmtIdentifier#1#2#3#4{%
|
|
\lst@DefOther\lst@fmta{#2}\edef\lst@fmt{\lst@fmt,\lst@fmta}%
|
|
\@namedef{\lst@ @fmt$\lst@fmta}{#3#4}}
|
|
\lst@EndAspect
|
|
\lst@BeginAspect{labels}
|
|
\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@firstnumber\@undefined
|
|
\let\lst@firstnumber\lst@firstline
|
|
\fi}
|
|
\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@SaveFirstNumber{%
|
|
\expandafter\xdef
|
|
\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@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@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@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@stepnumber
|
|
\let\lst@advancelstnum\m@ne
|
|
\edef\lst@stepnumber{-\lst@stepnumber}%
|
|
\fi
|
|
\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@skipnumbers=\z@
|
|
\global\advance\lst@skipnumbers-\lst@stepnumber\relax
|
|
\lst@PlaceNumber
|
|
\fi
|
|
\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}
|
|
\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}
|
|
\gdef\lst@parshape{%
|
|
\parshape\@ne \@totalleftmargin \linewidth}
|
|
\lst@AddToHook{Init}
|
|
{\lst@ifresetmargins
|
|
\advance\linewidth\@totalleftmargin
|
|
\advance\linewidth\rightmargin
|
|
\@totalleftmargin\z@
|
|
\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\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}
|
|
\lst@Key{prebreak}{}{\def\lst@prebreak{#1}}
|
|
\lst@Key{postbreak}{}{\def\lst@postbreak{#1}}
|
|
\lst@AddToHook{Init}
|
|
{\lst@ifbreaklines
|
|
\hbadness\@M \pretolerance\@M
|
|
\def\lst@parshape{\parshape\tw@ \@totalleftmargin\linewidth
|
|
\lst@breakshape}%
|
|
\else
|
|
\let\lst@discretionary\@empty
|
|
\fi}
|
|
\lst@AddToHook{OnNewLine}
|
|
{\lst@ifbreaklines \lst@breakNewLine \fi}
|
|
\gdef\lst@discretionary{%
|
|
\discretionary{\let\space\lst@spacekern\lst@prebreak}%
|
|
{\llap{\lsthk@EveryLine \kern\lst@breakcurrindent}%
|
|
\let\space\lst@spacekern\lst@postbreak}{}}
|
|
\lst@AddToHook{PostOutput}{\lst@discretionary}
|
|
\gdef\lst@spacekern{\kern\lst@width}
|
|
\gdef\lst@breakNewLine{%
|
|
\@tempdima\lst@breakindent\relax
|
|
\lst@ifbreakautoindent \advance\@tempdima\lst@lostspace \fi
|
|
\@tempdimc-\@tempdima \advance\@tempdimc\linewidth
|
|
\advance\@tempdima\@totalleftmargin
|
|
\xdef\lst@breakshape{\noexpand\lst@breakcurrindent \the\@tempdimc}%
|
|
\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{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}}%
|
|
\uppercase{\def\lst@framebshape{##4}}%
|
|
\let\lst@ifframeround\iffalse
|
|
\lst@IfSubstring R\lst@frametshape{\let\lst@ifframeround\iftrue}{}%
|
|
\lst@IfSubstring R\lst@framebshape{\let\lst@ifframeround\iftrue}{}%
|
|
\def\lst@frame{##1##2##3##4}}}
|
|
\lst@Key{frameround}\relax
|
|
{\uppercase{\def\lst@frameround{#1}}%
|
|
\expandafter\lstframe@\lst@frameround ffff\relax}
|
|
\global\let\lst@frameround\@empty
|
|
\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}}{}%
|
|
\lst@IfSubstring B\lst@frame{\edef\lst@frame{b\lst@frame}}{}%
|
|
\lst@IfSubstring L\lst@frame{\edef\lst@frame{l\lst@frame}}{}%
|
|
\let\lst@frametshape\@empty \let\lst@framebshape\@empty
|
|
\lst@frameCheck
|
|
ltr\lst@framelshape\lst@frametshape\lst@framershape #4#1%
|
|
\lst@frameCheck
|
|
LTR\lst@framelshape\lst@frametshape\lst@framershape #4#1%
|
|
\lst@frameCheck
|
|
lbr\lst@framelshape\lst@framebshape\lst@framershape #3#2%
|
|
\lst@frameCheck
|
|
LBR\lst@framelshape\lst@framebshape\lst@framershape #3#2%
|
|
\let\lst@ifframeround\iffalse
|
|
\lst@IfSubstring R\lst@frametshape{\let\lst@ifframeround\iftrue}{}%
|
|
\lst@IfSubstring R\lst@framebshape{\let\lst@ifframeround\iftrue}{}%
|
|
\let\lst@framelshape\@empty \let\lst@framershape\@empty
|
|
\lst@IfSubstring L\lst@frame
|
|
{\def\lst@framelshape{YY}}%
|
|
{\lst@IfSubstring l\lst@frame{\def\lst@framelshape{Y}}{}}%
|
|
\lst@IfSubstring R\lst@frame
|
|
{\def\lst@framershape{YY}}%
|
|
{\lst@IfSubstring r\lst@frame{\def\lst@framershape{Y}}{}}}
|
|
\gdef\lst@frameCheck#1#2#3#4#5#6#7#8{%
|
|
\lst@IfSubstring #1\lst@frame
|
|
{\if #7T\def#4{R}\else \def#4{Y}\fi}%
|
|
{\def#4{N}}%
|
|
\lst@IfSubstring #3\lst@frame
|
|
{\if #8T\def#6{R}\else \def#6{Y}\fi}%
|
|
{\def#6{N}}%
|
|
\lst@IfSubstring #2\lst@frame{\edef#5{#5#4Y#6}}{}}
|
|
\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{%
|
|
\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@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@rulesep
|
|
\expandafter\lst@frameL@\lst@framelshape\relax}
|
|
\gdef\lst@frameL@#1{%
|
|
\ifx\relax#1\@empty\else
|
|
\kern\lst@rulesep
|
|
\if#1Y\lst@framevrule \else \kern\lst@framerulewidth \fi
|
|
\expandafter\lst@frameL@
|
|
\fi}
|
|
\gdef\lst@frameH#1#2{%
|
|
\global\let\lst@framediml\z@ \global\let\lst@framedimr\z@
|
|
\setbox\z@\hbox{}\@tempcntb\z@
|
|
\expandafter\lst@frameH@\expandafter#1#2\relax\relax\relax
|
|
\@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{%
|
|
\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
|
|
\@tempdima\lst@framexleftmargin
|
|
\advance\@tempdima\lst@framexrightmargin
|
|
\advance\@tempdima\linewidth
|
|
\vrule\@width\@tempdima\@height\lst@framerulewidth \@depth\z@
|
|
\endgroup
|
|
\lst@frameCornerX\rlap{#2R}#5#1%
|
|
\ifdim\lst@framedimr<\@tempdimb
|
|
\xdef\lst@framedimr{\the\@tempdimb}%
|
|
\fi
|
|
\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}%
|
|
\fi}
|
|
\gdef\lst@frameCalcDimA#1{%
|
|
\@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}{\lst@frameInit}
|
|
\newbox\lst@framebox
|
|
\gdef\lst@frameInit{%
|
|
\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}%
|
|
\lst@frameCalcDimA\@ne \@getcirc\@tempdima
|
|
\@tempdimb\@tempdima \divide\@tempdimb\tw@
|
|
\advance\@tempdimb -\tw@\@wholewidth
|
|
\advance\@tempdimb -\lst@frametextsep
|
|
\edef\lst@rulesep{\the\@tempdimb}%
|
|
\fi
|
|
\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
|
|
\lst@frameSpreadV\lst@framextopmargin
|
|
\fi}
|
|
\lst@AddToHook{EveryLine}{\lst@framelr}
|
|
\global\let\lst@framelr\@empty
|
|
\lst@AddToHook{DeInit}
|
|
{\ifx\lst@framebshape\@empty\else \lst@frameExit \fi}
|
|
\gdef\lst@frameExit{%
|
|
\lst@frameSpreadV\lst@framexbottommargin
|
|
\lst@frameH B\lst@framebshape
|
|
\ifvoid\z@\else
|
|
\everypar{}\par\lst@parshape\nointerlineskip\noindent\box\z@
|
|
\fi}
|
|
\gdef\lst@frameSpreadV#1{%
|
|
\ifdim\z@=#1\else
|
|
\everypar{}\par\lst@parshape\nointerlineskip\noindent
|
|
\lst@frameMakeBoxV\z@{#1}{\z@}%
|
|
\box\z@
|
|
\fi}
|
|
\gdef\lst@frameTR{%
|
|
\vrule\@width.5\@tempdima\@height\lst@framerulewidth\@depth\z@
|
|
\kern-\lst@framerulewidth
|
|
\raise\lst@framerulewidth\hbox{%
|
|
\vrule\@width\lst@framerulewidth\@height\z@\@depth.5\@tempdima}}
|
|
\gdef\lst@frameBR{%
|
|
\vrule\@width.5\@tempdima\@height\lst@framerulewidth\@depth\z@
|
|
\kern-\lst@framerulewidth
|
|
\vrule\@width\lst@framerulewidth\@height.5\@tempdima\@depth\z@}
|
|
\gdef\lst@frameBL{%
|
|
\vrule\@width\lst@framerulewidth\@height.5\@tempdima\@depth\z@
|
|
\kern-\lst@framerulewidth
|
|
\vrule\@width.5\@tempdima\@height\lst@framerulewidth\@depth\z@}
|
|
\gdef\lst@frameTL{%
|
|
\raise\lst@framerulewidth\hbox{%
|
|
\vrule\@width\lst@framerulewidth\@height\z@\@depth.5\@tempdima}%
|
|
\kern-\lst@framerulewidth
|
|
\vrule\@width.5\@tempdima\@height\lst@framerulewidth\@depth\z@}
|
|
\gdef\lst@frameRoundT{%
|
|
\setbox\@tempboxa\hbox{\@circlefnt\char\@tempcnta}%
|
|
\ht\@tempboxa\lst@framerulewidth
|
|
\box\@tempboxa}
|
|
\gdef\lst@frameRoundB{%
|
|
\setbox\@tempboxa\hbox{\@circlefnt\char\@tempcnta}%
|
|
\dp\@tempboxa\z@
|
|
\box\@tempboxa}
|
|
\gdef\lst@frameRTR{%
|
|
\hb@xt@.5\@tempdima{\kern-\lst@framerulewidth
|
|
\kern.5\@tempdima \lst@frameRoundT \hss}}
|
|
\gdef\lst@frameRBR{%
|
|
\hb@xt@.5\@tempdima{\kern-\lst@framerulewidth
|
|
\advance\@tempcnta\@ne \kern.5\@tempdima \lst@frameRoundB \hss}}
|
|
\gdef\lst@frameRBL{%
|
|
\advance\@tempcnta\tw@ \lst@frameRoundB
|
|
\kern-.5\@tempdima}
|
|
\gdef\lst@frameRTL{%
|
|
\advance\@tempcnta\thr@@\lst@frameRoundT
|
|
\kern-.5\@tempdima}
|
|
\lst@EndAspect
|
|
\lst@BeginAspect[keywords]{make}
|
|
\lst@NewMode\lst@makemode
|
|
\lst@AddToHook{Output}{%
|
|
\ifnum\lst@mode=\lst@makemode
|
|
\ifx\lst@thestyle\lst@gkeywords@sty
|
|
\lst@makekeytrue
|
|
\fi
|
|
\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}
|
|
{\typeout{^^J%
|
|
***^^J%
|
|
*** `listings.sty' needs `fancyvrb.sty' right now.^^J%
|
|
*** Please ensure its availability and try again.^^J%
|
|
***^^J}%
|
|
\batchmode \@@end}{}
|
|
\gdef\lstFV@fancyvrb{%
|
|
\lst@iffancyvrb
|
|
\ifx\FancyVerbFormatLine\lstFV@FancyVerbFormatLine\else
|
|
\let\lstFV@FVFL\FancyVerbFormatLine
|
|
\let\FancyVerbFormatLine\lstFV@FancyVerbFormatLine
|
|
\fi
|
|
\else
|
|
\ifx\lstFV@FVFL\@undefined\else
|
|
\let\FancyVerbFormatLine\lstFV@FVFL
|
|
\let\lstFV@FVFL\@undefined
|
|
\fi
|
|
\fi}
|
|
\gdef\lstFV@VerbatimBegin{%
|
|
\ifx\FancyVerbFormatLine\lstFV@FancyVerbFormatLine
|
|
\lsthk@TextStyle \lsthk@BoxUnsafe
|
|
\lsthk@PreSet
|
|
\lst@activecharsfalse
|
|
\let\normalbaselines\relax
|
|
\lst@Init\relax
|
|
\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
|
|
\let\@noligs\relax
|
|
%% D.G. modification end
|
|
\fi}
|
|
\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
|
|
\fi}
|
|
\newbox\lstFV@gtempboxa
|
|
\lst@AddTo\FV@VerbatimBegin\lstFV@VerbatimBegin
|
|
\lst@AddToAtTop\FV@VerbatimEnd\lstFV@VerbatimEnd
|
|
\lst@AddTo\FV@LVerbatimBegin\lstFV@VerbatimBegin
|
|
\lst@AddToAtTop\FV@LVerbatimEnd\lstFV@VerbatimEnd
|
|
\lst@AddTo\FV@BVerbatimBegin\lstFV@VerbatimBegin
|
|
\lst@AddToAtTop\FV@BVerbatimEnd\lstFV@VerbatimEnd
|
|
\gdef\lstFV@FancyVerbFormatLine#1{%
|
|
\let\lst@arg\@empty \lst@FVConvert#1\@nil
|
|
\global\lst@newlines\z@
|
|
\vtop{\leavevmode\lst@parshape
|
|
\lst@ReenterModes
|
|
\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{%
|
|
\lst@NormedDef\lstlang@{#1}\lst@ReplaceInArg\lstlang@{|,}%
|
|
\def\lst@arg{:#2}}
|
|
\gdef\lst@LGGetValue#1{%
|
|
\lst@false
|
|
\def\lst@temp##1:#1##2##3\relax{%
|
|
\ifx\@empty##2\else \lst@LGGetValue@{#1}\fi}
|
|
\expandafter\lst@temp\lst@arg:#1\@empty\relax}
|
|
\gdef\lst@LGGetValue@#1{%
|
|
\lst@true
|
|
\def\lst@temp##1:#1##2:##3\relax{%
|
|
\@ifnextchar=\lst@LGGetValue@@{\lst@LGGetValue@@=}##2\relax
|
|
\def\lst@arg{##1:##3}}%
|
|
\expandafter\lst@temp\lst@arg\relax}
|
|
\gdef\lst@LGGetValue@@=#1\relax{\def\lst@LGvalue{#1}}
|
|
\gdef\lst@LGGetComment#1#2{%
|
|
\let#2\@empty
|
|
\lst@LGGetValue{#1b}%
|
|
\lst@if
|
|
\let#2\lst@LGvalue
|
|
\lst@LGGetValue{#1e}%
|
|
\ifx\lst@LGvalue\lst@LGEOL
|
|
\edef\lstlang@{\lstlang@,commentline={#2}}%
|
|
\let#2\@empty
|
|
\else
|
|
\edef#2{{#2}{\lst@LGvalue}}%
|
|
\fi
|
|
\fi}
|
|
\gdef\lst@LGGetString#1#2{%
|
|
\lst@LGGetValue{#1b}%
|
|
\lst@if
|
|
\let#2\lst@LGvalue
|
|
\lst@LGGetValue{#1e}%
|
|
\ifx\lst@LGvalue\lst@LGEOL
|
|
\edef\lstlang@{\lstlang@,morestringizer=[l]{#2}}%
|
|
\else
|
|
\ifx #2\lst@LGvalue
|
|
\edef\lstlang@{\lstlang@,morestringizer=[d]{#2}}%
|
|
\else
|
|
\edef\lst@temp{\lst@LGe#2}%
|
|
\ifx \lst@temp\lst@LGvalue
|
|
\edef\lstlang@{\lstlang@,morestringizer=[b]{#2}}%
|
|
\else
|
|
\PackageWarning{Listings}%
|
|
{String #2...\lst@LGvalue\space not supported}%
|
|
\fi
|
|
\fi
|
|
\fi
|
|
\fi}
|
|
\gdef\lst@LGDefLang{%
|
|
\lst@LGReplace
|
|
\let\lstlang@\empty
|
|
\lst@LGGetValue{kw}%
|
|
\lst@if
|
|
\lst@ReplaceInArg\lst@LGvalue{{ },}%
|
|
\edef\lstlang@{\lstlang@,keywords={\lst@LGvalue}}%
|
|
\fi
|
|
\lst@LGGetValue{oc}%
|
|
\lst@if
|
|
\edef\lstlang@{\lstlang@,sensitive=f}%
|
|
\fi
|
|
\lst@LGGetValue{id}%
|
|
\lst@if
|
|
\edef\lstlang@{\lstlang@,alsoletter=\lst@LGvalue}%
|
|
\fi
|
|
\lst@LGGetComment a\lst@LGa
|
|
\lst@LGGetComment c\lst@LGc
|
|
\ifx\lst@LGa\@empty
|
|
\ifx\lst@LGc\@empty\else
|
|
\edef\lstlang@{\lstlang@,singlecomment=\lst@LGc}%
|
|
\fi
|
|
\else
|
|
\ifx\lst@LGc\@empty
|
|
\edef\lstlang@{\lstlang@,singlecomment=\lst@LGa}%
|
|
\else
|
|
\edef\lstlang@{\lstlang@,doublecomment=\lst@LGc\lst@LGa}%
|
|
\fi
|
|
\fi
|
|
\lst@LGGetString s\lst@LGa
|
|
\lst@LGGetString l\lst@LGa
|
|
\lst@LGGetValue{tc}%
|
|
\lst@if
|
|
\edef\lstlang@{\lstlang@,lgrindef=\lst@LGvalue}%
|
|
\fi
|
|
\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
|
|
\ifx\lst@LGvalue\@empty\else
|
|
\PackageWarningNoLine{Listings}{Ignored capabilities for
|
|
\space `\lst@language@' are\MessageBreak\lst@LGvalue}%
|
|
\fi}
|
|
\gdef\lst@LGDroppedCaps#1:#2#3{%
|
|
\ifx#2\relax
|
|
\lst@RemoveCommas\lst@LGvalue
|
|
\else
|
|
\edef\lst@LGvalue{\lst@LGvalue,#2#3}%
|
|
\expandafter\lst@LGDroppedCaps
|
|
\fi}
|
|
\begingroup
|
|
\catcode`\/=0
|
|
\lccode`\z=`\:\lccode`\y=`\^\lccode`\x=`\$\lccode`\v=`\|
|
|
\catcode`\\=12\relax
|
|
/lowercase{%
|
|
/gdef/lst@LGReplace{/lst@ReplaceInArg/lst@arg
|
|
{{\:}{z }{\^}{y}{\$}{x}{\|}{v}{ \ }{ }{:\ :}{:}{\ }{ }{\(}({\)})}}
|
|
/gdef/lst@LGe{\e}
|
|
}
|
|
/endgroup
|
|
\gdef\lst@LGRead#1\par{%
|
|
\lst@LGGetNames#1:\relax
|
|
\def\lst@temp{endoflanguagedefinitions}%
|
|
\ifx\lstlang@\lst@temp
|
|
\let\lst@next\endinput
|
|
\else
|
|
\expandafter\lst@IfOneOf\lst@language@\relax\lstlang@
|
|
{\lst@LGDefLang \let\lst@next\endinput}%
|
|
{\let\lst@next\lst@LGRead}%
|
|
\fi
|
|
\lst@next}
|
|
\lst@Key{lgrindef}\relax{%
|
|
\lst@NormedDef\lst@language@{#1}%
|
|
\begingroup
|
|
\@ifundefined{lstLGlang@\lst@language@}%
|
|
{\everypar{\lst@LGRead}%
|
|
\catcode`\\=12\catcode`\{=12\catcode`\}=12\catcode`\%=12%
|
|
\catcode`\#=14\catcode`\$=12\catcode`\^=12\catcode`\_=12\relax
|
|
\input{\lstlgrindeffile}%
|
|
}{}%
|
|
\endgroup
|
|
\@ifundefined{lstLGlang@\lst@language@}%
|
|
{\PackageError{Listings}%
|
|
{LGrind language \lst@language@\space undefined}%
|
|
{The language is not loadable. \@ehc}}%
|
|
{\lsthk@SetLanguage
|
|
\csname\@lst LGlang@\lst@language@\endcsname}}
|
|
\@ifundefined{lstlgrindeffile}
|
|
{\lst@UserCommand\lstlgrindeffile{lgrindef.}}{}
|
|
\lst@EndAspect
|
|
\lst@BeginAspect[keywords]{hyper}
|
|
\lst@Key{hyperanchor}\hyper@@anchor{\let\lst@hyperanchor#1}
|
|
\lst@Key{hyperlink}\hyperlink{\let\lst@hyperlink#1}
|
|
\lst@InstallKeywords{h}{hyperref}{}\relax{}
|
|
{\begingroup
|
|
\let\lst@UM\@empty \xdef\@gtempa{\the\lst@token}%
|
|
\endgroup
|
|
\lst@GetFreeMacro{lstHR@\@gtempa}%
|
|
\global\expandafter\let\lst@freemacro\@empty
|
|
\@tempcntb\@tempcnta \advance\@tempcntb\m@ne
|
|
\edef\lst@alloverstyle##1{%
|
|
\let\noexpand\lst@alloverstyle\noexpand\@empty
|
|
\noexpand\smash{\raise\baselineskip\hbox
|
|
{\noexpand\lst@hyperanchor{lst.\@gtempa\the\@tempcnta}%
|
|
{\relax}}}%
|
|
\ifnum\@tempcnta=\z@ ##1\else
|
|
\noexpand\lst@hyperlink{lst.\@gtempa\the\@tempcntb}{##1}%
|
|
\fi}%
|
|
}
|
|
od
|
|
\lst@EndAspect
|
|
\endinput
|
|
%%
|
|
%% End of file `lstmisc.sty'.
|