%%
%% This is file `lstmisc.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% listings.dtx  (with options: `misc')
%% 
%% Please read the software license in listings.dtx or listings.dvi.
%%
%% (w)(c) 1996/1997/1998/1999/2000 Carsten Heinz and/or any other author
%% listed elsewhere in this file.
%%
%% This file is distributed under the terms of the LaTeX Project Public
%% License from CTAN archives in directory  macros/latex/base/lppl.txt.
%% Either version 1.0 or, at your option, any later version.
%%
%% The listings package is free software.
%%
%% However, if you distribute the package as part of a commercial
%% product or if you use the package to prepare a document and sell the
%% document (books, journals, and so on), I'd like to encourage you to
%% make a donation to the LaTeX3 fund. The size of this `license fee'
%% should depend on the value of the package for your product.
%%
%% If you use the package to typeset a non-commercial document, please
%% send me a copy of the document (.dvi, .ps, .pdf, hardcopy, etc.) to
%% support further development.
%%
%% Permission is granted to change this file. You are not allowed to
%% distribute any changed version of this file, neither under the same
%% name nor under a different one.
%%
%% Send comments and ideas on the package, error reports and additional
%% programming languages to <cheinz@gmx.de>.
%%
\ProvidesFile{lstmisc.sty}[2000/08/23 v0.21 (Carsten Heinz)]
\lst@AddToAtTop{\try@load@fontshape}{\def\space{ }}
\lst@BeginAspect{strings}
\gdef\lst@stringtypes{d,b,m,bd,db}
\global\let\lst@xstringtypes\@empty
\lst@Key{string}\relax{%
    \lstKV@XOptArg[d]{#1}\lst@SAC
         {String}s\lst@stringtypes\lst@xstringtypes
         \lst@DefStrings\lst@FVConvert \@empty}
\lst@Key{morestring}\relax{%
    \lstKV@XOptArg[d]{#1}\lst@SAC
         {String}s\lst@stringtypes\lst@xstringtypes
         \lst@DefStrings\lst@FVConvert \relax}
\lst@Key{deletestring}\relax{%
    \lstKV@XOptArg[d]{#1}\lst@SACDelete
         {String}s\lst@stringtypes\lst@xstringtypes
         \lst@DefStrings}
\lst@AddToHook{SetLanguage}{\let\lst@DefStrings\@empty}
\lst@AddToHook{SelectCharTable}{\lst@DefStrings}
\lst@Key{stringstyle}{}{\def\lst@stringstyle{#1}}
\lst@AddToHook{EmptyStyle}{\let\lst@stringstyle\@empty}
\lst@Key{stringspaces}{true}[t]{\lstKV@SetIf{#1}\lst@ifstringspaces}
\lst@NewMode\lst@stringmode
\gdef\lst@BeginString#1#2{%
    \lst@TrackNewLines
    \lst@ifexstrings #2\lst@PrintToken \fi
    \lst@EnterMode{#1}%
        {\lst@modetrue \let\lst@currstyle\lst@stringstyle}%
    \lst@ifexstrings\else #2\lst@PrintToken \fi
    \lst@ifstringspaces
        \lst@keepspacestrue
        \let\lst@outputspace\lst@visiblespace
    \fi}
\lst@AddToHookExe{ExcludeDelims}{\let\lst@ifexstrings\iffalse}
\gdef\lst@EndString#1{%
    \lst@ifexstrings
          \lst@PrintToken \lst@LeaveMode
        #1\lst@PrintToken
    \else
        #1\lst@PrintToken \lst@LeaveMode
    \fi}
\lst@Key{stringtest}\relax[t]{\lstKV@SetIf{#1}\lst@ifstringtest}
\lst@AddToHook{SetLanguage}{\let\lst@ifstringtest\iftrue}
\lst@AddToHook{Init}
    {\lst@ifstringtest\else \let\lst@TestStringMode\@empty \fi}
\gdef\lst@TestStringMode{%
     \ifnum\lst@mode=\lst@stringmode
         \PackageWarning{Listings}{String constant exceeds line}%
         \lst@EndString{}%
     \fi}
\lst@AddToHook{EOL}{\lst@TestStringMode}
\gdef\lst@ProcessString@d#1{%
    \lst@ifletter \lst@Output\lst@letterfalse \fi
    \let\lst@next\@empty
    \ifnum\lst@mode=\lst@stringmode
        \ifx #1\lst@closestring
            \let\lst@next\lst@EndString
        \fi
    \else
        \lst@ifmode\else
            \let\lst@closestring#1%
            \def\lst@next{\lst@BeginString\lst@stringmode}%
        \fi
    \fi
    \expandafter\lst@next\csname\@lst s@s#1\endcsname}
\gdef\lst@ProcessString@b#1{%
    \lst@ifletter \lst@Output\lst@letterfalse \fi
    \let\lst@next\@empty
    \ifnum\lst@mode=\lst@stringmode
        \ifx\lst@lastother\lstum@backslash\else
            \ifx #1\lst@closestring
                \let\lst@next\lst@EndString
            \fi
        \fi
    \else
        \lst@ifmode\else
            \let\lst@closestring#1%
            \def\lst@next{\lst@BeginString\lst@stringmode}%
        \fi
    \fi
    \expandafter\lst@next\csname lsts@s#1\endcsname}
\global\let\lst@ProcessString@bd\lst@ProcessString@b
\global\let\lst@ProcessString@db\lst@ProcessString@bd
\gdef\lst@ProcessString@m#1{%
    \let\lst@next\@empty
    \ifnum\lst@mode=\lst@stringmode
        \lst@ifletter \lst@Output\lst@letterfalse \fi
        \ifx #1\lst@closestring
            \let\lst@next\lst@EndString
        \fi
    \else
        \lst@ifletter
            \lst@Output\lst@letterfalse
        \else
            \ifx\lst@lastother)\else \lst@ifmode\else
                \let\lst@closestring#1%
                \def\lst@next{\lst@BeginString\lst@stringmode}%
            \fi \fi
        \fi
    \fi
    \expandafter\lst@next\csname lsts@s#1\endcsname}
\lst@EndAspect
\lst@BeginAspect{comments}
\gdef\lst@commenttypes{l,f,s,d,n}
\gdef\lst@xcommenttypes{l,f,s,d,n}
\lst@Key{comment}{}
    {\lstKV@XOptArg[]{#1}\lst@SAC
         {Comment}c\lst@commenttypes\lst@xcommenttypes
         \lst@DefComments\lst@FVConvert \@empty}
\lst@Key{morecomment}\relax
    {\lstKV@XOptArg[]{#1}\lst@SAC
         {Comment}c\lst@commenttypes\lst@xcommenttypes
         \lst@DefComments\lst@FVConvert \relax}
\lst@Key{deletecomment}\relax{%
    \lstKV@XOptArg[]{#1}\lst@SACDelete
         {Comment}c\lst@commenttypes\lst@xcommenttypes
         \lst@DefComments}
\lst@AddToHook{SelectCharTable}{\lst@DefComments}
\lst@AddToHook{SetLanguage}{\let\lst@DefComments\@empty}
\lst@Key{commentstyle}{}{\def\lst@commentstyle{#1}}
\lst@AddToHook{EmptyStyle}{\let\lst@commenstyle\itshape}
\gdef\lst@BeginComment#1#2#3\@empty{%
    \lst@TrackNewLines \lst@PrintToken
    \lst@EnterMode{#1}{\lst@modetrue \let\lst@currstyle#2}%
    \lst@mode\lst@nomode #3\lst@mode#1\relax
    \lsthk@AfterBeginComment}
\lst@AddToHook{AfterBeginComment}{}
\gdef\lst@EndComment#1\@empty{%
    #1%
    \lst@PrintToken \lst@LeaveMode
    \let\lst@lastother\@empty}
\gdef\lst@CommentB#1#2#3#4#5#6#7#8#9{%
    \lst@CDef#1#2{#3}#4%
        {#6}%
        {\let\lst@bnext\lst@CArgEmpty
         \lst@ifmode #7\else
             #8%
             \def\lst@bnext{\lst@BeginComment#5#9}%
         \fi
         \lst@bnext}%
        \@empty}
\gdef\lst@CommentE#1#2#3#4#5#6#7#8{%
    \lst@CDef#1#2{#3}#4%
        {#6}%
        {\let\lst@enext\lst@CArgEmpty
         \ifnum\lst@mode=#5%
             #7%
             \let\lst@enext\lst@EndComment
         \else
             #8%
         \fi
         \lst@enext}%
        \@empty}
\lst@AddToHook{Init}{\let\lst@bnext\relax \let\lst@enext\relax}
\lst@NewMode\lst@CLmode
\lst@AddToHook{EOL}{\ifnum\lst@mode=\lst@CLmode \lst@LeaveMode \fi}
\gdef\lst@Comment@l#1\@empty{%
    \lst@CArg #1\relax
        \lst@CommentB\lst@CLmode{}{}{}\lst@commentstyle}
\gdef\lst@Comment@f{\@ifnextchar[\lst@Comment@@f{\lst@Comment@@f[0]}}
\gdef\lst@Comment@@f[#1]#2{%
    \ifx\@empty#2\@empty\else
        \lst@CArg #2\relax\lst@CommentB\lst@CLmode{}{}%
            {\lst@CalcLineLength
             \ifnum\@tempcnta=#1\else
                \expandafter\@gobblethree
             \fi}%
            \lst@commentstyle
        \def\lst@next{\lst@Comment@@f[#1]}%
        \expandafter\lst@next
    \fi}
\gdef\lst@CommentDM@s#1#2#3\@empty{%
    \lst@CArg #2\relax\lst@CommentB{#1}{}{}{}\lst@commentstyle
    \lst@CArg #3\relax\lst@CommentE{#1}{}{}{}}
\gdef\lst@Comment@d#1\@empty{\lstKV@FourArg{#1}%
    {\ifx\@empty##4\@empty\else
         \lst@UseDynamicMode\lst@CommentDM@s{##1}{##2}\@empty
         \lst@UseDynamicMode\lst@CommentDM@s{##3}{##4}\@empty
     \fi}}
\gdef\lst@CommentDM@n#1#2\@empty{\lstKV@TwoArg{#2}%
    {\ifx\@empty##2\@empty\else
         \def\@tempa{##1}\def\@tempb{##2}%
         \ifx\@tempa\@tempb
             \PackageError{Listings}{Identical delimiters}%
             {These delimiters make no sense with nested comments.}%
         \else
             \lst@CArg ##1\relax\lst@CommentB{#1}%
                 {}%
                 {\ifnum\lst@mode=#1\relax \expandafter\@gobble \fi}%
                 {}\lst@commentstyle
             \lst@CArg ##2\relax\lst@CommentE{#1}{}{}{}%
         \fi
     \fi}}
\lst@EndAspect
\lst@BeginAspect{pod}
\lst@Key{printpod}{false}[t]{\lstKV@SetIf{#1}\lst@ifprintpod}
\lst@Key{podcomment}{false}[t]{\lstKV@SetIf{#1}\lst@ifpodcomment}
\lst@AddToHookExe{SetLanguage}{\let\lst@ifpodcomment\iffalse}
\lst@NewMode\lst@PODmode
\lst@NewMode\lst@PODmode
\lst@AddToHook{SelectCharTable}
    {\lst@ifpodcomment
         \lst@CArgX =\relax\lst@CommentB\lst@PODmode
           {}{}%
           {\ifnum\@tempcnta=\z@
                \lst@ifprintpod\else
                    \def\lst@bnext{\lst@BeginDropOutput\lst@PODmode}%
                    \expandafter\expandafter\expandafter\@gobblethree
                \fi
            \else
               \expandafter\@gobblethree
            \fi}%
           \lst@commentstyle
         \lst@CArgX =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{TextStyle}{\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@ActiveCDefX#1#2#3#4#5#6#7{%
    \let#4#1%
    \catcode`#1\active\lccode`\~=`#1%
    \ifx\@empty#2\@empty
        \lowercase{\def~}{#5\def\lst@next{#6#7}\lst@next}%
    \else \ifx\@empty#3\@empty
        \lowercase{\def~}##1{%
            #5%
            \ifx##1#2\def\lst@next{#6#7}\else
                     \def\lst@next{#4##1}\fi
            \lst@next}%
    \else
        \lowercase{\def~}{%
            #5%
            \lst@IfNextCharsArg{#2#3}{#6#7}%
                                     {\expandafter#4\lst@eaten}}%
    \fi \fi}
\gdef\lst@Escape#1#2#3#4{%
    \lst@CArgX #1\relax\lst@CDefX
        {}%
        {\lst@TrackNewLines\lst@UseLostSpace \lst@PrintToken
         \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}%
                 {}%
         \fi
         #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{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{writefile}
\newwrite\lst@WF \newtoks\lst@WFtoken
\lst@AddToHook{InitVarsBOL}{\global\lst@WFtoken{}}
\gdef\lst@WFWriteToFile{%
  \begingroup
   \let\lst@UM\@empty
   \expandafter\edef\expandafter\lst@temp\expandafter{\the\lst@WFtoken}%
   \immediate\write\lst@WF{\lst@temp}%
  \endgroup
  \global\lst@WFtoken{}}
\gdef\lst@WFAppend#1{%
    \global\expandafter\lst@WFtoken\expandafter{\the\lst@WFtoken#1}}
\gdef\lst@BeginWriteFile{%
    \begingroup
    \let\lst@OutputBox\@gobble
    \lst@WFBegin}
\gdef\lst@BeginAlsoWriteFile{\begingroup \lst@WFBegin}
\begingroup \catcode`\^^I=11
\gdef\lst@WFBegin#1{%
    \def\lst@Append##1{\advance\lst@length\@ne
        \expandafter\lst@token\expandafter{\the\lst@token##1}%
        \lst@WFAppend##1}%
    \def\lst@AppendOther##1{%
        \let\lst@lastother=##1\advance\lst@length\@ne
        \expandafter\lst@token\expandafter{\the\lst@token##1}%
        \ifx ##1\lst@outputspace
            \lst@WFAppend{ }%
        \else
            \lst@WFAppend##1%
        \fi}%
    \lst@lAddTo\lst@PreGotoTabStop{\lst@WFAppend{^^I}}%
    \def\lst@ProcessSpace{%
        \lst@ifletter \lst@Output\lst@letterfalse \fi
        \lst@AppendOther\lst@outputspace}%
    \let\lst@DeInit\lst@WFDeInit
    \let\lst@MProcessListing\lst@WFMProcessListing
    \immediate\openout\lst@WF=#1\relax}%
\endgroup
\gdef\lst@EndWriteFile{\immediate\closeout\lst@WF \endgroup}
\global\let\lst@WFMProcessListing\lst@MProcessListing
\global\let\lst@WFDeInit\lst@DeInit
\lst@AddToAtTop\lst@WFMProcessListing{\lst@WFWriteToFile}
\lst@AddToAtTop\lst@WFDeInit{%
    \ifnum\lst@length=\z@\else \lst@WFWriteToFile \fi}
\lst@EndAspect
\lst@BeginAspect{keywords}
\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@AddToHookExe{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@if#1@ins}%
             {\@tempa \global\@namedef{lst@if#1@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}
\global\let\lst@ifsensitivedefed\iffalse % init % \global
\gdef\lst@PostTrackKeywords#1#2#3#4{%
    \lst@ifsavemem\else
        \global\let#3#1%
        \global\let#4#2%
    \fi}
\lst@Key{defaultclass}\@ne{\def\lst@defaultclass{#1}}
\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[\lst@defaultclass]{##1}%
            {\@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@ProvideFamily#1{%
    \@ifundefined{lst@#1\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}%
    {\expandafter\expandafter\expandafter\lst@ProvideFamily@
         \csname lst@#1@data\endcsname
         {\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}}%
    {}}
\gdef\lst@ProvideFamily@#1#2#3#4#5#6#7#8{%
    \expandafter\xdef\csname lst@g#2#8@sty\endcsname
    {\if #6w%
         \expandafter\noexpand\csname lst@g#2@wp\endcsname{#8}%
     \else
         \expandafter\noexpand\csname lst@#3#8\endcsname
     \fi}%
    \ifx\@empty#3\@empty\else
        \edef\lst@temp{\noexpand\lst@AddToHook{Init}{%
            \noexpand\lst@ProvideStyle\expandafter\noexpand
                \csname lst@#3#8\endcsname\noexpand#4}}%
        \lst@temp
    \fi
    \expandafter\lst@ProvideFamily@@
         \csname lst@#2#8@list\expandafter\endcsname
         \csname lst@#2#8\expandafter\endcsname
         \csname lst@#2#8@also\expandafter\endcsname
         \csname lst@g#2#8@list\expandafter\endcsname
         \csname lst@g#2#8\expandafter\endcsname
         \csname lst@g#2#8@sty\expandafter\endcsname
         {#1}#5#6#7}
\gdef\lst@ProvideFamily@@#1#2#3#4#5#6#7#8{%
    \gdef#1{#2#5}\global\let#2\@empty \global\let#3\@empty % init
    \gdef#4{#2#5}\global\let#5\@empty % init
    \lst@AddToHook{Init}{\expandafter\lst@UseBasicClasses#3{}{}{}}%
    \if #8l\relax
        \lst@AddToHook{SetLanguage}{\def#1{#2#5}\let#2\@empty}%
    \fi
    \lst@InstallTest{#7}#1#2#4#5#6}
\gdef\lst@UseFamily#1{%
    \def\lst@family{#1}%
    \@ifnextchar[\lst@UseFamily@{\lst@UseFamily@[\lst@defaultclass]}}
\gdef\lst@UseFamily@[#1]{%
    \@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@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
    \expandafter\lst@SpecialKeywordScan\expandafter
        #4\expandafter#5#5{}{}}
\gdef\lst@DeleteKeywords[#1]#2#3#4#5#6{%
    \lst@MakeKeywords[#1]{#2}\@tempa\@tempb#5#6%
    \lst@DeleteClassesIn#3\@tempa
    \lst@DeleteKeysIn#4\@tempb
    \lst@SpecialKeywordScan#4#5{}{}}
\lst@Key{specialscan}t[t]{\lstKV@SetIf{#1}\lst@ifspecialscan}
\lst@AddToHook{SelectLanguage}{\let\lst@ifspecialscan\iftrue}
\lst@DefOther\lst@others{!"\#\%&'()*+-./0123456789:;<=>?[\]^`\{|\}~}
\global\let\lst@others\lst@others % init
\gdef\lst@SpecialKeywordScan#1#2#3#4{%
    \lst@ifspecialscan
        \def\lst@ialsoletter{#3}\def\lst@ialsodigit{#4}%
        \expandafter\lst@SKS@\expandafter#1\lst@others\relax
        \edef#2{{\lst@ialsoletter}{\lst@ialsodigit}}%
    \fi}
\gdef\lst@SKS@#1#2{%
    \ifx\relax#2%
        \expandafter\@gobbletwo
    \else
        \def\lst@temp##1#2##2##3\relax{%
            \ifx\@empty##2\else
                \def\lst@temp####1,#2####2####3\relax{%
                    \ifx\@empty####2%
                        \lst@SKS@@#2%
                    \else
                        \lst@SKSAdd\lst@ialsoletter#2%
                    \fi}%
                \expandafter\lst@temp\expandafter,#1,#2\@empty\relax
            \fi}%
        \expandafter\lst@temp #1#2\@empty\relax
    \fi
    \lst@SKS@#1}
\gdef\lst@SKS@@#1{%
    \ifnum`#1<`0%
        \lst@SKSAdd\lst@ialsodigit#1%
    \else\ifnum`#1>`9%
        \lst@SKSAdd\lst@ialsodigit#1%
    \fi \fi}
