%%
%% This is file `lstpatch.sty', generated manually.
%%
%% Please read the software license in listings.dtx or listings.dvi.
%%
%% (w)(c) 2003,2004 Carsten Heinz
%%
%% This file is distributed under the terms of the LaTeX Project Public
%% License from CTAN archives in directory macros/latex/base/lppl.txt.
%% Either version 1.0 or, at your option, any later version.
%%
%% Send comments and ideas on the package, error reports and additional
%% programming languages to <cheinz@gmx.de>.
%%
%% This patch file will remove the following bugs from the listings package.
%% Each item contains the bug finder with date of report and first bug fix
%% version, a short description of the problem, and the reason for the bug
%% in parenthesis.
%%
%% 1) Carsten Heinz, 2004/02/18, 1.1b (2004/02/18)
%%
%% Bad default for noxoutput
%% (`true' should be `false')
%%
%%
%% The following features are added to the base package.
%%
%% 1.2a (2004/02/10)
%%
%% a) H I G H L Y E X P E R I M E N T A L
%%
%% Use the options
%% rangeprefix=<prefix for begin and end of range>
%% rangesuffix=<suffix for begin and end of range>
%%
%% rangebeginprefix=<prefix for begin of range>
%% rangebeginsuffix=<suffix for begin of range>
%%
%% rangeendprefix=<prefix for end of range>
%% rangeendsuffix=<suffix for end of range>
%%
%% includerangemarker=true|false
%% together with
%% firstline=<begin marker>
%% lastline=<end marker>
%% or
%% linerange={<begin marker 1>-<end marker 1>,
%% <begin marker 2>-<end marker 2>, ...}
%% The according markers in the source code are
%% <prefix><marker><suffix>
%% for begin respectively end of range. Moreover, one can use
%% includerangemarker=true|false
%% to show or hide the range markers in the output.
%%
%% b) noxoutput=true|false (not a permanent key!)
%%
%% enables or disables the special output routine
%%
%%
\ProvidesFile{lstpatch.sty}[2004/02/18 1.2b (Carsten Heinz)]
\lst@CheckVersion{1.2}
{\typeout{^^J%
***^^J%
*** This is a patch for listings 1.2, but you're using^^J%
*** version \lst@version.^^J%
***^^J
*** Patch file not loaded.^^J%
***^^J}%
\endinput
}
%
% a) Let's start with the options:
\lst@Key{rangeprefix}\relax{\def\lst@rangebeginprefix{#1}%
\def\lst@rangeendprefix{#1}}
\lst@Key{rangesuffix}\relax{\def\lst@rangebeginsuffix{#1}%
\def\lst@rangeendsuffix{#1}}
\lst@Key{rangebeginprefix}{}{\def\lst@rangebeginprefix{#1}}
\lst@Key{rangebeginsuffix}{}{\def\lst@rangebeginsuffix{#1}}
\lst@Key{rangeendprefix}{}{\def\lst@rangeendprefix{#1}}
\lst@Key{rangeendsuffix}{}{\def\lst@rangeendsuffix{#1}}
\lst@Key{includerangemarker}{true}[t]{\lstKV@SetIf{#1}\lst@ifincluderangemarker}
%
% The key is a redefinition of \lst@GLI@ checking for numbers.
\def\lst@GLI@#1-#2-#3\@nil{%
\lst@IfNumber{#1}%
{\ifx\@empty#1\@empty
\let\lst@firstline\@ne
\else
\def\lst@firstline{#1\relax}%
\fi
\ifx\@empty#3\@empty
\def\lst@lastline{9999999\relax}%
\else
\ifx\@empty#2\@empty
\let\lst@lastline\lst@firstline
\else
\def\lst@lastline{#2\relax}%
\fi
\fi}%
%
% If we've found a general marker, we set firstline and lastline to 9999999.
% This prevents (almost) anything to be printed for now.
{\def\lst@firstline{9999999\relax}%
\let\lst@lastline\lst@firstline
%
% We add the prefixes and suffixes to the markers.
\let\lst@rangebegin\lst@rangebeginprefix
\lst@AddTo\lst@rangebegin{#1}\lst@Extend\lst@rangebegin\lst@rangebeginsuffix
\ifx\@empty#3\@empty
\let\lst@rangeend\lst@rangeendprefix
\lst@AddTo\lst@rangeend{#1}\lst@Extend\lst@rangeend\lst@rangeendsuffix
\else
\ifx\@empty#2\@empty
\let\lst@rangeend\@empty
\else
\let\lst@rangeend\lst@rangeendprefix
\lst@AddTo\lst@rangeend{#2}\lst@Extend\lst@rangeend\lst@rangeendsuffix
\fi
\fi
% The following definition will be executed in the SelectCharTable hook
% and here right now if we are already processing a listing.
\def\lst@DefRange{\expandafter\lst@CArgX\lst@rangebegin\relax\lst@DefRangeB}%
\ifnum\lst@mode=\lst@Pmode \expandafter\lst@DefRange \fi}}
\lst@AddToHook{SelectCharTable}{\lst@DefRange}
\lst@AddToHookExe{DeInit}{\global\let\lst@DefRange\@empty}
%
% Actually defining the marker (via \lst@GLI@, \lst@DefRange, \lst@CArgX as
% seen above) is similar to \lst@DefDelimB---except that we unfold the first
% parameter and use different <execute>, <pre>, and <post> statements.
\def\lst@DefRangeB#1#2{\lst@DefRangeB@#1#2}
\def\lst@DefRangeB@#1#2#3#4{%
\lst@CDef{#1{#2}{#3}}#4{}%
{\lst@ifincluderangemarker
\lst@LeaveMode
\let#1#4%
\lst@DefRangeEnd
\global\c@lstnumber\lst@lineno
\global\advance\c@lstnumber-\lst@advancelstnum
\else
\@tempcnta\lst@lineno \advance\@tempcnta\@ne
\edef\lst@firstline{\the\@tempcnta\relax}%
\gdef\lst@OnceAtEOL{\let#1#4\lst@DefRangeEnd}%
\global\c@lstnumber\lst@lineno
\fi
\lst@CArgEmpty}%
\@empty}
%
% The end-marker is defined if and only if it's not empty. The definition is
% similar to \lst@DefDelimE---with the above exceptions and except that we
% define the re-entry point \lst@DefRangeE@@ as it is defined in the new
% version of \lst@MProcessListing above.
\def\lst@DefRangeEnd{%
\ifx\lst@rangeend\@empty\else
\expandafter\lst@CArgX\lst@rangeend\relax\lst@DefRangeE
\fi}
\def\lst@DefRangeE#1#2{\lst@DefRangeE@#1#2}
\def\lst@DefRangeE@#1#2#3#4{%
\lst@CDef{#1#2{#3}}#4{}%
{\let#1#4%
\edef\lst@lastline{\the\lst@lineno\relax}%
\lst@DefRangeE@@}%
\@empty}
\def\lst@DefRangeE@@#1\@empty{%
\lst@ifincluderangemarker
#1\lst@XPrintToken
\fi
\lst@LeaveModeToPmode
\lst@BeginDropInput{\lst@Pmode}}
%
\def\lst@LeaveModeToPmode{%
\ifnum\lst@mode=\lst@Pmode
\expandafter\lsthk@EndGroup
\else
\expandafter\egroup\expandafter\lst@LeaveModeToPmode
\fi}
%
% Eventually we shouldn't forget to install \lst@OnceAtEOL, which must
% also be called in \lst@MSkipToFirst.
\lst@AddToHook{EOL}{\lst@OnceAtEOL\global\let\lst@OnceAtEOL\@empty}
\gdef\lst@OnceAtEOL{}% Init
\def\lst@MSkipToFirst{%
\global\advance\lst@lineno\@ne
\ifnum \lst@lineno=\lst@firstline
\def\lst@next{\lst@LeaveMode \global\lst@newlines\z@
\lst@OnceAtEOL \global\let\lst@OnceAtEOL\@empty
\lsthk@InitVarsBOL
\lst@BOLGobble}%
\expandafter\lst@next
\fi}
\def\lst@SkipToFirst{%
\ifnum \lst@lineno<\lst@firstline
\def\lst@next{\lst@BeginDropInput\lst@Pmode
\lst@Let{13}\lst@MSkipToFirst
\lst@Let{10}\lst@MSkipToFirst}%
\expandafter\lst@next
\else
\expandafter\lst@BOLGobble
\fi}
%
% Finally the service macro \lst@IfNumber:
\def\lst@IfNumber#1{%
\ifx\@empty#1\@empty
\let\lst@next\@firstoftwo
\else
\lst@IfNumber@#1\@nil
\fi
\lst@next}
\def\lst@IfNumber@#1#2\@nil{%
\let\lst@next\@secondoftwo
\ifnum`#1>47\relax \ifnum`#1>57\relax\else
\let\lst@next\@firstoftwo
\fi\fi}
%
% b) Disable redefinition of output routine if necessary.
% 1) Switched from true to false as default.
\lst@Key{noxoutput}{false}[t]{\lstKV@SetIf{#1}\lst@ifnoxoutput}
\lst@AddToHook{Init}
{\lst@ifnoxoutput
\expandafter\output\expandafter{\lst@OrgOutput}%
\fi}
%%
\endinput
%%
%% End of file `lstpatch.sty'.