diff options
-rw-r--r-- | usr.bin/mandoc/man.c | 10 | ||||
-rw-r--r-- | usr.bin/mandoc/man_html.c | 8 | ||||
-rw-r--r-- | usr.bin/mandoc/man_macro.c | 12 | ||||
-rw-r--r-- | usr.bin/mandoc/man_term.c | 18 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc.c | 10 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_html.c | 38 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_macro.c | 62 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_man.c | 36 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_state.c | 4 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_term.c | 48 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_validate.c | 8 | ||||
-rw-r--r-- | usr.bin/mandoc/roff.c | 18 | ||||
-rw-r--r-- | usr.bin/mandoc/roff.h | 21 | ||||
-rw-r--r-- | usr.bin/mandoc/tree.c | 14 |
14 files changed, 152 insertions, 155 deletions
diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c index c8c968bfe26..dd0c0c341f8 100644 --- a/usr.bin/mandoc/man.c +++ b/usr.bin/mandoc/man.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man.c,v 1.114 2015/10/22 21:53:49 schwarze Exp $ */ +/* $OpenBSD: man.c,v 1.115 2017/01/10 13:46:53 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -147,7 +147,7 @@ man_ptext(struct roff_man *man, int line, char *buf, int offs) assert(i); if (mandoc_eos(buf, (size_t)i)) - man->last->flags |= MAN_EOS; + man->last->flags |= NODE_EOS; man_descope(man, line, offs); return 1; @@ -338,7 +338,7 @@ man_state(struct roff_man *man, struct roff_node *n) switch(n->tok) { case MAN_nf: case MAN_EX: - if (man->flags & MAN_LITERAL && ! (n->flags & MAN_VALID)) + if (man->flags & MAN_LITERAL && ! (n->flags & NODE_VALID)) mandoc_msg(MANDOCERR_NF_SKIP, man->parse, n->line, n->pos, "nf"); man->flags |= MAN_LITERAL; @@ -346,7 +346,7 @@ man_state(struct roff_man *man, struct roff_node *n) case MAN_fi: case MAN_EE: if ( ! (man->flags & MAN_LITERAL) && - ! (n->flags & MAN_VALID)) + ! (n->flags & NODE_VALID)) mandoc_msg(MANDOCERR_FI_SKIP, man->parse, n->line, n->pos, "fi"); man->flags &= ~MAN_LITERAL; @@ -354,7 +354,7 @@ man_state(struct roff_man *man, struct roff_node *n) default: break; } - man->last->flags |= MAN_VALID; + man->last->flags |= NODE_VALID; } void diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c index 4fc98977e85..d0ccf5d309d 100644 --- a/usr.bin/mandoc/man_html.c +++ b/usr.bin/mandoc/man_html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_html.c,v 1.73 2016/01/08 17:48:04 schwarze Exp $ */ +/* $OpenBSD: man_html.c,v 1.74 2017/01/10 13:46:53 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -209,14 +209,14 @@ print_man_node(MAN_ARGS) print_paragraph(h); return; } - if (n->flags & MAN_LINE && (*n->string == ' ' || + if (n->flags & NODE_LINE && (*n->string == ' ' || (n->prev != NULL && mh->fl & MANH_LITERAL && ! (h->flags & HTML_NONEWLINE)))) print_otag(h, TAG_BR, 0, NULL); print_text(h, n->string); return; case ROFFT_EQN: - if (n->flags & MAN_LINE) + if (n->flags & NODE_LINE) putchar('\n'); print_eqn(h, n->eqn); break; @@ -510,7 +510,7 @@ man_IP_pre(MAN_ARGS) if (MAN_TP == n->tok) { nn = n->child; - while (NULL != nn && 0 == (MAN_LINE & nn->flags)) + while (NULL != nn && 0 == (NODE_LINE & nn->flags)) nn = nn->next; while (NULL != nn) { print_man_node(man, nn, mh, h); diff --git a/usr.bin/mandoc/man_macro.c b/usr.bin/mandoc/man_macro.c index b49d9915063..8fd771e94a4 100644 --- a/usr.bin/mandoc/man_macro.c +++ b/usr.bin/mandoc/man_macro.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_macro.c,v 1.76 2016/01/08 17:48:04 schwarze Exp $ */ +/* $OpenBSD: man_macro.c,v 1.77 2017/01/10 13:46:53 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2012, 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -93,7 +93,7 @@ man_unscope(struct roff_man *man, const struct roff_node *to) /* Reached the end of the document? */ - if (to == NULL && ! (n->flags & MAN_VALID)) { + if (to == NULL && ! (n->flags & NODE_VALID)) { if (man->flags & (MAN_BLINE | MAN_ELINE) && man_macros[n->tok].flags & MAN_SCOPED) { mandoc_vmsg(MANDOCERR_BLK_LINE, @@ -128,7 +128,7 @@ man_unscope(struct roff_man *man, const struct roff_node *to) man->last = n; n = n->parent; - man->last->flags |= MAN_VALID; + man->last->flags |= NODE_VALID; } /* @@ -162,7 +162,7 @@ rew_scope(struct roff_man *man, int tok) for (;;) { if (n->type == ROFFT_ROOT) return; - if (n->flags & MAN_VALID) { + if (n->flags & NODE_VALID) { n = n->parent; continue; } @@ -354,13 +354,13 @@ in_line_eoln(MACRO_PROT_ARGS) } /* - * Append MAN_EOS in case the last snipped argument + * Append NODE_EOS in case the last snipped argument * ends with a dot, e.g. `.IR syslog (3).' */ if (n != man->last && mandoc_eos(man->last->string, strlen(man->last->string))) - man->last->flags |= MAN_EOS; + man->last->flags |= NODE_EOS; /* * If no arguments are specified and this is MAN_SCOPED (i.e., diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c index 488d8193fb8..5e581a7884b 100644 --- a/usr.bin/mandoc/man_term.c +++ b/usr.bin/mandoc/man_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_term.c,v 1.140 2016/01/08 17:48:04 schwarze Exp $ */ +/* $OpenBSD: man_term.c,v 1.141 2017/01/10 13:46:53 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -317,7 +317,7 @@ pre_alternate(DECL_ARGS) mt->fl |= MANT_LITERAL; assert(nn->type == ROFFT_TEXT); term_word(p, nn->string); - if (nn->flags & MAN_EOS) + if (nn->flags & NODE_EOS) p->flags |= TERMP_SENTENCE; if (nn->next) p->flags |= TERMP_NOSPACE; @@ -675,7 +675,7 @@ pre_TP(DECL_ARGS) /* Calculate offset. */ if ((nn = n->parent->head->child) != NULL && - nn->string != NULL && ! (MAN_LINE & nn->flags) && + nn->string != NULL && ! (NODE_LINE & nn->flags) && a2roffsu(nn->string, &su, SCALE_EN)) { len = term_hspan(p, &su) / 24; if (len < 0 && (size_t)(-len) > mt->offset) @@ -696,7 +696,7 @@ pre_TP(DECL_ARGS) /* Don't print same-line elements. */ nn = n->child; - while (NULL != nn && 0 == (MAN_LINE & nn->flags)) + while (NULL != nn && 0 == (NODE_LINE & nn->flags)) nn = nn->next; while (NULL != nn) { @@ -958,17 +958,17 @@ print_man_node(DECL_ARGS) if ('\0' == *n->string) { term_vspace(p); return; - } else if (' ' == *n->string && MAN_LINE & n->flags) + } else if (' ' == *n->string && NODE_LINE & n->flags) term_newln(p); term_word(p, n->string); goto out; case ROFFT_EQN: - if ( ! (n->flags & MAN_LINE)) + if ( ! (n->flags & NODE_LINE)) p->flags |= TERMP_NOSPACE; term_eqn(p, n->eqn); - if (n->next != NULL && ! (n->next->flags & MAN_LINE)) + if (n->next != NULL && ! (n->next->flags & NODE_LINE)) p->flags |= TERMP_NOSPACE; return; case ROFFT_TBL: @@ -1005,7 +1005,7 @@ out: */ if (mt->fl & MANT_LITERAL && ! (p->flags & (TERMP_NOBREAK | TERMP_NONEWLINE)) && - (n->next == NULL || n->next->flags & MAN_LINE)) { + (n->next == NULL || n->next->flags & NODE_LINE)) { rm = p->rmargin; rmax = p->maxrmargin; p->rmargin = p->maxrmargin = TERM_MAXMARGIN; @@ -1021,7 +1021,7 @@ out: p->rmargin = rm; p->maxrmargin = rmax; } - if (MAN_EOS & n->flags) + if (NODE_EOS & n->flags) p->flags |= TERMP_SENTENCE; } diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c index 407f6bb3240..6c8e47e7165 100644 --- a/usr.bin/mandoc/mdoc.c +++ b/usr.bin/mandoc/mdoc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc.c,v 1.146 2016/08/20 14:43:39 schwarze Exp $ */ +/* $OpenBSD: mdoc.c,v 1.147 2017/01/10 13:46:53 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012-2016 Ingo Schwarze <schwarze@openbsd.org> @@ -138,8 +138,8 @@ mdoc_endbody_alloc(struct roff_man *mdoc, int line, int pos, int tok, { struct roff_node *p; - body->flags |= MDOC_ENDED; - body->parent->flags |= MDOC_ENDED; + body->flags |= NODE_ENDED; + body->parent->flags |= NODE_ENDED; p = roff_node_alloc(mdoc, line, pos, ROFFT_BODY, tok); p->body = body; p->norm = body->norm; @@ -290,7 +290,7 @@ mdoc_ptext(struct roff_man *mdoc, int line, char *buf, int offs) * behaviour that we want to work around it. */ roff_elem_alloc(mdoc, line, offs, MDOC_sp); - mdoc->last->flags |= MDOC_VALID | MDOC_ENDED; + mdoc->last->flags |= NODE_VALID | NODE_ENDED; mdoc->next = ROFF_NEXT_SIBLING; return 1; } @@ -309,7 +309,7 @@ mdoc_ptext(struct roff_man *mdoc, int line, char *buf, int offs) assert(buf < end); if (mandoc_eos(buf+offs, (size_t)(end-buf-offs))) - mdoc->last->flags |= MDOC_EOS; + mdoc->last->flags |= NODE_EOS; return 1; } diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c index c18b2d48b96..a09008a1f1b 100644 --- a/usr.bin/mandoc/mdoc_html.c +++ b/usr.bin/mandoc/mdoc_html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_html.c,v 1.118 2017/01/10 12:54:27 schwarze Exp $ */ +/* $OpenBSD: mdoc_html.c,v 1.119 2017/01/10 13:46:53 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -284,7 +284,7 @@ static void synopsis_pre(struct html *h, const struct roff_node *n) { - if (NULL == n->prev || ! (MDOC_SYNPRETTY & n->flags)) + if (NULL == n->prev || ! (NODE_SYNPRETTY & n->flags)) return; if (n->prev->tok == n->tok && @@ -380,7 +380,7 @@ print_mdoc_node(MDOC_ARGS) child = 1; t = h->tags.head; - n->flags &= ~MDOC_ENDED; + n->flags &= ~NODE_ENDED; switch (n->type) { case ROFFT_TEXT: @@ -391,17 +391,17 @@ print_mdoc_node(MDOC_ARGS) * Make sure that if we're in a literal mode already * (i.e., within a <PRE>) don't print the newline. */ - if (' ' == *n->string && MDOC_LINE & n->flags) + if (' ' == *n->string && NODE_LINE & n->flags) if ( ! (HTML_LITERAL & h->flags)) print_otag(h, TAG_BR, 0, NULL); - if (MDOC_DELIMC & n->flags) + if (NODE_DELIMC & n->flags) h->flags |= HTML_NOSPACE; print_text(h, n->string); - if (MDOC_DELIMO & n->flags) + if (NODE_DELIMO & n->flags) h->flags |= HTML_NOSPACE; return; case ROFFT_EQN: - if (n->flags & MDOC_LINE) + if (n->flags & NODE_LINE) putchar('\n'); print_eqn(h, n->eqn); break; @@ -429,7 +429,7 @@ print_mdoc_node(MDOC_ARGS) break; } - if (h->flags & HTML_KEEP && n->flags & MDOC_LINE) { + if (h->flags & HTML_KEEP && n->flags & NODE_LINE) { h->flags &= ~HTML_KEEP; h->flags |= HTML_PREKEEP; } @@ -443,11 +443,11 @@ print_mdoc_node(MDOC_ARGS) case ROFFT_EQN: break; default: - if ( ! mdocs[n->tok].post || n->flags & MDOC_ENDED) + if ( ! mdocs[n->tok].post || n->flags & NODE_ENDED) break; (*mdocs[n->tok].post)(meta, n, h); if (n->end != ENDBODY_NOT) - n->body->flags |= MDOC_ENDED; + n->body->flags |= NODE_ENDED; if (n->end == ENDBODY_NOSPACE) h->flags |= HTML_NOSPACE; break; @@ -606,7 +606,7 @@ mdoc_fl_pre(MDOC_ARGS) if (!(n->child == NULL && (n->next == NULL || n->next->type == ROFFT_TEXT || - n->next->flags & MDOC_LINE))) + n->next->flags & NODE_LINE))) h->flags |= HTML_NOSPACE; return 1; @@ -712,7 +712,7 @@ static int mdoc_ns_pre(MDOC_ARGS) { - if ( ! (MDOC_LINE & n->flags)) + if ( ! (NODE_LINE & n->flags)) h->flags |= HTML_NOSPACE; return 1; } @@ -1159,7 +1159,7 @@ mdoc_bd_pre(MDOC_ARGS) break; } if (h->flags & HTML_NONEWLINE || - (nn->next && ! (nn->next->flags & MDOC_LINE))) + (nn->next && ! (nn->next->flags & NODE_LINE))) continue; else if (nn->next) print_text(h, "\n"); @@ -1398,7 +1398,7 @@ mdoc_fn_pre(MDOC_ARGS) const char *sp, *ep; int sz, i, pretty; - pretty = MDOC_SYNPRETTY & n->flags; + pretty = NODE_SYNPRETTY & n->flags; synopsis_pre(h, n); /* Split apart into type and name. */ @@ -1428,7 +1428,7 @@ mdoc_fn_pre(MDOC_ARGS) */ #if 0 - if (MDOC_SYNPRETTY & n->flags) { + if (NODE_SYNPRETTY & n->flags) { nbuf[0] = '\0'; html_idcat(nbuf, sp, BUFSIZ); PAIR_ID_INIT(&tag[1], nbuf); @@ -1457,7 +1457,7 @@ mdoc_fn_pre(MDOC_ARGS) for (n = n->child->next; n; n = n->next) { i = 1; - if (MDOC_SYNPRETTY & n->flags) + if (NODE_SYNPRETTY & n->flags) i = 2; t = print_otag(h, TAG_I, i, tag); print_text(h, n->string); @@ -1647,7 +1647,7 @@ mdoc_in_pre(MDOC_ARGS) * of no children. */ - if (MDOC_SYNPRETTY & n->flags && MDOC_LINE & n->flags) + if (NODE_SYNPRETTY & n->flags && NODE_LINE & n->flags) print_text(h, "#include"); print_text(h, "<"); @@ -1824,7 +1824,7 @@ static void mdoc_pf_post(MDOC_ARGS) { - if ( ! (n->next == NULL || n->next->flags & MDOC_LINE)) + if ( ! (n->next == NULL || n->next->flags & NODE_LINE)) h->flags |= HTML_NOSPACE; } @@ -1895,7 +1895,7 @@ mdoc_lb_pre(MDOC_ARGS) { struct htmlpair tag; - if (SEC_LIBRARY == n->sec && MDOC_LINE & n->flags && n->prev) + if (SEC_LIBRARY == n->sec && NODE_LINE & n->flags && n->prev) print_otag(h, TAG_BR, 0, NULL); PAIR_CLASS_INIT(&tag, "lib"); diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c index bb0a07e83fe..fe8cfa3422e 100644 --- a/usr.bin/mandoc/mdoc_macro.c +++ b/usr.bin/mandoc/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_macro.c,v 1.165 2016/08/20 17:58:09 schwarze Exp $ */ +/* $OpenBSD: mdoc_macro.c,v 1.166 2017/01/10 13:46:53 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012-2016 Ingo Schwarze <schwarze@openbsd.org> @@ -214,7 +214,7 @@ mdoc_endparse(struct roff_man *mdoc) /* Scan for open explicit scopes. */ - n = mdoc->last->flags & MDOC_VALID ? + n = mdoc->last->flags & NODE_VALID ? mdoc->last->parent : mdoc->last; for ( ; n; n = n->parent) @@ -262,16 +262,16 @@ static void rew_last(struct roff_man *mdoc, const struct roff_node *to) { - if (to->flags & MDOC_VALID) + if (to->flags & NODE_VALID) return; while (mdoc->last != to) { mdoc_state(mdoc, mdoc->last); - mdoc->last->flags |= MDOC_VALID | MDOC_ENDED; + mdoc->last->flags |= NODE_VALID | NODE_ENDED; mdoc->last = mdoc->last->parent; } mdoc_state(mdoc, mdoc->last); - mdoc->last->flags |= MDOC_VALID | MDOC_ENDED; + mdoc->last->flags |= NODE_VALID | NODE_ENDED; mdoc->next = ROFF_NEXT_SIBLING; } @@ -296,7 +296,7 @@ rew_pending(struct roff_man *mdoc, const struct roff_node *n) default: return; } - if ( ! (n->flags & MDOC_BROKEN)) + if ( ! (n->flags & NODE_BROKEN)) return; } else n = mdoc->last; @@ -307,7 +307,7 @@ rew_pending(struct roff_man *mdoc, const struct roff_node *n) if (n->type == ROFFT_BLOCK || n->type == ROFFT_HEAD) { - if (n->flags & MDOC_ENDED) + if (n->flags & NODE_ENDED) break; else return; @@ -388,18 +388,18 @@ find_pending(struct roff_man *mdoc, int tok, int line, int ppos, irc = 0; for (n = mdoc->last; n != NULL && n != target; n = n->parent) { - if (n->flags & MDOC_ENDED) { - if ( ! (n->flags & MDOC_VALID)) - n->flags |= MDOC_BROKEN; + if (n->flags & NODE_ENDED) { + if ( ! (n->flags & NODE_VALID)) + n->flags |= NODE_BROKEN; continue; } if (n->type == ROFFT_BLOCK && mdoc_macros[n->tok].flags & MDOC_EXPLICIT) { irc = 1; - n->flags = MDOC_BROKEN; + n->flags = NODE_BROKEN; if (target->type == ROFFT_HEAD) - target->flags = MDOC_ENDED; - else if ( ! (target->flags & MDOC_ENDED)) { + target->flags = NODE_ENDED; + else if ( ! (target->flags & NODE_ENDED)) { mandoc_vmsg(MANDOCERR_BLK_NEST, mdoc->parse, line, ppos, "%s breaks %s", mdoc_macronames[tok], @@ -442,11 +442,11 @@ dword(struct roff_man *mdoc, int line, int col, const char *p, */ if (d == DELIM_OPEN) - mdoc->last->flags |= MDOC_DELIMO; + mdoc->last->flags |= NODE_DELIMO; else if (d == DELIM_CLOSE && ! (mdoc->flags & MDOC_NODELIMC) && mdoc->last->parent->tok != MDOC_Fd) - mdoc->last->flags |= MDOC_DELIMC; + mdoc->last->flags |= NODE_DELIMC; mdoc->flags &= ~MDOC_NODELIMC; } @@ -479,7 +479,7 @@ append_delims(struct roff_man *mdoc, int line, int *pos, char *buf) */ if (mandoc_eos(p, strlen(p))) - mdoc->last->flags |= MDOC_EOS; + mdoc->last->flags |= NODE_EOS; } } @@ -552,7 +552,7 @@ blk_exp_close(MACRO_PROT_ARGS) atok = rew_alt(tok); body = NULL; for (n = mdoc->last; n; n = n->parent) { - if (n->flags & MDOC_ENDED || n->tok != atok || + if (n->flags & NODE_ENDED || n->tok != atok || n->type != ROFFT_BODY || n->end != ENDBODY_NOT) continue; body = n; @@ -566,9 +566,9 @@ blk_exp_close(MACRO_PROT_ARGS) endbody = itblk = later = NULL; for (n = mdoc->last; n; n = n->parent) { - if (n->flags & MDOC_ENDED) { - if ( ! (n->flags & MDOC_VALID)) - n->flags |= MDOC_BROKEN; + if (n->flags & NODE_ENDED) { + if ( ! (n->flags & NODE_VALID)) + n->flags |= NODE_BROKEN; continue; } @@ -618,7 +618,7 @@ blk_exp_close(MACRO_PROT_ARGS) atok, body, ENDBODY_SPACE); if (tok == MDOC_El) - itblk->flags |= MDOC_ENDED | MDOC_BROKEN; + itblk->flags |= NODE_ENDED | NODE_BROKEN; /* * If a block closing macro taking arguments @@ -640,7 +640,7 @@ blk_exp_close(MACRO_PROT_ARGS) /* Breaking an open sub block. */ - n->flags |= MDOC_BROKEN; + n->flags |= NODE_BROKEN; if (later == NULL) later = n; } @@ -704,11 +704,11 @@ blk_exp_close(MACRO_PROT_ARGS) } if (n != NULL) { - if (ntok != TOKEN_NONE && n->flags & MDOC_BROKEN) { + if (ntok != TOKEN_NONE && n->flags & NODE_BROKEN) { target = n; do target = target->parent; - while ( ! (target->flags & MDOC_ENDED)); + while ( ! (target->flags & NODE_ENDED)); pending = find_pending(mdoc, ntok, line, ppos, target); } else @@ -767,7 +767,7 @@ in_line(MACRO_PROT_ARGS) if (ac == ARGS_EOLN) { if (d == DELIM_OPEN) - mdoc->last->flags &= ~MDOC_DELIMO; + mdoc->last->flags &= ~NODE_DELIMO; break; } @@ -861,7 +861,7 @@ in_line(MACRO_PROT_ARGS) */ if (firstarg && d == DELIM_CLOSE && !nc) - mdoc->last->flags &= ~MDOC_DELIMC; + mdoc->last->flags &= ~NODE_DELIMC; firstarg = 0; /* @@ -924,9 +924,9 @@ blk_full(MACRO_PROT_ARGS) blk = NULL; for (n = mdoc->last; n != NULL; n = n->parent) { - if (n->flags & MDOC_ENDED) { - if ( ! (n->flags & MDOC_VALID)) - n->flags |= MDOC_BROKEN; + if (n->flags & NODE_ENDED) { + if ( ! (n->flags & NODE_VALID)) + n->flags |= NODE_BROKEN; continue; } if (n->type != ROFFT_BLOCK) @@ -1127,7 +1127,7 @@ blk_full(MACRO_PROT_ARGS) break; } - if (blk->flags & MDOC_VALID) + if (blk->flags & NODE_VALID) return; if (head == NULL) head = roff_head_alloc(mdoc, line, ppos, tok); @@ -1462,7 +1462,7 @@ phrase_ta(MACRO_PROT_ARGS) body = NULL; for (n = mdoc->last; n != NULL; n = n->parent) { - if (n->flags & MDOC_ENDED) + if (n->flags & NODE_ENDED) continue; if (n->tok == MDOC_It && n->type == ROFFT_BODY) body = n; diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c index 3973feb06b5..bee72d4d169 100644 --- a/usr.bin/mandoc/mdoc_man.c +++ b/usr.bin/mandoc/mdoc_man.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_man.c,v 1.95 2017/01/10 12:54:27 schwarze Exp $ */ +/* $OpenBSD: mdoc_man.c,v 1.96 2017/01/10 13:46:53 schwarze Exp $ */ /* * Copyright (c) 2011-2017 Ingo Schwarze <schwarze@openbsd.org> * @@ -580,13 +580,13 @@ print_node(DECL_ARGS) * Break the line if we were parsed subsequent the current node. * This makes the page structure be more consistent. */ - if (MMAN_spc & outflags && MDOC_LINE & n->flags) + if (MMAN_spc & outflags && NODE_LINE & n->flags) outflags |= MMAN_nl; act = NULL; cond = 0; do_sub = 1; - n->flags &= ~MDOC_ENDED; + n->flags &= ~NODE_ENDED; if (n->type == ROFFT_TEXT) { /* @@ -599,10 +599,10 @@ print_node(DECL_ARGS) printf("\\&"); outflags &= ~MMAN_spc; } - if (outflags & MMAN_Sm && ! (n->flags & MDOC_DELIMC)) + if (outflags & MMAN_Sm && ! (n->flags & NODE_DELIMC)) outflags |= MMAN_spc_force; print_word(n->string); - if (outflags & MMAN_Sm && ! (n->flags & MDOC_DELIMO)) + if (outflags & MMAN_Sm && ! (n->flags & NODE_DELIMO)) outflags |= MMAN_spc; } else { /* @@ -628,14 +628,14 @@ print_node(DECL_ARGS) /* * Lastly, conditionally run the post-node handler. */ - if (MDOC_ENDED & n->flags) + if (NODE_ENDED & n->flags) return; if (cond && act->post) (*act->post)(meta, n); if (ENDBODY_NOT != n->end) - n->body->flags |= MDOC_ENDED; + n->body->flags |= NODE_ENDED; if (ENDBODY_NOSPACE == n->end) outflags &= ~(MMAN_spc | MMAN_nl); @@ -806,7 +806,7 @@ static void pre_syn(const struct roff_node *n) { - if (NULL == n->prev || ! (MDOC_SYNPRETTY & n->flags)) + if (NULL == n->prev || ! (NODE_SYNPRETTY & n->flags)) return; if (n->prev->tok == n->tok && @@ -1174,7 +1174,7 @@ pre_fa(DECL_ARGS) while (NULL != n) { font_push('I'); - if (am_Fa || MDOC_SYNPRETTY & n->flags) + if (am_Fa || NODE_SYNPRETTY & n->flags) outflags |= MMAN_nbrword; print_node(meta, n); font_pop(); @@ -1228,7 +1228,7 @@ post_fl(DECL_ARGS) if (!(n->child != NULL || n->next == NULL || n->next->type == ROFFT_TEXT || - n->next->flags & MDOC_LINE)) + n->next->flags & NODE_LINE)) outflags &= ~MMAN_spc; } @@ -1242,7 +1242,7 @@ pre_fn(DECL_ARGS) if (NULL == n) return 0; - if (MDOC_SYNPRETTY & n->flags) + if (NODE_SYNPRETTY & n->flags) print_block(".HP 4n", MMAN_nl); font_push('B'); @@ -1263,7 +1263,7 @@ post_fn(DECL_ARGS) { print_word(")"); - if (MDOC_SYNPRETTY & n->flags) { + if (NODE_SYNPRETTY & n->flags) { print_word(";"); outflags |= MMAN_PP; } @@ -1280,7 +1280,7 @@ pre_fo(DECL_ARGS) case ROFFT_HEAD: if (n->child == NULL) return 0; - if (MDOC_SYNPRETTY & n->flags) + if (NODE_SYNPRETTY & n->flags) print_block(".HP 4n", MMAN_nl); font_push('B'); break; @@ -1325,7 +1325,7 @@ static int pre_in(DECL_ARGS) { - if (MDOC_SYNPRETTY & n->flags) { + if (NODE_SYNPRETTY & n->flags) { pre_syn(n); font_push('B'); print_word("#include <"); @@ -1342,7 +1342,7 @@ static void post_in(DECL_ARGS) { - if (MDOC_SYNPRETTY & n->flags) { + if (NODE_SYNPRETTY & n->flags) { outflags &= ~MMAN_spc; print_word(">"); font_pop(); @@ -1617,7 +1617,7 @@ static void post_pf(DECL_ARGS) { - if ( ! (n->next == NULL || n->next->flags & MDOC_LINE)) + if ( ! (n->next == NULL || n->next->flags & NODE_LINE)) outflags &= ~MMAN_spc; } @@ -1749,7 +1749,7 @@ static int pre_vt(DECL_ARGS) { - if (MDOC_SYNPRETTY & n->flags) { + if (NODE_SYNPRETTY & n->flags) { switch (n->type) { case ROFFT_BLOCK: pre_syn(n); @@ -1768,7 +1768,7 @@ static void post_vt(DECL_ARGS) { - if (n->flags & MDOC_SYNPRETTY && n->type != ROFFT_BODY) + if (n->flags & NODE_SYNPRETTY && n->type != ROFFT_BODY) return; font_pop(); } diff --git a/usr.bin/mandoc/mdoc_state.c b/usr.bin/mandoc/mdoc_state.c index 10dc166f430..0bcf4182bbe 100644 --- a/usr.bin/mandoc/mdoc_state.c +++ b/usr.bin/mandoc/mdoc_state.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_state.c,v 1.3 2015/10/30 18:53:37 schwarze Exp $ */ +/* $OpenBSD: mdoc_state.c,v 1.4 2017/01/10 13:46:53 schwarze Exp $ */ /* * Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> * @@ -249,7 +249,7 @@ state_sh(STATE_ARGS) if (n->type != ROFFT_HEAD) return; - if ( ! (n->flags & MDOC_VALID)) { + if ( ! (n->flags & NODE_VALID)) { secname = NULL; deroff(&secname, n); diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index 2cadcb519d3..1f09dc208e8 100644 --- a/usr.bin/mandoc/mdoc_term.c +++ b/usr.bin/mandoc/mdoc_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_term.c,v 1.236 2017/01/10 12:54:27 schwarze Exp $ */ +/* $OpenBSD: mdoc_term.c,v 1.237 2017/01/10 13:46:53 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012-2016 Ingo Schwarze <schwarze@openbsd.org> @@ -317,7 +317,7 @@ print_mdoc_node(DECL_ARGS) chld = 1; offset = p->offset; rmargin = p->rmargin; - n->flags &= ~MDOC_ENDED; + n->flags &= ~NODE_ENDED; n->prev_font = p->fonti; memset(&npair, 0, sizeof(struct termpair)); @@ -328,7 +328,7 @@ print_mdoc_node(DECL_ARGS) * invoked in a prior line, revert it to PREKEEP. */ - if (p->flags & TERMP_KEEP && n->flags & MDOC_LINE) { + if (p->flags & TERMP_KEEP && n->flags & NODE_LINE) { p->flags &= ~TERMP_KEEP; p->flags |= TERMP_PREKEEP; } @@ -340,19 +340,19 @@ print_mdoc_node(DECL_ARGS) switch (n->type) { case ROFFT_TEXT: - if (' ' == *n->string && MDOC_LINE & n->flags) + if (' ' == *n->string && NODE_LINE & n->flags) term_newln(p); - if (MDOC_DELIMC & n->flags) + if (NODE_DELIMC & n->flags) p->flags |= TERMP_NOSPACE; term_word(p, n->string); - if (MDOC_DELIMO & n->flags) + if (NODE_DELIMO & n->flags) p->flags |= TERMP_NOSPACE; break; case ROFFT_EQN: - if ( ! (n->flags & MDOC_LINE)) + if ( ! (n->flags & NODE_LINE)) p->flags |= TERMP_NOSPACE; term_eqn(p, n->eqn); - if (n->next != NULL && ! (n->next->flags & MDOC_LINE)) + if (n->next != NULL && ! (n->next->flags & NODE_LINE)) p->flags |= TERMP_NOSPACE; break; case ROFFT_TBL: @@ -382,7 +382,7 @@ print_mdoc_node(DECL_ARGS) case ROFFT_EQN: break; default: - if ( ! termacts[n->tok].post || MDOC_ENDED & n->flags) + if ( ! termacts[n->tok].post || NODE_ENDED & n->flags) break; (void)(*termacts[n->tok].post)(p, &npair, meta, n); @@ -392,7 +392,7 @@ print_mdoc_node(DECL_ARGS) * that it must not call the post handler again. */ if (ENDBODY_NOT != n->end) - n->body->flags |= MDOC_ENDED; + n->body->flags |= NODE_ENDED; /* * End of line terminating an implicit block @@ -404,7 +404,7 @@ print_mdoc_node(DECL_ARGS) break; } - if (MDOC_EOS & n->flags) + if (NODE_EOS & n->flags) p->flags |= TERMP_SENTENCE; if (MDOC_ll != n->tok) { @@ -1049,7 +1049,7 @@ termp_fl_pre(DECL_ARGS) if (!(n->child == NULL && (n->next == NULL || n->next->type == ROFFT_TEXT || - n->next->flags & MDOC_LINE))) + n->next->flags & NODE_LINE))) p->flags |= TERMP_NOSPACE; return 1; @@ -1094,7 +1094,7 @@ static int termp_ns_pre(DECL_ARGS) { - if ( ! (MDOC_LINE & n->flags)) + if ( ! (NODE_LINE & n->flags)) p->flags |= TERMP_NOSPACE; return 1; } @@ -1260,7 +1260,7 @@ synopsis_pre(struct termp *p, const struct roff_node *n) * Obviously, if we're not in a SYNOPSIS or no prior macros * exist, do nothing. */ - if (NULL == n->prev || ! (MDOC_SYNPRETTY & n->flags)) + if (NULL == n->prev || ! (NODE_SYNPRETTY & n->flags)) return; /* @@ -1409,7 +1409,7 @@ static void termp_lb_post(DECL_ARGS) { - if (SEC_LIBRARY == n->sec && MDOC_LINE & n->flags) + if (SEC_LIBRARY == n->sec && NODE_LINE & n->flags) term_newln(p); } @@ -1437,7 +1437,7 @@ static int termp_ft_pre(DECL_ARGS) { - /* NB: MDOC_LINE does not effect this! */ + /* NB: NODE_LINE does not effect this! */ synopsis_pre(p, n); term_fontpush(p, TERMFONT_UNDER); return 1; @@ -1449,7 +1449,7 @@ termp_fn_pre(DECL_ARGS) size_t rmargin = 0; int pretty; - pretty = MDOC_SYNPRETTY & n->flags; + pretty = NODE_SYNPRETTY & n->flags; synopsis_pre(p, n); @@ -1615,7 +1615,7 @@ termp_bd_pre(DECL_ARGS) break; } if (p->flags & TERMP_NONEWLINE || - (nn->next && ! (nn->next->flags & MDOC_LINE))) + (nn->next && ! (nn->next->flags & NODE_LINE))) continue; term_flushln(p); p->flags |= TERMP_NOSPACE; @@ -1716,7 +1716,7 @@ static void termp_pf_post(DECL_ARGS) { - if ( ! (n->next == NULL || n->next->flags & MDOC_LINE)) + if ( ! (n->next == NULL || n->next->flags & NODE_LINE)) p->flags |= TERMP_NOSPACE; } @@ -1771,7 +1771,7 @@ termp_in_pre(DECL_ARGS) synopsis_pre(p, n); - if (MDOC_SYNPRETTY & n->flags && MDOC_LINE & n->flags) { + if (NODE_SYNPRETTY & n->flags && NODE_LINE & n->flags) { term_fontpush(p, TERMFONT_BOLD); term_word(p, "#include"); term_word(p, "<"); @@ -1788,13 +1788,13 @@ static void termp_in_post(DECL_ARGS) { - if (MDOC_SYNPRETTY & n->flags) + if (NODE_SYNPRETTY & n->flags) term_fontpush(p, TERMFONT_BOLD); p->flags |= TERMP_NOSPACE; term_word(p, ">"); - if (MDOC_SYNPRETTY & n->flags) + if (NODE_SYNPRETTY & n->flags) term_fontpop(p); } @@ -2001,7 +2001,7 @@ termp_fo_pre(DECL_ARGS) size_t rmargin = 0; int pretty; - pretty = MDOC_SYNPRETTY & n->flags; + pretty = NODE_SYNPRETTY & n->flags; if (n->type == ROFFT_BLOCK) { synopsis_pre(p, n); @@ -2047,7 +2047,7 @@ termp_fo_post(DECL_ARGS) p->flags |= TERMP_NOSPACE; term_word(p, ")"); - if (MDOC_SYNPRETTY & n->flags) { + if (NODE_SYNPRETTY & n->flags) { p->flags |= TERMP_NOSPACE; term_word(p, ";"); term_flushln(p); diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c index ff52063c8fd..27417d5b5c1 100644 --- a/usr.bin/mandoc/mdoc_validate.c +++ b/usr.bin/mandoc/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_validate.c,v 1.229 2017/01/10 12:54:28 schwarze Exp $ */ +/* $OpenBSD: mdoc_validate.c,v 1.230 2017/01/10 13:46:53 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org> @@ -315,9 +315,9 @@ mdoc_node_validate(struct roff_man *mdoc) */ if (n->child != NULL) - n->child->flags &= ~MDOC_DELIMC; + n->child->flags &= ~NODE_DELIMC; if (n->last != NULL) - n->last->flags &= ~MDOC_DELIMO; + n->last->flags &= ~NODE_DELIMO; /* Call the macro's postprocessor. */ @@ -1546,7 +1546,7 @@ static void post_ns(POST_ARGS) { - if (mdoc->last->flags & MDOC_LINE) + if (mdoc->last->flags & NODE_LINE) mandoc_msg(MANDOCERR_NS_SKIP, mdoc->parse, mdoc->last->line, mdoc->last->pos, NULL); } diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c index 2474f9a0f3d..901b41e3855 100644 --- a/usr.bin/mandoc/roff.c +++ b/usr.bin/mandoc/roff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: roff.c,v 1.156 2016/01/08 17:48:04 schwarze Exp $ */ +/* $OpenBSD: roff.c,v 1.157 2017/01/10 13:46:53 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -989,11 +989,11 @@ roff_node_alloc(struct roff_man *man, int line, int pos, n->sec = man->lastsec; if (man->flags & MDOC_SYNOPSIS) - n->flags |= MDOC_SYNPRETTY; + n->flags |= NODE_SYNPRETTY; else - n->flags &= ~MDOC_SYNPRETTY; + n->flags &= ~NODE_SYNPRETTY; if (man->flags & MDOC_NEWLINE) - n->flags |= MDOC_LINE; + n->flags |= NODE_LINE; man->flags &= ~MDOC_NEWLINE; return n; @@ -1058,9 +1058,9 @@ roff_word_alloc(struct roff_man *man, int line, int pos, const char *word) n->string = roff_strdup(man->roff, word); roff_node_append(man, n); if (man->macroset == MACROSET_MDOC) - n->flags |= MDOC_VALID | MDOC_ENDED; + n->flags |= NODE_VALID | NODE_ENDED; else - n->flags |= MAN_VALID; + n->flags |= NODE_VALID; man->next = ROFF_NEXT_SIBLING; } @@ -1130,7 +1130,7 @@ roff_addeqn(struct roff_man *man, const struct eqn *eqn) n = roff_node_alloc(man, eqn->ln, eqn->pos, ROFFT_EQN, TOKEN_NONE); n->eqn = eqn; if (eqn->ln > man->last->line) - n->flags |= MDOC_LINE; + n->flags |= NODE_LINE; roff_node_append(man, n); man->next = ROFF_NEXT_SIBLING; } @@ -1146,9 +1146,9 @@ roff_addtbl(struct roff_man *man, const struct tbl_span *tbl) n->span = tbl; roff_node_append(man, n); if (man->macroset == MACROSET_MDOC) - n->flags |= MDOC_VALID | MDOC_ENDED; + n->flags |= NODE_VALID | NODE_ENDED; else - n->flags |= MAN_VALID; + n->flags |= NODE_VALID; man->next = ROFF_NEXT_SIBLING; } diff --git a/usr.bin/mandoc/roff.h b/usr.bin/mandoc/roff.h index 97c367b0f3b..6dc1bd3da7b 100644 --- a/usr.bin/mandoc/roff.h +++ b/usr.bin/mandoc/roff.h @@ -1,4 +1,4 @@ -/* $OpenBSD: roff.h,v 1.20 2017/01/10 12:54:28 schwarze Exp $ */ +/* $OpenBSD: roff.h,v 1.21 2017/01/10 13:46:53 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -98,17 +98,14 @@ struct roff_node { int tok; /* Request or macro ID. */ #define TOKEN_NONE (-1) /* No request or macro. */ int flags; -#define MDOC_VALID (1 << 0) /* Has been validated. */ -#define MDOC_ENDED (1 << 1) /* Gone past body end mark. */ -#define MDOC_EOS (1 << 2) /* At sentence boundary. */ -#define MDOC_LINE (1 << 3) /* First macro/text on line. */ -#define MDOC_SYNPRETTY (1 << 4) /* SYNOPSIS-style formatting. */ -#define MDOC_BROKEN (1 << 5) /* Must validate parent when ending. */ -#define MDOC_DELIMO (1 << 6) -#define MDOC_DELIMC (1 << 7) -#define MAN_VALID MDOC_VALID -#define MAN_EOS MDOC_EOS -#define MAN_LINE MDOC_LINE +#define NODE_VALID (1 << 0) /* Has been validated. */ +#define NODE_ENDED (1 << 1) /* Gone past body end mark. */ +#define NODE_EOS (1 << 2) /* At sentence boundary. */ +#define NODE_LINE (1 << 3) /* First macro/text on line. */ +#define NODE_SYNPRETTY (1 << 4) /* SYNOPSIS-style formatting. */ +#define NODE_BROKEN (1 << 5) /* Must validate parent when ending. */ +#define NODE_DELIMO (1 << 6) +#define NODE_DELIMC (1 << 7) #define NODE_NOSRC (1 << 8) /* Generated node, not in input file. */ #define NODE_NOPRT (1 << 9) /* Shall not print anything. */ int prev_font; /* Before entering this node. */ diff --git a/usr.bin/mandoc/tree.c b/usr.bin/mandoc/tree.c index b37abf87f05..e32dbe075b2 100644 --- a/usr.bin/mandoc/tree.c +++ b/usr.bin/mandoc/tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tree.c,v 1.37 2017/01/10 12:54:28 schwarze Exp $ */ +/* $OpenBSD: tree.c,v 1.38 2017/01/10 13:46:53 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -157,14 +157,14 @@ print_mdoc(const struct roff_node *n, int indent) } putchar(' '); - if (MDOC_DELIMO & n->flags) + if (NODE_DELIMO & n->flags) putchar('('); - if (MDOC_LINE & n->flags) + if (NODE_LINE & n->flags) putchar('*'); printf("%d:%d", n->line, n->pos + 1); - if (MDOC_DELIMC & n->flags) + if (NODE_DELIMC & n->flags) putchar(')'); - if (MDOC_EOS & n->flags) + if (NODE_EOS & n->flags) putchar('.'); if (NODE_NOSRC & n->flags) printf(" NOSRC"); @@ -250,10 +250,10 @@ print_man(const struct roff_node *n, int indent) for (i = 0; i < indent; i++) putchar(' '); printf("%s (%s) ", p, t); - if (MAN_LINE & n->flags) + if (NODE_LINE & n->flags) putchar('*'); printf("%d:%d", n->line, n->pos + 1); - if (MAN_EOS & n->flags) + if (NODE_EOS & n->flags) putchar('.'); putchar('\n'); } |