From: Mark Wooding Date: Sat, 3 Aug 2019 19:39:09 +0000 (+0100) Subject: doc/: Add `*' option to `\descref' to suppress the page number. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/sod/commitdiff_plain/ea214e5e3cb0bd99a1fb4e1a49652f0dcbc5fdde?ds=inline doc/: Add `*' option to `\descref' to suppress the page number. Now you only get the hyperlink. --- diff --git a/doc/concepts.tex b/doc/concepts.tex index 4f192f5..f32aa7e 100644 --- a/doc/concepts.tex +++ b/doc/concepts.tex @@ -926,12 +926,12 @@ Construction of a new instance of a class involves three steps. \end{enumerate} The \descref{SOD_DECL}[macro]{mac} handles constructing instances with automatic storage duration (`on the stack'). Similarly, the -\descref{SOD_MAKE}[macro]{mac} and the \descref{sod_make}{fun} and +\descref{SOD_MAKE}[macro]{mac} and the \descref*{sod_make}{fun} and \descref{sod_makev}{fun} functions construct instances allocated from the standard @|malloc| heap. Programmers can add support for other allocation strategies by using the \descref{SOD_INIT}[macro]{mac} and the -\descref{sod_init}{fun} and \descref{sod_initv}{fun} functions, which package -up imprinting and initialization. +\descref*{sod_init}{fun} and \descref{sod_initv}{fun} functions, which +package up imprinting and initialization. \subsubsection{Allocation} Instances of most classes (specifically including those classes defined by diff --git a/doc/runtime.tex b/doc/runtime.tex index e22ed59..5d6e5fc 100644 --- a/doc/runtime.tex +++ b/doc/runtime.tex @@ -775,7 +775,7 @@ deallocation, and applications are free to use any suitable mechanism. Keyword arguments for the initialization message may be provided. The @|SOD_INIT| macro expects a single preprocessor-time argument which is - a use of one of \descref{KWARGS}{mac} or \descref{NO_KWARGS}{mac}; the + a use of one of \descref*{KWARGS}{mac} or \descref{NO_KWARGS}{mac}; the @|sod_init| function expects the keywords as a variable-length argument tail; and @|sod_initv| expects the keywords to be passed indirectly, through the captured argument-tail cursor @. @@ -810,7 +810,7 @@ The following macro constructs an instance with automatic storage duration. Keyword arguments for the initialization message may be provided. The macro expects a single preprocessor-time argument which is a use of one of - \descref{KWARGS}{mac} or \descref{NO_KWARGS}{mac}. + \descref*{KWARGS}{mac} or \descref{NO_KWARGS}{mac}. The instance has automatic storage duration: pointers to it will become invalid when control exits the scope of the declaration. If necessary, the @@ -835,7 +835,7 @@ standard C heap. They don't work in freestanding implementations where Keyword arguments for the initialization message may be provided. The @|SOD_MAKE| macro expects a single preprocessor-time argument which is - a use of one of \descref{KWARGS}{mac} or \descref{NO_KWARGS}{mac}; the + a use of one of \descref*{KWARGS}{mac} or \descref{NO_KWARGS}{mac}; the @|sod_make| function expects the keywords as a variable-length argument tail; and @|sod_makev| expects the keywords to be passed indirectly, through the captured argument-tail cursor @. diff --git a/doc/sod.sty b/doc/sod.sty index 457dcad..ffe2b9a 100644 --- a/doc/sod.sty +++ b/doc/sod.sty @@ -368,19 +368,24 @@ \def\desc@#1#2#3#4#5{\desc@begin{\dhead@{#1}{#2}{#3}{#4}{#5}}} \let\enddescribe\desc@end -\def\descref#1{\@ifnextchar[{\descref@i{#1}}{\descref@ii{#1}{}}} -\def\descref@i#1[#2]{\descref@ii{#1}{ #2}} -\def\descref@ii#1#2#3{% +\def\descref{\@ifstar% + {\descref@i{}\@gobble{}}% + {\descref@i{ (}{\noexpand\autopageref}{)}}} +\def\descref@i#1#2#3#4{\@ifnextchar[% + {\descref@ii{#1}{#2}{#3}{#4}}% + {\descref@iii{#1}{#2}{#3}{#4}{}}} +\def\descref@ii#1#2#3#4[#5]{\descref@iii{#1}{#2}{#3}{#4}{ #5}} +\def\descref@iii#1#2#3#4#5#6{% \begingroup% \let\protect\@empty% \def\@uscore{-\@gobble}% \edef\@tempa##1{% \endgroup% - \noexpand\hyperref[#3:#1]% + \noexpand\hyperref[#6:#4]% ##1% - \noexpand\autopageref{#3:#1}% + #2{#6:#4}% }% - \@tempa{{\code{#1}}#2 (})% + \@tempa{{\code{#4}}#5#1}#3% } %%%----- That's all, folks --------------------------------------------------