\gdef\lst@SKSAdd#1#2{%
    \def\lst@temp##1#2##2\relax{%
        \ifx\@empty##2\@empty \lst@lAddTo#1{#2}\fi}%
    \expandafter\lst@temp#1#2\relax}
\lst@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{otherkeywords}{}{\lst@DefActive\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#1\relax\lst@CDef {}\lst@PrintOtherKeyword\@empty
        \fi
        \expandafter\lst@DefineOtherKeywords
    \fi}
\gdef\lst@PrintOtherKeyword#1\@empty{%
    \lst@PrintToken
    \begingroup
        \lst@modetrue \lsthk@TextStyle
        \let\lst@ProcessDigit\lst@ProcessLetter
        \let\lst@ProcessOther\lst@ProcessLetter
        \lst@lettertrue
        \lst@gkeywords@sty{#1\lst@PrintToken}%
    \endgroup}
\lst@EndAspect
\lst@BeginAspect[keywords]{emph}
\lst@InstallFamily e{emph}{emphstyle}\relax{empty}{}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@CalcLineLength
          \lst@ifmode\else
              \ifnum\@tempcnta=\z@
                  \lst@EnterMode{\lst@CDmode}{}%
              \fi
          \fi
          \ifnum\lst@mode=\lst@CDmode
              \ifnum\@tempcnta=\z@
                  \lst@PrintToken
                  {\let\lst@currstyle\lst@directivestyle
                   \lsts@CCD\lst@PrintToken}%
              \else \lsts@CCD
              \fi
          \else \lsts@CCD
          \fi}%
     \fi}
