aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-05-05 15:17:32 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-05-05 15:17:32 +0000
commitac714e0488d7c68718c62be1daa50511092a070d (patch)
tree23603ba00471fb588afdd3b7c5765fab62424249 /mdoc_term.c
parent264209da4a75cf323caf3e1a5e89534f15086b73 (diff)
downloadmandoc-ac714e0488d7c68718c62be1daa50511092a070d.tar.gz
mandoc-ac714e0488d7c68718c62be1daa50511092a070d.tar.zst
mandoc-ac714e0488d7c68718c62be1daa50511092a070d.zip
Move .sp to the roff modules. Enough infrastructure is in place
now that this actually saves code: -70 LOC.
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c46
1 files changed, 9 insertions, 37 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index e7e8a0d2..ab26e280 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.354 2017/05/05 13:17:55 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.355 2017/05/05 15:17:32 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -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[MDOC_MAX - MDOC_Dd] = {
{ 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[MDOC_MAX - MDOC_Dd] = {
{ 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[MDOC_MAX - MDOC_Dd] = {
{ 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;
}