=================================================================== RCS file: /cvs/mandoc/man_macro.c,v retrieving revision 1.44 retrieving revision 1.54 diff -u -p -r1.44 -r1.54 --- mandoc/man_macro.c 2010/05/15 22:44:04 1.44 +++ mandoc/man_macro.c 2010/12/08 10:58:22 1.54 @@ -1,6 +1,6 @@ -/* $Id: man_macro.c,v 1.44 2010/05/15 22:44:04 kristaps Exp $ */ +/* $Id: man_macro.c,v 1.54 2010/12/08 10:58:22 kristaps Exp $ */ /* - * Copyright (c) 2008, 2009 Kristaps Dzonsons + * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -23,6 +23,7 @@ #include #include +#include "mandoc.h" #include "libman.h" enum rew { @@ -43,7 +44,7 @@ static enum rew rew_dohalt(enum mant, enum man_type, static enum rew rew_block(enum mant, enum man_type, const struct man_node *); static int rew_warn(struct man *, - struct man_node *, enum merr); + struct man_node *, enum mandocerr); const struct man_macro __man_macros[MAN_MAX] = { { in_line_eoln, MAN_NSCOPED }, /* br */ @@ -68,19 +69,17 @@ const struct man_macro __man_macros[MAN_MAX] = { { in_line_eoln, 0 }, /* IR */ { in_line_eoln, 0 }, /* RI */ { in_line_eoln, MAN_NSCOPED }, /* na */ - { in_line_eoln, 0 }, /* i */ { in_line_eoln, MAN_NSCOPED }, /* sp */ { in_line_eoln, 0 }, /* nf */ { in_line_eoln, 0 }, /* fi */ - { in_line_eoln, 0 }, /* r */ { blk_close, 0 }, /* RE */ { blk_exp, MAN_EXPLICIT }, /* RS */ { in_line_eoln, 0 }, /* DT */ { in_line_eoln, 0 }, /* UC */ { in_line_eoln, 0 }, /* PD */ - { in_line_eoln, MAN_NSCOPED }, /* Sp */ - { in_line_eoln, 0 }, /* Vb */ - { in_line_eoln, 0 }, /* Ve */ + { in_line_eoln, 0 }, /* AT */ + { in_line_eoln, 0 }, /* in */ + { in_line_eoln, 0 }, /* ft */ }; const struct man_macro * const man_macros = __man_macros; @@ -90,25 +89,26 @@ const struct man_macro * const man_macros = __man_macr * Warn when "n" is an explicit non-roff macro. */ static int -rew_warn(struct man *m, struct man_node *n, enum merr er) +rew_warn(struct man *m, struct man_node *n, enum mandocerr er) { - if (er == WERRMAX || MAN_BLOCK != n->type) + if (er == MANDOCERR_MAX || MAN_BLOCK != n->type) return(1); if (MAN_VALID & n->flags) return(1); if ( ! (MAN_EXPLICIT & man_macros[n->tok].flags)) return(1); - return(man_nwarn(m, n, er)); + return(man_nmsg(m, n, er)); } /* - * Rewind scope. If a code "er" != WERRMAX has been provided, it will - * be used if an explicit block scope is being closed out. + * Rewind scope. If a code "er" != MANDOCERR_MAX has been provided, it + * will be used if an explicit block scope is being closed out. */ int -man_unscope(struct man *m, const struct man_node *n, enum merr er) +man_unscope(struct man *m, const struct man_node *n, + enum mandocerr er) { assert(n); @@ -119,8 +119,6 @@ man_unscope(struct man *m, const struct man_node *n, e return(0); if ( ! man_valid_post(m)) return(0); - if ( ! man_action_post(m)) - return(0); m->last = m->last->parent; assert(m->last); } @@ -129,8 +127,6 @@ man_unscope(struct man *m, const struct man_node *n, e return(0); if ( ! man_valid_post(m)) return(0); - if ( ! man_action_post(m)) - return(0); m->next = MAN_ROOT == m->last->type ? MAN_NEXT_CHILD : MAN_NEXT_SIBLING; @@ -247,7 +243,7 @@ rew_scope(enum man_type type, struct man *m, enum mant */ assert(n); - return(man_unscope(m, n, WERRMAX)); + return(man_unscope(m, n, MANDOCERR_MAX)); } @@ -275,7 +271,7 @@ blk_close(MACRO_PROT_ARGS) break; if (NULL == nn) - if ( ! man_pwarn(m, line, ppos, WNOSCOPE)) + if ( ! man_pmsg(m, line, ppos, MANDOCERR_NOSCOPE)) return(0); if ( ! rew_scope(MAN_BODY, m, ntok)) @@ -287,6 +283,7 @@ blk_close(MACRO_PROT_ARGS) } +/* ARGSUSED */ int blk_exp(MACRO_PROT_ARGS) { @@ -338,6 +335,7 @@ blk_exp(MACRO_PROT_ARGS) * scopes, such as `SH' closing out an `SS', are defined in the rew * routines. */ +/* ARGSUSED */ int blk_imp(MACRO_PROT_ARGS) { @@ -395,6 +393,7 @@ blk_imp(MACRO_PROT_ARGS) } +/* ARGSUSED */ int in_line_eoln(MACRO_PROT_ARGS) { @@ -451,8 +450,6 @@ in_line_eoln(MACRO_PROT_ARGS) break; if ( ! man_valid_post(m)) return(0); - if ( ! man_action_post(m)) - return(0); } assert(m->last); @@ -463,8 +460,6 @@ in_line_eoln(MACRO_PROT_ARGS) if (m->last->type != MAN_ROOT && ! man_valid_post(m)) return(0); - if (m->last->type != MAN_ROOT && ! man_action_post(m)) - return(0); m->next = MAN_ROOT == m->last->type ? MAN_NEXT_CHILD : MAN_NEXT_SIBLING; @@ -477,6 +472,6 @@ int man_macroend(struct man *m) { - return(man_unscope(m, m->first, WEXITSCOPE)); + return(man_unscope(m, m->first, MANDOCERR_SCOPEEXIT)); }