mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-15 09:39:25 +02:00
+ version 1.0 of listings package
This commit is contained in:
parent
b164a9ff9f
commit
2d4540d64b
docs/packages/listings
File diff suppressed because it is too large
Load Diff
@ -1,77 +1,95 @@
|
||||
%%
|
||||
%% Installation file: Listings package for LaTeX2e
|
||||
%% (w)(c) 1996-1998 Carsten Heinz
|
||||
%% This file generates files required to use the listings package.
|
||||
%% At your command prompt write
|
||||
%%
|
||||
\def\batchfile{listings.ins}
|
||||
%
|
||||
% just do these things
|
||||
%
|
||||
\input{docstrip}
|
||||
%% tex listings.ins
|
||||
%%
|
||||
%%
|
||||
%% (w)(c) 1996--1999,2002 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.
|
||||
%%
|
||||
%% This file is completely free and comes without any warranty.
|
||||
%%
|
||||
%% Permission is granted to change this file. You are not allowed to
|
||||
%% distribute any changed version of this file unless you rename it.
|
||||
%%
|
||||
\input docstrip
|
||||
\preamble
|
||||
\endpreamble
|
||||
|
||||
\usedir{tex/latex/listings}
|
||||
\keepsilent
|
||||
\askforoverwritefalse
|
||||
|
||||
|
||||
%
|
||||
% define the preamble
|
||||
%
|
||||
\preamble
|
||||
|
||||
(w)(c) 1996-1998 Carsten Heinz
|
||||
|
||||
Please read the software license in listings.dtx or listings.dvi.
|
||||
|
||||
This file is distributed freely. You are not allowed to take money for
|
||||
the distribution of this file, except for a nominal charge for copying
|
||||
etc..
|
||||
|
||||
This file is free for any non-commercial use. Commercial use needs (i)
|
||||
explicit permission of the author of this package and (ii) the payment
|
||||
of a license fee. This fee is to be determined in each instance by the
|
||||
commercial user and the package author and is to be payed as donation
|
||||
to the LaTeX3 project.
|
||||
|
||||
This file is distributed without any warranty, express or implied, as
|
||||
to merchantability or fitness for any particular purpose.
|
||||
|
||||
Permission is granted to change this file. You are not allowed to
|
||||
distribute any changed version this file, neither under the same name
|
||||
nor under a different one.
|
||||
|
||||
\endpreamble
|
||||
|
||||
|
||||
%
|
||||
% unpack the listings package
|
||||
% generate base package
|
||||
%
|
||||
\generate{
|
||||
\file{listings.sty} {\from{listings.dtx}{kernel}}
|
||||
\file{lst017.sty} {\from{listings.dtx}{0.17}}
|
||||
\file{lstfvrb.sty} {\from{listings.dtx}{fancyvrb}}
|
||||
}
|
||||
|
||||
|
||||
%
|
||||
% create installation and configuration file if lstdrvrs.dtx exists
|
||||
%
|
||||
\IfFileExists{lstdrvrs.dtx}{\generate{
|
||||
\file{listings.sty}{\from{listings.dtx}{kernel}}
|
||||
\file{lstmisc.sty}{\from{listings.dtx}{misc,0.21}}
|
||||
\file{lstdoc.sty}{\from{listings.dtx}{doc}}
|
||||
\file{lstdrvrs.ins}{\from{lstdrvrs.dtx}{install}}
|
||||
\file{listings.cfg}{\from{lstdrvrs.dtx}{config}}
|
||||
}}
|
||||
|
||||
}
|
||||
|
||||
%
|
||||
% unpack drivers if possible
|
||||
% generate dummy patch if necessary
|
||||
%
|
||||
\InputIfFileExists{lstdrvrs.ins}{}{}
|
||||
\newif\ifdummypatch
|
||||
\def\lstinsIfFileExists#1#2#3{% <filename><pre-input><post-input>
|
||||
\openin\inputcheck #1\relax
|
||||
\ifeof\inputcheck\else
|
||||
\closein\inputcheck
|
||||
#2%
|
||||
\@@input #1
|
||||
#3%
|
||||
\fi}
|
||||
\def\ProvidesFile#1[#2]{\def\lstpatch{#2}\endinput}
|
||||
\def\lstinsCheckVersion#1 #2{%
|
||||
\ifx #2v\dummypatchtrue \expandafter\lstinsGobbleNil \fi
|
||||
\afterassignment\lstinsCheckVersion@ \count\z@#2}
|
||||
\def\lstinsCheckVersion@.{%
|
||||
\afterassignment\lstinsGobbleNil \count\tw@}
|
||||
\def\lstinsGobbleNil#1\@nil{%
|
||||
\ifdummypatch\else
|
||||
\edef\patchversion{\the\count\z@.\the\count\tw@}%
|
||||
\ifx\lstversion\patchversion\else
|
||||
\dummypatchtrue
|
||||
\fi
|
||||
\fi}
|
||||
|
||||
\Msg{checking listings version ...}
|
||||
\lstinsIfFileExists{listings.sty}
|
||||
{\def\NeedsTeXFormat#1{\endinput}}
|
||||
{\let\lstversion\fileversion
|
||||
\lstinsIfFileExists{lstpatch.sty}%
|
||||
{\let\fileversion\@undefined}%
|
||||
{\ifx\fileversion\@undefined
|
||||
\expandafter\lstinsCheckVersion\lstpatch\@nil
|
||||
\fi}%
|
||||
}
|
||||
|
||||
\ifdummypatch
|
||||
\generate{\file{lstpatch.sty}{\from{listings.dtx}{patch}}}
|
||||
\fi
|
||||
|
||||
%
|
||||
% print user's advice
|
||||
% generate language driver files
|
||||
%
|
||||
\batchinput{lstdrvrs.ins}
|
||||
|
||||
|
||||
\Msg{*}
|
||||
\Msg{* Move all `.sty' and `.cfg' files into a folder searched by TeX.}
|
||||
\Msg{* You probably need to move all created `.sty' and `.cfg'}
|
||||
\Msg{* files into a directory searched by TeX.}
|
||||
\Msg{*}
|
||||
\Msg{* Run the `.dtx' file through LaTeX2e to get the documentation.}
|
||||
\Msg{* And don't forget to refresh your filename database}
|
||||
\Msg{* if your TeX distribution uses such a database.}
|
||||
\Msg{*}
|
||||
|
||||
\endinput
|
||||
\endbatchfile
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -6,89 +6,45 @@
|
||||
%%
|
||||
%% lstdrvrs.dtx (with options: `install')
|
||||
%%
|
||||
%% (w)(c) 1996-1998 Carsten Heinz
|
||||
%%
|
||||
%% Please read the software license in listings.dtx or listings.dvi.
|
||||
%%
|
||||
%% This file is distributed freely. You are not allowed to take money for
|
||||
%% the distribution of this file, except for a nominal charge for copying
|
||||
%% etc..
|
||||
%%
|
||||
%% This file is free for any non-commercial use. Commercial use needs (i)
|
||||
%% explicit permission of the author of this package and (ii) the payment
|
||||
%% of a license fee. This fee is to be determined in each instance by the
|
||||
%% commercial user and the package author and is to be payed as donation
|
||||
%% to the LaTeX3 project.
|
||||
%%
|
||||
%% This file is distributed without any warranty, express or implied, as
|
||||
%% to merchantability or fitness for any particular purpose.
|
||||
%%
|
||||
%% Permission is granted to change this file. You are not allowed to
|
||||
%% distribute any changed version this file, neither under the same name
|
||||
%% nor under a different one.
|
||||
%%
|
||||
\ifx\keepsilent\undefined %
|
||||
\input{docstrip}
|
||||
\keepsilent
|
||||
\askforoverwritefalse
|
||||
\fi
|
||||
\def\batchfile{lstdrvrs.ins}
|
||||
|
||||
%% (w)(c) 1996/1997/1998/1999/2000/2001/2002 Carsten Heinz and/or any
|
||||
%% other author listed elsewhere in this file.
|
||||
%%
|
||||
%% This file is distributed under the terms of the LaTeX Project Public
|
||||
%% License from CTAN archives in directory macros/latex/base/lppl.txt.
|
||||
%% Either version 1.0 or, at your option, any later version.
|
||||
%%
|
||||
%% This file is completely free and comes without any warranty.
|
||||
%%
|
||||
%% Send comments and ideas on the package, error reports and additional
|
||||
%% programming languages to <cheinz@gmx.de>.
|
||||
%%
|
||||
\input docstrip
|
||||
\preamble
|
||||
|
||||
(w)(c) 1996,1997,1998 Carsten Heinz and/or any other author mentioned
|
||||
elsewhere in this file.
|
||||
|
||||
This file is distributed freely. You are not allowed to take money for
|
||||
the use or distribution of this file, except for a nominal charge for
|
||||
copying etc..
|
||||
|
||||
This file is distributed without any warranty, express or implied, as
|
||||
to merchantability or fitness for any particular purpose.
|
||||
|
||||
Permission is granted to change this file. You are not allowed to
|
||||
distribute any changed version this file, neither under the same name
|
||||
nor under a different one.
|
||||
|
||||
\endpreamble
|
||||
|
||||
\generate{
|
||||
\file{lstalgol.sty} {\from{listings.dtx}{keywordcomments}
|
||||
\from{lstdrvrs.dtx}{algol}}
|
||||
\file{lstc.sty} {\from{listings.dtx}{c}
|
||||
\from{lstdrvrs.dtx}{c,objective-c,c++}}
|
||||
\file{lstperl.sty} {\from{listings.dtx}{perl}
|
||||
\from{lstdrvrs.dtx}{perl}}
|
||||
\file{lstsimula.sty} {\from{listings.dtx}{keywordcomments}
|
||||
\from{lstdrvrs.dtx}{simula}}
|
||||
\file{lsttex.sty} {\from{listings.dtx}{tex}
|
||||
\from{lstdrvrs.dtx}{tex}}
|
||||
\file{lstada.sty} {\from{lstdrvrs.dtx}{ada}}
|
||||
\file{lstcobol.sty} {\from{lstdrvrs.dtx}{cobol}}
|
||||
\file{lstedu.sty} {\from{lstdrvrs.dtx}{comal,elan,logo}}
|
||||
\file{lstcsh.sty} {\from{lstdrvrs.dtx}{csh}}
|
||||
\file{lstdelphi.sty} {\from{lstdrvrs.dtx}{delphi}}
|
||||
\file{lsteiffel.sty} {\from{lstdrvrs.dtx}{eiffel}}
|
||||
\file{lsteuphoria.sty}{\from{lstdrvrs.dtx}{euphoria}}
|
||||
\file{lstfortran.sty} {\from{lstdrvrs.dtx}{fortran}}
|
||||
\file{lsthtml.sty} {\from{lstdrvrs.dtx}{html}}
|
||||
\file{lstidl.sty} {\from{lstdrvrs.dtx}{idl}}
|
||||
\file{lstjava.sty} {\from{lstdrvrs.dtx}{java}}
|
||||
\ifToplevel{
|
||||
\usedir{tex/latex/listings}
|
||||
\keepsilent
|
||||
\askonceonly
|
||||
}
|
||||
|
||||
\generate{
|
||||
\file{lstlisp.sty} {\from{lstdrvrs.dtx}{lisp}}
|
||||
\file{lstmatlab.sty} {\from{lstdrvrs.dtx}{matlab}}
|
||||
\file{lstmercury.sty} {\from{lstdrvrs.dtx}{mercury}}
|
||||
\file{lstmodula.sty} {\from{lstdrvrs.dtx}{modula}}
|
||||
\file{lstoberon.sty} {\from{lstdrvrs.dtx}{oberon}}
|
||||
\file{lstpascal.sty} {\from{lstdrvrs.dtx}{pascal}}
|
||||
\file{lstpli.sty} {\from{lstdrvrs.dtx}{pli}}
|
||||
\file{lstprolog.sty} {\from{lstdrvrs.dtx}{prolog}}
|
||||
\file{lstsql.sty} {\from{lstdrvrs.dtx}{sql}}
|
||||
\file{lstvhdl.sty} {\from{lstdrvrs.dtx}{vhdl}}
|
||||
\file{lstlang1.sty}{\from{lstdrvrs.dtx}{lang1}}
|
||||
\file{lstlang2.sty}{\from{lstdrvrs.dtx}{lang2}}
|
||||
\file{lstlang3.sty}{\from{lstdrvrs.dtx}{lang3}}
|
||||
}
|
||||
\end
|
||||
|
||||
\ifToplevel{
|
||||
\Msg{*}
|
||||
\Msg{* You probably need to move all created `.sty' and `.cfg'}
|
||||
\Msg{* files into a directory searched by TeX.}
|
||||
\Msg{*}
|
||||
\Msg{* Run `lstdrvrs.dtx' through LaTeX2e to get the documentation.}
|
||||
\Msg{*}
|
||||
}
|
||||
|
||||
\endbatchfile
|
||||
[2002/07/31 v1.0d listings language file]
|
||||
\endinput
|
||||
%%
|
||||
%% End of file `lstdrvrs.ins'.
|
||||
|
@ -1,69 +1,464 @@
|
||||
%%
|
||||
%% 1998/11/23: First patch for listings.sty
|
||||
%%
|
||||
%% (c) 1998 Carsten Heinz
|
||||
%%
|
||||
\def\lstlanguage@[#1]#2{%
|
||||
\lst@LocateLanguage[#1]{#2}%
|
||||
\@ifundefined{\lst@requested}%
|
||||
{{\catcode`\^^M=9\catcode`\"=12\makeatletter %
|
||||
\input{\lst@driver.sty}}}{}%
|
||||
\@ifundefined{\lst@requested}%
|
||||
{\PackageError{Listings}%
|
||||
{\ifx\@empty\lst@dialect@\else \lst@dialect@\space of \fi %
|
||||
\lst@language@\space undefined}{The driver file is not
|
||||
loadable or doesn't support the language.^^J%
|
||||
Type <RETURN> to proceed without changing the language.}}%
|
||||
{\lsthk@SetLanguage %
|
||||
\csname\lst@requested\endcsname %
|
||||
%% modification of
|
||||
% \def\lst@language{#1}\lst@Normalize\lst@language %
|
||||
% \def\lst@dialect{#2}\lst@Normalize\lst@dialect}}
|
||||
\def\lst@language{#2}\lst@Normalize\lst@language %
|
||||
\def\lst@dialect{#1}\lst@Normalize\lst@dialect}}
|
||||
%% end modification
|
||||
%
|
||||
%% load .fd files
|
||||
\lst@AddToHook{BeforeSelectCharTable}
|
||||
{\setbox\@tempboxa\hbox{\lst@labelstyle \lst@loadfd}}
|
||||
%% end load .fd files
|
||||
%
|
||||
%% move \let\lst@lastother\relax to end of macros
|
||||
\def\lst@Output{%
|
||||
\ifnum\lst@length=\z@\else %
|
||||
\lst@NewLine \lst@UseLostSpace %
|
||||
\hbox to \lst@length\lst@width{%
|
||||
\lst@lefthss %
|
||||
\lsthk@Output \lst@thestyle{%
|
||||
\expandafter\lst@FillOutputBox\the\lst@token\relax}%
|
||||
\lst@righthss}%
|
||||
\global\advance\lst@pos -\lst@length %
|
||||
\lst@token{}\lst@length\z@ %
|
||||
\fi %
|
||||
\let\lst@lastother\relax}
|
||||
\def\lst@OutputFlexible{%
|
||||
\ifnum\lst@length=\z@\else %
|
||||
\lst@NewLine \lst@UseLostSpace %
|
||||
\setbox\@tempboxa\hbox{%
|
||||
\lsthk@Output \lst@thestyle{\the\lst@token}}%
|
||||
\lst@CalcLostSpaceAndOutput %
|
||||
\fi %
|
||||
\let\lst@lastother\relax}
|
||||
%% end move \let\lst@lastother\relax to end of macros
|
||||
%
|
||||
%% correct bug of \lst@Aspect{texcs}{\def\lst@texcs{#1}}
|
||||
\let\lstS@Aspect\lst@Aspect
|
||||
\def\lst@Aspect#1{\def\@tempa{#1}\def\@tempb{texcs}%
|
||||
\ifx\@tempa\@tempb %
|
||||
\expandafter\lst@AspectTeX %
|
||||
\fi %
|
||||
\lstS@Aspect{#1}}
|
||||
\def\lst@AspectTeX#1#2#3{%
|
||||
\@ifundefined{KV@lst@#2}%
|
||||
{\let\lst@ifnew\iftrue}{\let\lst@ifnew\iffalse}%
|
||||
\lst@ifnew %
|
||||
\else %
|
||||
\expandafter\@gobblefour %
|
||||
\fi %
|
||||
\lstdefine@key{lst}{#2}{\edef\lst@texcs{##1}}}
|
||||
%% end correct bug of \lst@Aspect{texcs}{\def\lst@texcs{#1}}
|
||||
%%
|
||||
%% This is file `lstpatch.sty', generated manually.
|
||||
%%
|
||||
%% Please read the software license in listings.dtx or listings.dvi.
|
||||
%%
|
||||
%% (w)(c) 2002 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) Jochen Schneider, 2002/04/03, 1.0a (2002/04/05)
|
||||
%%
|
||||
%% undefined control sequence \lst@CommentB with HTML, XML, tcl
|
||||
%% (I didn't renamed them to \lst@DefDelimB|E)
|
||||
%%
|
||||
%% 2) Michael Niedermair, 2002/04/07, 1.0b
|
||||
%%
|
||||
%% undefined control sequence \lst@commentmode with XML
|
||||
%% (mode not defined any more)
|
||||
%%
|
||||
%% 3) Carsten Heinz, 2002/04/08, 1.0b
|
||||
%%
|
||||
%% bad PODs (investigating bugs 1 and 2)
|
||||
%% (definition doesn't use 1.0 style)
|
||||
%%
|
||||
%% 4) Peter Bartke, 2002/04/10, 1.0b
|
||||
%%
|
||||
%% various problems with fancyvrb interface: string ".5" at beginning
|
||||
%% of first line when using lineskip; ditto "perhaps a missing \item
|
||||
%% error"; wrong placed characters , and - when using fancyvrb
|
||||
%% (bad use of \strip@pt; TeX is not in vertical mode when leaving
|
||||
%% Verbatim; bad `noligs' handling)
|
||||
%%
|
||||
%% 5) Rolf Niepraschk, 2002/04/12, 1.0b
|
||||
%%
|
||||
%% \RequirePackage is missing keywordstyle when near the top of a page
|
||||
%% (\lst@lastother not saved away across page breaks)
|
||||
%%
|
||||
%% 6) Peter Ruckdeschel, 2002/04/12, 1.0b
|
||||
%% Timothy Van Zandt analyzed and fixed the bug
|
||||
%%
|
||||
%% incompatibility with seminar class
|
||||
%% (bad assignment of \lst@do@noligs in \lst@SelectCharTable)
|
||||
%%
|
||||
%% 7) Rene H. Larsen, 2002/04/12, 1.0b
|
||||
%%
|
||||
%% \lstinputlistings and texcl conflict
|
||||
%% (^^M not active to reenter modes)
|
||||
%%
|
||||
%% 8) Carsten Heinz, 2002/04/15, 1.0b (2002/04/15)
|
||||
%%
|
||||
%% gobble doesn't always work (investigating problem with VTeX)
|
||||
%% (\lst@BOLGobble@ must test against \lst@Process{FormFeed|Tabulator}X)
|
||||
%%
|
||||
%% 9) Peter Bartke, 2002/04/17, 1.0c
|
||||
%%
|
||||
%% TeX capacity exceeded with fancyvrb
|
||||
%% (\let\lst@entermodes\@empty must stay in \lstFV@VerbatimBegin)
|
||||
%%
|
||||
%% 10) Svend Tollak Munkejord, 2002/04/17, 1.0c
|
||||
%% Heiko Oberdiek analyzed and fixed the bug
|
||||
%%
|
||||
%% package incompatible with Lucida .fd files
|
||||
%% (parentheses have active catcodes when reading the file)
|
||||
%%
|
||||
%% 11) Carsten Hamm, 2002/04/19, 1.0c (2002/04/24)
|
||||
%%
|
||||
%% wrong frame rules with breaklines and xleftmargin>0pt
|
||||
%% (missing \kern-\lst@xleftmargin in \lst@discretionary)
|
||||
%%
|
||||
%% 12) Michael Niedermair, 2002/05/14, 1.0d
|
||||
%%
|
||||
%% backgroundcolor take effect on bottom captions
|
||||
%% (wrong order of \everypar{} and \lsthk@ExitVars in \lst@DeInit)
|
||||
%%
|
||||
%% 13) Georg Rehm, 2002/05/14, 1.0d
|
||||
%%
|
||||
%% bad baselineskip with captionpos=b
|
||||
%% (missing \normalbaselines)
|
||||
%%
|
||||
%% 14) Herfried Karl Wagner, 2002/05/11, 1.0d
|
||||
%%
|
||||
%% undefined control sequence \lst@entermodes
|
||||
%% (\output called before first \lst@EnterMode)
|
||||
%%
|
||||
%% 15) Peter K\"oller, 2002/05/24, 1.0d
|
||||
%%
|
||||
%% XML keywords don't have keywordstyle
|
||||
%% (missing \ifx... in implementation of contentsstyle)
|
||||
%%
|
||||
%% 16) Stephen Reindl, 2002/05/28, 1.0d
|
||||
%%
|
||||
%% \inaccessible using Cobol
|
||||
%% (\lst@Delim@option didn't enclose option in [])
|
||||
%%
|
||||
%% 17) Stephen Reindl, 2002/06/04, 1.0d (2002/06/12)
|
||||
%%
|
||||
%% frames not deactivated for text style listings
|
||||
%%
|
||||
%% 18) Carsten Heinz, 2002/07/27, 1.0e (2002/07/31)
|
||||
%%
|
||||
%% broken keywordcomments
|
||||
%% (\lst@KCpost inside group level 2; bad \lst@BeginComment call)
|
||||
%%
|
||||
%% 19) Kris Luyten, 2002/07/30, 1.0f (2002/08/03)
|
||||
%%
|
||||
%% Undefined control sequence \lst@thestyle
|
||||
%% (undefined \lst@directives after _loading_ C)
|
||||
%%
|
||||
%% 20) Kris Luyten, 2002/08/03, 1.0g (2002/08/06)
|
||||
%%
|
||||
%% Undefined control sequence \lst@thestyle
|
||||
%% (side effect of 19-bugfix on \lst@ProvideFamily)
|
||||
%%
|
||||
%% 21) Venkatesh Prasad Ranganath, 2002/08/31, 1.0h
|
||||
%%
|
||||
%% Undefined control sequence \thelstnumber with 0.21-option
|
||||
%% (\let must be changed to a \def inition)
|
||||
%%
|
||||
%% 22) Fermin Reig, 2002/09/04, 1.0h (2002/09/09)
|
||||
%%
|
||||
%% Bad top frame inside figure+centering
|
||||
%% (reset of leftskip, rightskip and parfillskip comes too late)
|
||||
%%
|
||||
%% 23) Hermann H\"uttler, 2002/10/05, 1.0i (2002/10/13)
|
||||
%%
|
||||
%% C++-string "... \\" does not end with second double quote
|
||||
%% (missing \let\lst@lastother\@empty in old fix)
|
||||
%%
|
||||
%%
|
||||
%% Moreover the following functionality is added.
|
||||
%%
|
||||
%% a) option "final" (Rolf Niepraschk, Enrico Straube)
|
||||
%%
|
||||
%% b) keys "fvcmdparams" and "morefvcmdparams" (Denis Girou)
|
||||
%%
|
||||
%% c) key "contentstyle" (Peter K\"oller)
|
||||
%%
|
||||
%% d) key "numberfirstline" (Georg Rehm)
|
||||
%%
|
||||
%%
|
||||
\ProvidesFile{lstpatch.sty}[2002/10/13 1.0i (Carsten Heinz)]
|
||||
\lst@CheckVersion{1.0}
|
||||
{\typeout{^^J%
|
||||
***^^J%
|
||||
*** This is a patch for `listings.sty' version 1.0, but^^J%
|
||||
*** you're using version \lst@version.^^J%
|
||||
***^^J
|
||||
*** Patch file not loaded.^^J%
|
||||
***^^J}%
|
||||
\endinput
|
||||
}
|
||||
%
|
||||
% 1) Define the missing control sequences. (Not needed any more.)
|
||||
\def\lstpatch@comments{%
|
||||
\global\let\lst@CommentB\lst@DefDelimB
|
||||
\global\let\lst@CommentE\lst@DefDelimE}
|
||||
%
|
||||
% 2) Define \lst@commentmode.
|
||||
\lst@NewMode\lst@commentmode
|
||||
%
|
||||
% 3) Introduce \lst@ifxpodcomment as master-clause and define 1.0 style
|
||||
% contents for SelectCharTable.
|
||||
\def\lstpatch@pod{%
|
||||
\lst@Key{podcomment}{false}[t]{\lstKV@SetIf{##1}\lst@ifxpodcomment}%
|
||||
\lst@AddToHookExe{SetLanguage}{\let\lst@ifxpodcomment\iffalse}%
|
||||
\lst@AddToHook{SelectCharTable}%
|
||||
{\lst@ifxpodcomment
|
||||
\lst@CArgX =\relax\lst@DefDelimB{}{}%
|
||||
{\ifnum\@tempcnta=\z@
|
||||
\lst@ifprintpod\else
|
||||
\def\lst@bnext{\lst@BeginDropOutput\lst@PODmode}%
|
||||
\expandafter\expandafter\expandafter\@gobblethree
|
||||
\fi
|
||||
\else
|
||||
\expandafter\@gobblethree
|
||||
\fi}%
|
||||
\lst@BeginComment\lst@PODmode{{\lst@commentstyle}}% modified
|
||||
\lst@CArgX =cut\^^M\relax\lst@DefDelimE
|
||||
{\lst@CalcColumn}%
|
||||
{\ifnum\@tempcnta=\z@\else
|
||||
\expandafter\@gobblethree
|
||||
\fi}%
|
||||
{}%
|
||||
\lst@EndComment\lst@PODmode
|
||||
\fi}%
|
||||
}
|
||||
%
|
||||
% 4) Redefine lineskip like podcomment above and don't use \strip@pt
|
||||
% together with \divide.
|
||||
\def\lstpatch@lineshape{%
|
||||
\lst@Key{lineskip}{\z@}{\def\lst@xlineskip{##1\relax}}
|
||||
\lst@AddToHook{Init}
|
||||
{\ifdim\z@=\lst@xlineskip\else
|
||||
\@tempdima\baselineskip
|
||||
\advance\@tempdima\lst@xlineskip
|
||||
\multiply\@tempdima\@cclvi
|
||||
\divide\@tempdima\baselineskip\relax
|
||||
\multiply\@tempdima\@cclvi
|
||||
\edef\baselinestretch{\strip@pt\@tempdima}%
|
||||
\selectfont
|
||||
\fi}%
|
||||
% 11) Add \kern-\lst@xleftmargin.
|
||||
\gdef\lst@discretionary{%
|
||||
\discretionary{\let\space\lst@spacekern\lst@prebreak}%
|
||||
{\llap{\lsthk@EveryLine
|
||||
\kern\lst@breakcurrindent\kern-\lst@xleftmargin}%
|
||||
\let\space\lst@spacekern\lst@postbreak}{}}%
|
||||
}
|
||||
% Back to 4): Insert \par for vertical mode.
|
||||
\def\lstpatch@fancyvrb{%
|
||||
\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
|
||||
\par % modified
|
||||
\fi}%
|
||||
% 9) Redefined \lstFV@VerbatimBegin removed.
|
||||
% b) Refine conversion definitions to either work as usual or to ...
|
||||
\gdef\lst@FVConvert{\@tempcnta\z@ \lst@FVConvertO@}%
|
||||
\gdef\lst@FVConvertO@{%
|
||||
\ifcase\@tempcnta \expandafter
|
||||
\futurelet\expandafter\@let@token\expandafter\lst@FVConvert@@
|
||||
\else
|
||||
% append arguments as they are.
|
||||
\expandafter\lst@FVConvertO@a
|
||||
\fi}%
|
||||
\gdef\lst@FVConvertO@a##1{%
|
||||
\lst@lAddTo\lst@arg{{##1}}\advance\@tempcnta\m@ne
|
||||
\lst@FVConvertO@}%
|
||||
% Here, ...
|
||||
\gdef\lst@FVConvert@##1{%
|
||||
\ifx \@nil##1\else
|
||||
\if\relax\noexpand##1%
|
||||
\lst@lAddTo\lst@arg{\lst@OutputLostSpace\lst@PrintToken##1}%
|
||||
% ... actually here, we check for commands with arguments and set the
|
||||
% value of \@tempcnta as required.
|
||||
\def\lst@temp####1,##1####2,####3####4\relax{%
|
||||
\ifx####3\@empty \else \@tempcnta####2\relax \fi}%
|
||||
\expandafter\lst@temp\lst@FVcmdparams,##1\z@,\@empty\relax
|
||||
\else
|
||||
\lccode`\~=`##1\lowercase{\lst@lAddTo\lst@arg~}%
|
||||
\fi
|
||||
\expandafter\lst@FVConvertO@
|
||||
\fi}
|
||||
% Eventually we define user keys to adjust \lst@FVcmdparams. The base
|
||||
% set of commands and parameter numbers was provided by Denis Girou.
|
||||
\lst@Key{fvcmdparams}%
|
||||
% D.G. suggestion begin - 2002/05/31
|
||||
{\overlay\@ne}%
|
||||
% D.G. suggestion end
|
||||
{\def\lst@FVcmdparams{,##1}}%
|
||||
\lst@Key{morefvcmdparams}\relax{\lst@lAddTo\lst@FVcmdparams{,##1}}%
|
||||
}
|
||||
%
|
||||
% 5) Extend \lst@SaveToken to save \lst@lastother.
|
||||
\def\lst@SaveToken{%
|
||||
\global\let\lst@gthestyle\lst@thestyle
|
||||
\global\let\lst@glastother\lst@lastother
|
||||
\xdef\lst@RestoreToken{\noexpand\lst@token{\the\lst@token}%
|
||||
\noexpand\lst@length\the\lst@length\relax
|
||||
\noexpand\let\noexpand\lst@thestyle
|
||||
\noexpand\lst@gthestyle
|
||||
\noexpand\let\noexpand\lst@lastother
|
||||
\noexpand\lst@glastother}%
|
||||
}
|
||||
%
|
||||
% 6) Assign \lst@do@noligs to \do.
|
||||
\def\lst@SelectCharTable{%
|
||||
\lst@SelectStdCharTable
|
||||
\lst@ifactivechars
|
||||
\catcode9\active \catcode12\active \catcode13\active
|
||||
\@tempcnta=32\relax
|
||||
\@whilenum\@tempcnta<128\do
|
||||
{\catcode\@tempcnta\active\advance\@tempcnta\@ne}%
|
||||
\fi
|
||||
\lst@ifec \lst@DefEC \fi
|
||||
\let\do\lst@do@noligs \verbatim@nolig@list % modified
|
||||
\lsthk@SelectCharTable
|
||||
\lst@DeveloperSCT
|
||||
\ifx\lst@Backslash\relax\else
|
||||
\lst@LetSaveDef{"5C}\lsts@backslash\lst@Backslash
|
||||
\fi}
|
||||
% 4)+6) And we need correct versions of \lst@do@noligs[@].
|
||||
\def\lst@do@noligs#1{%
|
||||
\begingroup \lccode`\~=`#1\lowercase{\endgroup
|
||||
\lst@do@noligs@~}}
|
||||
\def\lst@do@noligs@#1{%
|
||||
\expandafter\expandafter\expandafter\def
|
||||
\expandafter\expandafter\expandafter#1%
|
||||
\expandafter\expandafter\expandafter{\expandafter\lst@NoLig#1}}
|
||||
%
|
||||
% 7) Make ^^M active.
|
||||
\def\lst@InputListing#1{%
|
||||
\begingroup
|
||||
\lsthk@PreSet \gdef\lst@intname{#1}%
|
||||
\expandafter\lstset\expandafter{\lst@set}%
|
||||
\lsthk@DisplayStyle
|
||||
\catcode\active=\active % added
|
||||
\lst@Init\relax \let\lst@gobble\z@
|
||||
\lst@SkipToFirst
|
||||
\lst@ifprint \def\lst@next{\input{#1}}%
|
||||
\else \let\lst@next\@empty \fi
|
||||
\lst@next
|
||||
\lst@DeInit
|
||||
\endgroup}
|
||||
%
|
||||
% 8) Replace \lst@Process{FormFeed|Tabulator}.
|
||||
\def\lst@ProcessFormFeedX{\lst@ProcessFormFeed}
|
||||
\def\lst@ProcessTabulatorX{\lst@ProcessTabulator}
|
||||
\def\lst@BOLGobble@#1{%
|
||||
\let\lst@next#1%
|
||||
\ifx \lst@next\relax\else
|
||||
\ifx \lst@next\lst@MProcessListing\else
|
||||
\ifx \lst@next\lst@ProcessFormFeedX\else
|
||||
\ifx \lst@next\lstenv@backslash
|
||||
\let\lst@next\lstenv@BOLGobble@@
|
||||
\else
|
||||
\let\lst@next\lst@BOLGobble@@
|
||||
\ifx #1\lst@ProcessTabulatorX
|
||||
\advance\@tempcnta-\lst@tabsize\relax
|
||||
\ifnum\@tempcnta<\z@
|
||||
\lst@length-\@tempcnta \lst@PreGotoTabStop
|
||||
\fi
|
||||
\else
|
||||
\advance\@tempcnta\m@ne
|
||||
\fi
|
||||
\fi \fi \fi \fi
|
||||
\lst@next}
|
||||
%
|
||||
% 10) Add some \@makeother to \lst@nfss@catcodes.
|
||||
\def\lst@nfss@catcodes{%
|
||||
\lst@makeletter
|
||||
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\relax
|
||||
\@makeother (\@makeother )\@makeother ,\@makeother :\@makeother &%
|
||||
\@makeother 0\@makeother 1\@makeother 2\@makeother 3\@makeother 4%
|
||||
\@makeother 5\@makeother 6\@makeother 7\@makeother 8\@makeother 9%
|
||||
\@makeother =\lsts@nfss@catcodes}
|
||||
%
|
||||
% 12) and 13) Deactivate \everypar and use normal baseline parameters.
|
||||
\lst@AddToHook{DeInit}{\everypar{}\normalbaselines}
|
||||
%
|
||||
% 14) Define \lst@entermodes.
|
||||
\let\lst@entermodes\@empty
|
||||
%
|
||||
% 16) Insert [ and ] in replacement text.
|
||||
\def\lst@Delim@option[#1]{\def\lst@arg{[#1]}\lst@Delim@delim}
|
||||
%
|
||||
% 17) Just empty `frame' and top, right, bottom, and left shape.
|
||||
\lst@AddToHook{TextStyle}
|
||||
{\let\lst@frame\@empty
|
||||
\let\lst@frametshape\@empty
|
||||
\let\lst@framershape\@empty
|
||||
\let\lst@framebshape\@empty
|
||||
\let\lst@framelshape\@empty}
|
||||
%
|
||||
% 18) Execute \lst@BeginKC and \lst@BeginKCS outside the two groups.
|
||||
% Modify third argument to \lst@BeginComment to work properly.
|
||||
\def\lstpatch@keywordcomments{%
|
||||
\gdef\lst@BeginKC{\aftergroup\aftergroup\aftergroup\lst@BeginKC@}%
|
||||
\gdef\lst@BeginKC@{%
|
||||
\lst@ResetToken
|
||||
\lst@BeginComment\lst@KCmode{{\lst@commentstyle}\lst@modetrue}\@empty}%
|
||||
\gdef\lst@BeginKCS{\aftergroup\aftergroup\aftergroup\lst@BeginKCS@}%
|
||||
\gdef\lst@BeginKCS@{%
|
||||
\lst@ResetToken
|
||||
\lst@BeginComment\lst@KCSmode{{\lst@commentstyle}\lst@modetrue}\@empty}%
|
||||
\gdef\lst@EndKC{\lst@SaveToken \lst@LeaveMode \lst@RestoreToken
|
||||
\let\lst@thestyle\lst@identifierstyle \lsthk@Output}% renew style selection
|
||||
}
|
||||
%
|
||||
% 19) Init \lst@directives.
|
||||
\def\lstpatch@directives{%
|
||||
\global\let\lst@directives\@empty}
|
||||
%
|
||||
% 20) Use new prefix for a family -- the now initialized \lst@directives
|
||||
% clashes with the default.
|
||||
\def\lstpatch@keywords{%
|
||||
\gdef\lst@ProvideFamily##1{%
|
||||
\@ifundefined{lstfam@##1\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}%
|
||||
{\@namedef{lstfam@##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}}%
|
||||
{}}%
|
||||
}
|
||||
% 21) Define \thelstnumber every listing via \def.
|
||||
\@namedef{lstpatch@021}{%
|
||||
\lst@AddToHook{Init}{\def\thelstnumber{\thelstlabel}}%
|
||||
}
|
||||
% 22) Reset the registers in PreInit hook
|
||||
\lst@AddToHook{PreInit}
|
||||
{\rightskip\z@ \leftskip\z@ \parfillskip\z@ plus 1fil}
|
||||
%
|
||||
% 23) Add \let\lst@lastother\@empty
|
||||
\lst@AddToHook{SelectCharTable}{%
|
||||
\lst@ifbstring
|
||||
\lst@CArgX \\\\\relax \lst@CDefX{}%
|
||||
{\lst@ProcessOther\lstum@backslash
|
||||
\lst@ProcessOther\lstum@backslash
|
||||
\let\lst@lastother\@empty}%
|
||||
{}%
|
||||
\fi}
|
||||
%
|
||||
% a) Just declare the option.
|
||||
\DeclareOption{final}{\let\lst@ifdraft\iffalse}
|
||||
%
|
||||
% c) Define contentstyle and use it.
|
||||
\def\lstpatch@html{%
|
||||
\lst@Key{contentstyle}{}{\def\lst@contentstyle{##1}}%
|
||||
\lst@AddToHook{Init}%
|
||||
{\ifx\lst@DefInside\@empty\else
|
||||
\let\lst@tagstyle\lst@identifierstyle
|
||||
\let\lst@identifierstyle\lst@contentstyle
|
||||
\fi}%
|
||||
\lst@AddToHook{Output}%
|
||||
{\ifnum\lst@mode=\lst@insidemode
|
||||
% 15) Check for keywordstyle.
|
||||
\ifx\lst@thestyle\lst@gkeywords@sty\else
|
||||
\lst@ifusekeysinside \let\lst@thestyle\lst@tagstyle
|
||||
\else \let\lst@thestyle\lst@gkeywords@sty \fi
|
||||
\fi\fi}%
|
||||
\lst@AddToHook{OutputOther}%
|
||||
{\lst@ifmode\else \ifnum\lst@mode=\lst@insidemode\else
|
||||
\ifx\lst@DefInside\@empty\else
|
||||
\let\lst@thestyle\lst@contentstyle
|
||||
\fi
|
||||
\fi\fi}%
|
||||
}
|
||||
%
|
||||
% d) Define key and adjust \lst@SkipOrPrintLabel.
|
||||
\def\lstpatch@labels{%
|
||||
\lst@Key{numberfirstline}{f}[t]{\lstKV@SetIf{##1}\lst@ifnumberfirstline}%
|
||||
\gdef\lst@numberfirstlinefalse{\let\lst@ifnumberfirstline\iffalse}
|
||||
\gdef\lst@SkipOrPrintLabel{%
|
||||
\ifnum\lst@skipnumbers=\z@
|
||||
\global\advance\lst@skipnumbers-\lst@stepnumber\relax
|
||||
\lst@PlaceNumber
|
||||
\lst@numberfirstlinefalse
|
||||
\else
|
||||
\lst@ifnumberfirstline
|
||||
\lst@PlaceNumber
|
||||
\lst@numberfirstlinefalse
|
||||
\fi
|
||||
\fi
|
||||
\global\advance\lst@skipnumbers\@ne}%
|
||||
}
|
||||
%%
|
||||
\endinput
|
||||
%%
|
||||
%% End of file `lstpatch.sty'.
|
Loading…
Reference in New Issue
Block a user