%%
%% This is file `lstmisc.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% listings.dtx  (with options: `strings,comments,pod,escape,writefile,style,language,keywords,rdkeywords,html,tex,directives,index,procnames,keywordcomments,labels,lineshape,breaklines,frames,make,doc,fancyvrb')
%% 
%% Please read the software license in listings.dtx or listings.dvi.
%%
%% (w)(c) 1996/1997/1998/1999 Carsten Heinz and/or any other author
%% listed elsewhere in this file.
%%
%% This file is distributed under the terms of the LaTeX Project Public
%% License from CTAN archives in directory  macros/latex/base/lppl.txt.
%% Either version 1.0 or, at your option, any later version.
%%
%% The listings package is free software.
%%
%% However, if you distribute the package as part of a commercial
%% product or if you use the package to prepare a document and sell the
%% document (books, journals, and so on), I'd like to encourage you to
%% make a donation to the LaTeX3 fund. The size of this `license fee'
%% should depend on the value of the package for your product.
%%
%% If you use the package to typeset a non-commercial document, please
%% send me a copy of the document (hardcopy, .dvi, .ps, .pdf, etc.) to
%% support further development.
%%
%% Permission is granted to change this file. You are not allowed to
%% distribute any changed version of this file, neither under the same
%% name nor under a different one.
%%
%% Send comments and ideas on the package, error reports and additional
%% programming languages to <cheinz@gmx.de>.
%%
\ProvidesFile{lstmisc.sty}[1999/07/12 v0.20 (Carsten Heinz)]
\lst@BeginAspect{strings}
\gdef\lst@legalstringizer{d,b,m,bd,db}
\lst@Key{stringizer}\relax{\lstKV@OptArg[d]{#1}%
    {\lst@IfOneOf##1\relax \lst@legalstringizer
         {\expandafter\def\expandafter\lst@DefStrings
          \expandafter{\expandafter\lst@Stringizer\csname
              lst@ProcessStringizer@##1\endcsname ##2\@empty}}%
         {\PackageError{Listings}{Illegal stringizer type `##1'}%
          {Available types are \lst@legalstringizer.}}}}
\lst@AddToHook{SetLanguage}{\let\lst@DefStrings\@empty}
\lst@AddToHook{SelectCharTable}{\lst@DefStrings}
\gdef\lst@Stringizer#1#2{%
    \ifx\@empty#2%
        \expandafter\@gobbletwo
    \else
        \lccode`\~=`#2\lccode`\/=`#2\lowercase{%
            \expandafter\let\csname lsts@s/\endcsname~%
            \def~{#1/}}%
    \fi
    \lst@Stringizer#1}
\lst@NewMode\lst@stringmode
\gdef\lst@ProcessStringizer@d#1{%
    \lst@ifletter \lst@Output\lst@letterfalse \fi
    \ifnum\lst@mode=\lst@stringmode
        \csname lsts@s#1\endcsname
        \ifx\lst@lastother\lst@closestring
            \lst@EndString
        \fi
    \else
        \lst@OutputOther
        \lst@ifmode\else
            \expandafter\expandafter\expandafter\lst@BeginString
        \fi
        \csname lsts@s#1\endcsname
    \fi}
\gdef\lst@ProcessStringizer@b#1{%
    \lst@ifletter \lst@Output\lst@letterfalse \fi
    \ifnum\lst@mode=\lst@stringmode
        \let\lst@temp\lst@lastother \csname lsts@s#1\endcsname
        \ifx\lst@temp\lstum@backslash\else
        \ifx\lst@lastother\lst@closestring
            \lst@EndString
        \fi \fi
    \else
        \lst@OutputOther
        \lst@ifmode\else
            \expandafter\expandafter\expandafter\lst@BeginString
        \fi
        \csname lsts@s#1\endcsname
    \fi}
\global\let\lst@ProcessStringizer@bd\lst@ProcessStringizer@b
\global\let\lst@ProcessStringizer@db\lst@ProcessStringizer@bd
\gdef\lst@ProcessStringizer@m#1{%
    \ifnum\lst@mode=\lst@stringmode
        \lst@ifletter \lst@Output\lst@letterfalse \fi
        \csname lsts@s#1\endcsname
        \ifx\lst@lastother\lst@closestring
            \lst@EndString
        \fi
    \else
        \lst@ifletter
            \lst@Output\lst@letterfalse
        \else
            \lst@OutputOther
            \let\lst@CCnext\relax
            \ifx\lst@lastother)\else \lst@ifmode\else
                \let\lst@CCnext\lst@BeginString
            \fi \fi
            \expandafter\expandafter\expandafter\lst@CCnext
        \fi
        \csname lsts@s#1\endcsname
    \fi}
\lst@AddToHook{OmegaOutputBox}
    {\let\lst@ProcessStringizer@b\@firstofone
     \let\lst@ProcessStringizer@d\@firstofone
     \let\lst@ProcessStringizer@m\@firstofone
     \let\lst@ProcessStringizer@bd\@firstofone
     \let\lst@ProcessStringizer@db\@firstofone}
