Re: [mdoc] .T interpolated in macro lines
"G. Branden Robinson" <[email protected]>
| Newsgroups | gmane.comp.printing.groff.general |
|---|---|
| Message-ID | <20251107134958.jjh7byh4ep323uoo@illithid> |
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
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEh3PWHWjjDgcrENwa0Z6cfXEmbc4FAmkN+P8ACgkQ0Z6cfXEm bc5SWQ//UAjSa22Puvrodpd6xx3wlS0dp3FcEJP0Em/JpSzbQDZunmXz04MjvVLV k5aTby+82xk8BNrItKRBJoLs/fdjj/CNKxXvTtfcHIX5MREzjGxVnRpeZ/s8GwqF RooS6YdtUxXYpucwwUqhihB+jSUjjShAoXgJ0fAWgSXvx1h/gSHN748H1gw/dqDx DtrVjY5YYZh1AohjlmE0SP0HGGc5foU4MTw7UV3nXOggWj1FGZJWh2yNcRiQfz7Q n6dymy6oBGotZy+lNvBGUyIhaYbC4s2BGN3rpmFdRMcy1pbWnJGxPr0a9z5R+dqZ mBOcMdMklWT/Yt0KWPWsMGRj+ZyOOH4KaRG+cJYt/saUHA13VYUzpm/2P1fuglQe HW7NI0mLhUUijddRxMzoV+xRSXNdfu9QLpwemIPi7mvJimnzo5PqqRPpERjc5TTz 0ar63cDH8Ionlljr8mZZacj2k9ImRLdRuxLeL3BlG+Y4zoijqbpBKeMFHnJA0X/Z uGIpXqs0QGeg6tcuY3paPDgWX8eGJmuRKIrksvq2cQBNKHWjpjACqq0U5oZk//QX 5pK8WX19GuY5E7b8VfB5g7L1iRJb0jmN1SzTR7EQoWWlJY4YFf6K5YNvT2gY6piG bJatu+1RjeGQiWJId+8HJzWdXqg23lU9qtVz1Ugu5HhTRRmaiaU= =Zkrq -----END PGP SIGNATURE-----