1 |
mmeineke |
1122 |
%% |
2 |
|
|
%% This is file `lstmisc.sty', |
3 |
|
|
%% generated with the docstrip utility. |
4 |
|
|
%% |
5 |
|
|
%% The original source files were: |
6 |
|
|
%% |
7 |
|
|
%% listings.dtx (with options: `misc,0.21') |
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 |
|
|
\ProvidesFile{lstmisc.sty} |
27 |
|
|
[\filedate\space\fileversion\space(Carsten Heinz)] |
28 |
|
|
\lst@CheckVersion\fileversion |
29 |
|
|
{\typeout{^^J% |
30 |
|
|
***^^J% |
31 |
|
|
*** This file requires `listings.sty' version \fileversion.^^J% |
32 |
|
|
*** You have a serious problem, so I'm exiting ...^^J% |
33 |
|
|
***^^J}% |
34 |
|
|
\batchmode \@@end} |
35 |
|
|
\lst@BeginAspect{writefile} |
36 |
|
|
\newtoks\lst@WFtoken % global |
37 |
|
|
\lst@AddToHook{InitVarsBOL}{\global\lst@WFtoken{}} |
38 |
|
|
\newwrite\lst@WF |
39 |
|
|
\global\let\lst@WFifopen\iffalse % init |
40 |
|
|
\gdef\lst@WFWriteToFile{% |
41 |
|
|
\begingroup |
42 |
|
|
\let\lst@UM\@empty |
43 |
|
|
\expandafter\edef\expandafter\lst@temp\expandafter{\the\lst@WFtoken}% |
44 |
|
|
\immediate\write\lst@WF{\lst@temp}% |
45 |
|
|
\endgroup |
46 |
|
|
\global\lst@WFtoken{}} |
47 |
|
|
\gdef\lst@WFAppend#1{% |
48 |
|
|
\global\lst@WFtoken=\expandafter{\the\lst@WFtoken#1}} |
49 |
|
|
\gdef\lst@BeginWriteFile{\lst@WFBegin\@gobble} |
50 |
|
|
\gdef\lst@BeginAlsoWriteFile{\lst@WFBegin\lst@OutputBox} |
51 |
|
|
\begingroup \catcode`\^^I=11 |
52 |
|
|
\gdef\lst@WFBegin#1#2{% |
53 |
|
|
\begingroup |
54 |
|
|
\let\lst@OutputBox#1% |
55 |
|
|
\def\lst@Append##1{% |
56 |
|
|
\advance\lst@length\@ne |
57 |
|
|
\expandafter\lst@token\expandafter{\the\lst@token##1}% |
58 |
|
|
\ifx ##1\lst@outputspace \else |
59 |
|
|
\lst@WFAppend##1% |
60 |
|
|
\fi}% |
61 |
|
|
\lst@lAddTo\lst@PreGotoTabStop{\lst@WFAppend{^^I}}% |
62 |
|
|
\lst@lAddTo\lst@ProcessSpace{\lst@WFAppend{ }}% |
63 |
|
|
\let\lst@DeInit\lst@WFDeInit |
64 |
|
|
\let\lst@MProcessListing\lst@WFMProcessListing |
65 |
|
|
\lst@WFifopen\else |
66 |
|
|
\immediate\openout\lst@WF=#2\relax |
67 |
|
|
\global\let\lst@WFifopen\iftrue |
68 |
|
|
\@gobbletwo\fi\fi |
69 |
|
|
\fi} |
70 |
|
|
\endgroup |
71 |
|
|
\gdef\lst@EndWriteFile{% |
72 |
|
|
\immediate\closeout\lst@WF \endgroup |
73 |
|
|
\global\let\lst@WFifopen\iffalse} |
74 |
|
|
\global\let\lst@WFMProcessListing\lst@MProcessListing |
75 |
|
|
\global\let\lst@WFDeInit\lst@DeInit |
76 |
|
|
\lst@AddToAtTop\lst@WFMProcessListing{\lst@WFWriteToFile} |
77 |
|
|
\lst@AddToAtTop\lst@WFDeInit{% |
78 |
|
|
\ifnum\lst@length=\z@\else \lst@WFWriteToFile \fi} |
79 |
|
|
\lst@EndAspect |
80 |
|
|
\lst@BeginAspect{strings} |
81 |
|
|
\gdef\lst@stringtypes{d,b,m,bd,db} |
82 |
|
|
\gdef\lst@StringKey#1#2{% |
83 |
|
|
\lst@Delim\lst@stringstyle #2\relax |
84 |
|
|
{String}\lst@stringtypes #1% |
85 |
|
|
{\lst@BeginString\lst@EndString}% |
86 |
|
|
\@@end\@empty{}} |
87 |
|
|
\lst@Key{string}\relax{\lst@StringKey\@empty{#1}} |
88 |
|
|
\lst@Key{morestring}\relax{\lst@StringKey\relax{#1}} |
89 |
|
|
\lst@Key{deletestring}\relax{\lst@StringKey\@nil{#1}} |
90 |
|
|
\lst@Key{stringstyle}{}{\def\lst@stringstyle{#1}} |
91 |
|
|
\lst@AddToHook{EmptyStyle}{\let\lst@stringstyle\@empty} |
92 |
|
|
\lst@Key{showstringspaces}t[t]{\lstKV@SetIf{#1}\lst@ifshowstringspaces} |
93 |
|
|
\gdef\lst@BeginString{% |
94 |
|
|
\lst@DelimOpen |
95 |
|
|
\lst@ifexstrings\else |
96 |
|
|
{\lst@ifshowstringspaces |
97 |
|
|
\lst@keepspacestrue |
98 |
|
|
\let\lst@outputspace\lst@visiblespace |
99 |
|
|
\fi}} |
100 |
|
|
\lst@AddToHookExe{ExcludeDelims}{\let\lst@ifexstrings\iffalse} |
101 |
|
|
\gdef\lst@EndString{\lst@DelimClose\lst@ifexstrings\else} |
102 |
|
|
\gdef\lst@StringDM@d#1#2\@empty#3#4#5{% |
103 |
|
|
\lst@CArg #2\relax\lst@DefDelimBE{}{}{}#3{#1}{#5}#4} |
104 |
|
|
\gdef\lst@StringDM@b#1#2\@empty#3#4#5{% |
105 |
|
|
\let\lst@ifbstring\iftrue |
106 |
|
|
\lst@CArg #2\relax\lst@DefDelimBE |
107 |
|
|
{\lst@ifletter \lst@Output \lst@letterfalse \fi}% |
108 |
|
|
{\ifx\lst@lastother\lstum@backslash |
109 |
|
|
\expandafter\@gobblethree |
110 |
|
|
\fi}{}#3{#1}{#5}#4} |
111 |
|
|
\global\let\lst@ifbstring\iffalse % init |
112 |
|
|
\lst@AddToHook{SelectCharTable}{% |
113 |
|
|
\lst@ifbstring |
114 |
|
|
\lst@CArgX \\\\\relax \lst@CDefX{}% |
115 |
|
|
{\lst@ProcessOther\lstum@backslash |
116 |
|
|
\lst@ProcessOther\lstum@backslash |
117 |
|
|
\let\lst@lastother\relax}% |
118 |
|
|
{}% |
119 |
|
|
\fi} |
120 |
|
|
\global\let\lst@StringDM@bd\lst@StringDM@b |
121 |
|
|
\global\let\lst@StringDM@db\lst@StringDM@bd |
122 |
|
|
\gdef\lst@StringDM@a#1#2\@empty#3#4#5{% |
123 |
|
|
\lst@CArg #2\relax\lst@DefDelimBE{}{}% |
124 |
|
|
{\let\lst@next\@gobblethree |
125 |
|
|
\lst@ifletter\else |
126 |
|
|
\ifx\lst@lastother)\else \ifx\lst@lastother]\else |
127 |
|
|
\let\lst@next\@empty |
128 |
|
|
\fi \fi \fi |
129 |
|
|
\lst@next}#3{#1}{#5}#4} |
130 |
|
|
\gdef\lst@StringDM@m#1#2\@empty#3#4#5{% |
131 |
|
|
\lst@CArg #2\relax\lst@DefDelimBE{}{}% |
132 |
|
|
{\let\lst@next\@gobblethree |
133 |
|
|
\lst@ifletter\else |
134 |
|
|
\lst@IfLastOtherOneOf{)].0123456789\lstum@rbrace'}% |
135 |
|
|
{}% |
136 |
|
|
{\let\lst@next\@empty}% |
137 |
|
|
\fi |
138 |
|
|
\lst@next}#3{#1}{#5}#4} |
139 |
|
|
\lst@SaveOutputDef{"7D}\lstum@rbrace |
140 |
|
|
\lst@EndAspect |
141 |
|
|
\lst@BeginAspect{comments} |
142 |
|
|
\lst@NewMode\lst@commentmode |
143 |
|
|
\gdef\lst@commenttypes{l,f,s,n} |
144 |
|
|
\gdef\lst@CommentKey#1#2{% |
145 |
|
|
\lst@Delim\lst@commentstyle #2\relax |
146 |
|
|
{Comment}\lst@commenttypes #1% |
147 |
|
|
{\lst@BeginComment\lst@EndComment}% |
148 |
|
|
i\@empty{\lst@BeginInvisible\lst@EndInvisible}} |
149 |
|
|
\lst@Key{comment}\relax{\lst@CommentKey\@empty{#1}} |
150 |
|
|
\lst@Key{morecomment}\relax{\lst@CommentKey\relax{#1}} |
151 |
|
|
\lst@Key{deletecomment}\relax{\lst@CommentKey\@nil{#1}} |
152 |
|
|
\lst@Key{commentstyle}{}{\def\lst@commentstyle{#1}} |
153 |
|
|
\lst@AddToHook{EmptyStyle}{\let\lst@commentstyle\itshape} |
154 |
|
|
\gdef\lst@BeginComment{% |
155 |
|
|
\lst@DelimOpen |
156 |
|
|
\lst@ifexcomments\else |
157 |
|
|
\lsthk@AfterBeginComment} |
158 |
|
|
\gdef\lst@EndComment{\lst@DelimClose\lst@ifexcomments\else} |
159 |
|
|
\lst@AddToHook{AfterBeginComment}{} |
160 |
|
|
\lst@AddToHookExe{ExcludeDelims}{\let\lst@ifexcomments\iffalse} |
161 |
|
|
\gdef\lst@BeginInvisible#1#2#3\@empty{% |
162 |
|
|
\lst@TrackNewLines \lst@XPrintToken |
163 |
|
|
\lst@BeginDropOutput{#1}} |
164 |
|
|
\gdef\lst@EndInvisible#1\@empty{\lst@EndDropOutput} |
165 |
|
|
\gdef\lst@CommentDM@l#1#2\@empty#3#4#5{% |
166 |
|
|
\lst@CArg #2\relax\lst@DefDelimB{}{}{}#3{#1}{#5\lst@Lmodetrue}} |
167 |
|
|
\gdef\lst@CommentDM@f#1{% |
168 |
|
|
\@ifnextchar[{\lst@Comment@@f{#1}}% |
169 |
|
|
{\lst@Comment@@f{#1}[0]}} |
170 |
|
|
\gdef\lst@Comment@@f#1[#2]#3\@empty#4#5#6{% |
171 |
|
|
\lst@CArg #3\relax\lst@DefDelimB{}{}% |
172 |
|
|
{\lst@CalcColumn |
173 |
|
|
\ifnum #2=\@tempcnta\else |
174 |
|
|
\expandafter\@gobblethree |
175 |
|
|
\fi}% |
176 |
|
|
#4{#1}{#6\lst@Lmodetrue}} |
177 |
|
|
\gdef\lst@CommentDM@s#1#2#3\@empty#4#5#6{% |
178 |
|
|
\lst@CArg #2\relax\lst@DefDelimB{}{}{}#4{#1}{#6}% |
179 |
|
|
\lst@CArg #3\relax\lst@DefDelimE{}{}{}#5{#1}} |
180 |
|
|
\gdef\lst@CommentDM@n#1#2#3\@empty#4#5#6{% |
181 |
|
|
\ifx\@empty#3\@empty\else |
182 |
|
|
\def\@tempa{#2}\def\@tempb{#3}% |
183 |
|
|
\ifx\@tempa\@tempb |
184 |
|
|
\PackageError{Listings}{Identical delimiters}% |
185 |
|
|
{These delimiters make no sense with nested comments.}% |
186 |
|
|
\else |
187 |
|
|
\lst@CArg #2\relax\lst@DefDelimB |
188 |
|
|
{}% |
189 |
|
|
{\ifnum\lst@mode=#1\relax \expandafter\@gobble \fi}% |
190 |
|
|
{}#4{#1}{#6}% |
191 |
|
|
\lst@CArg #3\relax\lst@DefDelimE{}{}{}#5{#1}% |
192 |
|
|
\fi |
193 |
|
|
\fi} |
194 |
|
|
\lst@EndAspect |
195 |
|
|
\lst@BeginAspect{pod} |
196 |
|
|
\lst@Key{printpod}{false}[t]{\lstKV@SetIf{#1}\lst@ifprintpod} |
197 |
|
|
\lst@Key{podcomment}{false}[t]{\lstKV@SetIf{#1}\lst@ifpodcomment} |
198 |
|
|
\lst@AddToHookExe{SetLanguage}{\let\lst@ifpodcomment\iffalse} |
199 |
|
|
\lst@NewMode\lst@PODmode |
200 |
|
|
\lst@AddToHook{SelectCharTable} |
201 |
|
|
{\lst@ifpodcomment |
202 |
|
|
\lst@CArgX =\relax\lst@DefDelimB{}{}% |
203 |
|
|
{\ifnum\@tempcnta=\z@ |
204 |
|
|
\lst@ifprintpod\else |
205 |
|
|
\def\lst@bnext{\lst@BeginDropOutput\lst@PODmode}% |
206 |
|
|
\expandafter\expandafter\expandafter\@gobblethree |
207 |
|
|
\fi |
208 |
|
|
\else |
209 |
|
|
\expandafter\@gobblethree |
210 |
|
|
\fi}% |
211 |
|
|
\lst@BeginComment\lst@PODmode{{\lst@commentstyle}}% |
212 |
|
|
\lst@CArgX =cut\^^M\relax\lst@DefDelimE |
213 |
|
|
{\lst@CalcColumn}% |
214 |
|
|
{\ifnum\@tempcnta=\z@\else |
215 |
|
|
\expandafter\@gobblethree |
216 |
|
|
\fi}% |
217 |
|
|
{}% |
218 |
|
|
\lst@EndComment\lst@PODmode |
219 |
|
|
\fi} |
220 |
|
|
\lst@EndAspect |
221 |
|
|
\lst@BeginAspect[keywords]{html} |
222 |
|
|
\gdef\lst@tagtypes{s} |
223 |
|
|
\gdef\lst@TagKey#1#2{% |
224 |
|
|
\lst@Delim\lst@tagstyle #2\relax |
225 |
|
|
{Tag}\lst@tagtypes #1% |
226 |
|
|
{\lst@BeginTag\lst@EndTag}% |
227 |
|
|
\@@end\@empty{}} |
228 |
|
|
\lst@Key{tag}\relax{\lst@TagKey\@empty{#1}} |
229 |
|
|
\lst@Key{tagstyle}{}{\def\lst@tagstyle{#1}} |
230 |
|
|
\lst@AddToHook{EmptyStyle}{\let\lst@tagstyle\@empty} |
231 |
|
|
\gdef\lst@BeginTag{% |
232 |
|
|
\lst@DelimOpen |
233 |
|
|
\lst@ifextags\else |
234 |
|
|
{\let\lst@ifkeywords\iftrue |
235 |
|
|
\lst@ifmarkfirstintag \lst@firstintagtrue \fi}} |
236 |
|
|
\lst@AddToHookExe{ExcludeDelims}{\let\lst@ifextags\iffalse} |
237 |
|
|
\gdef\lst@EndTag{\lst@DelimClose\lst@ifextags\else} |
238 |
|
|
\lst@Key{usekeywordsintag}t[t]{\lstKV@SetIf{#1}\lst@ifusekeysintag} |
239 |
|
|
\lst@Key{markfirstintag}f[t]{\lstKV@SetIf{#1}\lst@ifmarkfirstintag} |
240 |
|
|
\gdef\lst@firstintagtrue{\global\let\lst@iffirstintag\iftrue} |
241 |
|
|
\global\let\lst@iffirstintag\iffalse |
242 |
|
|
\lst@AddToHook{PostOutput}{\lst@tagresetfirst} |
243 |
|
|
\lst@AddToHook{Output} |
244 |
|
|
{\gdef\lst@tagresetfirst{\global\let\lst@iffirstintag\iffalse}} |
245 |
|
|
\lst@AddToHook{OutputOther}{\gdef\lst@tagresetfirst{}} |
246 |
|
|
\lst@AddToHook{Output} |
247 |
|
|
{\ifnum\lst@mode=\lst@tagmode |
248 |
|
|
\lst@iffirstintag \let\lst@thestyle\lst@gkeywords@sty \fi |
249 |
|
|
\lst@ifusekeysintag\else \let\lst@thestyle\lst@gkeywords@sty\fi |
250 |
|
|
\fi} |
251 |
|
|
\lst@NewMode\lst@tagmode |
252 |
|
|
\lst@AddToHook{Init}{\global\let\lst@ifnotag\iftrue} |
253 |
|
|
\lst@AddToHook{SelectCharTable}{\let\lst@ifkeywords\lst@ifnotag} |
254 |
|
|
\gdef\lst@Tag@s#1#2\@empty#3#4#5{% |
255 |
|
|
\global\let\lst@ifnotag\iffalse |
256 |
|
|
\lst@CArg #1\relax\lst@DefDelimB {}{}% |
257 |
|
|
{\ifnum\lst@mode=\lst@tagmode \expandafter\@gobblethree \fi}% |
258 |
|
|
#3\lst@tagmode{#5}% |
259 |
|
|
\lst@CArg #2\relax\lst@DefDelimE {}{}{}#4\lst@tagmode}% |
260 |
|
|
\gdef\lst@BeginCDATA#1\@empty{% |
261 |
|
|
\lst@TrackNewLines \lst@PrintToken |
262 |
|
|
\lst@EnterMode\lst@GPmode{}\let\lst@ifmode\iffalse |
263 |
|
|
\lst@mode\lst@tagmode #1\lst@mode\lst@GPmode\relax\lst@modetrue} |
264 |
|
|
\lst@EndAspect |
265 |
|
|
\lst@BeginAspect{escape} |
266 |
|
|
\lst@Key{texcl}{false}[t]{\lstKV@SetIf{#1}\lst@iftexcl} |
267 |
|
|
\lst@AddToHook{TextStyle}{\let\lst@iftexcl\iffalse} |
268 |
|
|
\lst@AddToHook{EOL} |
269 |
|
|
{\ifnum\lst@mode=\lst@TeXLmode |
270 |
|
|
\expandafter\lst@escapeend |
271 |
|
|
\expandafter\lst@LeaveAllModes |
272 |
|
|
\expandafter\lst@ReenterModes |
273 |
|
|
\fi} |
274 |
|
|
\lst@AddToHook{AfterBeginComment} |
275 |
|
|
{\lst@iftexcl \lst@ifLmode \lst@ifdropinput\else |
276 |
|
|
\lst@PrintToken |
277 |
|
|
\lst@LeaveMode \lst@InterruptModes |
278 |
|
|
\lst@EnterMode{\lst@TeXLmode}{\lst@modetrue\lst@commentstyle}% |
279 |
|
|
\expandafter\expandafter\expandafter\lst@escapebegin |
280 |
|
|
\fi \fi \fi} |
281 |
|
|
\lst@NewMode\lst@TeXLmode |
282 |
|
|
\gdef\lst@ActiveCDefX#1{\lst@ActiveCDefX@#1} |
283 |
|
|
\gdef\lst@ActiveCDefX@#1#2#3{ |
284 |
|
|
\catcode`#1\active\lccode`\~=`#1% |
285 |
|
|
\lowercase{\lst@CDefIt~}{#2}{#3}{}} |
286 |
|
|
\gdef\lst@Escape#1#2#3#4{% |
287 |
|
|
\lst@CArgX #1\relax\lst@CDefX |
288 |
|
|
{}% |
289 |
|
|
{\lst@ifdropinput\else |
290 |
|
|
\lst@TrackNewLines\lst@OutputLostSpace \lst@XPrintToken |
291 |
|
|
\lst@InterruptModes |
292 |
|
|
\lst@EnterMode{\lst@TeXmode}{\lst@modetrue}% |
293 |
|
|
\ifx\^^M#2% |
294 |
|
|
\lst@CArg #2\relax\lst@ActiveCDefX |
295 |
|
|
{}% |
296 |
|
|
{\lst@escapeend #4\lst@LeaveAllModes\lst@ReenterModes}% |
297 |
|
|
{\lst@MProcessListing}% |
298 |
|
|
\else |
299 |
|
|
\lst@CArg #2\relax\lst@ActiveCDefX |
300 |
|
|
{}% |
301 |
|
|
{\lst@escapeend #4\lst@LeaveAllModes\lst@ReenterModes |
302 |
|
|
\lst@whitespacefalse}% |
303 |
|
|
{}% |
304 |
|
|
\fi |
305 |
|
|
#3\lst@escapebegin |
306 |
|
|
\fi}% |
307 |
|
|
{}} |
308 |
|
|
\lst@NewMode\lst@TeXmode |
309 |
|
|
\lst@Key{escapebegin}{}{\def\lst@escapebegin{#1}} |
310 |
|
|
\lst@Key{escapeend}{}{\def\lst@escapeend{#1}} |
311 |
|
|
\lst@Key{escapechar}{} |
312 |
|
|
{\ifx\@empty#1\@empty |
313 |
|
|
\let\lst@DefEsc\relax |
314 |
|
|
\else |
315 |
|
|
\def\lst@DefEsc{\lst@Escape{#1}{#1}{}{}}% |
316 |
|
|
\fi} |
317 |
|
|
\lst@AddToHook{TextStyle}{\let\lst@DefEsc\@empty} |
318 |
|
|
\lst@AddToHook{SelectCharTable}{\lst@DefEsc} |
319 |
|
|
\lst@Key{escapeinside}{}{\lstKV@TwoArg{#1}% |
320 |
|
|
{\let\lst@DefEsc\@empty |
321 |
|
|
\ifx\@empty##1@empty\else \ifx\@empty##2\@empty\else |
322 |
|
|
\def\lst@DefEsc{\lst@Escape{##1}{##2}{}{}}% |
323 |
|
|
\fi\fi}} |
324 |
|
|
\lst@Key{mathescape}{false}[t]{\lstKV@SetIf{#1}\lst@ifmathescape} |
325 |
|
|
\lst@AddToHook{SelectCharTable} |
326 |
|
|
{\lst@ifmathescape \lst@Escape{\$}{\$}% |
327 |
|
|
{\setbox\@tempboxa=\hbox\bgroup$}% |
328 |
|
|
{$\egroup \lst@CalcLostSpaceAndOutput}\fi} |
329 |
|
|
\lst@EndAspect |
330 |
|
|
\lst@BeginAspect{keywords} |
331 |
|
|
\global\let\lst@ifsensitive\iftrue % init |
332 |
|
|
\global\let\lst@ifsensitivedefed\iffalse % init % \global |
333 |
|
|
\lst@ifsavemem\else |
334 |
|
|
\gdef\lst@KeywordTest#1#2#3{% |
335 |
|
|
\begingroup \let\lst@UM\@empty |
336 |
|
|
\global\expandafter\let\expandafter\@gtempa |
337 |
|
|
\csname\@lst#1@\the\lst@token\endcsname |
338 |
|
|
\endgroup |
339 |
|
|
\ifx\@gtempa\relax\else |
340 |
|
|
\let\lst@thestyle\@gtempa |
341 |
|
|
\fi} |
342 |
|
|
\gdef\lst@KEYWORDTEST{% |
343 |
|
|
\uppercase\expandafter{\expandafter |
344 |
|
|
\lst@KEYWORDTEST@\the\lst@token}\relax} |
345 |
|
|
\gdef\lst@KEYWORDTEST@#1\relax#2#3#4{% |
346 |
|
|
\begingroup \let\lst@UM\@empty |
347 |
|
|
\global\expandafter\let\expandafter\@gtempa |
348 |
|
|
\csname\@lst#2@#1\endcsname |
349 |
|
|
\endgroup |
350 |
|
|
\ifx\@gtempa\relax\else |
351 |
|
|
\let\lst@thestyle\@gtempa |
352 |
|
|
\fi} |
353 |
|
|
\gdef\lst@WorkingTest#1#2#3{% |
354 |
|
|
\begingroup \let\lst@UM\@empty |
355 |
|
|
\global\expandafter\let\expandafter\@gtempa |
356 |
|
|
\csname\@lst#1@\the\lst@token\endcsname |
357 |
|
|
\endgroup |
358 |
|
|
\@gtempa} |
359 |
|
|
\gdef\lst@WORKINGTEST{% |
360 |
|
|
\uppercase\expandafter{\expandafter |
361 |
|
|
\lst@WORKINGTEST@\the\lst@token}\relax} |
362 |
|
|
\gdef\lst@WORKINGTEST@#1\relax#2#3#4{% |
363 |
|
|
\begingroup \let\lst@UM\@empty |
364 |
|
|
\global\expandafter\let\expandafter\@gtempa |
365 |
|
|
\csname\@lst#2@#1\endcsname |
366 |
|
|
\endgroup |
367 |
|
|
\@gtempa} |
368 |
|
|
\gdef\lst@DefineKeywords#1#2#3{% |
369 |
|
|
\lst@ifsensitive |
370 |
|
|
\def\lst@next{\lst@for#2}% |
371 |
|
|
\else |
372 |
|
|
\def\lst@next{\uppercase\expandafter{\expandafter\lst@for#2}}% |
373 |
|
|
\fi |
374 |
|
|
\lst@next\do |
375 |
|
|
{\expandafter\ifx\csname\@lst#1@##1\endcsname\relax |
376 |
|
|
\global\expandafter\let\csname\@lst#1@##1\endcsname#3% |
377 |
|
|
\fi}} |
378 |
|
|
\gdef\lst@UndefineKeywords#1#2#3{% |
379 |
|
|
\lst@ifsensitivedefed |
380 |
|
|
\def\lst@next{\lst@for#2}% |
381 |
|
|
\else |
382 |
|
|
\def\lst@next{\uppercase\expandafter{\expandafter\lst@for#2}}% |
383 |
|
|
\fi |
384 |
|
|
\lst@next\do |
385 |
|
|
{\expandafter\ifx\csname\@lst#1@##1\endcsname#3% |
386 |
|
|
\global\expandafter\let\csname\@lst#1@##1\endcsname\relax |
387 |
|
|
\fi}} |
388 |
|
|
\fi |
389 |
|
|
\lst@ifsavemem |
390 |
|
|
\gdef\lst@IfOneOutOf#1\relax#2{% |
391 |
|
|
\def\lst@temp##1,#1,##2##3\relax{% |
392 |
|
|
\ifx\@empty##2\else \expandafter\lst@IOOOfirst \fi}% |
393 |
|
|
\def\lst@next{\lst@IfOneOutOf@#1\relax}% |
394 |
|
|
\expandafter\lst@next#2\relax\relax} |
395 |
|
|
\gdef\lst@IfOneOutOf@#1\relax#2#3{% |
396 |
|
|
\ifx#2\relax |
397 |
|
|
\expandafter\@secondoftwo |
398 |
|
|
\else |
399 |
|
|
\expandafter\lst@temp\expandafter,#2,#1,\@empty\relax |
400 |
|
|
\expandafter\lst@next |
401 |
|
|
\fi} |
402 |
|
|
\ifx\iffalse\else\fi |
403 |
|
|
\gdef\lst@IOOOfirst#1\relax#2#3{\fi#2} |
404 |
|
|
\gdef\lst@IFONEOUTOF#1\relax#2{% |
405 |
|
|
\uppercase{\def\lst@temp##1,#1},##2##3\relax{% |
406 |
|
|
\ifx\@empty##2\else \expandafter\lst@IOOOfirst \fi}% |
407 |
|
|
\def\lst@next{\lst@IFONEOUTOF@#1\relax}% |
408 |
|
|
\expandafter\lst@next#2\relax} |
409 |
|
|
\gdef\lst@IFONEOUTOF@#1\relax#2#3{% |
410 |
|
|
\ifx#2\relax |
411 |
|
|
\expandafter\@secondoftwo |
412 |
|
|
\else |
413 |
|
|
\uppercase |
414 |
|
|
{\expandafter\lst@temp\expandafter,#2,#1,\@empty\relax}% |
415 |
|
|
\expandafter\lst@next |
416 |
|
|
\fi} |
417 |
|
|
\gdef\lst@KWTest{% |
418 |
|
|
\begingroup \let\lst@UM\@empty |
419 |
|
|
\expandafter\xdef\expandafter\@gtempa\expandafter{\the\lst@token}% |
420 |
|
|
\endgroup |
421 |
|
|
\expandafter\lst@IfOneOutOf\@gtempa\relax} |
422 |
|
|
\gdef\lst@KeywordTest#1#2#3{\lst@KWTest #2{\let\lst@thestyle#3}{}} |
423 |
|
|
\global\let\lst@KEYWORDTEST\lst@KeywordTest |
424 |
|
|
\gdef\lst@WorkingTest#1#2#3{\lst@KWTest #2#3{}} |
425 |
|
|
\global\let\lst@WORKINGTEST\lst@WorkingTest |
426 |
|
|
\fi |
427 |
|
|
\lst@Key{sensitive}\relax[t]{\lstKV@SetIf{#1}\lst@ifsensitive} |
428 |
|
|
\lst@AddToHook{SetLanguage}{\let\lst@ifsensitive\iftrue} |
429 |
|
|
\lst@AddToHook{Init} |
430 |
|
|
{\lst@ifsensitive\else |
431 |
|
|
\let\lst@KeywordTest\lst@KEYWORDTEST |
432 |
|
|
\let\lst@WorkingTest\lst@WORKINGTEST |
433 |
|
|
\let\lst@IfOneOutOf\lst@IFONEOUTOF |
434 |
|
|
\fi} |
435 |
|
|
\gdef\lst@MakeMacroUppercase#1{% |
436 |
|
|
\ifx\@undefined#1\else \uppercase\expandafter |
437 |
|
|
{\expandafter\def\expandafter#1\expandafter{#1}}% |
438 |
|
|
\fi} |
439 |
|
|
\gdef\lst@InstallTest#1#2#3#4#5#6#7#8{% |
440 |
|
|
\lst@AddToHook{TrackKeywords}{\lst@TrackKeywords{#1}#2#4#6#7#8}% |
441 |
|
|
\lst@AddToHook{PostTrackKeywords}{\lst@PostTrackKeywords#2#3#4#5}} |
442 |
|
|
\lst@AddToHook{Init}{\lsthk@TrackKeywords\lsthk@PostTrackKeywords} |
443 |
|
|
\lst@AddToHook{TrackKeywords}{}% init |
444 |
|
|
\lst@AddToHook{PostTrackKeywords}{}% init |
445 |
|
|
\lst@AddToHook{Output}{\lst@ifkeywords \lsthk@DetectKeywords \fi} |
446 |
|
|
\lst@AddToHook{DetectKeywords}{}% init |
447 |
|
|
\lst@AddToHook{ModeTrue}{\let\lst@ifkeywords\iffalse} |
448 |
|
|
\lst@AddToHook{Init}{\let\lst@ifkeywords\iftrue} |
449 |
|
|
\gdef\lst@InstallTestNow#1#2#3#4#5{% |
450 |
|
|
\@ifundefined{\string#2#1}% |
451 |
|
|
{\global\@namedef{\string#2#1}{}% |
452 |
|
|
\edef\@tempa{% |
453 |
|
|
\noexpand\lst@AddToHook{\ifx#5dDetectKeywords\else Output\fi}% |
454 |
|
|
{\ifx #4w\noexpand\lst@WorkingTest |
455 |
|
|
\else\noexpand\lst@KeywordTest \fi |
456 |
|
|
{#1}\noexpand#2\noexpand#3}}% |
457 |
|
|
\lst@ifsavemem |
458 |
|
|
\@tempa |
459 |
|
|
\else |
460 |
|
|
\@ifundefined{\@lst#1@if@ins}% |
461 |
|
|
{\@tempa \global\@namedef{\@lst#1@if@ins}{}}% |
462 |
|
|
{}% |
463 |
|
|
\fi} |
464 |
|
|
{}} |
465 |
|
|
\gdef\lst@TrackKeywords#1#2#3#4#5#6{% |
466 |
|
|
\lst@false |
467 |
|
|
\def\lst@arg{{#1}#4}% |
468 |
|
|
\expandafter\expandafter\expandafter\lst@TK@ |
469 |
|
|
\expandafter\lst@arg#2\relax\relax |
470 |
|
|
\lst@ifsavemem\else |
471 |
|
|
\def\lst@arg{{#1}#4#2}% |
472 |
|
|
\expandafter\expandafter\expandafter\lst@TK@@ |
473 |
|
|
\expandafter\lst@arg#3\relax\relax |
474 |
|
|
\fi |
475 |
|
|
\lst@if \lst@InstallTestNow{#1}#2#4#5#6\fi} |
476 |
|
|
\gdef\lst@TK@#1#2#3#4{% |
477 |
|
|
\ifx\lst@ifsensitive\lst@ifsensitivedefed |
478 |
|
|
\ifx#3#4\else |
479 |
|
|
\lst@true |
480 |
|
|
\lst@ifsavemem\else |
481 |
|
|
\lst@UndefineKeywords{#1}#4#2% |
482 |
|
|
\lst@DefineKeywords{#1}#3#2% |
483 |
|
|
\fi |
484 |
|
|
\fi |
485 |
|
|
\else |
486 |
|
|
\ifx#3\relax\else |
487 |
|
|
\lst@true |
488 |
|
|
\lst@ifsavemem\else |
489 |
|
|
\lst@UndefineKeywords{#1}#4#2% |
490 |
|
|
\lst@DefineKeywords{#1}#3#2% |
491 |
|
|
\fi |
492 |
|
|
\fi |
493 |
|
|
\fi |
494 |
|
|
\lst@ifsavemem \ifx#3\relax\else |
495 |
|
|
\lst@ifsensitive\else \lst@MakeMacroUppercase#3\fi |
496 |
|
|
\fi \fi |
497 |
|
|
\ifx#3\relax |
498 |
|
|
\expandafter\@gobblethree |
499 |
|
|
\fi |
500 |
|
|
\lst@TK@{#1}#2} |
501 |
|
|
\gdef\lst@TK@@#1#2#3#4#5{% |
502 |
|
|
\ifx#4\relax |
503 |
|
|
\expandafter\@gobblefour |
504 |
|
|
\else |
505 |
|
|
\lst@IfSubstring{#4#5}#3{}{\lst@UndefineKeywords{#1}#5#2}% |
506 |
|
|
\fi |
507 |
|
|
\lst@TK@@{#1}#2#3} |
508 |
|
|
\lst@AddToHook{InitVars} |
509 |
|
|
{\global\let\lst@ifsensitivedefed\lst@ifsensitive} |
510 |
|
|
\gdef\lst@PostTrackKeywords#1#2#3#4{% |
511 |
|
|
\lst@ifsavemem\else |
512 |
|
|
\global\let#3#1% |
513 |
|
|
\global\let#4#2% |
514 |
|
|
\fi} |
515 |
|
|
\lst@Key{classoffset}\z@{\def\lst@classoffset{#1}} |
516 |
|
|
\gdef\lst@InstallFamily#1#2#3#4#5{% |
517 |
|
|
\lst@Key{#2}\relax{\lst@UseFamily{#2}##1\relax\lst@MakeKeywords}% |
518 |
|
|
\lst@Key{more#2}\relax |
519 |
|
|
{\lst@UseFamily{#2}##1\relax\lst@MakeMoreKeywords}% |
520 |
|
|
\lst@Key{delete#2}\relax |
521 |
|
|
{\lst@UseFamily{#2}##1\relax\lst@DeleteKeywords}% |
522 |
|
|
\ifx\@empty#3\@empty\else |
523 |
|
|
\lst@Key{#3}{#4}{\lstKV@OptArg[\@ne]{##1}% |
524 |
|
|
{\@tempcnta\lst@classoffset \advance\@tempcnta####1\relax |
525 |
|
|
\@namedef{lst@#3\ifnum\@tempcnta=\@ne\else \the\@tempcnta |
526 |
|
|
\fi}{####2}}}% |
527 |
|
|
\fi |
528 |
|
|
\expandafter\lst@InstallFamily@ |
529 |
|
|
\csname\@lst @#2@data\expandafter\endcsname |
530 |
|
|
\csname\@lst @#5\endcsname {#1}{#2}{#3}} |
531 |
|
|
\gdef\lst@InstallFamily@#1#2#3#4#5#6#7#8{% |
532 |
|
|
\gdef#1{{#3}{#4}{#5}#2#7}% |
533 |
|
|
\long\def\lst@temp##1{#6}% |
534 |
|
|
\ifx\lst@temp\@gobble |
535 |
|
|
\lst@AddTo#1{s#8}% |
536 |
|
|
\else |
537 |
|
|
\lst@AddTo#1{w#8}% |
538 |
|
|
\global\@namedef{lst@g#4@wp}##1{#6}% |
539 |
|
|
\fi} |
540 |
|
|
\gdef\lst@UseFamily#1{% |
541 |
|
|
\def\lst@family{#1}% |
542 |
|
|
\@ifnextchar[\lst@UseFamily@{\lst@UseFamily@[\@ne]}} |
543 |
|
|
\gdef\lst@UseFamily@[#1]{% |
544 |
|
|
\@tempcnta\lst@classoffset \advance\@tempcnta#1\relax |
545 |
|
|
\lst@ProvideFamily\lst@family |
546 |
|
|
\lst@UseFamily@a |
547 |
|
|
{\lst@family\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}} |
548 |
|
|
\gdef\lst@UseFamily@a#1{% |
549 |
|
|
\expandafter\lst@UseFamily@b |
550 |
|
|
\csname\@lst @#1@list\expandafter\endcsname |
551 |
|
|
\csname\@lst @#1\expandafter\endcsname |
552 |
|
|
\csname\@lst @#1@also\expandafter\endcsname |
553 |
|
|
\csname\@lst @g#1\endcsname} |
554 |
|
|
\gdef\lst@UseFamily@b#1#2#3#4#5\relax#6{\lstKV@XOptArg[]{#5}#6#1#2#3#4} |
555 |
|
|
\gdef\lst@ProvideFamily#1{% |
556 |
|
|
\@ifundefined{lstfam@#1\ifnum\@tempcnta=\@ne\else\the\@tempcnta\fi}% |
557 |
|
|
{\@namedef{lstfam@#1\ifnum\@tempcnta=\@ne\else \the\@tempcnta\fi}{}% |
558 |
|
|
\expandafter\expandafter\expandafter\lst@ProvideFamily@ |
559 |
|
|
\csname\@lst @#1@data\endcsname |
560 |
|
|
{\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}}% |
561 |
|
|
{}}% |
562 |
|
|
\gdef\lst@ProvideFamily@#1#2#3#4#5#6#7#8{% |
563 |
|
|
\expandafter\xdef\csname\@lst @g#2#8@sty\endcsname |
564 |
|
|
{\if #6w% |
565 |
|
|
\expandafter\noexpand\csname\@lst @g#2@wp\endcsname{#8}% |
566 |
|
|
\else |
567 |
|
|
\expandafter\noexpand\csname\@lst @#3#8\endcsname |
568 |
|
|
\fi}% |
569 |
|
|
\ifx\@empty#3\@empty\else |
570 |
|
|
\edef\lst@temp{\noexpand\lst@AddToHook{Init}{% |
571 |
|
|
\noexpand\lst@ProvideStyle\expandafter\noexpand |
572 |
|
|
\csname\@lst @#3#8\endcsname\noexpand#4}}% |
573 |
|
|
\lst@temp |
574 |
|
|
\fi |
575 |
|
|
\expandafter\lst@ProvideFamily@@ |
576 |
|
|
\csname\@lst @#2#8@list\expandafter\endcsname |
577 |
|
|
\csname\@lst @#2#8\expandafter\endcsname |
578 |
|
|
\csname\@lst @#2#8@also\expandafter\endcsname |
579 |
|
|
\csname\@lst @g#2#8@list\expandafter\endcsname |
580 |
|
|
\csname\@lst @g#2#8\expandafter\endcsname |
581 |
|
|
\csname\@lst @g#2#8@sty\expandafter\endcsname |
582 |
|
|
{#1}#5#6#7} |
583 |
|
|
\gdef\lst@ProvideFamily@@#1#2#3#4#5#6#7#8{% |
584 |
|
|
\gdef#1{#2#5}\global\let#2\@empty \global\let#3\@empty % init |
585 |
|
|
\gdef#4{#2#5}\global\let#5\@empty % init |
586 |
|
|
\if #8l\relax |
587 |
|
|
\lst@AddToHook{SetLanguage}{\def#1{#2#5}\let#2\@empty}% |
588 |
|
|
\fi |
589 |
|
|
\lst@InstallTest{#7}#1#2#4#5#6} |
590 |
|
|
\gdef\lst@InstallKeywords#1#2#3#4#5{% |
591 |
|
|
\lst@Key{#2}\relax |
592 |
|
|
{\lst@UseFamily{#2}[\@ne]##1\relax\lst@MakeKeywords}% |
593 |
|
|
\lst@Key{more#2}\relax |
594 |
|
|
{\lst@UseFamily{#2}[\@ne]##1\relax\lst@MakeMoreKeywords}% |
595 |
|
|
\lst@Key{delete#2}\relax |
596 |
|
|
{\lst@UseFamily{#2}[\@ne]##1\relax\lst@DeleteKeywords}% |
597 |
|
|
\ifx\@empty#3\@empty\else |
598 |
|
|
\lst@Key{#3}{#4}{\@namedef{lst@#3}{##1}}% |
599 |
|
|
\fi |
600 |
|
|
\expandafter\lst@InstallFamily@ |
601 |
|
|
\csname\@lst @#2@data\expandafter\endcsname |
602 |
|
|
\csname\@lst @#5\endcsname {#1}{#2}{#3}} |
603 |
|
|
\gdef\lst@ProvideStyle#1#2{% |
604 |
|
|
\ifx#1\@undefined \let#1#2% |
605 |
|
|
\else\ifx#1\relax \let#1#2\fi\fi} |
606 |
|
|
\gdef\lst@BuildClassList#1#2,{% |
607 |
|
|
\ifx\relax#2\@empty\else |
608 |
|
|
\ifx\@empty#2\@empty\else |
609 |
|
|
\lst@lExtend#1{\csname\@lst @#2\expandafter\endcsname |
610 |
|
|
\csname\@lst @g#2\endcsname}% |
611 |
|
|
\fi |
612 |
|
|
\expandafter\lst@BuildClassList\expandafter#1 |
613 |
|
|
\fi} |
614 |
|
|
\gdef\lst@DeleteClassesIn#1#2{% |
615 |
|
|
\expandafter\lst@DCI@\expandafter#1#2\relax\relax} |
616 |
|
|
\gdef\lst@DCI@#1#2#3{% |
617 |
|
|
\ifx#2\relax |
618 |
|
|
\expandafter\@gobbletwo |
619 |
|
|
\else |
620 |
|
|
\def\lst@temp##1#2#3##2{% |
621 |
|
|
\lst@lAddTo#1{##1}% |
622 |
|
|
\ifx ##2\relax\else |
623 |
|
|
\expandafter\lst@temp |
624 |
|
|
\fi ##2}% |
625 |
|
|
\let\@tempa#1\let#1\@empty |
626 |
|
|
\expandafter\lst@temp\@tempa#2#3\relax |
627 |
|
|
\fi |
628 |
|
|
\lst@DCI@#1} |
629 |
|
|
\gdef\lst@MakeKeywords[#1]#2#3#4#5#6{% |
630 |
|
|
\def#3{#4#6}\let#4\@empty \let#5\@empty |
631 |
|
|
\lst@MakeMoreKeywords[#1]{#2}#3#4#5#6} |
632 |
|
|
\gdef\lst@MakeMoreKeywords[#1]#2#3#4#5#6{% |
633 |
|
|
\lst@BuildClassList#3#1,\relax,% |
634 |
|
|
\lst@DefOther\lst@temp{,#2}\lst@lExtend#4\lst@temp} |
635 |
|
|
\gdef\lst@DeleteKeywords[#1]#2#3#4#5#6{% |
636 |
|
|
\lst@MakeKeywords[#1]{#2}\@tempa\@tempb#5#6% |
637 |
|
|
\lst@DeleteClassesIn#3\@tempa |
638 |
|
|
\lst@DeleteKeysIn#4\@tempb} |
639 |
|
|
\lst@InstallFamily k{keywords}{keywordstyle}\bfseries{keywordstyle}{}ld |
640 |
|
|
\lst@Key{ndkeywords}\relax |
641 |
|
|
{\lst@UseFamily{keywords}[\tw@]#1\relax\lst@MakeKeywords}% |
642 |
|
|
\lst@Key{morendkeywords}\relax |
643 |
|
|
{\lst@UseFamily{keywords}[\tw@]#1\relax\lst@MakeMoreKeywords}% |
644 |
|
|
\lst@Key{deletendkeywords}\relax |
645 |
|
|
{\lst@UseFamily{keywords}[\tw@]#1\relax\lst@DeleteKeywords}% |
646 |
|
|
\lst@Key{ndkeywordstyle}\relax{\@namedef{lst@keywordstyle2}{#1}}% |
647 |
|
|
\lst@Key{keywordsprefix}\relax{\lst@DefActive\lst@keywordsprefix{#1}} |
648 |
|
|
\global\let\lst@keywordsprefix\@empty |
649 |
|
|
\lst@AddToHook{SelectCharTable} |
650 |
|
|
{\ifx\lst@keywordsprefix\@empty\else |
651 |
|
|
\expandafter\lst@CArg\lst@keywordsprefix\relax |
652 |
|
|
\lst@CDef{}% |
653 |
|
|
{\lst@ifletter\else |
654 |
|
|
\global\let\lst@prefixkeyword\@empty |
655 |
|
|
\fi}% |
656 |
|
|
{}% |
657 |
|
|
\fi} |
658 |
|
|
\lst@AddToHook{Init}{\global\let\lst@prefixkeyword\relax} |
659 |
|
|
\lst@AddToHook{Output} |
660 |
|
|
{\ifx\lst@prefixkeyword\@empty |
661 |
|
|
\let\lst@thestyle\lst@gkeywords@sty |
662 |
|
|
\global\let\lst@prefixkeyword\relax |
663 |
|
|
\fi}% |
664 |
|
|
\lst@Key{otherkeywords}{}{% |
665 |
|
|
\let\lst@otherkeywords\@empty |
666 |
|
|
\lst@for{#1}\do{% |
667 |
|
|
\lst@MakeActive{##1}% |
668 |
|
|
\lst@lExtend\lst@otherkeywords{% |
669 |
|
|
\expandafter\lst@CArg\lst@temp\relax\lst@CDef |
670 |
|
|
{}\lst@PrintOtherKeyword\@empty}}} |
671 |
|
|
\lst@AddToHook{SelectCharTable}{\lst@otherkeywords} |
672 |
|
|
\gdef\lst@PrintOtherKeyword#1\@empty{% |
673 |
|
|
\lst@XPrintToken |
674 |
|
|
\begingroup |
675 |
|
|
\lst@modetrue \lsthk@TextStyle |
676 |
|
|
\let\lst@ProcessDigit\lst@ProcessLetter |
677 |
|
|
\let\lst@ProcessOther\lst@ProcessLetter |
678 |
|
|
\lst@lettertrue |
679 |
|
|
\lst@gkeywords@sty{#1\lst@XPrintToken}% |
680 |
|
|
\endgroup} |
681 |
|
|
\lst@EndAspect |
682 |
|
|
\lst@BeginAspect[keywords]{emph} |
683 |
|
|
\lst@InstallFamily e{emph}{emphstyle}{}{emphstyle}{}od |
684 |
|
|
\lst@EndAspect |
685 |
|
|
\lst@BeginAspect[keywords]{tex} |
686 |
|
|
\lst@InstallKeywords{cs}{texcs}{texcsstyle}\relax{keywordstyle} |
687 |
|
|
{\ifx\lst@lastother\lstum@backslash |
688 |
|
|
\let\lst@thestyle\lst@texcsstyle |
689 |
|
|
\fi} |
690 |
|
|
ld |
691 |
|
|
\lst@EndAspect |
692 |
|
|
\lst@BeginAspect[keywords]{directives} |
693 |
|
|
\lst@NewMode\lst@CDmode |
694 |
|
|
\lst@AddToHook{EOL}{\ifnum\lst@mode=\lst@CDmode \lst@LeaveMode \fi} |
695 |
|
|
\lst@InstallKeywords{d}{directives}{directivestyle}\relax{keywordstyle} |
696 |
|
|
{\ifnum\lst@mode=\lst@CDmode |
697 |
|
|
\let\lst@thestyle\lst@directivestyle |
698 |
|
|
\fi} |
699 |
|
|
ld |
700 |
|
|
\global\let\lst@directives\@empty % init |
701 |
|
|
\lst@AddToHook{SelectCharTable} |
702 |
|
|
{\ifx\lst@directives\@empty\else |
703 |
|
|
\lst@DefSaveDef{`\#}\lsts@CCD |
704 |
|
|
{\lst@CalcColumn |
705 |
|
|
\lst@ifmode\else |
706 |
|
|
\ifnum\@tempcnta=\z@ |
707 |
|
|
\lst@EnterMode{\lst@CDmode}{}% |
708 |
|
|
\fi |
709 |
|
|
\fi |
710 |
|
|
\ifnum\lst@mode=\lst@CDmode |
711 |
|
|
\ifnum\@tempcnta=\z@ |
712 |
|
|
\lst@XPrintToken |
713 |
|
|
{\let\lst@currstyle\lst@directivestyle |
714 |
|
|
\lsts@CCD\lst@PrintToken}% |
715 |
|
|
\else \lsts@CCD |
716 |
|
|
\fi |
717 |
|
|
\else \lsts@CCD |
718 |
|
|
\fi}% |
719 |
|
|
\fi} |
720 |
|
|
\lst@AddTo\lst@stringtypes{,directive} |
721 |
|
|
\gdef\lst@StringDM@directive#1#2#3\@empty{% |
722 |
|
|
\lst@CArg #2\relax\lst@CDef |
723 |
|
|
{}% |
724 |
|
|
{\let\lst@bnext\lst@CArgEmpty |
725 |
|
|
\ifnum\lst@mode=\lst@CDmode |
726 |
|
|
\def\lst@bnext{\lst@BeginString{#1}}% |
727 |
|
|
\fi |
728 |
|
|
\lst@bnext}% |
729 |
|
|
\@empty |
730 |
|
|
\lst@CArg #3\relax\lst@CDef |
731 |
|
|
{}% |
732 |
|
|
{\let\lst@enext\lst@CArgEmpty |
733 |
|
|
\ifnum #1=\lst@mode |
734 |
|
|
\let\lst@bnext\lst@EndString |
735 |
|
|
\fi |
736 |
|
|
\lst@bnext}% |
737 |
|
|
\@empty} |
738 |
|
|
\lst@EndAspect |
739 |
|
|
\lst@BeginAspect[keywords,comments]{keywordcomments} |
740 |
|
|
\lst@NewMode\lst@KCmode \lst@NewMode\lst@KCSmode |
741 |
|
|
\gdef\lst@BeginKC{\aftergroup\aftergroup\aftergroup\lst@BeginKC@}% |
742 |
|
|
\gdef\lst@BeginKC@{% |
743 |
|
|
\lst@ResetToken |
744 |
|
|
\lst@BeginComment\lst@KCmode{{\lst@commentstyle}\lst@modetrue}% |
745 |
|
|
\@empty}% |
746 |
|
|
\gdef\lst@BeginKCS{\aftergroup\aftergroup\aftergroup\lst@BeginKCS@}% |
747 |
|
|
\gdef\lst@BeginKCS@{% |
748 |
|
|
\lst@ResetToken |
749 |
|
|
\lst@BeginComment\lst@KCSmode{{\lst@commentstyle}\lst@modetrue}% |
750 |
|
|
\@empty}% |
751 |
|
|
\lst@AddToHook{PostOutput}{\lst@KCpost \global\let\lst@KCpost\@empty} |
752 |
|
|
\global\let\lst@KCpost\@empty % init |
753 |
|
|
\gdef\lst@EndKC{\lst@SaveToken \lst@LeaveMode \lst@RestoreToken |
754 |
|
|
\let\lst@thestyle\lst@identifierstyle \lsthk@Output} |
755 |
|
|
\lst@InstallKeywords{kc}{keywordcomment}{}\relax{} |
756 |
|
|
{\ifnum\lst@mode=\lst@KCmode |
757 |
|
|
\edef\lst@temp{\the\lst@token}% |
758 |
|
|
\ifx\lst@temp\lst@KCmatch |
759 |
|
|
\lst@EndKC |
760 |
|
|
\fi |
761 |
|
|
\else |
762 |
|
|
\lst@ifmode\else |
763 |
|
|
\xdef\lst@KCmatch{\the\lst@token}% |
764 |
|
|
\global\let\lst@KCpost\lst@BeginKC |
765 |
|
|
\fi |
766 |
|
|
\fi} |
767 |
|
|
lo |
768 |
|
|
\lst@Key{keywordcommentsemicolon}{}{\lstKV@ThreeArg{#1}% |
769 |
|
|
{\def\lst@KCAkeywordsB{##1}% |
770 |
|
|
\def\lst@KCAkeywordsE{##2}% |
771 |
|
|
\def\lst@KCBkeywordsB{##3}% |
772 |
|
|
\def\lst@KCkeywords{##1##2##3}}} |
773 |
|
|
\lst@AddToHook{SetLanguage}{% |
774 |
|
|
\let\lst@KCAkeywordsB\@empty \let\lst@KCAkeywordsE\@empty |
775 |
|
|
\let\lst@KCBkeywordsB\@empty \let\lst@KCkeywords\@empty} |
776 |
|
|
\lst@AddToHook{SelectCharTable} |
777 |
|
|
{\ifx\lst@KCkeywords\@empty\else |
778 |
|
|
\lst@DefSaveDef{`\;}\lsts@EKC |
779 |
|
|
{\lst@XPrintToken |
780 |
|
|
\ifnum\lst@mode=\lst@KCmode \lst@EndComment\@empty \else |
781 |
|
|
\ifnum\lst@mode=\lst@KCSmode \lst@EndComment\@empty |
782 |
|
|
\fi \fi |
783 |
|
|
\lsts@EKC}% |
784 |
|
|
\fi} |
785 |
|
|
\gdef\lst@KCAWorkB{% |
786 |
|
|
\lst@ifmode\else \global\let\lst@KCpost\lst@BeginKC \fi} |
787 |
|
|
\gdef\lst@KCBWorkB{% |
788 |
|
|
\lst@ifmode\else \global\let\lst@KCpost\lst@BeginKCS \fi} |
789 |
|
|
\gdef\lst@KCAWorkE{\ifnum\lst@mode=\lst@KCmode \lst@EndKC \fi} |
790 |
|
|
\lst@ProvideFamily@@ |
791 |
|
|
\lst@KCAkeywordsB@list\lst@KCAkeywordsB \lst@KC@also |
792 |
|
|
\lst@gKCAkeywordsB@list\lst@gKCAkeywordsB \lst@KCAWorkB |
793 |
|
|
{kcb}owo % prefix, other key, working procedure, Output hook |
794 |
|
|
\lst@ProvideFamily@@ |
795 |
|
|
\lst@KCAkeywordsE@list\lst@KCAkeywordsE \lst@KC@also |
796 |
|
|
\lst@gKCAkeywordsE@list\lst@gKCAkeywordsE \lst@KCAWorkE |
797 |
|
|
{kce}owo |
798 |
|
|
\lst@ProvideFamily@@ |
799 |
|
|
\lst@KCBkeywordsB@list\lst@KCBkeywordsB \lst@KC@also |
800 |
|
|
\lst@gKCBkeywordsB@list\lst@gKCBkeywordsB \lst@KCBWorkB |
801 |
|
|
{kcs}owo |
802 |
|
|
\lst@EndAspect |
803 |
|
|
\lst@BeginAspect[keywords]{index} |
804 |
|
|
\lst@InstallFamily w{index}{indexstyle}\lstindexmacro{indexstyle} |
805 |
|
|
{\csname\@lst @indexstyle#1\expandafter\endcsname |
806 |
|
|
\expandafter{\the\lst@token}} |
807 |
|
|
od |
808 |
|
|
\lst@UserCommand\lstindexmacro#1{\index{{\ttfamily#1}}} |
809 |
|
|
\lst@EndAspect |
810 |
|
|
\lst@BeginAspect[keywords]{procnames} |
811 |
|
|
\gdef\lst@procnametrue{\global\let\lst@ifprocname\iftrue} |
812 |
|
|
\gdef\lst@procnamefalse{\global\let\lst@ifprocname\iffalse} |
813 |
|
|
\lst@AddToHook{Init}{\lst@procnamefalse} |
814 |
|
|
\lst@AddToHook{DetectKeywords} |
815 |
|
|
{\lst@ifprocname |
816 |
|
|
\let\lst@thestyle\lst@procnamestyle |
817 |
|
|
\lst@ifindexproc \csname\@lst @gindex@sty\endcsname \fi |
818 |
|
|
\lst@procnamefalse |
819 |
|
|
\fi} |
820 |
|
|
\lst@Key{procnamestyle}{}{\def\lst@procnamestyle{#1}} |
821 |
|
|
\lst@Key{indexprocnames}{false}[t]{\lstKV@SetIf{#1}\lst@ifindexproc} |
822 |
|
|
\lst@AddToHook{Init}{\lst@ifindexproc \lst@indexproc \fi} |
823 |
|
|
\gdef\lst@indexproc{% |
824 |
|
|
\@ifundefined{lst@indexstyle1}% |
825 |
|
|
{\@namedef{lst@indexstyle1}##1{}}% |
826 |
|
|
{}} |
827 |
|
|
\lst@InstallKeywords w{procnamekeys}{}\relax{} |
828 |
|
|
{\global\let\lst@PNpost\lst@procnametrue} |
829 |
|
|
od |
830 |
|
|
\lst@AddToHook{PostOutput}{\lst@PNpost\global\let\lst@PNpost\@empty} |
831 |
|
|
\global\let\lst@PNpost\@empty % init |
832 |
|
|
\lst@EndAspect |
833 |
|
|
\lst@BeginAspect{style} |
834 |
|
|
\@ifundefined{lststylefiles} |
835 |
|
|
{\lst@UserCommand\lststylefiles{lststy0.sty}}{} |
836 |
|
|
\lst@UserCommand\lstdefinestyle{\lst@DefStyle\iftrue} |
837 |
|
|
\lst@UserCommand\lst@definestyle{\lst@DefStyle\iffalse} |
838 |
|
|
\gdef\lst@DefStyle{\lst@DefDriver{style}{sty}\lstset} |
839 |
|
|
\global\@namedef{lststy@$}{\lsthk@EmptyStyle} |
840 |
|
|
\lst@AddToHook{EmptyStyle}{}% init |
841 |
|
|
\lst@Key{style}\relax{% |
842 |
|
|
\lst@LAS{style}{sty}{[]{#1}}\lst@NoAlias\lststylefiles |
843 |
|
|
\lsthk@SetStyle |
844 |
|
|
{}} |
845 |
|
|
\lst@AddToHook{SetStyle}{}% init |
846 |
|
|
\lst@EndAspect |
847 |
|
|
\lst@BeginAspect{language} |
848 |
|
|
\@ifundefined{lstdriverfiles} |
849 |
|
|
{\lst@UserCommand\lstlanguagefiles{lstlang0.sty}}{} |
850 |
|
|
\lst@UserCommand\lstdefinelanguage{\lst@DefLang\iftrue} |
851 |
|
|
\lst@UserCommand\lst@definelanguage{\lst@DefLang\iffalse} |
852 |
|
|
\gdef\lst@DefLang{\lst@DefDriver{language}{lang}\lstset} |
853 |
|
|
\lstdefinelanguage{}{} |
854 |
|
|
\lst@Key{language}\relax{\lstKV@OptArg[]{#1}% |
855 |
|
|
{\lst@LAS{language}{lang}{[##1]{##2}}\lst@FindAlias\lstlanguagefiles |
856 |
|
|
\lsthk@SetLanguage |
857 |
|
|
{\lst@FindAlias[##1]{##2}% |
858 |
|
|
\let\lst@language\lst@malias |
859 |
|
|
\let\lst@dialect\lst@oalias}}} |
860 |
|
|
\lst@Key{alsolanguage}\relax{\lstKV@OptArg[]{#1}% |
861 |
|
|
{\lst@LAS{language}{lang}{[##1]{##2}}\lst@FindAlias\lstlanguagefiles |
862 |
|
|
{}% |
863 |
|
|
{\lst@FindAlias[##1]{##2}% |
864 |
|
|
\let\lst@language\lst@malias |
865 |
|
|
\let\lst@dialect\lst@oalias}}} |
866 |
|
|
\lst@AddToHook{SetLanguage}{}% init |
867 |
|
|
\lst@UserCommand\lstalias{\@ifnextchar[\lstalias@\lstalias@@} |
868 |
|
|
\gdef\lstalias@[#1]#2[#3]#4{\lst@NormedNameDef{lsta@#2$#1}{#4$#3}} |
869 |
|
|
\gdef\lstalias@@#1#2{\lst@NormedNameDef{lsta@#1}{#2}} |
870 |
|
|
\lst@Key{defaultdialect}\relax |
871 |
|
|
{\lstKV@OptArg[]{#1}{\lst@NormedNameDef{lstdd@##2}{##1}}} |
872 |
|
|
\gdef\lst@FindAlias[#1]#2{% |
873 |
|
|
\lst@NormedDef\lst@oalias{#1}% |
874 |
|
|
\lst@NormedDef\lst@malias{#2}% |
875 |
|
|
\@ifundefined{lsta@\lst@malias}{}% |
876 |
|
|
{\edef\lst@malias{\csname\@lst a@\lst@malias\endcsname}}% |
877 |
|
|
\ifx\@empty\lst@oalias \@ifundefined{lstdd@\lst@malias}{}% |
878 |
|
|
{\edef\lst@oalias{\csname\@lst dd@\lst@malias\endcsname}}% |
879 |
|
|
\fi |
880 |
|
|
\edef\lst@temp{\lst@malias $\lst@oalias}% |
881 |
|
|
\@ifundefined{lsta@\lst@temp}{}% |
882 |
|
|
{\edef\lst@temp{\csname\@lst a@\lst@temp\endcsname}}% |
883 |
|
|
\expandafter\lst@FindAlias@\lst@temp $} |
884 |
|
|
\gdef\lst@FindAlias@#1$#2${% |
885 |
|
|
\def\lst@malias{#1}\def\lst@oalias{#2}% |
886 |
|
|
\ifx\@empty\lst@oalias \@ifundefined{lstdd@\lst@malias}{}% |
887 |
|
|
{\edef\lst@oalias{\csname\@lst dd@\lst@malias\endcsname}}% |
888 |
|
|
\fi} |
889 |
|
|
\gdef\lst@RequireLanguages#1{% |
890 |
|
|
\lst@Require{language}{lang}{#1}\lst@FindAlias\lstlanguagefiles |
891 |
|
|
\ifx\lst@loadaspects\@empty\else |
892 |
|
|
\lst@RequireAspects\lst@loadaspects |
893 |
|
|
\fi} |
894 |
|
|
\global\let\lstloadlanguages\lst@RequireLanguages |
895 |
|
|
\lst@EndAspect |
896 |
|
|
\lst@BeginAspect{formats} |
897 |
|
|
\@ifundefined{lstformatfiles} |
898 |
|
|
{\lst@UserCommand\lstformatfiles{lstfmt0.sty}}{} |
899 |
|
|
\lst@UserCommand\lstdefineformat{\lst@DefFormat\iftrue} |
900 |
|
|
\lst@UserCommand\lst@defineformat{\lst@DefFormat\iffalse} |
901 |
|
|
\gdef\lst@DefFormat{\lst@DefDriver{format}{fmt}\lst@UseFormat} |
902 |
|
|
\lstdefineformat{}{} |
903 |
|
|
\lst@Key{format}\relax{% |
904 |
|
|
\lst@LAS{format}{fmt}{[]{#1}}\lst@NoAlias\lstformatfiles |
905 |
|
|
\lsthk@SetFormat |
906 |
|
|
{}} |
907 |
|
|
\lst@AddToHook{SetFormat}{\let\lst@fmtformat\@empty}% init |
908 |
|
|
\gdef\lst@fmtSplit#1#2{% |
909 |
|
|
\def\lst@temp##1#2##2\relax##3{% |
910 |
|
|
\ifnum##3=\z@ |
911 |
|
|
\ifx\@empty##2\@empty |
912 |
|
|
\lst@false |
913 |
|
|
\let\lst@fmta#1% |
914 |
|
|
\let\lst@fmtb\@empty |
915 |
|
|
\else |
916 |
|
|
\expandafter\lst@temp#1\relax\@ne |
917 |
|
|
\fi |
918 |
|
|
\else |
919 |
|
|
\def\lst@fmta{##1}\def\lst@fmtb{##2}% |
920 |
|
|
\fi}% |
921 |
|
|
\lst@true |
922 |
|
|
\expandafter\lst@temp#1#2\relax\z@} |
923 |
|
|
\gdef\lst@IfNextCharWhitespace#1#2#3{% |
924 |
|
|
\lst@IfSubstring#3\lst@whitespaces{#1}{#2}#3} |
925 |
|
|
\begingroup |
926 |
|
|
\catcode`\^^I=12\catcode`\^^J=12\catcode`\^^M=12\catcode`\^^L=12\relax% |
927 |
|
|
\lst@DefActive\lst@whitespaces{\ ^^I^^J^^M}% add ^^L |
928 |
|
|
\global\let\lst@whitespaces\lst@whitespaces% |
929 |
|
|
\endgroup |
930 |
|
|
\gdef\lst@fmtIfIdentifier#1{% |
931 |
|
|
\ifx\relax#1\@empty |
932 |
|
|
\expandafter\@secondoftwo |
933 |
|
|
\else |
934 |
|
|
\expandafter\lst@fmtIfIdentifier@\expandafter#1% |
935 |
|
|
\fi} |
936 |
|
|
\gdef\lst@fmtIfIdentifier@#1#2\relax{% |
937 |
|
|
\let\lst@next\@secondoftwo |
938 |
|
|
\ifnum`#1=`_\else |
939 |
|
|
\ifnum`#1<64\else |
940 |
|
|
\ifnum`#1<91\let\lst@next\@firstoftwo\else |
941 |
|
|
\ifnum`#1<97\else |
942 |
|
|
\ifnum`#1<123\let\lst@next\@firstoftwo\else |
943 |
|
|
\fi \fi \fi \fi \fi |
944 |
|
|
\lst@next} |
945 |
|
|
\gdef\lst@fmtIfNextCharIn#1{% |
946 |
|
|
\ifx\@empty#1\@empty \expandafter\@secondoftwo \else |
947 |
|
|
\def\lst@next{\lst@fmtIfNextCharIn@{#1}}% |
948 |
|
|
\expandafter\lst@next\fi} |
949 |
|
|
\gdef\lst@fmtIfNextCharIn@#1#2#3#4{% |
950 |
|
|
\def\lst@temp##1#4##2##3\relax{% |
951 |
|
|
\ifx \@empty##2\expandafter\@secondoftwo |
952 |
|
|
\else \expandafter\@firstoftwo \fi}% |
953 |
|
|
\lst@temp#1#4\@empty\relax{#2}{#3}#4} |
954 |
|
|
\gdef\lst@fmtCDef#1{\lst@fmtCDef@#1} |
955 |
|
|
\gdef\lst@fmtCDef@#1#2#3#4#5#6#7{% |
956 |
|
|
\lst@CDefIt#1{#2}{#3}% |
957 |
|
|
{\lst@fmtIfNextCharIn{#5}{#4#2#3}{#6#4#2#3#7}}% |
958 |
|
|
#4% |
959 |
|
|
{}{}{}} |
960 |
|
|
\gdef\lst@fmtCDefX#1{\lst@fmtCDefX@#1} |
961 |
|
|
\gdef\lst@fmtCDefX@#1#2#3#4#5#6#7{% |
962 |
|
|
\let#4#1% |
963 |
|
|
\ifx\@empty#2\@empty |
964 |
|
|
\def#1{\lst@fmtIfNextCharIn{#5}{#4}{#6#7}}% |
965 |
|
|
\else \ifx\@empty#3\@empty |
966 |
|
|
\def#1##1{% |
967 |
|
|
\ifx##1#2% |
968 |
|
|
\def\lst@next{\lst@fmtIfNextCharIn{#5}{#4##1}% |
969 |
|
|
{#6#7}}% |
970 |
|
|
\else |
971 |
|
|
\def\lst@next{#4##1}% |
972 |
|
|
\fi |
973 |
|
|
\lst@next}% |
974 |
|
|
\else |
975 |
|
|
\def#1{% |
976 |
|
|
\lst@IfNextCharsArg{#2#3}% |
977 |
|
|
{\lst@fmtIfNextCharIn{#5}{\expandafter#4\lst@eaten}% |
978 |
|
|
{#6#7}}% |
979 |
|
|
{\expandafter#4\lst@eaten}}% |
980 |
|
|
\fi \fi} |
981 |
|
|
\gdef\lst@UseFormat#1{% |
982 |
|
|
\def\lst@fmtwhole{#1}% |
983 |
|
|
\lst@UseFormat@} |
984 |
|
|
\gdef\lst@UseFormat@{% |
985 |
|
|
\lst@fmtSplit\lst@fmtwhole,% |
986 |
|
|
\let\lst@fmtwhole\lst@fmtb |
987 |
|
|
\ifx\lst@fmta\@empty\else |
988 |
|
|
\lst@fmtSplit\lst@fmta=% |
989 |
|
|
\ifx\@empty\lst@fmta\else |
990 |
|
|
\expandafter\lstKV@XOptArg\expandafter[\expandafter]% |
991 |
|
|
\expandafter{\lst@fmtb}\lst@UseFormat@b |
992 |
|
|
\fi |
993 |
|
|
\fi |
994 |
|
|
\ifx\lst@fmtwhole\@empty\else |
995 |
|
|
\expandafter\lst@UseFormat@ |
996 |
|
|
\fi} |
997 |
|
|
\gdef\lst@UseFormat@b[#1]#2{% |
998 |
|
|
\def\lst@fmtc{{#1}}\lst@lExtend\lst@fmtc{\expandafter{\lst@fmta}}% |
999 |
|
|
\def\lst@fmtb{#2}% |
1000 |
|
|
\lst@fmtSplit\lst@fmtb\string |
1001 |
|
|
\ifx\@empty\lst@fmta |
1002 |
|
|
\lst@lAddTo\lst@fmtc{{}}% |
1003 |
|
|
\else |
1004 |
|
|
\lst@lExtend\lst@fmtc{\expandafter |
1005 |
|
|
{\expandafter\lst@fmtPre\expandafter{\lst@fmta}}}% |
1006 |
|
|
\fi |
1007 |
|
|
\ifx\@empty\lst@fmtb |
1008 |
|
|
\lst@lAddTo\lst@fmtc{{}}% |
1009 |
|
|
\else |
1010 |
|
|
\lst@lExtend\lst@fmtc{\expandafter |
1011 |
|
|
{\expandafter\lst@fmtPost\expandafter{\lst@fmtb}}}% |
1012 |
|
|
\fi |
1013 |
|
|
\expandafter\lst@UseFormat@c\lst@fmtc} |
1014 |
|
|
\gdef\lst@UseFormat@c#1#2#3#4{% |
1015 |
|
|
\lst@fmtIfIdentifier#2\relax |
1016 |
|
|
{\lst@fmtIdentifier{#2}% |
1017 |
|
|
\lst@if\else \PackageWarning{Listings}% |
1018 |
|
|
{Cannot drop identifier in format definition}% |
1019 |
|
|
\fi}% |
1020 |
|
|
{\lst@if |
1021 |
|
|
\lst@lAddTo\lst@fmtformat{\lst@CArgX#2\relax\lst@fmtCDef}% |
1022 |
|
|
\else |
1023 |
|
|
\lst@lAddTo\lst@fmtformat{\lst@CArgX#2\relax\lst@fmtCDefX}% |
1024 |
|
|
\fi |
1025 |
|
|
\lst@DefActive\lst@fmtc{#1}% |
1026 |
|
|
\lst@lExtend\lst@fmtformat{\expandafter{\lst@fmtc}{#3}{#4}}}} |
1027 |
|
|
\lst@AddToHook{SelectCharTable}{\lst@fmtformat} |
1028 |
|
|
\global\let\lst@fmtformat\@empty |
1029 |
|
|
\gdef\lst@fmtPre#1{% |
1030 |
|
|
\lst@PrintToken |
1031 |
|
|
\begingroup |
1032 |
|
|
\let\newline\lst@fmtEnsureNewLine |
1033 |
|
|
\let\space\lst@fmtEnsureSpace |
1034 |
|
|
\let\indent\lst@fmtIndent |
1035 |
|
|
\let\noindent\lst@fmtNoindent |
1036 |
|
|
#1% |
1037 |
|
|
\endgroup} |
1038 |
|
|
\gdef\lst@fmtPost#1{% |
1039 |
|
|
\global\let\lst@fmtPostOutput\@empty |
1040 |
|
|
\begingroup |
1041 |
|
|
\def\newline{\lst@AddTo\lst@fmtPostOutput\lst@fmtEnsureNewLine}% |
1042 |
|
|
\def\space{\aftergroup\lst@fmtEnsurePostSpace}% |
1043 |
|
|
\def\indent{\lst@AddTo\lst@fmtPostOutput\lst@fmtIndent}% |
1044 |
|
|
\def\noindent{\lst@AddTo\lst@fmtPostOutput\lst@fmtNoindent}% |
1045 |
|
|
\aftergroup\lst@PrintToken |
1046 |
|
|
#1% |
1047 |
|
|
\endgroup} |
1048 |
|
|
\lst@AddToHook{Init}{\global\let\lst@fmtPostOutput\@empty} |
1049 |
|
|
\lst@AddToHook{PostOutput} |
1050 |
|
|
{\lst@fmtPostOutput \global\let\lst@fmtPostOutput\@empty} |
1051 |
|
|
\gdef\lst@fmtEnsureSpace{% |
1052 |
|
|
\lst@ifwhitespace\else \expandafter\lst@ProcessSpace \fi} |
1053 |
|
|
\gdef\lst@fmtEnsurePostSpace{% |
1054 |
|
|
\lst@IfNextCharWhitespace{}{\lst@ProcessSpace}} |
1055 |
|
|
\lst@Key{fmtindent}{20pt}{\def\lst@fmtindent{#1}} |
1056 |
|
|
\newdimen\lst@fmtcurrindent |
1057 |
|
|
\lst@AddToHook{InitVars}{\global\lst@fmtcurrindent\z@} |
1058 |
|
|
\gdef\lst@fmtIndent{\global\advance\lst@fmtcurrindent\lst@fmtindent} |
1059 |
|
|
\gdef\lst@fmtNoindent{\global\advance\lst@fmtcurrindent-\lst@fmtindent} |
1060 |
|
|
\gdef\lst@fmtEnsureNewLine{% |
1061 |
|
|
\global\advance\lst@newlines\@ne |
1062 |
|
|
\global\advance\lst@newlinesensured\@ne |
1063 |
|
|
\lst@fmtignoretrue} |
1064 |
|
|
\lst@AddToAtTop\lst@DoNewLines{% |
1065 |
|
|
\ifnum\lst@newlines>\lst@newlinesensured |
1066 |
|
|
\global\advance\lst@newlines-\lst@newlinesensured |
1067 |
|
|
\fi |
1068 |
|
|
\global\lst@newlinesensured\z@} |
1069 |
|
|
\newcount\lst@newlinesensured % global |
1070 |
|
|
\lst@AddToHook{Init}{\global\lst@newlinesensured\z@} |
1071 |
|
|
\gdef\lst@fmtignoretrue{\let\lst@fmtifignore\iftrue} |
1072 |
|
|
\gdef\lst@fmtignorefalse{\let\lst@fmtifignore\iffalse} |
1073 |
|
|
\lst@AddToHook{InitVars}{\lst@fmtignorefalse} |
1074 |
|
|
\lst@AddToHook{Output}{\lst@fmtignorefalse} |
1075 |
|
|
\gdef\lst@fmtUseLostSpace{% |
1076 |
|
|
\lst@ifnewline \kern\lst@fmtcurrindent \global\lst@lostspace\z@ |
1077 |
|
|
\else |
1078 |
|
|
\lst@OldOLS |
1079 |
|
|
\fi} |
1080 |
|
|
\lst@AddToHook{Init} |
1081 |
|
|
{\lst@true |
1082 |
|
|
\ifx\lst@fmtformat\@empty \ifx\lst@fmt\@empty \lst@false \fi\fi |
1083 |
|
|
\lst@if |
1084 |
|
|
\let\lst@OldOLS\lst@OutputLostSpace |
1085 |
|
|
\let\lst@OutputLostSpace\lst@fmtUseLostSpace |
1086 |
|
|
\let\lst@ProcessSpace\lst@fmtProcessSpace |
1087 |
|
|
\fi} |
1088 |
|
|
\gdef\lst@fmtProcessSpace{% |
1089 |
|
|
\lst@ifletter |
1090 |
|
|
\lst@Output |
1091 |
|
|
\lst@fmtifignore\else |
1092 |
|
|
\lst@AppendOther\lst@outputspace |
1093 |
|
|
\fi |
1094 |
|
|
\else \lst@ifkeepspaces |
1095 |
|
|
\lst@AppendOther\lst@outputspace |
1096 |
|
|
\else \ifnum\lst@newlines=\z@ |
1097 |
|
|
\lst@AppendSpecialSpace |
1098 |
|
|
\else \ifnum\lst@length=\z@ |
1099 |
|
|
\global\advance\lst@lostspace\lst@width |
1100 |
|
|
\global\advance\lst@pos\m@ne |
1101 |
|
|
\else |
1102 |
|
|
\lst@AppendSpecialSpace |
1103 |
|
|
\fi |
1104 |
|
|
\fi \fi \fi |
1105 |
|
|
\lst@whitespacetrue} |
1106 |
|
|
\lst@InstallTest{f} |
1107 |
|
|
\lst@fmt@list\lst@fmt \lst@gfmt@list\lst@gfmt |
1108 |
|
|
\lst@gfmt@wp |
1109 |
|
|
wd |
1110 |
|
|
\gdef\lst@fmt@list{\lst@fmt\lst@gfmt}\global\let\lst@fmt\@empty |
1111 |
|
|
\gdef\lst@gfmt@list{\lst@fmt\lst@gfmt}\global\let\lst@gfmt\@empty |
1112 |
|
|
\gdef\lst@gfmt@wp{% |
1113 |
|
|
\begingroup \let\lst@UM\@empty |
1114 |
|
|
\let\lst@PrintToken\@empty |
1115 |
|
|
\csname\lst@ @fmt$\the\lst@token\endcsname |
1116 |
|
|
\endgroup} |
1117 |
|
|
\gdef\lst@fmtIdentifier#1#2#3#4{% |
1118 |
|
|
\lst@DefOther\lst@fmta{#2}\edef\lst@fmt{\lst@fmt,\lst@fmta}% |
1119 |
|
|
\@namedef{\lst@ @fmt$\lst@fmta}{#3#4}} |
1120 |
|
|
\lst@EndAspect |
1121 |
|
|
\lst@BeginAspect{labels} |
1122 |
|
|
\lst@Key{numbers}{none}{% |
1123 |
|
|
\let\lst@PlaceNumber\@empty |
1124 |
|
|
\lstKV@SwitchCases{#1}% |
1125 |
|
|
{none&\\% |
1126 |
|
|
left&\def\lst@PlaceNumber{\llap{\normalfont |
1127 |
|
|
\lst@numberstyle{\thelstnumber}\kern\lst@numbersep}}\\% |
1128 |
|
|
right&\def\lst@PlaceNumber{\rlap{\normalfont |
1129 |
|
|
\kern\linewidth \kern\lst@numbersep |
1130 |
|
|
\lst@numberstyle{\thelstnumber}}}% |
1131 |
|
|
}{\PackageError{Listings}{Numbers #1 unknown}\@ehc}} |
1132 |
|
|
\lst@Key{numberstyle}{}{\def\lst@numberstyle{#1}} |
1133 |
|
|
\lst@Key{numbersep}{10pt}{\def\lst@numbersep{#1}} |
1134 |
|
|
\lst@Key{stepnumber}{1}{\def\lst@stepnumber{#1\relax}} |
1135 |
|
|
\lst@AddToHook{EmptyStyle}{\let\lst@stepnumber\@ne} |
1136 |
|
|
\lst@Key{numberblanklines}{true}[t] |
1137 |
|
|
{\lstKV@SetIf{#1}\lst@ifnumberblanklines} |
1138 |
|
|
\lst@Key{numberfirstline}{f}[t]{\lstKV@SetIf{#1}\lst@ifnumberfirstline} |
1139 |
|
|
\gdef\lst@numberfirstlinefalse{\let\lst@ifnumberfirstline\iffalse} |
1140 |
|
|
\lst@Key{firstnumber}{auto}{% |
1141 |
|
|
\lstKV@SwitchCases{#1}% |
1142 |
|
|
{auto&\let\lst@firstnumber\@undefined\\% |
1143 |
|
|
last&\let\lst@firstnumber\c@lstnumber |
1144 |
|
|
}{\def\lst@firstnumber{#1\relax}}} |
1145 |
|
|
\lst@AddToHook{PreSet}{\let\lst@advancenumber\z@} |
1146 |
|
|
\lst@AddToHook{PreInit} |
1147 |
|
|
{\ifx\lst@firstnumber\@undefined |
1148 |
|
|
\let\lst@firstnumber\lst@firstline |
1149 |
|
|
\fi} |
1150 |
|
|
\gdef\lst@SetFirstNumber{% |
1151 |
|
|
\ifx\lst@firstnumber\@undefined |
1152 |
|
|
\@tempcnta 0\csname\@lst no@\lst@intname\endcsname\relax |
1153 |
|
|
\ifnum\@tempcnta=\z@ \@tempcnta\lst@firstline |
1154 |
|
|
\else \lst@nololtrue \fi |
1155 |
|
|
\advance\@tempcnta\lst@advancenumber |
1156 |
|
|
\edef\lst@firstnumber{\the\@tempcnta\relax}% |
1157 |
|
|
\fi} |
1158 |
|
|
\gdef\lst@SaveFirstNumber{% |
1159 |
|
|
\expandafter\xdef |
1160 |
|
|
\csname\@lst no\ifx\lst@intname\@empty @ \else @\lst@intname\fi |
1161 |
|
|
\endcsname{\the\c@lstnumber}} |
1162 |
|
|
\newcounter{lstnumber}% \global |
1163 |
|
|
\global\c@lstnumber\@ne % init |
1164 |
|
|
\renewcommand*\thelstnumber{\@arabic\c@lstnumber} |
1165 |
|
|
\lst@AddToHook{EveryPar} |
1166 |
|
|
{\global\advance\c@lstnumber\lst@advancelstnum |
1167 |
|
|
\global\advance\c@lstnumber\m@ne \refstepcounter{lstnumber}% |
1168 |
|
|
\lst@SkipOrPrintLabel}% |
1169 |
|
|
\global\let\lst@advancelstnum\@ne |
1170 |
|
|
\lst@AddToHook{Init}{\def\@currentlabel{\thelstnumber}} |
1171 |
|
|
\lst@AddToHook{InitVars} |
1172 |
|
|
{\global\c@lstnumber\lst@firstnumber |
1173 |
|
|
\global\advance\c@lstnumber\lst@advancenumber |
1174 |
|
|
\global\advance\c@lstnumber-\lst@advancelstnum |
1175 |
|
|
\ifx \lst@firstnumber\c@lstnumber |
1176 |
|
|
\global\advance\c@lstnumber-\lst@advancelstnum |
1177 |
|
|
\fi} |
1178 |
|
|
\lst@AddToHook{ExitVars} |
1179 |
|
|
{\global\advance\c@lstnumber\lst@advancelstnum} |
1180 |
|
|
\AtBeginDocument{% |
1181 |
|
|
\def\theHlstnumber{\ifx\lst@@caption\@empty \lst@neglisting |
1182 |
|
|
\else \thelstlisting \fi |
1183 |
|
|
.\thelstnumber}} |
1184 |
|
|
\newcount\lst@skipnumbers % \global |
1185 |
|
|
\lst@AddToHook{Init} |
1186 |
|
|
{\ifnum \z@>\lst@stepnumber |
1187 |
|
|
\let\lst@advancelstnum\m@ne |
1188 |
|
|
\edef\lst@stepnumber{-\lst@stepnumber}% |
1189 |
|
|
\fi |
1190 |
|
|
\ifnum \z@<\lst@stepnumber |
1191 |
|
|
\global\lst@skipnumbers\lst@firstnumber |
1192 |
|
|
\global\divide\lst@skipnumbers\lst@stepnumber |
1193 |
|
|
\global\multiply\lst@skipnumbers-\lst@stepnumber |
1194 |
|
|
\global\advance\lst@skipnumbers\lst@firstnumber |
1195 |
|
|
\ifnum\lst@skipnumbers>\z@ |
1196 |
|
|
\global\advance\lst@skipnumbers -\lst@stepnumber |
1197 |
|
|
\fi |
1198 |
|
|
\else |
1199 |
|
|
\let\lst@SkipOrPrintLabel\relax |
1200 |
|
|
\fi} |
1201 |
|
|
\gdef\lst@SkipOrPrintLabel{% |
1202 |
|
|
\ifnum\lst@skipnumbers=\z@ |
1203 |
|
|
\global\advance\lst@skipnumbers-\lst@stepnumber\relax |
1204 |
|
|
\lst@PlaceNumber |
1205 |
|
|
\lst@numberfirstlinefalse |
1206 |
|
|
\else |
1207 |
|
|
\lst@ifnumberfirstline |
1208 |
|
|
\lst@PlaceNumber |
1209 |
|
|
\lst@numberfirstlinefalse |
1210 |
|
|
\fi |
1211 |
|
|
\fi |
1212 |
|
|
\global\advance\lst@skipnumbers\@ne}% |
1213 |
|
|
\lst@AddToHook{OnEmptyLine}{% |
1214 |
|
|
\lst@ifnumberblanklines\else \ifnum\lst@skipnumbers=\z@ |
1215 |
|
|
\global\advance\lst@skipnumbers-\lst@stepnumber\relax |
1216 |
|
|
\fi\fi} |
1217 |
|
|
\lst@EndAspect |
1218 |
|
|
\lst@BeginAspect{lineshape} |
1219 |
|
|
\lst@Key{xleftmargin}{\z@}{\def\lst@xleftmargin{#1}} |
1220 |
|
|
\lst@Key{xrightmargin}{\z@}{\def\lst@xrightmargin{#1}} |
1221 |
|
|
\lst@Key{resetmargins}{false}[t]{\lstKV@SetIf{#1}\lst@ifresetmargins} |
1222 |
|
|
\lst@AddToHook{BoxUnsafe}{\let\lst@xleftmargin\z@ |
1223 |
|
|
\let\lst@xrightmargin\z@} |
1224 |
|
|
\lst@AddToHook{TextStyle}{% |
1225 |
|
|
\let\lst@xleftmargin\z@ \let\lst@xrightmargin\z@ |
1226 |
|
|
\let\lst@ifresetmargins\iftrue} |
1227 |
|
|
\lst@Key{linewidth}\linewidth{\def\lst@linewidth{#1}} |
1228 |
|
|
\lst@AddToHook{PreInit}{\linewidth\lst@linewidth\relax} |
1229 |
|
|
\gdef\lst@parshape{% |
1230 |
|
|
\parshape\@ne \@totalleftmargin \linewidth} |
1231 |
|
|
\lst@AddToHook{Init} |
1232 |
|
|
{\lst@ifresetmargins |
1233 |
|
|
\advance\linewidth\@totalleftmargin |
1234 |
|
|
\advance\linewidth\rightmargin |
1235 |
|
|
\@totalleftmargin\z@ |
1236 |
|
|
\fi |
1237 |
|
|
\advance\linewidth-\lst@xleftmargin |
1238 |
|
|
\advance\linewidth-\lst@xrightmargin |
1239 |
|
|
\advance\@totalleftmargin\lst@xleftmargin\relax} |
1240 |
|
|
\lst@Key{lineskip}{\z@}{\def\lst@lineskip{#1\relax}} |
1241 |
|
|
\lst@AddToHook{Init} |
1242 |
|
|
{\parskip\z@ |
1243 |
|
|
\ifdim\z@=\lst@lineskip\else |
1244 |
|
|
\@tempdima\baselineskip |
1245 |
|
|
\advance\@tempdima\lst@lineskip |
1246 |
|
|
\multiply\@tempdima\@cclvi |
1247 |
|
|
\divide\@tempdima\baselineskip\relax |
1248 |
|
|
\multiply\@tempdima\@cclvi |
1249 |
|
|
\edef\baselinestretch{\strip@pt\@tempdima}% |
1250 |
|
|
\selectfont |
1251 |
|
|
\fi} |
1252 |
|
|
\lst@Key{breaklines}{false}[t]{\lstKV@SetIf{#1}\lst@ifbreaklines} |
1253 |
|
|
\lst@Key{breakindent}{20pt}{\def\lst@breakindent{#1}} |
1254 |
|
|
\lst@Key{breakautoindent}{t}[t]{\lstKV@SetIf{#1}\lst@ifbreakautoindent} |
1255 |
|
|
\lst@Key{prebreak}{}{\def\lst@prebreak{#1}} |
1256 |
|
|
\lst@Key{postbreak}{}{\def\lst@postbreak{#1}} |
1257 |
|
|
\lst@AddToHook{Init} |
1258 |
|
|
{\lst@ifbreaklines |
1259 |
|
|
\hbadness\@M \pretolerance\@M |
1260 |
|
|
\def\lst@parshape{\parshape\tw@ \@totalleftmargin\linewidth |
1261 |
|
|
\lst@breakshape}% |
1262 |
|
|
\else |
1263 |
|
|
\let\lst@discretionary\@empty |
1264 |
|
|
\fi} |
1265 |
|
|
\lst@AddToHook{OnNewLine} |
1266 |
|
|
{\lst@ifbreaklines \lst@breakNewLine \fi} |
1267 |
|
|
\gdef\lst@discretionary{% |
1268 |
|
|
\discretionary{\let\space\lst@spacekern\lst@prebreak}% |
1269 |
|
|
{\llap{\lsthk@EveryLine |
1270 |
|
|
\kern\lst@breakcurrindent \kern-\@totalleftmargin}% |
1271 |
|
|
\let\space\lst@spacekern\lst@postbreak}{}} |
1272 |
|
|
\lst@AddToHook{PostOutput}{\lst@discretionary} |
1273 |
|
|
\gdef\lst@spacekern{\kern\lst@width} |
1274 |
|
|
\gdef\lst@breakNewLine{% |
1275 |
|
|
\@tempdima\lst@breakindent\relax |
1276 |
|
|
\lst@ifbreakautoindent \advance\@tempdima\lst@lostspace \fi |
1277 |
|
|
\@tempdimc-\@tempdima \advance\@tempdimc\linewidth |
1278 |
|
|
\advance\@tempdima\@totalleftmargin |
1279 |
|
|
\xdef\lst@breakshape{\noexpand\lst@breakcurrindent \the\@tempdimc}% |
1280 |
|
|
\xdef\lst@breakcurrindent{\the\@tempdima}} |
1281 |
|
|
\global\let\lst@breakcurrindent\z@ % init |
1282 |
|
|
\gdef\lst@breakshape{\@totalleftmargin \linewidth} |
1283 |
|
|
\gdef\lst@breakProcessOther#1{\lst@ProcessOther#1\lst@OutputOther} |
1284 |
|
|
\lst@AddToHook{SelectCharTable} |
1285 |
|
|
{\lst@ifbreaklines \lst@Def{`)}{\lst@breakProcessOther)}\fi} |
1286 |
|
|
\lst@EndAspect |
1287 |
|
|
\lst@BeginAspect[lineshape]{frames} |
1288 |
|
|
\lst@Key{framexleftmargin}{\z@}{\def\lst@framexleftmargin{#1}} |
1289 |
|
|
\lst@Key{framexrightmargin}{\z@}{\def\lst@framexrightmargin{#1}} |
1290 |
|
|
\lst@Key{framextopmargin}{\z@}{\def\lst@framextopmargin{#1}} |
1291 |
|
|
\lst@Key{framexbottommargin}{\z@}{\def\lst@framexbottommargin{#1}} |
1292 |
|
|
\lst@Key{backgroundcolor}{}{\def\lst@bkgcolor{#1}} |
1293 |
|
|
\lst@Key{fillcolor}{}{\def\lst@fillcolor{#1}} |
1294 |
|
|
\lst@Key{rulecolor}{}{\def\lst@rulecolor{#1}} |
1295 |
|
|
\lst@Key{rulesepcolor}{}{\def\lst@rulesepcolor{#1}} |
1296 |
|
|
\lst@AddToHook{Init}{% |
1297 |
|
|
\ifx\lst@fillcolor\@empty |
1298 |
|
|
\let\lst@fillcolor\lst@bkgcolor |
1299 |
|
|
\fi |
1300 |
|
|
\ifx\lst@rulesepcolor\@empty |
1301 |
|
|
\let\lst@rulesepcolor\lst@fillcolor |
1302 |
|
|
\fi} |
1303 |
|
|
\lst@Key{rulesep}{2pt}{\def\lst@rulesep{#1}} |
1304 |
|
|
\lst@Key{framerule}{.4pt}{\def\lst@framerulewidth{#1}} |
1305 |
|
|
\lst@Key{framesep}{3pt}{\def\lst@frametextsep{#1}} |
1306 |
|
|
\lst@Key{frameshape}{}{% |
1307 |
|
|
\let\lst@xrulecolor\@empty |
1308 |
|
|
\lstKV@FourArg{#1}% |
1309 |
|
|
{\uppercase{\def\lst@frametshape{##1}}% |
1310 |
|
|
\uppercase{\def\lst@framelshape{##2}}% |
1311 |
|
|
\uppercase{\def\lst@framershape{##3}}% |
1312 |
|
|
\uppercase{\def\lst@framebshape{##4}}% |
1313 |
|
|
\let\lst@ifframeround\iffalse |
1314 |
|
|
\lst@IfSubstring R\lst@frametshape{\let\lst@ifframeround\iftrue}{}% |
1315 |
|
|
\lst@IfSubstring R\lst@framebshape{\let\lst@ifframeround\iftrue}{}% |
1316 |
|
|
\def\lst@frame{##1##2##3##4}}} |
1317 |
|
|
\lst@Key{frameround}\relax |
1318 |
|
|
{\uppercase{\def\lst@frameround{#1}}% |
1319 |
|
|
\expandafter\lstframe@\lst@frameround ffff\relax} |
1320 |
|
|
\global\let\lst@frameround\@empty |
1321 |
|
|
\lst@Key{frame}\relax{% |
1322 |
|
|
\let\lst@xrulecolor\@empty |
1323 |
|
|
\lstKV@SwitchCases{#1}% |
1324 |
|
|
{none&\let\lst@frame\@empty\\% |
1325 |
|
|
leftline&\def\lst@frame{l}\\% |
1326 |
|
|
topline&\def\lst@frame{t}\\% |
1327 |
|
|
bottomline&\def\lst@frame{b}\\% |
1328 |
|
|
lines&\def\lst@frame{tb}\\% |
1329 |
|
|
single&\def\lst@frame{trbl}\\% |
1330 |
|
|
shadowbox&\def\lst@frame{tRBl}% |
1331 |
|
|
\def\lst@xrulecolor{\lst@rulesepcolor}% |
1332 |
|
|
\def\lst@rulesep{\lst@frametextsep}% |
1333 |
|
|
}{\def\lst@frame{#1}}% |
1334 |
|
|
\expandafter\lstframe@\lst@frameround ffff\relax} |
1335 |
|
|
\gdef\lstframe@#1#2#3#4#5\relax{% |
1336 |
|
|
\lst@IfSubstring T\lst@frame{\edef\lst@frame{t\lst@frame}}{}% |
1337 |
|
|
\lst@IfSubstring R\lst@frame{\edef\lst@frame{r\lst@frame}}{}% |
1338 |
|
|
\lst@IfSubstring B\lst@frame{\edef\lst@frame{b\lst@frame}}{}% |
1339 |
|
|
\lst@IfSubstring L\lst@frame{\edef\lst@frame{l\lst@frame}}{}% |
1340 |
|
|
\let\lst@frametshape\@empty \let\lst@framebshape\@empty |
1341 |
|
|
\lst@frameCheck |
1342 |
|
|
ltr\lst@framelshape\lst@frametshape\lst@framershape #4#1% |
1343 |
|
|
\lst@frameCheck |
1344 |
|
|
LTR\lst@framelshape\lst@frametshape\lst@framershape #4#1% |
1345 |
|
|
\lst@frameCheck |
1346 |
|
|
lbr\lst@framelshape\lst@framebshape\lst@framershape #3#2% |
1347 |
|
|
\lst@frameCheck |
1348 |
|
|
LBR\lst@framelshape\lst@framebshape\lst@framershape #3#2% |
1349 |
|
|
\let\lst@ifframeround\iffalse |
1350 |
|
|
\lst@IfSubstring R\lst@frametshape{\let\lst@ifframeround\iftrue}{}% |
1351 |
|
|
\lst@IfSubstring R\lst@framebshape{\let\lst@ifframeround\iftrue}{}% |
1352 |
|
|
\let\lst@framelshape\@empty \let\lst@framershape\@empty |
1353 |
|
|
\lst@IfSubstring L\lst@frame |
1354 |
|
|
{\def\lst@framelshape{YY}}% |
1355 |
|
|
{\lst@IfSubstring l\lst@frame{\def\lst@framelshape{Y}}{}}% |
1356 |
|
|
\lst@IfSubstring R\lst@frame |
1357 |
|
|
{\def\lst@framershape{YY}}% |
1358 |
|
|
{\lst@IfSubstring r\lst@frame{\def\lst@framershape{Y}}{}}} |
1359 |
|
|
\gdef\lst@frameCheck#1#2#3#4#5#6#7#8{% |
1360 |
|
|
\lst@IfSubstring #1\lst@frame |
1361 |
|
|
{\if #7T\def#4{R}\else \def#4{Y}\fi}% |
1362 |
|
|
{\def#4{N}}% |
1363 |
|
|
\lst@IfSubstring #3\lst@frame |
1364 |
|
|
{\if #8T\def#6{R}\else \def#6{Y}\fi}% |
1365 |
|
|
{\def#6{N}}% |
1366 |
|
|
\lst@IfSubstring #2\lst@frame{\edef#5{#5#4Y#6}}{}} |
1367 |
|
|
\lst@AddToHook{TextStyle} |
1368 |
|
|
{\let\lst@frame\@empty |
1369 |
|
|
\let\lst@frametshape\@empty |
1370 |
|
|
\let\lst@framershape\@empty |
1371 |
|
|
\let\lst@framebshape\@empty |
1372 |
|
|
\let\lst@framelshape\@empty} |
1373 |
|
|
\gdef\lst@frameMakeBoxV#1#2#3{% |
1374 |
|
|
\setbox#1\hbox{% |
1375 |
|
|
\color@begingroup \lst@rulecolor |
1376 |
|
|
\llap{\setbox\z@\hbox{\vrule\@width\z@\@height#2\@depth#3% |
1377 |
|
|
\lst@frameL}% |
1378 |
|
|
\rlap{\lst@frameBlock\lst@rulesepcolor{\wd\z@}% |
1379 |
|
|
{\ht\z@}{\dp\z@}}% |
1380 |
|
|
\box\z@ |
1381 |
|
|
\ifx\lst@framelshape\@empty |
1382 |
|
|
\kern\lst@frametextsep\relax |
1383 |
|
|
\else |
1384 |
|
|
\lst@frameBlock\lst@fillcolor\lst@frametextsep{#2}{#3}% |
1385 |
|
|
\fi |
1386 |
|
|
\kern\lst@framexleftmargin}% |
1387 |
|
|
\rlap{\kern-\lst@framexleftmargin |
1388 |
|
|
\@tempdima\linewidth |
1389 |
|
|
\advance\@tempdima\lst@framexleftmargin |
1390 |
|
|
\advance\@tempdima\lst@framexrightmargin |
1391 |
|
|
\lst@frameBlock\lst@bkgcolor\@tempdima{#2}{#3}% |
1392 |
|
|
\ifx\lst@framershape\@empty |
1393 |
|
|
\kern\lst@frametextsep\relax |
1394 |
|
|
\else |
1395 |
|
|
\lst@frameBlock\lst@fillcolor\lst@frametextsep{#2}{#3}% |
1396 |
|
|
\fi |
1397 |
|
|
\setbox\z@\hbox{\vrule\@width\z@\@height#2\@depth#3% |
1398 |
|
|
\lst@frameR}% |
1399 |
|
|
\rlap{\lst@frameBlock\lst@rulesepcolor{\wd\z@}% |
1400 |
|
|
{\ht\z@}{\dp\z@}}% |
1401 |
|
|
\box\z@}% |
1402 |
|
|
\color@endgroup}} |
1403 |
|
|
\gdef\lst@frameBlock#1#2#3#4{% |
1404 |
|
|
\color@begingroup |
1405 |
|
|
#1% |
1406 |
|
|
\setbox\z@\hbox{\vrule\@height#3\@depth#4% |
1407 |
|
|
\ifx#1\@empty \@width\z@ \kern#2\relax |
1408 |
|
|
\else \@width#2\relax \fi}% |
1409 |
|
|
\box\z@ |
1410 |
|
|
\color@endgroup} |
1411 |
|
|
\gdef\lst@frameR{% |
1412 |
|
|
\expandafter\lst@frameR@\lst@framershape\relax |
1413 |
|
|
\kern-\lst@rulesep} |
1414 |
|
|
\gdef\lst@frameR@#1{% |
1415 |
|
|
\ifx\relax#1\@empty\else |
1416 |
|
|
\if #1Y\lst@framevrule \else \kern\lst@framerulewidth \fi |
1417 |
|
|
\kern\lst@rulesep |
1418 |
|
|
\expandafter\lst@frameR@b |
1419 |
|
|
\fi} |
1420 |
|
|
\gdef\lst@frameR@b#1{% |
1421 |
|
|
\ifx\relax#1\@empty |
1422 |
|
|
\else |
1423 |
|
|
\if #1Y\color@begingroup |
1424 |
|
|
\lst@xrulecolor |
1425 |
|
|
\lst@framevrule |
1426 |
|
|
\color@endgroup |
1427 |
|
|
\else |
1428 |
|
|
\kern\lst@framerulewidth |
1429 |
|
|
\fi |
1430 |
|
|
\kern\lst@rulesep |
1431 |
|
|
\expandafter\lst@frameR@ |
1432 |
|
|
\fi} |
1433 |
|
|
\gdef\lst@frameL{% |
1434 |
|
|
\kern-\lst@rulesep |
1435 |
|
|
\expandafter\lst@frameL@\lst@framelshape\relax} |
1436 |
|
|
\gdef\lst@frameL@#1{% |
1437 |
|
|
\ifx\relax#1\@empty\else |
1438 |
|
|
\kern\lst@rulesep |
1439 |
|
|
\if#1Y\lst@framevrule \else \kern\lst@framerulewidth \fi |
1440 |
|
|
\expandafter\lst@frameL@ |
1441 |
|
|
\fi} |
1442 |
|
|
\gdef\lst@frameH#1#2{% |
1443 |
|
|
\global\let\lst@framediml\z@ \global\let\lst@framedimr\z@ |
1444 |
|
|
\setbox\z@\hbox{}\@tempcntb\z@ |
1445 |
|
|
\expandafter\lst@frameH@\expandafter#1#2\relax\relax\relax |
1446 |
|
|
\@tempdimb\lst@frametextsep\relax |
1447 |
|
|
\advance\@tempdimb\lst@framerulewidth\relax |
1448 |
|
|
\@tempdimc-\@tempdimb |
1449 |
|
|
\advance\@tempdimc\ht\z@ |
1450 |
|
|
\advance\@tempdimc\dp\z@ |
1451 |
|
|
\setbox\z@=\hbox{% |
1452 |
|
|
\lst@frameHBkg\lst@fillcolor\@tempdimb\@firstoftwo |
1453 |
|
|
\if#1T\rlap{\raise\dp\@tempboxa\box\@tempboxa}% |
1454 |
|
|
\else\rlap{\lower\ht\@tempboxa\box\@tempboxa}\fi |
1455 |
|
|
\lst@frameHBkg\lst@rulesepcolor\@tempdimc\@secondoftwo |
1456 |
|
|
\advance\@tempdimb\ht\@tempboxa |
1457 |
|
|
\if#1T\rlap{\raise\lst@frametextsep\box\@tempboxa}% |
1458 |
|
|
\else\rlap{\lower\@tempdimb\box\@tempboxa}\fi |
1459 |
|
|
\rlap{\box\z@}% |
1460 |
|
|
}} |
1461 |
|
|
\gdef\lst@frameH@#1#2#3#4{% |
1462 |
|
|
\ifx\relax#4\@empty\else |
1463 |
|
|
\lst@frameh \@tempcntb#1#2#3#4% |
1464 |
|
|
\advance\@tempcntb\@ne |
1465 |
|
|
\expandafter\lst@frameH@\expandafter#1% |
1466 |
|
|
\fi} |
1467 |
|
|
\gdef\lst@frameHBkg#1#2#3{% |
1468 |
|
|
\setbox\@tempboxa\hbox{% |
1469 |
|
|
\kern-\lst@framexleftmargin |
1470 |
|
|
#3{\kern-\lst@framediml\relax}{\@tempdima\z@}% |
1471 |
|
|
\ifdim\lst@framediml>\@tempdimb |
1472 |
|
|
#3{\@tempdima\lst@framediml \advance\@tempdima-\@tempdimb |
1473 |
|
|
\lst@frameBlock\lst@rulesepcolor\@tempdima\@tempdimb\z@}% |
1474 |
|
|
{\kern-\lst@framediml |
1475 |
|
|
\advance\@tempdima\lst@framediml\relax}% |
1476 |
|
|
\fi |
1477 |
|
|
#3{\@tempdima\z@ |
1478 |
|
|
\ifx\lst@framelshape\@empty\else |
1479 |
|
|
\advance\@tempdima\@tempdimb |
1480 |
|
|
\fi |
1481 |
|
|
\ifx\lst@framershape\@empty\else |
1482 |
|
|
\advance\@tempdima\@tempdimb |
1483 |
|
|
\fi}% |
1484 |
|
|
{\ifdim\lst@framedimr>\@tempdimb |
1485 |
|
|
\advance\@tempdima\lst@framedimr\relax |
1486 |
|
|
\fi}% |
1487 |
|
|
\advance\@tempdima\linewidth |
1488 |
|
|
\advance\@tempdima\lst@framexleftmargin |
1489 |
|
|
\advance\@tempdima\lst@framexrightmargin |
1490 |
|
|
\lst@frameBlock#1\@tempdima#2\z@ |
1491 |
|
|
#3{\ifdim\lst@framedimr>\@tempdimb |
1492 |
|
|
\@tempdima-\@tempdimb |
1493 |
|
|
\advance\@tempdima\lst@framedimr\relax |
1494 |
|
|
\lst@frameBlock\lst@rulesepcolor\@tempdima\@tempdimb\z@ |
1495 |
|
|
\fi}{}% |
1496 |
|
|
}} |
1497 |
|
|
\gdef\lst@frameh#1#2#3#4#5{% |
1498 |
|
|
\lst@frameCalcDimA#1% |
1499 |
|
|
\lst@ifframeround \@getcirc\@tempdima \fi |
1500 |
|
|
\setbox\z@\hbox{% |
1501 |
|
|
\begingroup |
1502 |
|
|
\setbox\z@\hbox{% |
1503 |
|
|
\kern-\lst@framexleftmargin |
1504 |
|
|
\color@begingroup |
1505 |
|
|
\ifnum#1=\z@ \lst@rulecolor \else \lst@xrulecolor \fi |
1506 |
|
|
\lst@frameCornerX\llap{#2L}#3#1% |
1507 |
|
|
\ifdim\lst@framediml<\@tempdimb |
1508 |
|
|
\xdef\lst@framediml{\the\@tempdimb}% |
1509 |
|
|
\fi |
1510 |
|
|
\begingroup |
1511 |
|
|
\if#4Y\else \let\lst@framerulewidth\z@ \fi |
1512 |
|
|
\@tempdima\lst@framexleftmargin |
1513 |
|
|
\advance\@tempdima\lst@framexrightmargin |
1514 |
|
|
\advance\@tempdima\linewidth |
1515 |
|
|
\vrule\@width\@tempdima\@height\lst@framerulewidth \@depth\z@ |
1516 |
|
|
\endgroup |
1517 |
|
|
\lst@frameCornerX\rlap{#2R}#5#1% |
1518 |
|
|
\ifdim\lst@framedimr<\@tempdimb |
1519 |
|
|
\xdef\lst@framedimr{\the\@tempdimb}% |
1520 |
|
|
\fi |
1521 |
|
|
\color@endgroup}% |
1522 |
|
|
\if#2T\rlap{\raise\dp\z@\box\z@}% |
1523 |
|
|
\else\rlap{\lower\ht\z@\box\z@}\fi |
1524 |
|
|
\endgroup |
1525 |
|
|
\box\z@}} |
1526 |
|
|
\gdef\lst@frameCornerX#1#2#3#4{% |
1527 |
|
|
\setbox\@tempboxa\hbox{\csname\@lst @frame\if#3RR\fi #2\endcsname}% |
1528 |
|
|
\@tempdimb\wd\@tempboxa |
1529 |
|
|
\if #3R% |
1530 |
|
|
#1{\box\@tempboxa}% |
1531 |
|
|
\else |
1532 |
|
|
\if #3Y\expandafter#1\else |
1533 |
|
|
\@tempdimb\z@ \expandafter\vphantom \fi |
1534 |
|
|
{\box\@tempboxa}% |
1535 |
|
|
\fi} |
1536 |
|
|
\gdef\lst@frameCalcDimA#1{% |
1537 |
|
|
\@tempdima\lst@rulesep |
1538 |
|
|
\advance\@tempdima\lst@framerulewidth |
1539 |
|
|
\multiply\@tempdima#1\relax |
1540 |
|
|
\advance\@tempdima\lst@frametextsep |
1541 |
|
|
\advance\@tempdima\lst@framerulewidth |
1542 |
|
|
\multiply\@tempdima\tw@} |
1543 |
|
|
\lst@AddToHook{Init}{\lst@frameInit} |
1544 |
|
|
\newbox\lst@framebox |
1545 |
|
|
\gdef\lst@frameInit{% |
1546 |
|
|
\ifx\lst@framelshape\@empty \let\lst@frameL\@empty \fi |
1547 |
|
|
\ifx\lst@framershape\@empty \let\lst@frameR\@empty \fi |
1548 |
|
|
\def\lst@framevrule{\vrule\@width\lst@framerulewidth\relax}% |
1549 |
|
|
\lst@ifframeround |
1550 |
|
|
\lst@frameCalcDimA\z@ \@getcirc\@tempdima |
1551 |
|
|
\@tempdimb\@tempdima \divide\@tempdimb\tw@ |
1552 |
|
|
\advance\@tempdimb -\@wholewidth |
1553 |
|
|
\edef\lst@frametextsep{\the\@tempdimb}% |
1554 |
|
|
\edef\lst@framerulewidth{\the\@wholewidth}% |
1555 |
|
|
\lst@frameCalcDimA\@ne \@getcirc\@tempdima |
1556 |
|
|
\@tempdimb\@tempdima \divide\@tempdimb\tw@ |
1557 |
|
|
\advance\@tempdimb -\tw@\@wholewidth |
1558 |
|
|
\advance\@tempdimb -\lst@frametextsep |
1559 |
|
|
\edef\lst@rulesep{\the\@tempdimb}% |
1560 |
|
|
\fi |
1561 |
|
|
\lst@frameMakeBoxV\lst@framebox{\ht\strutbox}{\dp\strutbox}% |
1562 |
|
|
\def\lst@framelr{\copy\lst@framebox}% |
1563 |
|
|
\ifx\lst@frametshape\@empty\else |
1564 |
|
|
\lst@frameH T\lst@frametshape |
1565 |
|
|
\ifvoid\z@\else |
1566 |
|
|
\par\lst@parshape |
1567 |
|
|
\@tempdima-\baselineskip \advance\@tempdima\ht\z@ |
1568 |
|
|
\ifdim\prevdepth<\@cclvi\p@\else |
1569 |
|
|
\advance\@tempdima\prevdepth |
1570 |
|
|
\fi |
1571 |
|
|
\ifdim\@tempdima<\z@ |
1572 |
|
|
\vskip\@tempdima\vskip\lineskip |
1573 |
|
|
\fi |
1574 |
|
|
\noindent\box\z@\par |
1575 |
|
|
\lineskiplimit\maxdimen \lineskip\z@ |
1576 |
|
|
\fi |
1577 |
|
|
\lst@frameSpreadV\lst@framextopmargin |
1578 |
|
|
\fi} |
1579 |
|
|
\lst@AddToHook{EveryLine}{\lst@framelr} |
1580 |
|
|
\global\let\lst@framelr\@empty |
1581 |
|
|
\lst@AddToHook{DeInit} |
1582 |
|
|
{\ifx\lst@framebshape\@empty\else \lst@frameExit \fi} |
1583 |
|
|
\gdef\lst@frameExit{% |
1584 |
|
|
\lst@frameSpreadV\lst@framexbottommargin |
1585 |
|
|
\lst@frameH B\lst@framebshape |
1586 |
|
|
\ifvoid\z@\else |
1587 |
|
|
\everypar{}\par\lst@parshape\nointerlineskip\noindent\box\z@ |
1588 |
|
|
\fi} |
1589 |
|
|
\gdef\lst@frameSpreadV#1{% |
1590 |
|
|
\ifdim\z@=#1\else |
1591 |
|
|
\everypar{}\par\lst@parshape\nointerlineskip\noindent |
1592 |
|
|
\lst@frameMakeBoxV\z@{#1}{\z@}% |
1593 |
|
|
\box\z@ |
1594 |
|
|
\fi} |
1595 |
|
|
\gdef\lst@frameTR{% |
1596 |
|
|
\vrule\@width.5\@tempdima\@height\lst@framerulewidth\@depth\z@ |
1597 |
|
|
\kern-\lst@framerulewidth |
1598 |
|
|
\raise\lst@framerulewidth\hbox{% |
1599 |
|
|
\vrule\@width\lst@framerulewidth\@height\z@\@depth.5\@tempdima}} |
1600 |
|
|
\gdef\lst@frameBR{% |
1601 |
|
|
\vrule\@width.5\@tempdima\@height\lst@framerulewidth\@depth\z@ |
1602 |
|
|
\kern-\lst@framerulewidth |
1603 |
|
|
\vrule\@width\lst@framerulewidth\@height.5\@tempdima\@depth\z@} |
1604 |
|
|
\gdef\lst@frameBL{% |
1605 |
|
|
\vrule\@width\lst@framerulewidth\@height.5\@tempdima\@depth\z@ |
1606 |
|
|
\kern-\lst@framerulewidth |
1607 |
|
|
\vrule\@width.5\@tempdima\@height\lst@framerulewidth\@depth\z@} |
1608 |
|
|
\gdef\lst@frameTL{% |
1609 |
|
|
\raise\lst@framerulewidth\hbox{% |
1610 |
|
|
\vrule\@width\lst@framerulewidth\@height\z@\@depth.5\@tempdima}% |
1611 |
|
|
\kern-\lst@framerulewidth |
1612 |
|
|
\vrule\@width.5\@tempdima\@height\lst@framerulewidth\@depth\z@} |
1613 |
|
|
\gdef\lst@frameRoundT{% |
1614 |
|
|
\setbox\@tempboxa\hbox{\@circlefnt\char\@tempcnta}% |
1615 |
|
|
\ht\@tempboxa\lst@framerulewidth |
1616 |
|
|
\box\@tempboxa} |
1617 |
|
|
\gdef\lst@frameRoundB{% |
1618 |
|
|
\setbox\@tempboxa\hbox{\@circlefnt\char\@tempcnta}% |
1619 |
|
|
\dp\@tempboxa\z@ |
1620 |
|
|
\box\@tempboxa} |
1621 |
|
|
\gdef\lst@frameRTR{% |
1622 |
|
|
\hb@xt@.5\@tempdima{\kern-\lst@framerulewidth |
1623 |
|
|
\kern.5\@tempdima \lst@frameRoundT \hss}} |
1624 |
|
|
\gdef\lst@frameRBR{% |
1625 |
|
|
\hb@xt@.5\@tempdima{\kern-\lst@framerulewidth |
1626 |
|
|
\advance\@tempcnta\@ne \kern.5\@tempdima \lst@frameRoundB \hss}} |
1627 |
|
|
\gdef\lst@frameRBL{% |
1628 |
|
|
\advance\@tempcnta\tw@ \lst@frameRoundB |
1629 |
|
|
\kern-.5\@tempdima} |
1630 |
|
|
\gdef\lst@frameRTL{% |
1631 |
|
|
\advance\@tempcnta\thr@@\lst@frameRoundT |
1632 |
|
|
\kern-.5\@tempdima} |
1633 |
|
|
\lst@EndAspect |
1634 |
|
|
\lst@BeginAspect[keywords]{make} |
1635 |
|
|
\lst@NewMode\lst@makemode |
1636 |
|
|
\lst@AddToHook{Output}{% |
1637 |
|
|
\ifnum\lst@mode=\lst@makemode |
1638 |
|
|
\ifx\lst@thestyle\lst@gkeywords@sty |
1639 |
|
|
\lst@makekeytrue |
1640 |
|
|
\fi |
1641 |
|
|
\fi} |
1642 |
|
|
\gdef\lst@makekeytrue{\let\lst@ifmakekey\iftrue} |
1643 |
|
|
\gdef\lst@makekeyfalse{\let\lst@ifmakekey\iffalse} |
1644 |
|
|
\global\lst@makekeyfalse % init |
1645 |
|
|
\lst@Key{makemacrouse}f[t]{\lstKV@SetIf{#1}\lst@ifmakemacrouse} |
1646 |
|
|
\gdef\lst@MakeSCT{% |
1647 |
|
|
\lst@ifmakemacrouse |
1648 |
|
|
\lst@ReplaceInput{$(}{% |
1649 |
|
|
\lst@PrintToken |
1650 |
|
|
\lst@EnterMode\lst@makemode{\lst@makekeyfalse}% |
1651 |
|
|
\lst@Merge{\lst@ProcessOther\$\lst@ProcessOther(}}% |
1652 |
|
|
\lst@ReplaceInput{)}{% |
1653 |
|
|
\ifnum\lst@mode=\lst@makemode |
1654 |
|
|
\lst@PrintToken |
1655 |
|
|
\begingroup |
1656 |
|
|
\lst@ProcessOther)% |
1657 |
|
|
\lst@ifmakekey |
1658 |
|
|
\let\lst@currstyle\lst@gkeywords@sty |
1659 |
|
|
\fi |
1660 |
|
|
\lst@OutputOther |
1661 |
|
|
\endgroup |
1662 |
|
|
\lst@LeaveMode |
1663 |
|
|
\else |
1664 |
|
|
\expandafter\lst@ProcessOther\expandafter)% |
1665 |
|
|
\fi}% |
1666 |
|
|
\else |
1667 |
|
|
\lst@ReplaceInput{$(}{\lst@ProcessOther\$\lst@ProcessOther(}% |
1668 |
|
|
\fi} |
1669 |
|
|
\lst@EndAspect |
1670 |
|
|
\lst@BeginAspect{0.21} |
1671 |
|
|
\lst@Key{labelstyle}{}{\def\lst@numberstyle{#1}} |
1672 |
|
|
\lst@Key{labelsep}{10pt}{\def\lst@numbersep{#1}} |
1673 |
|
|
\lst@Key{labelstep}{0}{% |
1674 |
|
|
\ifnum #1=\z@ \KV@lst@numbers{none}% |
1675 |
|
|
\else \KV@lst@numbers{left}\fi |
1676 |
|
|
\def\lst@stepnumber{#1\relax}} |
1677 |
|
|
\lst@Key{firstlabel}\relax{\def\lst@firstnumber{#1\relax}} |
1678 |
|
|
\lst@Key{advancelabel}\relax{\def\lst@advancenumber{#1\relax}} |
1679 |
|
|
\let\c@lstlabel\c@lstnumber |
1680 |
|
|
\lst@AddToHook{Init}{\def\thelstnumber{\thelstlabel}} |
1681 |
|
|
\newcommand*\thelstlabel{\@arabic\c@lstlabel} |
1682 |
|
|
\lst@Key{first}\relax{\def\lst@firstline{#1\relax}} |
1683 |
|
|
\lst@Key{last}\relax{\def\lst@lastline{#1\relax}} |
1684 |
|
|
\lst@Key{framerulewidth}{.4pt}{\def\lst@framerulewidth{#1}} |
1685 |
|
|
\lst@Key{framerulesep}{2pt}{\def\lst@rulesep{#1}} |
1686 |
|
|
\lst@Key{frametextsep}{3pt}{\def\lst@frametextsep{#1}} |
1687 |
|
|
\lst@Key{framerulecolor}{}{\lstKV@OptArg[]{#1}% |
1688 |
|
|
{\ifx\@empty##2\@empty |
1689 |
|
|
\let\lst@rulecolor\@empty |
1690 |
|
|
\else |
1691 |
|
|
\ifx\@empty##1\@empty |
1692 |
|
|
\def\lst@rulecolor{\color{##2}}% |
1693 |
|
|
\else |
1694 |
|
|
\def\lst@rulecolor{\color[##1]{##2}}% |
1695 |
|
|
\fi |
1696 |
|
|
\fi}} |
1697 |
|
|
\lst@Key{backgroundcolor}{}{\lstKV@OptArg[]{#1}% |
1698 |
|
|
{\ifx\@empty##2\@empty |
1699 |
|
|
\let\lst@bkgcolor\@empty |
1700 |
|
|
\else |
1701 |
|
|
\ifx\@empty##1\@empty |
1702 |
|
|
\def\lst@bkgcolor{\color{##2}}% |
1703 |
|
|
\else |
1704 |
|
|
\def\lst@bkgcolor{\color[##1]{##2}}% |
1705 |
|
|
\fi |
1706 |
|
|
\fi}} |
1707 |
|
|
\lst@Key{framespread}{\z@}{\def\lst@framespread{#1}} |
1708 |
|
|
\lst@AddToHook{PreInit} |
1709 |
|
|
{\@tempdima\lst@framespread\relax \divide\@tempdima\tw@ |
1710 |
|
|
\edef\lst@framextopmargin{\the\@tempdima}% |
1711 |
|
|
\let\lst@framexrightmargin\lst@framextopmargin |
1712 |
|
|
\let\lst@framexbottommargin\lst@framextopmargin |
1713 |
|
|
\advance\@tempdima\lst@xleftmargin\relax |
1714 |
|
|
\edef\lst@framexleftmargin{\the\@tempdima}} |
1715 |
|
|
\newdimen\lst@innerspread \newdimen\lst@outerspread |
1716 |
|
|
\lst@Key{spread}{\z@,\z@}{\lstKV@CSTwoArg{#1}% |
1717 |
|
|
{\lst@innerspread##1\relax |
1718 |
|
|
\ifx\@empty##2\@empty |
1719 |
|
|
\divide\lst@innerspread\tw@\relax |
1720 |
|
|
\lst@outerspread\lst@innerspread |
1721 |
|
|
\else |
1722 |
|
|
\lst@outerspread##2\relax |
1723 |
|
|
\fi}} |
1724 |
|
|
\lst@AddToHook{BoxUnsafe}{\lst@outerspread\z@ \lst@innerspread\z@} |
1725 |
|
|
\lst@Key{wholeline}{false}[t]{\lstKV@SetIf{#1}\lst@ifresetmargins} |
1726 |
|
|
\lst@Key{indent}{\z@}{\def\lst@xleftmargin{#1}} |
1727 |
|
|
\lst@AddToHook{PreInit} |
1728 |
|
|
{\lst@innerspread=-\lst@innerspread |
1729 |
|
|
\lst@outerspread=-\lst@outerspread |
1730 |
|
|
\ifodd\c@page \advance\lst@innerspread\lst@xleftmargin |
1731 |
|
|
\else \advance\lst@outerspread\lst@xleftmargin \fi |
1732 |
|
|
\ifodd\c@page |
1733 |
|
|
\edef\lst@xleftmargin{\the\lst@innerspread}% |
1734 |
|
|
\edef\lst@xrightmargin{\the\lst@outerspread}% |
1735 |
|
|
\else |
1736 |
|
|
\edef\lst@xleftmargin{\the\lst@outerspread}% |
1737 |
|
|
\edef\lst@xrightmargin{\the\lst@innerspread}% |
1738 |
|
|
\fi} |
1739 |
|
|
\lst@Key{defaultclass}\relax{\def\lst@classoffset{#1}} |
1740 |
|
|
\lst@Key{stringtest}\relax{}% dummy |
1741 |
|
|
\lst@Key{outputpos}\relax{\lst@outputpos#1\relax\relax} |
1742 |
|
|
\lst@Key{stringspaces}\relax[t]{\lstKV@SetIf{#1}\lst@ifshowstringspaces} |
1743 |
|
|
\lst@Key{visisblespaces}\relax[t]{\lstKV@SetIf{#1}\lst@ifshowspaces} |
1744 |
|
|
\lst@Key{visibletabs}\relax[t]{\lstKV@SetIf{#1}\lst@ifshowtabs} |
1745 |
|
|
\lst@EndAspect |
1746 |
|
|
\lst@BeginAspect{fancyvrb} |
1747 |
|
|
\@ifundefined{FancyVerbFormatLine} |
1748 |
|
|
{\typeout{^^J% |
1749 |
|
|
***^^J% |
1750 |
|
|
*** `listings.sty' needs `fancyvrb.sty' right now.^^J% |
1751 |
|
|
*** Please ensure its availability and try again.^^J% |
1752 |
|
|
***^^J}% |
1753 |
|
|
\batchmode \@@end}{} |
1754 |
|
|
\gdef\lstFV@fancyvrb{% |
1755 |
|
|
\lst@iffancyvrb |
1756 |
|
|
\ifx\FancyVerbFormatLine\lstFV@FancyVerbFormatLine\else |
1757 |
|
|
\let\lstFV@FVFL\FancyVerbFormatLine |
1758 |
|
|
\let\FancyVerbFormatLine\lstFV@FancyVerbFormatLine |
1759 |
|
|
\fi |
1760 |
|
|
\else |
1761 |
|
|
\ifx\lstFV@FVFL\@undefined\else |
1762 |
|
|
\let\FancyVerbFormatLine\lstFV@FVFL |
1763 |
|
|
\let\lstFV@FVFL\@undefined |
1764 |
|
|
\fi |
1765 |
|
|
\fi} |
1766 |
|
|
\gdef\lstFV@VerbatimBegin{% |
1767 |
|
|
\ifx\FancyVerbFormatLine\lstFV@FancyVerbFormatLine |
1768 |
|
|
\lsthk@TextStyle \lsthk@BoxUnsafe |
1769 |
|
|
\lsthk@PreSet |
1770 |
|
|
\lst@activecharsfalse |
1771 |
|
|
\let\normalbaselines\relax |
1772 |
|
|
\lst@Init\relax |
1773 |
|
|
\lst@ifresetmargins \advance\linewidth-\@totalleftmargin \fi |
1774 |
|
|
\everypar{}\global\lst@newlines\z@ |
1775 |
|
|
\lst@mode\lst@nomode \let\lst@entermodes\@empty |
1776 |
|
|
\lst@InterruptModes |
1777 |
|
|
%% D.G. modification begin - Nov. 25, 1998 |
1778 |
|
|
\let\@noligs\relax |
1779 |
|
|
%% D.G. modification end |
1780 |
|
|
\fi} |
1781 |
|
|
\gdef\lstFV@VerbatimEnd{% |
1782 |
|
|
\ifx\FancyVerbFormatLine\lstFV@FancyVerbFormatLine |
1783 |
|
|
\global\setbox\lstFV@gtempboxa\box\@tempboxa |
1784 |
|
|
\global\let\@gtempa\FV@ProcessLine |
1785 |
|
|
\lst@mode\lst@Pmode |
1786 |
|
|
\lst@DeInit |
1787 |
|
|
\let\FV@ProcessLine\@gtempa |
1788 |
|
|
\setbox\@tempboxa\box\lstFV@gtempboxa |
1789 |
|
|
\par |
1790 |
|
|
\fi} |
1791 |
|
|
\newbox\lstFV@gtempboxa |
1792 |
|
|
\lst@AddTo\FV@VerbatimBegin\lstFV@VerbatimBegin |
1793 |
|
|
\lst@AddToAtTop\FV@VerbatimEnd\lstFV@VerbatimEnd |
1794 |
|
|
\lst@AddTo\FV@LVerbatimBegin\lstFV@VerbatimBegin |
1795 |
|
|
\lst@AddToAtTop\FV@LVerbatimEnd\lstFV@VerbatimEnd |
1796 |
|
|
\lst@AddTo\FV@BVerbatimBegin\lstFV@VerbatimBegin |
1797 |
|
|
\lst@AddToAtTop\FV@BVerbatimEnd\lstFV@VerbatimEnd |
1798 |
|
|
\gdef\lstFV@FancyVerbFormatLine#1{% |
1799 |
|
|
\let\lst@arg\@empty \lst@FVConvert#1\@nil |
1800 |
|
|
\global\lst@newlines\z@ |
1801 |
|
|
\vtop{\leavevmode\lst@parshape |
1802 |
|
|
\lst@ReenterModes |
1803 |
|
|
\lst@arg \lst@PrintToken\lst@EOLUpdate\lsthk@InitVarsBOL |
1804 |
|
|
\lst@InterruptModes}} |
1805 |
|
|
\lst@Key{fvcmdparams}% |
1806 |
|
|
{\overlay\@ne}% |
1807 |
|
|
{\def\lst@FVcmdparams{,#1}} |
1808 |
|
|
\lst@Key{morefvcmdparams}\relax{\lst@lAddTo\lst@FVcmdparams{,#1}} |
1809 |
|
|
\gdef\lst@FVConvert{\@tempcnta\z@ \lst@FVConvertO@}% |
1810 |
|
|
\gdef\lst@FVConvertO@{% |
1811 |
|
|
\ifcase\@tempcnta |
1812 |
|
|
\expandafter\futurelet\expandafter\@let@token |
1813 |
|
|
\expandafter\lst@FVConvert@@ |
1814 |
|
|
\else |
1815 |
|
|
\expandafter\lst@FVConvertO@a |
1816 |
|
|
\fi} |
1817 |
|
|
\gdef\lst@FVConvertO@a#1{% |
1818 |
|
|
\lst@lAddTo\lst@arg{{#1}}\advance\@tempcnta\m@ne |
1819 |
|
|
\lst@FVConvertO@}% |
1820 |
|
|
\gdef\lst@FVConvert@@{% |
1821 |
|
|
\ifcat\noexpand\@let@token\bgroup \expandafter\lst@FVConvertArg |
1822 |
|
|
\else \expandafter\lst@FVConvert@ \fi} |
1823 |
|
|
\gdef\lst@FVConvertArg#1{% |
1824 |
|
|
{\let\lst@arg\@empty |
1825 |
|
|
\lst@FVConvert#1\@nil |
1826 |
|
|
\global\let\@gtempa\lst@arg}% |
1827 |
|
|
\lst@lExtend\lst@arg{\expandafter{\@gtempa\lst@PrintToken}}% |
1828 |
|
|
\lst@FVConvert} |
1829 |
|
|
\gdef\lst@FVConvert@#1{% |
1830 |
|
|
\ifx \@nil#1\else |
1831 |
|
|
\if\relax\noexpand#1% |
1832 |
|
|
\lst@lAddTo\lst@arg{\lst@OutputLostSpace\lst@PrintToken#1}% |
1833 |
|
|
\else |
1834 |
|
|
\lccode`\~=`#1\lowercase{\lst@lAddTo\lst@arg~}% |
1835 |
|
|
\fi |
1836 |
|
|
\expandafter\lst@FVConvert |
1837 |
|
|
\fi} |
1838 |
|
|
\gdef\lst@FVConvert@#1{% |
1839 |
|
|
\ifx \@nil#1\else |
1840 |
|
|
\if\relax\noexpand#1% |
1841 |
|
|
\lst@lAddTo\lst@arg{\lst@OutputLostSpace\lst@PrintToken#1}% |
1842 |
|
|
\def\lst@temp##1,#1##2,##3##4\relax{% |
1843 |
|
|
\ifx##3\@empty \else \@tempcnta##2\relax \fi}% |
1844 |
|
|
\expandafter\lst@temp\lst@FVcmdparams,#1\z@,\@empty\relax |
1845 |
|
|
\else |
1846 |
|
|
\lccode`\~=`#1\lowercase{\lst@lAddTo\lst@arg~}% |
1847 |
|
|
\fi |
1848 |
|
|
\expandafter\lst@FVConvertO@ |
1849 |
|
|
\fi} |
1850 |
|
|
\lst@EndAspect |
1851 |
|
|
\lst@BeginAspect[keywords,comments,strings,language]{lgrind} |
1852 |
|
|
\gdef\lst@LGGetNames#1:#2\relax{% |
1853 |
|
|
\lst@NormedDef\lstlang@{#1}\lst@ReplaceInArg\lstlang@{|,}% |
1854 |
|
|
\def\lst@arg{:#2}} |
1855 |
|
|
\gdef\lst@LGGetValue#1{% |
1856 |
|
|
\lst@false |
1857 |
|
|
\def\lst@temp##1:#1##2##3\relax{% |
1858 |
|
|
\ifx\@empty##2\else \lst@LGGetValue@{#1}\fi} |
1859 |
|
|
\expandafter\lst@temp\lst@arg:#1\@empty\relax} |
1860 |
|
|
\gdef\lst@LGGetValue@#1{% |
1861 |
|
|
\lst@true |
1862 |
|
|
\def\lst@temp##1:#1##2:##3\relax{% |
1863 |
|
|
\@ifnextchar=\lst@LGGetValue@@{\lst@LGGetValue@@=}##2\relax |
1864 |
|
|
\def\lst@arg{##1:##3}}% |
1865 |
|
|
\expandafter\lst@temp\lst@arg\relax} |
1866 |
|
|
\gdef\lst@LGGetValue@@=#1\relax{\def\lst@LGvalue{#1}} |
1867 |
|
|
\gdef\lst@LGGetComment#1#2{% |
1868 |
|
|
\let#2\@empty |
1869 |
|
|
\lst@LGGetValue{#1b}% |
1870 |
|
|
\lst@if |
1871 |
|
|
\let#2\lst@LGvalue |
1872 |
|
|
\lst@LGGetValue{#1e}% |
1873 |
|
|
\ifx\lst@LGvalue\lst@LGEOL |
1874 |
|
|
\edef\lstlang@{\lstlang@,commentline={#2}}% |
1875 |
|
|
\let#2\@empty |
1876 |
|
|
\else |
1877 |
|
|
\edef#2{{#2}{\lst@LGvalue}}% |
1878 |
|
|
\fi |
1879 |
|
|
\fi} |
1880 |
|
|
\gdef\lst@LGGetString#1#2{% |
1881 |
|
|
\lst@LGGetValue{#1b}% |
1882 |
|
|
\lst@if |
1883 |
|
|
\let#2\lst@LGvalue |
1884 |
|
|
\lst@LGGetValue{#1e}% |
1885 |
|
|
\ifx\lst@LGvalue\lst@LGEOL |
1886 |
|
|
\edef\lstlang@{\lstlang@,morestringizer=[l]{#2}}% |
1887 |
|
|
\else |
1888 |
|
|
\ifx #2\lst@LGvalue |
1889 |
|
|
\edef\lstlang@{\lstlang@,morestringizer=[d]{#2}}% |
1890 |
|
|
\else |
1891 |
|
|
\edef\lst@temp{\lst@LGe#2}% |
1892 |
|
|
\ifx \lst@temp\lst@LGvalue |
1893 |
|
|
\edef\lstlang@{\lstlang@,morestringizer=[b]{#2}}% |
1894 |
|
|
\else |
1895 |
|
|
\PackageWarning{Listings}% |
1896 |
|
|
{String #2...\lst@LGvalue\space not supported}% |
1897 |
|
|
\fi |
1898 |
|
|
\fi |
1899 |
|
|
\fi |
1900 |
|
|
\fi} |
1901 |
|
|
\gdef\lst@LGDefLang{% |
1902 |
|
|
\lst@LGReplace |
1903 |
|
|
\let\lstlang@\empty |
1904 |
|
|
\lst@LGGetValue{kw}% |
1905 |
|
|
\lst@if |
1906 |
|
|
\lst@ReplaceInArg\lst@LGvalue{{ },}% |
1907 |
|
|
\edef\lstlang@{\lstlang@,keywords={\lst@LGvalue}}% |
1908 |
|
|
\fi |
1909 |
|
|
\lst@LGGetValue{oc}% |
1910 |
|
|
\lst@if |
1911 |
|
|
\edef\lstlang@{\lstlang@,sensitive=f}% |
1912 |
|
|
\fi |
1913 |
|
|
\lst@LGGetValue{id}% |
1914 |
|
|
\lst@if |
1915 |
|
|
\edef\lstlang@{\lstlang@,alsoletter=\lst@LGvalue}% |
1916 |
|
|
\fi |
1917 |
|
|
\lst@LGGetComment a\lst@LGa |
1918 |
|
|
\lst@LGGetComment c\lst@LGc |
1919 |
|
|
\ifx\lst@LGa\@empty |
1920 |
|
|
\ifx\lst@LGc\@empty\else |
1921 |
|
|
\edef\lstlang@{\lstlang@,singlecomment=\lst@LGc}% |
1922 |
|
|
\fi |
1923 |
|
|
\else |
1924 |
|
|
\ifx\lst@LGc\@empty |
1925 |
|
|
\edef\lstlang@{\lstlang@,singlecomment=\lst@LGa}% |
1926 |
|
|
\else |
1927 |
|
|
\edef\lstlang@{\lstlang@,doublecomment=\lst@LGc\lst@LGa}% |
1928 |
|
|
\fi |
1929 |
|
|
\fi |
1930 |
|
|
\lst@LGGetString s\lst@LGa |
1931 |
|
|
\lst@LGGetString l\lst@LGa |
1932 |
|
|
\lst@LGGetValue{tc}% |
1933 |
|
|
\lst@if |
1934 |
|
|
\edef\lstlang@{\lstlang@,lgrindef=\lst@LGvalue}% |
1935 |
|
|
\fi |
1936 |
|
|
\expandafter\xdef\csname\@lst LGlang@\lst@language@\endcsname |
1937 |
|
|
{\noexpand\lstset{\lstlang@}}% |
1938 |
|
|
\lst@ReplaceInArg\lst@arg{{: :}:}\let\lst@LGvalue\@empty |
1939 |
|
|
\expandafter\lst@LGDroppedCaps\lst@arg\relax\relax |
1940 |
|
|
\ifx\lst@LGvalue\@empty\else |
1941 |
|
|
\PackageWarningNoLine{Listings}{Ignored capabilities for |
1942 |
|
|
\space `\lst@language@' are\MessageBreak\lst@LGvalue}% |
1943 |
|
|
\fi} |
1944 |
|
|
\gdef\lst@LGDroppedCaps#1:#2#3{% |
1945 |
|
|
\ifx#2\relax |
1946 |
|
|
\lst@RemoveCommas\lst@LGvalue |
1947 |
|
|
\else |
1948 |
|
|
\edef\lst@LGvalue{\lst@LGvalue,#2#3}% |
1949 |
|
|
\expandafter\lst@LGDroppedCaps |
1950 |
|
|
\fi} |
1951 |
|
|
\begingroup |
1952 |
|
|
\catcode`\/=0 |
1953 |
|
|
\lccode`\z=`\:\lccode`\y=`\^\lccode`\x=`\$\lccode`\v=`\| |
1954 |
|
|
\catcode`\\=12\relax |
1955 |
|
|
/lowercase{% |
1956 |
|
|
/gdef/lst@LGReplace{/lst@ReplaceInArg/lst@arg |
1957 |
|
|
{{\:}{z }{\^}{y}{\$}{x}{\|}{v}{ \ }{ }{:\ :}{:}{\ }{ }{\(}({\)})}} |
1958 |
|
|
/gdef/lst@LGe{\e} |
1959 |
|
|
} |
1960 |
|
|
/endgroup |
1961 |
|
|
\gdef\lst@LGRead#1\par{% |
1962 |
|
|
\lst@LGGetNames#1:\relax |
1963 |
|
|
\def\lst@temp{endoflanguagedefinitions}% |
1964 |
|
|
\ifx\lstlang@\lst@temp |
1965 |
|
|
\let\lst@next\endinput |
1966 |
|
|
\else |
1967 |
|
|
\expandafter\lst@IfOneOf\lst@language@\relax\lstlang@ |
1968 |
|
|
{\lst@LGDefLang \let\lst@next\endinput}% |
1969 |
|
|
{\let\lst@next\lst@LGRead}% |
1970 |
|
|
\fi |
1971 |
|
|
\lst@next} |
1972 |
|
|
\lst@Key{lgrindef}\relax{% |
1973 |
|
|
\lst@NormedDef\lst@language@{#1}% |
1974 |
|
|
\begingroup |
1975 |
|
|
\@ifundefined{lstLGlang@\lst@language@}% |
1976 |
|
|
{\everypar{\lst@LGRead}% |
1977 |
|
|
\catcode`\\=12\catcode`\{=12\catcode`\}=12\catcode`\%=12% |
1978 |
|
|
\catcode`\#=14\catcode`\$=12\catcode`\^=12\catcode`\_=12\relax |
1979 |
|
|
\input{\lstlgrindeffile}% |
1980 |
|
|
}{}% |
1981 |
|
|
\endgroup |
1982 |
|
|
\@ifundefined{lstLGlang@\lst@language@}% |
1983 |
|
|
{\PackageError{Listings}% |
1984 |
|
|
{LGrind language \lst@language@\space undefined}% |
1985 |
|
|
{The language is not loadable. \@ehc}}% |
1986 |
|
|
{\lsthk@SetLanguage |
1987 |
|
|
\csname\@lst LGlang@\lst@language@\endcsname}} |
1988 |
|
|
\@ifundefined{lstlgrindeffile} |
1989 |
|
|
{\lst@UserCommand\lstlgrindeffile{lgrindef.}}{} |
1990 |
|
|
\lst@EndAspect |
1991 |
|
|
\lst@BeginAspect[keywords]{hyper} |
1992 |
|
|
\lst@Key{hyperanchor}\hyper@@anchor{\let\lst@hyperanchor#1} |
1993 |
|
|
\lst@Key{hyperlink}\hyperlink{\let\lst@hyperlink#1} |
1994 |
|
|
\lst@InstallKeywords{h}{hyperref}{}\relax{} |
1995 |
|
|
{\begingroup |
1996 |
|
|
\let\lst@UM\@empty \xdef\@gtempa{\the\lst@token}% |
1997 |
|
|
\endgroup |
1998 |
|
|
\lst@GetFreeMacro{lstHR@\@gtempa}% |
1999 |
|
|
\global\expandafter\let\lst@freemacro\@empty |
2000 |
|
|
\@tempcntb\@tempcnta \advance\@tempcntb\m@ne |
2001 |
|
|
\edef\lst@alloverstyle##1{% |
2002 |
|
|
\let\noexpand\lst@alloverstyle\noexpand\@empty |
2003 |
|
|
\noexpand\smash{\raise\baselineskip\hbox |
2004 |
|
|
{\noexpand\lst@hyperanchor{lst.\@gtempa\the\@tempcnta}% |
2005 |
|
|
{\relax}}}% |
2006 |
|
|
\ifnum\@tempcnta=\z@ ##1\else |
2007 |
|
|
\noexpand\lst@hyperlink{lst.\@gtempa\the\@tempcntb}{##1}% |
2008 |
|
|
\fi}% |
2009 |
|
|
} |
2010 |
|
|
od |
2011 |
|
|
\lst@EndAspect |
2012 |
|
|
\endinput |
2013 |
|
|
%% |
2014 |
|
|
%% End of file `lstmisc.sty'. |