+ 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 ||
+ nn->tok == MAN_ig) {
+ 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 */
+int
+blk_close(MACRO_PROT_ARGS)
+{
+ enum mant ntok;
+ const struct man_node *nn;
+
+ switch (tok) {
+ case (MAN_RE):
+ ntok = MAN_RS;
+ break;
+ default:
+ abort();
+ /* NOTREACHED */
+ }
+
+ for (nn = m->last->parent; nn; nn = nn->parent)
+ if (ntok == nn->tok)
+ break;
+
+ if (NULL == nn)
+ if ( ! man_pwarn(m, line, ppos, WNOSCOPE))
+ return(0);
+
+ if ( ! rew_scope(MAN_BODY, m, ntok))
+ return(0);
+ if ( ! rew_scope(MAN_BLOCK, m, ntok))
+ return(0);
+
+ return(1);
+}
+
+
+int
+blk_exp(MACRO_PROT_ARGS)
+{
+ int w, la;
+ char *p;
+
+ /*
+ * Close out prior scopes. "Regular" explicit macros cannot be
+ * nested, but we allow roff macros to be placed just about
+ * 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 ( ! man_block_alloc(m, line, ppos, tok))
+ return(0);
+ if ( ! man_head_alloc(m, line, ppos, tok))
+ return(0);
+
+ for (;;) {
+ la = *pos;
+ w = man_args(m, line, pos, buf, &p);
+
+ if (-1 == w)
+ return(0);
+ if (0 == w)
+ break;
+
+ if ( ! man_word_alloc(m, line, la, p))
+ return(0);
+ }
+
+ assert(m);
+ assert(tok != MAN_MAX);
+
+ if ( ! rew_scope(MAN_HEAD, m, tok))
+ return(0);
+ return(man_body_alloc(m, line, ppos, tok));