\lst@AddTo\lst@stringtypes{,directive}
\lst@AddTo\lst@xstringtypes{,directive}
\gdef\lst@StringDM@directive#1#2#3\@empty{%
    \lst@CArg #2\relax\lst@CDef
        {}%
        {\let\lst@bnext\lst@CArgEmpty
         \ifnum\lst@mode=\lst@CDmode
             \def\lst@bnext{\lst@EnterMode#1{\lst@modetrue
                 \let\lst@currstyle\lst@stringstyle}}%
         \fi
         \lst@bnext}%
        \@empty
    \lst@CArg #3\relax\lst@CDef
        {}%
        {\let\lst@enext\lst@CArgEmpty
         \ifnum\lst@mode=#1%
             \let\lst@bnext\lst@EndXString
         \fi
         \lst@bnext}%
        \@empty}
\gdef\lst@EndXString#1\@empty{#1\lst@EndString}
\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@PrintToken
                      \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@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}
\lst@EndAspect
\lst@BeginAspect[keywords,comments]{keywordcomments}
\lst@NewMode\lst@KCmode \lst@NewMode\lst@KCSmode
\gdef\lst@BeginKC{%
    \lst@token{}\lst@length\z@
    \lst@BeginComment\lst@KCmode\lst@commentstyle\@empty}
