%%
%% This is file `listings.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% listings.dtx  (with options: `package')
%% 
%% (w)(c) 1996-1997 by Carsten Heinz
%% 
%% This file is distributed freely. You are not allowed to take money
%% for the distribution or use of this file, except for a nominal charge
%% for copying etc.
%% 
%% This file is distributed without any warranty; without even the implied
%% warranty of merchantability or fitness for a particular purpose.
%% 
%% You are not allowed to change this file.
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{listings}[1997/04/10 v0.15 by Carsten Heinz]
\DeclareOption{blank}  {\blanklisting}
\DeclareOption{c}      {\clisting}
\DeclareOption{cpp}    {\cpplisting}
\DeclareOption{eiffel} {\eiffellisting}
\DeclareOption{fortran}{\fortranlisting}
\DeclareOption{java}   {\javalisting}
\DeclareOption{modula} {\modulalisting}
\DeclareOption{pascal} {\pascallisting}
\DeclareOption{pxsc}   {\pxsclisting}
\DeclareOption{tp}     {\tplisting}
\newcommand\blanklisting  {\lst@Listing{blank}}
\newcommand\clisting      {\lst@Listing{c}}
\newcommand\cpplisting    {\lst@Listing{cpp}}
\newcommand\eiffellisting {\lst@Listing{eiffel}}
\newcommand\fortranlisting{\lst@Listing{fortran}}
\newcommand\javalisting   {\lst@Listing{java}}
\newcommand\modulalisting {\lst@Listing{modula}}
\newcommand\pascallisting {\lst@Listing{pascal}}
\newcommand\pxsclisting   {\lst@Listing{pxsc}}
\newcommand\tplisting     {\lst@Listing{tp}}
\newcommand\lst@Listing[1]{%
    \@ifundefined{lst@#1}{\input{lst#1.sty}}{}%
    \@ifundefined{lst@#1}{%
        \PackageError{Listings}{Driver file for `#1' corrupt}{%
        The driver file doesn't define the macro \string\lst@#1.}}%
    {\csname lst@#1\endcsname \def\lst@curr{#1}}}
\newread\lst@inputfile  \newif\if@lst@endinput  \newif\iflisting
\newcount\lst@last@line  \newcount\lst@current@line
\newcount\lst@comment@depth
\newif\if@lst@comment  \newif\if@lst@string
\newdimen\lst@width  \newcount\lst@length
\newcount\lst@tab@length  \newcount\lst@pos
\def\DeclareCommentLine#1\relax{\def\test{#1}%
  \ifx\test\empty \let\lst@CommentLine=\empty %
  \else
      \gdef\lst@CommentLine{\expandafter\lst@TestCL\lst@line#1\relax}%
      \long\gdef\lst@TestCL##1#1##2\relax{%
          \def\test{##2}%
          \ifx\test\empty \let\lst@commentline=\empty %
          \else \expandafter\lst@CutCL\lst@line\relax %
          \fi}%
      \gdef\lst@CutCL##1#1##2\relax{%
          \def\lst@line{##1}\def\lst@commentline{#1##2}}%
  \fi}
\def\DeclareSingleComment#1 #2\relax{\def\test{#2}%
  \ifx\test\empty %
      \let\lst@SOC=\empty \let\lst@EOC=\empty %
  \else %
      \gdef\lst@SOC{\expandafter\lst@TestSOC\lst@line#1\relax}%
      \long\gdef\lst@TestSOC##1#1##2\relax{%
          \def\test{##2}%
          \ifx\test\empty\else %
              \expandafter\lst@CutSOC\lst@line\relax %
          \fi}%
      \gdef\lst@CutSOC##1#1##2\relax{\@lst@commenttrue %
          \def\lst@line{##1}\def\lst@comment{#1##2}}%
      \gdef\lst@EOC{\expandafter\lst@TestEOC\lst@line#2\relax}%
      \long\gdef\lst@TestEOC##1#2##2\relax{%
          \def\test{##2}%
          \ifx\test\empty %
              \let\lst@comment=\lst@line \let\lst@line=\empty %
          \else %
              \expandafter\lst@CutEOC\lst@line\relax %
          \fi}%
      \gdef\lst@CutEOC##1#2##2\relax{\@lst@commentfalse %
          \def\lst@line{##2}\def\lst@comment{##1#2}}%
  \fi}
\def\DeclareDoubleComment#1 #2 #3 #4\relax{%
  \DeclareSingleComment#1 #2\relax %
  \global\let\lst@SavedEOC=\lst@EOC %
  \long\gdef\lst@TestSOC@##1#3##2\relax{%
      \def\test{##2}%
      \ifx\test\empty\else %
          \expandafter\lst@CutSOC@\lst@line\relax %
      \fi}%
  \gdef\lst@CutSOC@##1#3##2\relax{\@lst@commenttrue %
      \def\lst@line{##1}\def\lst@comment{#3##2}}%
  \gdef\lst@EOC@{\expandafter\lst@TestEOC@\lst@line#4\relax}%
  \long\gdef\lst@TestEOC@##1#4##2\relax{%
      \def\test{##2}%
      \ifx\test\empty %
          \let\lst@comment=\lst@line \let\lst@line=\empty %
      \else %
          \expandafter\lst@CutEOC@\lst@line\relax %
      \fi}%
  \gdef\lst@CutEOC@##1#4##2\relax{\@lst@commentfalse %
      \def\lst@line{##2}\def\lst@comment{##1#4}}%
  \long\gdef\lst@TestSOC##1#1##2\relax{%
      \lst@TestSOC@##1#3\relax %
      \if@lst@comment \let\lst@EOC=\lst@EOC@ %
      \else \def\test{##2}%
          \ifx\test\empty \else %
              \expandafter\lst@CutSOC\lst@line\relax %
              \let\lst@EOC=\lst@SavedEOC %
          \fi %
      \fi}}
\def\DeclareNestedComment#1 #2\relax{%
  \DeclareSingleComment#1 #2\relax %
  \long\gdef\lst@TestEOC##1#2##2\relax{%
      \lst@CountSOC##1#1\relax %
      \def\test{##2}%
      \ifx\test\empty %
          \let\lst@comment=\lst@line \let\lst@line=\empty %
      \else %
          \expandafter\lst@CutEOC\lst@line\relax %
      \fi}%
  \gdef\lst@CutEOC##1#2##2\relax{%
      \advance\lst@comment@depth by -1\relax %
      \ifnum 0=\lst@comment@depth \@lst@commentfalse\fi %
      \def\lst@line{##2}\def\lst@comment{##1#2}}%
  \long\gdef\lst@CountSOC##1#1##2\relax{%
      \def\test{##2}\ifx\test\empty\else %
          \advance\lst@comment@depth by 1%
          \def\@tempa{\lst@CountSOC##2\relax}%
          \expandafter\@tempa %
      \fi}}
\def\lst@CaseSensitiveKeywords#1\relax{%
    \def\test##1,#1,##2\relax{\def\test{##2}%
        \ifx\test\empty \lst@MakeBox{}%
        \else \lst@MakeBox{\lst@keywordstyle}%
        \fi}%
    \expandafter\test\lst@keywords,#1,\relax}%
\def\lst@NonCaseSensitiveKeywords#1\relax{%
    \uppercase{\def\test##1,#1,##2\relax{\def\test{##2}%
        \ifx\test\empty \lst@MakeBox{}%
        \else \lst@MakeBox{\lst@keywordstyle}%
        \fi}}%
    \expandafter\uppercase\expandafter{%
        \expandafter\test\lst@keywords,#1,\relax}}%
\newcommand\prelisting[1]{\def\lst@prelisting{#1}}
\newcommand\postlisting[1]{\def\lst@postlisting{#1}}
\newcommand\keywordstyle[1]{\def\lst@keywordstyle{#1}}
\newcommand\commentstyle[1]{\def\lst@commentstyle{#1}}
\newcommand\stringstyle[1]{\def\lst@stringstyle{#1}}
\newcommand\keywords[1]{\def\lst@keywords{#1}}
\newcommand\morekeywords[1]{\edef\lst@keywords{\lst@keywords,#1}}
\newcommand\stringizer[1]{\def\lst@stringizer{#1}}
\newcommand\blankstringtrue{%
    \let\lst@MakeStringBox=\lst@MakeBox}
\newcommand\blankstringfalse{%
    \let\lst@MakeStringBox=\lst@MakeSpecialStringBox}
\newcommand\sensitivetrue{%
    \let\lst@KeywordOrNot=\lst@CaseSensitiveKeywords}
\newcommand\sensitivefalse{%
    \let\lst@KeywordOrNot=\lst@NonCaseSensitiveKeywords}
\newcommand\tablength[1]{\ifnum#1>0\lst@tab@length=#1\relax \else %
    \PackageError{Listings}{Strict positive integer expected}{%
    You can't use `#1' as tablength.^^J I'll forget it and proceed.}\fi}
\newcommand\normallisting{%
    \keywordstyle{\bfseries}\commentstyle{\itshape}\stringstyle{}%
    \prelisting{}\postlisting{}\blankstringfalse}
\newcommand\inputlisting[2][1,999999]{%
    \batchmode \openin\lst@inputfile#2 \errorstopmode %
    \ifeof\lst@inputfile %
        \PackageError{Listings}{File `#2' not found}{%
        You must tell me the right name or I can't do the job.}%
    \else %
        \message{(#2}%
        \iflisting %
            \lst@SetRange[#1]\lst@current@line=1 %
            \lst@SkipUptoFirst \@lst@endinputfalse %
            \lst@begin %
            \loop %
                \read\lst@inputfile to\lst@line %
                \advance\lst@current@line by 1%
                \lst@AllLineProcessing %
                \ifeof\lst@inputfile \@lst@endinputtrue \fi %
                \ifnum\lst@last@line<\lst@current@line %
                    \@lst@endinputtrue %
                \fi %
                \if@lst@endinput\else %
            \repeat %
            \vspace*{-\baselineskip}%
            \lst@end %
        \else %
            \begin{center}%
            --- Listing of #2 has been skipped. ---
            \end{center}%
        \fi %
        \message{)}%
    \fi \closein\lst@inputfile}
\def\listing{%
    \iflisting
        \lst@begin \catcode`\^^M=\active \vspace*{-\baselineskip}%
        \expandafter\lst@env@ReadAndProcess %
    \else %
        \begin{center}%
        --- Listing has been skipped. ---
        \end{center}%
    \fi}
\def\endlisting{}
\begingroup
\catcode`\!=\active \catcode`\[=\active \catcode`\]=\active
\lccode`\!=`\\ \lccode`\[=`\{ \lccode`\]=`\}
\catcode`\~=\active \lccode`\~=`\^^M
\lowercase{
\gdef\lst@env@ReadAndProcess#1~{\lst@env@Process#1!end[listing]\relax}
\gdef\lst@env@Process#1!end[listing]#2\relax{%
    \def\test{#2}%
\ifx\test\empty %
        \def\lst@line{#1~}%
        \lst@AllLineProcessing %
        \let\next\lst@env@ReadAndProcess %
    \else %
        \def\next{\lst@end\end{listing}}%
    \fi\next}
}\endgroup
\def\lst@begin{%
    \smallbreak\bgroup\lst@prelisting %
    \@lst@stringfalse \lst@width=0.65em \lst@comment@depth=0 %
    \let\lst@comment=\empty \let\lst@commentline=\empty %
    \def\lst@test{fortran}\ifx\lst@curr\lst@test \lst@width=0.8em\fi
    \lst@ChangeCatcodes}
\def\lst@end{\lst@postlisting\egroup\smallbreak\ignorespaces}
\def\lst@SetRange[#1,#2]{\@tempcnta=#1\relax \lst@last@line=#2\relax}
\def\lst@SkipUptoFirst{%
    \@whilenum \@tempcnta<\lst@current@line \do %
        {\read\lst@inputfile to\lst@line %
         \advance\lst@current@line by 1}}
\def\lst@AllLineProcessing{%
    \let\lst@text=\empty \lst@length=0 \global\lst@pos=0 %
    \par \noindent \lst@PreProcessLine \lst@ProcessLine}
\def\lst@PreProcessLineDefault{%
    \if@lst@string %
        \PackageWarning{Listings}{string constant exceeds line}%
        \@lst@stringfalse %
    \fi}
\def\lst@ProcessLine{\def\next{\lst@ProcessLine}%
    \if@lst@comment \lst@EOC %
        {\@lst@commenttrue \expandafter\lst@Tokenize\lst@comment\relax}%
        \let\lst@comment=\empty\if@lst@comment \def\next{}\fi %
    \else %
        \lst@SOC \lst@CommentLine %
        {\@lst@commentfalse\expandafter\lst@Tokenize\lst@line\relax}%
        \if@lst@string %
            \@lst@commentfalse %
            \ifx\lst@commentline\empty\else \@lst@commenttrue \fi %
            \ifx\lst@comment\empty\else \@lst@commenttrue \fi %
            \if@lst@comment %
                \@lst@commentfalse %
                \expandafter\expandafter\expandafter\lst@TypesetChar %
                    \expandafter\lst@commentline\lst@comment\relax %
                \let\lst@comment=\empty \let\lst@commentline=\empty %
            \else %
                \def\next{}%
            \fi %
        \else %
            \ifx\lst@commentline\empty \else %
                \@lst@commenttrue %
                \expandafter\expandafter\expandafter\lst@Tokenize %
                    \expandafter\lst@commentline\lst@comment\relax %
                \let\lst@comment=\empty \let\lst@commentline=\empty %
                \@lst@commentfalse %
            \fi %
            \if@lst@comment %
                \let\lst@line=\lst@comment %
            \else \def\next{}%
            \fi %
        \fi %
    \fi\next}
\def\lst@TypesetChar#1#2\relax{\def\lst@line{#2}\lst@CharOutput#1}
\long\def\lst@Tokenize#1{%
    \def\lst@next{\lst@Tokenize}%
    \ifcat #1a%
        \edef\lst@text{\lst@text#1}\advance\lst@length by 1 %
    \else \ifcat #1&%
        \lst@Output \lst@GotoNextTabStop %
    \else %
        \lst@Output %
        \ifx#1\relax \def\lst@next{}%
        \else \if@lst@comment \lst@CharOutput#1%
        \else \lst@TestStringizer#1%
        \fi \fi %
    \fi \fi \lst@next}
\long\def\lst@TestStringizer#1{\def\test{#1}%
    \if@lst@string %
        \lst@CharOutput#1%
        \ifx \test\lst@closing@stringizer \global\@lst@stringfalse\fi %
    \else %
        \expandafter\lst@DoStringizerTest\lst@stringizer\relax %
        \lst@CharOutput#1%
    \fi}
\def\lst@DoStringizerTest#1{%
    \ifx#1\relax \else %
        \expandafter\if\test#1%
            \global\@lst@stringtrue %
            \gdef\lst@closing@stringizer{#1}%
        \fi %
        \expandafter\lst@DoStringizerTest %
    \fi}%
\def\lst@Output{%
    \ifx\lst@text\empty\else %
        \if@lst@string \lst@MakeStringBox \else %
        \if@lst@comment\lst@MakeBox{\lst@commentstyle}\else %
        \expandafter\lst@KeywordOrNot\lst@text\relax %
        \fi \fi %
        \global\advance\lst@pos by -\lst@length %
        \let\lst@text=\empty \lst@length=0 %
    \fi}
\def\lst@MakeBox#1{%
    \hbox to \lst@length\lst@width{#1\hss %
        \expandafter\lst@FillBox\lst@text\relax \hss}}
\begingroup
\catcode`\_=11
\gdef\lst@FillBox#1{%
    \ifx\relax#1\else %
        \ifx#1_\lst@underbar \else #1\fi \hss %
        \expandafter\lst@FillBox %
    \fi}
\endgroup
\def\lst@MakeSpecialStringBox{%
    \hbox to \lst@length\lst@width{\lst@stringstyle\hss %
        \expandafter\lst@FillStringBox\lst@text\relax \hss}}
\begingroup
\catcode`\_=11
\long\gdef\lst@FillStringBox#1{%
    \ifx\relax#1\else %
        \ifx#1_\lst@underbar \else %
        \ifx#1\lst@active@blank \lst@string@blank \else #1%
        \fi \fi \hss%
    \expandafter\lst@FillStringBox%
    \fi}%
\endgroup
\long\def\lst@CharOutput#1{\global\advance\lst@pos by -1%
    \hbox to \lst@width{\hss %
        \if@lst@string \lst@stringstyle\lst@FillStringBox#1\relax %
        \else \if@lst@comment \lst@commentstyle#1\hss %
        \else #1\hss %
        \fi \fi}}
\def\lst@GotoNextTabStop{%
    \@whilenum \lst@pos<1 \do %
        {\global\advance\lst@pos by \lst@tab@length}%
    \@whilenum \lst@pos>0 \do %
        {\lst@CharOutput\lst@active@blank}}
\def\lst@underbar{${_-}$}
\def\lst@leftbrace{$\{$}
\def\lst@rightbrace{$\}$}
\def\lst@less{$<$}
\def\lst@greater{$>$}
\def\lst@vertical@bar{$|$}
\def\lst@minus{$-$}
\def\lst@multiply{$*$}
\begingroup
\catcode`\ =12%
\gdef\lst@string@blank{{\ttfamily }}%
\endgroup
\begingroup
\catcode `/=0       \catcode `(= 1      \catcode `)=2 % new \, { and }
\catcode`\<=\active \catcode`\>=\active \catcode`\|=\active
\catcode`\-=\active \catcode`\*=\active
\catcode`\{=\active \catcode`\}=\active \catcode`\\=\active
/catcode`/ =/active%
/gdef/lst@active@blank(/ )%
/gdef/lst@ChangeCatcodes(%
/catcode`/ =/active/let =/lst@active@blank%
/catcode`/\=/active/def\($/backslash$)%
/catcode`/{=/active/def{(/lst@leftbrace)%
/catcode`/}=/active/def}(/lst@rightbrace)%
/catcode`/<=/active/def<(/lst@less)%
/catcode`/>=/active/def>(/lst@greater)%
/catcode`/|=/active/def|(/lst@vertical@bar)%
/catcode`/-=/active/def-(/lst@minus)%
/catcode`/*=/active/def*(/lst@multiply)%
/chardef~="7E%
/catcode`/^^I=4%
/catcode`/$=12/catcode`/&=12/catcode`/#=/lst@sharp@catcode%
/catcode`/^=12/catcode`/%=12/catcode`/"=12%
/catcode`/1=11/catcode`/2=11/catcode`/3=11%
/catcode`/4=11/catcode`/5=11/catcode`/6=11%
/catcode`/7=11/catcode`/8=11/catcode`/9=11%
/catcode`/0=11/catcode`/_=11)%
/endgroup
\normallisting
\listingtrue
\lst@tab@length=4
\ExecuteOptions{blank}
\ProcessOptions
\endinput
%%
%% End of file `listings.sty'.
