From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-2.sys.kth.se (smtp-2.sys.kth.se [130.237.32.160]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id p67ARcku014020 for ; Thu, 7 Jul 2011 06:27:39 -0400 (EDT) Received: from mailscan-1.sys.kth.se (mailscan-1.sys.kth.se [130.237.32.91]) by smtp-2.sys.kth.se (Postfix) with ESMTP id 548C714DCB1; Thu, 7 Jul 2011 12:27:32 +0200 (CEST) X-Virus-Scanned: by amavisd-new at kth.se Received: from smtp-2.sys.kth.se ([130.237.32.160]) by mailscan-1.sys.kth.se (mailscan-1.sys.kth.se [130.237.32.91]) (amavisd-new, port 10024) with LMTP id TZzeXlKzN7MK; Thu, 7 Jul 2011 12:27:30 +0200 (CEST) X-KTH-Auth: kristaps [89.158.117.88] X-KTH-mail-from: kristaps@bsd.lv Received: from macky.local (89-158-117-88.rev.dartybox.com [89.158.117.88]) by smtp-2.sys.kth.se (Postfix) with ESMTP id AD3D014D86C; Thu, 7 Jul 2011 12:27:28 +0200 (CEST) Message-ID: <4E158A0F.3060608@bsd.lv> Date: Thu, 07 Jul 2011 12:27:27 +0200 From: Kristaps Dzonsons User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 X-Mailinglist: mdocml-tech Reply-To: tech@mdocml.bsd.lv MIME-Version: 1.0 To: tech@mdocml.bsd.lv CC: Ingo Schwarze Subject: Re: sync results References: <20110704224519.GC28684@iris.usta.de> <4E1306FA.3070801@bsd.lv> <20110706060332.GB29041@iris.usta.de> In-Reply-To: <20110706060332.GB29041@iris.usta.de> Content-Type: multipart/mixed; boundary="------------070502000003050606040208" This is a multi-part message in MIME format. --------------070502000003050606040208 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 06/07/2011 08:03, Ingo Schwarze wrote: > Hi Kristaps, > > Kristaps Dzonsons wrote on Tue, Jul 05, 2011 at 02:43:38PM +0200: >> Ingo Schwarze wrote: > >> I'm not able to reproduce some of these. > >>> i'm currently syncing from bsd.lv to openbsd.org. >>> The code looks good, and in the output, i see many improvements, >>> so i will now commit the sync. >>> >>> >>> However, there are also a three tiny regressions: >>> >>> cvs(1) contains this code: >>> >>> .TP 1i >>> \fB?\fP \fIfile\fP >>> \fIfile\fP is in your working directory, but does not correspond to >>> anything in the source repository, and is not in the list of files >>> for \fBcvs\fP to ignore (see the description of the \fB\-I\fP option). >>> .PP >>> .RS .5i >>> .sp >>> Use the >>> .B \-A >>> option to reset any sticky tags, dates, or >>> .B \-k >>> options. (If you get a working copy of a file by using one of the >>> >>> Now doubtless, .PP .RS .sp in a row is horrible. >>> However, with groff and old mandoc, that gave one blank line. >>> Now there are two. > >> This is not the case with my machine (groff 1.19.2). >> >> The following: >> >> .TH FOO 1 >> .SH NAME >> foo - bar >> .SH DESCRIPTION >> hi. >> .PP >> .RS .5i >> .sp >> Use the >> >> Has two spaces between the "hi" and "Use the" with both groff and >> mandoc (using nroff -mandoc and groff -Tascii -mandoc). > > That looks like a bug in groff-1.19 that has been fixed in 1.21. > With groff-1.21 and your test code, i get one blank line between > "hi" and "Use the", which makes more sense given the general > tendency of roff to compress multiple blank lines to one. > >>> lynx(1) contains this code: >>> >>> .TP >>> .B \-cookie_file\fR=\fIFILENAME >>> specifies a file to use to read cookies. >>> >>> In groff and old mandoc, the indent of "specifies" relative to "-cookie" >>> was 7, now it is 5. > >> Are you sure? I just ran this code and had both mandoc and groff >> align "specifies" under the underscore, i.e., 7 spaces. > > Yes, with both OpenBSD and bsd.lv mandoc, i get the "specifies" > aligned under the "i" in "-cookie_file". I'm just noticing > that the change in alignment happens about two dozen lines above, > below "-cmd_script". The "comment beginning with..." is still > aligned at 7 (below the 'r'), the "exit" is aligned at 5 (below > the 's'). Ingo, this was a bit tricky. It seems I've neglected that `RS' saves the current default-left-margin, restoring it on output. The enclosed patch introduces a stack of `RS' default-left-margins. The stack overflows neatly: if there are too many nested `RS' scopes, it stops nesting but keeps track of what the stack would be. When the stack drops below overflow, nesting is reenabled. I set the current max stack to 64. This should clean up output a great deal when the `RS' is used with embedded paragraphs. Thoughts? Kristaps --------------070502000003050606040208 Content-Type: text/plain; name="patch.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch.txt" Index: man_term.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_term.c,v retrieving revision 1.113 diff -u -r1.113 man_term.c --- man_term.c 3 Jul 2011 22:57:32 -0000 1.113 +++ man_term.c 7 Jul 2011 10:27:14 -0000 @@ -33,29 +33,19 @@ #include "term.h" #include "main.h" -#define INDENT 7 -#define HALFINDENT 3 +#define INDENT 7 /* fixed-width char full-indent */ +#define HALFINDENT 3 /* fixed-width char half-indent */ +#define MAXMARGINS 64 /* maximum number of indented scopes */ /* FIXME: have PD set the default vspace width. */ struct mtermp { int fl; #define MANT_LITERAL (1 << 0) - /* - * Default amount to indent the left margin after leading text - * has been printed (e.g., `HP' left-indent, `TP' and `IP' body - * indent). This needs to be saved because `HP' and so on, if - * not having a specified value, must default. - * - * Note that this is the indentation AFTER the left offset, so - * the total offset is usually offset + lmargin. - */ - size_t lmargin; - /* - * The default offset, i.e., the amount between any text and the - * page boundary. - */ - size_t offset; + size_t lmargin[MAXMARGINS]; /* margins (incl. visible page) */ + int lmargincur; /* index of current margin */ + int lmarginsz; /* actual number of nested margins */ + size_t offset; /* default offset to visible page */ }; #define DECL_ARGS struct termp *p, \ @@ -164,8 +154,9 @@ term_begin(p, print_man_head, print_man_foot, m); p->flags |= TERMP_NOSPACE; - mt.fl = 0; - mt.lmargin = term_len(p, INDENT); + memset(&mt, 0, sizeof(struct mtermp)); + + mt.lmargin[mt.lmargincur] = term_len(p, INDENT); mt.offset = term_len(p, INDENT); if (n->child) @@ -456,7 +447,7 @@ return(0); } - len = mt->lmargin; + len = mt->lmargin[mt->lmargincur]; ival = -1; /* Calculate offset. */ @@ -472,7 +463,7 @@ p->rmargin = mt->offset + len; if (ival >= 0) - mt->lmargin = (size_t)ival; + mt->lmargin[mt->lmargincur] = (size_t)ival; return(1); } @@ -507,7 +498,7 @@ switch (n->type) { case (MAN_BLOCK): - mt->lmargin = term_len(p, INDENT); + mt->lmargin[mt->lmargincur] = term_len(p, INDENT); print_bvspace(p, n); break; default: @@ -542,7 +533,7 @@ return(1); } - len = mt->lmargin; + len = mt->lmargin[mt->lmargincur]; ival = -1; /* Calculate the offset from the optional second argument. */ @@ -563,7 +554,7 @@ break; /* Set the saved left-margin. */ - mt->lmargin = (size_t)ival; + mt->lmargin[mt->lmargincur] = (size_t)ival; savelit = MANT_LITERAL & mt->fl; mt->fl &= ~MANT_LITERAL; @@ -631,18 +622,15 @@ return(1); } - len = (size_t)mt->lmargin; + len = (size_t)mt->lmargin[mt->lmargincur]; ival = -1; /* Calculate offset. */ - if (NULL != (nn = n->parent->head->child)) { - while (nn && MAN_TEXT != nn->type) - nn = nn->next; - if (nn && nn->next) + if (NULL != (nn = n->parent->head->child)) + if (nn->parent->line == nn->line) if ((ival = a2width(p, nn->string)) >= 0) len = (size_t)ival; - } switch (n->type) { case (MAN_HEAD): @@ -663,9 +651,8 @@ if (savelit) mt->fl |= MANT_LITERAL; - if (ival >= 0) - mt->lmargin = (size_t)ival; + mt->lmargin[mt->lmargincur] = (size_t)ival; return(0); case (MAN_BODY): @@ -710,7 +697,7 @@ switch (n->type) { case (MAN_BLOCK): mt->fl &= ~MANT_LITERAL; - mt->lmargin = term_len(p, INDENT); + mt->lmargin[mt->lmargincur] = term_len(p, INDENT); mt->offset = term_len(p, INDENT); /* If following a prior empty `SS', no vspace. */ if (n->prev && MAN_SS == n->prev->tok) @@ -761,7 +748,7 @@ switch (n->type) { case (MAN_BLOCK): mt->fl &= ~MANT_LITERAL; - mt->lmargin = term_len(p, INDENT); + mt->lmargin[mt->lmargincur] = term_len(p, INDENT); mt->offset = term_len(p, INDENT); /* If following a prior empty `SH', no vspace. */ if (n->prev && MAN_SH == n->prev->tok) @@ -830,6 +817,10 @@ mt->offset += sz; p->offset = mt->offset; + if (++mt->lmarginsz < MAXMARGINS) + mt->lmargincur = mt->lmarginsz; + + mt->lmargin[mt->lmargincur] = mt->lmargin[mt->lmargincur - 1]; return(1); } @@ -858,6 +849,9 @@ mt->offset = mt->offset < sz ? 0 : mt->offset - sz; p->offset = mt->offset; + + if (--mt->lmarginsz < MAXMARGINS) + mt->lmargincur = mt->lmarginsz; } static void --------------070502000003050606040208-- -- To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv