1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464
|
%%
%% 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'.
|