=================================================================== RCS file: /cvs/mandoc/mdoc_macro.c,v retrieving revision 1.47 retrieving revision 1.49 diff -u -p -r1.47 -r1.49 --- mandoc/mdoc_macro.c 2010/03/31 07:13:53 1.47 +++ mandoc/mdoc_macro.c 2010/03/31 08:04:57 1.49 @@ -1,4 +1,4 @@ -/* $Id: mdoc_macro.c,v 1.47 2010/03/31 07:13:53 kristaps Exp $ */ +/* $Id: mdoc_macro.c,v 1.49 2010/03/31 08:04:57 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -538,10 +538,8 @@ rew_dobreak(enum mdoct tok, const struct mdoc_node *p) return(1); break; case (MDOC_Oc): -#ifdef UGLY if (MDOC_Op == p->tok) return(1); -#endif break; default: break; @@ -881,7 +879,10 @@ blk_full(MACRO_PROT_ARGS) int c, la; struct mdoc_arg *arg; struct mdoc_node *head; /* save of head macro */ + struct mdoc_node *body; /* save of body macro */ +#ifdef UGLY struct mdoc_node *n; +#endif char *p; /* Close out prior implicit scope. */ @@ -923,7 +924,7 @@ blk_full(MACRO_PROT_ARGS) if ( ! mdoc_block_alloc(m, line, ppos, tok, arg)) return(0); - head = NULL; + head = body = NULL; /* * The `Nd' macro has all arguments in its body: it's a hybrid @@ -938,6 +939,7 @@ blk_full(MACRO_PROT_ARGS) return(0); if ( ! mdoc_body_alloc(m, line, ppos, tok)) return(0); + body = m->last; } for (;;) { @@ -994,20 +996,23 @@ blk_full(MACRO_PROT_ARGS) if (1 == ppos && ! append_delims(m, line, pos, buf)) return(0); - /* See notes on `Nd' hybrid, above. */ + /* If we've already opened our body, exit now. */ - if (MDOC_Nd == tok) + if (NULL != body) return(1); #ifdef UGLY /* - * If there is an open sub-block requiring explicit close-out, - * postpone switching the current block from head to body until - * the rew_sub() call closing out that sub-block. + * If there is an open (i.e., unvalidated) sub-block requiring + * explicit close-out, postpone switching the current block from + * head to body until the rew_sub() call closing out that + * sub-block. */ for (n = m->last; n && n != head; n = n->parent) { - if (MDOC_EXPLICIT & mdoc_macros[n->tok].flags && - MDOC_BLOCK == n->type) { + if (MDOC_BLOCK == n->type && + MDOC_EXPLICIT & mdoc_macros[n->tok].flags && + ! (MDOC_VALID & n->flags)) { + assert( ! (MDOC_ACTED & n->flags)); n->pending = head; return(1); } @@ -1102,7 +1107,6 @@ blk_part_imp(MACRO_PROT_ARGS) body = m->last; } -#ifdef UGLY /* * If we can't rewind to our body, then our scope has already * been closed by another macro (like `Oc' closing `Op'). This @@ -1112,7 +1116,6 @@ blk_part_imp(MACRO_PROT_ARGS) for (n = m->last; n; n = n->parent) if (body == n) break; -#endif if (NULL == n && ! mdoc_nwarn(m, body, EIMPBRK)) return(0);