diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mandoc/mdoc_term.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index 4dd2f6402af..db33006cfe6 100644 --- a/usr.bin/mandoc/mdoc_term.c +++ b/usr.bin/mandoc/mdoc_term.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.9 2009/06/18 21:45:31 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.10 2009/06/18 21:50:45 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -583,6 +583,8 @@ arg_listtype(const struct mdoc_node *n) break; } + /* FIXME: mandated by parser. */ + errx(1, "list type not supported"); /* NOTREACHED */ } @@ -599,6 +601,9 @@ arg_offset(const struct mdoc_argv *arg) return(INDENT); if (0 == strcmp(*arg->value, "indent-two")) return(INDENT * 2); + + /* FIXME: needs to support field-widths (10n, etc.). */ + return(strlen(*arg->value)); } @@ -1060,6 +1065,8 @@ termp_rv_pre(DECL_ARGS) { int i; + /* FIXME: mandated by parser. */ + if (-1 == (i = arg_getattr(MDOC_Std, node))) errx(1, "expected -std argument"); if (1 != node->args->argv[i].sz) @@ -1093,6 +1100,8 @@ termp_ex_pre(DECL_ARGS) { int i; + /* FIXME: mandated by parser? */ + if (-1 == (i = arg_getattr(MDOC_Std, node))) errx(1, "expected -std argument"); if (1 != node->args->argv[i].sz) @@ -1146,8 +1155,9 @@ termp_xr_pre(DECL_ARGS) { const struct mdoc_node *n; - if (NULL == (n = node->child)) - errx(1, "expected text line argument"); + assert(node->child && MDOC_TEXT == node->child->type); + n = node->child; + term_word(p, n->string); if (NULL == (n = n->next)) return(0); @@ -1281,8 +1291,7 @@ termp_lb_pre(DECL_ARGS) { const char *lb; - if (NULL == node->child) - errx(1, "expected text line argument"); + assert(node->child && MDOC_TEXT == node->child->type); if ((lb = mdoc_a2lib(node->child->string))) { term_word(p, lb); return(0); @@ -1390,8 +1399,7 @@ termp_fn_pre(DECL_ARGS) { const struct mdoc_node *n; - if (NULL == node->child) - errx(1, "expected text line arguments"); + assert(node->child && MDOC_TEXT == node->child->type); /* FIXME: can be "type funcname" "type varname"... */ @@ -1498,6 +1506,8 @@ termp_bd_pre(DECL_ARGS) else if (MDOC_BODY != node->type) return(1); + /* FIXME: display type should be mandated by parser. */ + if (NULL == node->parent->args) errx(1, "missing display type"); @@ -1623,9 +1633,6 @@ termp_bx_post(DECL_ARGS) } -/* FIXME: consolidate the following into termp_system. */ - - /* ARGSUSED */ static int termp_ox_pre(DECL_ARGS) @@ -1949,8 +1956,7 @@ termp_fo_pre(DECL_ARGS) p->flags |= ttypes[TTYPE_FUNC_NAME]; for (n = node->child; n; n = n->next) { - if (MDOC_TEXT != n->type) - errx(1, "expected text line argument"); + assert(MDOC_TEXT == n->type); term_word(p, n->string); } p->flags &= ~ttypes[TTYPE_FUNC_NAME]; @@ -1994,9 +2000,7 @@ termp_bf_pre(DECL_ARGS) return(1); } - if (MDOC_TEXT != n->type) - errx(1, "expected text line arguments"); - + assert(MDOC_TEXT == n->type); if (0 == strcmp("Em", n->string)) TERMPAIR_SETFLAG(p, pair, ttypes[TTYPE_EMPH]); else if (0 == strcmp("Sy", n->string)) @@ -2032,9 +2036,7 @@ static int termp_sm_pre(DECL_ARGS) { - if (NULL == node->child || MDOC_TEXT != node->child->type) - errx(1, "expected boolean line argument"); - + assert(node->child && MDOC_TEXT == node->child->type); if (0 == strcmp("on", node->child->string)) { p->flags &= ~TERMP_NONOSPACE; p->flags &= ~TERMP_NOSPACE; |