* [PATCH] TODO entries for `Ns' and `No' spacing.
@ 2010-09-30 9:21 Kristaps Dzonsons
2010-10-01 0:23 ` Ingo Schwarze
0 siblings, 1 reply; 4+ messages in thread
From: Kristaps Dzonsons @ 2010-09-30 9:21 UTC (permalink / raw)
To: tech, jmc
[-- Attachment #1: Type: text/plain, Size: 663 bytes --]
Hi,
Can anybody Ok that this patch correctly handles the cases of `No' and
`Ns' with respect to spacing and without fallout? Cf. TODO items
- .No text No ) is "text )", not "text)"
see the terrible example
case word in [[(] pattern [| pattern] ... ) list ;; ] ... esac
in OpenBSD ksh(1)
- .It ${name Ns [ selector ] Ns }
should be "${name[selector]}" not "${name [selector]}"
This is parsed as
text("${name") text("[") Ns() text(selector)...
Opening punctuation should not fall out of .Ns.
see for example OpenBSD csh(1)
Note that the ellipsis suppresses whitespace because of the trailing
period. This is a new TODO.
Kristaps
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 3305 bytes --]
? .TODO.swp
? config.h
? config.log
? csh.1
? foo.1
? foo.1.html
? foo.3
? gcc.1
? ksh.1
? mandoc
? mandoc.core
? patch.txt
? regress/output
Index: mdoc_macro.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_macro.c,v
retrieving revision 1.94
diff -u -r1.94 mdoc_macro.c
--- mdoc_macro.c 26 Sep 2010 20:22:28 -0000 1.94
+++ mdoc_macro.c 30 Sep 2010 09:17:41 -0000
@@ -139,7 +139,7 @@
{ 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 }, /* 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: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.191
diff -u -r1.191 mdoc_term.c
--- mdoc_term.c 27 Sep 2010 23:03:44 -0000 1.191
+++ mdoc_term.c 30 Sep 2010 09:17:41 -0000
@@ -75,11 +75,11 @@
static void termp_bx_post(DECL_ARGS);
static void termp_d1_post(DECL_ARGS);
static void termp_fo_post(DECL_ARGS);
+static void termp_igndelim_post(DECL_ARGS);
static void termp_in_post(DECL_ARGS);
static void termp_it_post(DECL_ARGS);
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_sh_post(DECL_ARGS);
static void termp_ss_post(DECL_ARGS);
@@ -102,6 +102,7 @@
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);
@@ -109,7 +110,6 @@
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);
@@ -196,12 +196,12 @@
{ NULL, NULL }, /* Eo */
{ termp_xx_pre, NULL }, /* Fx */
{ termp_bold_pre, NULL }, /* Ms */
- { NULL, NULL }, /* No */
+ { termp_igndelim_pre, termp_igndelim_post }, /* 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_igndelim_post }, /* Pf */
{ termp_quote_pre, termp_quote_post }, /* Po */
{ termp_quote_pre, termp_quote_post }, /* Pq */
{ NULL, NULL }, /* Qc */
@@ -1684,7 +1684,7 @@
/* ARGSUSED */
static int
-termp_pf_pre(DECL_ARGS)
+termp_igndelim_pre(DECL_ARGS)
{
p->flags |= TERMP_IGNDELIM;
@@ -1694,11 +1694,12 @@
/* ARGSUSED */
static void
-termp_pf_post(DECL_ARGS)
+termp_igndelim_post(DECL_ARGS)
{
p->flags &= ~TERMP_IGNDELIM;
- p->flags |= TERMP_NOSPACE;
+ if (MDOC_Pf == n->tok)
+ p->flags |= TERMP_NOSPACE;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] TODO entries for `Ns' and `No' spacing.
2010-09-30 9:21 [PATCH] TODO entries for `Ns' and `No' spacing Kristaps Dzonsons
@ 2010-10-01 0:23 ` Ingo Schwarze
2010-10-01 20:49 ` Ingo Schwarze
0 siblings, 1 reply; 4+ messages in thread
From: Ingo Schwarze @ 2010-10-01 0:23 UTC (permalink / raw)
To: tech
Hi Kristaps,
Kristaps Dzonsons wrote on Thu, Sep 30, 2010 at 11:21:23AM +0200:
> Can anybody Ok that this patch correctly handles the cases of `No'
> and `Ns' with respect to spacing and without fallout? Cf. TODO
> items
>
> - .No text No ) is "text )", not "text)"
> see the terrible example
> case word in [[(] pattern [| pattern] ... ) list ;; ] ... esac
> in OpenBSD ksh(1)
>
> - .It ${name Ns [ selector ] Ns }
> should be "${name[selector]}" not "${name [selector]}"
> This is parsed as
> text("${name") text("[") Ns() text(selector)...
> Opening punctuation should not fall out of .Ns.
> see for example OpenBSD csh(1)
The .Ns part - i.e. the mdoc_macro.c patch - looks good and,
according to my tests, does the job.
The .No part - i.e. the mdoc_term.c patch - also looks good as far
as it goes, but does not seem to go far enough. It doesn't
solve the problem for me, yet.
To get it working, i need to add the following elements to
the patch:
- .No needs MDOC_IGNDELIM in mdoc_macro.c, too.
- .No must be allowed to have one child
(mdoc_macro.c and mdoc_validate.c).
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.
Yours,
Ingo
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 00:04:01 -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 */
@@ -1447,8 +1447,6 @@ in_line_argn(MACRO_PROT_ARGS)
switch (tok) {
case (MDOC_Ap):
- /* FALLTHROUGH */
- case (MDOC_No):
/* FALLTHROUGH */
case (MDOC_Ns):
/* FALLTHROUGH */
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 00:04:02 -0000
@@ -71,11 +71,11 @@ static void termp_bl_post(DECL_ARGS);
static void termp_bx_post(DECL_ARGS);
static void termp_d1_post(DECL_ARGS);
static void termp_fo_post(DECL_ARGS);
+static void termp_igndelim_post(DECL_ARGS);
static void termp_in_post(DECL_ARGS);
static void termp_it_post(DECL_ARGS);
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_sh_post(DECL_ARGS);
static void termp_ss_post(DECL_ARGS);
@@ -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, termp_igndelim_post }, /* 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_igndelim_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;
@@ -1690,11 +1690,12 @@ termp_pf_pre(DECL_ARGS)
/* ARGSUSED */
static void
-termp_pf_post(DECL_ARGS)
+termp_igndelim_post(DECL_ARGS)
{
p->flags &= ~TERMP_IGNDELIM;
- p->flags |= TERMP_NOSPACE;
+ if (MDOC_Pf == n->tok)
+ p->flags |= TERMP_NOSPACE;
}
Index: mdoc_validate.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/mdoc_validate.c,v
retrieving revision 1.70
diff -u -p -r1.70 mdoc_validate.c
--- mdoc_validate.c 27 Sep 2010 21:25:28 -0000 1.70
+++ mdoc_validate.c 1 Oct 2010 00:04:03 -0000
@@ -214,7 +214,7 @@ const struct valids mdoc_valids[MDOC_MAX
{ NULL, NULL }, /* Eo */
{ NULL, NULL }, /* Fx */
{ NULL, posts_text }, /* Ms */
- { NULL, posts_notext }, /* No */
+ { NULL, NULL }, /* No */
{ NULL, posts_notext }, /* Ns */
{ NULL, NULL }, /* Nx */
{ NULL, NULL }, /* Ox */
--
To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] TODO entries for `Ns' and `No' spacing.
2010-10-01 0:23 ` Ingo Schwarze
@ 2010-10-01 20:49 ` Ingo Schwarze
2010-10-01 20:52 ` Kristaps Dzonsons
0 siblings, 1 reply; 4+ messages in thread
From: Ingo Schwarze @ 2010-10-01 20:49 UTC (permalink / raw)
To: tech
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] TODO entries for `Ns' and `No' spacing.
2010-10-01 20:49 ` Ingo Schwarze
@ 2010-10-01 20:52 ` Kristaps Dzonsons
0 siblings, 0 replies; 4+ messages in thread
From: Kristaps Dzonsons @ 2010-10-01 20:52 UTC (permalink / raw)
To: tech
>> 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
>
> Received: from mx3.kth.se (130.237.48.97) by EXHUB2.ug.kth.se (130.237.32.137)
> with Microsoft SMTP Server id 14.0.702.0; Fri, 1 Oct 2010 22:50:12 +0200
> X-KTH-mail-from: kristaps+caf_=kristaps=kth.se@bsd.lv
> X-KTH-rcpt-to: kristaps@ug.kth.se
> Received: from mx4.kth.se (mx4.kth.se [130.237.48.62]) by mx3.kth.se (Postfix)
> with ESMTP id EE8B468135 for <kristaps@ug.kth.se>; Fri, 1 Oct 2010 22:50:11
> +0200 (CEST)
> X-Virus-Scanned: by amavisd-new at kth.se
> X-Spam-Flag: NO
> X-Spam-Score: 0.001
> X-Spam-Level:
> X-Spam-Status: No, score=0.001 tagged_above=-200 required=5
> tests=[BAYES_50=0.001] autolearn=no
> Received: from mx3.kth.se ([130.237.48.97]) by mx4.kth.se (mx4.kth.se
> [130.237.48.62]) (amavisd-new, port 10024) with LMTP id LOSsZjDKi1hN for
> <kristaps@ug.kth.se>; Fri, 1 Oct 2010 22:50:09 +0200 (CEST)
> X-KTH-mail-from: kristaps+caf_=kristaps=kth.se@bsd.lv
> X-KTH-rcpt-to: kristaps@kth.se
> Received: from mail-px0-f173.google.com (mail-px0-f173.google.com
> [209.85.212.173]) by mx3.kth.se (Postfix) with ESMTP id 7CC416970A for
> <kristaps@kth.se>; Fri, 1 Oct 2010 22:50:06 +0200 (CEST)
> Received: by pxi12 with SMTP id 12so1062665pxi.18 for
> <kristaps@kth.se>; Fri, 01 Oct 2010 13:50:05 -0700 (PDT)
> Received: by 10.142.231.11 with SMTP id d11mr5236398wfh.222.1285966205370;
> Fri, 01 Oct 2010 13:50:05 -0700 (PDT)
> X-Forwarded-To: kristaps@kth.se
> X-Forwarded-For: kristaps@bsd.lv kristaps@kth.se
> Delivered-To: kristaps@bsd.lv
> Received: by 10.142.203.10 with SMTP id a10cs55009wfg; Fri, 1 Oct 2010
> 13:50:05 -0700 (PDT)
> Received: by 10.224.43.232 with SMTP id x40mr4225959qae.73.1285966203834;
> Fri, 01 Oct 2010 13:50:03 -0700 (PDT)
> Received: from krisdoz.my.domain (66.111.2.196.static.nyinternet.net
> [66.111.2.196]) by mx.google.com with ESMTP id
> t34si3062683qco.81.2010.10.01.13.50.02; Fri, 01 Oct 2010 13:50:03
> -0700 (PDT)
> Received-SPF: neutral (google.com: 66.111.2.196 is neither permitted nor denied by best guess record for domain of tech+bounces-164-kristaps=bsd.lv@mdocml.bsd.lv) client-ip=66.111.2.196;
> Authentication-Results: mx.google.com; spf=neutral (google.com: 66.111.2.196 is neither permitted nor denied by best guess record for domain of tech+bounces-164-kristaps=bsd.lv@mdocml.bsd.lv) smtp.mail=tech+bounces-164-kristaps=bsd.lv@mdocml.bsd.lv
> Received: from krisdoz.my.domain (daemon@localhost [127.0.0.1]) by
> krisdoz.my.domain (8.14.3/8.14.3) with SMTP id o91Ko1nq002554 for
> <kristaps@bsd.lv>; Fri, 1 Oct 2010 16:50:01 -0400 (EDT)
> Received: from smtp1.rz.uni-karlsruhe.de
> (Debian-exim@smtp1.rz.uni-karlsruhe.de [129.13.185.217]) by krisdoz.my.domain
> (8.14.3/8.14.3) with ESMTP id o91KnwVL020030 for <tech@mdocml.bsd.lv>; Fri, 1
> Oct 2010 16:50:01 -0400 (EDT)
> Received: from hekate.usta.de (asta-nat.asta.uni-karlsruhe.de [172.22.63.82])
> by smtp1.rz.uni-karlsruhe.de with esmtp (Exim 4.63 #1) id 1P1mYG-0005H4-7b;
> Fri, 01 Oct 2010 22:49:56 +0200
> Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with
> esmtp (Exim 4.71) (envelope-from <schwarze@usta.de>) id 1P1mYG-0006uz-6k for
> tech@mdocml.bsd.lv; Fri, 01 Oct 2010 22:49:56 +0200
> Received: from iris.usta.de ([172.24.96.5] helo=usta.de) by
> donnerwolke.usta.de with esmtp (Exim 4.69) (envelope-from <schwarze@usta.de>)
> id 1P1mYG-0004CX-5e for tech@mdocml.bsd.lv; Fri, 01 Oct 2010 22:49:56 +0200
> Received: from schwarze by usta.de with local (Exim 4.71) (envelope-from
> <schwarze@usta.de>) id 1P1mYG-0005dl-0L for tech@mdocml.bsd.lv; Fri, 01 Oct
> 2010 22:49:56 +0200
> Date: Fri, 1 Oct 2010 22:49:55 +0200
> From: Ingo Schwarze <schwarze@usta.de>
> To: <tech@mdocml.bsd.lv>
> Subject: Re: [PATCH] TODO entries for `Ns' and `No' spacing.
> Message-ID: <20101001204955.GA17696@iris.usta.de>
> References: <4CA45693.10809@bsd.lv>
> <20101001002311.GB10250@iris.usta.de>
> X-Mailinglist: mdocml-tech
> Reply-To: <tech@mdocml.bsd.lv>
> Content-Type: text/plain; charset="us-ascii"
> Content-Disposition: inline
> In-Reply-To: <20101001002311.GB10250@iris.usta.de>
> User-Agent: Mutt/1.5.20 (2009-06-14)
> Return-Path: kristaps+caf_=kristaps=kth.se@bsd.lv
> X-MS-Exchange-Organization-AuthSource: EXHUB2.ug.kth.se
> X-MS-Exchange-Organization-AuthAs: Anonymous
> X-MS-Exchange-Organization-AVStamp-Mailbox: MSFTFF;1;0;0 0 0
> MIME-Version: 1.0
>
> 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
Ingo, what the hell? You beat me to the same solution!
Pop it in!
Kristaps
--
To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-10-01 20:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-30 9:21 [PATCH] TODO entries for `Ns' and `No' spacing Kristaps Dzonsons
2010-10-01 0:23 ` Ingo Schwarze
2010-10-01 20:49 ` Ingo Schwarze
2010-10-01 20:52 ` Kristaps Dzonsons
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).