From 9cec32b191bc0a490e538c0974b0b1aaf7d747a7 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Sat, 15 May 2010 22:44:04 +0000 Subject: Remove `am', `ami', `de', `dei', and `.' from -man, as they're now in the roff preprocessor. --- libman.h | 6 +--- man.c | 10 ++---- man.h | 7 +---- man_action.c | 22 +------------- man_html.c | 7 +---- man_macro.c | 96 +++------------------------------------------------------- man_term.c | 7 +---- man_validate.c | 25 +-------------- 8 files changed, 13 insertions(+), 167 deletions(-) diff --git a/libman.h b/libman.h index 7f96b535..0c1c5a9e 100644 --- a/libman.h +++ b/libman.h @@ -1,4 +1,4 @@ -/* $Id: libman.h,v 1.32 2010/05/15 15:54:39 kristaps Exp $ */ +/* $Id: libman.h,v 1.33 2010/05/15 22:44:04 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons * @@ -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 diff --git a/man.c b/man.c index 1bfbbe16..07b02369 100644 --- a/man.c +++ b/man.c @@ -1,4 +1,4 @@ -/* $Id: man.c,v 1.69 2010/05/15 20:51:40 kristaps Exp $ */ +/* $Id: man.c,v 1.70 2010/05/15 22:44:04 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -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) && diff --git a/man.h b/man.h index 183b21dd..a0ea681a 100644 --- a/man.h +++ b/man.h @@ -1,4 +1,4 @@ -/* $Id: man.h,v 1.31 2010/05/15 20:51:40 kristaps Exp $ */ +/* $Id: man.h,v 1.32 2010/05/15 22:44:04 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons * @@ -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 9bfe9b46..b0387189 100644 --- a/man_action.c +++ b/man_action.c @@ -1,4 +1,4 @@ -/* $Id: man_action.c,v 1.33 2010/05/15 20:51:40 kristaps Exp $ */ +/* $Id: man_action.c,v 1.34 2010/05/15 22:44:04 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -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 }, /* . */ }; @@ -113,20 +107,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) { diff --git a/man_html.c b/man_html.c index 7437ab20..3a6be4a9 100644 --- a/man_html.c +++ b/man_html.c @@ -1,4 +1,4 @@ -/* $Id: man_html.c,v 1.32 2010/05/15 20:51:40 kristaps Exp $ */ +/* $Id: man_html.c,v 1.33 2010/05/15 22:44:04 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -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 012d4163..c2e4bec0 100644 --- a/man_macro.c +++ b/man_macro.c @@ -1,4 +1,4 @@ -/* $Id: man_macro.c,v 1.43 2010/05/15 20:51:40 kristaps Exp $ */ +/* $Id: man_macro.c,v 1.44 2010/05/15 22:44:04 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -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,58 +246,11 @@ 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. */ @@ -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); diff --git a/man_term.c b/man_term.c index 0f6b4c03..49ded282 100644 --- a/man_term.c +++ b/man_term.c @@ -1,4 +1,4 @@ -/* $Id: man_term.c,v 1.67 2010/05/15 20:51:40 kristaps Exp $ */ +/* $Id: man_term.c,v 1.68 2010/05/15 22:44:04 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -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 bfce2287..ec9706f6 100644 --- a/man_validate.c +++ b/man_validate.c @@ -1,4 +1,4 @@ -/* $Id: man_validate.c,v 1.38 2010/05/15 20:51:40 kristaps Exp $ */ +/* $Id: man_validate.c,v 1.39 2010/05/15 22:44:04 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -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); -} -- cgit v1.2.3-56-ge451