public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <colomar.6.4.3@gmail.com>
To: mtk.manpages@gmail.com
Cc: linux-man <linux-man@vger.kernel.org>,
	"libc-alpha@sourceware.org" <libc-alpha@sourceware.org>
Subject: Re: queue.3 overhaul
Date: Tue, 20 Oct 2020 12:36:19 +0200	[thread overview]
Message-ID: <907cf2f7-70de-42c3-a738-d7e6a14327de@gmail.com> (raw)
In-Reply-To: <CAKgNAkhDZK9YyvDNr+s=bT9Y6BGCtC7mrGuYa+bdrzQnhGSjhw@mail.gmail.com>

Hi Michael,

On 2020-10-20 06:08, Michael Kerrisk (man-pages) wrote:
> Hi Alex,
> 
> On Mon, 19 Oct 2020 at 17:29, Alejandro Colomar <colomar.6.4.3@gmail.com> wrote:
>>
>> Hi Michael,
>>
>>
>> I'm working on moving and fixing code from queue.3 to different pages.
>>
>> I'd like to send you patches against a separate branch,
>> if you would create one, to ask you some questions from time to time,
>> and maybe get suggestions.
>>
>> Or maybe you could look at my branch on github
>> (https://github.com/alejandro-colomar/man-pages/commits/queue
>> (I may force push changes there sometimes))
> 
> I created a remote to remote to track your work. But you'll need to
> ping me from time to tell me to take a look. Also, I think mail to
> this list to discuss directions (as you are now doing) is great.
> 
>> (BTW, if you have a look there,
>> you can see how I'm moving&fixing the code from queue.3
>> to the other pages and maybe suggest a different way).
> 
> This looks okay in principle.
> 
>> Or maybe I can just show you small pieces of code (no patches),
>> like in this email.
>>
>> Whatever works best for you.
> 
> Both ;-)


Fine :-)

> 
> But, I find the indentation confusing actually. When I see pieces such as
> 
>         int        LIST_EMPTY(LIST_HEAD *head);
>                    LIST_ENTRY(TYPE);
> 
> It visually looks to me as though the LIST_ENTRY piece is some
> extension of the LIST_EMPTY pest.


Agreed.

> 
> I think it's best not to do horizontal indentation, but instead just
> use of vertical separation (.PP). We can perhaps revisit this later,
> to see if we can come up with something better.

Okay, I changed it to use vertical separation (as the original one did).
Now the output is the following (I think the SYNOPSIS already looks 
good, and I'll move to the DESCRIPTION):

[[
LIST(3)                    Linux Programmer's Manual 
LIST(3)

NAME
        LIST_EMPTY,    LIST_ENTRY,    LIST_FIRST,    LIST_FOREACH, 
LIST_HEAD,
        LIST_HEAD_INITIALIZER,  LIST_INIT,  LIST_INSERT_AFTER, 
LIST_INSERT_BE-
        FORE, LIST_INSERT_HEAD, LIST_NEXT, LIST_PREV, LIST_REMOVE - 
implementa-
        tion of a doubly-linked list


SYNOPSIS
        #include <sys/queue.h>

        int LIST_EMPTY(LIST_HEAD *head);

        LIST_ENTRY(TYPE);

        LIST_ENTRY *LIST_FIRST(LIST_HEAD *head);

        LIST_FOREACH(TYPE *var, LIST_HEAD *head, LIST_ENTRY NAME);

        LIST_HEAD(HEADNAME, TYPE);

        LIST_HEAD LIST_HEAD_INITIALIZER(LIST_HEAD head);

        void LIST_INIT(LIST_HEAD *head);

        void LIST_INSERT_AFTER(TYPE *listelm, TYPE *elm, LIST_ENTRY NAME);

        void LIST_INSERT_BEFORE(TYPE *listelm, TYPE *elm, LIST_ENTRY NAME);

        void LIST_INSERT_HEAD(LIST_HEAD *head, TYPE *elm, LIST_ENTRY NAME);

        LIST_ENTRY *LIST_NEXT(TYPE *elm, LIST_ENTRY NAME);

        void LIST_REMOVE(TYPE *elm, LIST_ENTRY NAME);

]]

The code for NAME and SYNOPSIS,
which are the sections that are ready in list.3,
is the following:

[[
.TH LIST 3 2020-10-19 "GNU" "Linux Programmer's Manual"
.SH NAME
LIST_EMPTY,
LIST_ENTRY,
LIST_FIRST,
LIST_FOREACH,
.\"LIST_FOREACH_FROM,
.\"LIST_FOREACH_SAFE,
.\"LIST_FOREACH_FROM_SAFE,
LIST_HEAD,
LIST_HEAD_INITIALIZER,
LIST_INIT,
LIST_INSERT_AFTER,
LIST_INSERT_BEFORE,
LIST_INSERT_HEAD,
LIST_NEXT,
LIST_PREV,
LIST_REMOVE
.\"LIST_SWAP
\- implementation of a doubly-linked list
.SH SYNOPSIS
.nf
.B #include <sys/queue.h>
.PP
.BI "int LIST_EMPTY(LIST_HEAD *" head ");"
.PP
.B  "LIST_ENTRY(TYPE);"
.PP
.BI "LIST_ENTRY *LIST_FIRST(LIST_HEAD *" head ");"
.PP
.BI "LIST_FOREACH(TYPE *" var ", LIST_HEAD *" head ", LIST_ENTRY " NAME ");"
.\".PP
.\".BI "LIST_FOREACH_FROM(TYPE *" var ", LIST_HEAD *" head ", LIST_ENTRY 
" NAME ");"
.\".PP
.\".BI "LIST_FOREACH_SAFE(TYPE *" var ", LIST_HEAD *" head ", LIST_ENTRY 
" NAME ", TYPE *" temp_var ");"
.\".PP
.\".BI "LIST_FOREACH_FROM_SAFE(TYPE *" var ", LIST_HEAD *" head ", 
LIST_ENTRY " NAME ", TYPE *" temp_var ");"
.PP
.B  "LIST_HEAD(HEADNAME, TYPE);"
.PP
.BI "LIST_HEAD LIST_HEAD_INITIALIZER(LIST_HEAD " head ");"
.PP
.BI "void LIST_INIT(LIST_HEAD *" head ");"
.PP
.BI "void LIST_INSERT_AFTER(TYPE *" listelm ", TYPE *" elm ", LIST_ENTRY 
" NAME ");"
.PP
.BI "void LIST_INSERT_BEFORE(TYPE *" listelm ", TYPE *" elm ", 
LIST_ENTRY " NAME ");"
.PP
.BI "void LIST_INSERT_HEAD(LIST_HEAD *" head ", TYPE *" elm ", 
LIST_ENTRY " NAME ");"
.PP
.BI "LIST_ENTRY *LIST_NEXT(TYPE *" elm ", LIST_ENTRY " NAME ");"
.\".PP
.\".BI "LIST_ENTRY LIST_PREV(TYPE *" elm ", LIST_HEAD *" head ", TYPE, 
LIST_ENTRY " NAME ");"
.PP
.BI "void LIST_REMOVE(TYPE *" elm ", LIST_ENTRY " NAME ");"
.\".PP
.\".BI "void LIST_SWAP(LIST_HEAD *" head1 ", LIST_HEAD *" head2 ", TYPE, 
LIST_ENTRY " NAME ");"
.fi
]]

I'll continue working on other sections;
please tell me if you find anything that could be improved.

I'll work on list.3 only, so that we then have a pattern for the rest.
Also, this way they can be merged to master separately,
resulting in shorter patchsets and times.


Cheers,

Alex

  reply	other threads:[~2020-10-20 10:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19 15:29 queue.3 overhaul Alejandro Colomar
2020-10-20  4:08 ` Michael Kerrisk (man-pages)
2020-10-20 10:36   ` Alejandro Colomar [this message]
2020-10-20 11:22     ` Hans Petter Selasky
2020-10-20 11:42       ` Alejandro Colomar
2020-10-21  4:53         ` Michael Kerrisk (man-pages)
2020-10-23  9:50           ` sys/queue.h: Add macros present on BSDs Alejandro Colomar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=907cf2f7-70de-42c3-a738-d7e6a14327de@gmail.com \
    --to=colomar.6.4.3@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox