doc/sod.sty: Rename the default modifier to `plain'.
[sod] / doc / sod.sty
1 %%% -*-latex-*-
2 %%%
3 %%% Styles and other hacking for the Sod manual
4 %%%
5 %%% (c) 2015 Straylight/Edgeware
6 %%%
7
8 %%%----- Licensing notice ---------------------------------------------------
9 %%%
10 %%% This file is part of the Sensible Object Design, an object system for C.
11 %%%
12 %%% SOD is free software; you can redistribute it and/or modify
13 %%% it under the terms of the GNU General Public License as published by
14 %%% the Free Software Foundation; either version 2 of the License, or
15 %%% (at your option) any later version.
16 %%%
17 %%% SOD is distributed in the hope that it will be useful,
18 %%% but WITHOUT ANY WARRANTY; without even the implied warranty of
19 %%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 %%% GNU General Public License for more details.
21 %%%
22 %%% You should have received a copy of the GNU General Public License
23 %%% along with SOD; if not, write to the Free Software Foundation,
24 %%% Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
26 \ProvidesPackage{sod}
27
28 %%%--------------------------------------------------------------------------
29 %%% Basic style things.
30
31 %% More reference types.
32 \defxref{p}{part}
33
34 %% A gadget to include in `\xref': call as
35 %%
36 %% \xref[\instead{THING}]{LABEL}
37 %%
38 %% to replace the usual `section' or whatever with THING.
39 \def\instead#1#2{#1}
40
41 %% Other languages with special typesetting.
42 \def\Cplusplus{C\kern-\p@++}
43 \def\Csharp{C\#}
44
45 %% Special maths notation.
46 \def\chain#1#2{\mathsf{ch}_{#1}(#2)}
47 \def\chainhead#1#2{\mathsf{hd}_{#1}(#2)}
48 \def\chaintail#1#2{\mathsf{tl}_{#1}(#2)}
49
50 %% Other mathematical tweaks.
51 \let\implies\Rightarrow
52 \let\epsilon\varepsilon
53
54 %% A table heading cell. Clone and hack \multicolumn.
55 \def\thd{\omit\@ifnextchar[\thd@{\thd@[l]}}
56 \def\thd@[#1]#2{%
57 \begingroup
58 \tab@multicol \tab@initread \let\tab@looped\tab@err@multi
59 \tab@preamble{}\def\tab@midtext{\bfseries#2}\tab@readpreamble{#1}%
60 \the\tab@preamble
61 \endgroup \ignorespaces
62 }
63
64 %% Unix manpage references.
65 \def\man#1#2{\textbf{#1}(#2)}
66
67 %% Listings don't need to be small.
68 \let\listingsize\relax
69
70 %% Notes for later.
71 \def\fixme#1{\leavevmode\marginpar{FIXME}\index{FIXME}[FIXME: #1]}
72
73 %% Diagram settings.
74 \tikzset{
75 every picture/.style={>=stealth, thick},
76 lit/.style={font=\sffamily}
77 }
78
79 %% Metavariables are italics without decoration.
80 \def\syntleft{\normalfont\itshape}
81 \let\syntright\empty
82
83 %% Literal code is in sans face.
84 \def\codeface{\upshape\sffamily}
85 \DeclareRobustCommand\code[1]{%
86 \ifmmode\hbox\else\leavevmode\fi%
87 {\normalfont\codeface\/#1\/}%
88 }
89 \def\ulitleft{\normalfont\codeface}
90 \let\ulitright\empty
91 \def\lit@i#1#2#3{\ifmmode\leavevmode\hbox\fi{#1{#3\/}#2}}
92
93 %% Conditionally enter maths mode. Can't use \ensuremath here because we
94 %% aren't necessarily sure where the maths will actually end.
95 \let\m@maybe@end\relax
96 \def\m@maybe{\ifmmode\else$\let\m@maybe@end$\fi}
97
98 %% Standard syntax shortcuts.
99 \atdef <#1>{\synt{#1}\@scripts}
100 \atdef "#1"{\lit*{#1}\@scripts}
101 \atdef `#1'{\lit{#1}\@scripts}
102 \atdef |#1|{\lit*{#1}\@scripts}
103
104 %% A handy abbreviation; `\\' itself is too good to steal.
105 \atdef \\{\textbackslash}
106
107 %% Intercept grammar typesetting and replace the vertical bar with the
108 %% maths-font version.
109 \let\@@grammar\grammar
110 \def\grammar{\def\textbar{\hbox{$|$}}\@@grammar}
111
112 %% Collect super- and subscripts. (Note that underscores are active for the
113 %% most part.) When we're done, end maths mode if we entered it
114 %% conditionally.
115 \def\@scripts{\futurelet\@ch\@scripts@i}
116 \begingroup\lccode`\~=`\_\lowercase{\endgroup
117 \def\@scripts@i{\if1\ifx\@ch~1\else\ifx\@ch_1\else\ifx\@ch^1\else0\fi\fi\fi%
118 \expandafter\@scripts@ii\else\expandafter\m@maybe@end\fi}}
119 \def\@scripts@ii#1#2{\m@maybe#1{#2}\@scripts}
120
121 %% Doubling characters, maybe. Either way, chain onto \@scripts.
122 \def\dbl@maybe#1{\let\@tempa#1\futurelet\@ch\dbl@maybe@i}
123 \def\dbl@maybe@i{\m@maybe\ifx\@ch\@tempa\@tempa\!\@tempa%
124 \expandafter\@firstoftwo\expandafter\@scripts%
125 \else\@tempa\expandafter\@scripts\fi}
126
127 %% Lookahead without eating spaces.
128 \def\@ifnextchar@preserve#1#2#3{%
129 \let\want@= #1\def\@tempa{#2}\def\@tempb{#3}%
130 \futurelet\nch@\@ifnch@p%
131 }
132 \def\@ifnch@p{%
133 \ifx\want@\nch@\expandafter\@tempa\else\expandafter\@tempb\fi}
134
135 %% Extra syntax for Lisp templates. These produce the maths-font versions of
136 %% characters, which should contrast well against the sans face used for
137 %% literals.
138 \atdef [{\dbl@maybe[}
139 \atdef ]{\dbl@maybe]}
140 \atdef {{\m@maybe\{\@scripts}
141 \atdef }{\m@maybe\}\@scripts}
142 \atdef ({\m@maybe(\@scripts}
143 \atdef ){\m@maybe)\@scripts}
144 \atdef !{\m@maybe|\@scripts}
145
146 \def\returns{\m@maybe\longrightarrow\m@maybe@end\hspace{0.5em}\ignorespaces}
147 \def\nlret{\\\hspace{4em}\returns}
148 \atdef >{\leavevmode\unskip\hspace{0.5em}\returns}
149
150 %% Extra syntax for common tokens.
151 \atdef ~{\textasciitilde}
152 \atdef -{\leavevmode\hbox\bgroup\futurelet\ch@\@dash}
153 \def\@dash{%
154 \ifx\ch@>%
155 --\raisebox{.4pt}{>}%
156 \def\next@{\@firstoftwo{\egroup\penalty200\relax}}%
157 \else\ifx\ch@-%
158 --\,%
159 \def\next@{\@firstoftwo{\futurelet\ch@\@dash}}%
160 \else%
161 --%
162 \let\next@\egroup%
163 \fi\fi
164 \next@%
165 }
166
167 %% Comment setting.
168 \def\comment#1{\mbox{\normalfont\itshape\/#1\/}}
169 \atdef /*#1*/{/*\comment{#1}*/}
170 \def\@semis;{\@ifnextchar@preserve;{;\@semis}\@semicomment}
171 \def\@semicomment#1\\{\comment{#1}\\}
172 \atdef ;{;\@semis;}
173
174 %% Put a chunk of text in a box.
175 \newenvironment{boxy}[1][\q@]{%
176 \savenotes%
177 \dimen@\linewidth\advance\dimen@-1.2pt\advance\dimen@-2ex%
178 \medskip%
179 \vbox\bgroup\hrule\hbox\bgroup\vrule%
180 \vbox\bgroup\vskip1ex\hbox\bgroup\hskip1ex\minipage\dimen@%
181 \def\@temp{#1}\ifx\@temp\q@\else\leavevmode{\headfam\bfseries#1\quad}\fi%
182 }{%
183 \endminipage\hskip1ex\egroup\vskip1ex\egroup%
184 \vrule\egroup\hrule\egroup%
185 \medskip%
186 \spewnotes%
187 }
188
189 %%%--------------------------------------------------------------------------
190 %%% Environment for setting programs.
191
192 %% Main guts of `prog' and `nprog'.
193 \def\@prog{\let\prog@@cr\@tabcr\let\@tabcr\@progcr\codeface\tabbing}
194
195 %% Newlines: called by `\\' within a `prog'.
196 %%
197 %% \\ newline without following break
198 %% \\[SKIP] newline /with/ break and vertical glue
199 %% \\*[SKIP] newline without break, with optional glue
200 %% \\+ newline with break and a vertical gap
201 %% \\- newline without break, with a tiny gap
202 \def\@progcr{\futurelet\@tempa\@progcr@i}
203 \def\@progcr@i{%
204 \ifx\@tempa\@sptoken\let\next@\@progcr@sp\else
205 \if1\ifx\@tempa[1\else
206 \ifx\@tempa*1\else
207 0\fi\fi
208 \let\next@\prog@@cr\else
209 \if1\ifx\@tempa+1\else
210 \ifx\@tempa-1\else
211 0\fi\fi
212 \let\next@\@progcr@ii\else
213 \let\next@\@progcr@a\fi\fi\fi
214 \next@}
215 \def\@progcr@a{\prog@@cr*{}\ignorespaces}
216 \def\@progcr@ii#1{\csname @progcr@#1\endcsname\ignorespaces}
217 \@namedef{@progcr@+}{\prog@@cr[\medskipamount]}
218 \@namedef{@progcr@-}{\prog@@cr*[\jot]}
219 {\def\:{\gdef\@progcr@sp}\: {\@progcr}} % \@progcr@sp eats space and recurses
220
221 %% Set a program in `codeface', with implicit tabbing and other toys.
222 %% Newlines are explicit, because otherwise I need comments in weird places
223 %% to make the vertical spacing come out properly. You can write
224 %% `\obeylines' if you really want to.
225 \def\prog{\quote\@prog}
226 \def\endprog{\endtabbing\endquote}
227
228 %% Like `prog', but without indenting the code. Use this within environments
229 %% which already set their contents out from the body text in some
230 %% distinctive way.
231 \let\nprog\@prog
232 \let\endnprog\endtabbing
233
234 %% Indent the following material. Cancel using `\-'.
235 \def\ind{\quad\=\+\kill}
236
237 %% Show a backslash by the right-hand margin; for multiline macros etc.
238 \def\macsl{\`\textbackslash\hskip\leftmargin}
239
240 %%%--------------------------------------------------------------------------
241 %%% Machinery for describing functions, etc.
242
243 %% \definedescribecategory{CAT}[KIND]{NAME}
244 %%
245 %% Define a category of things to document. CAT is a short label identifying
246 %% the category to `\describe', `\descref', and friends. The NAME is the
247 %% text to show in the description headline; it is a macro body which is
248 %% passed an argument `#1' that applies a modifier to some portion of the
249 %% text.
250 %%
251 %% The KIND allows additional arguments to be collected, included in label
252 %% strings, and mentioned in the index. The default is `plain'.
253 \def\definedescribecategory#1{%
254 \@ifnextchar[{\def@desc{#1}}{\def@desc{#1}[plain]}}
255 \def\def@desc#1[#2]#3{\@namedef{cat!#1}##1{#3}\@namedef{catsw!#1}{#2}}
256
257 %% \describecategoryname[MOD]{CAT}
258 %%
259 %% Typeset the category name for CAT, modified by MOD.
260 \def\describecategoryname{\@ifnextchar[\@descname@i{\@descname@i[]}}
261 \def\@descname@i[#1]#2{%
262 \expandafter\let\expandafter\@tempa\csname cat!#2\endcsname%
263 \expandafter\let\expandafter\@tempb\csname modcat/#1\endcsname%
264 \ifx\@tempa\relax\@tempb{#2}\else\@tempa\@tempb\fi}
265
266 %% Call a modifier method.
267 \def\@mod@dispatch#1#2{\csname #1/#2\endcsname}
268
269 %% Call a description method given the category.
270 \def\@desc@dispatch#1#2{%
271 \csname #1/%
272 \expandafter\ifx\csname catsw!#2\endcsname\relax plain%
273 \else \csname catsw!#2\endcsname \fi%
274 \endcsname%
275 }
276
277 %% Modifier methods for the default `plain' modifier.
278 \@namedef{modcat/plain}#1{#1}
279 \@namedef{modlabel/plain}#1{#1}
280 \@namedef{modindex/plain}#1{#1@\noexpand\code{#1}}
281
282 %% Modifier methods for `setf'. The name text prefixes the relevant word
283 %% with `setf-'.
284 \@namedef{modcat/setf}#1{\code{setf}-#1}
285 \@namedef{modlabel/setf}#1{setf/#1}
286 \@namedef{modindex/setf}#1{#1@\noexpand\code{#1}}
287
288 %% Modifier methods for words with *earmuffs*. Sort into the index without
289 %% the earmuffs.
290 \@namedef{modcat/muffs}#1{#1}
291 \@namedef{modlabel/muffs}#1{*#1*}
292 \@namedef{modindex/muffs}#1{#1@\noexpand\code{*#1*}}
293
294 %% Modifier methods for :keywords. Sort into the index without the `:'.
295 \@namedef{modcat/kwd}#1{#1}
296 \@namedef{modlabel/kwd}#1{:#1}
297 \@namedef{modindex/kwd}#1{#1@\noexpand\code{:#1}}
298
299 %% Category-kind methods for plain categories.
300 \@namedef{descargs/plain}#1{#1{}}
301 \@namedef{desclabel/plain}#1#2#3{#1:\@mod@dispatch{modlabel}{#2}{#3}}
302 \@namedef{descindex/plain}#1#2#3{%
303 \@mod@dispatch{modindex}{#2}{#3}!%
304 \protect\describecategoryname[#2]{#1}%
305 }
306
307 %% Category-kind methods for `method' categories. Collect an extra argument
308 %% listing the specializers: include them in the label, and typeset them in
309 %% the index.
310 \def\fmtspecs#1#2{%
311 \if!#2!\else\count@\z@\toks@{}#1\fmtspecs@i#2,\q@,\fi}
312 \def\fmtspecs@i#1,{%
313 \def\@tempa{#1}%
314 \ifx\@tempa\q@%
315 \ifcase\count@(no args?!)%
316 \or% nothin' doin
317 \or \space and %
318 \else, and %
319 \fi%
320 \the\toks@%
321 \else%
322 \ifnum\count@>\@ne, \fi%
323 \the\toks@%
324 \toks@{\code{#1}}\advance\count@\@ne%
325 \expandafter\fmtspecs@i%
326 \fi%
327 }
328 \@namedef{descargs/method}#1#2{#1{{#2}}}
329 \@namedef{desclabel/method}#1#2#3#4%
330 {#1:\@mod@dispatch{modlabel}{#2}{#3}(#4)}
331 \@namedef{descindex/method}#1#2#3#4{%
332 \@mod@dispatch{modindex}{#2}{#3}!%
333 \protect\describecategoryname[#2]{#1}%
334 \protect\fmtspecs{ specialized at }{#4}%
335 }
336
337 %% Some magic strings.
338 \def\q@{\q@}
339 \def\@setf{setf}
340 \def\@starstar{**}
341
342 %% \parse@dhd{NEXT}[MOD]{CAT}{...}...[NAME]{SYNOPSIS}
343 %%
344 %% Parse the arguments for a description header, and call
345 %%
346 %% NEXT{MOD}{CAT}{{...}...}{NAME}{SYNOPSIS}
347 %%
348 %% Here, {...}... represents the additional category-kind arguments. See
349 %% `describe' for what all of this means.
350 \def\parse@dhd#1{% {NEXT}
351 \@ifnextchar[{\parse@dhd@a{#1}}{\parse@dhd@c{#1}}}
352 \def\parse@dhd@a#1[#2]#3{% {NEXT}[MOD]{CAT}
353 \@desc@dispatch{descargs}{#3}{\parse@dhd@ab{#1}{#2}{#3}}}
354 \def\parse@dhd@ab#1#2#3#4{% {NEXT}{MOD}{CAT}{{...}...}
355 \@ifnextchar[{\parse@dhd@ac{#1}{#2}{#3}{#4}}{\parse@dhd@ad{#1}{#2}{#3}{#4}}}
356 \def\parse@dhd@ac#1#2#3#4[#5]#6{% {NEXT}{MOD}{CAT}{{...}...}[NAME]{SYNOPSIS}
357 #1{#2}{#3}{#4}{#5}{#6}}
358 \def\parse@dhd@ad#1#2#3#4#5{% {NEXT}{MOD}{CAT}{{...}...}{NAME [ARGS...]}
359 \parse@dhd@ae{#1}{#2}{#3}{#4}{#5}#5 \q@}
360 \def\parse@dhd@ae#1#2#3#4#5#6 #7\q@{%
361 % {NEXT}{MOD}{CAT}{{...}...}{SYNSOPSIS}NAME [ARGS...]\q@
362 #1{#2}{#3}{#4}{#6}{#5}}
363
364 \def\parse@dhd@c#1#2{% {NEXT}{CAT}
365 \@desc@dispatch{descargs}{#2}{\parse@dhd@cb{#1}{#2}}}
366 \def\parse@dhd@cb#1#2#3{% {NEXT}{CAT}{{...}...}
367 \@ifnextchar[{\parse@dhd@cc{#1}{#2}{#3}}{\parse@dhd@cd{#1}{#2}{#3}}}
368 \def\parse@dhd@cc#1#2#3[#4]#5{% {NEXT}{CAT}{{...}...}[NAME]{SYNOPSIS}
369 #1{plain}{#2}{#3}{#4}{#5}}
370 \def\parse@dhd@cd#1#2#3#4{% {NEXT}{CAT}{{...}...}{SYNOPSIS}
371 \parse@dhd@ce{#1}{#2}{#3}{#4}#4 \q@}
372 \def\parse@dhd@ce#1#2#3#4#5 #6\q@{%
373 % {NEXT}{CAT}{{...}...}{SYNOPSIS}NAME [ARGS...]\q@
374 \def\temp@{#5}%
375 \ifx\@setf\temp@\def\next@{\parse@dhd@csetf{#1}{#2}{#3}{#4}#6 \q@}%
376 \else\def\temp@##1##2*##3\q@{\def\temp@{##1##3}}\temp@#5*\q@%
377 \ifx\temp@\@starstar\def\next@{\parse@dhd@cmuffs{#1}{#2}{#3}{#4}#5}%
378 \else\def\temp@##1##2\q@{\def\temp@{##1}}\temp@#5\q@%
379 \if:\temp@\def\next@{\parse@dhd@ckwd{#1}{#2}{#3}{#4}#5\q@}%
380 \else\def\next@{#1{plain}{#2}{#3}{#5}{#4}}\fi\fi\fi%
381 \next@%
382 }
383 \def\parse@dhd@csetf#1#2#3#4(#5 #6\q@{%
384 % {NEXT}{CAT}{{...}...}{SYNOPSIS}(NAME [ARGS...])\q@
385 #1{setf}{#2}{#3}{#5}{#4}}
386 \def\parse@dhd@cmuffs#1#2#3#4*#5*{%
387 % {NEXT}{CAT}{{...}...}{SYNOPSIS}*NAME*
388 #1{muffs}{#2}{#3}{#5}{#4}}
389 \def\parse@dhd@ckwd#1#2#3#4:#5\q@{%
390 % {NEXT}{CAT}{{...}...}{SYNOPSIS}:NAME\q@
391 #1{kwd}{#2}{#3}{#5}{#4}}
392
393 %% \dhead[MOD]{CAT}{...}...[NAME]{SYNOPSIS}
394 %%
395 %% Typeset a description head. Use this within the first argument of
396 %% `describe*'; see `describe' for the details.
397 \newif\if@dheadfirst
398 \def\dhead{\parse@dhd\dhead@}
399 \def\dhead@#1#2#3#4#5{% {MOD}{CAT}{{...}...}{NAME}{SYNOPSIS}
400 \if@dheadfirst\global\@dheadfirstfalse\else\relax\\*[\smallskipamount]\fi%
401 \phantomsection%
402 {\let\protect\@empty\let\@uscore\relax%
403 \edef\temp@{\@desc@dispatch{desclabel}{#2}{#2}{#1}{#4}#3}%
404 \def\@uscore{_\@gobble}\expandafter\message\expandafter{\temp@}%
405 \def\@uscore{-\@gobble}\expandafter\label\expandafter{\temp@}}%
406 {\begingroup\lccode`\~=`\_\lowercase{\endgroup\def~{_}}%
407 \protected@edef\@tempa##1{%
408 \noexpand\index{\@desc@dispatch{descindex}{#2}{#2}{#1}{#4}#3##1}}%
409 \toks@\expandafter{\@tempa{|)}}%
410 \toks\tw@\expandafter{\after@desc}%
411 \xdef\after@desc{\the\toks\tw@\the\toks@}%
412 \@tempa{|(}}%
413 \rlap{\hb@xt@\linewidth{\hfil\normalfont\bfseries
414 [\describecategoryname[#1]{#2}]}}%
415 #5%
416 }
417
418 %% Main guts of a description environment. The argument here typesets the
419 %% header line(s).
420 \def\desc@begin#1{%
421 \let\saved@after@desc\after@desc%
422 \gdef\after@desc{}%
423 \normalfont%
424 \if@nobreak\else\par\goodbreak\fi%
425 \global\@dheadfirsttrue%
426 \begingroup%
427 \let\@endparenv\relax%
428 \clubpenalty\@M \widowpenalty\@M \interlinepenalty50%
429 \@prog#1\endtabbing%
430 \endgroup%
431 \penalty\@M\@afterheading%
432 \list{}{\rightmargin\z@\topsep\z@}\item%
433 }
434 \def\desc@end{\endlist\after@desc\global\let\after@desc\saved@after@desc}
435
436 %% \begin{describe}[MOD]{CAT}{...}...[NAME]{SYNOPSIS}
437 %% ...
438 %% \end{describe}
439 %%
440 %% Describe some kind of program object. The CAT names the category of thing
441 %% being described -- this will be shown in the header, and index. The
442 %% SYNOPSIS is an implicit `prog' environment in which invoking the thing can
443 %% be summarized.
444 %%
445 %% The {...}... are any additional arguments required by the category's kind
446 %% (e.g., method specializers).
447 %%
448 %% The NAME is the name of the thing, which ends up in the index and
449 %% cross-reference label. If omitted, it defaults to the first word of the
450 %% SYNOPSIS, except that there are some special cases.
451 %%
452 %% The MOD is the modifier to apply. If omitted, it will usually default to
453 %% `plain', but in the absence of a NAME, some kinds of synopses are
454 %% recognized specially:
455 %%
456 %% * `setf (NAME ...) ...': selects NAME, and defaults MOD to `setf'.
457 %%
458 %% * `*NAME*': selects NAME, without the earmuffs, and defaults MOD to
459 %% `muffs'.
460 %%
461 %% * `:NAME': selects NAME, withtout the colon, and defaults MOD to `kwd'.
462 \def\describe{\parse@dhd\desc@}
463 \def\desc@#1#2#3#4#5{\desc@begin{\dhead@{#1}{#2}{#3}{#4}{#5}}}
464 \let\enddescribe\desc@end
465
466 %% \begin{describe*}
467 %% {\dhead[MOD]{CAT}{...}...[NAME]{SYNOPSIS}
468 %% ...}
469 %% ...
470 %% \end{describe*}
471 %%
472 %% This is the fancy form of `describe' for describing several different
473 %% things at once.
474 \@namedef{describe*}#1{\desc@begin{#1}}
475 \expandafter\let\csname enddescribe*\endcsname\desc@end
476
477 %% \descref{CAT}{...}...{LABEL}[TEXT]
478 %% \descref*{CAT}{...}...{LABEL}
479 %%
480 %% Typesets a cross-reference to a described thing. The CAT names the
481 %% category of thing being described, and the LABEL names the specific thing.
482 %%
483 %% The {...}... are any additional arguments required by the category's kind
484 %% (e.g., method specializers).
485 %%
486 %% The precise rules for how the LABEL matches the name in the description
487 %% depend on the description's modifier:
488 %%
489 %% * `plain': the LABEL is the same as the NAME.
490 %% * `setf': the LABEL should be `setf/NAME'.
491 %% * `muffs': the LABEL should be `*NAME*', i.e., with the earmuffs
492 %% restored.
493 %% * `kwd: the LABEL should be `:NAME', i.e., with the colon restored.
494 %%
495 %% Usually a page-number cross-reference is included, so as to help readers
496 %% of a dead-tree copy; this is suppressed by the `*' version.
497 \def\descref{\@ifstar%
498 {\descref@i{}\@gobble{}}%
499 {\descref@i{ (}{\noexpand\autopageref}{)}}}
500 \def\descref@i#1#2#3#4#5{\@ifnextchar@preserve[%
501 {\descref@ii{#1}{#2}{#3}{#4}{#5}}%
502 {\descref@iii{#1}{#2}{#3}{#4}{#5}{}}}
503 \def\descref@ii#1#2#3#4#5[#6]{\descref@iii{#1}{#2}{#3}{#4}{#5}{ #6}}
504 \def\descref@iii#1#2#3#4#5#6{%
505 \begingroup%
506 \let\protect\@empty%
507 \def\@uscore{-\@gobble}%
508 \edef\@tempa##1{%
509 \endgroup%
510 \noexpand\hyperref[#4:#5]%
511 ##1%
512 #2{#4:#5}%
513 }%
514 \@tempa{{\code{#5}}#6#1}#3%
515 }
516
517 %% Description categories.
518 \definedescribecategory{sym}{symbol}
519 \definedescribecategory{fun}{#1{function}}
520 \definedescribecategory{gf}{generic #1{function}}
521 \definedescribecategory{msg}{message}
522 \definedescribecategory{var}{variable}
523 \definedescribecategory{modvar}{module variable}
524 \definedescribecategory{const}{constant}
525 \definedescribecategory{meth}[method]{primary #1{method}}
526 \definedescribecategory{ar-meth}[method]{\code{:around} #1{method}}
527 \definedescribecategory{be-meth}[method]{\code{:before} #1{method}}
528 \definedescribecategory{af-meth}[method]{\code{:after} #1{method}}
529 \definedescribecategory{cls}{class}
530 \definedescribecategory{rst}{restart}
531 \definedescribecategory{ty}{type}
532 \definedescribecategory{mac}{#1{macro}}
533 \definedescribecategory{feat}{feature macro}
534 \definedescribecategory{lmac}{local #1{macro}}
535 \definedescribecategory{parse}{parser spec}
536 \definedescribecategory{parseform}{parser form}
537 \definedescribecategory{opt}{option handler}
538 \definedescribecategory{optmac}{option macro}
539 \definedescribecategory{plug}{pluggable parser}
540
541 %%%----- That's all, folks --------------------------------------------------
542 \endinput