2
%% This is file `lstmisc.sty',
3
%% generated with the docstrip utility.
5
%% The original source files were:
7
%% listings.dtx (with options: `misc,0.21')
9
%% Please read the software license in listings.dtx or listings.dvi.
11
%% (w)(c) 1996 -- 2002 Carsten Heinz and/or any other author
12
%% listed elsewhere in this file.
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.
18
%% Permission is granted to modify the listings package as well as
19
%% lstdrvrs.dtx. You are not allowed to distribute a modified version
20
%% of the package or lstdrvrs.dtx unless you change the file names and
21
%% provide the original files. In any case it is better to contact the
22
%% address below; other users will welcome removed bugs, new features,
23
%% and additional programming languages.
25
%% The listings package is free software.
27
%% However, if you distribute the package as part of a commercial
28
%% product or if you use the package to prepare a commercial document
29
%% (books, journals, and so on), I'd like to encourage you to make a
30
%% donation to the LaTeX3 fund. The size of this `license fee' should
31
%% depend on the value of the package for your product. For more
32
%% information about LaTeX see http://www.latex-project.org
34
%% No matter whether you use the package for a commercial or
35
%% non-commercial document, please send me a copy of the document (.dvi,
36
%% .ps, .pdf, hardcopy, etc.) to support further development---it is
37
%% easier to introduce new features or simplify things if I see how the
38
%% package is used by other people.
40
%% Send comments and ideas on the package, error reports and additional
41
%% programming languages to <cheinz@gmx.de>.
43
\def\filedate{2002/04/01}
45
\ProvidesFile{lstmisc.sty}
46
[\filedate\space\fileversion\space(Carsten Heinz)]
47
\lst@CheckVersion\fileversion
50
*** This file requires `listings.sty' version \fileversion.^^J%
51
*** You have a serious problem, so I'm exiting ...^^J%
54
\lst@BeginAspect{writefile}
55
\newtoks\lst@WFtoken % global
56
\lst@AddToHook{InitVarsBOL}{\global\lst@WFtoken{}}
58
\global\let\lst@WFifopen\iffalse % init
59
\gdef\lst@WFWriteToFile{%
62
\expandafter\edef\expandafter\lst@temp\expandafter{\the\lst@WFtoken}%
63
\immediate\write\lst@WF{\lst@temp}%
65
\global\lst@WFtoken{}}
66
\gdef\lst@WFAppend#1{%
67
\global\lst@WFtoken=\expandafter{\the\lst@WFtoken#1}}
68
\gdef\lst@BeginWriteFile{\lst@WFBegin\@gobble}
69
\gdef\lst@BeginAlsoWriteFile{\lst@WFBegin\lst@OutputBox}
70
\begingroup \catcode`\^^I=11
71
\gdef\lst@WFBegin#1#2{%
75
\advance\lst@length\@ne
76
\expandafter\lst@token\expandafter{\the\lst@token##1}%
77
\ifx ##1\lst@outputspace \else
80
\lst@lAddTo\lst@PreGotoTabStop{\lst@WFAppend{^^I}}%
81
\lst@lAddTo\lst@ProcessSpace{\lst@WFAppend{ }}%
82
\let\lst@DeInit\lst@WFDeInit
83
\let\lst@MProcessListing\lst@WFMProcessListing
85
\immediate\openout\lst@WF=#2\relax
86
\global\let\lst@WFifopen\iftrue
90
\gdef\lst@EndWriteFile{%
91
\immediate\closeout\lst@WF \endgroup
92
\global\let\lst@WFifopen\iffalse}
93
\global\let\lst@WFMProcessListing\lst@MProcessListing
94
\global\let\lst@WFDeInit\lst@DeInit
95
\lst@AddToAtTop\lst@WFMProcessListing{\lst@WFWriteToFile}
96
\lst@AddToAtTop\lst@WFDeInit{%
97
\ifnum\lst@length=\z@\else \lst@WFWriteToFile \fi}
99
\lst@BeginAspect{strings}
100
\gdef\lst@stringtypes{d,b,m,bd,db}
101
\gdef\lst@StringKey#1#2{%
102
\lst@Delim\lst@stringstyle #2\relax
103
{String}\lst@stringtypes #1%
104
{\lst@BeginString\lst@EndString}%
106
\lst@Key{string}\relax{\lst@StringKey\@empty{#1}}
107
\lst@Key{morestring}\relax{\lst@StringKey\relax{#1}}
108
\lst@Key{deletestring}\relax{\lst@StringKey\@nil{#1}}
109
\lst@Key{stringstyle}{}{\def\lst@stringstyle{#1}}
110
\lst@AddToHook{EmptyStyle}{\let\lst@stringstyle\@empty}
111
\lst@Key{showstringspaces}t[t]{\lstKV@SetIf{#1}\lst@ifshowstringspaces}
112
\gdef\lst@BeginString{%
114
\lst@ifexstrings\else
115
{\lst@ifshowstringspaces
117
\let\lst@outputspace\lst@visiblespace
119
\lst@AddToHookExe{ExcludeDelims}{\let\lst@ifexstrings\iffalse}
120
\gdef\lst@EndString{\lst@DelimClose\lst@ifexstrings\else}
121
\gdef\lst@StringDM@d#1#2\@empty#3#4#5{%
122
\lst@CArg #2\relax\lst@DefDelimBE{}{}{}#3{#1}{#5}#4}
123
\gdef\lst@StringDM@b#1#2\@empty#3#4#5{%
124
\let\lst@ifbstring\iftrue
125
\lst@CArg #2\relax\lst@DefDelimBE
126
{\lst@ifletter \lst@Output \lst@letterfalse \fi}%
127
{\ifx\lst@lastother\lstum@backslash
128
\expandafter\@gobblethree
130
\global\let\lst@ifbstring\iffalse % init
131
\lst@AddToHook{SelectCharTable}{%
133
\lst@CArgX \\\\\relax \lst@CDefX{}%
134
{\lst@ProcessOther\lstum@backslash
135
\lst@ProcessOther\lstum@backslash}%
138
\global\let\lst@StringDM@bd\lst@StringDM@b
139
\global\let\lst@StringDM@db\lst@StringDM@bd
140
\gdef\lst@StringDM@m#1#2\@empty#3#4#5{%
141
\lst@CArg #2\relax\lst@DefDelimBE{}{}%
142
{\let\lst@next\@gobblethree
144
\ifx\lst@lastother)\else \ifx\lst@lastother]\else
147
\lst@next}#3{#1}{#5}#4}
149
\lst@BeginAspect{comments}
150
\gdef\lst@commenttypes{l,f,s,n}
151
\gdef\lst@CommentKey#1#2{%
152
\lst@Delim\lst@commentstyle #2\relax
153
{Comment}\lst@commenttypes #1%
154
{\lst@BeginComment\lst@EndComment}%
155
i\@empty{\lst@BeginInvisible\lst@EndInvisible}}
156
\lst@Key{comment}\relax{\lst@CommentKey\@empty{#1}}
157
\lst@Key{morecomment}\relax{\lst@CommentKey\relax{#1}}
158
\lst@Key{deletecomment}\relax{\lst@CommentKey\@nil{#1}}
159
\lst@Key{commentstyle}{}{\def\lst@commentstyle{#1}}
160
\lst@AddToHook{EmptyStyle}{\let\lst@commentstyle\itshape}
161
\gdef\lst@BeginComment{%
163
\lst@ifexcomments\else
164
\lsthk@AfterBeginComment}
165
\gdef\lst@EndComment{\lst@DelimClose\lst@ifexcomments\else}
166
\lst@AddToHook{AfterBeginComment}{}
167
\lst@AddToHookExe{ExcludeDelims}{\let\lst@ifexcomments\iffalse}
168
\gdef\lst@BeginInvisible#1#2#3\@empty{%
169
\lst@TrackNewLines \lst@XPrintToken
170
\lst@BeginDropOutput{#1}}
171
\gdef\lst@EndInvisible#1\@empty{\lst@EndDropOutput}
172
\gdef\lst@CommentDM@l#1#2\@empty#3#4#5{%
173
\lst@CArg #2\relax\lst@DefDelimB{}{}{}#3{#1}{#5\lst@Lmodetrue}}
174
\gdef\lst@CommentDM@f#1{%
175
\@ifnextchar[{\lst@Comment@@f{#1}}%
176
{\lst@Comment@@f{#1}[0]}}
177
\gdef\lst@Comment@@f#1[#2]#3\@empty#4#5#6{%
178
\lst@CArg #3\relax\lst@DefDelimB{}{}%
180
\ifnum #2=\@tempcnta\else
181
\expandafter\@gobblethree
183
#4{#1}{#6\lst@Lmodetrue}}
184
\gdef\lst@CommentDM@s#1#2#3\@empty#4#5#6{%
185
\lst@CArg #2\relax\lst@DefDelimB{}{}{}#4{#1}{#6}%
186
\lst@CArg #3\relax\lst@DefDelimE{}{}{}#5{#1}}
187
\gdef\lst@CommentDM@n#1#2#3\@empty#4#5#6{%
188
\ifx\@empty#3\@empty\else
189
\def\@tempa{#2}\def\@tempb{#3}%
191
\PackageError{Listings}{Identical delimiters}%
192
{These delimiters make no sense with nested comments.}%
194
\lst@CArg #2\relax\lst@DefDelimB
196
{\ifnum\lst@mode=#1\relax \expandafter\@gobble \fi}%
198
\lst@CArg #3\relax\lst@DefDelimE{}{}{}#5{#1}%
202
\lst@BeginAspect{pod}
203
\lst@Key{printpod}{false}[t]{\lstKV@SetIf{#1}\lst@ifprintpod}
204
\lst@Key{podcomment}{false}[t]{\lstKV@SetIf{#1}\lst@ifpodcomment}
205
\lst@AddToHookExe{SetLanguage}{\let\lst@ifpodcomment\iffalse}
206
\lst@NewMode\lst@PODmode
207
\lst@AddToHook{SelectCharTable}
209
\lst@CArgX =\relax\lst@DefDelimB{}{}%
210
{\ifnum\@tempcnta=\z@
212
\def\lst@bnext{\lst@BeginDropOutput\lst@PODmode}%
213
\expandafter\expandafter\expandafter\@gobblethree
216
\expandafter\@gobblethree
218
\lst@BeginComment\lst@PODmode\lst@commentstyle
219
\lst@CArgX =cut\^^M\relax\lst@DefDelimE
221
{\ifnum\@tempcnta=\z@\else
222
\expandafter\@gobblethree
225
\lst@EndComment\lst@PODmode
228
\lst@BeginAspect{escape}
229
\lst@Key{texcl}{false}[t]{\lstKV@SetIf{#1}\lst@iftexcl}
230
\lst@AddToHook{TextStyle}{\let\lst@iftexcl\iffalse}
232
{\ifnum\lst@mode=\lst@TeXLmode
233
\expandafter\lst@escapeend
234
\expandafter\lst@LeaveAllModes
235
\expandafter\lst@ReenterModes
237
\lst@AddToHook{AfterBeginComment}
238
{\lst@iftexcl \lst@ifLmode \lst@ifdropinput\else
240
\lst@LeaveMode \lst@InterruptModes
241
\lst@EnterMode{\lst@TeXLmode}{\lst@modetrue\lst@commentstyle}%
242
\expandafter\expandafter\expandafter\lst@escapebegin
244
\lst@NewMode\lst@TeXLmode
245
\gdef\lst@ActiveCDefX#1{\lst@ActiveCDefX@#1}
246
\gdef\lst@ActiveCDefX@#1#2#3{
247
\catcode`#1\active\lccode`\~=`#1%
248
\lowercase{\lst@CDefIt~}{#2}{#3}{}}
249
\gdef\lst@Escape#1#2#3#4{%
250
\lst@CArgX #1\relax\lst@CDefX
252
{\lst@ifdropinput\else
253
\lst@TrackNewLines\lst@OutputLostSpace \lst@XPrintToken
255
\lst@EnterMode{\lst@TeXmode}{\lst@modetrue}%
257
\lst@CArg #2\relax\lst@ActiveCDefX
259
{\lst@escapeend #4\lst@LeaveAllModes\lst@ReenterModes}%
260
{\lst@MProcessListing}%
262
\lst@CArg #2\relax\lst@ActiveCDefX
264
{\lst@escapeend #4\lst@LeaveAllModes\lst@ReenterModes
265
\lst@whitespacefalse}%
271
\lst@NewMode\lst@TeXmode
272
\lst@Key{escapebegin}{}{\def\lst@escapebegin{#1}}
273
\lst@Key{escapeend}{}{\def\lst@escapeend{#1}}
274
\lst@Key{escapechar}{}
275
{\ifx\@empty#1\@empty
276
\let\lst@DefEsc\relax
278
\def\lst@DefEsc{\lst@Escape{#1}{#1}{}{}}%
280
\lst@AddToHook{TextStyle}{\let\lst@DefEsc\@empty}
281
\lst@AddToHook{SelectCharTable}{\lst@DefEsc}
282
\lst@Key{escapeinside}{}{\lstKV@TwoArg{#1}%
283
{\let\lst@DefEsc\@empty
284
\ifx\@empty##1@empty\else \ifx\@empty##2\@empty\else
285
\def\lst@DefEsc{\lst@Escape{##1}{##2}{}{}}%
287
\lst@Key{mathescape}{false}[t]{\lstKV@SetIf{#1}\lst@ifmathescape}
288
\lst@AddToHook{SelectCharTable}
289
{\lst@ifmathescape \lst@Escape{\$}{\$}%
290
{\setbox\@tempboxa=\hbox\bgroup$}%
291
{$\egroup \lst@CalcLostSpaceAndOutput}\fi}
293
\lst@BeginAspect{keywords}
294
\global\let\lst@ifsensitive\iftrue % init
295
\global\let\lst@ifsensitivedefed\iffalse % init % \global
297
\gdef\lst@KeywordTest#1#2#3{%
298
\begingroup \let\lst@UM\@empty
299
\global\expandafter\let\expandafter\@gtempa
300
\csname\@lst#1@\the\lst@token\endcsname
302
\ifx\@gtempa\relax\else
303
\let\lst@thestyle\@gtempa
305
\gdef\lst@KEYWORDTEST{%
306
\uppercase\expandafter{\expandafter
307
\lst@KEYWORDTEST@\the\lst@token}\relax}
308
\gdef\lst@KEYWORDTEST@#1\relax#2#3#4{%
309
\begingroup \let\lst@UM\@empty
310
\global\expandafter\let\expandafter\@gtempa
311
\csname\@lst#2@#1\endcsname
313
\ifx\@gtempa\relax\else
314
\let\lst@thestyle\@gtempa
316
\gdef\lst@WorkingTest#1#2#3{%
317
\begingroup \let\lst@UM\@empty
318
\global\expandafter\let\expandafter\@gtempa
319
\csname\@lst#1@\the\lst@token\endcsname
322
\gdef\lst@WORKINGTEST{%
323
\uppercase\expandafter{\expandafter
324
\lst@WORKINGTEST@\the\lst@token}\relax}
325
\gdef\lst@WORKINGTEST@#1\relax#2#3#4{%
326
\begingroup \let\lst@UM\@empty
327
\global\expandafter\let\expandafter\@gtempa
328
\csname\@lst#2@#1\endcsname
331
\gdef\lst@DefineKeywords#1#2#3{%
333
\def\lst@next{\lst@for#2}%
335
\def\lst@next{\uppercase\expandafter{\expandafter\lst@for#2}}%
338
{\expandafter\ifx\csname\@lst#1@##1\endcsname\relax
339
\global\expandafter\let\csname\@lst#1@##1\endcsname#3%
341
\gdef\lst@UndefineKeywords#1#2#3{%
342
\lst@ifsensitivedefed
343
\def\lst@next{\lst@for#2}%
345
\def\lst@next{\uppercase\expandafter{\expandafter\lst@for#2}}%
348
{\expandafter\ifx\csname\@lst#1@##1\endcsname#3%
349
\global\expandafter\let\csname\@lst#1@##1\endcsname\relax
353
\gdef\lst@IfOneOutOf#1\relax#2{%
354
\def\lst@temp##1,#1,##2##3\relax{%
355
\ifx\@empty##2\else \expandafter\lst@IOOOfirst \fi}%
356
\def\lst@next{\lst@IfOneOutOf@#1\relax}%
357
\expandafter\lst@next#2\relax\relax}
358
\gdef\lst@IfOneOutOf@#1\relax#2#3{%
360
\expandafter\@secondoftwo
362
\expandafter\lst@temp\expandafter,#2,#1,\@empty\relax
363
\expandafter\lst@next
366
\gdef\lst@IOOOfirst#1\relax#2#3{\fi#2}
367
\gdef\lst@IFONEOUTOF#1\relax#2{%
368
\uppercase{\def\lst@temp##1,#1},##2##3\relax{%
369
\ifx\@empty##2\else \expandafter\lst@IOOOfirst \fi}%
370
\def\lst@next{\lst@IFONEOUTOF@#1\relax}%
371
\expandafter\lst@next#2\relax}
372
\gdef\lst@IFONEOUTOF@#1\relax#2#3{%
374
\expandafter\@secondoftwo
377
{\expandafter\lst@temp\expandafter,#2,#1,\@empty\relax}%
378
\expandafter\lst@next
381
\begingroup \let\lst@UM\@empty
382
\expandafter\xdef\expandafter\@gtempa\expandafter{\the\lst@token}%
384
\expandafter\lst@IfOneOutOf\@gtempa\relax}
385
\gdef\lst@KeywordTest#1#2#3{\lst@KWTest #2{\let\lst@thestyle#3}{}}
386
\global\let\lst@KEYWORDTEST\lst@KeywordTest
387
\gdef\lst@WorkingTest#1#2#3{\lst@KWTest #2#3{}}
388
\global\let\lst@WORKINGTEST\lst@WorkingTest
390
\lst@Key{sensitive}\relax[t]{\lstKV@SetIf{#1}\lst@ifsensitive}
391
\lst@AddToHook{SetLanguage}{\let\lst@ifsensitive\iftrue}
393
{\lst@ifsensitive\else
394
\let\lst@KeywordTest\lst@KEYWORDTEST
395
\let\lst@WorkingTest\lst@WORKINGTEST
396
\let\lst@IfOneOutOf\lst@IFONEOUTOF
398
\gdef\lst@MakeMacroUppercase#1{%
399
\ifx\@undefined#1\else \uppercase\expandafter
400
{\expandafter\def\expandafter#1\expandafter{#1}}%
402
\gdef\lst@InstallTest#1#2#3#4#5#6#7#8{%
403
\lst@AddToHook{TrackKeywords}{\lst@TrackKeywords{#1}#2#4#6#7#8}%
404
\lst@AddToHook{PostTrackKeywords}{\lst@PostTrackKeywords#2#3#4#5}}
405
\lst@AddToHook{Init}{\lsthk@TrackKeywords\lsthk@PostTrackKeywords}
406
\lst@AddToHook{TrackKeywords}{}% init
407
\lst@AddToHook{PostTrackKeywords}{}% init
408
\lst@AddToHook{Output}{\lst@ifkeywords \lsthk@DetectKeywords \fi}
409
\lst@AddToHook{DetectKeywords}{}% init
410
\lst@AddToHook{ModeTrue}{\let\lst@ifkeywords\iffalse}
411
\lst@AddToHook{Init}{\let\lst@ifkeywords\iftrue}
412
\gdef\lst@InstallTestNow#1#2#3#4#5{%
413
\@ifundefined{\string#2#1}%
414
{\global\@namedef{\string#2#1}{}%
416
\noexpand\lst@AddToHook{\ifx#5dDetectKeywords\else Output\fi}%
417
{\ifx #4w\noexpand\lst@WorkingTest
418
\else\noexpand\lst@KeywordTest \fi
419
{#1}\noexpand#2\noexpand#3}}%
423
\@ifundefined{\@lst#1@if@ins}%
424
{\@tempa \global\@namedef{\@lst#1@if@ins}{}}%
428
\gdef\lst@TrackKeywords#1#2#3#4#5#6{%
430
\def\lst@arg{{#1}#4}%
431
\expandafter\expandafter\expandafter\lst@TK@
432
\expandafter\lst@arg#2\relax\relax
434
\def\lst@arg{{#1}#4#2}%
435
\expandafter\expandafter\expandafter\lst@TK@@
436
\expandafter\lst@arg#3\relax\relax
438
\lst@if \lst@InstallTestNow{#1}#2#4#5#6\fi}
439
\gdef\lst@TK@#1#2#3#4{%
440
\ifx\lst@ifsensitive\lst@ifsensitivedefed
444
\lst@UndefineKeywords{#1}#4#2%
445
\lst@DefineKeywords{#1}#3#2%
452
\lst@UndefineKeywords{#1}#4#2%
453
\lst@DefineKeywords{#1}#3#2%
457
\lst@ifsavemem \ifx#3\relax\else
458
\lst@ifsensitive\else \lst@MakeMacroUppercase#3\fi
461
\expandafter\@gobblethree
464
\gdef\lst@TK@@#1#2#3#4#5{%
466
\expandafter\@gobblefour
468
\lst@IfSubstring{#4#5}#3{}{\lst@UndefineKeywords{#1}#5#2}%
471
\lst@AddToHook{InitVars}
472
{\global\let\lst@ifsensitivedefed\lst@ifsensitive}
473
\gdef\lst@PostTrackKeywords#1#2#3#4{%
478
\lst@Key{classoffset}\z@{\def\lst@classoffset{#1}}
479
\gdef\lst@InstallFamily#1#2#3#4#5{%
480
\lst@Key{#2}\relax{\lst@UseFamily{#2}##1\relax\lst@MakeKeywords}%
481
\lst@Key{more#2}\relax
482
{\lst@UseFamily{#2}##1\relax\lst@MakeMoreKeywords}%
483
\lst@Key{delete#2}\relax
484
{\lst@UseFamily{#2}##1\relax\lst@DeleteKeywords}%
485
\ifx\@empty#3\@empty\else
486
\lst@Key{#3}{#4}{\lstKV@OptArg[\@ne]{##1}%
487
{\@tempcnta\lst@classoffset \advance\@tempcnta####1\relax
488
\@namedef{lst@#3\ifnum\@tempcnta=\@ne\else \the\@tempcnta
491
\expandafter\lst@InstallFamily@
492
\csname\@lst @#2@data\expandafter\endcsname
493
\csname\@lst @#5\endcsname {#1}{#2}{#3}}
494
\gdef\lst@InstallFamily@#1#2#3#4#5#6#7#8{%
495
\gdef#1{{#3}{#4}{#5}#2#7}%
496
\long\def\lst@temp##1{#6}%
497
\ifx\lst@temp\@gobble
501
\global\@namedef{lst@g#4@wp}##1{#6}%
503
\gdef\lst@UseFamily#1{%
505
\@ifnextchar[\lst@UseFamily@{\lst@UseFamily@[\@ne]}}
506
\gdef\lst@UseFamily@[#1]{%
507
\@tempcnta\lst@classoffset \advance\@tempcnta#1\relax
508
\lst@ProvideFamily\lst@family
510
{\lst@family\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}}
511
\gdef\lst@UseFamily@a#1{%
512
\expandafter\lst@UseFamily@b
513
\csname\@lst @#1@list\expandafter\endcsname
514
\csname\@lst @#1\expandafter\endcsname
515
\csname\@lst @#1@also\expandafter\endcsname
516
\csname\@lst @g#1\endcsname}
517
\gdef\lst@UseFamily@b#1#2#3#4#5\relax#6{\lstKV@XOptArg[]{#5}#6#1#2#3#4}
518
\gdef\lst@ProvideFamily#1{%
519
\@ifundefined{lst@#1\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}%
520
{\expandafter\expandafter\expandafter\lst@ProvideFamily@
521
\csname\@lst @#1@data\endcsname
522
{\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}}%
524
\gdef\lst@ProvideFamily@#1#2#3#4#5#6#7#8{%
525
\expandafter\xdef\csname\@lst @g#2#8@sty\endcsname
527
\expandafter\noexpand\csname\@lst @g#2@wp\endcsname{#8}%
529
\expandafter\noexpand\csname\@lst @#3#8\endcsname
531
\ifx\@empty#3\@empty\else
532
\edef\lst@temp{\noexpand\lst@AddToHook{Init}{%
533
\noexpand\lst@ProvideStyle\expandafter\noexpand
534
\csname\@lst @#3#8\endcsname\noexpand#4}}%
537
\expandafter\lst@ProvideFamily@@
538
\csname\@lst @#2#8@list\expandafter\endcsname
539
\csname\@lst @#2#8\expandafter\endcsname
540
\csname\@lst @#2#8@also\expandafter\endcsname
541
\csname\@lst @g#2#8@list\expandafter\endcsname
542
\csname\@lst @g#2#8\expandafter\endcsname
543
\csname\@lst @g#2#8@sty\expandafter\endcsname
545
\gdef\lst@ProvideFamily@@#1#2#3#4#5#6#7#8{%
546
\gdef#1{#2#5}\global\let#2\@empty \global\let#3\@empty % init
547
\gdef#4{#2#5}\global\let#5\@empty % init
549
\lst@AddToHook{SetLanguage}{\def#1{#2#5}\let#2\@empty}%
551
\lst@InstallTest{#7}#1#2#4#5#6}
552
\gdef\lst@InstallKeywords#1#2#3#4#5{%
554
{\lst@UseFamily{#2}[\@ne]##1\relax\lst@MakeKeywords}%
555
\lst@Key{more#2}\relax
556
{\lst@UseFamily{#2}[\@ne]##1\relax\lst@MakeMoreKeywords}%
557
\lst@Key{delete#2}\relax
558
{\lst@UseFamily{#2}[\@ne]##1\relax\lst@DeleteKeywords}%
559
\ifx\@empty#3\@empty\else
560
\lst@Key{#3}{#4}{\@namedef{lst@#3}{##1}}%
562
\expandafter\lst@InstallFamily@
563
\csname\@lst @#2@data\expandafter\endcsname
564
\csname\@lst @#5\endcsname {#1}{#2}{#3}}
565
\gdef\lst@ProvideStyle#1#2{%
566
\ifx#1\@undefined \let#1#2%
567
\else\ifx#1\relax \let#1#2\fi\fi}
568
\gdef\lst@BuildClassList#1#2,{%
569
\ifx\relax#2\@empty\else
570
\ifx\@empty#2\@empty\else
571
\lst@lExtend#1{\csname\@lst @#2\expandafter\endcsname
572
\csname\@lst @g#2\endcsname}%
574
\expandafter\lst@BuildClassList\expandafter#1
576
\gdef\lst@DeleteClassesIn#1#2{%
577
\expandafter\lst@DCI@\expandafter#1#2\relax\relax}
578
\gdef\lst@DCI@#1#2#3{%
580
\expandafter\@gobbletwo
582
\def\lst@temp##1#2#3##2{%
585
\expandafter\lst@temp
587
\let\@tempa#1\let#1\@empty
588
\expandafter\lst@temp\@tempa#2#3\relax
591
\gdef\lst@MakeKeywords[#1]#2#3#4#5#6{%
592
\def#3{#4#6}\let#4\@empty \let#5\@empty
593
\lst@MakeMoreKeywords[#1]{#2}#3#4#5#6}
594
\gdef\lst@MakeMoreKeywords[#1]#2#3#4#5#6{%
595
\lst@BuildClassList#3#1,\relax,%
596
\lst@DefOther\lst@temp{,#2}\lst@lExtend#4\lst@temp}
597
\gdef\lst@DeleteKeywords[#1]#2#3#4#5#6{%
598
\lst@MakeKeywords[#1]{#2}\@tempa\@tempb#5#6%
599
\lst@DeleteClassesIn#3\@tempa
600
\lst@DeleteKeysIn#4\@tempb}
601
\lst@InstallFamily k{keywords}{keywordstyle}\bfseries{keywordstyle}{}ld
602
\lst@Key{ndkeywords}\relax
603
{\lst@UseFamily{keywords}[\tw@]#1\relax\lst@MakeKeywords}%
604
\lst@Key{morendkeywords}\relax
605
{\lst@UseFamily{keywords}[\tw@]#1\relax\lst@MakeMoreKeywords}%
606
\lst@Key{deletendkeywords}\relax
607
{\lst@UseFamily{keywords}[\tw@]#1\relax\lst@DeleteKeywords}%
608
\lst@Key{ndkeywordstyle}\relax{\@namedef{lst@keywordstyle2}{#1}}%
609
\lst@Key{keywordsprefix}\relax{\lst@DefActive\lst@keywordsprefix{#1}}
610
\global\let\lst@keywordsprefix\@empty
611
\lst@AddToHook{SelectCharTable}
612
{\ifx\lst@keywordsprefix\@empty\else
613
\expandafter\lst@CArg\lst@keywordsprefix\relax
616
\global\let\lst@prefixkeyword\@empty
620
\lst@AddToHook{Init}{\global\let\lst@prefixkeyword\relax}
621
\lst@AddToHook{Output}
622
{\ifx\lst@prefixkeyword\@empty
623
\let\lst@thestyle\lst@gkeywords@sty
624
\global\let\lst@prefixkeyword\relax
626
\lst@Key{otherkeywords}{}{%
627
\let\lst@otherkeywords\@empty
629
\lst@MakeActive{##1}%
630
\lst@lExtend\lst@otherkeywords{%
631
\expandafter\lst@CArg\lst@temp\relax\lst@CDef
632
{}\lst@PrintOtherKeyword\@empty}}}
633
\lst@AddToHook{SelectCharTable}{\lst@otherkeywords}
634
\gdef\lst@PrintOtherKeyword#1\@empty{%
637
\lst@modetrue \lsthk@TextStyle
638
\let\lst@ProcessDigit\lst@ProcessLetter
639
\let\lst@ProcessOther\lst@ProcessLetter
641
\lst@gkeywords@sty{#1\lst@XPrintToken}%
644
\lst@BeginAspect[keywords]{emph}
645
\lst@InstallFamily e{emph}{emphstyle}{}{emphstyle}{}od
647
\lst@BeginAspect[keywords]{tex}
648
\lst@InstallKeywords{cs}{texcs}{texcsstyle}\relax{keywordstyle}
649
{\ifx\lst@lastother\lstum@backslash
650
\let\lst@thestyle\lst@texcsstyle
654
\lst@BeginAspect[keywords]{directives}
655
\lst@NewMode\lst@CDmode
656
\lst@AddToHook{EOL}{\ifnum\lst@mode=\lst@CDmode \lst@LeaveMode \fi}
657
\lst@InstallKeywords{d}{directives}{directivestyle}\relax{keywordstyle}
658
{\ifnum\lst@mode=\lst@CDmode
659
\let\lst@thestyle\lst@directivestyle
662
\lst@AddToHook{SelectCharTable}
663
{\ifx\lst@directives\@empty\else
664
\lst@DefSaveDef{`\#}\lsts@CCD
668
\lst@EnterMode{\lst@CDmode}{}%
671
\ifnum\lst@mode=\lst@CDmode
674
{\let\lst@currstyle\lst@directivestyle
675
\lsts@CCD\lst@PrintToken}%
681
\lst@AddTo\lst@stringtypes{,directive}
682
\gdef\lst@StringDM@directive#1#2#3\@empty{%
683
\lst@CArg #2\relax\lst@CDef
685
{\let\lst@bnext\lst@CArgEmpty
686
\ifnum\lst@mode=\lst@CDmode
687
\def\lst@bnext{\lst@BeginString{#1}}%
691
\lst@CArg #3\relax\lst@CDef
693
{\let\lst@enext\lst@CArgEmpty
695
\let\lst@bnext\lst@EndString
700
\lst@BeginAspect[keywords]{html}
701
\lst@NewMode\lst@insidemode
702
\lst@Key{keywordsinside}{}{\lstKV@TwoArg{#1}
703
{\let\lst@DefInside\@empty
704
\ifx\@empty##1\@empty\else \ifx\@empty##2\@empty\else
706
\lst@DefSaveDef{`##1}\lsts@insideb
707
{\lst@ifmode\else \ifnum\lst@mode=\lst@insidemode\else
709
\lst@EnterMode\lst@insidemode{}%
712
\lst@DefSaveDef{`##2}\lsts@insidee
713
{\ifnum\lst@mode=\lst@insidemode
714
\lsts@insidee \lst@XPrintToken\lst@LeaveMode
716
\expandafter\lsts@insidee
719
\lst@AddToHook{SelectCharTable}{\lst@DefInside}
720
\lst@AddToHook{SetLanguage}{\let\lst@DefInside\@empty}
721
\lst@AddToHook{Output}
722
{\ifx\lst@DefInside\@empty\else \ifx\lst@thestyle\lst@gkeywords@sty
723
\ifnum\lst@mode=\lst@insidemode\else
724
\let\lst@thestyle\@empty
727
\lst@Key{usekeywordsinside}t[t]{\lstKV@SetIf{#1}\lst@ifusekeysinside}
728
\lst@AddToHook{Output}
729
{\ifnum\lst@mode=\lst@insidemode \lst@ifusekeysinside\else
730
\let\lst@thestyle\lst@gkeywords@sty
732
\gdef\lst@BeginCDATA#1\@empty{%
733
\lst@TrackNewLines \lst@PrintToken
734
\lst@EnterMode\lst@GPmode{}\let\lst@ifmode\iffalse
735
\lst@mode\lst@insidemode #1\lst@mode\lst@GPmode\relax\lst@modetrue}
737
\lst@BeginAspect[keywords,comments]{keywordcomments}
738
\lst@NewMode\lst@KCmode \lst@NewMode\lst@KCSmode
741
\lst@BeginComment\lst@KCmode\lst@commentstyle\@empty}
744
\lst@BeginComment\lst@KCSmode\lst@commentstyle\@empty}
745
\lst@AddToHook{PostOutput}{\lst@KCpost \global\let\lst@KCpost\@empty}
746
\global\let\lst@KCpost\@empty % init
747
\gdef\lst@EndKC{\lst@SaveToken \lst@LeaveMode \lst@RestoreToken}
748
\lst@InstallKeywords{kc}{keywordcomment}{}\relax{}
749
{\ifnum\lst@mode=\lst@KCmode
750
\edef\lst@temp{\the\lst@token}%
751
\ifx\lst@temp\lst@KCmatch
756
\xdef\lst@KCmatch{\the\lst@token}%
757
\global\let\lst@KCpost\lst@BeginKC
761
\lst@Key{keywordcommentsemicolon}{}{\lstKV@ThreeArg{#1}%
762
{\def\lst@KCAkeywordsB{##1}%
763
\def\lst@KCAkeywordsE{##2}%
764
\def\lst@KCBkeywordsB{##3}%
765
\def\lst@KCkeywords{##1##2##3}}}
766
\lst@AddToHook{SelectCharTable}
767
{\ifx\lst@KCkeywords\@empty\else
768
\lst@DefSaveDef{`\;}\lsts@EKC
770
\ifnum\lst@mode=\lst@KCmode \lst@EndComment\@empty \else
771
\ifnum\lst@mode=\lst@KCSmode \lst@EndComment\@empty
776
\lst@ifmode\else \global\let\lst@KCpost\lst@BeginKC \fi}
778
\lst@ifmode\else \global\let\lst@KCpost\lst@BeginKCS \fi}
779
\gdef\lst@KCAWorkE{\ifnum\lst@mode=\lst@KCmode \lst@EndKC \fi}
781
\lst@KCAkeywordsB@list\lst@KCAkeywordsB \lst@KC@also
782
\lst@gKCAkeywordsB@list\lst@gKCAkeywordsB \lst@KCAWorkB
783
{kcb}owo % prefix, other key, working procedure, Output hook
785
\lst@KCAkeywordsE@list\lst@KCAkeywordsE \lst@KC@also
786
\lst@gKCAkeywordsE@list\lst@gKCAkeywordsE \lst@KCAWorkE
789
\lst@KCBkeywordsB@list\lst@KCBkeywordsB \lst@KC@also
790
\lst@gKCBkeywordsB@list\lst@gKCBkeywordsB \lst@KCBWorkB
793
\lst@BeginAspect[keywords]{index}
794
\lst@InstallFamily w{index}{indexstyle}\lstindexmacro{indexstyle}
795
{\csname\@lst @indexstyle#1\expandafter\endcsname
796
\expandafter{\the\lst@token}}
798
\lst@UserCommand\lstindexmacro#1{\index{{\ttfamily#1}}}
800
\lst@BeginAspect[keywords]{procnames}
801
\gdef\lst@procnametrue{\global\let\lst@ifprocname\iftrue}
802
\gdef\lst@procnamefalse{\global\let\lst@ifprocname\iffalse}
803
\lst@AddToHook{Init}{\lst@procnamefalse}
804
\lst@AddToHook{DetectKeywords}
806
\let\lst@thestyle\lst@procnamestyle
807
\lst@ifindexproc \csname\@lst @gindex@sty\endcsname \fi
810
\lst@Key{procnamestyle}{}{\def\lst@procnamestyle{#1}}
811
\lst@Key{indexprocnames}{false}[t]{\lstKV@SetIf{#1}\lst@ifindexproc}
812
\lst@AddToHook{Init}{\lst@ifindexproc \lst@indexproc \fi}
813
\gdef\lst@indexproc{%
814
\@ifundefined{lst@indexstyle1}%
815
{\@namedef{lst@indexstyle1}##1{}}%
817
\lst@InstallKeywords w{procnamekeys}{}\relax{}
818
{\global\let\lst@PNpost\lst@procnametrue}
820
\lst@AddToHook{PostOutput}{\lst@PNpost\global\let\lst@PNpost\@empty}
821
\global\let\lst@PNpost\@empty % init
823
\lst@BeginAspect{style}
824
\@ifundefined{lststylefiles}
825
{\lst@UserCommand\lststylefiles{lststy0.sty}}{}
826
\lst@UserCommand\lstdefinestyle{\lst@DefStyle\iftrue}
827
\lst@UserCommand\lst@definestyle{\lst@DefStyle\iffalse}
828
\gdef\lst@DefStyle{\lst@DefDriver{style}{sty}\lstset}
829
\global\@namedef{lststy@$}{\lsthk@EmptyStyle}
830
\lst@AddToHook{EmptyStyle}{}% init
831
\lst@Key{style}\relax{%
832
\lst@LAS{style}{sty}{[]{#1}}\lst@NoAlias\lststylefiles
835
\lst@AddToHook{SetStyle}{}% init
837
\lst@BeginAspect{language}
838
\@ifundefined{lstdriverfiles}
839
{\lst@UserCommand\lstlanguagefiles{lstlang0.sty}}{}
840
\lst@UserCommand\lstdefinelanguage{\lst@DefLang\iftrue}
841
\lst@UserCommand\lst@definelanguage{\lst@DefLang\iffalse}
842
\gdef\lst@DefLang{\lst@DefDriver{language}{lang}\lstset}
843
\lstdefinelanguage{}{}
844
\lst@Key{language}\relax{\lstKV@OptArg[]{#1}%
845
{\lst@LAS{language}{lang}{[##1]{##2}}\lst@FindAlias\lstlanguagefiles
847
{\lst@FindAlias[##1]{##2}%
848
\let\lst@language\lst@malias
849
\let\lst@dialect\lst@oalias}}}
850
\lst@Key{alsolanguage}\relax{\lstKV@OptArg[]{#1}%
851
{\lst@LAS{language}{lang}{[##1]{##2}}\lst@FindAlias\lstlanguagefiles
853
{\lst@FindAlias[##1]{##2}%
854
\let\lst@language\lst@malias
855
\let\lst@dialect\lst@oalias}}}
856
\lst@AddToHook{SetLanguage}{}% init
857
\lst@UserCommand\lstalias{\@ifnextchar[\lstalias@\lstalias@@}
858
\gdef\lstalias@[#1]#2[#3]#4{\lst@NormedNameDef{lsta@#2$#1}{#4$#3}}
859
\gdef\lstalias@@#1#2{\lst@NormedNameDef{lsta@#1}{#2}}
860
\lst@Key{defaultdialect}\relax
861
{\lstKV@OptArg[]{#1}{\lst@NormedNameDef{lstdd@##2}{##1}}}
862
\gdef\lst@FindAlias[#1]#2{%
863
\lst@NormedDef\lst@oalias{#1}%
864
\lst@NormedDef\lst@malias{#2}%
865
\@ifundefined{lsta@\lst@malias}{}%
866
{\edef\lst@malias{\csname\@lst a@\lst@malias\endcsname}}%
867
\ifx\@empty\lst@oalias \@ifundefined{lstdd@\lst@malias}{}%
868
{\edef\lst@oalias{\csname\@lst dd@\lst@malias\endcsname}}%
870
\edef\lst@temp{\lst@malias $\lst@oalias}%
871
\@ifundefined{lsta@\lst@temp}{}%
872
{\edef\lst@temp{\csname\@lst a@\lst@temp\endcsname}}%
873
\expandafter\lst@FindAlias@\lst@temp $}
874
\gdef\lst@FindAlias@#1$#2${%
875
\def\lst@malias{#1}\def\lst@oalias{#2}%
876
\ifx\@empty\lst@oalias \@ifundefined{lstdd@\lst@malias}{}%
877
{\edef\lst@oalias{\csname\@lst dd@\lst@malias\endcsname}}%
879
\gdef\lst@RequireLanguages#1{%
880
\lst@Require{language}{lang}{#1}\lst@FindAlias\lstlanguagefiles
881
\ifx\lst@loadaspects\@empty\else
882
\lst@RequireAspects\lst@loadaspects
884
\global\let\lstloadlanguages\lst@RequireLanguages
886
\lst@BeginAspect{formats}
887
\@ifundefined{lstformatfiles}
888
{\lst@UserCommand\lstformatfiles{lstfmt0.sty}}{}
889
\lst@UserCommand\lstdefineformat{\lst@DefFormat\iftrue}
890
\lst@UserCommand\lst@defineformat{\lst@DefFormat\iffalse}
891
\gdef\lst@DefFormat{\lst@DefDriver{format}{fmt}\lst@UseFormat}
893
\lst@Key{format}\relax{%
894
\lst@LAS{format}{fmt}{[]{#1}}\lst@NoAlias\lstformatfiles
897
\lst@AddToHook{SetFormat}{\let\lst@fmtformat\@empty}% init
898
\gdef\lst@fmtSplit#1#2{%
899
\def\lst@temp##1#2##2\relax##3{%
901
\ifx\@empty##2\@empty
906
\expandafter\lst@temp#1\relax\@ne
909
\def\lst@fmta{##1}\def\lst@fmtb{##2}%
912
\expandafter\lst@temp#1#2\relax\z@}
913
\gdef\lst@IfNextCharWhitespace#1#2#3{%
914
\lst@IfSubstring#3\lst@whitespaces{#1}{#2}#3}
916
\catcode`\^^I=12\catcode`\^^J=12\catcode`\^^M=12\catcode`\^^L=12\relax%
917
\lst@DefActive\lst@whitespaces{\ ^^I^^J^^M}% add ^^L
918
\global\let\lst@whitespaces\lst@whitespaces%
920
\gdef\lst@fmtIfIdentifier#1{%
922
\expandafter\@secondoftwo
924
\expandafter\lst@fmtIfIdentifier@\expandafter#1%
926
\gdef\lst@fmtIfIdentifier@#1#2\relax{%
927
\let\lst@next\@secondoftwo
930
\ifnum`#1<91\let\lst@next\@firstoftwo\else
932
\ifnum`#1<123\let\lst@next\@firstoftwo\else
935
\gdef\lst@fmtIfNextCharIn#1{%
936
\ifx\@empty#1\@empty \expandafter\@secondoftwo \else
937
\def\lst@next{\lst@fmtIfNextCharIn@{#1}}%
938
\expandafter\lst@next\fi}
939
\gdef\lst@fmtIfNextCharIn@#1#2#3#4{%
940
\def\lst@temp##1#4##2##3\relax{%
941
\ifx \@empty##2\expandafter\@secondoftwo
942
\else \expandafter\@firstoftwo \fi}%
943
\lst@temp#1#4\@empty\relax{#2}{#3}#4}
944
\gdef\lst@fmtCDef#1{\lst@fmtCDef@#1}
945
\gdef\lst@fmtCDef@#1#2#3#4#5#6#7{%
946
\lst@CDefIt#1{#2}{#3}%
947
{\lst@fmtIfNextCharIn{#5}{#4#2#3}{#6#4#2#3#7}}%
950
\gdef\lst@fmtCDefX#1{\lst@fmtCDefX@#1}
951
\gdef\lst@fmtCDefX@#1#2#3#4#5#6#7{%
954
\def#1{\lst@fmtIfNextCharIn{#5}{#4}{#6#7}}%
955
\else \ifx\@empty#3\@empty
958
\def\lst@next{\lst@fmtIfNextCharIn{#5}{#4##1}%
961
\def\lst@next{#4##1}%
966
\lst@IfNextCharsArg{#2#3}%
967
{\lst@fmtIfNextCharIn{#5}{\expandafter#4\lst@eaten}%
969
{\expandafter#4\lst@eaten}}%
971
\gdef\lst@UseFormat#1{%
972
\def\lst@fmtwhole{#1}%
974
\gdef\lst@UseFormat@{%
975
\lst@fmtSplit\lst@fmtwhole,%
976
\let\lst@fmtwhole\lst@fmtb
977
\ifx\lst@fmta\@empty\else
978
\lst@fmtSplit\lst@fmta=%
979
\ifx\@empty\lst@fmta\else
980
\expandafter\lstKV@XOptArg\expandafter[\expandafter]%
981
\expandafter{\lst@fmtb}\lst@UseFormat@b
984
\ifx\lst@fmtwhole\@empty\else
985
\expandafter\lst@UseFormat@
987
\gdef\lst@UseFormat@b[#1]#2{%
988
\def\lst@fmtc{{#1}}\lst@lExtend\lst@fmtc{\expandafter{\lst@fmta}}%
990
\lst@fmtSplit\lst@fmtb\string
992
\lst@lAddTo\lst@fmtc{{}}%
994
\lst@lExtend\lst@fmtc{\expandafter
995
{\expandafter\lst@fmtPre\expandafter{\lst@fmta}}}%
998
\lst@lAddTo\lst@fmtc{{}}%
1000
\lst@lExtend\lst@fmtc{\expandafter
1001
{\expandafter\lst@fmtPost\expandafter{\lst@fmtb}}}%
1003
\expandafter\lst@UseFormat@c\lst@fmtc}
1004
\gdef\lst@UseFormat@c#1#2#3#4{%
1005
\lst@fmtIfIdentifier#2\relax
1006
{\lst@fmtIdentifier{#2}%
1007
\lst@if\else \PackageWarning{Listings}%
1008
{Cannot drop identifier in format definition}%
1011
\lst@lAddTo\lst@fmtformat{\lst@CArgX#2\relax\lst@fmtCDef}%
1013
\lst@lAddTo\lst@fmtformat{\lst@CArgX#2\relax\lst@fmtCDefX}%
1015
\lst@DefActive\lst@fmtc{#1}%
1016
\lst@lExtend\lst@fmtformat{\expandafter{\lst@fmtc}{#3}{#4}}}}
1017
\lst@AddToHook{SelectCharTable}{\lst@fmtformat}
1018
\global\let\lst@fmtformat\@empty
1019
\gdef\lst@fmtPre#1{%
1022
\let\newline\lst@fmtEnsureNewLine
1023
\let\space\lst@fmtEnsureSpace
1024
\let\indent\lst@fmtIndent
1025
\let\noindent\lst@fmtNoindent
1028
\gdef\lst@fmtPost#1{%
1029
\global\let\lst@fmtPostOutput\@empty
1031
\def\newline{\lst@AddTo\lst@fmtPostOutput\lst@fmtEnsureNewLine}%
1032
\def\space{\aftergroup\lst@fmtEnsurePostSpace}%
1033
\def\indent{\lst@AddTo\lst@fmtPostOutput\lst@fmtIndent}%
1034
\def\noindent{\lst@AddTo\lst@fmtPostOutput\lst@fmtNoindent}%
1035
\aftergroup\lst@PrintToken
1038
\lst@AddToHook{Init}{\global\let\lst@fmtPostOutput\@empty}
1039
\lst@AddToHook{PostOutput}
1040
{\lst@fmtPostOutput \global\let\lst@fmtPostOutput\@empty}
1041
\gdef\lst@fmtEnsureSpace{%
1042
\lst@ifwhitespace\else \expandafter\lst@ProcessSpace \fi}
1043
\gdef\lst@fmtEnsurePostSpace{%
1044
\lst@IfNextCharWhitespace{}{\lst@ProcessSpace}}
1045
\lst@Key{fmtindent}{20pt}{\def\lst@fmtindent{#1}}
1046
\newdimen\lst@fmtcurrindent
1047
\lst@AddToHook{InitVars}{\global\lst@fmtcurrindent\z@}
1048
\gdef\lst@fmtIndent{\global\advance\lst@fmtcurrindent\lst@fmtindent}
1049
\gdef\lst@fmtNoindent{\global\advance\lst@fmtcurrindent-\lst@fmtindent}
1050
\gdef\lst@fmtEnsureNewLine{%
1051
\global\advance\lst@newlines\@ne
1052
\global\advance\lst@newlinesensured\@ne
1054
\lst@AddToAtTop\lst@DoNewLines{%
1055
\ifnum\lst@newlines>\lst@newlinesensured
1056
\global\advance\lst@newlines-\lst@newlinesensured
1058
\global\lst@newlinesensured\z@}
1059
\newcount\lst@newlinesensured % global
1060
\lst@AddToHook{Init}{\global\lst@newlinesensured\z@}
1061
\gdef\lst@fmtignoretrue{\let\lst@fmtifignore\iftrue}
1062
\gdef\lst@fmtignorefalse{\let\lst@fmtifignore\iffalse}
1063
\lst@AddToHook{InitVars}{\lst@fmtignorefalse}
1064
\lst@AddToHook{Output}{\lst@fmtignorefalse}
1065
\gdef\lst@fmtUseLostSpace{%
1066
\lst@ifnewline \kern\lst@fmtcurrindent \global\lst@lostspace\z@
1070
\lst@AddToHook{Init}
1072
\ifx\lst@fmtformat\@empty \ifx\lst@fmt\@empty \lst@false \fi\fi
1074
\let\lst@OldOLS\lst@OutputLostSpace
1075
\let\lst@OutputLostSpace\lst@fmtUseLostSpace
1076
\let\lst@ProcessSpace\lst@fmtProcessSpace
1078
\gdef\lst@fmtProcessSpace{%
1081
\lst@fmtifignore\else
1082
\lst@AppendOther\lst@outputspace
1084
\else \lst@ifkeepspaces
1085
\lst@AppendOther\lst@outputspace
1086
\else \ifnum\lst@newlines=\z@
1087
\lst@AppendSpecialSpace
1088
\else \ifnum\lst@length=\z@
1089
\global\advance\lst@lostspace\lst@width
1090
\global\advance\lst@pos\m@ne
1092
\lst@AppendSpecialSpace
1095
\lst@whitespacetrue}
1097
\lst@fmt@list\lst@fmt \lst@gfmt@list\lst@gfmt
1100
\gdef\lst@fmt@list{\lst@fmt\lst@gfmt}\global\let\lst@fmt\@empty
1101
\gdef\lst@gfmt@list{\lst@fmt\lst@gfmt}\global\let\lst@gfmt\@empty
1103
\begingroup \let\lst@UM\@empty
1104
\let\lst@PrintToken\@empty
1105
\csname\lst@ @fmt$\the\lst@token\endcsname
1107
\gdef\lst@fmtIdentifier#1#2#3#4{%
1108
\lst@DefOther\lst@fmta{#2}\edef\lst@fmt{\lst@fmt,\lst@fmta}%
1109
\@namedef{\lst@ @fmt$\lst@fmta}{#3#4}}
1111
\lst@BeginAspect{labels}
1112
\lst@Key{numbers}{none}{%
1113
\let\lst@PlaceNumber\@empty
1114
\lstKV@SwitchCases{#1}%
1116
left&\def\lst@PlaceNumber{\llap{\normalfont
1117
\lst@numberstyle{\thelstnumber}\kern\lst@numbersep}}\\%
1118
right&\def\lst@PlaceNumber{\rlap{\normalfont
1119
\kern\linewidth \kern\lst@numbersep
1120
\lst@numberstyle{\thelstnumber}}}%
1121
}{\PackageError{Listings}{Numbers #1 unknown}\@ehc}}
1122
\lst@Key{numberstyle}{}{\def\lst@numberstyle{#1}}
1123
\lst@Key{numbersep}{10pt}{\def\lst@numbersep{#1}}
1124
\lst@Key{stepnumber}{1}{\def\lst@stepnumber{#1\relax}}
1125
\lst@AddToHook{EmptyStyle}{\let\lst@stepnumber\@ne}
1126
\lst@Key{numberblanklines}{true}[t]
1127
{\lstKV@SetIf{#1}\lst@ifnumberblanklines}
1128
\lst@Key{firstnumber}{auto}{%
1129
\lstKV@SwitchCases{#1}%
1130
{auto&\let\lst@firstnumber\@undefined\\%
1131
last&\let\lst@firstnumber\c@lstnumber
1132
}{\def\lst@firstnumber{#1\relax}}}
1133
\lst@AddToHook{PreSet}{\let\lst@advancenumber\z@}
1134
\lst@AddToHook{PreInit}
1135
{\ifx\lst@firstnumber\@undefined
1136
\let\lst@firstnumber\lst@firstline
1138
\gdef\lst@SetFirstNumber{%
1139
\ifx\lst@firstnumber\@undefined
1140
\@tempcnta 0\csname\@lst no@\lst@intname\endcsname\relax
1141
\ifnum\@tempcnta=\z@ \@tempcnta\lst@firstline
1142
\else \lst@nololtrue \fi
1143
\advance\@tempcnta\lst@advancenumber
1144
\edef\lst@firstnumber{\the\@tempcnta\relax}%
1146
\gdef\lst@SaveFirstNumber{%
1148
\csname\@lst no\ifx\lst@intname\@empty @ \else @\lst@intname\fi
1149
\endcsname{\the\c@lstnumber}}
1150
\newcounter{lstnumber}% \global
1151
\global\c@lstnumber\@ne % init
1152
\renewcommand*\thelstnumber{\@arabic\c@lstnumber}
1153
\lst@AddToHook{EveryPar}
1154
{\global\advance\c@lstnumber\lst@advancelstnum
1155
\global\advance\c@lstnumber\m@ne \refstepcounter{lstnumber}%
1156
\lst@SkipOrPrintLabel}%
1157
\global\let\lst@advancelstnum\@ne
1158
\lst@AddToHook{Init}{\def\@currentlabel{\thelstnumber}}
1159
\lst@AddToHook{InitVars}
1160
{\global\c@lstnumber\lst@firstnumber
1161
\global\advance\c@lstnumber\lst@advancenumber
1162
\global\advance\c@lstnumber-\lst@advancelstnum
1163
\ifx \lst@firstnumber\c@lstnumber
1164
\global\advance\c@lstnumber-\lst@advancelstnum
1166
\lst@AddToHook{ExitVars}
1167
{\global\advance\c@lstnumber\lst@advancelstnum}
1169
\def\theHlstnumber{\ifx\lst@@caption\@empty \lst@neglisting
1170
\else \thelstlisting \fi
1172
\newcount\lst@skipnumbers % \global
1173
\lst@AddToHook{Init}
1174
{\ifnum \z@>\lst@stepnumber
1175
\let\lst@advancelstnum\m@ne
1176
\edef\lst@stepnumber{-\lst@stepnumber}%
1178
\ifnum \z@<\lst@stepnumber
1179
\global\lst@skipnumbers\lst@firstnumber
1180
\global\divide\lst@skipnumbers\lst@stepnumber
1181
\global\multiply\lst@skipnumbers-\lst@stepnumber
1182
\global\advance\lst@skipnumbers\lst@firstnumber
1183
\ifnum\lst@skipnumbers>\z@
1184
\global\advance\lst@skipnumbers -\lst@stepnumber
1187
\let\lst@SkipOrPrintLabel\relax
1189
\gdef\lst@SkipOrPrintLabel{%
1190
\ifnum\lst@skipnumbers=\z@
1191
\global\advance\lst@skipnumbers-\lst@stepnumber\relax
1194
\global\advance\lst@skipnumbers\@ne}
1195
\lst@AddToHook{OnEmptyLine}{%
1196
\lst@ifnumberblanklines\else \ifnum\lst@skipnumbers=\z@
1197
\global\advance\lst@skipnumbers-\lst@stepnumber\relax
1200
\lst@BeginAspect{lineshape}
1201
\lst@Key{xleftmargin}{\z@}{\def\lst@xleftmargin{#1}}
1202
\lst@Key{xrightmargin}{\z@}{\def\lst@xrightmargin{#1}}
1203
\lst@Key{resetmargins}{false}[t]{\lstKV@SetIf{#1}\lst@ifresetmargins}
1204
\lst@AddToHook{BoxUnsafe}{\let\lst@xleftmargin\z@
1205
\let\lst@xrightmargin\z@}
1206
\lst@AddToHook{TextStyle}{%
1207
\let\lst@xleftmargin\z@ \let\lst@xrightmargin\z@
1208
\let\lst@ifresetmargins\iftrue}
1209
\lst@Key{linewidth}\linewidth{\def\lst@linewidth{#1}}
1210
\lst@AddToHook{PreInit}{\linewidth\lst@linewidth\relax}
1211
\gdef\lst@parshape{%
1212
\parshape\@ne \@totalleftmargin \linewidth}
1213
\lst@AddToHook{Init}
1214
{\lst@ifresetmargins
1215
\advance\linewidth\@totalleftmargin
1216
\advance\linewidth\rightmargin
1217
\@totalleftmargin\z@
1219
\advance\linewidth-\lst@xleftmargin
1220
\advance\linewidth-\lst@xrightmargin
1221
\advance\@totalleftmargin\lst@xleftmargin\relax}
1222
\lst@Key{lineskip}{\z@}{\def\lst@lineskip{#1\relax}}
1223
\lst@AddToHook{Init}
1225
\ifdim\z@=\lst@lineskip\else
1226
\@tempdima\baselineskip
1227
\advance\@tempdima\lst@lineskip
1228
\divide\@tempdima\strip@pt\baselineskip\relax
1229
\edef\baselinestretch{\strip@pt\@tempdima}%
1232
\lst@Key{breaklines}{false}[t]{\lstKV@SetIf{#1}\lst@ifbreaklines}
1233
\lst@Key{breakindent}{20pt}{\def\lst@breakindent{#1}}
1234
\lst@Key{breakautoindent}{t}[t]{\lstKV@SetIf{#1}\lst@ifbreakautoindent}
1235
\lst@Key{prebreak}{}{\def\lst@prebreak{#1}}
1236
\lst@Key{postbreak}{}{\def\lst@postbreak{#1}}
1237
\lst@AddToHook{Init}
1239
\hbadness\@M \pretolerance\@M
1240
\def\lst@parshape{\parshape\tw@ \@totalleftmargin\linewidth
1243
\let\lst@discretionary\@empty
1245
\lst@AddToHook{OnNewLine}
1246
{\lst@ifbreaklines \lst@breakNewLine \fi}
1247
\gdef\lst@discretionary{%
1248
\discretionary{\let\space\lst@spacekern\lst@prebreak}%
1249
{\llap{\lsthk@EveryLine \kern\lst@breakcurrindent}%
1250
\let\space\lst@spacekern\lst@postbreak}{}}
1251
\lst@AddToHook{PostOutput}{\lst@discretionary}
1252
\gdef\lst@spacekern{\kern\lst@width}
1253
\gdef\lst@breakNewLine{%
1254
\@tempdima\lst@breakindent\relax
1255
\lst@ifbreakautoindent \advance\@tempdima\lst@lostspace \fi
1256
\@tempdimc-\@tempdima \advance\@tempdimc\linewidth
1257
\advance\@tempdima\@totalleftmargin
1258
\xdef\lst@breakshape{\noexpand\lst@breakcurrindent \the\@tempdimc}%
1259
\xdef\lst@breakcurrindent{\the\@tempdima}}
1260
\gdef\lst@breakshape{\@totalleftmargin \linewidth}
1261
\gdef\lst@breakProcessOther#1{\lst@ProcessOther#1\lst@OutputOther}
1262
\lst@AddToHook{SelectCharTable}
1263
{\lst@ifbreaklines \lst@Def{`)}{\lst@breakProcessOther)}\fi}
1265
\lst@BeginAspect[lineshape]{frames}
1266
\lst@Key{framexleftmargin}{\z@}{\def\lst@framexleftmargin{#1}}
1267
\lst@Key{framexrightmargin}{\z@}{\def\lst@framexrightmargin{#1}}
1268
\lst@Key{framextopmargin}{\z@}{\def\lst@framextopmargin{#1}}
1269
\lst@Key{framexbottommargin}{\z@}{\def\lst@framexbottommargin{#1}}
1270
\lst@Key{backgroundcolor}{}{\def\lst@bkgcolor{#1}}
1271
\lst@Key{fillcolor}{}{\def\lst@fillcolor{#1}}
1272
\lst@Key{rulecolor}{}{\def\lst@rulecolor{#1}}
1273
\lst@Key{rulesepcolor}{}{\def\lst@rulesepcolor{#1}}
1274
\lst@AddToHook{Init}{%
1275
\ifx\lst@fillcolor\@empty
1276
\let\lst@fillcolor\lst@bkgcolor
1278
\ifx\lst@rulesepcolor\@empty
1279
\let\lst@rulesepcolor\lst@fillcolor
1281
\lst@Key{rulesep}{2pt}{\def\lst@rulesep{#1}}
1282
\lst@Key{framerule}{.4pt}{\def\lst@framerulewidth{#1}}
1283
\lst@Key{framesep}{3pt}{\def\lst@frametextsep{#1}}
1284
\lst@Key{frameshape}{}{%
1285
\let\lst@xrulecolor\@empty
1287
{\uppercase{\def\lst@frametshape{##1}}%
1288
\uppercase{\def\lst@framelshape{##2}}%
1289
\uppercase{\def\lst@framershape{##3}}%
1290
\uppercase{\def\lst@framebshape{##4}}%
1291
\let\lst@ifframeround\iffalse
1292
\lst@IfSubstring R\lst@frametshape{\let\lst@ifframeround\iftrue}{}%
1293
\lst@IfSubstring R\lst@framebshape{\let\lst@ifframeround\iftrue}{}%
1294
\def\lst@frame{##1##2##3##4}}}
1295
\lst@Key{frameround}\relax
1296
{\uppercase{\def\lst@frameround{#1}}%
1297
\expandafter\lstframe@\lst@frameround ffff\relax}
1298
\global\let\lst@frameround\@empty
1299
\lst@Key{frame}\relax{%
1300
\let\lst@xrulecolor\@empty
1301
\lstKV@SwitchCases{#1}%
1302
{none&\let\lst@frame\@empty\\%
1303
leftline&\def\lst@frame{l}\\%
1304
topline&\def\lst@frame{t}\\%
1305
bottomline&\def\lst@frame{b}\\%
1306
lines&\def\lst@frame{tb}\\%
1307
single&\def\lst@frame{trbl}\\%
1308
shadowbox&\def\lst@frame{tRBl}%
1309
\def\lst@xrulecolor{\lst@rulesepcolor}%
1310
\def\lst@rulesep{\lst@frametextsep}%
1311
}{\def\lst@frame{#1}}%
1312
\expandafter\lstframe@\lst@frameround ffff\relax}
1313
\gdef\lstframe@#1#2#3#4#5\relax{%
1314
\lst@IfSubstring T\lst@frame{\edef\lst@frame{t\lst@frame}}{}%
1315
\lst@IfSubstring R\lst@frame{\edef\lst@frame{r\lst@frame}}{}%
1316
\lst@IfSubstring B\lst@frame{\edef\lst@frame{b\lst@frame}}{}%
1317
\lst@IfSubstring L\lst@frame{\edef\lst@frame{l\lst@frame}}{}%
1318
\let\lst@frametshape\@empty \let\lst@framebshape\@empty
1320
ltr\lst@framelshape\lst@frametshape\lst@framershape #4#1%
1322
LTR\lst@framelshape\lst@frametshape\lst@framershape #4#1%
1324
lbr\lst@framelshape\lst@framebshape\lst@framershape #3#2%
1326
LBR\lst@framelshape\lst@framebshape\lst@framershape #3#2%
1327
\let\lst@ifframeround\iffalse
1328
\lst@IfSubstring R\lst@frametshape{\let\lst@ifframeround\iftrue}{}%
1329
\lst@IfSubstring R\lst@framebshape{\let\lst@ifframeround\iftrue}{}%
1330
\let\lst@framelshape\@empty \let\lst@framershape\@empty
1331
\lst@IfSubstring L\lst@frame
1332
{\def\lst@framelshape{YY}}%
1333
{\lst@IfSubstring l\lst@frame{\def\lst@framelshape{Y}}{}}%
1334
\lst@IfSubstring R\lst@frame
1335
{\def\lst@framershape{YY}}%
1336
{\lst@IfSubstring r\lst@frame{\def\lst@framershape{Y}}{}}}
1337
\gdef\lst@frameCheck#1#2#3#4#5#6#7#8{%
1338
\lst@IfSubstring #1\lst@frame
1339
{\if #7T\def#4{R}\else \def#4{Y}\fi}%
1341
\lst@IfSubstring #3\lst@frame
1342
{\if #8T\def#6{R}\else \def#6{Y}\fi}%
1344
\lst@IfSubstring #2\lst@frame{\edef#5{#5#4Y#6}}{}}
1345
\gdef\lst@frameMakeBoxV#1#2#3{%
1347
\color@begingroup \lst@rulecolor
1348
\llap{\setbox\z@\hbox{\vrule\@width\z@\@height#2\@depth#3%
1350
\rlap{\lst@frameBlock\lst@rulesepcolor{\wd\z@}%
1353
\ifx\lst@framelshape\@empty
1354
\kern\lst@frametextsep\relax
1356
\lst@frameBlock\lst@fillcolor\lst@frametextsep{#2}{#3}%
1358
\kern\lst@framexleftmargin}%
1359
\rlap{\kern-\lst@framexleftmargin
1360
\@tempdima\linewidth
1361
\advance\@tempdima\lst@framexleftmargin
1362
\advance\@tempdima\lst@framexrightmargin
1363
\lst@frameBlock\lst@bkgcolor\@tempdima{#2}{#3}%
1364
\ifx\lst@framershape\@empty
1365
\kern\lst@frametextsep\relax
1367
\lst@frameBlock\lst@fillcolor\lst@frametextsep{#2}{#3}%
1369
\setbox\z@\hbox{\vrule\@width\z@\@height#2\@depth#3%
1371
\rlap{\lst@frameBlock\lst@rulesepcolor{\wd\z@}%
1375
\gdef\lst@frameBlock#1#2#3#4{%
1378
\setbox\z@\hbox{\vrule\@height#3\@depth#4%
1379
\ifx#1\@empty \@width\z@ \kern#2\relax
1380
\else \@width#2\relax \fi}%
1384
\expandafter\lst@frameR@\lst@framershape\relax
1386
\gdef\lst@frameR@#1{%
1387
\ifx\relax#1\@empty\else
1388
\if #1Y\lst@framevrule \else \kern\lst@framerulewidth \fi
1390
\expandafter\lst@frameR@b
1392
\gdef\lst@frameR@b#1{%
1395
\if #1Y\color@begingroup
1400
\kern\lst@framerulewidth
1403
\expandafter\lst@frameR@
1407
\expandafter\lst@frameL@\lst@framelshape\relax}
1408
\gdef\lst@frameL@#1{%
1409
\ifx\relax#1\@empty\else
1411
\if#1Y\lst@framevrule \else \kern\lst@framerulewidth \fi
1412
\expandafter\lst@frameL@
1414
\gdef\lst@frameH#1#2{%
1415
\global\let\lst@framediml\z@ \global\let\lst@framedimr\z@
1416
\setbox\z@\hbox{}\@tempcntb\z@
1417
\expandafter\lst@frameH@\expandafter#1#2\relax\relax\relax
1418
\@tempdimb\lst@frametextsep\relax
1419
\advance\@tempdimb\lst@framerulewidth\relax
1420
\@tempdimc-\@tempdimb
1421
\advance\@tempdimc\ht\z@
1422
\advance\@tempdimc\dp\z@
1424
\lst@frameHBkg\lst@fillcolor\@tempdimb\@firstoftwo
1425
\if#1T\rlap{\raise\dp\@tempboxa\box\@tempboxa}%
1426
\else\rlap{\lower\ht\@tempboxa\box\@tempboxa}\fi
1427
\lst@frameHBkg\lst@rulesepcolor\@tempdimc\@secondoftwo
1428
\advance\@tempdimb\ht\@tempboxa
1429
\if#1T\rlap{\raise\lst@frametextsep\box\@tempboxa}%
1430
\else\rlap{\lower\@tempdimb\box\@tempboxa}\fi
1433
\gdef\lst@frameH@#1#2#3#4{%
1434
\ifx\relax#4\@empty\else
1435
\lst@frameh \@tempcntb#1#2#3#4%
1436
\advance\@tempcntb\@ne
1437
\expandafter\lst@frameH@\expandafter#1%
1439
\gdef\lst@frameHBkg#1#2#3{%
1440
\setbox\@tempboxa\hbox{%
1441
\kern-\lst@framexleftmargin
1442
#3{\kern-\lst@framediml\relax}{\@tempdima\z@}%
1443
\ifdim\lst@framediml>\@tempdimb
1444
#3{\@tempdima\lst@framediml \advance\@tempdima-\@tempdimb
1445
\lst@frameBlock\lst@rulesepcolor\@tempdima\@tempdimb\z@}%
1446
{\kern-\lst@framediml
1447
\advance\@tempdima\lst@framediml\relax}%
1450
\ifx\lst@framelshape\@empty\else
1451
\advance\@tempdima\@tempdimb
1453
\ifx\lst@framershape\@empty\else
1454
\advance\@tempdima\@tempdimb
1456
{\ifdim\lst@framedimr>\@tempdimb
1457
\advance\@tempdima\lst@framedimr\relax
1459
\advance\@tempdima\linewidth
1460
\advance\@tempdima\lst@framexleftmargin
1461
\advance\@tempdima\lst@framexrightmargin
1462
\lst@frameBlock#1\@tempdima#2\z@
1463
#3{\ifdim\lst@framedimr>\@tempdimb
1464
\@tempdima-\@tempdimb
1465
\advance\@tempdima\lst@framedimr\relax
1466
\lst@frameBlock\lst@rulesepcolor\@tempdima\@tempdimb\z@
1469
\gdef\lst@frameh#1#2#3#4#5{%
1470
\lst@frameCalcDimA#1%
1471
\lst@ifframeround \@getcirc\@tempdima \fi
1475
\kern-\lst@framexleftmargin
1477
\ifnum#1=\z@ \lst@rulecolor \else \lst@xrulecolor \fi
1478
\lst@frameCornerX\llap{#2L}#3#1%
1479
\ifdim\lst@framediml<\@tempdimb
1480
\xdef\lst@framediml{\the\@tempdimb}%
1483
\if#4Y\else \let\lst@framerulewidth\z@ \fi
1484
\@tempdima\lst@framexleftmargin
1485
\advance\@tempdima\lst@framexrightmargin
1486
\advance\@tempdima\linewidth
1487
\vrule\@width\@tempdima\@height\lst@framerulewidth \@depth\z@
1489
\lst@frameCornerX\rlap{#2R}#5#1%
1490
\ifdim\lst@framedimr<\@tempdimb
1491
\xdef\lst@framedimr{\the\@tempdimb}%
1494
\if#2T\rlap{\raise\dp\z@\box\z@}%
1495
\else\rlap{\lower\ht\z@\box\z@}\fi
1498
\gdef\lst@frameCornerX#1#2#3#4{%
1499
\setbox\@tempboxa\hbox{\csname\@lst @frame\if#3RR\fi #2\endcsname}%
1500
\@tempdimb\wd\@tempboxa
1504
\if #3Y\expandafter#1\else
1505
\@tempdimb\z@ \expandafter\vphantom \fi
1508
\gdef\lst@frameCalcDimA#1{%
1509
\@tempdima\lst@rulesep
1510
\advance\@tempdima\lst@framerulewidth
1511
\multiply\@tempdima#1\relax
1512
\advance\@tempdima\lst@frametextsep
1513
\advance\@tempdima\lst@framerulewidth
1514
\multiply\@tempdima\tw@}
1515
\lst@AddToHook{Init}{\lst@frameInit}
1516
\newbox\lst@framebox
1517
\gdef\lst@frameInit{%
1518
\ifx\lst@framelshape\@empty \let\lst@frameL\@empty \fi
1519
\ifx\lst@framershape\@empty \let\lst@frameR\@empty \fi
1520
\def\lst@framevrule{\vrule\@width\lst@framerulewidth\relax}%
1522
\lst@frameCalcDimA\z@ \@getcirc\@tempdima
1523
\@tempdimb\@tempdima \divide\@tempdimb\tw@
1524
\advance\@tempdimb -\@wholewidth
1525
\edef\lst@frametextsep{\the\@tempdimb}%
1526
\edef\lst@framerulewidth{\the\@wholewidth}%
1527
\lst@frameCalcDimA\@ne \@getcirc\@tempdima
1528
\@tempdimb\@tempdima \divide\@tempdimb\tw@
1529
\advance\@tempdimb -\tw@\@wholewidth
1530
\advance\@tempdimb -\lst@frametextsep
1531
\edef\lst@rulesep{\the\@tempdimb}%
1533
\lst@frameMakeBoxV\lst@framebox{\ht\strutbox}{\dp\strutbox}%
1534
\def\lst@framelr{\copy\lst@framebox}%
1535
\ifx\lst@frametshape\@empty\else
1536
\lst@frameH T\lst@frametshape
1539
\@tempdima-\baselineskip \advance\@tempdima\ht\z@
1540
\ifdim\prevdepth<\@cclvi\p@\else
1541
\advance\@tempdima\prevdepth
1543
\ifdim\@tempdima<\z@
1544
\vskip\@tempdima\vskip\lineskip
1546
\noindent\box\z@\par
1547
\lineskiplimit\maxdimen \lineskip\z@
1549
\lst@frameSpreadV\lst@framextopmargin
1551
\lst@AddToHook{EveryLine}{\lst@framelr}
1552
\global\let\lst@framelr\@empty
1553
\lst@AddToHook{DeInit}
1554
{\ifx\lst@framebshape\@empty\else \lst@frameExit \fi}
1555
\gdef\lst@frameExit{%
1556
\lst@frameSpreadV\lst@framexbottommargin
1557
\lst@frameH B\lst@framebshape
1559
\everypar{}\par\lst@parshape\nointerlineskip\noindent\box\z@
1561
\gdef\lst@frameSpreadV#1{%
1563
\everypar{}\par\lst@parshape\nointerlineskip\noindent
1564
\lst@frameMakeBoxV\z@{#1}{\z@}%
1568
\vrule\@width.5\@tempdima\@height\lst@framerulewidth\@depth\z@
1569
\kern-\lst@framerulewidth
1570
\raise\lst@framerulewidth\hbox{%
1571
\vrule\@width\lst@framerulewidth\@height\z@\@depth.5\@tempdima}}
1573
\vrule\@width.5\@tempdima\@height\lst@framerulewidth\@depth\z@
1574
\kern-\lst@framerulewidth
1575
\vrule\@width\lst@framerulewidth\@height.5\@tempdima\@depth\z@}
1577
\vrule\@width\lst@framerulewidth\@height.5\@tempdima\@depth\z@
1578
\kern-\lst@framerulewidth
1579
\vrule\@width.5\@tempdima\@height\lst@framerulewidth\@depth\z@}
1581
\raise\lst@framerulewidth\hbox{%
1582
\vrule\@width\lst@framerulewidth\@height\z@\@depth.5\@tempdima}%
1583
\kern-\lst@framerulewidth
1584
\vrule\@width.5\@tempdima\@height\lst@framerulewidth\@depth\z@}
1585
\gdef\lst@frameRoundT{%
1586
\setbox\@tempboxa\hbox{\@circlefnt\char\@tempcnta}%
1587
\ht\@tempboxa\lst@framerulewidth
1589
\gdef\lst@frameRoundB{%
1590
\setbox\@tempboxa\hbox{\@circlefnt\char\@tempcnta}%
1593
\gdef\lst@frameRTR{%
1594
\hb@xt@.5\@tempdima{\kern-\lst@framerulewidth
1595
\kern.5\@tempdima \lst@frameRoundT \hss}}
1596
\gdef\lst@frameRBR{%
1597
\hb@xt@.5\@tempdima{\kern-\lst@framerulewidth
1598
\advance\@tempcnta\@ne \kern.5\@tempdima \lst@frameRoundB \hss}}
1599
\gdef\lst@frameRBL{%
1600
\advance\@tempcnta\tw@ \lst@frameRoundB
1602
\gdef\lst@frameRTL{%
1603
\advance\@tempcnta\thr@@\lst@frameRoundT
1606
\lst@BeginAspect[keywords]{make}
1607
\lst@NewMode\lst@makemode
1608
\lst@AddToHook{Output}{%
1609
\ifnum\lst@mode=\lst@makemode
1610
\ifx\lst@thestyle\lst@gkeywords@sty
1614
\gdef\lst@makekeytrue{\let\lst@ifmakekey\iftrue}
1615
\gdef\lst@makekeyfalse{\let\lst@ifmakekey\iffalse}
1616
\global\lst@makekeyfalse % init
1617
\lst@Key{makemacrouse}f[t]{\lstKV@SetIf{#1}\lst@ifmakemacrouse}
1620
\lst@ReplaceInput{$(}{%
1622
\lst@EnterMode\lst@makemode{\lst@makekeyfalse}%
1623
\lst@Merge{\lst@ProcessOther\$\lst@ProcessOther(}}%
1624
\lst@ReplaceInput{)}{%
1625
\ifnum\lst@mode=\lst@makemode
1630
\let\lst@currstyle\lst@gkeywords@sty
1636
\expandafter\lst@ProcessOther\expandafter)%
1639
\lst@ReplaceInput{$(}{\lst@ProcessOther\$\lst@ProcessOther(}%
1642
\lst@BeginAspect{0.21}
1643
\lst@Key{labelstyle}{}{\def\lst@numberstyle{#1}}
1644
\lst@Key{labelsep}{10pt}{\def\lst@numbersep{#1}}
1645
\lst@Key{labelstep}{0}{%
1646
\ifnum #1=\z@ \KV@lst@numbers{none}%
1647
\else \KV@lst@numbers{left}\fi
1648
\def\lst@stepnumber{#1\relax}}
1649
\lst@Key{firstlabel}\relax{\def\lst@firstnumber{#1\relax}}
1650
\lst@Key{advancelabel}\relax{\def\lst@advancenumber{#1\relax}}
1651
\let\c@lstlabel\c@lstnumber
1652
\lst@AddToHook{Init}{\let\thelstnumber\thelstlabel}
1653
\newcommand*\thelstlabel{\@arabic\c@lstlabel}
1654
\lst@Key{first}\relax{\def\lst@firstline{#1\relax}}
1655
\lst@Key{last}\relax{\def\lst@lastline{#1\relax}}
1656
\lst@Key{framerulewidth}{.4pt}{\def\lst@framerulewidth{#1}}
1657
\lst@Key{framerulesep}{2pt}{\def\lst@rulesep{#1}}
1658
\lst@Key{frametextsep}{3pt}{\def\lst@frametextsep{#1}}
1659
\lst@Key{framerulecolor}{}{\lstKV@OptArg[]{#1}%
1660
{\ifx\@empty##2\@empty
1661
\let\lst@rulecolor\@empty
1663
\ifx\@empty##1\@empty
1664
\def\lst@rulecolor{\color{##2}}%
1666
\def\lst@rulecolor{\color[##1]{##2}}%
1669
\lst@Key{backgroundcolor}{}{\lstKV@OptArg[]{#1}%
1670
{\ifx\@empty##2\@empty
1671
\let\lst@bkgcolor\@empty
1673
\ifx\@empty##1\@empty
1674
\def\lst@bkgcolor{\color{##2}}%
1676
\def\lst@bkgcolor{\color[##1]{##2}}%
1679
\lst@Key{framespread}{\z@}{\def\lst@framespread{#1}}
1680
\lst@AddToHook{PreInit}
1681
{\@tempdima\lst@framespread\relax \divide\@tempdima\tw@
1682
\edef\lst@framextopmargin{\the\@tempdima}%
1683
\let\lst@framexrightmargin\lst@framextopmargin
1684
\let\lst@framexbottommargin\lst@framextopmargin
1685
\advance\@tempdima\lst@xleftmargin\relax
1686
\edef\lst@framexleftmargin{\the\@tempdima}}
1687
\newdimen\lst@innerspread \newdimen\lst@outerspread
1688
\lst@Key{spread}{\z@,\z@}{\lstKV@CSTwoArg{#1}%
1689
{\lst@innerspread##1\relax
1690
\ifx\@empty##2\@empty
1691
\divide\lst@innerspread\tw@\relax
1692
\lst@outerspread\lst@innerspread
1694
\lst@outerspread##2\relax
1696
\lst@AddToHook{BoxUnsafe}{\lst@outerspread\z@ \lst@innerspread\z@}
1697
\lst@Key{wholeline}{false}[t]{\lstKV@SetIf{#1}\lst@ifresetmargins}
1698
\lst@Key{indent}{\z@}{\def\lst@xleftmargin{#1}}
1699
\lst@AddToHook{PreInit}
1700
{\lst@innerspread=-\lst@innerspread
1701
\lst@outerspread=-\lst@outerspread
1702
\ifodd\c@page \advance\lst@innerspread\lst@xleftmargin
1703
\else \advance\lst@outerspread\lst@xleftmargin \fi
1705
\edef\lst@xleftmargin{\the\lst@innerspread}%
1706
\edef\lst@xrightmargin{\the\lst@outerspread}%
1708
\edef\lst@xleftmargin{\the\lst@outerspread}%
1709
\edef\lst@xrightmargin{\the\lst@innerspread}%
1711
\lst@Key{defaultclass}\relax{\def\lst@classoffset{#1}}
1712
\lst@Key{stringtest}\relax{}% dummy
1713
\lst@Key{outputpos}\relax{\lst@outputpos#1\relax\relax}
1714
\lst@Key{stringspaces}\relax[t]{\lstKV@SetIf{#1}\lst@ifshowstringspaces}
1715
\lst@Key{visisblespaces}\relax[t]{\lstKV@SetIf{#1}\lst@ifshowspaces}
1716
\lst@Key{visibletabs}\relax[t]{\lstKV@SetIf{#1}\lst@ifshowtabs}
1718
\lst@BeginAspect{fancyvrb}
1719
\@ifundefined{FancyVerbFormatLine}
1722
*** `listings.sty' needs `fancyvrb.sty' right now.^^J%
1723
*** Please ensure its availability and try again.^^J%
1725
\batchmode \@@end}{}
1726
\gdef\lstFV@fancyvrb{%
1728
\ifx\FancyVerbFormatLine\lstFV@FancyVerbFormatLine\else
1729
\let\lstFV@FVFL\FancyVerbFormatLine
1730
\let\FancyVerbFormatLine\lstFV@FancyVerbFormatLine
1733
\ifx\lstFV@FVFL\@undefined\else
1734
\let\FancyVerbFormatLine\lstFV@FVFL
1735
\let\lstFV@FVFL\@undefined
1738
\gdef\lstFV@VerbatimBegin{%
1739
\ifx\FancyVerbFormatLine\lstFV@FancyVerbFormatLine
1740
\lsthk@TextStyle \lsthk@BoxUnsafe
1742
\lst@activecharsfalse
1743
\let\normalbaselines\relax
1745
\lst@ifresetmargins \advance\linewidth-\@totalleftmargin \fi
1746
\everypar{}\global\lst@newlines\z@
1747
\lst@mode\lst@nomode \let\lst@entermodes\@empty
1749
%% D.G. modification begin - Nov. 25, 1998
1751
%% D.G. modification end
1753
\gdef\lstFV@VerbatimEnd{%
1754
\ifx\FancyVerbFormatLine\lstFV@FancyVerbFormatLine
1755
\global\setbox\lstFV@gtempboxa\box\@tempboxa
1756
\global\let\@gtempa\FV@ProcessLine
1759
\let\FV@ProcessLine\@gtempa
1760
\setbox\@tempboxa\box\lstFV@gtempboxa
1762
\newbox\lstFV@gtempboxa
1763
\lst@AddTo\FV@VerbatimBegin\lstFV@VerbatimBegin
1764
\lst@AddToAtTop\FV@VerbatimEnd\lstFV@VerbatimEnd
1765
\lst@AddTo\FV@LVerbatimBegin\lstFV@VerbatimBegin
1766
\lst@AddToAtTop\FV@LVerbatimEnd\lstFV@VerbatimEnd
1767
\lst@AddTo\FV@BVerbatimBegin\lstFV@VerbatimBegin
1768
\lst@AddToAtTop\FV@BVerbatimEnd\lstFV@VerbatimEnd
1769
\gdef\lstFV@FancyVerbFormatLine#1{%
1770
\let\lst@arg\@empty \lst@FVConvert#1\@nil
1771
\global\lst@newlines\z@
1772
\vtop{\leavevmode\lst@parshape
1774
\lst@arg \lst@PrintToken\lst@EOLUpdate\lsthk@InitVarsBOL
1775
\lst@InterruptModes}}
1776
\gdef\lst@FVConvert{\futurelet\@let@token\lst@FVConvert@@}
1777
\gdef\lst@FVConvert@@{%
1778
\ifcat\noexpand\@let@token\bgroup \expandafter\lst@FVConvertArg
1779
\else \expandafter\lst@FVConvert@ \fi}
1780
\gdef\lst@FVConvertArg#1{%
1781
{\let\lst@arg\@empty
1782
\lst@FVConvert#1\@nil
1783
\global\let\@gtempa\lst@arg}%
1784
\lst@lExtend\lst@arg{\expandafter{\@gtempa\lst@PrintToken}}%
1786
\gdef\lst@FVConvert@#1{%
1788
\if\relax\noexpand#1%
1789
\lst@lAddTo\lst@arg{\lst@OutputLostSpace\lst@PrintToken#1}%
1791
\lccode`\~=`#1\lowercase{\lst@lAddTo\lst@arg~}%
1793
\expandafter\lst@FVConvert
1796
\lst@BeginAspect[keywords,comments,strings,language]{lgrind}
1797
\gdef\lst@LGGetNames#1:#2\relax{%
1798
\lst@NormedDef\lstlang@{#1}\lst@ReplaceInArg\lstlang@{|,}%
1800
\gdef\lst@LGGetValue#1{%
1802
\def\lst@temp##1:#1##2##3\relax{%
1803
\ifx\@empty##2\else \lst@LGGetValue@{#1}\fi}
1804
\expandafter\lst@temp\lst@arg:#1\@empty\relax}
1805
\gdef\lst@LGGetValue@#1{%
1807
\def\lst@temp##1:#1##2:##3\relax{%
1808
\@ifnextchar=\lst@LGGetValue@@{\lst@LGGetValue@@=}##2\relax
1809
\def\lst@arg{##1:##3}}%
1810
\expandafter\lst@temp\lst@arg\relax}
1811
\gdef\lst@LGGetValue@@=#1\relax{\def\lst@LGvalue{#1}}
1812
\gdef\lst@LGGetComment#1#2{%
1814
\lst@LGGetValue{#1b}%
1817
\lst@LGGetValue{#1e}%
1818
\ifx\lst@LGvalue\lst@LGEOL
1819
\edef\lstlang@{\lstlang@,commentline={#2}}%
1822
\edef#2{{#2}{\lst@LGvalue}}%
1825
\gdef\lst@LGGetString#1#2{%
1826
\lst@LGGetValue{#1b}%
1829
\lst@LGGetValue{#1e}%
1830
\ifx\lst@LGvalue\lst@LGEOL
1831
\edef\lstlang@{\lstlang@,morestringizer=[l]{#2}}%
1834
\edef\lstlang@{\lstlang@,morestringizer=[d]{#2}}%
1836
\edef\lst@temp{\lst@LGe#2}%
1837
\ifx \lst@temp\lst@LGvalue
1838
\edef\lstlang@{\lstlang@,morestringizer=[b]{#2}}%
1840
\PackageWarning{Listings}%
1841
{String #2...\lst@LGvalue\space not supported}%
1846
\gdef\lst@LGDefLang{%
1849
\lst@LGGetValue{kw}%
1851
\lst@ReplaceInArg\lst@LGvalue{{ },}%
1852
\edef\lstlang@{\lstlang@,keywords={\lst@LGvalue}}%
1854
\lst@LGGetValue{oc}%
1856
\edef\lstlang@{\lstlang@,sensitive=f}%
1858
\lst@LGGetValue{id}%
1860
\edef\lstlang@{\lstlang@,alsoletter=\lst@LGvalue}%
1862
\lst@LGGetComment a\lst@LGa
1863
\lst@LGGetComment c\lst@LGc
1865
\ifx\lst@LGc\@empty\else
1866
\edef\lstlang@{\lstlang@,singlecomment=\lst@LGc}%
1870
\edef\lstlang@{\lstlang@,singlecomment=\lst@LGa}%
1872
\edef\lstlang@{\lstlang@,doublecomment=\lst@LGc\lst@LGa}%
1875
\lst@LGGetString s\lst@LGa
1876
\lst@LGGetString l\lst@LGa
1877
\lst@LGGetValue{tc}%
1879
\edef\lstlang@{\lstlang@,lgrindef=\lst@LGvalue}%
1881
\expandafter\xdef\csname\@lst LGlang@\lst@language@\endcsname
1882
{\noexpand\lstset{\lstlang@}}%
1883
\lst@ReplaceInArg\lst@arg{{: :}:}\let\lst@LGvalue\@empty
1884
\expandafter\lst@LGDroppedCaps\lst@arg\relax\relax
1885
\ifx\lst@LGvalue\@empty\else
1886
\PackageWarningNoLine{Listings}{Ignored capabilities for
1887
\space `\lst@language@' are\MessageBreak\lst@LGvalue}%
1889
\gdef\lst@LGDroppedCaps#1:#2#3{%
1891
\lst@RemoveCommas\lst@LGvalue
1893
\edef\lst@LGvalue{\lst@LGvalue,#2#3}%
1894
\expandafter\lst@LGDroppedCaps
1898
\lccode`\z=`\:\lccode`\y=`\^\lccode`\x=`\$\lccode`\v=`\|
1899
\catcode`\\=12\relax
1901
/gdef/lst@LGReplace{/lst@ReplaceInArg/lst@arg
1902
{{\:}{z }{\^}{y}{\$}{x}{\|}{v}{ \ }{ }{:\ :}{:}{\ }{ }{\(}({\)})}}
1906
\gdef\lst@LGRead#1\par{%
1907
\lst@LGGetNames#1:\relax
1908
\def\lst@temp{endoflanguagedefinitions}%
1909
\ifx\lstlang@\lst@temp
1910
\let\lst@next\endinput
1912
\expandafter\lst@IfOneOf\lst@language@\relax\lstlang@
1913
{\lst@LGDefLang \let\lst@next\endinput}%
1914
{\let\lst@next\lst@LGRead}%
1917
\lst@Key{lgrindef}\relax{%
1918
\lst@NormedDef\lst@language@{#1}%
1920
\@ifundefined{lstLGlang@\lst@language@}%
1921
{\everypar{\lst@LGRead}%
1922
\catcode`\\=12\catcode`\{=12\catcode`\}=12\catcode`\%=12%
1923
\catcode`\#=14\catcode`\$=12\catcode`\^=12\catcode`\_=12\relax
1924
\input{\lstlgrindeffile}%
1927
\@ifundefined{lstLGlang@\lst@language@}%
1928
{\PackageError{Listings}%
1929
{LGrind language \lst@language@\space undefined}%
1930
{The language is not loadable. \@ehc}}%
1932
\csname\@lst LGlang@\lst@language@\endcsname}}
1933
\@ifundefined{lstlgrindeffile}
1934
{\lst@UserCommand\lstlgrindeffile{lgrindef.}}{}
1936
\lst@BeginAspect[keywords]{hyper}
1937
\lst@Key{hyperanchor}\hyper@@anchor{\let\lst@hyperanchor#1}
1938
\lst@Key{hyperlink}\hyperlink{\let\lst@hyperlink#1}
1939
\lst@InstallKeywords{h}{hyperref}{}\relax{}
1941
\let\lst@UM\@empty \xdef\@gtempa{\the\lst@token}%
1943
\lst@GetFreeMacro{lstHR@\@gtempa}%
1944
\global\expandafter\let\lst@freemacro\@empty
1945
\@tempcntb\@tempcnta \advance\@tempcntb\m@ne
1946
\edef\lst@alloverstyle##1{%
1947
\let\noexpand\lst@alloverstyle\noexpand\@empty
1948
\noexpand\smash{\raise\baselineskip\hbox
1949
{\noexpand\lst@hyperanchor{lst.\@gtempa\the\@tempcnta}%
1951
\ifnum\@tempcnta=\z@ ##1\else
1952
\noexpand\lst@hyperlink{lst.\@gtempa\the\@tempcntb}{##1}%
1959
%% End of file `lstmisc.sty'.