From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from scc-mailout-kit-01.scc.kit.edu (scc-mailout-kit-01.scc.kit.edu [129.13.231.81]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTP id 280cec2d for ; Mon, 29 May 2017 18:47:24 -0500 (EST) Received: from asta-nat.asta.uni-karlsruhe.de ([172.22.63.82] helo=hekate.usta.de) by scc-mailout-kit-01.scc.kit.edu with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (envelope-from ) id 1dFUNb-00079G-ET; Tue, 30 May 2017 01:47:23 +0200 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.77) (envelope-from ) id 1dFUNZ-0006VK-Aw; Tue, 30 May 2017 01:47:17 +0200 Received: from athene.usta.de ([172.24.96.10]) by donnerwolke.usta.de with esmtp (Exim 4.84_2) (envelope-from ) id 1dFUNZ-00060c-6V; Tue, 30 May 2017 01:47:17 +0200 Received: from localhost (athene.usta.de [local]) by athene.usta.de (OpenSMTPD) with ESMTPA id 4a0b780c; Tue, 30 May 2017 01:47:17 +0200 (CEST) Date: Tue, 30 May 2017 01:47:17 +0200 From: Ingo Schwarze To: Yuri Pankov Cc: mdocml-discuss Subject: Re: move roff sections to a separate file Message-ID: <20170529234717.GA54102@athene.usta.de> References: X-Mailinglist: mdocml-discuss Reply-To: discuss@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.2 (2016-07-01) Hi Yuri, Yuri Pankov wrote on Tue, May 30, 2017 at 01:14:35AM +0300: > I'd like a propose a small change which would simplify maintaining a > downstream version for us (as we need it modified and with a bit changed > order) - move list of sections (roff_sec) and their descriptions (secnames) > to separate file which we keep without a need to sync with upstream, > roffsec.in. Patch is pretty straightforward and simply moves both there. I see why such small differences can be a bother in maintenance, but i don't like the direction this is going. 1. I'd like to encourage more consistency in manual page organization across different systems, not facilitate divergence. Section naming and ordering is an area where existing differences are relatively mild, and making this aggressively configurable really seems like pushing into the wrong direction to me. 2. Besides harming users by promoting gratuitious differences among platforms, such configurability also impedes flexibility of development because - even keeping the user-visibile functionality constant - the implementation cannot be modified when *.in-style interfaces are promised to downstream systems. 3. Technically, i don't like the concept of *.in files at all. They make reading the code harder, as they are neither fish nor fowl, neither proper, readable C code, nor proper, readable *.h headers. I want to slowly get rid of them. I have deleted a few already and hope to continue in that direction, even if not with terribly high priority. But i certainly don't want to add any more of them. 4. Your specific patch is incorrect. "static const char * const secnames[SEC__MAX]" is not a declaration, but a definition. So if it goes into an *.in file, that *.in file cannot be included in any *.h file, but only in one *.c file, because otherwise every *.o file using the *.h file gets its own copy of the array. But enum roff_sec *is* needed in roff.h, so you are stuck. I don't think you should try to fix the technicality (4) because that will only make the patch yet uglier, aggravate (3), and not solve the more fundamental issues (1) and (2) in the least. To help finding a solution, i should like to understand the scope of the issue better. Which sections specificially do you want to order in which non-standard way? Is there any other, specific issue except ordering that you would like to change? If so, which one? Note that, if you simply use some additional, non-standard sections in some pages, i'm not convinced they need to be listed at all. They should work just fine as SEC_CUSTOM. Then again, if a section name is sufficiently widespread, we usually carry it even if it is not used in every system (e.g. LIBRARY). If you think there is such a case of a section name used by many, but not by all systems, that ought to be added, which one is it? Yours, Ingo > commit 369032da926596cc6cec2a5615fe3afd9f6083db > Author: Yuri Pankov > Date: Tue May 30 01:02:14 2017 +0300 > > move section list to separate file > > diff --git a/mdoc_validate.c b/mdoc_validate.c > index 1d3d81e..ede6863 100644 > --- a/mdoc_validate.c > +++ b/mdoc_validate.c > @@ -251,33 +251,6 @@ static const enum roff_tok rsord[RSORD_MAX] = { > MDOC__O > }; > > -static const char * const secnames[SEC__MAX] = { > - NULL, > - "NAME", > - "LIBRARY", > - "SYNOPSIS", > - "DESCRIPTION", > - "CONTEXT", > - "IMPLEMENTATION NOTES", > - "RETURN VALUES", > - "ENVIRONMENT", > - "FILES", > - "EXIT STATUS", > - "EXAMPLES", > - "DIAGNOSTICS", > - "COMPATIBILITY", > - "ERRORS", > - "SEE ALSO", > - "STANDARDS", > - "HISTORY", > - "AUTHORS", > - "CAVEATS", > - "BUGS", > - "SECURITY CONSIDERATIONS", > - NULL > -}; > - > - > void > mdoc_node_validate(struct roff_man *mdoc) > { > diff --git a/roff.h b/roff.h > index f0c2bf4..8f90faa 100644 > --- a/roff.h > +++ b/roff.h > @@ -16,6 +16,8 @@ > * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > */ > > +#include "roffsec.in" > + > struct ohash; > struct mdoc_arg; > union mdoc_data; > @@ -26,33 +28,6 @@ enum roff_macroset { > MACROSET_MAN > }; > > -enum roff_sec { > - SEC_NONE = 0, > - SEC_NAME, > - SEC_LIBRARY, > - SEC_SYNOPSIS, > - SEC_DESCRIPTION, > - SEC_CONTEXT, > - SEC_IMPLEMENTATION, /* IMPLEMENTATION NOTES */ > - SEC_RETURN_VALUES, > - SEC_ENVIRONMENT, > - SEC_FILES, > - SEC_EXIT_STATUS, > - SEC_EXAMPLES, > - SEC_DIAGNOSTICS, > - SEC_COMPATIBILITY, > - SEC_ERRORS, > - SEC_SEE_ALSO, > - SEC_STANDARDS, > - SEC_HISTORY, > - SEC_AUTHORS, > - SEC_CAVEATS, > - SEC_BUGS, > - SEC_SECURITY, > - SEC_CUSTOM, > - SEC__MAX > -}; > - > enum roff_type { > ROFFT_ROOT, > ROFFT_BLOCK, > diff --git a/roffsec.in b/roffsec.in > new file mode 100644 > index 0000000..6fd4172 > --- /dev/null > +++ b/roffsec.in > @@ -0,0 +1,70 @@ > +/* > + * Copyright (c) 2008-2012 Kristaps Dzonsons > + * Copyright (c) 2010-2017 Ingo Schwarze > + * Copyright (c) 2010 Joerg Sonnenberger > + * > + * Permission to use, copy, modify, and distribute this software for any > + * purpose with or without fee is hereby granted, provided that the above > + * copyright notice and this permission notice appear in all copies. > + * > + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES > + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF > + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR > + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES > + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN > + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF > + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > + */ > + > +enum roff_sec { > + SEC_NONE = 0, > + SEC_NAME, > + SEC_LIBRARY, > + SEC_SYNOPSIS, > + SEC_DESCRIPTION, > + SEC_CONTEXT, > + SEC_IMPLEMENTATION, /* IMPLEMENTATION NOTES */ > + SEC_RETURN_VALUES, > + SEC_ENVIRONMENT, > + SEC_FILES, > + SEC_EXIT_STATUS, > + SEC_EXAMPLES, > + SEC_DIAGNOSTICS, > + SEC_COMPATIBILITY, > + SEC_ERRORS, > + SEC_SEE_ALSO, > + SEC_STANDARDS, > + SEC_HISTORY, > + SEC_AUTHORS, > + SEC_CAVEATS, > + SEC_BUGS, > + SEC_SECURITY, > + SEC_CUSTOM, > + SEC__MAX > +}; > + > +static const char * const secnames[SEC__MAX] = { > + NULL, > + "NAME", > + "LIBRARY", > + "SYNOPSIS", > + "DESCRIPTION", > + "CONTEXT", > + "IMPLEMENTATION NOTES", > + "RETURN VALUES", > + "ENVIRONMENT", > + "FILES", > + "EXIT STATUS", > + "EXAMPLES", > + "DIAGNOSTICS", > + "COMPATIBILITY", > + "ERRORS", > + "SEE ALSO", > + "STANDARDS", > + "HISTORY", > + "AUTHORS", > + "CAVEATS", > + "BUGS", > + "SECURITY CONSIDERATIONS", > + NULL > +}; -- To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv