diff options
-rw-r--r-- | libman.h | 4 | ||||
-rw-r--r-- | man.c | 8 | ||||
-rw-r--r-- | man.h | 5 | ||||
-rw-r--r-- | man_action.c | 20 | ||||
-rw-r--r-- | man_html.c | 5 | ||||
-rw-r--r-- | man_macro.c | 94 | ||||
-rw-r--r-- | man_term.c | 5 | ||||
-rw-r--r-- | man_validate.c | 23 |
8 files changed, 5 insertions, 159 deletions
@@ -28,7 +28,6 @@ struct man { void *data; struct man_cb cb; int pflags; /* parse flags (see man.h) */ - int svflags; /* flags saved during roff blocks */ int flags; /* parse flags */ #define MAN_HALT (1 << 0) /* badness happened: die */ #define MAN_ELINE (1 << 1) /* Next-line element scope. */ @@ -37,7 +36,6 @@ struct man { #define MAN_LITERAL (1 << 4) /* Literal input. */ #define MAN_BPLINE (1 << 5) enum man_next next; - enum man_next svnext; struct man_node *last; struct man_node *first; struct man_meta meta; @@ -62,8 +60,6 @@ enum merr { WNOSCOPE, WOLITERAL, WNLITERAL, - WROFFNEST, - WROFFSCOPE, WTITLECASE, WBADCOMMENT, WERRMAX @@ -49,8 +49,6 @@ const char *const __man_merrnames[WERRMAX] = { "no scope context", /* WNOSCOPE */ "literal context already open", /* WOLITERAL */ "no literal context open", /* WNLITERAL */ - "invalid nesting of roff declarations", /* WROFFNEST */ - "scope in roff instructions broken", /* WROFFSCOPE */ "document title should be uppercase", /* WTITLECASE */ "deprecated comment style", /* WBADCOMMENT */ }; @@ -64,8 +62,7 @@ const char *const __man_macronames[MAN_MAX] = { "RI", "na", "i", "sp", "nf", "fi", "r", "RE", "RS", "DT", "UC", "PD", - "Sp", "Vb", "Ve", "de", - "dei", "am", "ami", ".", + "Sp", "Vb", "Ve", }; const char * const *man_macronames = __man_macronames; @@ -548,9 +545,6 @@ man_pmacro(struct man *m, int ln, char *buf) * Remove prior ELINE macro, as it's being clobbering by a new * macro. Note that NSCOPED macros do not close out ELINE * macros---they don't print text---so we let those slip by. - * NOTE: we don't allow roff blocks (NOCLOSE) to be embedded - * here because that would stipulate blocks as children of - * elements! */ if ( ! (MAN_NSCOPED & man_macros[tok].flags) && @@ -55,11 +55,6 @@ enum mant { MAN_Sp, MAN_Vb, MAN_Ve, - MAN_de, - MAN_dei, - MAN_am, - MAN_ami, - MAN_dot, MAN_MAX }; diff --git a/man_action.c b/man_action.c index befdab37..cf3e0e1b 100644 --- a/man_action.c +++ b/man_action.c @@ -30,7 +30,6 @@ struct actions { }; static int post_TH(struct man *); -static int post_de(struct man *); static int post_fi(struct man *); static int post_nf(struct man *); @@ -70,11 +69,6 @@ const struct actions man_actions[MAN_MAX] = { { NULL }, /* Sp */ { post_nf }, /* Vb */ { post_fi }, /* Ve */ - { post_de }, /* de */ - { post_de }, /* dei */ - { post_de }, /* am */ - { post_de }, /* ami */ - { NULL }, /* . */ }; @@ -114,20 +108,6 @@ post_fi(struct man *m) static int -post_de(struct man *m) -{ - - /* - * XXX: for the time being, we indiscriminately remove roff - * instructions from the parse stream. - */ - if (MAN_BLOCK == m->last->type) - man_node_delete(m, m->last); - return(1); -} - - -static int post_nf(struct man *m) { @@ -106,11 +106,6 @@ static const struct htmlman mans[MAN_MAX] = { { man_br_pre, NULL }, /* Sp */ { man_ign_pre, NULL }, /* Vb */ { NULL, NULL }, /* Ve */ - { man_ign_pre, NULL }, /* de */ - { man_ign_pre, NULL }, /* dei */ - { man_ign_pre, NULL }, /* am */ - { man_ign_pre, NULL }, /* ami */ - { NULL, NULL }, /* . */ }; diff --git a/man_macro.c b/man_macro.c index cc5d7b86..4a65a66b 100644 --- a/man_macro.c +++ b/man_macro.c @@ -32,7 +32,6 @@ enum rew { }; static int blk_close(MACRO_PROT_ARGS); -static int blk_dotted(MACRO_PROT_ARGS); static int blk_exp(MACRO_PROT_ARGS); static int blk_imp(MACRO_PROT_ARGS); static int in_line_eoln(MACRO_PROT_ARGS); @@ -82,11 +81,6 @@ const struct man_macro __man_macros[MAN_MAX] = { { in_line_eoln, MAN_NSCOPED }, /* Sp */ { in_line_eoln, 0 }, /* Vb */ { in_line_eoln, 0 }, /* Ve */ - { blk_exp, MAN_EXPLICIT | MAN_NOCLOSE}, /* de */ - { blk_exp, MAN_EXPLICIT | MAN_NOCLOSE}, /* dei */ - { blk_exp, MAN_EXPLICIT | MAN_NOCLOSE}, /* am */ - { blk_exp, MAN_EXPLICIT | MAN_NOCLOSE}, /* ami */ - { blk_dotted, 0 }, /* . */ }; const struct man_macro * const man_macros = __man_macros; @@ -105,8 +99,6 @@ rew_warn(struct man *m, struct man_node *n, enum merr er) return(1); if ( ! (MAN_EXPLICIT & man_macros[n->tok].flags)) return(1); - if (MAN_NOCLOSE & man_macros[n->tok].flags) - return(1); return(man_nwarn(m, n, er)); } @@ -186,24 +178,6 @@ rew_dohalt(enum mant tok, enum man_type type, const struct man_node *n) if (type == n->type && tok == n->tok) return(REW_REWIND); - /* - * If we're a roff macro, then we can close out anything that - * stands between us and our parent context. - */ - if (MAN_NOCLOSE & man_macros[tok].flags) - return(REW_NOHALT); - - /* - * Don't clobber roff macros: this is a bit complicated. If the - * current macro is a roff macro, halt immediately and don't - * rewind. If it's not, and the parent is, then close out the - * current scope and halt at the parent. - */ - if (MAN_NOCLOSE & man_macros[n->tok].flags) - return(REW_HALT); - if (MAN_NOCLOSE & man_macros[n->parent->tok].flags) - return(REW_REWIND); - /* * Next follow the implicit scope-smashings as defined by man.7: * section, sub-section, etc. @@ -272,59 +246,12 @@ rew_scope(enum man_type type, struct man *m, enum mant tok) * instruction that's mowing over explicit scopes. */ assert(n); - if (MAN_NOCLOSE & man_macros[tok].flags) - return(man_unscope(m, n, WROFFSCOPE)); return(man_unscope(m, n, WERRMAX)); } /* - * Closure for dotted macros (de, dei, am, ami, ign). This must handle - * any of these as the parent node, so it needs special handling. - * Beyond this, it's the same as blk_close(). - */ -/* ARGSUSED */ -int -blk_dotted(MACRO_PROT_ARGS) -{ - enum mant ntok; - struct man_node *nn; - - /* Check for any of the following parents... */ - - for (nn = m->last->parent; nn; nn = nn->parent) - if (nn->tok == MAN_de || nn->tok == MAN_dei || - nn->tok == MAN_am || - nn->tok == MAN_ami) { - ntok = nn->tok; - break; - } - - if (NULL == nn) { - if ( ! man_pwarn(m, line, ppos, WNOSCOPE)) - return(0); - return(1); - } - - if ( ! rew_scope(MAN_BODY, m, ntok)) - return(0); - if ( ! rew_scope(MAN_BLOCK, m, ntok)) - return(0); - - /* - * Restore flags set when we got here and also stipulate that we - * don't post-process the line when exiting the macro op - * function in man_pmacro(). See blk_exp(). - */ - - m->flags = m->svflags | MAN_ILINE; - m->next = m->svnext; - return(1); -} - - -/* * Close out a generic explicit macro. */ /* ARGSUSED */ @@ -372,23 +299,10 @@ blk_exp(MACRO_PROT_ARGS) * anywhere. */ - if ( ! (MAN_NOCLOSE & man_macros[tok].flags)) { - if ( ! rew_scope(MAN_BODY, m, tok)) - return(0); - if ( ! rew_scope(MAN_BLOCK, m, tok)) - return(0); - } else { - /* - * Save our state and next-scope indicator; we restore - * it when exiting from the roff instruction block. See - * blk_dotted(). - */ - m->svflags = m->flags; - m->svnext = m->next; - - /* Make sure we drop any line modes. */ - m->flags = 0; - } + if ( ! rew_scope(MAN_BODY, m, tok)) + return(0); + if ( ! rew_scope(MAN_BLOCK, m, tok)) + return(0); if ( ! man_block_alloc(m, line, ppos, tok)) return(0); @@ -142,11 +142,6 @@ static const struct termact termacts[MAN_MAX] = { { pre_sp, NULL, MAN_NOTEXT }, /* Sp */ { pre_nf, NULL, 0 }, /* Vb */ { pre_fi, NULL, 0 }, /* Ve */ - { pre_ign, NULL, MAN_NOTEXT }, /* de */ - { pre_ign, NULL, MAN_NOTEXT }, /* dei */ - { pre_ign, NULL, MAN_NOTEXT }, /* am */ - { pre_ign, NULL, MAN_NOTEXT }, /* ami */ - { NULL, NULL, 0 }, /* . */ }; diff --git a/man_validate.c b/man_validate.c index fefc4fdd..4e250973 100644 --- a/man_validate.c +++ b/man_validate.c @@ -46,7 +46,6 @@ static int check_ge2(CHKARGS); static int check_le5(CHKARGS); static int check_par(CHKARGS); static int check_part(CHKARGS); -static int check_roff(CHKARGS); static int check_root(CHKARGS); static int check_sec(CHKARGS); static int check_text(CHKARGS); @@ -59,7 +58,6 @@ static v_check posts_part[] = { check_part, NULL }; static v_check posts_sec[] = { check_sec, NULL }; static v_check posts_le1[] = { check_le1, NULL }; static v_check pres_bline[] = { check_bline, NULL }; -static v_check pres_roff[] = { check_roff, NULL }; static const struct man_valid man_valids[MAN_MAX] = { { NULL, posts_eq0 }, /* br */ @@ -97,11 +95,6 @@ static const struct man_valid man_valids[MAN_MAX] = { { NULL, posts_le1 }, /* Sp */ { pres_bline, posts_le1 }, /* Vb */ { pres_bline, posts_eq0 }, /* Ve */ - { pres_roff, NULL }, /* de */ - { pres_roff, NULL }, /* dei */ - { pres_roff, NULL }, /* am */ - { pres_roff, NULL }, /* ami */ - { NULL, NULL }, /* . */ }; @@ -323,19 +316,3 @@ check_bline(CHKARGS) return(1); } - -static int -check_roff(CHKARGS) -{ - - if (MAN_BLOCK != n->type) - return(1); - - for (n = n->parent; n; n = n->parent) - if (MAN_de == n->tok || MAN_dei == n->tok || - MAN_am == n->tok || - MAN_ami == n->tok) - return(man_nerr(m, n, WROFFNEST)); - - return(1); -} |