\gdef\lst@BeginKCS{%
    \lst@token{}\lst@length\z@
    \lst@BeginComment\lst@KCSmode\lst@commentstyle\@empty}
\lst@AddToHook{PostOutput}{\lst@KCpost \global\let\lst@KCpost\@empty}
\global\let\lst@KCpost\@empty
\gdef\lst@EndKC{%
    \xdef\@gtempa{%
        \noexpand\lst@token{\the\lst@token}%
        \noexpand\lst@length\the\lst@length\relax}%
    \aftergroup\@gtempa \lst@LeaveMode}
\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@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@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{indexstyle1}
    {\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
         \@ifundefined{lst@indexstyle1}%
             {\@namedef{lst@indexstyle1}##1{}}%
             {}%
     \fi \fi}
\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 lsta@\lst@malias\endcsname}}%
    \ifx\@empty\lst@oalias \@ifundefined{lstdd@\lst@malias}{}%
        {\edef\lst@oalias{\csname lstdd@\lst@malias\endcsname}}%
    \fi
    \edef\lst@temp{\lst@malias $\lst@oalias}%
    \@ifundefined{lsta@\lst@temp}{}%
        {\edef\lst@temp{\csname lsta@\lst@temp\endcsname}}%
    \expandafter\lst@FindAlias@\lst@temp $}
