tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* Re: mdocml version 1.10.6 available
       [not found] <4CA0912F.5040103@bsd.lv>
@ 2010-09-27 22:26 ` Ingo Schwarze
  2010-09-27 22:44   ` Kristaps Dzonsons
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Schwarze @ 2010-09-27 22:26 UTC (permalink / raw)
  To: tech

Hi Kristaps,

Kristaps Dzonsons wrote on Mon, Sep 27, 2010 at 02:42:23PM +0200:

> I'm pleased to announce mdocml 1.10.6, now at http://mdocml.bsd.lv/.
> This is mainly for the new mandoc calling conventions and improved
> pod2man preamble support.

... and you snoke in a few nice last-minute bug fixes,
shortening the TODO list.  :-)

This is now merged to OpenBSD as well.
While merging, i fixed a minor regression:
Two successive blank lines must both be printed,
even (horrors!) ouside literal mode.
Both old and new groff agree on that.

I fixed that by interpreting blank lines as .sp (instead of .Pp)
in mdoc.c, function mdoc_ptext(), and dropping .Pp before .sp
in exactly the same way as .Pp before .Pp.

For reference, here are the rules for handling explicit line breaks:

 .br  breaks the line, unless we are at the beginning of a line
 .Pp  adds a blank line, but collapses with a following -
      but not with a preceding! - blank line
 .sp  adds a blank line and doesn't collapse

A blank line is always the same as .sp.

Consequently, using the notation

 0 = break the line, no blank line
 1 = one blank line
 2 = two blank lines

we get the following combinations:

 single br = 0
 single Pp = 1
 single sp = 1

 double br = 0
 br Pp = Pp = 1
 Pp br = Pp = 1
 br sp = sp = 1
 sp br = sp = 1

 double Pp = Pp (collapse) = 1
 Pp sp = sp (collapse) = 1
 sp Pp = 2
 double sp = 2

Crazy as it is, this is now indeed implemented correctly in mandoc.


So, here is the diff from OpenBSD that i would like to merge to bsd.lv:

 * mdoc.c, first chunk:
   blank line = .sp, see above
 * mdoc.c, second chunk:
   Revert unneeded and wrong part of the .br\} fix.
   The parsing is completed in roff.c, the .br\} never propagates
   to the macro libraries, and when a backslash follows a real
   macro, that macro must *not* be recognized.
   This was never merged to OpenBSD; sorry for forgetting
   to report earlier...
 * mdoc_term.c:
   Two prototypes are better than one?
 * mdoc_validate.c:
   Drop .Pp before .sp; see above.
 * term_ps.c:
   fix off by one found by jsg@ with parfait,
   see OpenBSD term_ps.d rev. 1.12

OK?

Yours,
  Ingo


Index: mdoc.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.c,v
retrieving revision 1.164
diff -u -p -r1.164 mdoc.c
--- mdoc.c	29 Aug 2010 11:29:51 -0000	1.164
+++ mdoc.c	27 Sep 2010 21:37:24 -0000
@@ -691,11 +691,11 @@ mdoc_ptext(struct mdoc *m, int line, cha
 			return(0);
 
 		/*
-		 * Insert a `Pp' in the case of a blank line.  Technically,
+		 * Insert a `sp' in the case of a blank line.  Technically,
 		 * blank lines aren't allowed, but enough manuals assume this
 		 * behaviour that we want to work around it.
 		 */
-		if ( ! mdoc_elem_alloc(m, line, offs, MDOC_Pp, NULL))
+		if ( ! mdoc_elem_alloc(m, line, offs, MDOC_sp, NULL))
 			return(0);
 
 		m->next = MDOC_NEXT_SIBLING;
@@ -758,14 +758,11 @@ mdoc_pmacro(struct mdoc *m, int ln, char
 
 	/* 
 	 * Copy the first word into a nil-terminated buffer.
-	 * Stop copying when a tab, space, backslash, or eoln is encountered.
+	 * Stop copying when a tab, space, or eoln is encountered.
 	 */
 
 	j = 0;
-	while (j < 4 && '\0' != buf[i] && 
-			' ' != buf[i] && 
-			'\t' != buf[i] && 
-			'\\' != buf[i])
+	while (j < 4 && '\0' != buf[i] && ' ' != buf[i] && '\t' != buf[i])
 		mac[j++] = buf[i++];
 	mac[j] = '\0';
 
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.190
diff -u -p -r1.190 mdoc_term.c
--- mdoc_term.c	27 Sep 2010 11:21:39 -0000	1.190
+++ mdoc_term.c	27 Sep 2010 21:37:27 -0000
@@ -81,7 +81,6 @@ static	void	  termp_lb_post(DECL_ARGS);
 static	void	  termp_nm_post(DECL_ARGS);
 static	void	  termp_pf_post(DECL_ARGS);
 static	void	  termp_quote_post(DECL_ARGS);
-static	void	  termp_quote_post(DECL_ARGS);
 static	void	  termp_sh_post(DECL_ARGS);
 static	void	  termp_ss_post(DECL_ARGS);
 
Index: mdoc_validate.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_validate.c,v
retrieving revision 1.118
diff -u -p -r1.118 mdoc_validate.c
--- mdoc_validate.c	27 Sep 2010 11:25:03 -0000	1.118
+++ mdoc_validate.c	27 Sep 2010 21:37:30 -0000
@@ -265,7 +265,7 @@ const	struct valids mdoc_valids[MDOC_MAX
 	{ NULL, NULL },				/* Dx */
 	{ NULL, posts_text },			/* %Q */
 	{ NULL, posts_notext },			/* br */
-	{ NULL, posts_sp },			/* sp */
+	{ pres_pp, posts_sp },			/* sp */
 	{ NULL, posts_text1 },			/* %U */
 	{ NULL, NULL },				/* Ta */
 };
Index: term_ps.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term_ps.c,v
retrieving revision 1.44
diff -u -p -r1.44 term_ps.c
--- term_ps.c	4 Sep 2010 20:18:53 -0000	1.44
+++ term_ps.c	27 Sep 2010 21:37:30 -0000
@@ -908,7 +908,7 @@ ps_pletter(struct termp *p, int c)
 
 	f = (int)p->engine.ps.lastf;
 
-	if (c <= 32 || (c - 32 > MAXCHAR)) {
+	if (c <= 32 || (c - 32 >= MAXCHAR)) {
 		ps_putchar(p, ' ');
 		p->engine.ps.pscol += (size_t)fonts[f].gly[0].wx;
 		return;


--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mdocml version 1.10.6 available
  2010-09-27 22:26 ` mdocml version 1.10.6 available Ingo Schwarze
@ 2010-09-27 22:44   ` Kristaps Dzonsons
  2010-09-27 23:29     ` Ingo Schwarze
  0 siblings, 1 reply; 3+ messages in thread
From: Kristaps Dzonsons @ 2010-09-27 22:44 UTC (permalink / raw)
  To: tech

> ... and you snoke in a few nice last-minute bug fixes,
> shortening the TODO list.  :-)

Ja, I forgot that I hadn't released since the calling convention change 
and wanted to push those out before people get too comfortable with the 
-W conventions.

These TODOs were really the low-hanging fruit, however.  The block stuff 
and the dreaded Bl-tab issues remain.

I want to focus on some structural changes in 1.10.7, such as throwing 
out {mdoc,man}_action in favour of validate.  This will probably bring 
with it a chunk of code reductions and clean-ups.  I'll probably end up 
fixing A. Kozlov's TODO item while I'm at it.

I'm also going to push around some header code as talked about quite 
some time ago.

Ingo & Joerg, do the downstream mdoclint scripts have any warnings that 
mandoc doesn't?  Beyond the `Pp' stuff I just added to the TODO (more 
low-hanging fruit).

> This is now merged to OpenBSD as well.
> While merging, i fixed a minor regression:
> Two successive blank lines must both be printed,
> even (horrors!) ouside literal mode.
> Both old and new groff agree on that.
> 
> I fixed that by interpreting blank lines as .sp (instead of .Pp)
> in mdoc.c, function mdoc_ptext(), and dropping .Pp before .sp
> in exactly the same way as .Pp before .Pp.

I'm fine with all of these patches (and embarrassed I didn't catch them 
myself---especially the Pp insertion in mdoc.c, ouch!).

Thanks again and good work!

Kristaps
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mdocml version 1.10.6 available
  2010-09-27 22:44   ` Kristaps Dzonsons
@ 2010-09-27 23:29     ` Ingo Schwarze
  0 siblings, 0 replies; 3+ messages in thread
From: Ingo Schwarze @ 2010-09-27 23:29 UTC (permalink / raw)
  To: tech

Hi Kristaps,

Kristaps Dzonsons wrote on Tue, Sep 28, 2010 at 12:44:44AM +0200:

> These TODOs were really the low-hanging fruit, however.
> The block stuff and the dreaded Bl-tab issues remain.

Yes, many of the TODOs are not terribly urgent, but good to keep
track of anyway.

Then ones i hear more complaints about are:

- In .Bl -column,
  .It Em Authentication<tab>Key Length
  ought to render "Key Length" with emphasis, too,
  see OpenBSD iked.conf(5).

- in enclosures, mandoc sometimes fancies a bogus end of sentence
  reminded by jmc@  Thu, 23 Sep 2010 18:13:39 +0059
 (Actually, that is a crime i committed, but i'm now focussing
  on exit codes because we need precision in that area for ports.)

- The characters "|" and "\*(Ba" should never be bold,
  not even in the middle of a word, e.g. ".Cm b\*(Bac" in
  "mknod [-m mode] name b|c major minor"
  in OpenBSD ksh(1)

> I want to focus on some structural changes in 1.10.7, such as
> throwing out {mdoc,man}_action in favour of validate.

Yes, i agree that is sane, even though it will cause churn.
We don't need two files for the same task.

> This will probably bring with it a chunk of code reductions and
> clean-ups.
> I'll probably end up fixing A. Kozlov's TODO item while I'm at it.

Sounds good, jmc@ also stumbled on that one.

> I'm also going to push around some header code as talked about quite
> some time ago.

If that is what i think you are talking about, i'm looking forward
to it, even though it will cause more churn.
But having utilities available everywhere will pay off.

I somehow feel the splitting of the code into three libraries -
even though theory likes libraries for reasons of reusability and
modularisation - to be more of a liability than an asset when
regarded from a point of view of getting practical work done...
At least we need to sort it such that stuff is available where
it is needed.

> Ingo & Joerg, do the downstream mdoclint scripts have any warnings
> that mandoc doesn't?  Beyond the `Pp' stuff I just added to the TODO
> (more low-hanging fruit).

Hmm, i'm planning to check - and, where needed, adjust - the warnings
and errors mandoc already has before looking at mdoclint in order
to add new ones.  There is no problem, though, with somebody starting
to look at mdoclint in parallel.

> I'm fine with all of these patches (and embarrassed I didn't catch
> them myself---especially the Pp insertion in mdoc.c, ouch!).

No sweat.  Hopefully, few people use double blank lines outside
literal mode, end ever fewer will suffer from losing half of them.

Yours,
  Ingo
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-09-27 23:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <4CA0912F.5040103@bsd.lv>
2010-09-27 22:26 ` mdocml version 1.10.6 available Ingo Schwarze
2010-09-27 22:44   ` Kristaps Dzonsons
2010-09-27 23:29     ` Ingo Schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).