"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "mdoc_term.c" between
mdocml-1.14.1rc1.tar.gz and mdocml-1.14.1rc2.tar.gz

About: mdocml is a suite of tools compiling "-mdoc", the roff macro package of choice for BSD manual pages, and "-man", the predominant historical package for UNIX manuals. Hint: The installed binary name is "mandoc". Release candidate.

mdoc_term.c  (mdocml-1.14.1rc1):mdoc_term.c  (mdocml-1.14.1rc2)
/* $Id: mdoc_term.c,v 1.343 2017/02/06 03:44:58 schwarze Exp $ */ /* $Id: mdoc_term.c,v 1.346 2017/02/17 19:15:41 schwarze Exp $ */
/* /*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2017 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2010, 2012-2017 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2013 Franco Fichtner <franco@lastsummer.de> * Copyright (c) 2013 Franco Fichtner <franco@lastsummer.de>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies. * copyright notice and this permission notice appear in all copies.
* *
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
skipping to change at line 398 skipping to change at line 398
break; break;
(void)(*termacts[n->tok].post)(p, &npair, meta, n); (void)(*termacts[n->tok].post)(p, &npair, meta, n);
/* /*
* Explicit end tokens not only call the post * Explicit end tokens not only call the post
* handler, but also tell the respective block * handler, but also tell the respective block
* that it must not call the post handler again. * that it must not call the post handler again.
*/ */
if (ENDBODY_NOT != n->end) if (ENDBODY_NOT != n->end)
n->body->flags |= NODE_ENDED; n->body->flags |= NODE_ENDED;
/*
* End of line terminating an implicit block
* while an explicit block is still open.
* Continue the explicit block without spacing.
*/
if (ENDBODY_NOSPACE == n->end)
p->flags |= TERMP_NOSPACE;
break; break;
} }
if (NODE_EOS & n->flags) if (NODE_EOS & n->flags)
p->flags |= TERMP_SENTENCE; p->flags |= TERMP_SENTENCE;
if (MDOC_ll != n->tok) { if (MDOC_ll != n->tok) {
p->offset = offset; p->offset = offset;
p->rmargin = rmargin; p->rmargin = rmargin;
} }
skipping to change at line 616 skipping to change at line 608
termp_ll_pre(DECL_ARGS) termp_ll_pre(DECL_ARGS)
{ {
term_setwidth(p, n->child != NULL ? n->child->string : NULL); term_setwidth(p, n->child != NULL ? n->child->string : NULL);
return 0; return 0;
} }
static int static int
termp_it_pre(DECL_ARGS) termp_it_pre(DECL_ARGS)
{ {
struct roffsu su;
char buf[24]; char buf[24];
const struct roff_node *bl, *nn; const struct roff_node *bl, *nn;
size_t ncols, dcol; size_t ncols, dcol;
int i, offset, width; int i, offset, width;
enum mdoc_list type; enum mdoc_list type;
if (n->type == ROFFT_BLOCK) { if (n->type == ROFFT_BLOCK) {
print_bvspace(p, n->parent->parent, n); print_bvspace(p, n->parent->parent, n);
return 1; return 1;
} }
skipping to change at line 693 skipping to change at line 686
dcol = ncols < 5 ? term_len(p, 4) : dcol = ncols < 5 ? term_len(p, 4) :
ncols == 5 ? term_len(p, 3) : term_len(p, 1); ncols == 5 ? term_len(p, 3) : term_len(p, 1);
/* /*
* Calculate the offset by applying all prior ROFFT_BODY, * Calculate the offset by applying all prior ROFFT_BODY,
* so we stop at the ROFFT_HEAD (nn->prev == NULL). * so we stop at the ROFFT_HEAD (nn->prev == NULL).
*/ */
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++) {
offset += dcol + a2width(p, SCALE_HS_INIT(&su,
bl->norm->Bl.cols[i]); term_strlen(p, bl->norm->Bl.cols[i]));
su.scale /= term_strlen(p, "0");
offset += term_hspan(p, &su) / 24 + dcol;
}
/* /*
* When exceeding the declared number of columns, leave * When exceeding the declared number of columns, leave
* the remaining widths at 0. This will later be * the remaining widths at 0. This will later be
* adjusted to the default width of 10, or, for the last * adjusted to the default width of 10, or, for the last
* column, stretched to the right margin. * column, stretched to the right margin.
*/ */
if (i >= (int)ncols) if (i >= (int)ncols)
break; break;
/* /*
* Use the declared column widths, extended as explained * Use the declared column widths, extended as explained
* in the preceding paragraph. * in the preceding paragraph.
*/ */
width = a2width(p, bl->norm->Bl.cols[i]) + dcol; SCALE_HS_INIT(&su, term_strlen(p, bl->norm->Bl.cols[i]));
su.scale /= term_strlen(p, "0");
width = term_hspan(p, &su) / 24 + dcol;
break; break;
default: default:
if (NULL == bl->norm->Bl.width) if (NULL == bl->norm->Bl.width)
break; break;
/* /*
* Note: buffer the width by 2, which is groff's magic * Note: buffer the width by 2, which is groff's magic
* number for buffering single arguments. See the above * number for buffering single arguments. See the above
* handling for column for how this changes. * handling for column for how this changes.
*/ */
skipping to change at line 1718 skipping to change at line 1716
case MDOC_Bro: case MDOC_Bro:
case MDOC_Brq: case MDOC_Brq:
term_word(p, "{"); term_word(p, "{");
break; break;
case MDOC_Oo: case MDOC_Oo:
case MDOC_Op: case MDOC_Op:
case MDOC_Bo: case MDOC_Bo:
case MDOC_Bq: case MDOC_Bq:
term_word(p, "["); term_word(p, "[");
break; break;
case MDOC__T:
/* FALLTHROUGH */
case MDOC_Do: case MDOC_Do:
case MDOC_Dq: case MDOC_Dq:
term_word(p, "\\(Lq"); term_word(p, "\\(Lq");
break; break;
case MDOC_En: case MDOC_En:
if (NULL == n->norm->Es || if (NULL == n->norm->Es ||
NULL == n->norm->Es->child) NULL == n->norm->Es->child)
return 1; return 1;
term_word(p, n->norm->Es->child->string); term_word(p, n->norm->Es->child->string);
break; break;
case MDOC_Po: case MDOC_Po:
case MDOC_Pq: case MDOC_Pq:
term_word(p, "("); term_word(p, "(");
break; break;
case MDOC__T:
case MDOC_Qo: case MDOC_Qo:
case MDOC_Qq: case MDOC_Qq:
term_word(p, "\""); term_word(p, "\"");
break; break;
case MDOC_Ql: case MDOC_Ql:
case MDOC_So: case MDOC_So:
case MDOC_Sq: case MDOC_Sq:
term_word(p, "\\(oq"); term_word(p, "\\(oq");
break; break;
default: default:
skipping to change at line 1775 skipping to change at line 1774
case MDOC_Bro: case MDOC_Bro:
case MDOC_Brq: case MDOC_Brq:
term_word(p, "}"); term_word(p, "}");
break; break;
case MDOC_Oo: case MDOC_Oo:
case MDOC_Op: case MDOC_Op:
case MDOC_Bo: case MDOC_Bo:
case MDOC_Bq: case MDOC_Bq:
term_word(p, "]"); term_word(p, "]");
break; break;
case MDOC__T:
/* FALLTHROUGH */
case MDOC_Do: case MDOC_Do:
case MDOC_Dq: case MDOC_Dq:
term_word(p, "\\(Rq"); term_word(p, "\\(Rq");
break; break;
case MDOC_En: case MDOC_En:
if (n->norm->Es == NULL || if (n->norm->Es == NULL ||
n->norm->Es->child == NULL || n->norm->Es->child == NULL ||
n->norm->Es->child->next == NULL) n->norm->Es->child->next == NULL)
p->flags &= ~TERMP_NOSPACE; p->flags &= ~TERMP_NOSPACE;
else else
term_word(p, n->norm->Es->child->next->string); term_word(p, n->norm->Es->child->next->string);
break; break;
case MDOC_Po: case MDOC_Po:
case MDOC_Pq: case MDOC_Pq:
term_word(p, ")"); term_word(p, ")");
break; break;
case MDOC__T:
case MDOC_Qo: case MDOC_Qo:
case MDOC_Qq: case MDOC_Qq:
term_word(p, "\""); term_word(p, "\"");
break; break;
case MDOC_Ql: case MDOC_Ql:
case MDOC_So: case MDOC_So:
case MDOC_Sq: case MDOC_Sq:
term_word(p, "\\(cq"); term_word(p, "\\(cq");
break; break;
default: default:
 End of changes. 9 change blocks. 
15 lines changed or deleted 15 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS