tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: tech@mdocml.bsd.lv
Subject: Re: [PATCH] TODO entries for `Ns' and `No' spacing.
Date: Fri, 1 Oct 2010 22:49:55 +0200	[thread overview]
Message-ID: <20101001204955.GA17696@iris.usta.de> (raw)
In-Reply-To: <20101001002311.GB10250@iris.usta.de>

Replying to myself...

Ingo Schwarze wrote on Fri, Oct 01, 2010 at 02:23:12AM +0200:

> With the updated patch included below, i do not see the two
> problems any longer, and i see no regressions.  I'm not sure
> that solution is ideal, though; the trick to get TERMP_IGNDELIM
> to the right places by limiting .No to one argument looks
> rather artificial.  But i'm too tired now to rethink that.

It worked, but it was crap all the same.
Here is a better solution.

Observe that TERMP_IGNDELIM and HTML_IGNDELIM only act on the
beginning of one single word, since MDOC_Pf can only have one
argument.  Thus, make them follow the same logic as TERMP_NOSPACE:
clear after use.

That way, we can use the same *_igndelim_pre functions for .No and .Pf,
we can cut down the *_pf_post functions to half the amount of code
(wow! ;) and we don't need any post function for No.

Both .Pf and .No extensively tested manually, builds all OpenBSD
manuals, no regressions in src/bin and src/sbin, no regressions
in my test suites, fixes a few spacing issues in csh.1 and ksh.1.

OK to commit?
  Ingo


