source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Move .sp to the roff modules.
@ 2017-05-05 15:18 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2017-05-05 15:18 UTC (permalink / raw)
  To: source

Log Message:
-----------
Move .sp to the roff modules.  Enough infrastructure is in place
now that this actually saves code: -70 LOC.

Modified Files:
--------------
    mdocml:
        man.c
        man_html.c
        man_macro.c
        man_term.c
        man_validate.c
        mandocdb.c
        mdoc.c
        mdoc_argv.c
        mdoc_html.c
        mdoc_macro.c
        mdoc_man.c
        mdoc_markdown.c
        mdoc_state.c
        mdoc_term.c
        mdoc_validate.c
        roff.c
        roff.h
        roff_html.c
        roff_term.c
        roff_validate.c
    mdocml/regress/man/blank:
        line.out_lint
    mdocml/regress/mdoc/Pp:
        arg.out_lint
    mdocml/regress/roff/cond:
        close.out_lint

Revision Data
-------------
Index: arg.out_lint
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/mdoc/Pp/arg.out_lint,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lregress/mdoc/Pp/arg.out_lint -Lregress/mdoc/Pp/arg.out_lint -u -p -r1.2 -r1.3
--- regress/mdoc/Pp/arg.out_lint
+++ regress/mdoc/Pp/arg.out_lint
@@ -1,3 +1,3 @@
 mandoc: arg.in:11:5: ERROR: skipping all arguments: br drop this
+mandoc: arg.in:13:8: ERROR: skipping excess arguments: sp ... drop this
 mandoc: arg.in:9:2: ERROR: skipping all arguments: Pp drop
-mandoc: arg.in:13:8: ERROR: skipping excess arguments: sp ... drop
Index: roff_term.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/roff_term.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lroff_term.c -Lroff_term.c -u -p -r1.3 -r1.4
--- roff_term.c
+++ roff_term.c
@@ -1,6 +1,6 @@
 /*	$OpenBSD$ */
 /*
- * Copyright (c) 2010, 2014, 2017 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -30,11 +30,13 @@ typedef	void	(*roff_term_pre_fp)(ROFF_TE
 static	void	  roff_term_pre_br(ROFF_TERM_ARGS);
 static	void	  roff_term_pre_ft(ROFF_TERM_ARGS);
 static	void	  roff_term_pre_ll(ROFF_TERM_ARGS);
+static	void	  roff_term_pre_sp(ROFF_TERM_ARGS);
 
 static	const roff_term_pre_fp roff_term_pre_acts[ROFF_MAX] = {
 	roff_term_pre_br,  /* br */
 	roff_term_pre_ft,  /* ft */
 	roff_term_pre_ll,  /* ft */
+	roff_term_pre_sp,  /* br */
 };
 
 
@@ -86,4 +88,26 @@ static void
 roff_term_pre_ll(ROFF_TERM_ARGS)
 {
 	term_setwidth(p, n->child != NULL ? n->child->string : NULL);
+}
+
+static void
+roff_term_pre_sp(ROFF_TERM_ARGS)
+{
+	struct roffsu	 su;
+	int		 len;
+
+	if (n->child != NULL) {
+		if (a2roffsu(n->child->string, &su, SCALE_VS) == 0)
+			su.scale = 1.0;
+		len = term_vspan(p, &su);
+	} else
+		len = 1;
+
+	if (len < 0)
+		p->skipvsp -= len;
+	else
+		while (len--)
+			term_vspace(p);
+
+	roff_term_pre_br(p, n);
 }
