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