diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2017-01-10 13:47:00 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2017-01-10 13:47:00 +0000 |
commit | 8d7c45893d14200cf487664ea9966f4c64db548d (patch) | |
tree | 1d3d7493d7bb10da3b43ff578cf8b4808127d552 | |
parent | b0911daecba940ec62df1e631a2f8a01d7ffe641 (diff) | |
download | mandoc-8d7c45893d14200cf487664ea9966f4c64db548d.tar.gz |
unify names of AST node flags; no change of cpp output
-rw-r--r-- | demandoc.c | 4 | ||||
-rw-r--r-- | man.c | 8 | ||||
-rw-r--r-- | man_html.c | 6 | ||||
-rw-r--r-- | man_macro.c | 10 | ||||
-rw-r--r-- | man_term.c | 16 | ||||
-rw-r--r-- | mdoc.c | 8 | ||||
-rw-r--r-- | mdoc_html.c | 36 | ||||
-rw-r--r-- | mdoc_macro.c | 60 | ||||
-rw-r--r-- | mdoc_man.c | 34 | ||||
-rw-r--r-- | mdoc_state.c | 2 | ||||
-rw-r--r-- | mdoc_term.c | 46 | ||||
-rw-r--r-- | mdoc_validate.c | 6 | ||||
-rw-r--r-- | roff.c | 16 | ||||
-rw-r--r-- | roff.h | 19 | ||||
-rw-r--r-- | tree.c | 12 |
15 files changed, 140 insertions, 143 deletions
@@ -239,7 +239,7 @@ pmdoc(const struct roff_node *p, int *line, int *col, int list) { for ( ; p; p = p->next) { - if (MDOC_LINE & p->flags) + if (NODE_LINE & p->flags) pline(p->line, line, col, list); if (ROFFT_TEXT == p->type) pstring(p->string, p->pos, col, list); @@ -253,7 +253,7 @@ pman(const struct roff_node *p, int *line, int *col, int list) { for ( ; p; p = p->next) { - if (MAN_LINE & p->flags) + if (NODE_LINE & p->flags) pline(p->line, line, col, list); if (ROFFT_TEXT == p->type) pstring(p->string, p->pos, col, list); @@ -149,7 +149,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; @@ -340,7 +340,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; @@ -348,7 +348,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; @@ -356,7 +356,7 @@ man_state(struct roff_man *man, struct roff_node *n) default: break; } - man->last->flags |= MAN_VALID; + man->last->flags |= NODE_VALID; } void @@ -211,14 +211,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; @@ -512,7 +512,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/man_macro.c b/man_macro.c index 4ea78146..ee144e97 100644 --- a/man_macro.c +++ b/man_macro.c @@ -95,7 +95,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, @@ -130,7 +130,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; } /* @@ -164,7 +164,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; } @@ -356,13 +356,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., @@ -319,7 +319,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; @@ -677,7 +677,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) @@ -698,7 +698,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) { @@ -960,17 +960,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: @@ -1007,7 +1007,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; @@ -1023,7 +1023,7 @@ out: p->rmargin = rm; p->maxrmargin = rmax; } - if (MAN_EOS & n->flags) + if (NODE_EOS & n->flags) p->flags |= TERMP_SENTENCE; } @@ -140,8 +140,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; @@ -292,7 +292,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; } @@ -311,7 +311,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/mdoc_html.c b/mdoc_html.c index fffe10f3..7251be73 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -286,7 +286,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 && @@ -382,7 +382,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: @@ -393,17 +393,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; @@ -431,7 +431,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; } @@ -445,11 +445,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; @@ -608,7 +608,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; @@ -714,7 +714,7 @@ static int mdoc_ns_pre(MDOC_ARGS) { - if ( ! (MDOC_LINE & n->flags)) + if ( ! (NODE_LINE & n->flags)) h->flags |= HTML_NOSPACE; return 1; } @@ -1161,7 +1161,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"); @@ -1400,7 +1400,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. */ @@ -1430,7 +1430,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); @@ -1459,7 +1459,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); @@ -1649,7 +1649,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, "<"); @@ -1826,7 +1826,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; } @@ -1897,7 +1897,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/mdoc_macro.c b/mdoc_macro.c index d232b09e..facec52e 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -216,7 +216,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) @@ -264,16 +264,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; } @@ -298,7 +298,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; @@ -309,7 +309,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; @@ -390,18 +390,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], @@ -444,11 +444,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; } @@ -481,7 +481,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; } } @@ -554,7 +554,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; @@ -568,9 +568,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; } @@ -620,7 +620,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 @@ -642,7 +642,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; } @@ -706,11 +706,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 @@ -769,7 +769,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; } @@ -863,7 +863,7 @@ in_line(MACRO_PROT_ARGS) */ if (firstarg && d == DELIM_CLOSE && !nc) - mdoc->last->flags &= ~MDOC_DELIMC; + mdoc->last->flags &= ~NODE_DELIMC; firstarg = 0; /* @@ -926,9 +926,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) @@ -1129,7 +1129,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); @@ -1464,7 +1464,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; @@ -582,13 +582,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) { /* @@ -601,10 +601,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 { /* @@ -630,14 +630,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); @@ -808,7 +808,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 && @@ -1176,7 +1176,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(); @@ -1230,7 +1230,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; } @@ -1244,7 +1244,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'); @@ -1265,7 +1265,7 @@ post_fn(DECL_ARGS) { print_word(")"); - if (MDOC_SYNPRETTY & n->flags) { + if (NODE_SYNPRETTY & n->flags) { print_word(";"); outflags |= MMAN_PP; } @@ -1282,7 +1282,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; @@ -1327,7 +1327,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 <"); @@ -1344,7 +1344,7 @@ static void post_in(DECL_ARGS) { - if (MDOC_SYNPRETTY & n->flags) { + if (NODE_SYNPRETTY & n->flags) { outflags &= ~MMAN_spc; print_word(">"); font_pop(); @@ -1619,7 +1619,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; } @@ -1751,7 +1751,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); @@ -1770,7 +1770,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/mdoc_state.c b/mdoc_state.c index cd5d6ca8..705e3cd3 100644 --- a/mdoc_state.c +++ b/mdoc_state.c @@ -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/mdoc_term.c b/mdoc_term.c index 6cdf9d84..363e616d 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -319,7 +319,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)); @@ -330,7 +330,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; } @@ -342,19 +342,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: @@ -384,7 +384,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); @@ -394,7 +394,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 @@ -406,7 +406,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) { @@ -1051,7 +1051,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; @@ -1096,7 +1096,7 @@ static int termp_ns_pre(DECL_ARGS) { - if ( ! (MDOC_LINE & n->flags)) + if ( ! (NODE_LINE & n->flags)) p->flags |= TERMP_NOSPACE; return 1; } @@ -1262,7 +1262,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; /* @@ -1411,7 +1411,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); } @@ -1439,7 +1439,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; @@ -1451,7 +1451,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); @@ -1617,7 +1617,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; @@ -1718,7 +1718,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; } @@ -1773,7 +1773,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, "<"); @@ -1790,13 +1790,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); } @@ -2003,7 +2003,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); @@ -2049,7 +2049,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/mdoc_validate.c b/mdoc_validate.c index a6225b49..b41125a5 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -317,9 +317,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. */ @@ -1555,7 +1555,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); } @@ -991,11 +991,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; @@ -1060,9 +1060,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; } @@ -1132,7 +1132,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; } @@ -1148,9 +1148,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; } @@ -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. */ @@ -159,14 +159,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"); @@ -252,10 +252,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'); } |