\lst@Key{stringstyle}{}{\def\lst@stringstyle{#1}}
\lst@Key{stringspaces}{true}[t]{\lstKV@SetIf{#1}\lst@ifstringspaces}
\lst@AddToHook{EmptyStyle}{\let\lst@stringstyle\@empty}
\gdef\lst@BeginString#1{%
    \lst@NewLine
    \lst@EnterMode{\lst@stringmode}{\lst@modetrue\lst@stringstyle}%
    #1%
    \let\lst@closestring\lst@lastother
    \lst@ifstringspaces
        \lst@keepspacestrue
        \let\lst@outputspace\lst@visiblespace
    \fi}
\gdef\lst@keepspacestrue{\let\lst@ifkeepspaces\iftrue}
\gdef\lst@EndString{%
    \lst@OutputOther \lst@LeaveMode
    \lst@token{}\lst@length\z@}
\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\relax \fi}
\gdef\lst@TestStringMode{%
     \ifnum\lst@mode=\lst@stringmode
         \PackageWarning{Listings}{String constant exceeds line}%
         \lst@LeaveMode \lst@token{}\lst@length\z@
     \fi}
\lst@AddToHook{EOL}{\lst@TestStringMode}
\lst@EndAspect
\lst@BeginAspect{comments}
\gdef\lst@CommentB#1#2#3#4#5#6#7#8#9{%
    \let#4#1%
    \ifx\@empty#2\@empty
        \def#1{%
            #6\let\lst@bnext\relax
            \lst@ifmode #7\else
                #8%
                \def\lst@bnext{\lst@BeginComment#5#9}%
            \fi
            \lst@bnext #4}%
    \else \ifx\@empty#3\@empty
        \def#1##1{%
            #6\let\lst@bnext\relax
            \ifx##1#2%
                \lst@ifmode #7\else
                    #8%
                    \def\lst@bnext{\lst@@BeginComment#5#9}%
                \fi
            \fi
            \lst@bnext#4##1}%
    \else
        \def#1{%
            #6\def\lst@bnext{\expandafter#4\lst@eaten}%
            \lst@IfNextCharsArg{#2#3}%
            {\lst@ifmode #7\else
                 #8%
                 \def\lst@bnext{\lst@@BeginComment#5#9#4\lst@eaten}%
             \fi
             \lst@bnext}\lst@bnext}%
    \fi \fi}
\gdef\lst@CommentE#1#2#3#4#5#6#7#8{%
    \let#4#1%
    \ifx\@empty#2\@empty
        \def#1{%
            #6\let\lst@enext#4%
            \ifnum\lst@mode=#5%
                #7%
                \def\lst@enext{#4\lst@EndComment}%
            \else
                #8%
            \fi
            \lst@enext}%
    \else \ifx\@empty#3\@empty
        \def#1##1{%
            #6\def\lst@enext{#4##1}%
            \ifx##1#2%
                \ifnum\lst@mode=#5%
                    #7%
                    \def\lst@enext{#4##1\lst@EndComment}%
                \else
                    #8%
                \fi
            \fi
            \lst@enext}%
    \else
        \def#1{%
            #6\def\lst@enext{\expandafter#4\lst@eaten}%
            \lst@IfNextCharsArg{#2#3}%
            {\ifnum\lst@mode=#5%
                 #7%
                 \def\lst@enext{#4\lst@eaten\lst@EndComment}%
             \else
                 #8%
             \fi
             \lst@enext}\lst@enext}%
    \fi \fi}
\gdef\lst@BeginComment#1#2#3{%
    \lst@NewLine \lst@PrintToken
    \lst@EnterMode{#1}{\lst@modetrue\lst@commentstyle#2}%
    \lst@mode\lst@nomode #3\lst@mode#1\relax
    \lsthk@AfterBeginComment}
\gdef\lst@@BeginComment#1#2#3#4{%
    \lst@NewLine \lst@PrintToken
    \lst@EnterMode{#1}{\lst@modetrue\lst@commentstyle#2}%
    \lst@mode\lst@nomode #3#4\lst@mode#1\relax
    \lsthk@AfterBeginComment}
\gdef\lst@EndComment{%
    \lst@PrintToken \lst@LeaveMode
    \let\lst@lastother\@empty}
\lst@AddToHook{AfterBeginComment}{}
\@ifundefined{@gobblethree}{\gdef\@gobblethree#1#2#3{}}{}
\lst@Key{commentstyle}{}{\def\lst@commentstyle{#1}}
\lst@AddToHook{EmptyStyle}{\let\lst@commenstyle\itshape}
\lst@AddToHook{SetLanguage}
    {\let\lst@DefSC\@empty \let\lst@DefNC\@empty \let\lst@DefDC\@empty
     \let\lst@DefCL\@empty \let\lst@DefFCL\@empty}
\lst@AddToHook{SelectCharTable}
    {\lst@DefSC \lst@DefNC \lst@DefDC \lst@DefCL \lst@DefFCL}
\lst@AddToHook{Init}
    {\let\lst@CCnext\relax \let\lst@bnext\relax\let\lst@enext\relax}
\lst@Key{commentline}{}
  {\ifx\@empty#1\@empty
       \let\lst@DefCL\@empty
   \else
       \def\lst@DefCL{\lst@CArg{CL}#1\relax
           \lst@CommentB\lst@CLmode{}{}{}\@empty}%
   \fi}
\lst@NewMode\lst@CLmode
\lst@AddToHook{EOL}{\ifnum\lst@mode=\lst@CLmode \lst@LeaveMode \fi}
\lst@Key{fixedcommentline}{}{\lstKV@OptArg[0]{#1}%
  {\ifx\@empty##1\@empty
       \let\lst@DefFCL\@empty
   \else
       \def\lst@DefFCL{\lst@FixedCL[##1]##2\@empty}%
   \fi}}
\gdef\lst@FixedCL[#1]#2{%
    \ifx\@empty#2\@empty\else
        \lst@CArg{FCL}#2\relax\lst@CommentB\lst@CLmode{}{}%
            {\lst@CalcLineLength
             \ifnum\@tempcnta=#1\else
                \expandafter\@gobblethree
             \fi}
            \@empty
        \def\lst@next{\lst@FixedCL[#1]}%
        \expandafter\lst@next
    \fi}
\lst@Key{singlecomment}{}{\lstKV@TwoArg{#1}%
  {\ifx\@empty##2\@empty
       \let\lst@DefSC\@empty
   \else
       \def\lst@DefSC{%
           \lst@CArg{BC}##1\relax\lst@CommentB\lst@SCmode{}{}{}\@empty
           \lst@CArg{EC}##2\relax\lst@CommentE\lst@SCmode{}{}{}}%
   \fi}}
\lst@Key{doublecomment}{}{\lstKV@FourArg{#1}%
  {\ifx\@empty##4\@empty
       \let\lst@DefDC\@empty
   \else
       \def\lst@DefDC{%
           \lst@CArg{BCA}##1\relax\lst@CommentB\lst@DCAmode{}{}{}\@empty
           \lst@CArg{BCB}##3\relax\lst@CommentB\lst@DCBmode{}{}{}\@empty
           \lst@CArg{ECA}##2\relax\lst@CommentE\lst@DCAmode{}{}{}%
           \lst@CArg{ECB}##4\relax\lst@CommentE\lst@DCBmode{}{}{}}%
   \fi}}
\lst@NewMode\lst@SCmode \lst@NewMode\lst@DCAmode\lst@NewMode\lst@DCBmode
\lst@NewMode\lst@NCmode
\lst@Key{nestedcomment}{}{\lstKV@TwoArg{#1}%
  {\let\lst@DefNC\@empty
   \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
         \def\lst@DefNC{%
             \lst@CArg{BNC}##1\relax\lst@CommentB\lst@NCmode
                 {}%
                 {\ifnum\lst@mode=\lst@NCmode \expandafter\@gobble \fi}%
                 {}\@empty
             \lst@CArg{ENC}##2\relax\lst@CommentE\lst@NCmode{}{}{}}%
      \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@CArg{POD}=\relax\lst@CommentB\lst@PODmode
           {}{}%
           {\ifnum\@tempcnta=\z@
                \lst@ifprintpod\else
                    \def\lst@bnext{\lst@BeginDropOutput\lst@PODmode}%
                    \expandafter\expandafter\expandafter\@gobblethree
                \fi
            \else
               \expandafter\@gobblethree
            \fi}%
           \@empty
         \lst@CArg{POD}=cut\^^M\relax\lst@CommentE\lst@PODmode
           {\lst@CalcLineLength}%
           {\ifnum\@tempcnta=\z@\else
                \expandafter\@gobblethree
            \fi}%
           {}%
 \fi}
\lst@EndAspect
\lst@BeginAspect{escape}
\lst@Key{texcl}{false}[t]{\lstKV@SetIf{#1}\lst@iftexcl}
\lst@AddToHook{InlineUnsave}{\let\lst@iftexcl\iffalse}
\lst@AddToHook{EOL}
    {\ifnum\lst@mode=\lst@TeXCLmode
         \expandafter\lst@escapeend
         \expandafter\lst@LeaveAllModes
         \expandafter\lst@ReenterModes
     \fi}
\lst@AddToHook{AfterBeginComment}
    {\lst@iftexcl \ifnum\lst@mode=\lst@CLmode
         \lst@PrintToken
         \lst@LeaveMode \lst@InterruptModes
         \lst@EnterMode{\lst@TeXCLmode}{\lst@modetrue\lst@commentstyle}%
         \expandafter\expandafter\expandafter\lst@escapebegin
     \fi \fi}
\lst@NewMode\lst@TeXCLmode
\gdef\lst@Escape#1#2{%
    \lccode`\~=`#1\lccode`\^^@=`#2\lowercase{\lst@Escape@~^^@}}
\gdef\lst@Escape@#1#2#3#4{%
    \def#1{%
        \lst@NewLine\lst@UseLostSpace \lst@PrintToken
        \lst@InterruptModes
        \lst@EnterMode{\lst@TeXmode}{\lst@modetrue}%
        \catcode`#2=\active
        \def#2{\lst@escapeend #4\lst@LeaveAllModes \lst@ReenterModes}%
        #3\lst@escapebegin}}
\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{InlineUnsave}{\let\lst@DefEsc\relax}
\lst@AddToHook{SelectCharTable}{\lst@DefEsc}
\lst@Key{escapeinside}{}{\lstKV@TwoArg{#1}%
    {\let\lst@DefEsc\relax
     \ifx\@empty##1@empty\else \ifx\@empty##2\@empty\else
         \def\lst@DefEsc{\lst@Escape{##1}{##2}{}{}}%
     \fi\fi}}
\lst@AddToHook{InlineUnsave}{\let\lst@DefEsc\relax}
\lst@AddToHook{SelectCharTable}{\lst@DefEsc}
\lst@Key{mathescape}{false}[t]{\lstKV@SetIf{#1}\lst@ifmathescape}
\lst@AddToHook{InlineUnsave}{\let\lst@ifmathescape\iffalse}
\lst@AddToHook{SelectCharTable}
    {\lst@ifmathescape \lst@Escape{\$}{\$}{$}{$}\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@Output\lst@EmptyOutput
    \let\lst@OutputOther\lst@EmptyOutputOther
    \let\lst@PreGotoTabStop\lst@EmptyGotoTabStop
    \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{style}
\lst@UserCommand\lstdefinestyle#1{\lst@NormedDef\lst@temp{#1}%
    \begingroup \lstset@catcodes \lstdefinestyle@}
\gdef\lstdefinestyle@#1{\endgroup
    \global\@namedef{lststy@\lst@temp}{\lstset{#1}}}
\lst@Key{style}\relax
    {\lst@NormedDef\lst@temp{#1}%
     \@ifundefined{lststy@\lst@temp}%
        {\PackageError{Listings}{Style `#1' undefined}%
         {You might have misspelt the name here or before.^^J%
          Type <RETURN> to proceed without changing the style.}}%
        {\lsthk@SetStyle \csname lststy@\lst@temp\endcsname}}
\lst@AddToHook{SetStyle}{}% init
\gdef\lststy@{\lsthk@EmptyStyle}
\lst@AddToHook{EmptyStyle}{}% init
\lst@EndAspect
\lst@BeginAspect{language}
\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@dialect@{#1}%
    \lst@NormedDef\lst@language@{#2}%
    \@ifundefined{lsta@\lst@language@}{}%
        {\edef\lst@language@{\csname lsta@\lst@language@\endcsname}}%
    \ifx\@empty\lst@dialect@ \@ifundefined{lstdd@\lst@language@}{}%
        {\edef\lst@dialect@{\csname lstdd@\lst@language@\endcsname}}%
    \fi
    \edef\lst@temp{\lst@language@ $\lst@dialect@}%
    \@ifundefined{lsta@\lst@temp}{}%
        {\edef\lst@temp{\csname lsta@\lst@temp\endcsname}}%
    \expandafter\lst@FindAlias@\lst@temp $}
\gdef\lst@FindAlias@#1$#2${%
    \def\lst@language@{#1}\def\lst@dialect@{#2}%
    \ifx\@empty\lst@dialect@ \@ifundefined{lstdd@\lst@language@}{}%
        {\edef\lst@dialect@{\csname lstdd@\lst@language@\endcsname}}%
    \fi}
\@ifundefined{lstdriverfiles}
    {\lst@UserCommand\lstdriverfiles{lstlang0.sty}}{}
\gdef\lst@RequireLanguages#1{%
    \lst@for #1\do{\lstKV@OptArg[]{##1}{%
        \lst@FindAlias[####1]{####2}%
        \@ifundefined{lstlang@\lst@language@ $\lst@dialect@}%
            {\xdef\lst@loadlanguages{\lst@loadlanguages,%
             \lst@language@ $\lst@dialect@}}{}}}%
    \begingroup
        \lst@InputCatcodes
        \lst@for\lstdriverfiles\do{%
            \ifx\lst@loadlanguages\@empty\else
                \InputIfFileExists{##1}{}{}%
                \lst@DeleteKeysIn\lst@loadlanguages\lst@loadedlanguages
            \fi}%
        \global\let\lst@loadlanguages\lst@loadlanguages
    \endgroup
    \ifx\lst@loadlanguages\@empty\else
        \PackageWarning{Listings}{Couldn't load all languages}%
    \fi
    \ifx\lst@loadaspects\@empty\else
        \lst@RequireAspects\lst@loadaspects
    \fi}
\ifx\@onlypreamble\@notprerr
    \global\let\lstloadlanguages\@notprerr
\else
    \global\let\lstloadlanguages\lst@RequireLanguages
    \@onlypreamble\lstloadlanguages
\fi
\lst@UserCommand\lstdefinelanguage{\lst@DefLang\iftrue}
\lst@UserCommand\lst@definelanguage{\lst@DefLang\iffalse}
\global\let\lst@loadedlanguages\@empty % init % \global
\global\let\lst@loadlanguages\@empty % init % \global
\gdef\lst@DefLang#1{%
    \let\lst@ifdeflang#1%
    \@ifnextchar[\lst@DefLang@{\lst@DefLang@[]}}
\gdef\lst@DefLang@[#1]#2{%
    \lst@NormedDef\lstlang@{#2$#1}%
    \begingroup
    \lst@ifdeflang\else
        \expandafter\lst@IfOneOf\lstlang@\relax\lst@loadlanguages
        {\lst@deflangtrue}{}%
    \fi
    \lstset@catcodes
    \@ifnextchar[\lst@XDefLang\lst@DefLang@@}
\gdef\lst@DefLang@@#1{%
    \lst@ifdeflang
        \global\@namedef{lstlang@\lstlang@}{\lstset{#1}}%
        \xdef\lst@loadedlanguages{\lst@loadedlanguages,\lstlang@}%
    \fi
    \endgroup
    \@ifnextchar[\lst@XXDefLang\@empty}
\gdef\lst@XXDefLang[#1]{%
    \ifx\@empty#1\@empty\else
        \lst@ifdeflang
            \lstloadaspects{#1}%
        \else
            \@ifundefined{lstlang@\lstlang@}{}%
            {\xdef\lst@loadaspects{\lst@loadaspects,#1}}%
        \fi
    \fi}
\gdef\lst@XDefLang[#1]#2#3{%
    \lst@ifdeflang
        \lst@NormedDef\lst@temp{#2$#1}%
        \xdef\lst@loadlanguages{\lst@loadlanguages,\lst@temp}%
    \fi
    \lst@DefLang@@{language=[#1]#2,#3}}
\gdef\lst@deflangtrue{\let\lst@ifdeflang\iftrue}
\lstdefinelanguage{}{}
\lst@Key{language}\relax{\lstKV@OptArg[]{#1}%
    {\lst@RequireLanguages{[##1]{##2}}%
     \@ifundefined{lstlang@\lst@language@ $\lst@dialect@}%
        {\PackageError{Listings}%
         {\ifx\@empty\lst@dialect@\else \lst@dialect@\space of \fi
          \lst@language@\space undefined}%
         {The language is not loadable or just mispellt.^^J%
          Type <RETURN> to proceed without changing the language.}}%
        {\lsthk@SetLanguage
         \csname lstlang@\lst@language@ $\lst@dialect@\endcsname
         \lst@FindAlias[##1]{##2}%
         \let\lst@language\lst@language@
         \let\lst@dialect\lst@dialect@}}}
\lst@AddToHook{SetLanguage}{}% init
\lst@EndAspect
\lst@BeginAspect{keywords}
\gdef\lst@InstallKeywords#1#2{%
    \def\lst@arg{{#1}{#2}}%
    \lst@lExtend\lst@arg{%
        \csname lst@#2\expandafter\endcsname
        \csname lst@#2@also\expandafter\endcsname
        \csname lst@g#2tyle\expandafter\endcsname
        \csname lst@g#2\endcsname}%
    \expandafter\lst@InstallKeywords@\lst@arg}
\gdef\lst@InstallKeywords@#1#2#3#4#5#6#7{%
    \lst@Key{#2}\relax{\lst@MakeKeywords#3#4{##1}}%
    \def\@tempa{%
        \lst@Key{more#2}\relax{\lst@MakeMoreKeywords#3#4{####1}}%
        \lst@Key{delete#2}\relax{\lst@DeleteKeywords#3#4{####1}}%
        \lst@Key{#2tyle}\relax{\def#7{####1}}%
        \lst@AddToHook{SetLanguage}{\let#3\@empty}}%
    \def\lst@arg{#1}\def\lst@temp{k}%
    \ifx\lst@arg\lst@temp \@tempa \fi
    \global\let#3\@empty \global\let#4\@empty % init
    \gdef#5{#7}\global\let#6\@empty % init
    \lst@AddToHook{Init}{\expandafter\lst@UseBasicClasses#4{}{}{}}%
    \lst@InstallKeywordTest{#1}#3#6#5}{}
\gdef\lst@InstallKeywordTest#1#2#3#4#5{%
    \lst@AddToHook{Init}{\lst@UpdateKeywords{#1}#2#3#4}%
    \@ifundefined{lst@if#1installed}%
    {\global\@namedef{lst@if#1installed}{}%
     \edef\lst@arg{#1}\def\lst@temp{k}%
     \edef\@tempa{%
         \noexpand\lst@AddToHook{#5DetectKeywords\else Output\fi}%
             \ifx\lst@arg\lst@temp
                  \noexpand\lst@KeywordTest
             \else
                 {\noexpand\lst@WorkingTest{#1}}%
             \fi}
     \@tempa}{}}
\lst@AddToHook{Output}{\lst@ifkeywords \lsthk@DetectKeywords \fi}
\lst@AddToHook{ModeTrue}{\let\lst@ifkeywords\iffalse}
\lst@AddToHook{Init}{\let\lst@ifkeywords\iftrue}
\gdef\lst@KeywordTestSensitive{%
    \begingroup \let\lst@UM\@empty
    \global\expandafter\let\expandafter\@gtempa
        \csname lstk@\the\lst@token\endcsname
    \endgroup
    \ifx\@gtempa\relax\else
        \let\lst@thestyle\@gtempa
    \fi}
\gdef\lst@KeywordTestInsensitive{%
    \uppercase\expandafter{\expandafter
        \lst@KeywordTestI@\the\lst@token}\relax}
\gdef\lst@KeywordTestI@#1\relax{%
    \begingroup \let\lst@UM\@empty
    \global\expandafter\let\expandafter\@gtempa
        \csname lstk@#1\endcsname
    \endgroup
    \ifx\@gtempa\relax\else
        \let\lst@thestyle\@gtempa
    \fi}
\lst@AddToHook{Init}
    {\lst@ifsensitive\else
         \let\lst@KeywordTest\lst@KeywordTestInsensitive
     \fi}
\global\let\lst@KeywordTest\lst@KeywordTestSensitive % init
\gdef\lst@WorkingTestSensitive#1{%
    \begingroup \let\lst@UM\@empty
    \global\expandafter\let\expandafter\@gtempa
        \csname lst#1@\the\lst@token\endcsname
    \endgroup
    \@gtempa}
\gdef\lst@WorkingTestInsensitive{%
    \uppercase\expandafter{\expandafter
        \lst@WorkingTestI@\the\lst@token}\relax}
\gdef\lst@WorkingTestI@#1\relax#2{%
    \begingroup \let\lst@UM\@empty
    \global\expandafter\let\expandafter\@gtempa
        \csname lst#2@#1\endcsname
    \endgroup
    \@gtempa}
\lst@AddToHook{Init}
    {\lst@ifsensitive\else
         \let\lst@WorkingTest\lst@WorkingTestInsensitive
     \fi}
\global\let\lst@WorkingTest\lst@WorkingTestSensitive % init
\lst@Key{sensitive}\relax[t]{\lstKV@SetIf{#1}\lst@ifsensitive}
\lst@AddToHookExe{SetLanguage}{\let\lst@ifsensitive\iftrue}
\gdef\lst@UpdateKeywords#1#2#3#4{%
    \ifx\lst@ifsensitive\lst@ifsensitivedefed
        \ifx#2#3\else
            \lst@UndefineKeywords{#1}#3#4%
            \lst@DefineKeywords{#1}#2#4%
            \global\let#3#2%
        \fi
    \else
        \lst@UndefineKeywords{#1}#3#4%
        \lst@DefineKeywords{#1}#2#4%
        \global\let#3#2%
    \fi}
\lst@AddToHook{InitVars}
    {\global\let\lst@ifsensitivedefed\lst@ifsensitive}
\global\let\lst@ifsensitivedefed\iffalse % init % \global
\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#2%
        \global\expandafter\let\csname lst#1@##1\endcsname\relax
     \fi}}
\gdef\lst@DeleteKeywords#1#2#3{%
    \lst@MakeKeywords\lst@arg#2{#3}%
    \lst@DeleteKeysIn#1\lst@arg
    \lst@SpecialKeywordScan#1#2{}{}}
\gdef\lst@MakeKeywords#1#2{%
    \let#1\@empty \let#2\@empty
    \lst@MakeMoreKeywords#1#2}
\gdef\lst@MakeMoreKeywords#1#2#3{%
    \lst@MakeMoreKeywords@#1#3,\relax,%
    \expandafter\lst@DefOther\expandafter#1\expandafter{#1}%
    \expandafter\lst@SpecialKeywordScan\expandafter
        #1\expandafter#2#2{}{}}
\gdef\lst@MakeMoreKeywords@#1#2,{%
    \ifx\relax#2\@empty
        \expandafter\@gobbletwo
    \else
        \lst@IfOneOf#2\relax\lst@storedkeywords
        {\lst@lExtend#1{\expandafter,#2}}%
        {\lst@lAddTo#1{,#2}}%
    \fi
    \lst@MakeMoreKeywords@#1}
\lst@DefOther\lst@others{!"\#\%&'()*+-./0123456789:;<=>?[\]^`\{|\}~}
\global\let\lst@others\lst@others % init
\gdef\lst@SpecialKeywordScan#1#2#3#4{%
    \def\lst@ialsoletter{#3}\def\lst@ialsodigit{#4}%
    \expandafter\lst@SKS@\expandafter#1\lst@others\relax
    \edef#2{{\lst@ialsoletter}{\lst@ialsodigit}}}
\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@UserCommand\lststorekeywords#1#2
    {\gdef#1{#2}%
     \lst@AddTo\lst@storedkeywords{,#1}}
\global\let\lst@storedkeywords\@empty % init % \global
\lst@InstallKeywords k{keywords}\lst@keywordstyle\iftrue
\lst@InstallKeywords k{ndkeywords}\lst@ndkeywordstyle\iftrue
\lst@AddToHook{EmptyStyle}{\let\lst@keywordstyle\bfseries}
\global\let\lst@keywordstyle\@empty % init
\lst@AddToHook{Init}
    {\ifx\lst@ndkeywordstyle\@undefined
         \let\lst@ndkeywordstyle\lst@keywordstyle
     \fi}
\lst@Key{otherkeywords}{}{\def\lst@otherkeywords{#1}}
\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{ok}#1\relax\lst@DefineOtherKeywords@
        \fi
        \expandafter\lst@DefineOtherKeywords
    \fi}
\gdef\lst@DefineOtherKeywords@#1#2#3#4{%
    \let#4#1%
    \ifx\@empty#2\@empty
        \def#1{\lst@PrintOtherKeyword#4}%
    \else \ifx\@empty#3\@empty
        \def#1##1{%
            \ifx##1#2%
                \def\lst@next{\lst@PrintOtherKeyword{#4##1}}%
            \else
                \def\lst@next{#4##1}%
            \fi
            \lst@next}%
    \else
        \def#1{\lst@IfNextCharsArg{#2#3}%
               {\lst@PrintOtherKeyword{#4\lst@eaten}}%
               {\expandafter#4\lst@eaten}}%
    \fi \fi}
\gdef\lst@PrintOtherKeyword#1{%
    \lst@PrintToken
    \begingroup
        \lst@modetrue \lsthk@InlineUnsave
        \let\lst@ProcessDigit\lst@ProcessLetter
        \let\lst@ProcessOther\lst@ProcessLetter
        \lst@lettertrue
        \lst@gkeywordstyle{#1\lst@PrintToken}%
    \endgroup}
\lst@EndAspect
\lst@BeginAspect[keywords]{rdkeywords}
\lst@InstallKeywords k{rdkeywords}\lst@rdkeywordstyle\iftrue
\lst@AddToHook{Init}
    {\ifx\lst@rdkeywordstyle\@undefined
         \let\lst@rdkeywordstyle\lst@keywordstyle
     \fi}
\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@EnterMode\lst@insidemode{}%
                  \fi\fi
                  \lsts@insideb}%
             \lst@DefSaveDef{`##2}\lsts@insidee
                  {\ifnum\lst@mode=\lst@insidemode
                       \lsts@insidee \lst@PrintToken\lst@LeaveMode
                   \else
                       \expandafter\lsts@insidee
                   \fi}}%
     \fi\fi}}
\lst@AddToHook{SelectCharTable}{\lst@DefInside}
\lst@AddToHook{Output}
    {\ifx\lst@DefInside\@empty\else \ifx\lst@thestyle\lst@gkeywordstyle
         \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@gkeywordstyle
     \fi\fi}
\lst@EndAspect
\lst@BeginAspect[keywords]{tex}
\lst@InstallKeywords{cs}{texcs}
    {\ifx\lst@lastother\lstum@backslash
         \let\lst@thestyle\lst@texcsstyle
     \fi}
    \iftrue
\lst@Key{moretexcs}\relax
    {\lst@MakeMoreKeywords\lst@texcs\lst@texcs@also{#1}}
\lst@Key{texcsstyle}\relax{\def\lst@texcsstyle{#1}}
\lst@AddToHook{Init}
    {\ifx\@undefined\lst@texcsstyle
         \let\lst@texcsstyle\lst@keywordstyle
     \fi}
\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}
    {\ifnum\lst@mode=\lst@CDmode
         \let\lst@thestyle\lst@cdstyle
     \fi}
    \iftrue
\lst@AddToHook{SetLanguage}{\let\lst@directives\@empty}
\lst@AddToHook{SelectCharTable}
    {\ifx\lst@directives\@empty\else
         \lst@DefSaveDef{`\#}\lsts@CCD
         {\lst@CalcLineLength
          \lst@ifmode\else
              \ifnum\@tempcnta=\z@
                  \lst@EnterMode{\lst@CDmode}{}%
              \fi
          \fi
          \ifnum\lst@mode=\lst@CDmode
              \ifnum\@tempcnta=\z@
                  \lst@PrintToken{\lst@cdstyle\lsts@CCD\lst@PrintToken}%
              \else \lsts@CCD
              \fi
          \else \lsts@CCD
          \fi}%
     \fi}
\lst@Key{directivestyle}\relax{\def\lst@cdstyle{#1}}
\lst@AddToHook{Init}
    {\ifx\@undefined\lst@cdstyle
         \let\lst@cdstyle\lst@keywordstyle
     \fi}
\lst@EndAspect
\lst@BeginAspect[keywords]{index}
\lst@InstallKeywords w{index}
    {\expandafter\lst@indexmacro\expandafter{\the\lst@token}}\iftrue
\lst@InstallKeywords w{ndindex}
    {\expandafter\lst@ndindexmacro\expandafter{\the\lst@token}}\iftrue
\lst@UserCommand\lstindexmacro#1{\index{{\ttfamily#1}}}
\lst@Key{indexmacro}\lstindexmacro{\let\lst@indexmacro#1}
\lst@Key{ndindexmacro}\lstindexmacro{\let\lst@ndindexmacro#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 \lst@gindextyle \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 \ifx\lst@indexmacro\@undefined
         \let\lst@indexmacro\@gobble
     \fi \fi}
\lst@InstallKeywords w{procnamekeys}
    {\global\let\lst@PNpost\lst@procnametrue}\iftrue
\lst@AddToHook{PostOutput}{\lst@PNpost\global\let\lst@PNpost\@empty}
\global\let\lst@PNpost\@empty % init
\lst@EndAspect
\lst@BeginAspect[keywords,comments]{keywordcomments}
\lst@NewMode\lst@KCmode \lst@NewMode\lst@KCSmode
\gdef\lst@BeginKC{\lst@BeginComment\lst@KCmode\lst@modetrue\@empty}
\gdef\lst@BeginKCS{\lst@BeginComment\lst@KCSmode\lst@modetrue\@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}
\lst@InstallKeywords{kc}{keywordcomment}
    {\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}\iffalse
\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@ifletter \lst@Output\lst@letterfalse \fi
             \ifnum\lst@mode=\lst@KCmode \lst@EndComment \else
             \ifnum\lst@mode=\lst@KCSmode \lst@EndComment
             \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@InstallKeywordTest{kcb}
    \lst@KCAkeywordsB\lst@gKCAkeywordsB\lst@KCAWorkB\iffalse
\lst@InstallKeywordTest{kce}
    \lst@KCAkeywordsE\lst@gKCAkeywordsE\lst@KCAWorkE\iffalse
\lst@InstallKeywordTest{kc}
    \lst@KCBkeywordsB\lst@gKCBkeywordsB\lst@KCBWorkB\iffalse
\global\let\lst@gKCAkeywordsB\@empty\global\let\lst@gKCAkeywordsE\@empty
\global\let\lst@gKCBkeywordsB\@empty
\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@AddToHook{PreInit}
    {\ifx\lst@firstlabel\@undefined
         \let\lst@firstlabel\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}%
    \fi}
\gdef\lst@SaveFirstLabel{%
    \expandafter\xdef
        \csname lstno\ifx\lst@intname\@empty @ \else @\lst@intname\fi
        \endcsname{\the\c@lstlabel}}
\newcounter{lstlabel}% \global
\renewcommand*\thelstlabel{\@arabic\c@lstlabel}
\lst@AddToHook{EveryLine}
    {\global\advance\c@lstlabel\lst@labeladvance \lst@SkipOrPrintLabel}
\global\let\lst@labeladvance\@ne
\lst@AddToHook{Init}{\def\@currentlabel{\thelstlabel}}
\lst@AddToHook{InitVars}
    {\global\c@lstlabel\lst@firstlabel
     \global\advance\c@lstlabel\lst@advancelabel
     \global\advance\c@lstlabel-\lst@labeladvance}
\lst@AddToHook{ExitVars}
    {\global\advance\c@lstlabel\lst@labeladvance}
\newcount\lst@skiplabels % \global
\lst@AddToHook{Init}
    {\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
         \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}%
    \fi
    \global\advance\lst@skiplabels\@ne}
\lst@EndAspect
\lst@BeginAspect{lineshape}
\newdimen\lst@innerspread \newdimen\lst@outerspread
\lst@AddToHook{BoxUnsave}{\lst@outerspread\z@ \lst@innerspread\z@}
\lst@Key{wholeline}{false}[t]{\lstKV@SetIf{#1}\lst@ifwholeline}
\lst@Key{indent}{\z@}{\def\lst@indent{#1}}
\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}
\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
         \advance\linewidth\@totalleftmargin
     \else
         \advance\lst@innerspread-\@totalleftmargin
         \advance\lst@outerspread-\@totalleftmargin
     \fi
     \if@twoside\else \lst@outerspread\lst@innerspread \fi}
\lst@Key{lineskip}{\z@}{\def\lst@lineskip{#1\relax}}
\lst@AddToHook{Init}{\parskip\lst@lineskip}
\lst@EndAspect
\lst@BeginAspect[lineshape]{breaklines}
\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
         \let\lst@NewLineMacro\lst@breakNewLineMacro
         \def\lst@parshape{\parshape\tw@
             \ifodd\c@page -\lst@innerspread\else -\lst@outerspread\fi
             \linewidth %
             \lst@breakshape}%
     \else
         \let\lst@discretionary\relax
     \fi}
\gdef\lst@discretionary{%
    \discretionary{\let\space\lst@spacekern\lst@prebreak}%
                  {\let\space\lst@spacekern\lst@postbreak}{}}
\lst@AddToHook{PostOutput}{\lst@discretionary}
\gdef\lst@spacekern{\kern\lst@width}
\gdef\lst@breakNewLineMacro{%
    \@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
    \xdef\lst@breakshape{%
        \noexpand\ifodd\c@page \the\@tempdima
        \noexpand\else \the\@tempdimb \noexpand\fi
        \the\@tempdimc}%
    \global\let\lst@NewLine\relax \par\noindent\hbox{}}
\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}%
    {\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
    {\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@frameR{%
    \strut\smash{\expandafter\lst@frameR@\lst@framershape\relax}}
\gdef\lst@frameR@#1{%
    \ifx\relax#1\@empty\else
        \if #1Y\lst@framevrule \else \kern\lst@framerulewidth \fi
        \kern\lst@framerulesep
        \expandafter\lst@frameR@
    \fi}
\gdef\lst@frameL{%
    \strut\smash{\expandafter\lst@frameL@\lst@framelshape\relax}}
\gdef\lst@frameL@#1{%
    \ifx\relax#1\@empty\else
        \kern\lst@framerulesep
        \if#1Y\lst@framevrule \else \kern\lst@framerulewidth \fi
        \expandafter\lst@frameL@
    \fi}
\gdef\lst@frameH#1#2{%
    \setbox\z@\hbox{}\@tempcntb\z@
    \expandafter\lst@frameH@\expandafter#1#2\relax\relax\relax}
\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@frameh#1#2#3#4#5{%
    \lst@frameCalcDimA#1%
    \lst@ifframeround \@getcirc\@tempdima \fi
    \setbox\z@=\hbox{\rlap{\copy\z@}%
      \setbox\z@=\hbox{%
        \kern-\lst@indent
        \kern\ifodd\c@page -\lst@innerspread\else -\lst@outerspread\fi
        \kern-\lst@framehalfspread
        \lst@frameCornerX\llap{#2L}#3%
        \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@
        \endgroup
        \lst@frameCornerX\rlap{#2R}#5%
        \kern-\lst@framehalfspread}%
    \if#2T\raise\dp\z@\copy\z@
     \else\lower\ht\z@\copy\z@ \fi}}
\gdef\lst@frameCornerX#1#2#3{%
    \if #3R%
        #1{\csname lst@frameR#2\endcsname}%
    \else
        \if #3Y\expandafter#1\else \expandafter\vphantom \fi
        {\csname lst@frame#2\endcsname}
    \fi}
\gdef\lst@frameCalcDimA#1{%
            \@tempdima\lst@framerulesep
    \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}
\gdef\lst@frameInit{%
    \ifx\lst@framelshape\@empty \let\lst@frameL\relax \fi
    \ifx\lst@framershape\@empty \let\lst@frameR\relax \fi
    \def\lst@framelr{%
        \llap{\lst@frameL \kern\lst@frametextsep
              \kern\lst@framehalfspread \kern\lst@indent}%
        \rlap{\kern\linewidth
              \kern\lst@framehalfspread \kern\lst@frametextsep
              \lst@frameR}}
    \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}%
    \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}%
    \fi
    \expandafter\lst@frameH T\lst@frametshape
    \ifvoid\z@\else
        \par\parshape\z@\nointerlineskip\noindent\box\z@
    \fi
    \lst@frameSpreadV}
\lst@AddToHook{EveryLine}{\lst@framelr}
\global\let\lst@framelr\@empty
\lst@AddToHook{DeInit}{\ifx\lst@frame\@empty\else \lst@frameExit \fi}
\gdef\lst@frameExit{%
    \lst@frameSpreadV
    \lst@frameH B\lst@framebshape
    \ifvoid\z@\else
        \everypar{}\par\nointerlineskip\noindent\box\z@
    \fi}
\gdef\lst@frameSpreadV{%
    \ifdim\z@=\lst@framespread\else
        \everypar{}\par\parshape\z@\nointerlineskip\noindent
        \setbox\z@=\hbox{%
            \def\lst@framevrule{\vrule\@height\lst@framehalfspread
                \@depth\z@\@width\lst@framerulewidth}%
            \let\strut\@empty
            \lst@framelr
            \vrule\@height\lst@framehalfspread\@depth\z@\@width\z@}%
        \llap{\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@frameRTR{%
    \kern-\lst@framerulewidth
                           \kern.5\@tempdima \@circlefnt\char\@tempcnta}
\gdef\lst@frameRBR{%
    \kern-\lst@framerulewidth
    \advance\@tempcnta\@ne \kern.5\@tempdima \@circlefnt\char\@tempcnta}
\gdef\lst@frameRBL{%
    \advance\@tempcnta\tw@ \@circlefnt\char\@tempcnta
    \kern-.5\@tempdima}
\gdef\lst@frameRTL{%
    \advance\@tempcnta\thr@@\@circlefnt\char\@tempcnta
    \kern-.5\@tempdima}
\lst@EndAspect
\lst@BeginAspect[keywords]{make}
\lst@NewMode\lst@makemode
\def\lst@makekeyfalse{\let\lst@ifmakekey\iffalse}
\def\lst@makekeytrue{\let\lst@ifmakekey\iftrue}
\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@gkeywordstyle\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}
\def\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@gkeywordstyle
            \lst@makekeytrue
        \fi
    \fi
    \lst@makePrintAside\lst@thestyle}
\lst@EndAspect
\lst@BeginAspect[writefile]{doc}
\newbox\lst@samplebox
\lstnewenvironment{lstsample}[1]
    {\lst@TestEOLChar{#1}\global\let\lst@intname\@empty
     \gdef\lst@sample{#1}%
     \setbox\lst@samplebox=\hbox\bgroup
         \setkeys{lst}{language={},style={},tabsize=4,gobble=5,%
     basicstyle=\small\ttfamily,basewidth=0.51em}
         \lstsampleverbcmd
         \lst@BeginAlsoWriteFile{\jobname.tmp}}
    {\lst@EndWriteFile\egroup
     \ifdim \wd\lst@samplebox>.5\linewidth
         \smallbreak
         \lst@sampleInput
         \begin{center}
         \begin{minipage}{0.9\linewidth}%
             \hbox to\linewidth{\box\lst@samplebox\hss}%
         \end{minipage}%
         \end{center}%
     \else
         \begin{center}%
         \begin{minipage}{0.45\linewidth}\lst@sampleInput\end{minipage}%
         \qquad
         \begin{minipage}{0.45\linewidth}%
             \hbox to\linewidth{\box\lst@samplebox\hss}%
         \end{minipage}%
         \end{center}%
     \fi}
\global\let\lstsampleverbcmd\@empty
\gdef\lst@sampleInput{%
    \MakePercentComment\catcode`\^^M=9\relax
    \small\lst@sample
    \setkeys{lst}{SelectCharTable=\lst@ReplaceInput{\^\^I}%
                                  {\lst@ProcessTabulator}}%
    \input{\jobname.tmp}\MakePercentIgnore}
\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@InlineUnsave \lsthk@BoxUnsave
        \lsthk@PreSet
        \lst@activecharsfalse
        \let\smallbreak\relax \let\normalbaselines\relax
        \lst@Init\relax
        \everypar{}\global\let\lst@NewLine\relax
        \lst@mode\lst@nomode \let\lst@entermodes\@empty
        \lst@InterruptModes
        \let\@noligs\relax
    \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@%
    \let\lst@NewLine\lst@NewLineMacro
    \vtop{\lst@ReenterModes
          \lst@arg \lst@PrintToken\lst@EOLUpdate
          \lst@InterruptModes}}
\lst@EndAspect
\endinput
%%
%% End of file `lstmisc.sty'.
