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