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