Hi onf,

At 2025-10-30T12:22:41+0100, onf wrote:
> On Thu Oct 30, 2025 at 12:15 AM CET, G. Branden Robinson wrote:
> > This is possible but harder to do in the *roff language itself
> > (related: the performance misadventure of Savannah #67602). You
> > have C at your disposal so the problem is more easily solved.
> 
> To be fair, it is just as easily solved in roff now that the
> 2-character name limit is gone: just prefix the register names with
> something unique to mdoc, e.g. mdoc-type-\$1 rather than \$1. The BSD
> macros obviously couldn't do this because they were bound by the 2
> character limit.

Yes, that appears to be true.  I had thought we'd have name space
management problems but now I don't think so (see below[1]).

If someone would like to implement a patch, that could be helpful.

Regards,
Branden

[1] $ git grep 'doc-type' tmac
tmac/doc.tmac:.\" NS doc-typeXXX global register
tmac/doc.tmac:.nr doc-type1 0
tmac/doc.tmac:.\" NS   doc-typeXXX
tmac/doc.tmac:.  nr doc-type\n[doc-arg-count] \n[doc-arg-type]
tmac/doc.tmac:.\" NS   doc-typeXXX
tmac/doc.tmac:.  nr doc-type\n[doc-arg-count] \n[doc-arg-type]
tmac/doc.tmac:.  doc-set-spacing-\n[doc-type\n[doc-arg-count]]
tmac/doc.tmac:.\" NS   doc-typeXXX
tmac/doc.tmac:.  nr doc-type\n[doc-arg-count] \$2
tmac/doc.tmac:.    ie (\n[doc-type\n[doc-arg-ptr]] == 1) \{\
tmac/doc.tmac:.      if (\n[doc-type\n[doc-arg-ptr]] == 3) \
tmac/doc.tmac:.  nr doc-reg-dfr1 \n[doc-type\n[doc-arg-ptr]]
tmac/doc.tmac:.      ie (\n[doc-type\n[doc-arg-ptr]] == 3) \{\
tmac/doc.tmac:.        ie (\n[doc-type\n[doc-reg-dfr]] == 4) \
tmac/doc.tmac:.  nr doc-reg-dpr1 \n[doc-type\n[doc-arg-ptr]]
tmac/doc.tmac:.    if !(\n[doc-type\n[doc-arg-ptr]] == 4) \
tmac/doc.tmac:.    if (\n[doc-type\n[doc-arg-ptr]] == 1) \{\
tmac/doc.tmac:.    if !(\n[doc-type\n[doc-arg-ptr]] == 2) \{\
tmac/doc.tmac:.      nr doc-type\n[doc-arg-ptr] 2
tmac/doc.tmac:.  ie ((\n[doc-arg-count] >= \n[doc-arg-ptr]) & 
(\n[doc-type\n[doc-arg-ptr]] == 2)) \{\
tmac/doc.tmac:.    ie !(\n[doc-type\n[doc-arg-ptr]] == 2) \{\
tmac/doc.tmac:.        nr doc-type\n[doc-arg-ptr] 2
tmac/doc.tmac:.    if !(\n[doc-type\n[doc-arg-ptr]] == 2) \{\
tmac/doc.tmac:.      nr doc-type\n[doc-arg-ptr] 2
tmac/doc.tmac:.    doc-do-\n[doc-type\n[doc-arg-ptr]]
tmac/doc.tmac:.    ie (\n[doc-type\n[doc-arg-count]] == 3) \{\
tmac/doc.tmac:.      if !r doc-type\n[doc-reg-des] \
tmac/doc.tmac:.      while (\n[doc-type\n[doc-reg-des]] == 3) \
tmac/doc.tmac:.            rnn doc-type\n[doc-reg-des1] doc-type\n[doc-reg-des2]
tmac/doc.tmac:.          nr doc-type\n[doc-reg-des] 3
tmac/doc.tmac:.    doc-do-\n[doc-type\n[doc-arg-ptr]]
tmac/doc.tmac:.      doc-do-\n[doc-type\n[doc-arg-ptr]]
tmac/doc.tmac:.    nr doc-type\n[doc-reg-Bl] 0
tmac/doc.tmac:.    nr doc-type\n[doc-reg-dsgv]-saved 
\n[doc-type\n[doc-reg-dsgv]]
tmac/doc.tmac:.    nr doc-type\n[doc-reg-drgv] 
\n[doc-type\n[doc-reg-drgv]-saved]
tmac/doc.tmac:.        nr doc-curr-type \n[doc-type1]
tmac/doc.tmac:.        ie (\n[doc-type1] == 1) \
tmac/doc.tmac:.  ie (\n[doc-type\n[doc-arg-ptr]] == 2) \{\
tmac/doc.tmac:.    if !(\n[doc-type\n[doc-lasttext-Xr]] == 3) \
tmac/doc.tmac:.    if (\n[doc-type\n[doc-next-arg-ptr-Xr]] == 1) \
tmac/doc.tmac:.    if (\n[doc-type\n[doc-next-arg-ptr-Xr]] == 2) \
tmac/doc.tmac:.  doc-do-\n[doc-type\n[doc-arg-ptr]]
tmac/doc.tmac:.      doc-do-\n[doc-type\n[doc-arg-ptr]]
tmac/doc.tmac:.    if (\n[doc-type\n[doc-arg-ptr]] == 2) \{\
tmac/doc.tmac:.    if (\n[doc-type\n[doc-arg-ptr]] == 2) \{\
tmac/doc.tmac:.  nr doc-reg-ddr1 \n[doc-type\n[doc-arg-ptr]]
tmac/doc.tmac:.  ie (\n[doc-type\n[doc-arg-ptr]] == 2) \
tmac/doc.tmac:.    if !(\n[doc-type\n[doc-lasttext-Lk]] == 3) \
tmac/mdoc/doc-common:.    tm doc-type\n[doc-reg-Rd] == 
\n[doc-type\n[doc-reg-Rd]]
tmac/mdoc/doc-syms:.  nr doc-type\n[doc-arg-ptr] 2
tmac/mdoc/doc-syms:.    ie (\n[doc-type\n[doc-arg-ptr]] == 2) \{\
tmac/mdoc/doc-syms:.          ie (\n[doc-type\n[doc-arg-ptr]] == 2) \{\
tmac/mdoc/doc-syms:.            ie (\n[doc-type\n[doc-arg-ptr]] == 2) \{\
tmac/mdoc/doc-syms:.  nr doc-type\n[doc-arg-ptr] 2
tmac/mdoc/doc-syms:.    ie (\n[doc-type\n[doc-arg-ptr]] == 2) \{\
tmac/mdoc/doc-syms:.  nr doc-type\n[doc-arg-ptr] 2
tmac/mdoc/doc-syms:.    ie (\n[doc-type\n[doc-arg-ptr]] == 2) \{\
tmac/mdoc/doc-syms:.  nr doc-type\n[doc-arg-ptr] 2
tmac/mdoc/doc-syms:.    ie (\n[doc-type\n[doc-arg-ptr]] == 2) \{\
tmac/mdoc/doc-syms:.  nr doc-type\n[doc-arg-ptr] 2
tmac/mdoc/doc-syms:.    ie (\n[doc-type\n[doc-arg-ptr]] == 2) \{\
tmac/mdoc/doc-syms:.  nr doc-type\n[doc-arg-ptr] 2
tmac/mdoc/doc-syms:.    ie (\n[doc-type\n[doc-arg-ptr]] == 2) \
tmac/mdoc/doc-syms:.  nr doc-type\n[doc-arg-ptr] 2
tmac/mdoc/doc-syms:.    ie (\n[doc-type\n[doc-arg-ptr]] == 2) \
tmac/mdoc/doc-syms:.  nr doc-type\n[doc-arg-ptr] 2

Attachment: signature.asc
Description: PGP signature

Reply via email to