/[escript]/trunk/esys2/doc/user/listings.sty
ViewVC logotype

Annotation of /trunk/esys2/doc/user/listings.sty

Parent Directory Parent Directory | Revision Log Revision Log


Revision 82 - (hide annotations)
Tue Oct 26 06:53:54 2004 UTC (15 years ago) by jgs
File size: 66854 byte(s)
Initial revision

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