+termp_op_post(DECL_ARGS)
+{
+
+ if (MDOC_BODY != node->type)
+ return;
+ p->flags |= TERMP_NOSPACE;
+ word(p, "\\(rB");
+}
+
+
+/* ARGSUSED */
+static int
+termp_xr_pre(DECL_ARGS)
+{
+ const struct mdoc_node *n;
+
+ n = node->child;
+ assert(n);
+
+ assert(MDOC_TEXT == n->type);
+ word(p, n->data.text.string);
+
+ if (NULL == (n = n->next))
+ return(0);
+
+ assert(MDOC_TEXT == n->type);
+ p->flags |= TERMP_NOSPACE;
+ word(p, "(");
+ p->flags |= TERMP_NOSPACE;
+ word(p, n->data.text.string);
+ p->flags |= TERMP_NOSPACE;
+ word(p, ")");
+
+ return(0);
+}
+
+
+/* ARGSUSED */
+static int
+termp_vt_pre(DECL_ARGS)
+{
+
+ /* FIXME: this can be "type name". */
+ TERMPAIR_SETFLAG(pair, ttypes[TTYPE_VAR_DECL]);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static void
+termp_vt_post(DECL_ARGS)
+{
+
+ if (node->sec == SEC_SYNOPSIS)
+ vspace(p);
+}
+
+
+/* ARGSUSED */
+static int
+termp_fd_pre(DECL_ARGS)
+{
+
+ /*
+ * FIXME: this naming is bad. This value is used, in general,
+ * for the #include header or other preprocessor statement.
+ */
+ TERMPAIR_SETFLAG(pair, ttypes[TTYPE_FUNC_DECL]);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static void
+termp_fd_post(DECL_ARGS)
+{
+
+ if (node->sec != SEC_SYNOPSIS)
+ return;
+ newln(p);
+ if (node->next && MDOC_Fd != node->next->tok)
+ vspace(p);
+}
+
+
+/* ARGSUSED */
+static int
+termp_sh_pre(DECL_ARGS)
+{
+
+ switch (node->type) {
+ case (MDOC_HEAD):
+ vspace(p);
+ TERMPAIR_SETFLAG(pair, ttypes[TTYPE_SECTION]);
+ break;
+ case (MDOC_BODY):
+ p->offset = INDENT;
+ break;
+ default:
+ break;
+ }
+ return(1);
+}
+
+
+/* ARGSUSED */
+static void
+termp_sh_post(DECL_ARGS)
+{
+
+ switch (node->type) {
+ case (MDOC_HEAD):
+ newln(p);
+ break;
+ case (MDOC_BODY):
+ newln(p);
+ p->offset = 0;
+ break;
+ default:
+ break;
+ }
+}
+
+
+/* ARGSUSED */
+static int
+termp_op_pre(DECL_ARGS)
+{
+
+ switch (node->type) {
+ case (MDOC_BODY):
+ word(p, "\\(lB");
+ p->flags |= TERMP_NOSPACE;
+ break;
+ default:
+ break;
+ }
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
+termp_bt_pre(DECL_ARGS)
+{
+
+ word(p, "is currently in beta test.");
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
+termp_ud_pre(DECL_ARGS)
+{
+
+ word(p, "currently under development.");
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
+termp_d1_pre(DECL_ARGS)
+{
+
+ if (MDOC_BODY != node->type)
+ return(1);
+ newln(p);
+ p->offset += (pair->offset = INDENT);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static void
+termp_d1_post(DECL_ARGS)
+{
+
+ if (MDOC_BODY != node->type)
+ return;
+ newln(p);
+ p->offset -= pair->offset;
+}
+
+
+/* ARGSUSED */
+static int
+termp_aq_pre(DECL_ARGS)
+{
+
+ if (MDOC_BODY != node->type)
+ return(1);
+ word(p, "<");
+ p->flags |= TERMP_NOSPACE;
+ return(1);
+}
+
+
+/* ARGSUSED */
+static void
+termp_aq_post(DECL_ARGS)
+{
+
+ if (MDOC_BODY != node->type)
+ return;
+ p->flags |= TERMP_NOSPACE;
+ word(p, ">");
+}
+
+
+/* ARGSUSED */
+static int
+termp_ft_pre(DECL_ARGS)
+{
+
+ TERMPAIR_SETFLAG(pair, ttypes[TTYPE_FUNC_TYPE]);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static void
+termp_ft_post(DECL_ARGS)
+{
+
+ if (node->sec == SEC_SYNOPSIS)
+ newln(p);
+}
+
+
+/* ARGSUSED */
+static int
+termp_fn_pre(DECL_ARGS)
+{
+ const struct mdoc_node *n;
+
+ assert(node->child);
+ assert(MDOC_TEXT == node->child->type);
+
+ /* FIXME: can be "type funcname" "type varname"... */
+
+ p->flags |= ttypes[TTYPE_FUNC_NAME];
+ word(p, node->child->data.text.string);
+ p->flags &= ~ttypes[TTYPE_FUNC_NAME];
+
+ word(p, "(");
+
+ p->flags |= TERMP_NOSPACE;
+ for (n = node->child->next; n; n = n->next) {
+ assert(MDOC_TEXT == n->type);
+ p->flags |= ttypes[TTYPE_FUNC_ARG];
+ word(p, n->data.text.string);
+ p->flags &= ~ttypes[TTYPE_FUNC_ARG];
+ if (n->next)
+ word(p, ",");
+ }
+
+ word(p, ")");
+
+ if (SEC_SYNOPSIS == node->sec)
+ word(p, ";");
+
+ return(0);
+}
+
+
+/* ARGSUSED */
+static void
+termp_fn_post(DECL_ARGS)
+{
+
+ if (node->sec == SEC_SYNOPSIS && node->next)
+ vspace(p);
+
+}
+
+
+/* ARGSUSED */
+static int
+termp_sx_pre(DECL_ARGS)
+{
+
+ TERMPAIR_SETFLAG(pair, ttypes[TTYPE_LINK]);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
+termp_fa_pre(DECL_ARGS)
+{
+ struct mdoc_node *n;
+
+ if (node->parent->tok != MDOC_Fo) {
+ TERMPAIR_SETFLAG(pair, ttypes[TTYPE_FUNC_ARG]);
+ return(1);
+ }
+
+ for (n = node->child; n; n = n->next) {
+ assert(MDOC_TEXT == n->type);
+
+ p->flags |= ttypes[TTYPE_FUNC_ARG];
+ word(p, n->data.text.string);
+ p->flags &= ~ttypes[TTYPE_FUNC_ARG];
+
+ if (n->next)
+ word(p, ",");
+ }
+
+ if (node->next && node->next->tok == MDOC_Fa)
+ word(p, ",");
+
+ return(0);
+}
+
+
+/* ARGSUSED */
+static int
+termp_va_pre(DECL_ARGS)
+{
+
+ TERMPAIR_SETFLAG(pair, ttypes[TTYPE_VAR_DECL]);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
+termp_bd_pre(DECL_ARGS)
+{
+ const struct mdoc_block *bl;
+ const struct mdoc_node *n;
+ int i;
+
+ if (MDOC_BLOCK == node->type) {
+ if (node->prev)
+ vspace(p);
+ return(1);
+ } else if (MDOC_BODY != node->type)
+ return(1);
+
+ assert(MDOC_BLOCK == node->parent->type);
+ pair->offset = p->offset;
+
+ bl = &node->parent->data.block;
+
+
+ i = arg_getattr(MDOC_Offset, bl->argc, bl->argv);
+ if (-1 != i) {
+ assert(1 == bl->argv[i].sz);
+ p->offset += arg_offset(&bl->argv[i]);
+ }
+
+ if ( ! arg_hasattr(MDOC_Literal, bl->argc, bl->argv))
+ return(1);
+
+ p->flags |= TERMP_LITERAL;
+
+ for (n = node->child; n; n = n->next) {
+ assert(MDOC_TEXT == n->type); /* FIXME */
+ if ((*n->data.text.string)) {
+ word(p, n->data.text.string);
+ flushln(p);
+ } else
+ vspace(p);
+
+ }
+
+ p->flags &= ~TERMP_LITERAL;
+ return(0);
+}
+
+
+/* ARGSUSED */
+static void
+termp_bd_post(DECL_ARGS)
+{
+
+ if (MDOC_BODY != node->type)
+ return;
+ newln(p);
+ p->offset = pair->offset;
+}
+
+
+/* ARGSUSED */
+static int
+termp_qq_pre(DECL_ARGS)
+{
+
+ if (MDOC_BODY != node->type)
+ return(1);
+ word(p, "\"");
+ p->flags |= TERMP_NOSPACE;
+ return(1);
+}
+
+
+/* ARGSUSED */
+static void
+termp_qq_post(DECL_ARGS)
+{
+
+ if (MDOC_BODY != node->type)
+ return;
+ p->flags |= TERMP_NOSPACE;
+ word(p, "\"");
+}
+
+
+/* ARGSUSED */
+static int
+termp_bsx_pre(DECL_ARGS)
+{
+
+ word(p, "BSDI BSD/OS");
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
+termp_bx_pre(DECL_ARGS)
+{
+
+ word(p, "BSD");
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
+termp_ox_pre(DECL_ARGS)
+{