Index: html.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/html.c,v
retrieving revision 1.16
diff -u -p -r1.16 html.c
--- html.c	27 Sep 2010 21:25:28 -0000	1.16
+++ html.c	1 Oct 2010 20:32:26 -0000
@@ -548,6 +548,8 @@ print_text(struct html *h, const char *w
 		if ( ! (h->flags & HTML_NONOSPACE))
 			h->flags &= ~HTML_NOSPACE;
 
+	h->flags &= ~HTML_IGNDELIM;
+
 	/* 
 	 * Note that we don't process the pipe: the parser sees it as
 	 * punctuation, but we don't in terms of typography.
Index: mdoc_html.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/mdoc_html.c,v
retrieving revision 1.33
diff -u -p -r1.33 mdoc_html.c
--- mdoc_html.c	27 Sep 2010 21:25:28 -0000	1.33
+++ mdoc_html.c	1 Oct 2010 20:32:31 -0000
@@ -87,6 +87,7 @@ static	int		  mdoc_ex_pre(MDOC_ARGS);
 static	void		  mdoc_fo_post(MDOC_ARGS);
 static	int		  mdoc_fo_pre(MDOC_ARGS);
 static	int		  mdoc_ic_pre(MDOC_ARGS);
+static	int		  mdoc_igndelim_pre(MDOC_ARGS);
 static	int		  mdoc_in_pre(MDOC_ARGS);
 static	int		  mdoc_it_block_pre(MDOC_ARGS, enum mdoc_list,
 				int, struct roffsu *, struct roffsu *);
@@ -105,7 +106,6 @@ static	int		  mdoc_nm_pre(MDOC_ARGS);
 static	int		  mdoc_ns_pre(MDOC_ARGS);
 static	int		  mdoc_pa_pre(MDOC_ARGS);
 static	void		  mdoc_pf_post(MDOC_ARGS);
-static	int		  mdoc_pf_pre(MDOC_ARGS);
 static	void		  mdoc_quote_post(MDOC_ARGS);
 static	int		  mdoc_quote_pre(MDOC_ARGS);
 static	int		  mdoc_rs_pre(MDOC_ARGS);
@@ -195,12 +195,12 @@ static	const struct htmlmdoc mdocs[MDOC_
 	{NULL, NULL}, /* Eo */
 	{mdoc_xx_pre, NULL}, /* Fx */
 	{mdoc_ms_pre, NULL}, /* Ms */
-	{NULL, NULL}, /* No */
+	{mdoc_igndelim_pre, NULL}, /* No */
 	{mdoc_ns_pre, NULL}, /* Ns */
 	{mdoc_xx_pre, NULL}, /* Nx */
 	{mdoc_xx_pre, NULL}, /* Ox */
 	{NULL, NULL}, /* Pc */
-	{mdoc_pf_pre, mdoc_pf_post}, /* Pf */
+	{mdoc_igndelim_pre, mdoc_pf_post}, /* Pf */
 	{mdoc_quote_pre, mdoc_quote_post}, /* Po */
 	{mdoc_quote_pre, mdoc_quote_post}, /* Pq */
 	{NULL, NULL}, /* Qc */
@@ -1907,7 +1907,7 @@ mdoc_ms_pre(MDOC_ARGS)
 
 /* ARGSUSED */
 static int
-mdoc_pf_pre(MDOC_ARGS)
+mdoc_igndelim_pre(MDOC_ARGS)
 {
 
 	h->flags |= HTML_IGNDELIM;
@@ -1920,7 +1920,6 @@ static void
 mdoc_pf_post(MDOC_ARGS)
 {
 
-	h->flags &= ~HTML_IGNDELIM;
 	h->flags |= HTML_NOSPACE;
 }
 
Index: mdoc_macro.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/mdoc_macro.c,v
retrieving revision 1.56
diff -u -p -r1.56 mdoc_macro.c
--- mdoc_macro.c	26 Sep 2010 20:19:58 -0000	1.56
+++ mdoc_macro.c	1 Oct 2010 20:32:39 -0000
@@ -134,8 +134,8 @@ const	struct mdoc_macro __mdoc_macros[MD
 	{ blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Eo */
 	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Fx */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ms */
-	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* No */
-	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Ns */
+	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED | MDOC_IGNDELIM }, /* No */
+	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED | MDOC_IGNDELIM }, /* Ns */
 	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Nx */
 	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Ox */
 	{ blk_exp_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Pc */
Index: mdoc_term.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/mdoc_term.c,v
retrieving revision 1.108
diff -u -p -r1.108 mdoc_term.c
--- mdoc_term.c	27 Sep 2010 21:25:28 -0000	1.108
+++ mdoc_term.c	1 Oct 2010 20:32:43 -0000
@@ -98,6 +98,7 @@ static	int	  termp_fl_pre(DECL_ARGS);
 static	int	  termp_fn_pre(DECL_ARGS);
 static	int	  termp_fo_pre(DECL_ARGS);
 static	int	  termp_ft_pre(DECL_ARGS);
+static	int	  termp_igndelim_pre(DECL_ARGS);
 static	int	  termp_in_pre(DECL_ARGS);
 static	int	  termp_it_pre(DECL_ARGS);
 static	int	  termp_li_pre(DECL_ARGS);
@@ -105,7 +106,6 @@ static	int	  termp_lk_pre(DECL_ARGS);
 static	int	  termp_nd_pre(DECL_ARGS);
 static	int	  termp_nm_pre(DECL_ARGS);
 static	int	  termp_ns_pre(DECL_ARGS);
-static	int	  termp_pf_pre(DECL_ARGS);
 static	int	  termp_quote_pre(DECL_ARGS);
 static	int	  termp_rs_pre(DECL_ARGS);
 static	int	  termp_rv_pre(DECL_ARGS);
@@ -192,12 +192,12 @@ static	const struct termact termacts[MDO
 	{ NULL, NULL }, /* Eo */
 	{ termp_xx_pre, NULL }, /* Fx */
 	{ termp_bold_pre, NULL }, /* Ms */
-	{ NULL, NULL }, /* No */
+	{ termp_igndelim_pre, NULL }, /* No */
 	{ termp_ns_pre, NULL }, /* Ns */
 	{ termp_xx_pre, NULL }, /* Nx */
 	{ termp_xx_pre, NULL }, /* Ox */
 	{ NULL, NULL }, /* Pc */
-	{ termp_pf_pre, termp_pf_post }, /* Pf */
+	{ termp_igndelim_pre, termp_pf_post }, /* Pf */
 	{ termp_quote_pre, termp_quote_post }, /* Po */
 	{ termp_quote_pre, termp_quote_post }, /* Pq */
 	{ NULL, NULL }, /* Qc */
@@ -1680,7 +1680,7 @@ termp_xx_pre(DECL_ARGS)
 
 /* ARGSUSED */
 static int
-termp_pf_pre(DECL_ARGS)
+termp_igndelim_pre(DECL_ARGS)
 {
 
 	p->flags |= TERMP_IGNDELIM;
@@ -1693,7 +1693,6 @@ static void
 termp_pf_post(DECL_ARGS)
 {
 
-	p->flags &= ~TERMP_IGNDELIM;
 	p->flags |= TERMP_NOSPACE;
 }
 
Index: term.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/term.c,v
retrieving revision 1.51
diff -u -p -r1.51 term.c
--- term.c	23 Sep 2010 20:22:31 -0000	1.51
+++ term.c	1 Oct 2010 20:32:43 -0000
@@ -501,7 +501,7 @@ term_word(struct termp *p, const char *w
 	else
 		p->flags |= TERMP_NOSPACE;
 
-	p->flags &= ~TERMP_SENTENCE;
+	p->flags &= ~(TERMP_SENTENCE | TERMP_IGNDELIM);
 
 	while (*word) {
 		if ((ssz = strcspn(word, "\\")) > 0)
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

  reply	other threads:[~2010-10-01 20:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-30  9:21 Kristaps Dzonsons
2010-10-01  0:23 ` Ingo Schwarze
2010-10-01 20:49   ` Ingo Schwarze [this message]
2010-10-01 20:52     ` Kristaps Dzonsons

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=20101001204955.GA17696@iris.usta.de \
    --to=schwarze@usta.de \
    --cc=tech@mdocml.bsd.lv \
    /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;
as well as URLs for NNTP newsgroup(s).