\gdef\lst@FindAlias@#1$#2${%
    \def\lst@malias{#1}\def\lst@oalias{#2}%
    \ifx\@empty\lst@oalias \@ifundefined{lstdd@\lst@malias}{}%
        {\edef\lst@oalias{\csname lstdd@\lst@malias\endcsname}}%
    \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}% ^^L removed
\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#2#3#4#5#6#7{%
    \let#4#1%
    \ifx\@empty#2\@empty
        \def#1{\lst@fmtIfNextCharIn{#5}{#4}{#6#4#7}}%
    \else \ifx\@empty#3\@empty
        \def#1##1{%
            \ifx##1#2%
                \def\lst@next{\lst@fmtIfNextCharIn{#5}{#4##1}%
                                                      {#6#4#2#7}}%
            \else
                 \def\lst@next{#4##1}%
            \fi
            \lst@next}%
    \else
        \def#1{%
            \lst@IfNextCharsArg{#2#3}%
                {\lst@fmtIfNextCharIn{#5}{\expandafter#4\lst@eaten}%
                                         {#6#4#2#3#7}}%
                {\expandafter#4\lst@eaten}}%
    \fi \fi}
\gdef\lst@fmtCDefX#1#2#3#4#5#6#7{%
    \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{%
    \ifx\lst@newlines\@empty
        \lst@AddTo\lst@newlines\lst@EnsuredNewLine
    \fi
    \lst@fmtignoretrue}
\gdef\lst@EnsuredNewLine#1{%
    \lst@ifnewline\else
        \ifx#1\lst@NewLine\else \lst@NewLine \fi
    \fi
    #1}
\lst@AddToHook{PostOutput}{\global\let\lst@ifnewline\iffalse}
\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
        \ifdim\lst@lostspace>\z@ \lst@InsertLostSpace \fi
    \fi}
\lst@AddToHook{Init}
    {\lst@true
     \ifx\lst@fmtformat\@empty \ifx\lst@fmt\@empty \lst@false \fi\fi
     \lst@if
        \let\lst@UseLostSpace\lst@fmtUseLostSpace
        \let\lst@ProcessSpace\lst@fmtProcessSpace
     \fi}
\gdef\lst@fmtProcessSpace{%
    \lst@ifletter
        \lst@Output\lst@letterfalse
        \lst@fmtifignore\else
            \lst@AppendOther\lst@outputspace
        \fi
    \else \lst@ifkeepspaces
        \lst@AppendOther\lst@outputspace
    \else \ifx\lst@newlines\@empty
        \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{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{EveryPar}
    {\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
         \let\lst@labeladvance\m@ne
         \edef\lst@labelstep{-\lst@labelstep}%
     \fi
     \ifnum \z@<\lst@labelstep
         \global\lst@skiplabels\lst@firstlabel
         \global\divide\lst@skiplabels\lst@labelstep
         \global\multiply\lst@skiplabels-\lst@labelstep
         \global\advance\lst@skiplabels\lst@firstlabel
         \ifnum\lst@skiplabels>\z@
             \global\advance\lst@skiplabels -\lst@labelstep
         \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{BoxUnsafe}{\lst@outerspread\z@ \lst@innerspread\z@}
\lst@Key{wholeline}{false}[t]{\lstKV@SetIf{#1}\lst@ifwholeline}
\lst@Key{linewidth}\linewidth{\def\lst@linewidth{#1}}
\lst@AddToHook{PreInit}{\linewidth\lst@linewidth\relax}
\lst@Key{indent}{\z@}{\def\lst@indent{#1}}
\lst@AddToHook{TextStyle}{\let\lst@indent\z@ \let\lst@ifwholeline\iftrue}
\lst@Key{spread}{\z@,\z@}{\lstKV@CSTwoArg{#1}%
    {\lst@innerspread##1\relax
     \ifx\@empty##2\@empty
         \divide\lst@innerspread\tw@\relax
         \lst@outerspread\lst@innerspread
     \else
         \lst@outerspread##2\relax
     \fi}}
\gdef\lst@parshape{%
    \parshape\@ne
        \ifodd\c@page -\lst@innerspread\else -\lst@outerspread\fi
        \linewidth}
\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
         \def\lst@parshape{\parshape\tw@
             \ifodd\c@page -\lst@innerspread\else -\lst@outerspread\fi
             \linewidth %
             \lst@breakshape}%
     \else
         \let\lst@discretionary\relax
     \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
    \@tempdimb\@tempdima \@tempdimc-\@tempdima
    \advance\@tempdima-\lst@innerspread
    \advance\@tempdimb-\lst@outerspread
    \advance\@tempdimc\linewidth
    \xdef\lst@breakshape{\noexpand\lst@breakcurrindent \the\@tempdimc}%
    \xdef\lst@breakcurrindent{%
        \noexpand\ifodd\c@page \the\@tempdima
        \noexpand\else \the\@tempdimb \noexpand\fi}}
\gdef\lst@breakProcessOther#1{%
    \lst@ifletter \lst@Output\lst@letterfalse \fi
    \lst@AppendOther#1\lst@OutputOther}
\lst@AddToHook{SelectCharTable}
    {\lst@ifbreaklines \lst@Def{`)}{\lst@breakProcessOther)}\fi}
\lst@EndAspect
\lst@BeginAspect[lineshape]{frames}
\lst@Key{framerulewidth}{.4pt}{\def\lst@framerulewidth{#1}}
\lst@Key{framerulesep}{2pt}{\def\lst@framerulesep{#1}}
\lst@Key{frametextsep}{3pt}{\def\lst@frametextsep{#1}}
\lst@Key{framespread}{\z@}{\def\lst@framespread{#1}}
\lst@Key{frameshape}{}{\lstKV@FourArg{#1}%
    {\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}}{}}
\lst@Key{backgroundcolor}{}{\lstKV@OptArg[]{#1}%
    {\ifx\@empty##2\@empty
         \let\lst@bkgcolor\@empty
     \else
         \ifx\@empty##1\@empty
             \def\lst@bkgcolor{\color{##2}}%
         \else
             \def\lst@bkgcolor{\color[##1]{##2}}%
         \fi
     \fi}}
\lst@Key{framerulecolor}{}{\lstKV@OptArg[]{#1}%
    {\ifx\@empty##2\@empty
         \let\lst@framerulecolor\@empty
     \else
         \ifx\@empty##1\@empty
             \def\lst@framerulecolor{\color{##2}}%
         \else
             \def\lst@framerulecolor{\color[##1]{##2}}%
         \fi
     \fi}}
\lst@AddToHook{EveryLine}
    {\ifx\lst@bkgcolor\@empty\else
         \@tempdima\linewidth \advance\@tempdima\lst@indent
         \rlap{\begingroup \lst@bkgcolor
               \kern-\lst@indent\relax
               \color@block{\@tempdima}{\ht\strutbox}{\dp\strutbox}%
               \endgroup}%
     \fi}
\gdef\lst@frameBkgBox#1{%
    \ifx\lst@bkgcolor\@empty\else
        \setbox#1\hbox{\begingroup \lst@bkgcolor
                       \color@block{\wd#1}{\ht#1}{\dp#1}%
                       \endgroup \box#1}%
    \fi}
\gdef\lst@frameR{%
    \strut\smash{\expandafter\lst@frameR@\lst@framershape\relax}%
    \kern-\lst@framerulesep}
\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{%
    \kern-\lst@framerulesep
    \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{%
    \global\let\lst@framediml\z@ \global\let\lst@framedimr\z@
    \setbox\z@\hbox{}\@tempcntb\z@
    \expandafter\lst@frameH@\expandafter#1#2\relax\relax\relax
    \ifx\lst@bkgcolor\@empty\else
        \@tempdima\lst@framediml
        \advance\@tempdima\lst@indent
        \setbox\z@\hbox{\rlap{%
            \kern-\@tempdima
            \kern-\ifodd\c@page\lst@innerspread\else\lst@outerspread\fi
            \kern-\lst@framehalfspread
            \advance\@tempdima\linewidth
            \advance\@tempdima\lst@framedimr
            \advance\@tempdima\lst@framespread
            \begingroup \lst@bkgcolor
            \color@block{\@tempdima}{\ht\z@}{\dp\z@}%
            \endgroup}%
            \box\z@}%
    \fi}
\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{%
        \begingroup \lst@framerulecolor
        \kern-\lst@indent
        \kern\ifodd\c@page -\lst@innerspread\else -\lst@outerspread\fi
        \kern-\lst@framehalfspread
        \lst@frameCornerX\llap{#2L}#3%
        \ifdim\lst@framediml<\@tempdimb
            \xdef\lst@framediml{\the\@tempdimb}%
        \fi
        \begingroup
        \if#4Y\else\let\lst@framerulewidth\z@ \fi
        \vrule\@width\lst@framespread\@height\lst@framerulewidth
              \@depth\z@
        \vrule\@width\lst@indent\@height\lst@framerulewidth\@depth\z@
        \vrule\@width\linewidth\@height\lst@framerulewidth\@depth\z@
        \endgroup
        \lst@frameCornerX\rlap{#2R}#5%
        \ifdim\lst@framedimr<\@tempdimb
            \xdef\lst@framedimr{\the\@tempdimb}%
        \fi
        \kern-\lst@framehalfspread
        \endgroup}%
    \if#2T\raise\dp\z@\copy\z@
     \else\lower\ht\z@\copy\z@ \fi}}
\gdef\lst@frameCornerX#1#2#3{%
    \setbox\@tempboxa\hbox{\csname lst@frame\if#3RR\fi #2\endcsname}%
    \@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@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{%
        \begingroup \lst@framerulecolor
        \setbox\z@\hbox{\lst@frameL \kern\lst@frametextsep
                        \kern\lst@framehalfspread}%
        \lst@frameBkgBox\z@
        \llap{\box\z@ \kern\lst@indent}%
        \setbox\z@\hbox{\kern\lst@framehalfspread \kern\lst@frametextsep
                        \lst@frameR}%
        \lst@frameBkgBox\z@
        \rlap{\kern\linewidth \box\z@}%
        \endgroup}%
    \ifx\lst@frameL\relax \ifx\lst@frameR\relax
        \let\lst@framelr\strut
    \fi \fi
    \@tempdima\ht\strutbox \advance\@tempdima\lst@lineskip
    \@tempdimb\dp\strutbox \advance\@tempdimb\lst@lineskip
    \edef\lst@framevrule{%
        \vrule\noexpand\@height\the\@tempdima
              \noexpand\@depth\the\@tempdimb
              \noexpand\@width\noexpand\lst@framerulewidth}%
    \@tempdima\lst@framerulewidth \divide\@tempdima\tw@
    \edef\lst@framerulehalfwidth{\the\@tempdima}%
    \@tempdima\lst@framespread\relax \divide\@tempdima\tw@
    \edef\lst@framehalfspread{\the\@tempdima}%
    \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@
        \@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@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\lst@parshape\nointerlineskip\noindent
        \setbox\z@=\hbox{%
          \def\lst@framevrule{\vrule\@height\lst@framehalfspread
              \@depth\z@\@width\lst@framerulewidth}%
          \def\strut{\vrule\@height\lst@framehalfspread
              \@depth\z@\@width\z@}%
          \lst@framelr
          \kern-\lst@indent
          \ifx\lst@bkgcolor\@empty\else
          \begingroup \lst@bkgcolor
          \vrule\@height\lst@framehalfspread\@depth\z@\@width\linewidth
          \vrule\@height\lst@framehalfspread\@depth\z@\@width\lst@indent
          \endgroup
          \fi}%
        \rlap{\box\z@}%
    \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
\gdef\lst@makekeyfalse{\let\lst@ifmakekey\iffalse}
\gdef\lst@makekeytrue{\let\lst@ifmakekey\iftrue}
\global\lst@makekeyfalse
\lst@Key{makemacrouse}f[t]{\lstKV@SetIf{#1}\lst@ifmakemacrouse}
\lst@AddToHook{SelectCharTable}
    {\lst@ifmakemacrouse
         \lst@ReplaceInput{$(}{%
             \lst@PrintToken
             \lst@EnterMode\lst@makemode{\lst@makekeyfalse}%
             \def\lst@aside{\lst@ProcessOther\$\lst@ProcessOther(}}%
         \lst@ReplaceInput{)}{%
             \ifnum\lst@mode=\lst@makemode
                 \lst@PrintToken
                 \begingroup
                     \lst@ProcessOther)%
                     \lst@ifmakekey
                         \lst@gkeywords@sty\lst@OutputOther
                     \else
                         \lst@OutputOther
                     \fi
                 \endgroup
                 \lst@LeaveMode
             \else
                 \expandafter\lst@ProcessOther\expandafter)%
             \fi}%
     \else \ifx\lst@language\lst@make
         \lst@ReplaceInput{$(}{\lst@ProcessOther\$\lst@ProcessOther(}%
     \fi \fi}
\gdef\lst@make{make}
\lst@AddToHook{InitVars}{\let\lst@aside\@empty}
\gdef\lst@makePrintAside#1{%
    \ifx\lst@aside\@empty\else
        \begingroup
        \lst@token{}\lst@length\z@ \lst@aside \let\lst@aside\@empty
        #1{\lst@OutputOther}%
        \endgroup
        \let\lst@aside\@empty
    \fi}
\lst@AddToHook{OutputOther}{\lst@makePrintAside\relax}
\lst@AddToHook{Output}{%
    \ifnum\lst@mode=\lst@makemode
        \ifx\lst@thestyle\lst@gkeywords@sty
            \lst@makekeytrue
        \fi
    \fi
    \lst@makePrintAside\lst@thestyle}
\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@ifwholeline \advance\linewidth-\@totalleftmargin \fi
        \everypar{}\global\let\lst@newlines\@empty
        \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@true \lst@FVConvert#1\@nil
    \global\let\lst@newlines\@empty
    \vtop{\leavevmode\lst@parshape
          \lst@ReenterModes
          \lst@arg \lst@PrintToken\lst@EOLUpdate
          \lst@InterruptModes}}
\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 lstLGlang@\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 or just mispellt.^^J%
          Type <RETURN> to proceed without changing the language.}}%
        {\lsthk@SetLanguage
         \csname lstLGlang@\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'.
