version 1.380, 2020/04/06 10:16:17 |
version 1.383, 2023/11/13 19:13:01 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2010, 2012-2020 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2010, 2012-2020, 2022 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2013 Franco Fichtner <franco@lastsummer.de> |
* Copyright (c) 2013 Franco Fichtner <franco@lastsummer.de> |
* |
* |
Line 250 terminal_mdoc(void *arg, const struct roff_meta *mdoc) |
|
Line 250 terminal_mdoc(void *arg, const struct roff_meta *mdoc) |
|
{ |
{ |
struct roff_node *n, *nn; |
struct roff_node *n, *nn; |
struct termp *p; |
struct termp *p; |
size_t save_defindent; |
|
|
|
p = (struct termp *)arg; |
p = (struct termp *)arg; |
p->tcol->rmargin = p->maxrmargin = p->defrmargin; |
p->tcol->rmargin = p->maxrmargin = p->defrmargin; |
Line 275 terminal_mdoc(void *arg, const struct roff_meta *mdoc) |
|
Line 274 terminal_mdoc(void *arg, const struct roff_meta *mdoc) |
|
print_mdoc_nodelist(p, NULL, mdoc, n); |
print_mdoc_nodelist(p, NULL, mdoc, n); |
term_newln(p); |
term_newln(p); |
} else { |
} else { |
save_defindent = p->defindent; |
|
if (p->defindent == 0) |
|
p->defindent = 5; |
|
term_begin(p, print_mdoc_head, print_mdoc_foot, mdoc); |
term_begin(p, print_mdoc_head, print_mdoc_foot, mdoc); |
while (n != NULL && |
while (n != NULL && |
(n->type == ROFFT_COMMENT || |
(n->type == ROFFT_COMMENT || |
Line 289 terminal_mdoc(void *arg, const struct roff_meta *mdoc) |
|
Line 285 terminal_mdoc(void *arg, const struct roff_meta *mdoc) |
|
print_mdoc_nodelist(p, NULL, mdoc, n); |
print_mdoc_nodelist(p, NULL, mdoc, n); |
} |
} |
term_end(p); |
term_end(p); |
p->defindent = save_defindent; |
|
} |
} |
} |
} |
|
|
Line 320 print_mdoc_node(DECL_ARGS) |
|
Line 315 print_mdoc_node(DECL_ARGS) |
|
(p->flags & TERMP_NONEWLINE) == 0) |
(p->flags & TERMP_NONEWLINE) == 0) |
term_newln(p); |
term_newln(p); |
p->flags |= TERMP_BRNEVER; |
p->flags |= TERMP_BRNEVER; |
} else |
} else { |
|
if (n->flags & NODE_LINE) |
|
term_tab_ref(p); |
p->flags &= ~TERMP_BRNEVER; |
p->flags &= ~TERMP_BRNEVER; |
|
} |
|
|
if (n->type == ROFFT_COMMENT || n->flags & NODE_NOPRT) |
if (n->type == ROFFT_COMMENT || n->flags & NODE_NOPRT) |
return; |
return; |
Line 566 a2width(const struct termp *p, const char *v) |
|
Line 564 a2width(const struct termp *p, const char *v) |
|
|
|
end = a2roffsu(v, &su, SCALE_MAX); |
end = a2roffsu(v, &su, SCALE_MAX); |
if (end == NULL || *end != '\0') { |
if (end == NULL || *end != '\0') { |
SCALE_HS_INIT(&su, term_strlen(p, v)); |
su.unit = SCALE_EN; |
su.scale /= term_strlen(p, "0"); |
su.scale = term_strlen(p, v) / term_strlen(p, "0"); |
} |
} |
return term_hen(p, &su); |
return term_hen(p, &su); |
} |
} |
Line 703 termp_it_pre(DECL_ARGS) |
|
Line 701 termp_it_pre(DECL_ARGS) |
|
for (i = 0, nn = n->prev; |
for (i = 0, nn = n->prev; |
nn->prev && i < (int)ncols; |
nn->prev && i < (int)ncols; |
nn = nn->prev, i++) { |
nn = nn->prev, i++) { |
SCALE_HS_INIT(&su, |
su.unit = SCALE_EN; |
term_strlen(p, bl->norm->Bl.cols[i])); |
su.scale = term_strlen(p, bl->norm->Bl.cols[i]) / |
su.scale /= term_strlen(p, "0"); |
term_strlen(p, "0"); |
offset += term_hen(p, &su) + dcol; |
offset += term_hen(p, &su) + dcol; |
} |
} |
|
|
Line 722 termp_it_pre(DECL_ARGS) |
|
Line 720 termp_it_pre(DECL_ARGS) |
|
* Use the declared column widths, extended as explained |
* Use the declared column widths, extended as explained |
* in the preceding paragraph. |
* in the preceding paragraph. |
*/ |
*/ |
SCALE_HS_INIT(&su, term_strlen(p, bl->norm->Bl.cols[i])); |
su.unit = SCALE_EN; |
su.scale /= term_strlen(p, "0"); |
su.scale = term_strlen(p, bl->norm->Bl.cols[i]) / |
|
term_strlen(p, "0"); |
width = term_hen(p, &su) + dcol; |
width = term_hen(p, &su) + dcol; |
break; |
break; |
default: |
default: |