Index: mdoc_macro.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_macro.c,v
retrieving revision 1.222
retrieving revision 1.223
diff -Lmdoc_macro.c -Lmdoc_macro.c -u -p -r1.222 -r1.223
--- mdoc_macro.c
+++ mdoc_macro.c
@@ -197,7 +197,6 @@ const	struct mdoc_macro __mdoc_macros[MD
 	{ blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* En */
 	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Dx */
 	{ in_line_eoln, MDOC_JOIN }, /* %Q */
-	{ in_line_eoln, 0 }, /* sp */
 	{ in_line_eoln, 0 }, /* %U */
 	{ phrase_ta, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Ta */
 };
@@ -249,9 +248,8 @@ lookup(struct roff_man *mdoc, int from, 
 		if (res != TOKEN_NONE) {
 			if (mdoc_macros[res].flags & MDOC_CALLABLE)
 				return res;
-			if (res != MDOC_sp)
-				mandoc_msg(MANDOCERR_MACRO_CALL,
-				    mdoc->parse, line, ppos, p);
+			mandoc_msg(MANDOCERR_MACRO_CALL,
+			    mdoc->parse, line, ppos, p);
 		}
 	}
 	return TOKEN_NONE;
Index: mandocdb.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandocdb.c,v
retrieving revision 1.248
retrieving revision 1.249
diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.248 -r1.249
--- mandocdb.c
+++ mandocdb.c
@@ -302,7 +302,6 @@ static	const struct mdoc_handler __mdocs
 	{ NULL, 0, 0 },  /* En */
 	{ NULL, TYPE_Dx, NODE_NOSRC },  /* Dx */
 	{ NULL, 0, 0 },  /* %Q */
-	{ NULL, 0, 0 },  /* sp */
 	{ NULL, 0, 0 },  /* %U */
 	{ NULL, 0, 0 },  /* Ta */
 };
Index: man_term.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/man_term.c,v
retrieving revision 1.196
retrieving revision 1.197
diff -Lman_term.c -Lman_term.c -u -p -r1.196 -r1.197
--- man_term.c
+++ man_term.c
@@ -83,7 +83,6 @@ static	int		  pre_alternate(DECL_ARGS);
 static	int		  pre_ign(DECL_ARGS);
 static	int		  pre_in(DECL_ARGS);
 static	int		  pre_literal(DECL_ARGS);
-static	int		  pre_sp(DECL_ARGS);
 
 static	void		  post_IP(DECL_ARGS);
 static	void		  post_HP(DECL_ARGS);
@@ -114,7 +113,6 @@ static	const struct termact __termacts[M
 	{ pre_I, NULL, 0 }, /* I */
 	{ pre_alternate, NULL, 0 }, /* IR */
 	{ pre_alternate, NULL, 0 }, /* RI */
-	{ pre_sp, NULL, MAN_NOTEXT }, /* sp */
 	{ pre_literal, NULL, 0 }, /* nf */
 	{ pre_literal, NULL, 0 }, /* fi */
 	{ NULL, NULL, 0 }, /* RE */
@@ -387,55 +385,6 @@ pre_in(DECL_ARGS)
 		p->offset = v;
 	if (p->offset > SHRT_MAX)
 		p->offset = term_len(p, p->defindent);
-
-	return 0;
-}
-
-static int
-pre_sp(DECL_ARGS)
-{
-	struct roffsu	 su;
-	int		 i, len;
-
-	if ((NULL == n->prev && n->parent)) {
-		switch (n->parent->tok) {
-		case MAN_SH:
-		case MAN_SS:
-		case MAN_PP:
-		case MAN_LP:
-		case MAN_P:
-			return 0;
-		default:
-			break;
-		}
-	}
-
-	if (n->child == NULL)
-		len = 1;
-	else {
-		if ( ! a2roffsu(n->child->string, &su, SCALE_VS))
-			su.scale = 1.0;
-		len = term_vspan(p, &su);
-	}
-
-	if (len == 0)
-		term_newln(p);
-	else if (len < 0)
-		p->skipvsp -= len;
-	else
-		for (i = 0; i < len; i++)
-			term_vspace(p);
-
-	/*
-	 * Handle an explicit break request in the same way
-	 * as an overflowing line.
-	 */
-
-	if (p->flags & TERMP_BRIND) {
-		p->offset = p->rmargin;
-		p->rmargin = p->maxrmargin;
-		p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND);
-	}
 
 	return 0;
 }
Index: mdoc_man.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_man.c,v
retrieving revision 1.112
retrieving revision 1.113
diff -Lmdoc_man.c -Lmdoc_man.c -u -p -r1.112 -r1.113
--- mdoc_man.c
+++ mdoc_man.c
@@ -73,7 +73,6 @@ static	void	  post_nm(DECL_ARGS);
 static	void	  post_percent(DECL_ARGS);
 static	void	  post_pf(DECL_ARGS);
 static	void	  post_sect(DECL_ARGS);
-static	void	  post_sp(DECL_ARGS);
 static	void	  post_vt(DECL_ARGS);
 static	int	  pre__t(DECL_ARGS);
 static	int	  pre_an(DECL_ARGS);
