groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using tbl(1) for structure definitions


From: Alejandro Colomar
Subject: Re: Using tbl(1) for structure definitions
Date: Tue, 26 Jul 2022 22:09:44 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.0.2

I must say that the source code is really ugly (ugly as in, someone reading it will probably have a hard time modifying it, without reading tbl(1)).

But at the same time, the result is beautiful, and the syntax is really great. You can express exactly what you want.

Cheers,

Alex

On 7/26/22 22:07, Alejandro Colomar wrote:
Improved an v2 using T{...T} in combination with column modifiers and removing .nf/.fi for the table, fixing a misplaced .PD, and .BR instead of \fB...\fP:


     open_how.2type: ffix

    Format structures with tbl(1) to improve alignment in proportional-width font text.

     Reported-by: "G. Branden Robinson" <g.branden.robinson@gmail.com>
     Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>

diff --git a/man2type/open_how.2type b/man2type/open_how.2type
index e058c08dc..edc4d8a3b 100644
--- a/man2type/open_how.2type
+++ b/man2type/open_how.2type
@@ -13,9 +13,26 @@ Linux kernel headers
  .B #include <linux/openat2.h>
  .PP
  .B struct open_how {
-.BR "    u64  flags;" "    /* " O_ "* flags */"
-.BR "    u64  mode;" "     /* Mode for " O_ { CREAT , TMPFILE "} */"
-.BR "    u64  resolve;" "  /* " RESOLVE_ "* flags */"
+.fi
+.PD 0
+.TS
+l lB lB l1 lX.
+\&     u64     flags;  /*      T{
+.BR O_ *
+flags */
+T}
+\&     u64     mode;   /*      T{
+Mode for
+.BR O_ { CREAT , TMPFILE }
+*/
+T}
+\&     u64     resolve;        /*      T{
+.BR RESOLVE_ *
+flags */
+T}
+.TE
+.PD
+.nf
      /* ... */
  .B };
  .fi



--
Alejandro Colomar
<http://www.alejandro-colomar.es/>

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]