3 %%% Styles and other hacking for the Sod manual
5 %%% (c) 2015 Straylight/Edgeware
8 %%%----- Licensing notice ---------------------------------------------------
10 %%% This file is part of the Sensible Object Design, an object system for C.
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.
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.
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.
28 %%%--------------------------------------------------------------------------
29 %%% Basic style things.
31 %% More reference types.
34 %% A gadget to include in `\xref': call as
36 %% \xref[\instead{THING}]{LABEL}
38 %% to replace the usual `section' or whatever with THING.
41 %% Other languages with special typesetting.
42 \def\Cplusplus{C\kern-\p@++}
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)}
50 %% Other mathematical tweaks.
51 \let\implies\Rightarrow
52 \let\epsilon\varepsilon
54 %% A table heading cell. Clone and hack \multicolumn.
55 \def\thd{\omit\@ifnextchar[\thd@{\thd@[l]}}
58 \tab@multicol \tab@initread \let\tab@looped\tab@err@multi
59 \tab@preamble{}\def\tab@midtext{\bfseries#2}\tab@readpreamble{#1}%
61 \endgroup \ignorespaces
64 %% Unix manpage references.
65 \def\man#1#2{\textbf{#1}(#2)}
67 %% Listings don't need to be small.
68 \let\listingsize\relax
71 \def\fixme#1{\leavevmode\marginpar{FIXME}\index{FIXME}[FIXME: #1]}
75 every picture/.style={>=stealth, thick},
76 lit/.style={font=\sffamily}
79 %% Metavariables are italics without decoration.
80 \def\syntleft{\normalfont\itshape}
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\/}%
89 \def\ulitleft{\normalfont\codeface}
91 \def\lit@i#1#2#3{\ifmmode\leavevmode\hbox\fi{#1{#3\/}#2}}
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}
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}
104 %% A handy abbreviation; `\\' itself is too good to steal.
105 \atdef \\{\textbackslash}
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}
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
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}
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}
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%
133 \ifx\want@\nch@\expandafter\@tempa\else\expandafter\@tempb\fi}
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
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}
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}
150 %% Extra syntax for common tokens.
151 \atdef ~{\textasciitilde}
152 \atdef -{\leavevmode\hbox\bgroup\futurelet\ch@\@dash}
155 --\raisebox{.4pt}{>}%
156 \def\next@{\@firstoftwo{\egroup\penalty200\relax}}%
159 \def\next@{\@firstoftwo{\futurelet\ch@\@dash}}%
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}\\}
174 %% Put a chunk of text in a box.
175 \newenvironment{boxy}[1][\q@]{%
177 \dimen@\linewidth\advance\dimen@-1.2pt\advance\dimen@-2ex%
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%
183 \endminipage\hskip1ex\egroup\vskip1ex\egroup%
184 \vrule\egroup\hrule\egroup%
189 %%%--------------------------------------------------------------------------
190 %%% Environment for setting programs.
192 %% Main guts of `prog' and `nprog'.
194 \let\prog@@cr\@tabcr%
200 %% Newlines: called by `\\' within a `prog'.
202 %% \\ newline without following break
203 %% \\[SKIP] newline /with/ break and vertical glue
204 %% \\*[SKIP] newline without break, with optional glue
205 %% \\+ newline with break and a vertical gap
206 %% \\- newline without break, with a tiny gap
207 \def\@progcr{\futurelet\@tempa\@progcr@i}
209 \ifx\@tempa\@sptoken\let\next@\@progcr@sp\else
210 \if1\ifx\@tempa[1\else
213 \let\next@\prog@@cr\else
214 \if1\ifx\@tempa+1\else
217 \let\next@\@progcr@ii\else
218 \let\next@\@progcr@a\fi\fi\fi
220 \def\@progcr@a{\prog@@cr*{}\ignorespaces}
221 \def\@progcr@ii#1{\csname @progcr@#1\endcsname\ignorespaces}
222 \@namedef{@progcr@+}{\prog@@cr[\medskipamount]}
223 \@namedef{@progcr@-}{\prog@@cr*[\jot]}
224 {\def\:{\gdef\@progcr@sp}\: {\@progcr}} % \@progcr@sp eats space and recurses
226 %% Set a program in `codeface', with implicit tabbing and other toys.
227 %% Newlines are explicit, because otherwise I need comments in weird places
228 %% to make the vertical spacing come out properly. You can write
229 %% `\obeylines' if you really want to.
230 \def\prog{\quote\@prog}
231 \def\endprog{\endtabbing\endquote}
233 %% Like `prog', but without indenting the code. Use this within environments
234 %% which already set their contents out from the body text in some
237 \let\endnprog\endtabbing
239 %% Indent the following material. Cancel using `\-'.
240 \def\ind{\quad\=\+\kill}
242 %% Show a backslash by the right-hand margin; for multiline macros etc.
243 \def\macsl{\`\textbackslash\hskip\leftmargin}
245 %% \maplist{THING}{{ITEM}...}: Invoke THING{ITEM} for each ITEM in turn.
246 \def\maplist#1#2{\map@i{#1}#2\q@}
247 \def\map@i#1{\def\next@{\map@ii{#1}}\futurelet\ch@\next@}
248 \def\map@ii#1{\ifx\ch@\q@\expandafter\@gobble%
249 \else\def\next@{\map@iii{#1}}\expandafter\next@\fi}
250 \def\map@iii#1#2{#1{#2}\map@i{#1}}
252 %% \crossproduct{THING}{{LIST}...} where each LIST is {ITEM}...
253 %% For each possible way of selecting one ITEM from each LIST, in order,
254 %% invoke THING{{ITEM}...}
257 \toksdef\cprod@head=4
258 \toksdef\cprod@tail=6
259 \def\crossproduct#1#2{%
261 \maplist{\cprod@f{#1}}{#2}%
263 \edef\next@{\noexpand\maplist{\the\cprod@head}{\the\cprod@new}}
267 \cprod@old\cprod@new\cprod@new{}%
268 \maplist\cprod@g{#2}%
272 \expandafter\maplist\expandafter\cprod@h\expandafter{\the\cprod@old}%
276 \cprod@new\expandafter{\the\expandafter\cprod@new\expandafter{%
277 \the\expandafter\cprod@tail\the\cprod@head}}%
280 %%%--------------------------------------------------------------------------
281 %%% Machinery for describing functions, etc.
283 %% \definedescribecategory{CAT}[KIND]{NAME}
285 %% Define a category of things to document. CAT is a short label identifying
286 %% the category to `\describe', `\descref', and friends. The NAME is the
287 %% text to show in the description headline; it is a macro body which is
288 %% passed an argument `#1' that applies a modifier to some portion of the
291 %% The KIND allows additional arguments to be collected, included in label
292 %% strings, and mentioned in the index. The default is `plain'.
293 \def\definedescribecategory#1{%
294 \@ifnextchar[{\def@desc{#1}}{\def@desc{#1}[plain]}}
295 \def\def@desc#1[#2]#3{\@namedef{cat!#1}##1{#3}\@namedef{catsw!#1}{#2}}
297 %% \describecategoryname[MOD]{CAT}
299 %% Typeset the category name for CAT, modified by MOD.
300 \def\describecategoryname{\@ifnextchar[\@descname@i{\@descname@i[]}}
301 \def\@descname@i[#1]#2{%
302 \expandafter\let\expandafter\@tempa\csname cat!#2\endcsname%
303 \expandafter\let\expandafter\@tempb\csname modcat/#1\endcsname%
304 \ifx\@tempa\relax\@tempb{#2}\else\@tempa\@tempb\fi}
306 %% Call a modifier method.
307 \def\@mod@dispatch#1#2{\csname #1/#2\endcsname}
309 %% Call a description method given the category.
310 \def\@desc@dispatch#1#2{%
312 \expandafter\ifx\csname catsw!#2\endcsname\relax plain%
313 \else \csname catsw!#2\endcsname \fi%
317 %% Modifier methods for the default `plain' modifier.
318 \@namedef{modcat/plain}#1{#1}
319 \@namedef{modlabel/plain}#1{#1}
320 \@namedef{modindex/plain}#1{#1@\noexpand\code{#1}}
322 %% Modifier methods for `setf'. The name text prefixes the relevant word
324 \@namedef{modcat/setf}#1{\code{setf}-#1}
325 \@namedef{modlabel/setf}#1{setf/#1}
326 \@namedef{modindex/setf}#1{#1@\noexpand\code{#1}}
328 %% Modifier methods for words with *earmuffs*. Sort into the index without
330 \@namedef{modcat/muffs}#1{#1}
331 \@namedef{modlabel/muffs}#1{#1}
332 \@namedef{modindex/muffs}#1{\@unmuff#1@\noexpand\code{#1}}
335 %% Modifier methods for :keywords. Sort into the index without the `:'.
336 \@namedef{modcat/kwd}#1{#1}
337 \@namedef{modlabel/kwd}#1{#1}
338 \@namedef{modindex/kwd}#1{\@gobble#1@\noexpand\code{#1}}
340 %% Category-kind methods for plain categories.
341 \@namedef{descargs/plain}#1{#1{}}
342 \@namedef{desclabel/plain}#1#2#3{#2:\@mod@dispatch{modlabel}{#1}{#3}}
343 \@namedef{descindex/plain}#1#2#3{%
344 \@mod@dispatch{modindex}{#1}{#3}!%
345 \protect\describecategoryname[#1]{#2}%
348 %% Category-kind methods for `method' categories. Collect an extra argument
349 %% listing the specializers: include them in the label, and typeset them in
352 \if!#2!\else\count@\z@\toks@{}#1\fmtspecs@i#2,\q@,\fi}
356 \ifcase\count@(no args?!)%
363 \ifnum\count@>\@ne, \fi%
365 \toks@{\code{#1}}\advance\count@\@ne%
366 \expandafter\fmtspecs@i%
369 \@namedef{descargs/method}#1#2{#1{{#2}}}
370 \@namedef{desclabel/method}#1#2#3#4%
371 {#2:\@mod@dispatch{modlabel}{#1}{#4}(#3)}
372 \@namedef{descindex/method}#1#2#3#4{%
373 \@mod@dispatch{modindex}{#1}{#4}!%
374 \protect\describecategoryname[#1]{#2}%
375 \protect\fmtspecs{ specialized at }{#3}%
378 %% Some magic strings.
383 %% \parse@dhd{NEXT}[MOD]{CAT}{...}...[NAME]{SYNOPSIS}
385 %% Parse the arguments for a description header, and call
387 %% NEXT{MOD}{CAT}{{...}...}{NAME}{SYNOPSIS}
389 %% Here, {...}... represents the additional category-kind arguments. See
390 %% `describe' for what all of this means.
391 \def\parse@dhd#1{% {NEXT}
392 \@ifnextchar[{\parse@dhd@a{#1}}{\parse@dhd@c{#1}}}
393 \def\parse@dhd@a#1[#2]#3{% {NEXT}[MOD]{CAT}
394 \@desc@dispatch{descargs}{#3}{\parse@dhd@ab{#1}{#2}{#3}}}
395 \def\parse@dhd@ab#1#2#3#4{% {NEXT}{MOD}{CAT}{{...}...}
396 \@ifnextchar[{\parse@dhd@ac{#1}{#2}{#3}{#4}}{\parse@dhd@ad{#1}{#2}{#3}{#4}}}
397 \def\parse@dhd@ac#1#2#3#4[#5]#6{% {NEXT}{MOD}{CAT}{{...}...}[NAME]{SYNOPSIS}
398 #1{#2}{#3}{#4}{#5}{#6}}
399 \def\parse@dhd@ad#1#2#3#4#5{% {NEXT}{MOD}{CAT}{{...}...}{NAME [ARGS...]}
400 \parse@dhd@ae{#1}{#2}{#3}{#4}{#5}#5 \q@}
401 \def\parse@dhd@ae#1#2#3#4#5#6 #7\q@{%
402 % {NEXT}{MOD}{CAT}{{...}...}{SYNSOPSIS}NAME [ARGS...]\q@
403 #1{#2}{#3}{#4}{#6}{#5}}
405 \def\parse@dhd@c#1#2{% {NEXT}{CAT}
406 \@desc@dispatch{descargs}{#2}{\parse@dhd@cb{#1}{#2}}}
407 \def\parse@dhd@cb#1#2#3{% {NEXT}{CAT}{{...}...}
408 \@ifnextchar[{\parse@dhd@cc{#1}{#2}{#3}}{\parse@dhd@cd{#1}{#2}{#3}}}
409 \def\parse@dhd@cc#1#2#3[#4]#5{% {NEXT}{CAT}{{...}...}[NAME]{SYNOPSIS}
410 #1{plain}{#2}{#3}{#4}{#5}}
411 \def\parse@dhd@cd#1#2#3#4{% {NEXT}{CAT}{{...}...}{SYNOPSIS}
412 \parse@dhd@ce{#1}{#2}{#3}{#4}#4 \q@}
413 \def\parse@dhd@ce#1#2#3#4#5 #6\q@{%
414 % {NEXT}{CAT}{{...}...}{SYNOPSIS}NAME [ARGS...]\q@
416 \ifx\@setf\temp@\def\next@{\parse@dhd@csetf{#1}{#2}{#3}{#4}#6 \q@}%
417 \else\def\temp@##1##2*##3\q@{\def\temp@{##1##3}}\temp@#5*\q@%
418 \ifx\temp@\@starstar\def\next@{#1{muffs}{#2}{#3}{#5}{#4}}%
419 \else\def\temp@##1##2\q@{\def\temp@{##1}}\temp@#5\q@%
420 \if:\temp@\def\next@{#1{kwd}{#2}{#3}{#5}{#4}}%
421 \else\def\next@{#1{plain}{#2}{#3}{#5}{#4}}\fi\fi\fi%
424 \def\parse@dhd@csetf#1#2#3#4(#5 #6\q@{%
425 % {NEXT}{CAT}{{...}...}{SYNOPSIS}(NAME [ARGS...])\q@
426 #1{setf}{#2}{#3}{#5}{#4}}
428 %% \dhead[MOD]{CAT}{...}...[NAME]{SYNOPSIS}
429 %% \dhead*[MOD]{CAT}{...}...[NAME]{SYNOPSIS}
431 %% Typeset a description head. Use this within the first argument of
432 %% `describe*'; see `describe' for the details.
434 %% With `*', don't set labels or add items to the index.
438 {\parse@dhd{\global\@dheadindexfalse\dhead@}}%
439 {\parse@dhd{\global\@dheadindextrue\dhead@}}}
440 \def\dhead@#1#2#3#4#5{% {MOD}{CAT}{{...}...}{NAME}{SYNOPSIS}
441 \if@dheadfirst\global\@dheadfirstfalse\else\relax\\*[\smallskipamount]\fi%
444 {\let\protect\@empty\let\@uscore\relax%
445 \edef\temp@{\@desc@dispatch{desclabel}{#2}{#1}{#2}#3{#4}}%
446 \def\@uscore{_\@gobble}\expandafter\message\expandafter{\temp@}%
447 \def\@uscore{-\@gobble}\expandafter\label\expandafter{\temp@}}%
448 {\begingroup\lccode`\~=`\_\lowercase{\endgroup\def~{_}}%
449 \protected@edef\@tempa##1{%
450 \noexpand\index{\@desc@dispatch{descindex}{#2}{#1}{#2}#3{#4}##1}}%
451 \toks@\expandafter{\@tempa{|)}}%
452 \toks\tw@\expandafter{\after@desc}%
453 \xdef\after@desc{\the\toks\tw@\the\toks@}%
456 \rlap{\hb@xt@\linewidth{\hfil\normalfont\bfseries
457 [\describecategoryname[#1]{#2}]}}%
461 %% Main guts of a description environment. The argument here typesets the
464 \let\saved@after@desc\after@desc%
467 \if@nobreak\else\par\goodbreak\fi%
468 \global\@dheadfirsttrue%
470 \let\@endparenv\relax%
471 \clubpenalty\@M \widowpenalty\@M \interlinepenalty50%
474 \penalty\@M\@afterheading%
475 \list{}{\rightmargin\z@\topsep\z@}\item%
477 \def\desc@end{\endlist\after@desc\global\let\after@desc\saved@after@desc}
479 %% \begin{describe}[MOD]{CAT}{...}...[NAME]{SYNOPSIS}
483 %% Describe some kind of program object. The CAT names the category of thing
484 %% being described -- this will be shown in the header, and index. The
485 %% SYNOPSIS is an implicit `prog' environment in which invoking the thing can
488 %% The {...}... are any additional arguments required by the category's kind
489 %% (e.g., method specializers).
491 %% The NAME is the name of the thing, which ends up in the index and
492 %% cross-reference label. If omitted, it defaults to the first word of the
493 %% SYNOPSIS, except that there are some special cases.
495 %% The MOD is the modifier to apply. If omitted, it will usually default to
496 %% `plain', but in the absence of a NAME, some kinds of synopses are
497 %% recognized specially:
499 %% * `setf (NAME ...) ...': selects NAME, and defaults MOD to `setf'.
501 %% * `*NAME*': defaults MOD to `muffs'.
503 %% * `:NAME': defaults MOD to `kwd'.
504 \def\describe{\parse@dhd\desc@}
505 \def\desc@#1#2#3#4#5{%
506 \global\@dheadindextrue%
507 \desc@begin{\dhead@{#1}{#2}{#3}{#4}{#5}}%
509 \let\enddescribe\desc@end
512 %% {\dhead[MOD]{CAT}{...}...[NAME]{SYNOPSIS}
517 %% This is the fancy form of `describe' for describing several different
519 \@namedef{describe*}#1{\desc@begin{#1}}
520 \expandafter\let\csname enddescribe*\endcsname\desc@end
522 %% \parse@dlbl{NEXT}[MOD]{CAT}{...}...{LABEL}
524 %% Parse a description label, and call
526 %% NEXT{MOD}{CAT}{{...}...}{LABEL}
528 %% This handles defaulting the MOD correctly, based on the LABEL text. See
529 %% `\descref' for the details.
530 \def\parse@dlbl#1{\@ifnextchar[{\parse@dlbl@a{#1}}{\parse@dlbl@c{#1}}}
531 \def\parse@dlbl@a#1[#2]#3{\@desc@dispatch{descargs}{#3}{#1{#2}{#3}}}
532 \def\parse@dlbl@c#1#2%
533 {\@desc@dispatch{descargs}{#2}{\parse@dlbl@cb{#1}{#2}}}
534 \def\parse@dlbl@cb#1#2#3#4{%
535 \def\temp@##1##2*##3\q@{\def\temp@{##1##3}}\temp@#4*\q@%
536 \ifx\temp@\@starstar\def\next@{#1{muffs}{#2}{#3}{#4}}%
537 \else\def\temp@##1##2\q@{\def\temp@{##1}}\temp@#4\q@%
538 \if:\temp@\def\next@{#1{kwd}{#2}{#3}{#4}}
539 \else\def\next@{#1{plain}{#2}{#3}{#4}}\fi\fi%
543 %% \descref[MOD]{CAT}{...}...{LABEL}[TEXT]
544 %% \descref*[MOD]{CAT}{...}...{LABEL}
546 %% Typesets a cross-reference to a described thing. The CAT names the
547 %% category of thing being described, and the LABEL names the specific thing.
549 %% The {...}... are any additional arguments required by the category's kind
550 %% (e.g., method specializers).
552 %% The MOD is the modifier to apply, similar (but subtly different from) to
553 %% the `describe' environment. If omitted, it will usually default to
554 %% `plain', but in the absence of a NAME, some kinds of synopses are
555 %% recognized specially:
557 %% * `*NAME*': defaults MOD to `muffs'.
559 %% * `:NAME': defaults MOD to `kwd'.
561 %% (`setf' is /not/ specially detected here. Write an explicit `setf'
562 %% modifier if necessary, because it's no more typing.)
564 %% Usually a page-number cross-reference is included, so as to help readers
565 %% of a dead-tree copy; this is suppressed by the `*' version.
566 \def\descref{\@ifstar%
567 {\parse@dlbl{\descref@i\relax\@gobble\relax}}%
568 {\parse@dlbl{\descref@i{ (}\autopageref)}}}
569 \def\descref@i#1#2#3#4#5#6#7{\@ifnextchar@preserve[%
570 % {PGA}{PGB}{PGC}{MOD}{CAT}{{...}...}{LABEL}
571 {\descref@ii{#1}{#2}{#3}{#4}{#5}{#6}{#7}}%
572 {\descref@iii{#1}{#2}{#3}{#4}{#5}{#6}{#7}{}}}
573 \def\descref@ii#1#2#3#4#5#6#7[#8]%
574 % {PGA}{PGB}{PGC}{MOD}{CAT}{{...}...}{LABEL}[AFTER]
575 {\descref@iii{#1}{#2}{#3}{#4}{#5}{#6}{#7}{ #8}}
576 \def\descref@iii#1#2#3#4#5#6#7#8{%
577 % {PGA}{PGB}{PGC}{MOD}{CAT}{{...}...}{LABEL}{AFTER}
579 \let\protect\@empty\def\@uscore{-\@gobble}%
580 \edef\temp@{\@desc@dispatch{desclabel}{#5}{#4}{#5}#6{#7}}%
581 \hyperref[\temp@]{\code{#7}}#8%
586 %% \descindex[MOD]{CAT}{...}...{LABEL}[SUFFIX]
588 %% Set a label and index entry here, as if for a description. The CAT names
589 %% the category of thing being described, and the LABEL names the specific
590 %% thing, as for `\descref'. The {...}... are any additional arguments
591 %% required by the category's kind (e.g., method specializers). The MOD is
592 %% the modifier to apply; see `\descref' for the details.
594 %% The SUFFIX is appended to the index-entry text; by default it is empty.
595 %% Useful values are `|(' and `|)' to set ranges.
596 \def\descindex{\parse@dlbl\descindex@i}
597 \def\descindex@i#1#2#3#4{\@ifnextchar[%
598 {\descindex@ii{#1}{#2}{#3}{#4}}%
599 {\descindex@ii{#1}{#2}{#3}{#4}[]}}
600 \def\descindex@ii#1#2#3#4[#5]{%
601 {\begingroup\lccode`\~=`\_\lowercase{\endgroup\def~{_}}%
602 \protected@edef\@tempa{%
603 \noexpand\index{\@desc@dispatch{descindex}{#2}{#1}{#2}#3{#4}#5}}%
607 %% \desclabel[MOD]{CAT}{...}...{LABEL}[INDEX-SUFFIX]
609 %% Set a label and index entry here, as if for a description. The CAT names
610 %% the category of thing being described, and the LABEL names the specific
611 %% thing, as for `\descref'. The {...}... are any additional arguments
612 %% required by the category's kind (e.g., method specializers). The MOD is
613 %% the modifier to apply; see `\descref' for the details.
615 %% This will also add an index entry, as for `\descindex'; the INDEX-SUFFIX
616 %% argument has the same effect as its SUFFIX argument.
617 \def\desclabel{\parse@dlbl\desclabel@i}
618 \def\desclabel@i#1#2#3#4{%
620 \let\protect\@empty\def\@uscore{-\@gobble}%
621 \edef\@tempa{\@desc@dispatch{desclabel}{#2}{#1}{#2}#3{#4}}%
622 \phantomsection\label{\@tempa}%
624 \descindex@i{#1}{#2}{#3}{#4}%
627 %% Description categories.
628 \definedescribecategory{sym}{symbol}
629 \definedescribecategory{fun}{#1{function}}
630 \definedescribecategory{gf}{generic #1{function}}
631 \definedescribecategory{msg}{message}
632 \definedescribecategory{var}{variable}
633 \definedescribecategory{modvar}{module variable}
634 \definedescribecategory{const}{constant}
635 \definedescribecategory{meth}[method]{primary #1{method}}
636 \definedescribecategory{ar-meth}[method]{\code{:around} #1{method}}
637 \definedescribecategory{be-meth}[method]{\code{:before} #1{method}}
638 \definedescribecategory{af-meth}[method]{\code{:after} #1{method}}
639 \definedescribecategory{cls}{class}
640 \definedescribecategory{rst}{restart}
641 \definedescribecategory{ty}{type}
642 \definedescribecategory{mac}{#1{macro}}
643 \definedescribecategory{feat}{feature macro}
644 \definedescribecategory{lmac}{local #1{macro}}
645 \definedescribecategory{parse}{parser spec}
646 \definedescribecategory{parseform}{parser form}
647 \definedescribecategory{opt}{option handler}
648 \definedescribecategory{optmac}{option macro}
649 \definedescribecategory{plug}{pluggable parser}
651 %%%----- That's all, folks --------------------------------------------------