@@ -109,7 +108,7 @@ static	int	  pre_ns(DECL_ARGS);
 static	int	  pre_pp(DECL_ARGS);
 static	int	  pre_rs(DECL_ARGS);
 static	int	  pre_sm(DECL_ARGS);
-static	int	  pre_sp(DECL_ARGS);
+static	void	  pre_sp(DECL_ARGS);
 static	int	  pre_sect(DECL_ARGS);
 static	int	  pre_sy(DECL_ARGS);
 static	void	  pre_syn(const struct roff_node *);
@@ -128,6 +127,7 @@ static	const void_fp roff_manacts[ROFF_M
 	pre_br,
 	pre_ft,
 	pre_ll,
+	pre_sp,
 };
 
 static	const struct manact __manacts[MDOC_MAX - MDOC_Dd] = {
@@ -249,7 +249,6 @@ static	const struct manact __manacts[MDO
 	{ cond_body, pre_en, post_en, NULL, NULL }, /* En */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Dx */
 	{ NULL, NULL, post_percent, NULL, NULL }, /* %Q */
-	{ NULL, pre_sp, post_sp, NULL, NULL }, /* sp */
 	{ NULL, NULL, post_percent, NULL, NULL }, /* %U */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Ta */
 };
@@ -1694,22 +1693,17 @@ pre_sm(DECL_ARGS)
 	return 0;
 }
 
-static int
+static void
 pre_sp(DECL_ARGS)
 {
-
-	if (MMAN_PP & outflags) {
+	if (outflags & MMAN_PP) {
 		outflags &= ~MMAN_PP;
 		print_line(".PP", 0);
-	} else
+	} else {
 		print_line(".sp", 0);
-	return 1;
-}
-
-static void
-post_sp(DECL_ARGS)
-{
-
+		if (n->child != NULL)
+			print_word(n->child->string);
+	}
 	outflags |= MMAN_nl;
 }
 
