| 1 |
%% |
| 2 |
%% This is file `listings.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% listings.dtx (with options: `kernel') |
| 8 |
%% |
| 9 |
%% Please read the software license in listings.dtx or listings.pdf. |
| 10 |
%% |
| 11 |
%% (w)(c) 1996--2004 Carsten Heinz and/or any other author listed |
| 12 |
%% elsewhere in this file. |
| 13 |
%% (c) 2006 Brooks Moses |
| 14 |
%% (c) 2013- Jobst Hoffmann |
| 15 |
%% |
| 16 |
%% Send comments and ideas on the package, error reports and additional |
| 17 |
%% programming languages to Jobst Hoffmann at <[email protected]>. |
| 18 |
%% |
| 19 |
\def\filedate{2025/11/14} |
| 20 |
\def\fileversion{1.11b} |
| 21 |
\NeedsTeXFormat{LaTeX2e} |
| 22 |
\AtEndOfPackage{\ProvidesPackage{listings} |
| 23 |
[\filedate\space\fileversion\space(Carsten Heinz)]} |
| 24 |
\def\lst@CheckVersion#1{\edef\reserved@a{#1}% |
| 25 |
\ifx\lst@version\reserved@a \expandafter\@gobble |
| 26 |
\else \expandafter\@firstofone \fi} |
| 27 |
\let\lst@version\fileversion |
| 28 |
\def\lst@InputCatcodes{% |
| 29 |
\makeatletter \catcode`\"12% |
| 30 |
\catcode`\^^@\active |
| 31 |
\catcode`\^^I9% |
| 32 |
\catcode`\^^L9% |
| 33 |
\catcode`\^^M9% |
| 34 |
\catcode`\%14% |
| 35 |
\catcode`\~\active} |
| 36 |
\def\lst@RestoreCatcodes#1{% |
| 37 |
\ifx\relax#1\else |
| 38 |
\noexpand\catcode`\noexpand#1\the\catcode`#1\relax |
| 39 |
\expandafter\lst@RestoreCatcodes |
| 40 |
\fi} |
| 41 |
\edef\lst@RestoreCatcodes{% |
| 42 |
\lst@RestoreCatcodes\"\^^I\^^M\~\^^@\relax |
| 43 |
\catcode12\active} |
| 44 |
\lst@InputCatcodes |
| 45 |
\AtEndOfPackage{\lst@RestoreCatcodes} |
| 46 |
\def\@lst{lst} |
| 47 |
\def\lst@IfSubstring#1#2{% |
| 48 |
\def\lst@temp##1#1##2##3\relax{% |
| 49 |
\ifx \@empty##2\expandafter\@secondoftwo |
| 50 |
\else \expandafter\@firstoftwo \fi}% |
| 51 |
\expandafter\lst@temp#2#1\@empty\relax} |
| 52 |
\def\lst@IfOneOf#1\relax#2{% |
| 53 |
\def\lst@temp##1,#1,##2##3\relax{% |
| 54 |
\ifx \@empty##2\expandafter\@secondoftwo |
| 55 |
\else \expandafter\@firstoftwo \fi}% |
| 56 |
\expandafter\lst@temp\expandafter,#2,#1,\@empty\relax} |
| 57 |
\def\lst@DeleteKeysIn#1#2{% |
| 58 |
\expandafter\lst@DeleteKeysIn@\expandafter#1#2,\relax,} |
| 59 |
\def\lst@DeleteKeysIn@#1#2,{% |
| 60 |
\ifx\relax#2\@empty |
| 61 |
\expandafter\@firstoftwo\expandafter\lst@RemoveCommas |
| 62 |
\else |
| 63 |
\ifx\@empty#2\@empty\else |
| 64 |
\def\lst@temp##1,#2,##2{% |
| 65 |
##1% |
| 66 |
\ifx\@empty##2\@empty\else |
| 67 |
\expandafter\lst@temp\expandafter,% |
| 68 |
\fi ##2}% |
| 69 |
\edef#1{\expandafter\lst@temp\expandafter,#1,#2,\@empty}% |
| 70 |
\fi |
| 71 |
\fi |
| 72 |
\lst@DeleteKeysIn@#1} |
| 73 |
\def\lst@RemoveCommas#1{\edef#1{\expandafter\lst@RC@#1\@empty}} |
| 74 |
\def\lst@RC@#1{\ifx,#1\expandafter\lst@RC@ \else #1\fi} |
| 75 |
\def\lst@ReplaceIn#1#2{% |
| 76 |
\expandafter\lst@ReplaceIn@\expandafter#1#2\@empty\@empty} |
| 77 |
\def\lst@ReplaceInArg#1#2{\lst@ReplaceIn@#1#2\@empty\@empty} |
| 78 |
\def\lst@ReplaceIn@#1#2#3{% |
| 79 |
\ifx\@empty#3\relax\else |
| 80 |
\def\lst@temp##1#2##2{% |
| 81 |
\ifx\@empty##2% |
| 82 |
\lst@lAddTo#1{##1}% |
| 83 |
\else |
| 84 |
\lst@lAddTo#1{##1#3}\expandafter\lst@temp |
| 85 |
\fi ##2}% |
| 86 |
\let\@tempa#1\let#1\@empty |
| 87 |
\expandafter\lst@temp\@tempa#2\@empty |
| 88 |
\expandafter\lst@ReplaceIn@\expandafter#1% |
| 89 |
\fi} |
| 90 |
\providecommand*\@gobblethree[3]{} |
| 91 |
\def\lst@GobbleNil#1\@nil{} |
| 92 |
\def\lst@Swap#1#2{#2#1} |
| 93 |
\def\lst@true{\let\lst@if\iftrue} |
| 94 |
\def\lst@false{\let\lst@if\iffalse} |
| 95 |
\lst@false |
| 96 |
\def\lst@IfNextCharsArg#1{% |
| 97 |
\def\lst@tofind{#1}\lst@IfNextChars\lst@tofind} |
| 98 |
\def\lst@IfNextChars#1#2#3{% |
| 99 |
\let\lst@tofind#1\def\@tempa{#2}\def\@tempb{#3}% |
| 100 |
\let\lst@eaten\@empty \lst@IfNextChars@} |
| 101 |
\def\lst@IfNextChars@{\expandafter\lst@IfNextChars@@\lst@tofind\relax} |
| 102 |
\def\lst@IfNextChars@@#1#2\relax#3{% |
| 103 |
\def\lst@tofind{#2}\lst@lAddTo\lst@eaten{#3}% |
| 104 |
\ifx#1#3% |
| 105 |
\ifx\lst@tofind\@empty |
| 106 |
\let\lst@next\@tempa |
| 107 |
\else |
| 108 |
\let\lst@next\lst@IfNextChars@ |
| 109 |
\fi |
| 110 |
\expandafter\lst@next |
| 111 |
\else |
| 112 |
\expandafter\@tempb |
| 113 |
\fi} |
| 114 |
\def\lst@IfNextCharActive#1#2#3{% |
| 115 |
\begingroup \lccode`\~=`#3\lowercase{\endgroup |
| 116 |
\ifx~}#3% |
| 117 |
\def\lst@next{#1}% |
| 118 |
\else |
| 119 |
\def\lst@next{#2}% |
| 120 |
\fi \lst@next #3} |
| 121 |
\def\lst@for#1\do#2{% |
| 122 |
\def\lst@forbody##1{#2}% |
| 123 |
\def\@tempa{#1}% |
| 124 |
\ifx\@tempa\@empty\else\expandafter\lst@f@r#1,\@nil,\fi |
| 125 |
} |
| 126 |
\def\lst@f@r#1,{% |
| 127 |
\def\@tempa{#1}% |
| 128 |
\ifx\@tempa\@nnil\else\lst@forbody{#1}\expandafter\lst@f@r\fi |
| 129 |
} |
| 130 |
\def\lst@MakeActive#1{% |
| 131 |
\let\lst@temp\@empty \lst@MakeActive@#1% |
| 132 |
\relax\relax\relax\relax\relax\relax\relax\relax\relax} |
| 133 |
\begingroup |
| 134 |
\catcode`\^^@=\active \catcode`\^^A=\active \catcode`\^^B=\active |
| 135 |
\catcode`\^^C=\active \catcode`\^^D=\active \catcode`\^^E=\active |
| 136 |
\catcode`\^^F=\active \catcode`\^^G=\active \catcode`\^^H=\active |
| 137 |
\gdef\lst@MakeActive@#1#2#3#4#5#6#7#8#9{\let\lst@next\relax |
| 138 |
\ifx#1\relax |
| 139 |
\else \lccode`\^^@=`#1% |
| 140 |
\ifx#2\relax |
| 141 |
\lowercase{\lst@lAddTo\lst@temp{^^@}}% |
| 142 |
\else \lccode`\^^A=`#2% |
| 143 |
\ifx#3\relax |
| 144 |
\lowercase{\lst@lAddTo\lst@temp{^^@^^A}}% |
| 145 |
\else \lccode`\^^B=`#3% |
| 146 |
\ifx#4\relax |
| 147 |
\lowercase{\lst@lAddTo\lst@temp{^^@^^A^^B}}% |
| 148 |
\else \lccode`\^^C=`#4% |
| 149 |
\ifx#5\relax |
| 150 |
\lowercase{\lst@lAddTo\lst@temp{^^@^^A^^B^^C}}% |
| 151 |
\else \lccode`\^^D=`#5% |
| 152 |
\ifx#6\relax |
| 153 |
\lowercase{\lst@lAddTo\lst@temp{^^@^^A^^B^^C^^D}}% |
| 154 |
\else \lccode`\^^E=`#6% |
| 155 |
\ifx#7\relax |
| 156 |
\lowercase{\lst@lAddTo\lst@temp{^^@^^A^^B^^C^^D^^E}}% |
| 157 |
\else \lccode`\^^F=`#7% |
| 158 |
\ifx#8\relax |
| 159 |
\lowercase{\lst@lAddTo\lst@temp{^^@^^A^^B^^C^^D^^E^^F}}% |
| 160 |
\else \lccode`\^^G=`#8% |
| 161 |
\ifx#9\relax |
| 162 |
\lowercase{\lst@lAddTo\lst@temp{^^@^^A^^B^^C^^D^^E^^F^^G}}% |
| 163 |
\else \lccode`\^^H=`#9% |
| 164 |
\lowercase{\lst@lAddTo\lst@temp{^^@^^A^^B^^C^^D^^E^^F^^G^^H}}% |
| 165 |
\let\lst@next\lst@MakeActive@ |
| 166 |
\fi \fi \fi \fi \fi \fi \fi \fi \fi |
| 167 |
\lst@next} |
| 168 |
\endgroup |
| 169 |
\def\lst@DefActive#1#2{\lst@MakeActive{#2}\let#1\lst@temp} |
| 170 |
\def\lst@DefOther#1#2{% |
| 171 |
\begingroup \def#1{#2}\escapechar\m@ne \expandafter\endgroup |
| 172 |
\expandafter\lst@DefOther@\meaning#1\relax#1} |
| 173 |
\def\lst@DefOther@#1>#2\relax#3{\edef#3{\zap@space#2 \@empty}} |
| 174 |
\def\lst@InsideConvert#1{% |
| 175 |
\lst@ifmathescape |
| 176 |
\lst@InsideConvert@e#1$\@nil |
| 177 |
\lst@if |
| 178 |
\lst@InsideConvert@ey#1\@nil |
| 179 |
\else |
| 180 |
\lst@InsideConvert@#1 \@empty |
| 181 |
\expandafter\@gobbletwo |
| 182 |
\fi |
| 183 |
\expandafter\lst@next |
| 184 |
\else |
| 185 |
\lst@InsideConvert@#1 \@empty |
| 186 |
\fi} |
| 187 |
\begingroup \lccode`\~=`\ \relax \lowercase{% |
| 188 |
\gdef\lst@InsideConvert@#1 #2{% |
| 189 |
\lst@MakeActive{#1}% |
| 190 |
\ifx\@empty#2% |
| 191 |
\lst@lExtend\lst@arg{\lst@temp}% |
| 192 |
\else |
| 193 |
\lst@lExtend\lst@arg{\lst@temp~}% |
| 194 |
\expandafter\lst@InsideConvert@ |
| 195 |
\fi #2} |
| 196 |
}\endgroup |
| 197 |
\def\lst@InsideConvert@e#1$#2\@nil{% |
| 198 |
\ifx\@empty#2\@empty \lst@false \else \lst@true \fi} |
| 199 |
\def\lst@InsideConvert@ey#1$#2$#3\@nil{% |
| 200 |
\lst@InsideConvert@#1 \@empty |
| 201 |
\lst@lAddTo\lst@arg{% |
| 202 |
\lst@ifdropinput\else |
| 203 |
\lst@TrackNewLines\lst@OutputLostSpace \lst@XPrintToken |
| 204 |
\setbox\@tempboxa=\hbox\bgroup$\lst@escapebegin |
| 205 |
#2% |
| 206 |
\lst@escapeend$\egroup \lst@CalcLostSpaceAndOutput |
| 207 |
\lst@whitespacefalse |
| 208 |
\fi}% |
| 209 |
\def\lst@next{\lst@InsideConvert{#3}}% |
| 210 |
} |
| 211 |
\def\lst@XConvert{\@ifnextchar\bgroup \lst@XConvertArg\lst@XConvert@} |
| 212 |
\def\lst@XConvertArg#1{% |
| 213 |
{\lst@false \let\lst@arg\@empty |
| 214 |
\lst@XConvert#1\@nil |
| 215 |
\global\let\@gtempa\lst@arg}% |
| 216 |
\lst@lExtend\lst@arg{\expandafter{\@gtempa}}% |
| 217 |
\lst@XConvertNext} |
| 218 |
\def\lst@XConvert@#1{% |
| 219 |
\ifx\@nil#1\else |
| 220 |
\begingroup\lccode`\~=`#1\lowercase{\endgroup |
| 221 |
\lst@lAddTo\lst@arg~}% |
| 222 |
\expandafter\lst@XConvertNext |
| 223 |
\fi} |
| 224 |
\def\lst@XConvertNext{% |
| 225 |
\lst@if \expandafter\lst@XConvertX |
| 226 |
\else \expandafter\lst@XConvert \fi} |
| 227 |
\def\lst@XConvertX#1{% |
| 228 |
\ifx\@nil#1\else |
| 229 |
\lst@XConvertX@#1\relax |
| 230 |
\expandafter\lst@XConvert |
| 231 |
\fi} |
| 232 |
\def\lst@XConvertX@#1#2\relax{% |
| 233 |
\begingroup\lccode`\~=`#1\lowercase{\endgroup |
| 234 |
\lst@XCConvertX@@~}{#2}} |
| 235 |
\def\lst@XCConvertX@@#1#2{\lst@lAddTo\lst@arg{{#1#2}}} |
| 236 |
\def\lst@Require#1#2#3#4#5{% |
| 237 |
\begingroup |
| 238 |
\aftergroup\lst@true |
| 239 |
\ifx\@empty#3\@empty\else |
| 240 |
\def\lst@prefix{#2}\let\lst@require\@empty |
| 241 |
\edef\lst@temp{\expandafter\zap@space#3 \@empty}% |
| 242 |
\lst@for\lst@temp\do{% |
| 243 |
\ifx\@empty##1\@empty\else \lstKV@OptArg[]{##1}{% |
| 244 |
#4[####1]{####2}% |
| 245 |
\@ifundefined{\@lst\lst@prefix @\lst@malias $\lst@oalias}% |
| 246 |
{\edef\lst@require{\lst@require,\lst@malias $\lst@oalias}}% |
| 247 |
{}}% |
| 248 |
\fi}% |
| 249 |
\global\let\lst@loadaspects\@empty |
| 250 |
\lst@InputCatcodes |
| 251 |
\ifx\lst@require\@empty\else |
| 252 |
\lst@for{#5}\do{% |
| 253 |
\ifx\lst@require\@empty\else |
| 254 |
\InputIfFileExists{##1}{}{}% |
| 255 |
\fi}% |
| 256 |
\fi |
| 257 |
\ifx\lst@require\@empty\else |
| 258 |
\PackageError{Listings}{Couldn't load requested #1}% |
| 259 |
{The following #1s weren't loadable:^^J\@spaces |
| 260 |
\lst@require^^JThis may cause errors in the sequel.}% |
| 261 |
\aftergroup\lst@false |
| 262 |
\fi |
| 263 |
\ifx\lst@loadaspects\@empty\else |
| 264 |
\lst@RequireAspects\lst@loadaspects |
| 265 |
\fi |
| 266 |
\fi |
| 267 |
\endgroup} |
| 268 |
\def\lst@IfRequired[#1]#2{% |
| 269 |
\lst@NormedDef\lst@temp{[#1]#2}% |
| 270 |
\expandafter\lst@IfRequired@\lst@temp\relax} |
| 271 |
\def\lst@IfRequired@[#1]#2\relax#3{% |
| 272 |
\lst@IfOneOf #2$#1\relax\lst@require |
| 273 |
{\lst@DeleteKeysIn@\lst@require#2$#1,\relax,% |
| 274 |
\global\expandafter\let |
| 275 |
\csname\@lst\lst@prefix @#2$#1\endcsname\@empty |
| 276 |
#3}} |
| 277 |
\let\lst@require\@empty |
| 278 |
\def\lst@NoAlias[#1]#2{% |
| 279 |
\lst@NormedDef\lst@oalias{#1}\lst@NormedDef\lst@malias{#2}} |
| 280 |
\gdef\lst@LAS#1#2#3#4#5#6#7{% |
| 281 |
\lst@Require{#1}{#2}{#3}#4#5% |
| 282 |
#4#3% |
| 283 |
\@ifundefined{lst#2@\lst@malias$\lst@oalias}% |
| 284 |
{\PackageError{Listings}% |
| 285 |
{#1 \ifx\@empty\lst@oalias\else \lst@oalias\space of \fi |
| 286 |
\lst@malias\space undefined}% |
| 287 |
{The #1 is not loadable. \@ehc}}% |
| 288 |
{#6\csname\@lst#2@\lst@malias $\lst@oalias\endcsname #7}} |
| 289 |
\def\lst@RequireAspects#1{% |
| 290 |
\lst@Require{aspect}{asp}{#1}\lst@NoAlias\lstaspectfiles} |
| 291 |
\let\lstloadaspects\lst@RequireAspects |
| 292 |
\@ifundefined{lstaspectfiles} |
| 293 |
{\newcommand\lstaspectfiles{lstmisc0.sty,lstmisc.sty}}{} |
| 294 |
\gdef\lst@DefDriver#1#2#3#4{% |
| 295 |
\@ifnextchar[{\lst@DefDriver@{#1}{#2}#3#4}% |
| 296 |
{\lst@DefDriver@{#1}{#2}#3#4[]}} |
| 297 |
\gdef\lst@DefDriver@#1#2#3#4[#5]#6{% |
| 298 |
\def\lst@name{#1}\let\lst@if#4% |
| 299 |
\lst@NormedDef\lst@driver{\@lst#2@#6$#5}% |
| 300 |
\lst@IfRequired[#5]{#6}{\begingroup \lst@true}% |
| 301 |
{\begingroup}% |
| 302 |
\lst@setcatcodes |
| 303 |
\@ifnextchar[{\lst@XDefDriver{#1}#3}{\lst@DefDriver@@#3}} |
| 304 |
\gdef\lst@DefDriver@@#1#2{% |
| 305 |
\lst@if |
| 306 |
\global\@namedef{\lst@driver}{#1{#2}}% |
| 307 |
\fi |
| 308 |
\endgroup |
| 309 |
\@ifnextchar[\lst@XXDefDriver\@empty} |
| 310 |
\gdef\lst@XXDefDriver[#1]{% |
| 311 |
\ifx\@empty#1\@empty\else |
| 312 |
\lst@if |
| 313 |
\lstloadaspects{#1}% |
| 314 |
\else |
| 315 |
\@ifundefined{\lst@driver}{}% |
| 316 |
{\xdef\lst@loadaspects{\lst@loadaspects,#1}}% |
| 317 |
\fi |
| 318 |
\fi} |
| 319 |
\gdef\lst@XDefDriver#1#2[#3]#4#5{\lst@DefDriver@@#2{also#1=[#3]#4,#5}} |
| 320 |
\let\lst@UserCommand\gdef |
| 321 |
\newcommand*\lst@BeginAspect[2][]{% |
| 322 |
\def\lst@curraspect{#2}% |
| 323 |
\ifx \lst@curraspect\@empty |
| 324 |
\expandafter\lst@GobbleAspect |
| 325 |
\else |
| 326 |
\let\lst@next\@empty |
| 327 |
\lst@IfRequired[]{#2}% |
| 328 |
{\lst@RequireAspects{#1}% |
| 329 |
\lst@if\else \let\lst@next\lst@GobbleAspect \fi}% |
| 330 |
{\let\lst@next\lst@GobbleAspect}% |
| 331 |
\expandafter\lst@next |
| 332 |
\fi} |
| 333 |
\def\lst@EndAspect{% |
| 334 |
\csname\@lst patch@\lst@curraspect\endcsname |
| 335 |
\let\lst@curraspect\@empty} |
| 336 |
\long\def\lst@GobbleAspect#1\lst@EndAspect{\let\lst@curraspect\@empty} |
| 337 |
\def\lst@Key#1#2{% |
| 338 |
\@ifnextchar[{\lstKV@def{#1}{#2}}% |
| 339 |
{\def\lst@temp{\lst@Key@{#1}{#2}} |
| 340 |
\afterassignment\lst@temp |
| 341 |
\global\@namedef{KV@\@lst @#1}####1}} |
| 342 |
\def\lstKV@def#1#2[#3]{% |
| 343 |
\global\@namedef{KV@\@lst @#1@default\expandafter}\expandafter |
| 344 |
{\csname KV@\@lst @#1\endcsname{#3}}% |
| 345 |
\def\lst@temp{\lst@Key@{#1}{#2}}\afterassignment\lst@temp |
| 346 |
\global\@namedef{KV@\@lst @#1}##1} |
| 347 |
\def\lst@Key@#1#2{% |
| 348 |
\ifx\relax#2\@empty\else |
| 349 |
\begingroup \globaldefs\@ne |
| 350 |
\csname KV@\@lst @#1\endcsname{#2}% |
| 351 |
\endgroup |
| 352 |
\fi} |
| 353 |
\def\lst@UseHook#1{\csname\@lst hk@#1\endcsname} |
| 354 |
\def\lst@AddToHook{\lst@ATH@\iffalse\lst@AddTo} |
| 355 |
\def\lst@AddToHookExe{\lst@ATH@\iftrue\lst@AddTo} |
| 356 |
\def\lst@AddToHookAtTop{\lst@ATH@\iffalse\lst@AddToAtTop} |
| 357 |
\long\def\lst@ATH@#1#2#3#4{% |
| 358 |
\@ifundefined{\@lst hk@#3}{% |
| 359 |
\expandafter\gdef\csname\@lst hk@#3\endcsname{}}{}% |
| 360 |
\expandafter#2\csname\@lst hk@#3\endcsname{#4}% |
| 361 |
\def\lst@temp{#4}% |
| 362 |
#1% \iftrue|false |
| 363 |
\begingroup \globaldefs\@ne \lst@temp \endgroup |
| 364 |
\fi} |
| 365 |
\long\def\lst@AddTo#1#2{% |
| 366 |
\expandafter\gdef\expandafter#1\expandafter{#1#2}} |
| 367 |
\def\lst@AddToAtTop#1#2{\def\lst@temp{#2}% |
| 368 |
\expandafter\expandafter\expandafter\gdef |
| 369 |
\expandafter\expandafter\expandafter#1% |
| 370 |
\expandafter\expandafter\expandafter{\expandafter\lst@temp#1}} |
| 371 |
\def\lst@lAddTo#1#2{\expandafter\def\expandafter#1\expandafter{#1#2}} |
| 372 |
\def\lst@Extend#1#2{% |
| 373 |
\expandafter\lst@AddTo\expandafter#1\expandafter{#2}} |
| 374 |
\def\lst@lExtend#1#2{% |
| 375 |
\expandafter\lst@lAddTo\expandafter#1\expandafter{#2}} |
| 376 |
\RequirePackage{keyval}[1997/11/10] |
| 377 |
\def\lstKV@TwoArg#1#2{\gdef\@gtempa##1##2{#2}\@gtempa#1{}{}} |
| 378 |
\def\lstKV@ThreeArg#1#2{\gdef\@gtempa##1##2##3{#2}\@gtempa#1{}{}{}} |
| 379 |
\def\lstKV@FourArg#1#2{\gdef\@gtempa##1##2##3##4{#2}\@gtempa#1{}{}{}{}} |
| 380 |
\def\lstKV@OptArg[#1]#2#3{% |
| 381 |
\gdef\@gtempa[##1]##2{#3}\lstKV@OptArg@{#1}#2\@} |
| 382 |
\def\lstKV@OptArg@#1{\@ifnextchar[\lstKV@OptArg@@{\lstKV@OptArg@@[#1]}} |
| 383 |
\def\lstKV@OptArg@@[#1]#2\@{\@gtempa[#1]{#2}} |
| 384 |
\def\lstKV@XOptArg[#1]#2#3{% |
| 385 |
\global\let\@gtempa#3\lstKV@OptArg@{#1}#2\@} |
| 386 |
\def\lstKV@CSTwoArg#1#2{% |
| 387 |
\gdef\@gtempa##1,##2,##3\relax{#2}% |
| 388 |
\@gtempa#1,,\relax} |
| 389 |
\def\lstKV@SetIf#1{\lstKV@SetIf@#1\relax} |
| 390 |
\def\lstKV@SetIf@#1#2\relax#3{\lowercase{% |
| 391 |
\expandafter\let\expandafter#3% |
| 392 |
\csname if\ifx #1t}true\else false\fi\endcsname} |
| 393 |
\def\lstKV@SwitchCases#1#2#3{% |
| 394 |
\def\lst@temp##1\\#1:##2\\##3##4\@nil{% |
| 395 |
\ifx\@empty##3% |
| 396 |
#3% |
| 397 |
\else |
| 398 |
##2% |
| 399 |
\fi |
| 400 |
}% |
| 401 |
\lst@temp\\#2\\#1:\\\@empty\@nil} |
| 402 |
\lst@UserCommand\lstset{\begingroup \lst@setcatcodes \lstset@} |
| 403 |
\def\lstset@#1{\endgroup \ifx\@empty#1\@empty\else\setkeys{lst}{#1}\fi} |
| 404 |
\def\lst@setcatcodes{\makeatletter \catcode`\==12\relax} |
| 405 |
\def\lst@NewMode#1{% |
| 406 |
\ifx\@undefined#1% |
| 407 |
\lst@mode\lst@newmode\relax \advance\lst@mode\@ne |
| 408 |
\xdef\lst@newmode{\the\lst@mode}% |
| 409 |
\global\chardef#1=\lst@mode |
| 410 |
\lst@mode\lst@nomode |
| 411 |
\fi} |
| 412 |
\newcount\lst@mode |
| 413 |
\def\lst@newmode{\m@ne}% init |
| 414 |
\lst@NewMode\lst@nomode % init (of \lst@mode :-) |
| 415 |
\def\lst@UseDynamicMode{% |
| 416 |
\@tempcnta\lst@dynamicmode\relax \advance\@tempcnta\@ne |
| 417 |
\edef\lst@dynamicmode{\the\@tempcnta}% |
| 418 |
\expandafter\lst@Swap\expandafter{\expandafter{\lst@dynamicmode}}} |
| 419 |
\lst@AddToHook{InitVars}{\let\lst@dynamicmode\lst@newmode} |
| 420 |
\def\lst@EnterMode#1#2{% |
| 421 |
\bgroup \lst@mode=#1\relax #2% |
| 422 |
\lst@FontAdjust |
| 423 |
\lst@lAddTo\lst@entermodes{\lst@EnterMode{#1}{#2}}} |
| 424 |
\lst@AddToHook{InitVars}{\let\lst@entermodes\@empty} |
| 425 |
\let\lst@entermodes\@empty % init |
| 426 |
\def\lst@LeaveMode{% |
| 427 |
\ifnum\lst@mode=\lst@nomode\else |
| 428 |
\egroup \expandafter\lsthk@EndGroup |
| 429 |
\fi} |
| 430 |
\lst@AddToHook{EndGroup}{}% init |
| 431 |
\def\lst@InterruptModes{% |
| 432 |
\lst@Extend\lst@modestack{\expandafter{\lst@entermodes}}% |
| 433 |
\lst@LeaveAllModes} |
| 434 |
\lst@AddToHook{InitVars}{\global\let\lst@modestack\@empty} |
| 435 |
\def\lst@ReenterModes{% |
| 436 |
\ifx\lst@modestack\@empty\else |
| 437 |
\lst@LeaveAllModes |
| 438 |
\global\let\@gtempa\lst@modestack |
| 439 |
\global\let\lst@modestack\@empty |
| 440 |
\expandafter\lst@ReenterModes@\@gtempa\relax |
| 441 |
\fi} |
| 442 |
\def\lst@ReenterModes@#1#2{% |
| 443 |
\ifx\relax#2\@empty |
| 444 |
\gdef\@gtempa##1{#1}% |
| 445 |
\expandafter\@gtempa |
| 446 |
\else |
| 447 |
\lst@AddTo\lst@modestack{{#1}}% |
| 448 |
\expandafter\lst@ReenterModes@ |
| 449 |
\fi |
| 450 |
{#2}} |
| 451 |
\def\lst@LeaveAllModes{% |
| 452 |
\ifnum\lst@mode=\lst@nomode |
| 453 |
\expandafter\lsthk@EndGroup |
| 454 |
\else |
| 455 |
\expandafter\egroup\expandafter\lst@LeaveAllModes |
| 456 |
\fi} |
| 457 |
\lst@AddToHook{ExitVars}{\lst@LeaveAllModes} |
| 458 |
\lst@NewMode\lst@Pmode |
| 459 |
\lst@NewMode\lst@GPmode |
| 460 |
\def\lst@modetrue{\let\lst@ifmode\iftrue \lsthk@ModeTrue} |
| 461 |
\let\lst@ifmode\iffalse % init |
| 462 |
\lst@AddToHook{ModeTrue}{}% init |
| 463 |
\def\lst@Lmodetrue{\let\lst@ifLmode\iftrue} |
| 464 |
\let\lst@ifLmode\iffalse % init |
| 465 |
\lst@AddToHook{EOL}{\@whilesw \lst@ifLmode\fi \lst@LeaveMode} |
| 466 |
\def\lst@NormedDef#1#2{\lowercase{\edef#1{\zap@space#2 \@empty}}} |
| 467 |
\def\lst@NormedNameDef#1#2{% |
| 468 |
\lowercase{\edef\lst@temp{\zap@space#1 \@empty}% |
| 469 |
\expandafter\xdef\csname\lst@temp\endcsname{\zap@space#2 \@empty}}} |
| 470 |
\def\lst@GetFreeMacro#1{% |
| 471 |
\@tempcnta\z@ \def\lst@freemacro{#1\the\@tempcnta}% |
| 472 |
\lst@GFM@} |
| 473 |
\def\lst@GFM@{% |
| 474 |
\expandafter\ifx \csname\lst@freemacro\endcsname \relax |
| 475 |
\edef\lst@freemacro{\csname\lst@freemacro\endcsname}% |
| 476 |
\else |
| 477 |
\advance\@tempcnta\@ne |
| 478 |
\expandafter\lst@GFM@ |
| 479 |
\fi} |
| 480 |
\newbox\lst@gtempboxa |
| 481 |
\newtoks\lst@token \newcount\lst@length |
| 482 |
\def\lst@ResetToken{\lst@token{}\lst@length\z@} |
| 483 |
\lst@AddToHook{InitVarsBOL}{\lst@ResetToken \let\lst@lastother\@empty} |
| 484 |
\lst@AddToHook{EndGroup}{\lst@ResetToken \let\lst@lastother\@empty} |
| 485 |
\def\lst@lettertrue{\let\lst@ifletter\iftrue} |
| 486 |
\def\lst@letterfalse{\let\lst@ifletter\iffalse} |
| 487 |
\lst@AddToHook{InitVars}{\lst@letterfalse} |
| 488 |
\def\lst@Append#1{\advance\lst@length\@ne |
| 489 |
\lst@token=\expandafter{\the\lst@token#1}} |
| 490 |
\def\lst@AppendOther{% |
| 491 |
\lst@ifletter \lst@Output\lst@letterfalse \fi |
| 492 |
\futurelet\lst@lastother\lst@Append} |
| 493 |
\def\lst@AppendLetter{% |
| 494 |
\lst@ifletter\else \lst@OutputOther\lst@lettertrue \fi |
| 495 |
\lst@Append} |
| 496 |
\def\lst@SaveToken{% |
| 497 |
\global\let\lst@gthestyle\lst@thestyle |
| 498 |
\global\let\lst@glastother\lst@lastother |
| 499 |
\xdef\lst@RestoreToken{\noexpand\lst@token{\the\lst@token}% |
| 500 |
\noexpand\lst@length\the\lst@length\relax |
| 501 |
\noexpand\let\noexpand\lst@thestyle |
| 502 |
\noexpand\lst@gthestyle |
| 503 |
\noexpand\let\noexpand\lst@lastother |
| 504 |
\noexpand\lst@glastother}} |
| 505 |
\def\lst@IfLastOtherOneOf#1{\lst@IfLastOtherOneOf@ #1\relax} |
| 506 |
\def\lst@IfLastOtherOneOf@#1{% |
| 507 |
\ifx #1\relax |
| 508 |
\expandafter\@secondoftwo |
| 509 |
\else |
| 510 |
\ifx\lst@lastother#1% |
| 511 |
\lst@IfLastOtherOneOf@t |
| 512 |
\else |
| 513 |
\expandafter\expandafter\expandafter\lst@IfLastOtherOneOf@ |
| 514 |
\fi |
| 515 |
\fi} |
| 516 |
\def\lst@IfLastOtherOneOf@t#1\fi\fi#2\relax{\fi\fi\@firstoftwo} |
| 517 |
\newdimen\lst@currlwidth % \global |
| 518 |
\newcount\lst@column \newcount\lst@pos % \global |
| 519 |
\lst@AddToHook{InitVarsBOL} |
| 520 |
{\global\lst@currlwidth\z@ \global\lst@pos\z@ \global\lst@column\z@} |
| 521 |
\def\lst@CalcColumn{% |
| 522 |
\@tempcnta\lst@column |
| 523 |
\advance\@tempcnta\lst@length |
| 524 |
\advance\@tempcnta-\lst@pos} |
| 525 |
\newdimen\lst@lostspace % \global |
| 526 |
\lst@AddToHook{InitVarsBOL}{\global\lst@lostspace\z@} |
| 527 |
\def\lst@UseLostSpace{\ifdim\lst@lostspace>\z@ \lst@InsertLostSpace \fi} |
| 528 |
\def\lst@InsertLostSpace{% |
| 529 |
\lst@Kern\lst@lostspace \global\lst@lostspace\z@} |
| 530 |
\def\lst@InsertHalfLostSpace{% |
| 531 |
\global\[email protected]\lst@lostspace \lst@Kern\lst@lostspace} |
| 532 |
\newdimen\lst@width |
| 533 |
\lst@Key{basewidth}{0.6em,0.45em}{\lstKV@CSTwoArg{#1}% |
| 534 |
{\def\lst@widthfixed{##1}\def\lst@widthflexible{##2}% |
| 535 |
\ifx\lst@widthflexible\@empty |
| 536 |
\let\lst@widthflexible\lst@widthfixed |
| 537 |
\fi |
| 538 |
\def\lst@temp{\PackageError{Listings}% |
| 539 |
{Negative value(s) treated as zero}% |
| 540 |
\@ehc}% |
| 541 |
\let\lst@error\@empty |
| 542 |
\ifdim \lst@widthfixed<\z@ |
| 543 |
\let\lst@error\lst@temp \let\lst@widthfixed\z@ |
| 544 |
\fi |
| 545 |
\ifdim \lst@widthflexible<\z@ |
| 546 |
\let\lst@error\lst@temp \let\lst@widthflexible\z@ |
| 547 |
\fi |
| 548 |
\lst@error}} |
| 549 |
\lst@AddToHook{FontAdjust} |
| 550 |
{\lst@width=\lst@ifflexible\lst@widthflexible |
| 551 |
\else\lst@widthfixed\fi \relax} |
| 552 |
\lst@Key{fontadjust}{false}[t]{\lstKV@SetIf{#1}\lst@iffontadjust} |
| 553 |
\def\lst@FontAdjust{\lst@iffontadjust \lsthk@FontAdjust \fi} |
| 554 |
\lst@AddToHook{InitVars}{\lsthk@FontAdjust} |
| 555 |
\def\lst@OutputBox#1{\lst@alloverstyle{\box#1}} |
| 556 |
\def\lst@alloverstyle#1{#1}% init |
| 557 |
\def\lst@Kern#1{% |
| 558 |
\setbox\z@\hbox{{\lst@currstyle{\kern#1}}}% |
| 559 |
\global\advance\lst@currlwidth \wd\z@ |
| 560 |
\lst@OutputBox\z@} |
| 561 |
\def\lst@CalcLostSpaceAndOutput{% |
| 562 |
\global\advance\lst@lostspace \lst@length\lst@width |
| 563 |
\global\advance\lst@lostspace-\wd\@tempboxa |
| 564 |
\global\advance\lst@currlwidth \wd\@tempboxa |
| 565 |
\global\advance\lst@pos -\lst@length |
| 566 |
\setbox\@tempboxa\hbox{\let\lst@OutputBox\box |
| 567 |
\ifdim\lst@lostspace>\z@ \lst@leftinsert \fi |
| 568 |
\box\@tempboxa |
| 569 |
\ifdim\lst@lostspace>\z@ \lst@rightinsert \fi}% |
| 570 |
\lst@OutputBox\@tempboxa \lsthk@PostOutput} |
| 571 |
\lst@AddToHook{PostOutput}{}% init |
| 572 |
\def\lst@OutputToken{% |
| 573 |
\lst@TrackNewLines \lst@OutputLostSpace |
| 574 |
\lst@ifgobbledws |
| 575 |
\lst@gobbledwhitespacefalse |
| 576 |
\lst@@discretionary |
| 577 |
\fi |
| 578 |
\lst@CheckMerge |
| 579 |
{\lst@thestyle{\lst@FontAdjust |
| 580 |
\setbox\@tempboxa\lst@hbox |
| 581 |
{\lsthk@OutputBox |
| 582 |
\lst@lefthss |
| 583 |
\expandafter\lst@FillOutputBox\the\lst@token\@empty |
| 584 |
\lst@righthss}% |
| 585 |
\lst@CalcLostSpaceAndOutput}}% |
| 586 |
\lst@ResetToken} |
| 587 |
\lst@AddToHook{OutputBox}{}% init |
| 588 |
\def\lst@gobbledwhitespacetrue{\global\let\lst@ifgobbledws\iftrue} |
| 589 |
\def\lst@gobbledwhitespacefalse{\global\let\lst@ifgobbledws\iffalse} |
| 590 |
\lst@AddToHookExe{InitBOL}{\lst@gobbledwhitespacefalse}% init |
| 591 |
\def\lst@Delay#1{% |
| 592 |
\lst@CheckDelay |
| 593 |
#1% |
| 594 |
\lst@GetOutputMacro\lst@delayedoutput |
| 595 |
\edef\lst@delayed{\the\lst@token}% |
| 596 |
\edef\lst@delayedlength{\the\lst@length}% |
| 597 |
\lst@ResetToken} |
| 598 |
\def\lst@Merge#1{% |
| 599 |
\lst@CheckMerge |
| 600 |
#1% |
| 601 |
\edef\lst@merged{\the\lst@token}% |
| 602 |
\edef\lst@mergedlength{\the\lst@length}% |
| 603 |
\lst@ResetToken} |
| 604 |
\def\lst@MergeToken#1#2{% |
| 605 |
\advance\lst@length#2% |
| 606 |
\lst@lExtend#1{\the\lst@token}% |
| 607 |
\expandafter\lst@token\expandafter{#1}% |
| 608 |
\let#1\@empty} |
| 609 |
\def\lst@CheckDelay{% |
| 610 |
\ifx\lst@delayed\@empty\else |
| 611 |
\lst@GetOutputMacro\@gtempa |
| 612 |
\ifx\lst@delayedoutput\@gtempa |
| 613 |
\lst@MergeToken\lst@delayed\lst@delayedlength |
| 614 |
\else |
| 615 |
{\lst@ResetToken |
| 616 |
\lst@MergeToken\lst@delayed\lst@delayedlength |
| 617 |
\lst@delayedoutput}% |
| 618 |
\let\lst@delayed\@empty |
| 619 |
\fi |
| 620 |
\fi} |
| 621 |
\def\lst@CheckMerge{% |
| 622 |
\ifx\lst@merged\@empty\else |
| 623 |
\lst@MergeToken\lst@merged\lst@mergedlength |
| 624 |
\fi} |
| 625 |
\let\lst@delayed\@empty % init |
| 626 |
\let\lst@merged\@empty % init |
| 627 |
\def\lst@column@fixed{% |
| 628 |
\lst@flexiblefalse |
| 629 |
\lst@width\lst@widthfixed\relax |
| 630 |
\let\lst@OutputLostSpace\lst@UseLostSpace |
| 631 |
\let\lst@FillOutputBox\lst@FillFixed |
| 632 |
\let\lst@hss\hss |
| 633 |
\def\lst@hbox{\hbox to\lst@length\lst@width}} |
| 634 |
\def\lst@FillFixed#1{#1\lst@FillFixed@} |
| 635 |
\def\lst@FillFixed@#1{% |
| 636 |
\ifx\@empty#1\else \lst@hss#1\expandafter\lst@FillFixed@ \fi} |
| 637 |
\def\lst@column@flexible{% |
| 638 |
\lst@flexibletrue |
| 639 |
\lst@width\lst@widthflexible\relax |
| 640 |
\let\lst@OutputLostSpace\lst@UseLostSpace |
| 641 |
\let\lst@FillOutputBox\@empty |
| 642 |
\let\lst@hss\@empty |
| 643 |
\let\lst@hbox\hbox} |
| 644 |
\def\lst@column@fullflexible{% |
| 645 |
\lst@column@flexible |
| 646 |
\def\lst@OutputLostSpace{\lst@ifnewline \lst@UseLostSpace\fi}% |
| 647 |
\let\lst@leftinsert\@empty |
| 648 |
\let\lst@rightinsert\@empty} |
| 649 |
\def\lst@column@spaceflexible{% |
| 650 |
\lst@column@flexible |
| 651 |
\def\lst@OutputLostSpace{% |
| 652 |
\lst@ifwhitespace |
| 653 |
\ifx\lst@outputspace\lst@visiblespace |
| 654 |
\else |
| 655 |
\lst@UseLostSpace |
| 656 |
\fi |
| 657 |
\else |
| 658 |
\lst@ifnewline \lst@UseLostSpace\fi |
| 659 |
\fi}% |
| 660 |
\let\lst@leftinsert\@empty |
| 661 |
\let\lst@rightinsert\@empty} |
| 662 |
\def\lst@outputpos#1#2\relax{% |
| 663 |
\def\lst@lefthss{\lst@hss}\let\lst@righthss\lst@lefthss |
| 664 |
\let\lst@rightinsert\lst@InsertLostSpace |
| 665 |
\ifx #1c% |
| 666 |
\let\lst@leftinsert\lst@InsertHalfLostSpace |
| 667 |
\else\ifx #1r% |
| 668 |
\let\lst@righthss\@empty |
| 669 |
\let\lst@leftinsert\lst@InsertLostSpace |
| 670 |
\let\lst@rightinsert\@empty |
| 671 |
\else |
| 672 |
\let\lst@lefthss\@empty |
| 673 |
\let\lst@leftinsert\@empty |
| 674 |
\ifx #1l\else \PackageWarning{Listings}% |
| 675 |
{Unknown positioning for output boxes}% |
| 676 |
\fi |
| 677 |
\fi\fi} |
| 678 |
\def\lst@flexibletrue{\let\lst@ifflexible\iftrue} |
| 679 |
\def\lst@flexiblefalse{\let\lst@ifflexible\iffalse} |
| 680 |
\lst@Key{columns}{[c]fixed}{\lstKV@OptArg[]{#1}{% |
| 681 |
\ifx\@empty##1\@empty\else \lst@outputpos##1\relax\relax \fi |
| 682 |
\expandafter\let\expandafter\lst@arg |
| 683 |
\csname\@lst @column@##2\endcsname |
| 684 |
\lst@arg |
| 685 |
\ifx\lst@arg\relax |
| 686 |
\PackageWarning{Listings}{Unknown column format `##2'}% |
| 687 |
\else |
| 688 |
\lst@ifflexible |
| 689 |
\let\lst@columnsflexible\lst@arg |
| 690 |
\else |
| 691 |
\let\lst@columnsfixed\lst@arg |
| 692 |
\fi |
| 693 |
\fi}} |
| 694 |
\let\lst@columnsfixed\lst@column@fixed % init |
| 695 |
\let\lst@columnsflexible\lst@column@flexible % init |
| 696 |
\lst@Key{flexiblecolumns}\relax[t]{% |
| 697 |
\lstKV@SetIf{#1}\lst@ifflexible |
| 698 |
\lst@ifflexible \lst@columnsflexible |
| 699 |
\else \lst@columnsfixed \fi} |
| 700 |
\newcount\lst@newlines |
| 701 |
\lst@AddToHook{InitVars}{\global\lst@newlines\z@} |
| 702 |
\lst@AddToHook{InitVarsBOL}{\global\advance\lst@newlines\@ne} |
| 703 |
\def\lst@NewLine{% |
| 704 |
\ifx\lst@OutputBox\@gobble\else |
| 705 |
\par\noindent \hbox{}% |
| 706 |
\fi |
| 707 |
\global\advance\lst@newlines\m@ne |
| 708 |
\lst@newlinetrue} |
| 709 |
\def\lst@newlinetrue{\global\let\lst@ifnewline\iftrue} |
| 710 |
\lst@AddToHookExe{PostOutput}{\global\let\lst@ifnewline\iffalse}% init |
| 711 |
\def\lst@TrackNewLines{% |
| 712 |
\ifnum\lst@newlines>\z@ |
| 713 |
\lsthk@OnNewLine |
| 714 |
\lst@DoNewLines |
| 715 |
\fi} |
| 716 |
\lst@AddToHook{OnNewLine}{}% init |
| 717 |
\lst@Key{emptylines}\maxdimen{% |
| 718 |
\@ifstar{\lst@true\@tempcnta\@gobble#1\relax\lst@GobbleNil}% |
| 719 |
{\lst@false\@tempcnta#1\relax\lst@GobbleNil}#1\@nil |
| 720 |
\advance\@tempcnta\@ne |
| 721 |
\edef\lst@maxempty{\the\@tempcnta\relax}% |
| 722 |
\let\lst@ifpreservenumber\lst@if} |
| 723 |
\def\lst@DoNewLines{% |
| 724 |
\@whilenum\lst@newlines>\lst@maxempty \do |
| 725 |
{\lst@ifpreservenumber |
| 726 |
\lsthk@OnEmptyLine |
| 727 |
\global\advance\c@lstnumber\lst@advancelstnum |
| 728 |
\fi |
| 729 |
\global\advance\lst@newlines\m@ne}% |
| 730 |
\@whilenum \lst@newlines>\@ne \do |
| 731 |
{\lsthk@OnEmptyLine \lst@NewLine}% |
| 732 |
\ifnum\lst@newlines>\z@ \lst@NewLine \fi} |
| 733 |
\lst@AddToHook{OnEmptyLine}{}% init |
| 734 |
\lst@Key{identifierstyle}{}{\def\lst@identifierstyle{#1}} |
| 735 |
\lst@AddToHook{EmptyStyle}{\let\lst@identifierstyle\@empty} |
| 736 |
\def\lst@GotoTabStop{% |
| 737 |
\ifnum\lst@newlines=\z@ |
| 738 |
\setbox\@tempboxa\hbox{\lst@outputspace}% |
| 739 |
\setbox\@tempboxa\hbox to\wd\@tempboxa{{\lst@currstyle{\hss}}}% |
| 740 |
\lst@CalcLostSpaceAndOutput |
| 741 |
\else |
| 742 |
\global\advance\lst@lostspace \lst@length\lst@width |
| 743 |
\global\advance\lst@column\lst@length \lst@length\z@ |
| 744 |
\fi} |
| 745 |
\def\lst@OutputOther{% |
| 746 |
\lst@CheckDelay |
| 747 |
\ifnum\lst@length=\z@\else |
| 748 |
\let\lst@thestyle\lst@currstyle |
| 749 |
\lsthk@OutputOther |
| 750 |
\lst@OutputToken |
| 751 |
\fi} |
| 752 |
\lst@AddToHook{OutputOther}{}% init |
| 753 |
\let\lst@currstyle\relax % init |
| 754 |
\def\lst@Output{% |
| 755 |
\lst@CheckDelay |
| 756 |
\ifnum\lst@length=\z@\else |
| 757 |
\ifx\lst@currstyle\relax |
| 758 |
\let\lst@thestyle\lst@identifierstyle |
| 759 |
\else |
| 760 |
\let\lst@thestyle\lst@currstyle |
| 761 |
\fi |
| 762 |
\lsthk@Output |
| 763 |
\lst@OutputToken |
| 764 |
\fi |
| 765 |
\let\lst@lastother\relax} |
| 766 |
\lst@AddToHook{Output}{}% init |
| 767 |
\def\lst@GetOutputMacro#1{% |
| 768 |
\lst@ifletter \global\let#1\lst@Output |
| 769 |
\else \global\let#1\lst@OutputOther\fi} |
| 770 |
\def\lst@PrintToken{% |
| 771 |
\lst@ifletter \lst@Output \lst@letterfalse |
| 772 |
\else \lst@OutputOther \let\lst@lastother\@empty \fi} |
| 773 |
\def\lst@XPrintToken{% |
| 774 |
\lst@PrintToken \lst@CheckMerge |
| 775 |
\ifnum\lst@length=\z@\else \lst@PrintToken \fi} |
| 776 |
\def\lst@BeginDropOutput#1{% |
| 777 |
\xdef\lst@BDOnewlines{\the\lst@newlines}% |
| 778 |
\global\let\lst@BDOifnewline\lst@ifnewline |
| 779 |
\lst@EnterMode{#1}% |
| 780 |
{\lst@modetrue |
| 781 |
\let\lst@OutputBox\@gobble |
| 782 |
\aftergroup\lst@BDORestore}} |
| 783 |
\def\lst@BDORestore{% |
| 784 |
\global\lst@newlines\lst@BDOnewlines |
| 785 |
\global\let\lst@ifnewline\lst@BDOifnewline} |
| 786 |
\let\lst@EndDropOutput\lst@LeaveMode |
| 787 |
\def\lst@ProcessLetter{\lst@whitespacefalse \lst@AppendLetter} |
| 788 |
\def\lst@ProcessOther{\lst@whitespacefalse \lst@AppendOther} |
| 789 |
\def\lst@ProcessDigit{% |
| 790 |
\lst@whitespacefalse |
| 791 |
\lst@ifletter \expandafter\lst@AppendLetter |
| 792 |
\else \expandafter\lst@AppendOther\fi} |
| 793 |
\def\lst@whitespacetrue{\global\let\lst@ifwhitespace\iftrue} |
| 794 |
\def\lst@whitespacefalse{\global\let\lst@ifwhitespace\iffalse} |
| 795 |
\lst@AddToHook{InitVarsBOL}{\lst@whitespacetrue} |
| 796 |
\lst@Key{tabsize}{8} |
| 797 |
{\ifnum#1>\z@ \def\lst@tabsize{#1}\else |
| 798 |
\PackageError{Listings}{Strict positive integer expected}% |
| 799 |
{You can't use `#1' as tabsize. \@ehc}% |
| 800 |
\fi} |
| 801 |
\lst@Key{showtabs}f[t]{\lstKV@SetIf{#1}\lst@ifshowtabs} |
| 802 |
\lst@Key{tab}{\kern.06em\hbox{\vrule\@height.3ex}% |
| 803 |
\hrulefill\hbox{\vrule\@height.3ex}} |
| 804 |
{\def\lst@tab{#1}} |
| 805 |
\def\lst@ProcessTabulator{% |
| 806 |
\lst@XPrintToken \lst@whitespacetrue |
| 807 |
\global\advance\lst@column -\lst@pos |
| 808 |
\@whilenum \lst@pos<\@ne \do |
| 809 |
{\global\advance\lst@pos\lst@tabsize}% |
| 810 |
\lst@length\lst@pos |
| 811 |
\lst@PreGotoTabStop} |
| 812 |
\def\lst@PreGotoTabStop{% |
| 813 |
\lst@ifshowtabs |
| 814 |
\lst@TrackNewLines |
| 815 |
\setbox\@tempboxa\hbox to\lst@length\lst@width |
| 816 |
{{\lst@currstyle{\hss\lst@tab}}}% |
| 817 |
\lst@CalcLostSpaceAndOutput |
| 818 |
\else |
| 819 |
\lst@ifkeepspaces |
| 820 |
\@tempcnta\lst@length \lst@length\z@ |
| 821 |
\@whilenum \@tempcnta>\z@ \do |
| 822 |
{\lst@AppendOther\lst@outputspace |
| 823 |
\advance\@tempcnta\m@ne}% |
| 824 |
\lst@OutputOther |
| 825 |
\else |
| 826 |
\lst@GotoTabStop |
| 827 |
\fi |
| 828 |
\fi |
| 829 |
\lst@length\z@ \global\lst@pos\z@} |
| 830 |
\def\lst@outputspace{\ } |
| 831 |
\def\lst@visiblespace{\verbvisiblespace} |
| 832 |
\lst@Key{showspaces}{false}[t]{\lstKV@SetIf{#1}\lst@ifshowspaces} |
| 833 |
\lst@Key{keepspaces}{false}[t]{\lstKV@SetIf{#1}\lst@ifkeepspaces} |
| 834 |
\lst@AddToHook{Init} |
| 835 |
{\lst@ifshowspaces |
| 836 |
\let\lst@outputspace\lst@visiblespace |
| 837 |
\lst@keepspacestrue |
| 838 |
\fi} |
| 839 |
\def\lst@keepspacestrue{\let\lst@ifkeepspaces\iftrue} |
| 840 |
\def\lst@ProcessSpace{% |
| 841 |
\lst@ifkeepspaces |
| 842 |
\lst@PrintToken |
| 843 |
\lst@whitespacetrue |
| 844 |
\lst@AppendOther\lst@outputspace |
| 845 |
\lst@PrintToken |
| 846 |
\else \ifnum\lst@newlines=\z@ |
| 847 |
\lst@AppendSpecialSpace |
| 848 |
\else \ifnum\lst@length=\z@ |
| 849 |
\global\advance\lst@lostspace\lst@width |
| 850 |
\global\advance\lst@pos\m@ne |
| 851 |
\lst@whitespacetrue |
| 852 |
\else |
| 853 |
\lst@AppendSpecialSpace |
| 854 |
\fi |
| 855 |
\fi \fi} |
| 856 |
\def\lst@AppendSpecialSpace{% |
| 857 |
\lst@ifwhitespace |
| 858 |
\lst@PrintToken |
| 859 |
\global\advance\lst@lostspace\lst@width |
| 860 |
\global\advance\lst@pos\m@ne |
| 861 |
\lst@gobbledwhitespacetrue |
| 862 |
\else |
| 863 |
\lst@PrintToken |
| 864 |
\lst@whitespacetrue |
| 865 |
\lst@AppendOther\lst@outputspace |
| 866 |
\lst@PrintToken |
| 867 |
\fi} |
| 868 |
\lst@Key{formfeed}{\bigbreak}{\def\lst@formfeed{#1}} |
| 869 |
\def\lst@ProcessFormFeed{% |
| 870 |
\lst@XPrintToken |
| 871 |
\ifnum\lst@newlines=\z@ |
| 872 |
\lst@EOLUpdate \lsthk@InitVarsBOL |
| 873 |
\fi |
| 874 |
\lst@formfeed |
| 875 |
\lst@whitespacetrue} |
| 876 |
\def\lst@Def#1{\lccode`\~=#1\lowercase{\def~}} |
| 877 |
\def\lst@Let#1{\lccode`\~=#1\lowercase{\let~}} |
| 878 |
\lst@AddToAtTop{\try@load@fontshape}{\def\space{ }} |
| 879 |
\def\lst@SelectStdCharTable{% |
| 880 |
\lst@Def{9}{\lst@ProcessTabulator}% |
| 881 |
\lst@Def{12}{\lst@ProcessFormFeed}% |
| 882 |
\lst@Def{32}{\lst@ProcessSpace}} |
| 883 |
\def\lst@CCPut#1#2{% |
| 884 |
\ifnum#2=\z@ |
| 885 |
\expandafter\@gobbletwo |
| 886 |
\else |
| 887 |
\begingroup\lccode`\~=#2\lccode`\/=#2\lowercase{\endgroup\lst@CCPut@~{#1/}}% |
| 888 |
\fi |
| 889 |
\lst@CCPut#1} |
| 890 |
\def\lst@CCPut@#1#2{\lst@lAddTo\lst@SelectStdCharTable{\def#1{#2}}} |
| 891 |
\lst@CCPut \lst@ProcessOther |
| 892 |
{"21}{"22}{"28}{"29}{"2B}{"2C}{"2E}{"2F} |
| 893 |
{"3A}{"3B}{"3D}{"3F}{"5B}{"5D} |
| 894 |
\z@ |
| 895 |
\lst@CCPut \lst@ProcessDigit |
| 896 |
{"30}{"31}{"32}{"33}{"34}{"35}{"36}{"37}{"38}{"39} |
| 897 |
\z@ |
| 898 |
\lst@CCPut \lst@ProcessLetter |
| 899 |
{"40}{"41}{"42}{"43}{"44}{"45}{"46}{"47} |
| 900 |
{"48}{"49}{"4A}{"4B}{"4C}{"4D}{"4E}{"4F} |
| 901 |
{"50}{"51}{"52}{"53}{"54}{"55}{"56}{"57} |
| 902 |
{"58}{"59}{"5A} |
| 903 |
{"61}{"62}{"63}{"64}{"65}{"66}{"67} |
| 904 |
{"68}{"69}{"6A}{"6B}{"6C}{"6D}{"6E}{"6F} |
| 905 |
{"70}{"71}{"72}{"73}{"74}{"75}{"76}{"77} |
| 906 |
{"78}{"79}{"7A} |
| 907 |
\z@ |
| 908 |
\def\lst@CCPutMacro#1#2#3{% |
| 909 |
\ifnum#2=\z@ \else |
| 910 |
\begingroup\lccode`\~=#2\relax \lccode`\/=#2\relax |
| 911 |
\lowercase{\endgroup\expandafter\lst@CCPutMacro@ |
| 912 |
\csname\@lst @um/\expandafter\endcsname |
| 913 |
\csname\@lst @um/@\endcsname /~}#1{#3}% |
| 914 |
\expandafter\lst@CCPutMacro |
| 915 |
\fi} |
| 916 |
\def\lst@CCPutMacro@#1#2#3#4#5#6{% |
| 917 |
\lst@lAddTo\lst@SelectStdCharTable{\def#4{#5#1}}% |
| 918 |
\def#1{\lst@UM#3}% |
| 919 |
\def#2{#6}} |
| 920 |
\def\lst@UM#1{\csname\@lst @um#1@\endcsname} |
| 921 |
\lst@CCPutMacro |
| 922 |
\lst@ProcessOther {"22}{\lst@ifupquote \textquotedbl |
| 923 |
\else \char34\relax \fi} |
| 924 |
\lst@ProcessOther {"23}\# |
| 925 |
\lst@ProcessLetter{"24}\textdollar |
| 926 |
\lst@ProcessOther {"25}\% |
| 927 |
\lst@ProcessOther {"26}\& |
| 928 |
\lst@ProcessOther {"27}{\lst@ifupquote \textquotesingle |
| 929 |
\else \char39\relax \fi} |
| 930 |
\lst@ProcessOther {"2A}{\lst@ttfamily*\textasteriskcentered} |
| 931 |
\lst@ProcessOther {"2D}{\lst@ttfamily{-{}}{\textminus}} |
| 932 |
\lst@ProcessOther {"3C}{\lst@ttfamily<\textless} |
| 933 |
\lst@ProcessOther {"3E}{\lst@ttfamily>\textgreater} |
| 934 |
\lst@ProcessOther {"5C}{\lst@ttfamily{\char92}\textbackslash} |
| 935 |
\lst@ProcessOther {"5E}\textasciicircum |
| 936 |
\lst@ProcessLetter{"5F}{\lst@ttfamily{\char95}\textunderscore} |
| 937 |
% or \char"5F |
| 938 |
\lst@ProcessOther {"60}{\lst@ifupquote \textasciigrave |
| 939 |
\else \char96\relax \fi} |
| 940 |
\lst@ProcessOther {"7B}{\lst@ttfamily{\char123}\textbraceleft} |
| 941 |
\lst@ProcessOther {"7C}{\lst@ttfamily|\textbar} |
| 942 |
\lst@ProcessOther {"7D}{\lst@ttfamily{\char125}\textbraceright} |
| 943 |
\lst@ProcessOther {"7E}\textasciitilde |
| 944 |
\lst@ProcessOther {"7F}- |
| 945 |
\@empty\z@\@empty |
| 946 |
\def\lst@ttfamily#1#2{\ifx\f@family\ttdefault#1\relax\else#2\fi} |
| 947 |
\lst@AddToHook{Init}{\edef\ttdefault{\ttdefault}} |
| 948 |
\lst@Key{upquote}{false}[t]{\lstKV@SetIf{#1}\lst@ifupquote |
| 949 |
\lst@ifupquote |
| 950 |
\@ifundefined{textasciigrave}% |
| 951 |
{\let\KV@lst@upquote\@gobble |
| 952 |
\lstKV@SetIf f\lst@ifupquote \@gobble\fi |
| 953 |
\PackageError{Listings}{Option `upquote' requires `textcomp' |
| 954 |
package.\MessageBreak The option has been disabled}% |
| 955 |
{Add \string\usepackage{textcomp} to your preamble.}}% |
| 956 |
{}% |
| 957 |
\fi} |
| 958 |
\AtBeginDocument{% |
| 959 |
\@ifpackageloaded{upquote}{\RequirePackage{textcomp}% |
| 960 |
\lstset{upquote}}{}% |
| 961 |
\@ifpackageloaded{upquote2}{\lstset{upquote}}{}} |
| 962 |
\def\lst@activecharstrue{\let\lst@ifactivechars\iftrue} |
| 963 |
\def\lst@activecharsfalse{\let\lst@ifactivechars\iffalse} |
| 964 |
\lst@activecharstrue |
| 965 |
\def\lst@SelectCharTable{% |
| 966 |
\lst@SelectStdCharTable |
| 967 |
\lst@ifactivechars |
| 968 |
\catcode9\active \catcode12\active \catcode13\active |
| 969 |
\@tempcnta=32\relax |
| 970 |
\@whilenum\@tempcnta<128\do |
| 971 |
{\catcode\@tempcnta\active\advance\@tempcnta\@ne}% |
| 972 |
\fi |
| 973 |
\lst@ifec \lst@DefEC \fi |
| 974 |
\let\do\lst@do@noligs \verbatim@nolig@list |
| 975 |
\lsthk@SelectCharTable |
| 976 |
\lst@DeveloperSCT\lst@DefRange |
| 977 |
\ifx\lst@Backslash\relax\else |
| 978 |
\lst@LetSaveDef{"5C}\lsts@backslash\lst@Backslash |
| 979 |
\fi} |
| 980 |
\lst@Key{SelectCharTable}{}{\def\lst@DeveloperSCT{#1}} |
| 981 |
\lst@Key{MoreSelectCharTable}\relax{\lst@lAddTo\lst@DeveloperSCT{#1}} |
| 982 |
\lst@AddToHook{SetLanguage}{\let\lst@DeveloperSCT\@empty} |
| 983 |
\def\lst@do@noligs#1{% |
| 984 |
\begingroup \lccode`\~=`#1\lowercase{\endgroup |
| 985 |
\lst@do@noligs@~}} |
| 986 |
\def\lst@do@noligs@#1{% |
| 987 |
\expandafter\expandafter\expandafter\def |
| 988 |
\expandafter\expandafter\expandafter#1% |
| 989 |
\expandafter\expandafter\expandafter{\expandafter\lst@NoLig#1}} |
| 990 |
\def\lst@NoLig{\advance\lst@length\m@ne \lst@Append\lst@nolig} |
| 991 |
\def\lst@nolig{\lst@UM\@empty}% |
| 992 |
\@namedef{\@lst @um@}{\leavevmode\kern\z@} |
| 993 |
\def\lst@SaveOutputDef#1#2{% |
| 994 |
\begingroup \lccode`\~=#1\relax \lowercase{\endgroup |
| 995 |
\def\lst@temp##1\def~##2##3\relax}{% |
| 996 |
\global\expandafter\let\expandafter#2\@gobble##2\relax}% |
| 997 |
\expandafter\lst@temp\lst@SelectStdCharTable\relax} |
| 998 |
\lst@SaveOutputDef{"5C}\lstum@backslash |
| 999 |
\lst@Key{extendedchars}{true}[t]{\lstKV@SetIf{#1}\lst@ifec} |
| 1000 |
\def\lst@DefEC{% |
| 1001 |
\lst@CCECUse \lst@ProcessLetter |
| 1002 |
^^80^^81^^82^^83^^84^^85^^86^^87^^88^^89^^8a^^8b^^8c^^8d^^8e^^8f% |
| 1003 |
^^90^^91^^92^^93^^94^^95^^96^^97^^98^^99^^9a^^9b^^9c^^9d^^9e^^9f% |
| 1004 |
^^a0^^a1^^a2^^a3^^a4^^a5^^a6^^a7^^a8^^a9^^aa^^ab^^ac^^ad^^ae^^af% |
| 1005 |
^^b0^^b1^^b2^^b3^^b4^^b5^^b6^^b7^^b8^^b9^^ba^^bb^^bc^^bd^^be^^bf% |
| 1006 |
^^c0^^c1^^c2^^c3^^c4^^c5^^c6^^c7^^c8^^c9^^ca^^cb^^cc^^cd^^ce^^cf% |
| 1007 |
^^d0^^d1^^d2^^d3^^d4^^d5^^d6^^d7^^d8^^d9^^da^^db^^dc^^dd^^de^^df% |
| 1008 |
^^e0^^e1^^e2^^e3^^e4^^e5^^e6^^e7^^e8^^e9^^ea^^eb^^ec^^ed^^ee^^ef% |
| 1009 |
^^f0^^f1^^f2^^f3^^f4^^f5^^f6^^f7^^f8^^f9^^fa^^fb^^fc^^fd^^fe^^ff% |
| 1010 |
^^00} |
| 1011 |
\def\lst@CCECUse#1#2{% |
| 1012 |
\ifnum`#2=\z@ |
| 1013 |
\expandafter\@gobbletwo |
| 1014 |
\else |
| 1015 |
\ifnum\catcode`#2=\active |
| 1016 |
\lccode`\~=`#2\lccode`\/=`#2\lowercase{\lst@CCECUse@#1~/}% |
| 1017 |
\else |
| 1018 |
\lst@ifactivechars \catcode`#2=\active \fi |
| 1019 |
\lccode`\~=`#2\lccode`\/=`#2\lowercase{\def~{#1/}}% |
| 1020 |
\fi |
| 1021 |
\fi |
| 1022 |
\lst@CCECUse#1} |
| 1023 |
\def\lst@CCECUse@#1#2#3{% |
| 1024 |
\expandafter\def\csname\@lst @EC#3\endcsname{\lst@UM#3}% |
| 1025 |
\expandafter\let\csname\@lst @um#3@\endcsname #2% |
| 1026 |
\edef#2{\noexpand#1% |
| 1027 |
\expandafter\noexpand\csname\@lst @EC#3\endcsname}} |
| 1028 |
\lst@AddToHook{Init} |
| 1029 |
{\let\lsts@nfss@catcodes\nfss@catcodes |
| 1030 |
\let\nfss@catcodes\lst@nfss@catcodes} |
| 1031 |
\def\lst@nfss@catcodes{% |
| 1032 |
\lst@makeletter |
| 1033 |
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\relax |
| 1034 |
\@makeother (\@makeother )\@makeother ,\@makeother :\@makeother\&% |
| 1035 |
\@makeother 0\@makeother 1\@makeother 2\@makeother 3\@makeother 4% |
| 1036 |
\@makeother 5\@makeother 6\@makeother 7\@makeother 8\@makeother 9% |
| 1037 |
\@makeother =\lsts@nfss@catcodes} |
| 1038 |
\def\lst@makeletter#1{% |
| 1039 |
\ifx\relax#1\else\catcode`#111\relax \expandafter\lst@makeletter\fi} |
| 1040 |
\lst@Key{useoutput}{2}{\edef\lst@useoutput{\ifcase0#1 0\or 1\else 2\fi}} |
| 1041 |
\lst@AddToHook{Init} |
| 1042 |
{\edef\lst@OrgOutput{\the\output}% |
| 1043 |
\ifcase\lst@useoutput\relax |
| 1044 |
\or |
| 1045 |
\output{\global\setbox\lst@gtempboxa\box\@cclv |
| 1046 |
\expandafter\egroup |
| 1047 |
\lst@SaveToken |
| 1048 |
\lst@InterruptModes |
| 1049 |
\setbox\@cclv\box\lst@gtempboxa |
| 1050 |
\bgroup\lst@OrgOutput\egroup |
| 1051 |
\bgroup |
| 1052 |
\aftergroup\pagegoal\aftergroup\vsize |
| 1053 |
\aftergroup\lst@ReenterModes\aftergroup\lst@RestoreToken}% |
| 1054 |
\else |
| 1055 |
\output{\lst@RestoreOrigCatcodes |
| 1056 |
\lst@ifec \lst@RestoreOrigExtendedCatcodes \fi |
| 1057 |
\lst@OrgOutput}% |
| 1058 |
\fi} |
| 1059 |
\def\lst@GetChars#1#2#3{% |
| 1060 |
\let#1\@empty |
| 1061 |
\@tempcnta#2\relax \@tempcntb#3\relax |
| 1062 |
\loop \ifnum\@tempcnta<\@tempcntb\relax |
| 1063 |
\lst@lExtend#1{\expandafter\catcode\the\@tempcnta=}% |
| 1064 |
\lst@lExtend#1{\the\catcode\@tempcnta\relax}% |
| 1065 |
\ifnum\the\catcode\@tempcnta=\active |
| 1066 |
\begingroup\lccode`\~=\@tempcnta |
| 1067 |
\lowercase{\endgroup |
| 1068 |
\lst@lExtend#1{\expandafter\let\expandafter~\csname |
| 1069 |
lstecs@\the\@tempcnta\endcsname}% |
| 1070 |
\expandafter\let\csname lstecs@\the\@tempcnta\endcsname~}% |
| 1071 |
\fi |
| 1072 |
\advance\@tempcnta\@ne |
| 1073 |
\repeat} |
| 1074 |
\begingroup \catcode12=\active\let^^L\@empty |
| 1075 |
\gdef\lst@ScanChars{% |
| 1076 |
\let\lsts@ssL^^L% |
| 1077 |
\def^^L{\par}% |
| 1078 |
\lst@GetChars\lst@RestoreOrigCatcodes\@ne {128}% |
| 1079 |
\let^^L\lsts@ssL |
| 1080 |
\lst@GetChars\lst@RestoreOrigExtendedCatcodes{128}{256}} |
| 1081 |
\endgroup |
| 1082 |
\lst@Key{rescanchars}\relax{\lst@ScanChars} |
| 1083 |
\AtBeginDocument{\lst@ScanChars} |
| 1084 |
\lst@Key{alsoletter}\relax{% |
| 1085 |
\lst@DoAlso{#1}\lst@alsoletter\lst@ProcessLetter} |
| 1086 |
\lst@Key{alsodigit}\relax{% |
| 1087 |
\lst@DoAlso{#1}\lst@alsodigit\lst@ProcessDigit} |
| 1088 |
\lst@Key{alsoother}\relax{% |
| 1089 |
\lst@DoAlso{#1}\lst@alsoother\lst@ProcessOther} |
| 1090 |
\lst@AddToHook{SelectCharTable} |
| 1091 |
{\lst@alsoother \lst@alsodigit \lst@alsoletter} |
| 1092 |
\lst@AddToHookExe{SetLanguage}% init |
| 1093 |
{\let\lst@alsoletter\@empty |
| 1094 |
\let\lst@alsodigit\@empty |
| 1095 |
\let\lst@alsoother\@empty} |
| 1096 |
\def\lst@DoAlso#1#2#3{% |
| 1097 |
\lst@DefOther\lst@arg{#1}\let#2\@empty |
| 1098 |
\expandafter\lst@DoAlso@\expandafter#2\expandafter#3\lst@arg\relax} |
| 1099 |
\def\lst@DoAlso@#1#2#3{% |
| 1100 |
\ifx\relax#3\expandafter\@gobblethree \else |
| 1101 |
\begingroup \lccode`\~=`#3\relax \lowercase{\endgroup |
| 1102 |
\def\lst@temp##1\def~##2##3\relax{% |
| 1103 |
\edef\lst@arg{\def\noexpand~{\noexpand#2\expandafter |
| 1104 |
\noexpand\@gobble##2}}}}% |
| 1105 |
\expandafter\lst@temp\lst@SelectStdCharTable\relax |
| 1106 |
\lst@lExtend#1{\lst@arg}% |
| 1107 |
\fi |
| 1108 |
\lst@DoAlso@#1#2} |
| 1109 |
\def\lst@SaveDef#1#2{% |
| 1110 |
\begingroup \lccode`\~=#1\relax \lowercase{\endgroup\let#2~}} |
| 1111 |
\def\lst@DefSaveDef#1#2{% |
| 1112 |
\begingroup \lccode`\~=#1\relax \lowercase{\endgroup\let#2~\def~}} |
| 1113 |
\def\lst@LetSaveDef#1#2{% |
| 1114 |
\begingroup \lccode`\~=#1\relax \lowercase{\endgroup\let#2~\let~}} |
| 1115 |
\def\lst@CDef#1{\lst@CDef@#1} |
| 1116 |
\def\lst@CDef@#1#2#3#4{\lst@CDefIt#1{#2}{#3}{#4#2#3}#4} |
| 1117 |
\def\lst@CDefX#1{\lst@CDefX@#1} |
| 1118 |
\def\lst@CDefX@#1#2#3{\lst@CDefIt#1{#2}{#3}{}} |
| 1119 |
\def\lst@CDefIt#1#2#3#4#5#6#7#8{% |
| 1120 |
\ifx\@empty#2\@empty |
| 1121 |
\def#1{#6\def\lst@next{#7#4#8}\lst@next}% |
| 1122 |
\else \ifx\@empty#3\@empty |
| 1123 |
\def#1##1{% |
| 1124 |
#6% |
| 1125 |
\ifx##1#2\def\lst@next{#7#4#8}\else |
| 1126 |
\def\lst@next{#5##1}\fi |
| 1127 |
\lst@next}% |
| 1128 |
\else |
| 1129 |
\def#1{% |
| 1130 |
#6% |
| 1131 |
\lst@IfNextCharsArg{#2#3}{#7#4#8}% |
| 1132 |
{\expandafter#5\lst@eaten}}% |
| 1133 |
\fi \fi} |
| 1134 |
\def\lst@CArgX#1#2\relax{% |
| 1135 |
\lst@DefActive\lst@arg{#1#2}% |
| 1136 |
\expandafter\lst@CArg\lst@arg\relax} |
| 1137 |
\def\lst@CArg#1#2\relax{% |
| 1138 |
\lccode`\/=`#1\lowercase{\def\lst@temp{/}}% |
| 1139 |
\lst@GetFreeMacro{lst@c\lst@temp}% |
| 1140 |
\expandafter\lst@CArg@\lst@freemacro#1#2\@empty\@empty\relax} |
| 1141 |
\def\lst@CArg@#1#2#3#4\@empty#5\relax#6{% |
| 1142 |
\let#1#2% |
| 1143 |
\ifx\@empty#3\@empty |
| 1144 |
\def\lst@next{#6{#2{}{}}}% |
| 1145 |
\else |
| 1146 |
\def\lst@next{#6{#2#3{#4}}}% |
| 1147 |
\fi |
| 1148 |
\lst@next #1} |
| 1149 |
\def\lst@CArgEmpty#1\@empty{#1} |
| 1150 |
\lst@Key{excludedelims}\relax |
| 1151 |
{\lsthk@ExcludeDelims \lst@NormedDef\lst@temp{#1}% |
| 1152 |
\expandafter\lst@for\lst@temp\do |
| 1153 |
{\expandafter\let\csname\@lst @ifex##1\endcsname\iftrue}} |
| 1154 |
\def\lst@DelimPrint#1#2{% |
| 1155 |
#1% |
| 1156 |
\begingroup |
| 1157 |
\lst@mode\lst@nomode \lst@modetrue |
| 1158 |
#2\lst@XPrintToken |
| 1159 |
\endgroup |
| 1160 |
\lst@ResetToken |
| 1161 |
\fi} |
| 1162 |
\def\lst@DelimOpen#1#2#3#4#5#6\@empty{% |
| 1163 |
\lst@TrackNewLines \lst@XPrintToken |
| 1164 |
\lst@DelimPrint#1{#6}% |
| 1165 |
\lst@EnterMode{#4}{\def\lst@currstyle#5}% |
| 1166 |
\lst@DelimPrint{#1#2}{#6}% |
| 1167 |
#3} |
| 1168 |
\def\lst@DelimClose#1#2#3\@empty{% |
| 1169 |
\lst@TrackNewLines \lst@XPrintToken |
| 1170 |
\lst@DelimPrint{#1#2}{#3}% |
| 1171 |
\lst@LeaveMode |
| 1172 |
\lst@DelimPrint{#1}{#3}} |
| 1173 |
\def\lst@BeginDelim{\lst@DelimOpen\iffalse\else{}} |
| 1174 |
\def\lst@EndDelim{\lst@DelimClose\iffalse\else} |
| 1175 |
\def\lst@BeginIDelim{\lst@DelimOpen\iffalse{}{}} |
| 1176 |
\def\lst@EndIDelim{\lst@DelimClose\iffalse{}} |
| 1177 |
\lst@AddToHook{SelectCharTable}{\lst@DefDelims} |
| 1178 |
\lst@AddToHookExe{SetLanguage}{\let\lst@DefDelims\@empty} |
| 1179 |
\def\lst@Delim#1{% |
| 1180 |
\lst@false \let\lst@cumulative\@empty \let\lst@arg\@empty |
| 1181 |
\@ifstar{\@ifstar{\lst@Delim@{#1}}% |
| 1182 |
{\let\lst@cumulative\relax |
| 1183 |
\lst@Delim@{#1}}}% |
| 1184 |
{\lst@true\lst@Delim@{#1}}} |
| 1185 |
\def\lst@Delim@#1[#2]{% |
| 1186 |
\gdef\lst@delimtype{#2}% |
| 1187 |
\@ifnextchar[\lst@Delim@sty |
| 1188 |
{\lst@Delim@sty[#1]}} |
| 1189 |
\def\lst@Delim@sty[#1]{% |
| 1190 |
\def\lst@delimstyle{#1}% |
| 1191 |
\ifx\@empty#1\@empty\else |
| 1192 |
\lst@Delim@sty@ #1\@nil |
| 1193 |
\fi |
| 1194 |
\@ifnextchar[\lst@Delim@option |
| 1195 |
\lst@Delim@delim} |
| 1196 |
\def\lst@Delim@option[#1]{\def\lst@arg{[#1]}\lst@Delim@delim} |
| 1197 |
\def\lst@Delim@sty@#1#2\@nil{% |
| 1198 |
\if\relax\noexpand#1\else |
| 1199 |
\edef\lst@delimstyle{\expandafter\noexpand |
| 1200 |
\csname\@lst @\lst@delimstyle\endcsname}% |
| 1201 |
\fi} |
| 1202 |
\def\lst@Delim@delim#1\relax#2#3#4#5#6#7#8{% |
| 1203 |
\ifx #4\@empty \lst@Delim@delall{#2}\fi |
| 1204 |
\ifx\@empty#1\@empty |
| 1205 |
\ifx #4\@nil |
| 1206 |
\@ifundefined{\@lst @#2DM@\lst@delimtype}% |
| 1207 |
{\lst@Delim@delall{#2@\lst@delimtype}}% |
| 1208 |
{\lst@Delim@delall{#2DM@\lst@delimtype}}% |
| 1209 |
\fi |
| 1210 |
\else |
| 1211 |
\expandafter\lst@Delim@args\expandafter |
| 1212 |
{\lst@delimtype}{#1}{#5}#6{#7}{#8}#4% |
| 1213 |
\let\lst@delim\@empty |
| 1214 |
\expandafter\lst@IfOneOf\lst@delimtype\relax#3% |
| 1215 |
{\@ifundefined{\@lst @#2DM@\lst@delimtype}% |
| 1216 |
{\lst@lExtend\lst@delim{\csname\@lst @#2@\lst@delimtype |
| 1217 |
\expandafter\endcsname\lst@arg}}% |
| 1218 |
{\lst@lExtend\lst@delim{\expandafter\lst@UseDynamicMode |
| 1219 |
\csname\@lst @#2DM@\lst@delimtype |
| 1220 |
\expandafter\endcsname\lst@arg}}% |
| 1221 |
\ifx #4\@nil |
| 1222 |
\let\lst@temp\lst@DefDelims \let\lst@DefDelims\@empty |
| 1223 |
\expandafter\lst@Delim@del\lst@temp\@empty\@nil\@nil\@nil |
| 1224 |
\else |
| 1225 |
\lst@lExtend\lst@DefDelims\lst@delim |
| 1226 |
\fi}% |
| 1227 |
{\PackageError{Listings}{Illegal type `\lst@delimtype'}% |
| 1228 |
{#2 types are #3.}}% |
| 1229 |
\fi} |
| 1230 |
\def\lst@Delim@args#1#2#3#4#5#6#7{% |
| 1231 |
\begingroup |
| 1232 |
\lst@false \let\lst@next\lst@XConvert |
| 1233 |
\@ifnextchar #4{\xdef\lst@delimtype{\expandafter\@gobble |
| 1234 |
\lst@delimtype}% |
| 1235 |
#5\lst@next#2\@nil |
| 1236 |
\lst@lAddTo\lst@arg{\@empty#6}% |
| 1237 |
\lst@GobbleNil}% |
| 1238 |
{\lst@next#2\@nil |
| 1239 |
\lst@lAddTo\lst@arg{\@empty#3}% |
| 1240 |
\lst@GobbleNil}% |
| 1241 |
#1\@nil |
| 1242 |
\global\let\@gtempa\lst@arg |
| 1243 |
\endgroup |
| 1244 |
\let\lst@arg\@gtempa |
| 1245 |
\ifx #7\@nil\else |
| 1246 |
\expandafter\lst@Delim@args@\expandafter{\lst@delimstyle}% |
| 1247 |
\fi} |
| 1248 |
\def\lst@Delim@args@#1{% |
| 1249 |
\lst@if |
| 1250 |
\lst@lAddTo\lst@arg{{{#1}\lst@modetrue}}% |
| 1251 |
\else |
| 1252 |
\ifx\lst@cumulative\@empty |
| 1253 |
\lst@lAddTo\lst@arg{{{}#1}}% |
| 1254 |
\else |
| 1255 |
\lst@lAddTo\lst@arg{{{#1}}}% |
| 1256 |
\fi |
| 1257 |
\fi} |
| 1258 |
\def\lst@Delim@del#1\@empty#2#3#4{% |
| 1259 |
\ifx #2\@nil\else |
| 1260 |
\def\lst@temp{#1\@empty#2#3}% |
| 1261 |
\ifx\lst@temp\lst@delim\else |
| 1262 |
\lst@lAddTo\lst@DefDelims{#1\@empty#2#3{#4}}% |
| 1263 |
\fi |
| 1264 |
\expandafter\lst@Delim@del |
| 1265 |
\fi} |
| 1266 |
\def\lst@Delim@delall#1{% |
| 1267 |
\begingroup |
| 1268 |
\edef\lst@delim{\expandafter\string\csname\@lst @#1\endcsname}% |
| 1269 |
\lst@false \global\let\@gtempa\@empty |
| 1270 |
\expandafter\lst@Delim@delall@\lst@DefDelims\@empty |
| 1271 |
\endgroup |
| 1272 |
\let\lst@DefDelims\@gtempa} |
| 1273 |
\def\lst@Delim@delall@#1{% |
| 1274 |
\ifx #1\@empty\else |
| 1275 |
\ifx #1\lst@UseDynamicMode |
| 1276 |
\lst@true |
| 1277 |
\let\lst@next\lst@Delim@delall@do |
| 1278 |
\else |
| 1279 |
\def\lst@next{\lst@Delim@delall@do#1}% |
| 1280 |
\fi |
| 1281 |
\expandafter\lst@next |
| 1282 |
\fi} |
| 1283 |
\def\lst@Delim@delall@do#1#2\@empty#3#4#5{% |
| 1284 |
\expandafter\lst@IfSubstring\expandafter{\lst@delim}{\string#1}% |
| 1285 |
{}% |
| 1286 |
{\lst@if \lst@AddTo\@gtempa\lst@UseDynamicMode \fi |
| 1287 |
\lst@AddTo\@gtempa{#1#2\@empty#3#4{#5}}}% |
| 1288 |
\lst@false \lst@Delim@delall@} |
| 1289 |
\gdef\lst@DefDelimB#1#2#3#4#5#6#7#8{% |
| 1290 |
\lst@CDef{#1}#2% |
| 1291 |
{#3}% |
| 1292 |
{\let\lst@bnext\lst@CArgEmpty |
| 1293 |
\lst@ifmode #4\else |
| 1294 |
#5% |
| 1295 |
\def\lst@bnext{#6{#7}{#8}}% |
| 1296 |
\fi |
| 1297 |
\lst@bnext}% |
| 1298 |
\@empty} |
| 1299 |
\gdef\lst@DefDelimE#1#2#3#4#5#6#7{% |
| 1300 |
\lst@CDef{#1}#2% |
| 1301 |
{#3}% |
| 1302 |
{\let\lst@enext\lst@CArgEmpty |
| 1303 |
\ifnum #7=\lst@mode% |
| 1304 |
#4% |
| 1305 |
\let\lst@enext#6% |
| 1306 |
\else |
| 1307 |
#5% |
| 1308 |
\fi |
| 1309 |
\lst@enext}% |
| 1310 |
\@empty} |
| 1311 |
\lst@AddToHook{Init}{\let\lst@bnext\relax \let\lst@enext\relax} |
| 1312 |
\gdef\lst@DefDelimBE#1#2#3#4#5#6#7#8#9{% |
| 1313 |
\lst@CDef{#1}#2% |
| 1314 |
{#3}% |
| 1315 |
{\let\lst@bnext\lst@CArgEmpty |
| 1316 |
\ifnum #7=\lst@mode |
| 1317 |
#4% |
| 1318 |
\let\lst@bnext#9% |
| 1319 |
\else |
| 1320 |
\lst@ifmode\else |
| 1321 |
#5% |
| 1322 |
\def\lst@bnext{#6{#7}{#8}}% |
| 1323 |
\fi |
| 1324 |
\fi |
| 1325 |
\lst@bnext}% |
| 1326 |
\@empty} |
| 1327 |
\gdef\lst@delimtypes{s,l} |
| 1328 |
\gdef\lst@DelimKey#1#2{% |
| 1329 |
\lst@Delim{}#2\relax |
| 1330 |
{Delim}\lst@delimtypes #1% |
| 1331 |
{\lst@BeginDelim\lst@EndDelim} |
| 1332 |
i\@empty{\lst@BeginIDelim\lst@EndIDelim}} |
| 1333 |
\lst@Key{delim}\relax{\lst@DelimKey\@empty{#1}} |
| 1334 |
\lst@Key{moredelim}\relax{\lst@DelimKey\relax{#1}} |
| 1335 |
\lst@Key{deletedelim}\relax{\lst@DelimKey\@nil{#1}} |
| 1336 |
\gdef\lst@DelimDM@l#1#2\@empty#3#4#5{% |
| 1337 |
\lst@CArg #2\relax\lst@DefDelimB{}{}{}#3{#1}{#5\lst@Lmodetrue}} |
| 1338 |
\gdef\lst@DelimDM@s#1#2#3\@empty#4#5#6{% |
| 1339 |
\lst@CArg #2\relax\lst@DefDelimB{}{}{}#4{#1}{#6}% |
| 1340 |
\lst@CArg #3\relax\lst@DefDelimE{}{}{}#5{#1}} |
| 1341 |
\def\lst@ReplaceInput#1{\lst@CArgX #1\relax\lst@CDefX{}{}} |
| 1342 |
\def\lst@Literatekey#1\@nil@{\let\lst@ifxliterate\lst@if |
| 1343 |
\def\lst@literate{#1}} |
| 1344 |
\lst@Key{literate}{}{\@ifstar{\lst@true \lst@Literatekey} |
| 1345 |
{\lst@false\lst@Literatekey}#1\@nil@} |
| 1346 |
\lst@AddToHook{SelectCharTable} |
| 1347 |
{\ifx\lst@literate\@empty\else |
| 1348 |
\expandafter\lst@Literate\lst@literate{}\relax\z@ |
| 1349 |
\fi} |
| 1350 |
\def\lst@Literate#1#2#3{% |
| 1351 |
\ifx\relax#2\@empty\else |
| 1352 |
\lst@CArgX #1\relax\lst@CDef |
| 1353 |
{} |
| 1354 |
{\let\lst@next\@empty |
| 1355 |
\lst@ifxliterate |
| 1356 |
\lst@ifmode \let\lst@next\lst@CArgEmpty \fi |
| 1357 |
\fi |
| 1358 |
\ifx\lst@next\@empty |
| 1359 |
\ifx\lst@OutputBox\@gobble\else |
| 1360 |
\lst@XPrintToken \let\lst@scanmode\lst@scan@m |
| 1361 |
\lst@token{#2}\lst@length#3\relax |
| 1362 |
\lst@XPrintToken |
| 1363 |
\fi |
| 1364 |
\let\lst@next\lst@CArgEmptyGobble |
| 1365 |
\fi |
| 1366 |
\lst@next}% |
| 1367 |
\@empty |
| 1368 |
\expandafter\lst@Literate |
| 1369 |
\fi} |
| 1370 |
\def\lst@CArgEmptyGobble#1\@empty{} |
| 1371 |
\def\lst@BeginDropInput#1{% |
| 1372 |
\lst@EnterMode{#1}% |
| 1373 |
{\lst@modetrue |
| 1374 |
\let\lst@OutputBox\@gobble |
| 1375 |
\let\lst@ifdropinput\iftrue |
| 1376 |
\let\lst@ProcessLetter\@gobble |
| 1377 |
\let\lst@ProcessDigit\@gobble |
| 1378 |
\let\lst@ProcessOther\@gobble |
| 1379 |
\let\lst@ProcessSpace\@empty |
| 1380 |
\let\lst@ProcessTabulator\@empty |
| 1381 |
\let\lst@ProcessFormFeed\@empty}} |
| 1382 |
\let\lst@ifdropinput\iffalse % init |
| 1383 |
\lst@Key{basicstyle}\relax{\def\lst@basicstyle{#1}} |
| 1384 |
\lst@Key{inputencoding}\relax{\def\lst@inputenc{#1}} |
| 1385 |
\lst@AddToHook{Init} |
| 1386 |
{\lst@basicstyle |
| 1387 |
\ifx\lst@inputenc\@empty\else |
| 1388 |
\@ifundefined{inputencoding}{}% |
| 1389 |
{\inputencoding\lst@inputenc}% |
| 1390 |
\fi} |
| 1391 |
\lst@AddToHookExe{EmptyStyle} |
| 1392 |
{\let\lst@basicstyle\@empty |
| 1393 |
\let\lst@inputenc\@empty} |
| 1394 |
\lst@Key{multicols}{}{\@tempcnta=0#1\relax\def\lst@multicols{#1}} |
| 1395 |
\def\lst@parshape{\parshape\@ne \z@ \linewidth} |
| 1396 |
\lst@AddToHookAtTop{EveryLine}{\lst@parshape} |
| 1397 |
\lst@AddToHookAtTop{EndGroup}{\lst@parshape} |
| 1398 |
\newcount\lst@lineno % \global |
| 1399 |
\lst@AddToHook{InitVars}{\global\lst@lineno\@ne} |
| 1400 |
\lst@Key{print}{true}[t]{\lstKV@SetIf{#1}\lst@ifprint} |
| 1401 |
\lst@Key{firstline}\relax{\def\lst@firstline{#1\relax}} |
| 1402 |
\lst@Key{lastline}\relax{\def\lst@lastline{#1\relax}} |
| 1403 |
\lst@AddToHook{PreSet} |
| 1404 |
{% |
| 1405 |
\def\lst@firstline{1\relax} |
| 1406 |
\def\lst@lastline{9999999\relax} |
| 1407 |
\let\lst@linerange\@empty |
| 1408 |
} |
| 1409 |
\lst@Key{nolol}{false}[t]{\lstKV@SetIf{#1}\lst@ifnolol} |
| 1410 |
\def\lst@nololtrue{\let\lst@ifnolol\iftrue} |
| 1411 |
\let\lst@ifnolol\iffalse % init |
| 1412 |
\lst@Key{linerange}\relax{\lstKV@OptArg[]{#1}{% |
| 1413 |
\def\lst@interrange{##1}\def\lst@linerange{##2,}}} |
| 1414 |
\lst@Key{consecutivenumbers}{true}[t]{% |
| 1415 |
\lstKV@SetIf{#1}\lst@ifconsecutivenumbers} |
| 1416 |
\lst@Key{rangeprefix}\relax{\def\lst@rangebeginprefix{#1}% |
| 1417 |
\def\lst@rangeendprefix{#1}} |
| 1418 |
\lst@Key{rangesuffix}\relax{\def\lst@rangebeginsuffix{#1}% |
| 1419 |
\def\lst@rangeendsuffix{#1}} |
| 1420 |
\lst@Key{rangebeginprefix}{}{\def\lst@rangebeginprefix{#1}} |
| 1421 |
\lst@Key{rangebeginsuffix}{}{\def\lst@rangebeginsuffix{#1}} |
| 1422 |
\lst@Key{rangeendprefix}{}{\def\lst@rangeendprefix{#1}} |
| 1423 |
\lst@Key{rangeendsuffix}{}{\def\lst@rangeendsuffix{#1}} |
| 1424 |
\lst@Key{includerangemarker}{true}[t]{\lstKV@SetIf{#1}% |
| 1425 |
\lst@ifincluderangemarker} |
| 1426 |
\lst@AddToHook{Init} |
| 1427 |
{% |
| 1428 |
\ifx\lst@linerange\@empty |
| 1429 |
\edef\lst@linerange{{\lst@firstline}-{\lst@lastline},}% |
| 1430 |
\fi% |
| 1431 |
\lst@GetLineInterval% |
| 1432 |
}% |
| 1433 |
\def\lst@GetLineInterval{\expandafter\lst@GLI\lst@linerange\@nil} |
| 1434 |
\def\lst@GLI#1,#2\@nil{% GLI: get line interval |
| 1435 |
\def\lst@linerange{#2}\lst@GLI@#1--\@nil% |
| 1436 |
} |
| 1437 |
\def\lst@GLI@#1-#2-#3\@nil{% |
| 1438 |
|
| 1439 |
\lst@IfNumber{#1}% |
| 1440 |
{% |
| 1441 |
\ifx\@empty#1\@empty |
| 1442 |
\let\lst@firstline\@ne |
| 1443 |
\else |
| 1444 |
\def\lst@firstline{#1\relax} |
| 1445 |
\fi |
| 1446 |
\ifx\@empty#3\@empty |
| 1447 |
\def\lst@lastline{9999999\relax} |
| 1448 |
\ifx\@empty#2\@empty |
| 1449 |
\let\lst@lastline\lst@firstline |
| 1450 |
\fi |
| 1451 |
\else% |
| 1452 |
\ifx\@empty#2\@empty |
| 1453 |
\def\lst@lastline{9999999\relax} |
| 1454 |
\else % doesn't happen(?) |
| 1455 |
\def\lst@lastline{#2\relax} |
| 1456 |
\fi |
| 1457 |
\fi |
| 1458 |
}% |
| 1459 |
{% |
| 1460 |
\def\lst@firstline{9999999\relax} |
| 1461 |
\let\lst@lastline\lst@firstline |
| 1462 |
\let\lst@rangebegin\lst@rangebeginprefix |
| 1463 |
\lst@AddTo\lst@rangebegin{#1}% |
| 1464 |
\lst@Extend\lst@rangebegin\lst@rangebeginsuffix |
| 1465 |
\ifx\@empty#3\@empty |
| 1466 |
\let\lst@rangeend\lst@rangeendprefix |
| 1467 |
\lst@AddTo\lst@rangeend{#1} |
| 1468 |
\lst@Extend\lst@rangeend\lst@rangeendsuffix |
| 1469 |
\else |
| 1470 |
\ifx\@empty#2\@empty |
| 1471 |
\let\lst@rangeend\@empty |
| 1472 |
\else |
| 1473 |
\let\lst@rangeend\lst@rangeendprefix |
| 1474 |
\lst@AddTo\lst@rangeend{#2}% |
| 1475 |
\lst@Extend\lst@rangeend\lst@rangeendsuffix |
| 1476 |
\fi |
| 1477 |
\fi |
| 1478 |
\global\def\lst@DefRange{% |
| 1479 |
\expandafter\lst@CArgX\lst@rangebegin\relax\lst@DefRangeB}% |
| 1480 |
\ifnum\lst@mode=\lst@Pmode \expandafter\lst@DefRange \fi% |
| 1481 |
}% |
| 1482 |
} |
| 1483 |
\lst@AddToHookExe{DeInit}{\global\let\lst@DefRange\@empty} |
| 1484 |
\def\lst@DefRangeB#1#2{\lst@DefRangeB@#1#2} |
| 1485 |
\def\lst@DefRangeB@#1#2#3#4{% |
| 1486 |
\lst@CDef{#1{#2}{#3}}#4{}{% |
| 1487 |
\lst@ifincluderangemarker |
| 1488 |
\lst@LeaveMode |
| 1489 |
\let#1#4% |
| 1490 |
\lst@DefRangeEnd |
| 1491 |
\lst@InitLstNumber |
| 1492 |
\else |
| 1493 |
\@tempcnta\lst@lineno \advance\@tempcnta\@ne |
| 1494 |
\edef\lst@firstline{\the\@tempcnta\relax}% |
| 1495 |
\gdef\lst@OnceAtEOL{\let#1#4\lst@DefRangeEnd}% |
| 1496 |
\lst@InitLstNumber |
| 1497 |
\fi |
| 1498 |
\global\let\lst@DefRange\lst@DefRangeEnd |
| 1499 |
\lst@CArgEmpty% |
| 1500 |
}% |
| 1501 |
\@empty% |
| 1502 |
} |
| 1503 |
\def\lstpatch@labels{% |
| 1504 |
\gdef\lst@SetFirstNumber{% |
| 1505 |
\ifx\lst@firstnumber\@undefined |
| 1506 |
\@tempcnta 0\csname\@lst no@\lst@intname\endcsname\relax |
| 1507 |
\ifnum\@tempcnta=\z@ \else |
| 1508 |
\lst@nololtrue |
| 1509 |
\advance\@tempcnta\lst@advancenumber |
| 1510 |
\edef\lst@firstnumber{\the\@tempcnta\relax} |
| 1511 |
\fi |
| 1512 |
\fi |
| 1513 |
} |
| 1514 |
} |
| 1515 |
\def\lst@InitLstNumber{% |
| 1516 |
\global\c@lstnumber\lst@firstnumber |
| 1517 |
\global\advance\c@lstnumber\lst@advancenumber |
| 1518 |
\global\advance\c@lstnumber-\lst@advancelstnum |
| 1519 |
\ifx \lst@firstnumber\c@lstnumber |
| 1520 |
\global\advance\c@lstnumber-\lst@advancelstnum |
| 1521 |
\fi% |
| 1522 |
\lst@ifincluderangemarker\else% |
| 1523 |
\global\advance\c@lstnumber by 1% |
| 1524 |
\fi% |
| 1525 |
} |
| 1526 |
\def\lst@DefRangeEnd{% |
| 1527 |
\ifx\lst@rangeend\@empty\else |
| 1528 |
\expandafter\lst@CArgX\lst@rangeend\relax\lst@DefRangeE |
| 1529 |
\fi} |
| 1530 |
\def\lst@DefRangeE#1#2{\lst@DefRangeE@#1#2} |
| 1531 |
\def\lst@DefRangeE@#1#2#3#4{% |
| 1532 |
\lst@CDef{#1#2{#3}}#4{}% |
| 1533 |
{\let#1#4% |
| 1534 |
\edef\lst@lastline{\the\lst@lineno\relax}% |
| 1535 |
\lst@DefRangeE@@}% |
| 1536 |
\@empty} |
| 1537 |
\def\lst@DefRangeE@@#1\@empty{% |
| 1538 |
\lst@ifincluderangemarker |
| 1539 |
#1\lst@XPrintToken |
| 1540 |
\fi |
| 1541 |
\lst@LeaveModeToPmode |
| 1542 |
\lst@BeginDropInput{\lst@Pmode}} |
| 1543 |
\def\lst@LeaveModeToPmode{% |
| 1544 |
\ifnum\lst@mode=\lst@Pmode |
| 1545 |
\expandafter\lsthk@EndGroup |
| 1546 |
\else |
| 1547 |
\expandafter\egroup\expandafter\lst@LeaveModeToPmode |
| 1548 |
\fi} |
| 1549 |
\def\lst@DisplayConsecutiveNumbersOrNot{% |
| 1550 |
\lst@ifconsecutivenumbers\else% |
| 1551 |
\c@lstnumber=\numexpr-1+\lst@lineno |
| 1552 |
\fi% |
| 1553 |
} |
| 1554 |
\lst@AddToHook{EOL}{\lst@OnceAtEOL\global\let\lst@OnceAtEOL\@empty} |
| 1555 |
\gdef\lst@OnceAtEOL{}% Init |
| 1556 |
\def\lst@MSkipToFirst{% |
| 1557 |
\global\advance\lst@lineno\@ne |
| 1558 |
\ifnum \lst@lineno=\lst@firstline |
| 1559 |
\def\lst@next{\lst@LeaveMode \global\lst@newlines\z@ |
| 1560 |
\lst@OnceAtEOL \global\let\lst@OnceAtEOL\@empty |
| 1561 |
\lst@InitLstNumber % Added to work with modified \lsthk@PreInit. |
| 1562 |
\lsthk@InitVarsBOL |
| 1563 |
\lst@BOLGobble}% |
| 1564 |
\expandafter\lst@next |
| 1565 |
\fi} |
| 1566 |
\def\lst@SkipToFirst{% |
| 1567 |
\ifnum \lst@lineno<\lst@firstline |
| 1568 |
\def\lst@next{\lst@BeginDropInput\lst@Pmode |
| 1569 |
\lst@Let{13}\lst@MSkipToFirst |
| 1570 |
\lst@Let{10}\lst@MSkipToFirst}% |
| 1571 |
\expandafter\lst@next |
| 1572 |
\else |
| 1573 |
\expandafter\lst@BOLGobble |
| 1574 |
\fi} |
| 1575 |
\def\lst@IfNumber#1{% |
| 1576 |
\ifx\@empty#1\@empty |
| 1577 |
\let\lst@next\@firstoftwo |
| 1578 |
\else |
| 1579 |
\lst@IfNumber@#1\@nil |
| 1580 |
\fi |
| 1581 |
\lst@next} |
| 1582 |
\def\lst@IfNumber@#1#2\@nil{% |
| 1583 |
\let\lst@next\@secondoftwo |
| 1584 |
\ifnum`#1>47\relax \ifnum`#1>57\relax\else |
| 1585 |
\let\lst@next\@firstoftwo |
| 1586 |
\fi\fi} |
| 1587 |
\lst@Key{captionpos}{t}{\def\lst@captionpos{#1}} |
| 1588 |
\lst@Key{abovecaptionskip}\smallskipamount{% |
| 1589 |
\def\lst@abovecaption{#1}} |
| 1590 |
\lst@Key{belowcaptionskip}\smallskipamount{% |
| 1591 |
\def\lst@belowcaption{#1}} |
| 1592 |
\lst@Key{label}\relax{\def\lst@label{#1}} |
| 1593 |
\lst@Key{title}\relax{\def\lst@title{#1}\let\lst@caption\relax} |
| 1594 |
\lst@Key{caption}\relax{\lstKV@OptArg[{#1}]{#1}% |
| 1595 |
{\def\lst@caption{##2}\def\lst@@caption{##1}}% |
| 1596 |
\let\lst@title\@empty} |
| 1597 |
\lst@AddToHookExe{TextStyle} |
| 1598 |
{\let\lst@caption\@empty \let\lst@@caption\@empty |
| 1599 |
\let\lst@title\@empty \let\lst@label\@empty} |
| 1600 |
\AtBeginDocument{% |
| 1601 |
\@ifundefined{thechapter}{\let\lst@ifnumberbychapter\iffalse}{} |
| 1602 |
\lst@ifnumberbychapter |
| 1603 |
\newcounter{lstlisting}[chapter] |
| 1604 |
\gdef\thelstlisting% |
| 1605 |
{\ifnum \c@chapter>\z@ \thechapter.\fi \@arabic\c@lstlisting} |
| 1606 |
\else |
| 1607 |
\newcounter{lstlisting} |
| 1608 |
\gdef\thelstlisting{\@arabic\c@lstlisting} |
| 1609 |
\fi} |
| 1610 |
\lst@UserCommand\lstlistingname{Listing} |
| 1611 |
\lst@UserCommand\lstlistingnamestyle{} |
| 1612 |
\lst@Key{numberbychapter}{true}[t]{% |
| 1613 |
\lstKV@SetIf{#1}\lst@ifnumberbychapter} |
| 1614 |
\@ifundefined{abovecaptionskip}{% |
| 1615 |
\newskip\abovecaptionskip% |
| 1616 |
\newskip\belowcaptionskip% |
| 1617 |
}{} |
| 1618 |
\@ifundefined{@makecaption}{% |
| 1619 |
\long\def\@makecaption#1#2{% |
| 1620 |
\vskip\abovecaptionskip% |
| 1621 |
\sbox\@tempboxa{#1: #2}% |
| 1622 |
\ifdim \wd\@tempboxa >\hsize% |
| 1623 |
#1: #2\par% |
| 1624 |
\else% |
| 1625 |
\global \@minipagefalse% |
| 1626 |
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% |
| 1627 |
\fi% |
| 1628 |
\vskip\belowcaptionskip}% |
| 1629 |
}{} |
| 1630 |
\def\fnum@lstlisting{% |
| 1631 |
{\lstlistingnamestyle\lstlistingname |
| 1632 |
\ifx\lst@@caption\@empty\else~\thelstlisting\fi}% |
| 1633 |
} |
| 1634 |
\def\ext@lstlisting{lol} |
| 1635 |
\def\lst@MakeCaption#1{% |
| 1636 |
\lst@ifdisplaystyle |
| 1637 |
\ifx #1t \allowbreak% |
| 1638 |
\ifx\lst@@caption\@empty\expandafter\lst@HRefStepCounter \else |
| 1639 |
\expandafter\refstepcounter |
| 1640 |
\fi {lstlisting}% |
| 1641 |
\ifx\lst@label\@empty\else \label{\lst@label}\fi |
| 1642 |
\let\lst@arg\lst@intname \lst@ReplaceIn\lst@arg\lst@filenamerpl |
| 1643 |
\global\let\lst@name\lst@arg \global\let\lstname\lst@name |
| 1644 |
\lst@ifnolol\else |
| 1645 |
\ifx\lst@@caption\@empty |
| 1646 |
\ifx\lst@caption\@empty |
| 1647 |
\ifx\lst@intname\@empty \else \def\lst@temp{ }% |
| 1648 |
\ifx\lst@intname\lst@temp \else |
| 1649 |
\addcontentsline{\ext@lstlisting}{lstlisting}\lst@name |
| 1650 |
\fi\fi |
| 1651 |
\fi |
| 1652 |
\else |
| 1653 |
\addcontentsline{\ext@lstlisting}{lstlisting}% |
| 1654 |
{\protect\numberline{\thelstlisting}\lst@@caption}% |
| 1655 |
\fi |
| 1656 |
\fi |
| 1657 |
\fi |
| 1658 |
\ifx\lst@caption\@empty\else |
| 1659 |
\lst@IfSubstring #1\lst@captionpos |
| 1660 |
{\begingroup \let\@@vskip\vskip |
| 1661 |
\def\vskip{\afterassignment\lst@vskip \@tempskipa}% |
| 1662 |
\def\lst@vskip{\nobreak\@@vskip\@tempskipa\nobreak}% |
| 1663 |
\par\@parboxrestore\normalsize\normalfont % \noindent (AS) |
| 1664 |
%%\ifx #1t\allowbreak \fi |
| 1665 |
\ifx\lst@title\@empty |
| 1666 |
\lst@makecaption\fnum@lstlisting{% |
| 1667 |
\ignorespaces \lst@caption} |
| 1668 |
\else |
| 1669 |
\lst@maketitle\lst@title % (AS) |
| 1670 |
\fi |
| 1671 |
\ifx #1b\allowbreak \fi |
| 1672 |
\endgroup}{}% |
| 1673 |
\fi |
| 1674 |
\fi} |
| 1675 |
\def\lst@makecaption{\def\@captype{lstlisting}\@makecaption} |
| 1676 |
\def\lst@maketitle{\@makecaption\lst@title@dropdelim} |
| 1677 |
\def\lst@title@dropdelim#1{\ignorespaces} |
| 1678 |
\AtBeginDocument{% |
| 1679 |
\@ifundefined{captionlabelfalse}{}{% |
| 1680 |
\def\lst@maketitle{\captionlabelfalse\@makecaption\@empty}}% |
| 1681 |
\@ifundefined{caption@startrue}{}{% |
| 1682 |
\def\lst@maketitle{\caption@startrue\@makecaption\@empty}}% |
| 1683 |
} |
| 1684 |
\def\lst@HRefStepCounter#1{% |
| 1685 |
\begingroup |
| 1686 |
\c@lstlisting\lst@neglisting |
| 1687 |
\advance\c@lstlisting\m@ne \xdef\lst@neglisting{\the\c@lstlisting}% |
| 1688 |
\ifx\hyper@refstepcounter\@undefined\else |
| 1689 |
\hyper@refstepcounter{#1}% |
| 1690 |
\fi |
| 1691 |
\endgroup |
| 1692 |
} |
| 1693 |
\gdef\lst@neglisting{\z@}% init, \z@ can be used both for 0pt and 0, |
| 1694 |
% remember: _neg_ative number, but no |
| 1695 |
% counter! |
| 1696 |
\lst@Key{boxpos}{c}{\def\lst@boxpos{#1}} |
| 1697 |
\def\lst@boxtrue{\let\lst@ifbox\iftrue} |
| 1698 |
\let\lst@ifbox\iffalse |
| 1699 |
\lst@Key{float}\relax[\lst@floatplacement]{% |
| 1700 |
\lstKV@SwitchCases{#1}% |
| 1701 |
{true:\let\lst@floatdefault\lst@floatplacement |
| 1702 |
\let\lst@float\lst@floatdefault\\% |
| 1703 |
false:\let\lst@floatdefault\relax |
| 1704 |
\let\lst@float\lst@floatdefault |
| 1705 |
}{\def\lst@next{\@ifstar{\let\lst@beginfloat\@dblfloat |
| 1706 |
\let\lst@endfloat\end@dblfloat |
| 1707 |
\lst@KFloat}% |
| 1708 |
{\let\lst@beginfloat\@float |
| 1709 |
\let\lst@endfloat\end@float |
| 1710 |
\lst@KFloat}} |
| 1711 |
\edef\lst@float{#1}% |
| 1712 |
\expandafter\lst@next\lst@float\relax}} |
| 1713 |
\def\lst@KFloat#1\relax{% |
| 1714 |
\ifx\@empty#1\@empty |
| 1715 |
\let\lst@float\lst@floatplacement |
| 1716 |
\else |
| 1717 |
\def\lst@float{#1}% |
| 1718 |
\fi} |
| 1719 |
\lst@Key{floatplacement}{tbp}{\def\lst@floatplacement{#1}} |
| 1720 |
\lst@AddToHook{PreSet}{\let\lst@float\lst@floatdefault} |
| 1721 |
\lst@AddToHook{TextStyle}{\let\lst@float\relax} |
| 1722 |
\let\lst@floatdefault\relax % init |
| 1723 |
\lst@AddToHook{DeInit}{% |
| 1724 |
\ifx\lst@float\relax |
| 1725 |
\global\let\lst@doendpe\@doendpe |
| 1726 |
\else |
| 1727 |
\global\let\lst@doendpe\@empty |
| 1728 |
\fi} |
| 1729 |
\AtBeginDocument{% |
| 1730 |
\@ifundefined{c@float@type}% |
| 1731 |
{\edef\ftype@lstlisting{\ifx\c@figure\@undefined 1\else 4\fi}} |
| 1732 |
{\edef\ftype@lstlisting{\the\c@float@type}% |
| 1733 |
\addtocounter{float@type}{\value{float@type}}}% |
| 1734 |
} |
| 1735 |
\lst@Key{aboveskip}\medskipamount{\def\lst@aboveskip{#1}} |
| 1736 |
\lst@Key{belowskip}\medskipamount{\def\lst@belowskip{#1}} |
| 1737 |
\lst@AddToHook{TextStyle} |
| 1738 |
{\let\lst@aboveskip\z@ \let\lst@belowskip\z@} |
| 1739 |
\lst@Key{everydisplay}{}{\def\lst@EveryDisplay{#1}} |
| 1740 |
\lst@AddToHook{TextStyle}{\let\lst@ifdisplaystyle\iffalse} |
| 1741 |
\lst@AddToHook{DisplayStyle}{\let\lst@ifdisplaystyle\iftrue} |
| 1742 |
\let\lst@ifdisplaystyle\iffalse |
| 1743 |
\def\lst@Init#1{% |
| 1744 |
\begingroup |
| 1745 |
\ifx\lst@float\relax\else |
| 1746 |
\edef\@tempa{\noexpand\lst@beginfloat{lstlisting}[\lst@float]}% |
| 1747 |
\expandafter\@tempa |
| 1748 |
\fi |
| 1749 |
\ifx\lst@multicols\@empty\else |
| 1750 |
\edef\lst@next{\noexpand\multicols{\lst@multicols}} |
| 1751 |
\expandafter\lst@next |
| 1752 |
\fi |
| 1753 |
\ifhmode\ifinner \lst@boxtrue \fi\fi |
| 1754 |
\lst@ifbox |
| 1755 |
\lsthk@BoxUnsafe |
| 1756 |
\hbox to\z@\bgroup |
| 1757 |
$\if t\lst@boxpos \vtop |
| 1758 |
\else \if b\lst@boxpos \vbox |
| 1759 |
\else \vcenter \fi\fi |
| 1760 |
\bgroup \par\noindent |
| 1761 |
\else |
| 1762 |
\lst@ifdisplaystyle |
| 1763 |
\lst@EveryDisplay |
| 1764 |
\par\penalty-50\relax |
| 1765 |
\vspace\lst@aboveskip |
| 1766 |
\fi |
| 1767 |
\fi |
| 1768 |
\normalbaselines |
| 1769 |
\abovecaptionskip\lst@abovecaption\relax |
| 1770 |
\belowcaptionskip\lst@belowcaption\relax |
| 1771 |
\lst@MakeCaption t% |
| 1772 |
\lsthk@PreInit \lsthk@Init |
| 1773 |
\lst@ifdisplaystyle |
| 1774 |
\global\let\lst@ltxlabel\@empty |
| 1775 |
\if@inlabel |
| 1776 |
\lst@ifresetmargins |
| 1777 |
\leavevmode |
| 1778 |
\else |
| 1779 |
\xdef\lst@ltxlabel{\the\everypar}% |
| 1780 |
\lst@AddTo\lst@ltxlabel{% |
| 1781 |
\global\let\lst@ltxlabel\@empty |
| 1782 |
\everypar{\lsthk@EveryLine\lsthk@EveryPar}}% |
| 1783 |
\fi |
| 1784 |
\fi |
| 1785 |
\everypar\expandafter{\lst@ltxlabel |
| 1786 |
\lsthk@EveryLine\lsthk@EveryPar}% |
| 1787 |
\else |
| 1788 |
\everypar{}\let\lst@NewLine\@empty |
| 1789 |
\fi |
| 1790 |
\lsthk@InitVars \lsthk@InitVarsBOL |
| 1791 |
\lst@Let{13}\lst@MProcessListing |
| 1792 |
\let\lst@Backslash#1% |
| 1793 |
\lst@EnterMode{\lst@Pmode}{\lst@SelectCharTable}% |
| 1794 |
\lst@InitFinalize} |
| 1795 |
\let\lst@InitFinalize\@empty % init |
| 1796 |
\lst@AddToHook{PreInit} |
| 1797 |
{\rightskip\z@ \leftskip\z@ \parfillskip=\z@ plus 1fil |
| 1798 |
\let\par\@@par} |
| 1799 |
\lst@AddToHook{EveryLine}{}% init |
| 1800 |
\lst@AddToHook{EveryPar}{}% init |
| 1801 |
\lst@Key{showlines}f[t]{\lstKV@SetIf{#1}\lst@ifshowlines} |
| 1802 |
\def\lst@DeInit{% |
| 1803 |
\lst@XPrintToken \lst@EOLUpdate |
| 1804 |
\global\advance\lst@newlines\m@ne |
| 1805 |
\lst@ifshowlines |
| 1806 |
\lst@DoNewLines |
| 1807 |
\else |
| 1808 |
\setbox\@tempboxa\vbox{\lst@DoNewLines}% |
| 1809 |
\fi |
| 1810 |
\lst@ifdisplaystyle \par\removelastskip \fi |
| 1811 |
\lsthk@ExitVars\everypar{}\lsthk@DeInit\normalbaselines\normalcolor |
| 1812 |
\lst@MakeCaption b% |
| 1813 |
\lst@ifbox |
| 1814 |
\egroup $\hss \egroup |
| 1815 |
\vrule\@width\lst@maxwidth\@height\z@\@depth\z@ |
| 1816 |
\else |
| 1817 |
\lst@ifdisplaystyle |
| 1818 |
\par\penalty-50\vspace\lst@belowskip |
| 1819 |
\fi |
| 1820 |
\fi |
| 1821 |
\ifx\lst@multicols\@empty\else |
| 1822 |
\def\lst@next{\global\let\@checkend\@gobble |
| 1823 |
\endmulticols |
| 1824 |
\global\let\@checkend\lst@@checkend} |
| 1825 |
\expandafter\lst@next |
| 1826 |
\fi |
| 1827 |
\ifx\lst@float\relax\else |
| 1828 |
\expandafter\lst@endfloat |
| 1829 |
\fi |
| 1830 |
\endgroup} |
| 1831 |
\let\lst@@checkend\@checkend |
| 1832 |
\newdimen\lst@maxwidth % \global |
| 1833 |
\lst@AddToHook{InitVars}{\global\lst@maxwidth\z@} |
| 1834 |
\lst@AddToHook{InitVarsEOL} |
| 1835 |
{\ifdim\lst@currlwidth>\lst@maxwidth |
| 1836 |
\global\lst@maxwidth\lst@currlwidth |
| 1837 |
\fi} |
| 1838 |
\def\lst@EOLUpdate{\lsthk@EOL \lsthk@InitVarsEOL} |
| 1839 |
\def\lst@MProcessListing{% |
| 1840 |
\lst@XPrintToken \lst@EOLUpdate \lsthk@InitVarsBOL |
| 1841 |
\global\advance\lst@lineno\@ne |
| 1842 |
\ifnum \lst@lineno>\lst@lastline |
| 1843 |
\lst@ifdropinput \lst@LeaveMode \fi |
| 1844 |
\ifx\lst@linerange\@empty |
| 1845 |
\expandafter\expandafter\expandafter\lst@EndProcessListing |
| 1846 |
\else |
| 1847 |
\lst@interrange |
| 1848 |
\lst@GetLineInterval |
| 1849 |
\expandafter\expandafter\expandafter\lst@SkipToFirst |
| 1850 |
\fi |
| 1851 |
\else |
| 1852 |
\expandafter\lst@BOLGobble |
| 1853 |
\fi} |
| 1854 |
\let\lst@EndProcessListing\endinput |
| 1855 |
\lst@Key{gobble}{0}{\def\lst@gobble{#1}} |
| 1856 |
\def\lst@BOLGobble{% |
| 1857 |
\ifnum\lst@gobble>\z@ |
| 1858 |
\@tempcnta\lst@gobble\relax |
| 1859 |
\expandafter\lst@BOLGobble@ |
| 1860 |
\fi} |
| 1861 |
\def\lst@BOLGobble@@{% |
| 1862 |
\ifnum\@tempcnta>\z@ |
| 1863 |
\expandafter\lst@BOLGobble@ |
| 1864 |
\fi} |
| 1865 |
\def\lstenv@BOLGobble@@{% |
| 1866 |
\lst@IfNextChars\lstenv@endstring{\lstenv@End}% |
| 1867 |
{\advance\@tempcnta\m@ne \expandafter\lst@BOLGobble@@\lst@eaten}} |
| 1868 |
\def\lst@BOLGobble@#1{% |
| 1869 |
\let\lst@next#1% |
| 1870 |
\ifx \lst@next\relax\else |
| 1871 |
\ifx \lst@next\lst@MProcessListing\else |
| 1872 |
\ifx \lst@next\lst@processformfeed\else |
| 1873 |
\ifx \lst@next\lstenv@backslash |
| 1874 |
\let\lst@next\lstenv@BOLGobble@@ |
| 1875 |
\else |
| 1876 |
\let\lst@next\lst@BOLGobble@@ |
| 1877 |
\ifx #1\lst@processtabulator |
| 1878 |
\advance\@tempcnta-\lst@tabsize\relax |
| 1879 |
\ifnum\@tempcnta<\z@ |
| 1880 |
\lst@length-\@tempcnta \lst@PreGotoTabStop |
| 1881 |
\fi |
| 1882 |
\else |
| 1883 |
\advance\@tempcnta\m@ne |
| 1884 |
\fi |
| 1885 |
\fi \fi \fi \fi |
| 1886 |
\lst@next} |
| 1887 |
\def\lst@processformfeed{\lst@ProcessFormFeed} |
| 1888 |
\def\lst@processtabulator{\lst@ProcessTabulator} |
| 1889 |
\lst@Key{name}\relax{\def\lst@intname{#1}} |
| 1890 |
\lst@AddToHookExe{PreSet}{\global\let\lst@intname\@empty} |
| 1891 |
\lst@AddToHook{PreInit}{% |
| 1892 |
\let\lst@arg\lst@intname \lst@ReplaceIn\lst@arg\lst@filenamerpl |
| 1893 |
\global\let\lst@name\lst@arg \global\let\lstname\lst@name} |
| 1894 |
\def\lst@filenamerpl{_\textunderscore $\textdollar -\textendash} |
| 1895 |
\def\l@lstlisting#1#2{\@dottedtocline{1}{1.5em}{2.3em}{#1}{#2}} |
| 1896 |
\lst@UserCommand\lstlistlistingname{Listings} |
| 1897 |
\lst@UserCommand\lstlistoflistings{\bgroup |
| 1898 |
\let\contentsname\lstlistlistingname |
| 1899 |
\let\lst@temp\@starttoc |
| 1900 |
\def\@starttoc##1{\lst@temp{\ext@lstlisting}}% |
| 1901 |
\tableofcontents \egroup} |
| 1902 |
\@ifundefined{float@listhead}{}{% |
| 1903 |
\renewcommand*{\lstlistoflistings}{% |
| 1904 |
\begingroup |
| 1905 |
\@ifundefined{@restonecoltrue}{}{% |
| 1906 |
\if@twocolumn |
| 1907 |
\@restonecoltrue\onecolumn |
| 1908 |
\else |
| 1909 |
\@restonecolfalse |
| 1910 |
\fi |
| 1911 |
}% |
| 1912 |
\float@listhead{\lstlistlistingname}% |
| 1913 |
\parskip\z@\parindent\z@\parfillskip \z@ \@plus 1fil% |
| 1914 |
\@starttoc{\ext@lstlisting}% |
| 1915 |
\@ifundefined{@restonecoltrue}{}{% |
| 1916 |
\if@restonecol\twocolumn\fi |
| 1917 |
}% |
| 1918 |
\endgroup |
| 1919 |
}% |
| 1920 |
} |
| 1921 |
\AtBeginDocument{% |
| 1922 |
\@ifpackageloaded{tocbasic}{% |
| 1923 |
\addtotoclist[float]{\ext@lstlisting}% |
| 1924 |
\renewcommand*{\lstlistoflistings}{\listoftoc[{\lstlistlistingname}]{lol}}% |
| 1925 |
\DeclareTOCStyleEntry[level=1,numwidth=2.3em,indent=1.5em]{default}{lstlisting}% |
| 1926 |
}{}% |
| 1927 |
} |
| 1928 |
\AtBeginDocument{% |
| 1929 |
\@ifundefined{KOMAClassName}{% |
| 1930 |
\@ifundefined{float@addtolists}{% |
| 1931 |
\gdef\float@addtolists#1{\addtocontents{\ext@lstlisting}{#1}}% |
| 1932 |
}{% |
| 1933 |
\let\orig@float@addtolists\float@addtolists |
| 1934 |
\gdef\float@addtolists#1{% |
| 1935 |
\addtocontents{\ext@lstlisting}{#1}% |
| 1936 |
\orig@float@addtolists{#1}}}% |
| 1937 |
}{}% |
| 1938 |
}% |
| 1939 |
\edef\lst@temp{\the\catcode`\^^@} |
| 1940 |
\catcode`\^^@=1 |
| 1941 |
\newcommand\lstinline[1][]{% |
| 1942 |
\leavevmode\bgroup % \hbox\bgroup --> \bgroup |
| 1943 |
\def\lst@boxpos{b}% |
| 1944 |
\lsthk@PreSet\lstset{flexiblecolumns,#1}% |
| 1945 |
\lsthk@TextStyle |
| 1946 |
\@ifnextchar\bgroup{% |
| 1947 |
\afterassignment\lst@InlineG \romannumeral`^^@\iffalse}\fi |
| 1948 |
\let\@let@token}% |
| 1949 |
\lstinline@} |
| 1950 |
\catcode`\^^@=\lst@temp |
| 1951 |
\def\lstinline@#1{% |
| 1952 |
\lst@Init\relax |
| 1953 |
\lst@IfNextCharActive{\lst@InlineM#1}{\lst@InlineJ#1}} |
| 1954 |
\lst@AddToHook{TextStyle}{}% init |
| 1955 |
\lst@AddToHook{SelectCharTable}{\lst@inlinechars} |
| 1956 |
\global\let\lst@inlinechars\@empty |
| 1957 |
\def\lst@InlineM#1{% |
| 1958 |
\gdef\lst@inlinechars{% |
| 1959 |
\lst@Def{`#1}{\lst@DeInit\egroup\global\let\lst@inlinechars\@empty}% |
| 1960 |
\lst@Def{13}{\lst@DeInit\egroup \global\let\lst@inlinechars\@empty |
| 1961 |
\PackageError{Listings}{lstinline ended by EOL}\@ehc}}% |
| 1962 |
\lst@inlinechars} |
| 1963 |
\def\lst@InlineJ#1{% |
| 1964 |
\def\lst@temp##1#1{% |
| 1965 |
\let\lst@arg\@empty \lst@InsideConvert{##1}\lst@arg |
| 1966 |
\lst@DeInit\egroup}% |
| 1967 |
\lst@temp} |
| 1968 |
\def\lst@InlineG{% |
| 1969 |
\lst@Init\relax |
| 1970 |
\lst@IfNextCharActive{\lst@InlineM\}}{% |
| 1971 |
\let\lst@arg\@empty \lst@InlineGJ}} |
| 1972 |
\edef\lst@temp{\the\catcode`\^^@} |
| 1973 |
\catcode`\^^@=2 |
| 1974 |
\def\lst@InlineGJ{\futurelet\@let@token\lst@InlineGJTest} |
| 1975 |
\def\lst@InlineGJTest{% |
| 1976 |
\ifx\@let@token\egroup |
| 1977 |
\iffalse{\fi\romannumeral`^^@ |
| 1978 |
\afterassignment\lst@InlineGJEnd |
| 1979 |
\expandafter\let\expandafter\@let@token |
| 1980 |
\else |
| 1981 |
\ifx\@let@token\@sptoken |
| 1982 |
\let\lst@next\lst@InlineGJReadSp |
| 1983 |
\else |
| 1984 |
\let\lst@next\lst@InlineGJRead |
| 1985 |
\fi |
| 1986 |
\expandafter\lst@next |
| 1987 |
\fi} |
| 1988 |
\catcode`\^^@=\lst@temp |
| 1989 |
\def\lst@InlineGJEnd{\lst@arg\lst@DeInit\egroup} |
| 1990 |
\def\lst@InlineGJRead#1{% |
| 1991 |
\lccode`\~=`#1\lowercase{\lst@lAddTo\lst@arg~}% |
| 1992 |
\lst@InlineGJ} |
| 1993 |
\def\lst@InlineGJReadSp#1{% |
| 1994 |
\lccode`\~=`\ \lowercase{\lst@lAddTo\lst@arg~}% |
| 1995 |
\lst@InlineGJ#1} |
| 1996 |
\newcommand\lstMakeShortInline[1][]{% |
| 1997 |
\def\lst@shortinlinedef{\lstinline[#1]}% |
| 1998 |
\lstMakeShortInline@}% |
| 1999 |
\def\lstMakeShortInline@#1{% |
| 2000 |
\expandafter\ifx\csname lst@ShortInlineOldCatcode\string#1\endcsname\relax |
| 2001 |
\lst@shortlstinlineinfo{Made }{#1}% |
| 2002 |
\lst@add@special{#1}% |
| 2003 |
\expandafter |
| 2004 |
\xdef\csname lst@ShortInlineOldCatcode\string#1\endcsname{% |
| 2005 |
\the\catcode`#1}% |
| 2006 |
\begingroup |
| 2007 |
\catcode`\~\active \lccode`\~`#1% |
| 2008 |
\lowercase{% |
| 2009 |
\global\expandafter\let |
| 2010 |
\csname lst@ShortInlineOldMeaning\string#1\endcsname~% |
| 2011 |
\expandafter\gdef\expandafter~\expandafter{% |
| 2012 |
\lst@shortinlinedef#1}}% |
| 2013 |
\endgroup |
| 2014 |
\global\catcode`#1\active |
| 2015 |
\else |
| 2016 |
\PackageError{Listings}% |
| 2017 |
{\string\lstMakeShorterInline\ definitions cannot be nested}% |
| 2018 |
{Use \string\lstDeleteShortInline first.}% |
| 2019 |
{}% |
| 2020 |
\fi} |
| 2021 |
\def\lstDeleteShortInline#1{% |
| 2022 |
\expandafter\ifx% |
| 2023 |
\csname lst@ShortInlineOldCatcode\string#1\endcsname\relax% |
| 2024 |
\PackageError{Listings}% |
| 2025 |
{#1 is not a short reference for \string\lstinline}% |
| 2026 |
{Use \string\lstMakeShortInline first.}% |
| 2027 |
{}% |
| 2028 |
\else |
| 2029 |
\lst@shortlstinlineinfo{Deleted }{#1 as}% |
| 2030 |
\lst@rem@special{#1}% |
| 2031 |
\global\catcode`#1\csname lst@ShortInlineOldCatcode\string#1\endcsname |
| 2032 |
\global \expandafter\let% |
| 2033 |
\csname lst@ShortInlineOldCatcode\string#1\endcsname \relax |
| 2034 |
\ifnum\catcode`#1=\active |
| 2035 |
\begingroup |
| 2036 |
\catcode`\~\active \lccode`\~`#1% |
| 2037 |
\lowercase{% |
| 2038 |
\global\expandafter\let\expandafter~% |
| 2039 |
\csname lst@ShortInlineOldMeaning\string#1\endcsname}% |
| 2040 |
\endgroup |
| 2041 |
\fi |
| 2042 |
\fi} |
| 2043 |
\def\lst@shortlstinlineinfo#1#2{% |
| 2044 |
\PackageInfo{Listings}{% |
| 2045 |
#1\string#2 a short reference for \string\lstinline}} |
| 2046 |
\def\lst@add@special#1{% |
| 2047 |
\lst@rem@special{#1}% |
| 2048 |
\expandafter\gdef\expandafter\dospecials\expandafter |
| 2049 |
{\dospecials \do #1}% |
| 2050 |
\expandafter\gdef\expandafter\@sanitize\expandafter |
| 2051 |
{\@sanitize \@makeother #1}} |
| 2052 |
\def\lst@rem@special#1{% |
| 2053 |
\def\do##1{% |
| 2054 |
\ifnum`#1=`##1 \else \noexpand\do\noexpand##1\fi}% |
| 2055 |
\xdef\dospecials{\dospecials}% |
| 2056 |
\begingroup |
| 2057 |
\def\@makeother##1{% |
| 2058 |
\ifnum`#1=`##1 \else \noexpand\@makeother\noexpand##1\fi}% |
| 2059 |
\xdef\@sanitize{\@sanitize}% |
| 2060 |
\endgroup} |
| 2061 |
\def\lst@MakePath#1{\ifx\@empty#1\@empty\else\lst@MakePath@#1/\@nil/\fi} |
| 2062 |
\def\lst@MakePath@#1/{#1/\lst@MakePath@@} |
| 2063 |
\def\lst@MakePath@@#1/{% |
| 2064 |
\ifx\@nil#1\expandafter\@gobble |
| 2065 |
\else \ifx\@empty#1\else #1/\fi \fi |
| 2066 |
\lst@MakePath@@} |
| 2067 |
\lst@Key{inputpath}{}{\edef\lst@inputpath{\lst@MakePath{#1}}} |
| 2068 |
\def\lstinputlisting{% |
| 2069 |
\begingroup \lst@setcatcodes \lst@inputlisting} |
| 2070 |
\newcommand\lst@inputlisting[2][]{% |
| 2071 |
\endgroup |
| 2072 |
\bgroup\def\lst@set{#1}% |
| 2073 |
\expandafter\lstset\expandafter{\lst@set}% |
| 2074 |
\IfFileExists{\lst@inputpath#2}% |
| 2075 |
{\lst@InputListing{\lst@inputpath#2}}% |
| 2076 |
{\filename@parse{\lst@inputpath#2}% |
| 2077 |
\edef\reserved@a{\noexpand\lst@MissingFileError |
| 2078 |
{\filename@area\filename@base}% |
| 2079 |
{\ifx\filename@ext\relax tex\else\filename@ext\fi}}% |
| 2080 |
\reserved@a |
| 2081 |
\let\lst@doendpe\@empty}% |
| 2082 |
\egroup |
| 2083 |
\lst@doendpe \@newlistfalse \ignorespaces% |
| 2084 |
} |
| 2085 |
\def\lst@MissingFileError#1#2{% |
| 2086 |
\typeout{^^J! Package Listings Error: File `#1(.#2)' not found.^^J% |
| 2087 |
^^JType X to quit or <RETURN> to proceed,^^J% |
| 2088 |
or enter new name. (Default extension: #2)^^J}% |
| 2089 |
\message{Enter file name: }% |
| 2090 |
{\endlinechar\m@ne \global\read\m@ne to\@gtempa}% |
| 2091 |
\ifx\@gtempa\@empty \else |
| 2092 |
\def\reserved@a{x}\ifx\reserved@a\@gtempa\batchmode\@@end\fi |
| 2093 |
\def\reserved@a{X}\ifx\reserved@a\@gtempa\batchmode\@@end\fi |
| 2094 |
\filename@parse\@gtempa |
| 2095 |
\edef\filename@ext{% |
| 2096 |
\ifx\filename@ext\relax#2\else\filename@ext\fi}% |
| 2097 |
\edef\reserved@a{\noexpand\IfFileExists % |
| 2098 |
{\filename@area\filename@base.\filename@ext}% |
| 2099 |
{\noexpand\lst@InputListing % |
| 2100 |
{\filename@area\filename@base.\filename@ext}}% |
| 2101 |
{\noexpand\lst@MissingFileError |
| 2102 |
{\filename@area\filename@base}{\filename@ext}}}% |
| 2103 |
\expandafter\reserved@a % |
| 2104 |
\fi} |
| 2105 |
\let\lst@ifdraft\iffalse |
| 2106 |
\DeclareOption{draft}{\let\lst@ifdraft\iftrue} |
| 2107 |
\DeclareOption{final}{\let\lst@ifdraft\iffalse} |
| 2108 |
\lst@AddToHook{PreSet} |
| 2109 |
{\lst@ifdraft |
| 2110 |
\let\lst@ifprint\iffalse |
| 2111 |
\@gobbletwo\fi\fi |
| 2112 |
\fi} |
| 2113 |
\def\lst@InputListing#1{% |
| 2114 |
\begingroup |
| 2115 |
\lsthk@PreSet \gdef\lst@intname{#1}% |
| 2116 |
\expandafter\lstset\expandafter{\lst@set}% |
| 2117 |
\lsthk@DisplayStyle |
| 2118 |
\catcode\active=\active |
| 2119 |
\lst@Init\relax \let\lst@gobble\z@ |
| 2120 |
\lst@SkipToFirst |
| 2121 |
\lst@ifprint \def\lst@next{\input{#1}}% |
| 2122 |
\else \let\lst@next\@empty \fi |
| 2123 |
\lst@next |
| 2124 |
\lst@DeInit |
| 2125 |
\endgroup} |
| 2126 |
\def\lst@SkipToFirst{% |
| 2127 |
\ifnum \lst@lineno<\lst@firstline |
| 2128 |
\lst@BeginDropInput\lst@Pmode |
| 2129 |
\lst@Let{13}\lst@MSkipToFirst |
| 2130 |
\lst@Let{10}\lst@MSkipToFirst |
| 2131 |
\else |
| 2132 |
\expandafter\lst@BOLGobble |
| 2133 |
\fi} |
| 2134 |
\def\lst@MSkipToFirst{% |
| 2135 |
\global\advance\lst@lineno\@ne |
| 2136 |
\ifnum \lst@lineno=\lst@firstline |
| 2137 |
\lst@LeaveMode \global\lst@newlines\z@ |
| 2138 |
\lsthk@InitVarsBOL |
| 2139 |
\lst@DisplayConsecutiveNumbersOrNot |
| 2140 |
\expandafter\lst@BOLGobble |
| 2141 |
\fi} |
| 2142 |
\def\lstenv@DroppedWarning{% |
| 2143 |
\ifx\lst@dropped\@undefined\else |
| 2144 |
\PackageWarning{Listings}{Text dropped after begin of listing}% |
| 2145 |
\fi} |
| 2146 |
\let\lst@dropped\@undefined % init |
| 2147 |
\begingroup \lccode`\~=`\^^M\lowercase{% |
| 2148 |
\gdef\lstenv@Process#1{% |
| 2149 |
\ifx~#1% |
| 2150 |
\lstenv@DroppedWarning \let\lst@next\lst@SkipToFirst |
| 2151 |
\else\ifx^^J#1% |
| 2152 |
\lstenv@DroppedWarning \let\lst@next\lstenv@ProcessJ |
| 2153 |
\else |
| 2154 |
\let\lst@dropped#1\let\lst@next\lstenv@Process |
| 2155 |
\fi \fi |
| 2156 |
\lst@next} |
| 2157 |
}\endgroup |
| 2158 |
\def\lstenv@ProcessJ{% |
| 2159 |
\let\lst@arg\@empty |
| 2160 |
\ifx\@currenvir\lstenv@name |
| 2161 |
\expandafter\lstenv@ProcessJEnv |
| 2162 |
\else |
| 2163 |
\expandafter\def\expandafter\lst@temp\expandafter##1% |
| 2164 |
\csname end\lstenv@name\endcsname |
| 2165 |
{\lst@InsideConvert{##1}\lstenv@ProcessJ@}% |
| 2166 |
\expandafter\lst@temp |
| 2167 |
\fi} |
| 2168 |
\begingroup \lccode`\~=`\\\lowercase{% |
| 2169 |
\gdef\lstenv@ProcessJ@{% |
| 2170 |
\lst@lExtend\lst@arg |
| 2171 |
{\expandafter\ \expandafter~\lstenv@endstring}% |
| 2172 |
\catcode10=\active \lst@Let{10}\lst@MProcessListing |
| 2173 |
\lst@SkipToFirst \lst@arg} |
| 2174 |
}\endgroup |
| 2175 |
\def\lstenv@ProcessJEnv#1\end#2{\def\lst@temp{#2}% |
| 2176 |
\ifx\lstenv@name\lst@temp |
| 2177 |
\lst@InsideConvert{#1}% |
| 2178 |
\expandafter\lstenv@ProcessJ@ |
| 2179 |
\else |
| 2180 |
\lst@InsideConvert{#1\\end\{#2\}}% |
| 2181 |
\expandafter\lstenv@ProcessJEnv |
| 2182 |
\fi} |
| 2183 |
\def\lstenv@backslash{% |
| 2184 |
\lst@IfNextChars\lstenv@endstring |
| 2185 |
{\lstenv@End}% |
| 2186 |
{\expandafter\lsts@backslash \lst@eaten}}% |
| 2187 |
\def\lstenv@End{% |
| 2188 |
\ifx\@currenvir\lstenv@name |
| 2189 |
\edef\lst@next{\noexpand\end{\lstenv@name}}% |
| 2190 |
\else |
| 2191 |
\def\lst@next{\csname end\lstenv@name\endcsname}% |
| 2192 |
\fi |
| 2193 |
\lst@next} |
| 2194 |
\lst@UserCommand\lstnewenvironment#1#2#{% |
| 2195 |
\@ifundefined{#1}% |
| 2196 |
{\let\lst@arg\@empty |
| 2197 |
\lst@XConvert{#1}\@nil |
| 2198 |
\expandafter\lstnewenvironment@\lst@arg{#1}{#2}}% |
| 2199 |
{\PackageError{Listings}{Environment `#1' already defined}\@eha |
| 2200 |
\@gobbletwo}} |
| 2201 |
\def\@tempa#1#2#3{% |
| 2202 |
\gdef\lstnewenvironment@##1##2##3##4##5{% |
| 2203 |
\begingroup |
| 2204 |
\global\@namedef{end##2}{\lstenv@Error{##2}}% |
| 2205 |
\global\@namedef{##2}{\def\lstenv@name{##2}% |
| 2206 |
\begingroup \lst@setcatcodes \catcode\active=\active |
| 2207 |
\csname##2@\endcsname}% |
| 2208 |
\let\l@ngrel@x\global |
| 2209 |
\let\pr@tectedrel@x\global |
| 2210 |
\let\@xargdef\lstenv@xargdef |
| 2211 |
\expandafter\new@command\csname##2@\endcsname##3% |
| 2212 |
{\lsthk@PreSet ##4% |
| 2213 |
\ifx\@currenvir\lstenv@name |
| 2214 |
\def\lstenv@endstring{#1#2##1#3}% |
| 2215 |
\else |
| 2216 |
\def\lstenv@endstring{#1##1}% |
| 2217 |
\fi |
| 2218 |
\@namedef{end##2}{\lst@DeInit ##5\endgroup |
| 2219 |
\lst@doendpe \@ignoretrue}% |
| 2220 |
\lsthk@DisplayStyle |
| 2221 |
\let\lst@EndProcessListing\lstenv@SkipToEnd |
| 2222 |
\lst@Init\lstenv@backslash |
| 2223 |
\lst@ifprint |
| 2224 |
\expandafter\expandafter\expandafter\lstenv@Process |
| 2225 |
\else |
| 2226 |
\expandafter\lstenv@SkipToEnd |
| 2227 |
\fi |
| 2228 |
\lst@insertargs}% |
| 2229 |
\endgroup}% |
| 2230 |
} |
| 2231 |
\let\lst@arg\@empty \lst@XConvert{end}\{\}\@nil |
| 2232 |
\expandafter\@tempa\lst@arg |
| 2233 |
\let\lst@insertargs\@empty |
| 2234 |
\def\lstenv@xargdef#1{% |
| 2235 |
\expandafter\lstenv@xargdef@\csname\string#1\endcsname#1} |
| 2236 |
\def\lstenv@xargdef@#1#2[#3][#4]#5{% |
| 2237 |
\@ifdefinable#2{% |
| 2238 |
\gdef#2{% |
| 2239 |
\ifx\protect\@typeset@protect |
| 2240 |
\expandafter\lstenv@testopt |
| 2241 |
\else |
| 2242 |
\@x@protect#2% |
| 2243 |
\fi |
| 2244 |
#1% |
| 2245 |
{#4}}% |
| 2246 |
\@yargdef% |
| 2247 |
#1% |
| 2248 |
\tw@% |
| 2249 |
{#3}% |
| 2250 |
{#5}}% |
| 2251 |
} |
| 2252 |
\long\def\lstenv@testopt#1#2{% |
| 2253 |
\@ifnextchar[{\catcode\active5\relax \lstenv@testopt@#1}% |
| 2254 |
{#1[{#2}]}} |
| 2255 |
\def\lstenv@testopt@#1[#2]{% |
| 2256 |
\catcode\active\active |
| 2257 |
#1[#2]} |
| 2258 |
\begingroup \lccode`\~=`\\\lowercase{% |
| 2259 |
\gdef\lstenv@SkipToEnd{% |
| 2260 |
\long\expandafter\def\expandafter\lst@temp\expandafter##\expandafter |
| 2261 |
1\expandafter~\lstenv@endstring{\lstenv@End}% |
| 2262 |
\lst@temp} |
| 2263 |
}\endgroup |
| 2264 |
\def\lstenv@Error#1{\PackageError{Listings}{Extra \string\end#1}% |
| 2265 |
{I'm ignoring this, since I wasn't doing a \csname#1\endcsname.}} |
| 2266 |
\begingroup \lccode`\~=`\^^M\lowercase{% |
| 2267 |
\gdef\lst@TestEOLChar#1{% |
| 2268 |
\def\lst@insertargs{#1}% |
| 2269 |
\ifx ~#1\@empty \else |
| 2270 |
\ifx^^J#1\@empty \else |
| 2271 |
\global\let\lst@intname\lst@insertargs |
| 2272 |
\let\lst@insertargs\@empty |
| 2273 |
\fi \fi} |
| 2274 |
}\endgroup |
| 2275 |
\lstnewenvironment{lstlisting}[2][]{% |
| 2276 |
\lst@TestEOLChar{#2}% |
| 2277 |
\lstset{#1}% |
| 2278 |
\csname\@lst @SetFirstNumber\endcsname% |
| 2279 |
}{% |
| 2280 |
\@nobreakfalse |
| 2281 |
\csname\@lst @SaveFirstNumber\endcsname% |
| 2282 |
} |
| 2283 |
\lst@Key{fancyvrb}\relax[t]{% |
| 2284 |
\lstKV@SetIf{#1}\lst@iffancyvrb |
| 2285 |
\lstFV@fancyvrb} |
| 2286 |
\ifx\lstFV@fancyvrb\@undefined |
| 2287 |
\gdef\lstFV@fancyvrb{\lst@RequireAspects{fancyvrb}\lstFV@fancyvrb} |
| 2288 |
\fi |
| 2289 |
\@ifundefined{ocp}{} |
| 2290 |
{\lst@AddToHook{OutputBox}% |
| 2291 |
{\let\lst@ProcessLetter\@firstofone |
| 2292 |
\let\lst@ProcessDigit\@firstofone |
| 2293 |
\let\lst@ProcessOther\@firstofone}} |
| 2294 |
\DeclareOption*{\expandafter\lst@ProcessOption\CurrentOption\relax} |
| 2295 |
\def\lst@ProcessOption#1#2\relax{% |
| 2296 |
\ifx #1!% |
| 2297 |
\lst@DeleteKeysIn\lst@loadaspects{#2}% |
| 2298 |
\else |
| 2299 |
\lst@lAddTo\lst@loadaspects{,#1#2}% |
| 2300 |
\fi} |
| 2301 |
\@ifundefined{lst@loadaspects} |
| 2302 |
{\def\lst@loadaspects{strings,comments,escape,style,language,% |
| 2303 |
keywords,labels,lineshape,frames,emph,index}% |
| 2304 |
}{} |
| 2305 |
\InputIfFileExists{lstpatch.sty}{}{} |
| 2306 |
\let\lst@ifsavemem\iffalse |
| 2307 |
\DeclareOption{savemem}{\let\lst@ifsavemem\iftrue} |
| 2308 |
\DeclareOption{noaspects}{\let\lst@loadaspects\@empty} |
| 2309 |
\ProcessOptions |
| 2310 |
\lst@RequireAspects\lst@loadaspects |
| 2311 |
\let\lst@loadaspects\@empty |
| 2312 |
\lst@UseHook{SetStyle}\lst@UseHook{EmptyStyle} |
| 2313 |
\lst@UseHook{SetLanguage}\lst@UseHook{EmptyLanguage} |
| 2314 |
\lst@RestoreCatcodes% |
| 2315 |
\InputIfFileExists{listings.cfg}{}{} |
| 2316 |
\InputIfFileExists{lstlocal.cfg}{}{} |
| 2317 |
\endinput |
| 2318 |
%% |
| 2319 |
%% End of file `listings.sty'. |