Index: roff.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/roff.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -Lroff.h -Lroff.h -u -p -r1.45 -r1.46
--- roff.h
+++ roff.h
@@ -69,6 +69,7 @@ enum	roff_tok {
 	ROFF_br = 0,
 	ROFF_ft,
 	ROFF_ll,
+	ROFF_sp,
 	ROFF_MAX,
 	ROFF_ab,
 	ROFF_ad,
@@ -261,7 +262,6 @@ enum	roff_tok {
 	ROFF_shift,
 	ROFF_sizes,
 	ROFF_so,
-	/* MAN_sp, MDOC_sp */
 	ROFF_spacewidth,
 	ROFF_special,
 	ROFF_spreadwarn,
@@ -429,7 +429,6 @@ enum	roff_tok {
 	MDOC_En,
 	MDOC_Dx,
 	MDOC__Q,
-	MDOC_sp,
 	MDOC__U,
 	MDOC_Ta,
 	MDOC_MAX,
@@ -453,7 +452,6 @@ enum	roff_tok {
 	MAN_I,
 	MAN_IR,
 	MAN_RI,
-	MAN_sp,
 	MAN_nf,
 	MAN_fi,
 	MAN_RE,
Index: mdoc_term.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_term.c,v
retrieving revision 1.354
retrieving revision 1.355
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.354 -r1.355
--- mdoc_term.c
+++ mdoc_term.c
@@ -115,7 +115,7 @@ static	int	  termp_rs_pre(DECL_ARGS);
 static	int	  termp_sh_pre(DECL_ARGS);
 static	int	  termp_skip_pre(DECL_ARGS);
 static	int	  termp_sm_pre(DECL_ARGS);
-static	int	  termp_sp_pre(DECL_ARGS);
+static	int	  termp_pp_pre(DECL_ARGS);
 static	int	  termp_ss_pre(DECL_ARGS);
 static	int	  termp_sy_pre(DECL_ARGS);
 static	int	  termp_tag_pre(DECL_ARGS);
@@ -130,7 +130,7 @@ static	const struct termact __termacts[M
 	{ NULL, NULL }, /* Os */
 	{ termp_sh_pre, termp_sh_post }, /* Sh */
 	{ termp_ss_pre, termp_ss_post }, /* Ss */
-	{ termp_sp_pre, NULL }, /* Pp */
+	{ termp_pp_pre, NULL }, /* Pp */
 	{ termp_d1_pre, termp_bl_post }, /* D1 */
 	{ termp_d1_pre, termp_bl_post }, /* Dl */
 	{ termp_bd_pre, termp_bd_post }, /* Bd */
@@ -232,7 +232,7 @@ static	const struct termact __termacts[M
 	{ termp_under_pre, NULL }, /* Fr */
 	{ NULL, NULL }, /* Ud */
 	{ NULL, termp_lb_post }, /* Lb */
-	{ termp_sp_pre, NULL }, /* Lp */
+	{ termp_pp_pre, NULL }, /* Lp */
 	{ termp_lk_pre, NULL }, /* Lk */
 	{ termp_under_pre, NULL }, /* Mt */
 	{ termp_quote_pre, termp_quote_post }, /* Brq */
@@ -243,7 +243,6 @@ static	const struct termact __termacts[M
 	{ termp_quote_pre, termp_quote_post }, /* En */
 	{ termp_xx_pre, termp_xx_post }, /* Dx */
 	{ NULL, termp____post }, /* %Q */
-	{ termp_sp_pre, NULL }, /* sp */
 	{ NULL, termp____post }, /* %U */
 	{ NULL, NULL }, /* Ta */
 };
@@ -1495,9 +1494,9 @@ termp_bd_pre(DECL_ARGS)
 		 * anyway, so don't sweat it.
 		 */
 		switch (nn->tok) {
-		case MDOC_Sm:
 		case ROFF_br:
-		case MDOC_sp:
+		case ROFF_sp:
+		case MDOC_Sm:
 		case MDOC_Bl:
 		case MDOC_D1:
 		case MDOC_Dl:
@@ -1644,37 +1643,10 @@ termp_in_post(DECL_ARGS)
 }
 
 static int
-termp_sp_pre(DECL_ARGS)
+termp_pp_pre(DECL_ARGS)
 {
-	struct roffsu	 su;
-	int		 i, len;
-
-	switch (n->tok) {
-	case MDOC_sp:
-		if (n->child) {
-			if ( ! a2roffsu(n->child->string, &su, SCALE_VS))
-				su.scale = 1.0;
-			len = term_vspan(p, &su);
-		} else
-			len = 1;
-		break;
-	case ROFF_br:
-		len = 0;
-		break;
-	default:
-		len = 1;
-		fn_prio = 0;
-		break;
-	}
-
-	if (0 == len)
-		term_newln(p);
-	else if (len < 0)
-		p->skipvsp -= len;
-	else
-		for (i = 0; i < len; i++)
-			term_vspace(p);
-
+	fn_prio = 0;
+	term_vspace(p);
 	return 0;
 }
 
Index: mdoc_markdown.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_markdown.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -Lmdoc_markdown.c -Lmdoc_markdown.c -u -p -r1.20 -r1.21
--- mdoc_markdown.c
+++ mdoc_markdown.c
@@ -222,7 +222,6 @@ static	const struct md_act __md_acts[MDO
 	{ md_cond_body, md_pre_En, md_post_En, NULL, NULL }, /* En */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Dx */
 	{ NULL, NULL, md_post_pc, NULL, NULL }, /* %Q */
-	{ NULL, md_pre_Pp, NULL, NULL, NULL }, /* sp */
 	{ NULL, md_pre_Lk, md_post_pc, NULL, NULL }, /* %U */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Ta */
 };
@@ -322,6 +321,9 @@ md_node(struct roff_node *n)
 		switch (n->tok) {
 		case ROFF_br:
 			process_children = md_pre_br(n);
+			break;
+		case ROFF_sp:
+			process_children = md_pre_Pp(n);
 			break;
 		default:
 			process_children = 0;
Index: roff_html.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/roff_html.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lroff_html.c -Lroff_html.c -u -p -r1.2 -r1.3
--- roff_html.c
+++ roff_html.c
@@ -1,6 +1,7 @@
 /*	$OpenBSD$ */
 /*
- * Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv>
+ * Copyright (c) 2014, 2017 Ingo Schwarze <schwarze@openbsd.org>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -28,10 +29,13 @@
 typedef	void	(*roff_html_pre_fp)(ROFF_HTML_ARGS);
 
 static	void	  roff_html_pre_br(ROFF_HTML_ARGS);
+static	void	  roff_html_pre_sp(ROFF_HTML_ARGS);
 
 static	const roff_html_pre_fp roff_html_pre_acts[ROFF_MAX] = {
 	roff_html_pre_br,  /* br */
 	NULL,  /* ft */
+	NULL,  /* ll */
+	roff_html_pre_sp,  /* sp */
 };
 
 
@@ -47,5 +51,21 @@ static void
 roff_html_pre_br(ROFF_HTML_ARGS)
 {
 	print_otag(h, TAG_DIV, "");
+	print_text(h, "\\~");  /* So the div isn't empty. */
+}
+
+static void
+roff_html_pre_sp(ROFF_HTML_ARGS)
+{
+	struct roffsu	 su;
+
+	SCALE_VS_INIT(&su, 1);
+	if ((n = n->child) != NULL) {
+		if (a2roffsu(n->string, &su, SCALE_VS) == 0)
+			su.scale = 1.0;
+		else if (su.scale < 0.0)
+			su.scale = 0.0;
+	}
+	print_otag(h, TAG_DIV, "suh", &su);
 	print_text(h, "\\~");  /* So the div isn't empty. */
 }
Index: man_html.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/man_html.c,v
retrieving revision 1.140
retrieving revision 1.141
diff -Lman_html.c -Lman_html.c -u -p -r1.140 -r1.141
--- man_html.c
+++ man_html.c
@@ -69,7 +69,6 @@ static	int		  man_ign_pre(MAN_ARGS);
 static	int		  man_in_pre(MAN_ARGS);
 static	void		  man_root_post(MAN_ARGS);
 static	void		  man_root_pre(MAN_ARGS);
-static	int		  man_sp_pre(MAN_ARGS);
 
 static	const struct htmlman __mans[MAN_MAX - MAN_TH] = {
 	{ NULL, NULL }, /* TH */
@@ -92,7 +91,6 @@ static	const struct htmlman __mans[MAN_M
 	{ man_I_pre, NULL }, /* I */
 	{ man_alt_pre, NULL }, /* IR */
 	{ man_alt_pre, NULL }, /* RI */
-	{ man_sp_pre, NULL }, /* sp */
 	{ NULL, NULL }, /* nf */
 	{ NULL, NULL }, /* fi */
 	{ NULL, NULL }, /* RE */
@@ -304,6 +302,7 @@ print_man_node(MAN_ARGS)
 		t = h->tag;
 		if (n->tok < ROFF_MAX) {
 			roff_html_pre(h, n);
+			child = 0;
 			break;
 		}
 
@@ -411,25 +410,6 @@ man_root_post(MAN_ARGS)
 	if (man->os)
 		print_text(h, man->os);
 	print_tagq(h, t);
-}
-
-
-static int
-man_sp_pre(MAN_ARGS)
-{
-	struct roffsu	 su;
-
-	SCALE_VS_INIT(&su, 1);
-	if (NULL != (n = n->child))
-		if ( ! a2roffsu(n->string, &su, SCALE_VS))
-			su.scale = 1.0;
-
-	print_otag(h, TAG_DIV, "suh", &su);
-
-	/* So the div isn't empty: */
-	print_text(h, "\\~");
-
-	return 0;
 }
 
 static int
Index: mdoc_state.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_state.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -Lmdoc_state.c -Lmdoc_state.c -u -p -r1.7 -r1.8
--- mdoc_state.c
+++ mdoc_state.c
@@ -155,7 +155,6 @@ static	const state_handler __state_handl
 	NULL,		/* En */
 	NULL,		/* Dx */
 	NULL,		/* %Q */
-	NULL,		/* sp */
 	NULL,		/* %U */
 	NULL,		/* Ta */
 };
Index: mdoc_validate.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_validate.c,v
retrieving revision 1.325
retrieving revision 1.326
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.325 -r1.326
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -227,7 +227,6 @@ static	const v_post __mdoc_valids[MDOC_M
 	post_en,	/* En */
 	post_xx,	/* Dx */
 	NULL,		/* %Q */
-	post_par,	/* sp */
 	NULL,		/* %U */
 	NULL,		/* Ta */
 };
@@ -328,6 +327,7 @@ mdoc_node_validate(struct roff_man *mdoc
 		if (n->tok < ROFF_MAX) {
 			switch(n->tok) {
 			case ROFF_br:
+			case ROFF_sp:
 				post_par(mdoc);
 				break;
 			default:
@@ -2096,10 +2096,10 @@ post_par(POST_ARGS)
 	struct roff_node *np;
 
 	np = mdoc->last;
-	if (np->tok != ROFF_br && np->tok != MDOC_sp)
+	if (np->tok != ROFF_br && np->tok != ROFF_sp)
 		post_prevpar(mdoc);
 
-	if (np->tok == MDOC_sp) {
+	if (np->tok == ROFF_sp) {
 		if (np->child != NULL && np->child->next != NULL)
 			mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse,
 			    np->child->next->line, np->child->next->pos,
@@ -2115,7 +2115,7 @@ post_par(POST_ARGS)
 			return;
 	} else if (np->tok != MDOC_Pp && np->tok != MDOC_Lp &&
 	    (mdoc->last->tok != ROFF_br ||
-	     (np->tok != MDOC_sp && np->tok != ROFF_br)))
+	     (np->tok != ROFF_sp && np->tok != ROFF_br)))
 		return;
 
 	mandoc_vmsg(MANDOCERR_PAR_SKIP, mdoc->parse,
Index: man_macro.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/man_macro.c,v
retrieving revision 1.119
retrieving revision 1.120
diff -Lman_macro.c -Lman_macro.c -u -p -r1.119 -r1.120
--- man_macro.c
+++ man_macro.c
@@ -61,7 +61,6 @@ const	struct man_macro __man_macros[MAN_
 	{ in_line_eoln, MAN_SCOPED | MAN_JOIN }, /* I */
 	{ in_line_eoln, 0 }, /* IR */
 	{ in_line_eoln, 0 }, /* RI */
-	{ in_line_eoln, MAN_NSCOPED }, /* sp */
 	{ in_line_eoln, MAN_NSCOPED }, /* nf */
 	{ in_line_eoln, MAN_NSCOPED }, /* fi */
 	{ blk_close, MAN_BSCOPE }, /* RE */
@@ -331,8 +330,7 @@ in_line_eoln(MACRO_PROT_ARGS)
 			    roff_name[tok], buf + *pos);
 			break;
 		}
-		if (buf[*pos] != '\0' && man->last != n &&
-		    (tok == MAN_PD || tok == MAN_sp)) {
+		if (buf[*pos] != '\0' && man->last != n && tok == MAN_PD) {
 			mandoc_vmsg(MANDOCERR_ARG_EXCESS,
 			    man->parse, line, *pos, "%s ... %s",
 			    roff_name[tok], buf + *pos);
Index: mdoc_html.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_html.c,v
retrieving revision 1.284
retrieving revision 1.285
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.284 -r1.285
--- mdoc_html.c
+++ mdoc_html.c
@@ -108,7 +108,6 @@ static	int		  mdoc_rs_pre(MDOC_ARGS);
 static	int		  mdoc_sh_pre(MDOC_ARGS);
 static	int		  mdoc_skip_pre(MDOC_ARGS);
 static	int		  mdoc_sm_pre(MDOC_ARGS);
-static	int		  mdoc_sp_pre(MDOC_ARGS);
 static	int		  mdoc_ss_pre(MDOC_ARGS);
 static	int		  mdoc_st_pre(MDOC_ARGS);
 static	int		  mdoc_sx_pre(MDOC_ARGS);
@@ -237,7 +236,6 @@ static	const struct htmlmdoc __mdocs[MDO
 	{mdoc_quote_pre, mdoc_quote_post}, /* En */
 	{mdoc_xx_pre, NULL}, /* Dx */
 	{mdoc__x_pre, mdoc__x_post}, /* %Q */
-	{mdoc_sp_pre, NULL}, /* sp */
 	{mdoc__x_pre, mdoc__x_post}, /* %U */
 	{NULL, NULL}, /* Ta */
 };
@@ -1009,9 +1007,9 @@ mdoc_bd_pre(MDOC_ARGS)
 		 * anyway, so don't sweat it.
 		 */
 		switch (nn->tok) {
-		case MDOC_Sm:
 		case ROFF_br:
-		case MDOC_sp:
+		case ROFF_sp:
+		case MDOC_Sm:
 		case MDOC_Bl:
 		case MDOC_D1:
 		case MDOC_Dl:
@@ -1323,28 +1321,6 @@ mdoc_pp_pre(MDOC_ARGS)
 
 	print_paragraph(h);
 	return 0;
-}
-
-static int
-mdoc_sp_pre(MDOC_ARGS)
-{
-	struct roffsu	 su;
-
-	SCALE_VS_INIT(&su, 1);
-	if (NULL != (n = n->child)) {
-		if ( ! a2roffsu(n->string, &su, SCALE_VS))
-			su.scale = 1.0;
-		else if (su.scale < 0.0)
-			su.scale = 0.0;
-	}
-
-	print_otag(h, TAG_DIV, "suh", &su);
-
-	/* So the div isn't empty: */
-	print_text(h, "\\~");
-
-	return 0;
-
 }
 
 static int
Index: man.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/man.c,v
retrieving revision 1.171
retrieving revision 1.172
diff -Lman.c -Lman.c -u -p -r1.171 -r1.172
--- man.c
+++ man.c
@@ -97,7 +97,7 @@ man_ptext(struct roff_man *man, int line
 		/* Allocate a blank entry. */
 		if (man->last->tok != MAN_SH &&
 		    man->last->tok != MAN_SS) {
-			roff_elem_alloc(man, line, offs, MAN_sp);
+			roff_elem_alloc(man, line, offs, ROFF_sp);
 			man->next = ROFF_NEXT_SIBLING;
 		}
 		return 1;
Index: roff_validate.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/roff_validate.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lroff_validate.c -Lroff_validate.c -u -p -r1.2 -r1.3
--- roff_validate.c
+++ roff_validate.c
@@ -34,6 +34,7 @@ static	const roff_valid_fp roff_valids[R
 	NULL,  /* br */
 	roff_valid_ft,  /* ft */
 	NULL,  /* ll */
+	NULL,  /* sp */
 };
 
 
Index: man_validate.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/man_validate.c,v
retrieving revision 1.126
retrieving revision 1.127
diff -Lman_validate.c -Lman_validate.c -u -p -r1.126 -r1.127
--- man_validate.c
+++ man_validate.c
@@ -74,7 +74,6 @@ static	const v_check __man_valids[MAN_MA
 	NULL,       /* I */
 	NULL,       /* IR */
 	NULL,       /* RI */
-	post_vs,    /* sp */
 	NULL,       /* nf */
 	NULL,       /* fi */
 	NULL,       /* RE */
@@ -125,6 +124,7 @@ man_node_validate(struct roff_man *man)
 		if (n->tok < ROFF_MAX) {
 			switch (n->tok) {
 			case ROFF_br:
+			case ROFF_sp:
 				post_vs(man, n);
 				break;
 			default:
@@ -445,6 +445,9 @@ post_vs(CHKARGS)
 	switch (n->parent->tok) {
 	case MAN_SH:
 	case MAN_SS:
+	case MAN_PP:
+	case MAN_LP:
+	case MAN_P:
 		mandoc_vmsg(MANDOCERR_PAR_SKIP, man->parse, n->line, n->pos,
 		    "%s after %s", roff_name[n->tok],
 		    roff_name[n->parent->tok]);
Index: mdoc.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc.c,v
retrieving revision 1.263
retrieving revision 1.264
diff -Lmdoc.c -Lmdoc.c -u -p -r1.263 -r1.264
--- mdoc.c
+++ mdoc.c
@@ -253,7 +253,7 @@ mdoc_ptext(struct roff_man *mdoc, int li
 		 * blank lines aren't allowed, but enough manuals assume this
 		 * behaviour that we want to work around it.
 		 */
-		roff_elem_alloc(mdoc, line, offs, MDOC_sp);
+		roff_elem_alloc(mdoc, line, offs, ROFF_sp);
 		mdoc->last->flags |= NODE_VALID | NODE_ENDED;
 		mdoc->next = ROFF_NEXT_SIBLING;
 		return 1;
Index: mdoc_argv.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_argv.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -Lmdoc_argv.c -Lmdoc_argv.c -u -p -r1.113 -r1.114
--- mdoc_argv.c
+++ mdoc_argv.c
@@ -263,7 +263,6 @@ static	const struct mdocarg __mdocargs[M
 	{ ARGSFL_DELIM, NULL }, /* En */
 	{ ARGSFL_DELIM, NULL }, /* Dx */
 	{ ARGSFL_NONE, NULL }, /* %Q */
-	{ ARGSFL_NONE, NULL }, /* sp */
 	{ ARGSFL_NONE, NULL }, /* %U */
 	{ ARGSFL_NONE, NULL }, /* Ta */
 };
Index: roff.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/roff.c,v
retrieving revision 1.298
retrieving revision 1.299
diff -Lroff.c -Lroff.c -u -p -r1.298 -r1.299
--- roff.c
+++ roff.c
@@ -211,7 +211,8 @@ static	enum rofferr	 roff_userdef(ROFF_A
 #define	ROFFNUM_WHITE	(1 << 1)  /* Skip whitespace in roff_evalnum(). */
 
 const char *__roff_name[MAN_MAX + 1] = {
-	"br",		"ft",		"ll",		NULL,
+	"br",		"ft",		"ll",		"sp",
+	NULL,
 	"ab",		"ad",		"af",		"aln",
 	"als",		"am",		"am1",		"ami",
 	"ami1",		"as",		"as1",		"asciify",
@@ -301,14 +302,14 @@ const char *__roff_name[MAN_MAX + 1] = {
 	"Fr",		"Ud",		"Lb",		"Lp",
 	"Lk",		"Mt",		"Brq",		"Bro",
 	"Brc",		"%C",		"Es",		"En",
-	"Dx",		"%Q",		"sp",
-	"%U",		"Ta",		NULL,
+	"Dx",		"%Q",		"%U",		"Ta",
+	NULL,
 	"TH",		"SH",		"SS",		"TP",
 	"LP",		"PP",		"P",		"IP",
 	"HP",		"SM",		"SB",		"BI",
 	"IB",		"BR",		"RB",		"R",
 	"B",		"I",		"IR",		"RI",
-	"sp",		"nf",		"fi",
+	"nf",		"fi",
 	"RE",		"RS",		"DT",		"UC",
 	"PD",		"AT",		"in",
 	"OP",		"EX",		"EE",		"UR",
@@ -320,6 +321,7 @@ static	struct roffmac	 roffs[TOKEN_NONE]
 	{ roff_br, NULL, NULL, 0 },  /* br */
 	{ roff_onearg, NULL, NULL, 0 },  /* ft */
 	{ roff_onearg, NULL, NULL, 0 },  /* ll */
+	{ roff_onearg, NULL, NULL, 0 },  /* sp */
 	{ NULL, NULL, NULL, 0 },  /* ROFF_MAX */
 	{ roff_unsupp, NULL, NULL, 0 },  /* ab */
 	{ roff_line_ignore, NULL, NULL, 0 },  /* ad */
Index: line.out_lint
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/man/blank/line.out_lint,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/man/blank/line.out_lint -Lregress/man/blank/line.out_lint -u -p -r1.1 -r1.2
--- regress/man/blank/line.out_lint
+++ regress/man/blank/line.out_lint
@@ -1,4 +1,8 @@
 mandoc: line.in:5:2: WARNING: skipping paragraph macro: sp after SH
+mandoc: line.in:23:2: WARNING: skipping paragraph macro: br after PP
 mandoc: line.in:25:2: WARNING: skipping paragraph macro: PP empty
+mandoc: line.in:35:2: WARNING: skipping paragraph macro: sp after PP
+mandoc: line.in:38:2: WARNING: skipping paragraph macro: sp after PP
+mandoc: line.in:53:1: WARNING: skipping paragraph macro: sp after PP
 mandoc: line.in:81:2: WARNING: skipping paragraph macro: sp after SH
 mandoc: line.in:84:2: WARNING: skipping paragraph macro: sp after SS
Index: close.out_lint
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/roff/cond/close.out_lint,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lregress/roff/cond/close.out_lint -Lregress/roff/cond/close.out_lint -u -p -r1.2 -r1.3
--- regress/roff/cond/close.out_lint
+++ regress/roff/cond/close.out_lint
@@ -1 +1,2 @@
 mandoc: close.in:14:2: ERROR: appending missing end of block: if
+mandoc: close.in:14:9: WARNING: skipping paragraph macro: sp after PP
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-05-05 15:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-05 15:18 mdocml: Move .sp to the roff modules 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).