-/* $Id: mdocml.c,v 1.25 2008/12/28 00:34:20 kristaps Exp $ */
+/* $Id: mdocml.c,v 1.28 2008/12/29 18:08:44 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
static void
print_node(const struct mdoc_node *n, int indent)
{
- const char *p, *t;
- int i, j;
- size_t argc;
- struct mdoc_arg *argv;
+ const char *p, *t;
+ int i, j;
+ size_t argc, sz;
+ char **params;
+ struct mdoc_arg *argv;
argv = NULL;
argc = 0;
+ params = NULL;
+ sz = 0;
switch (n->type) {
case (MDOC_TEXT):
case (MDOC_HEAD):
p = mdoc_macronames[n->data.head.tok];
t = "block-head";
+ params = n->data.head.args;
+ sz = n->data.head.sz;
break;
case (MDOC_ELEM):
assert(NULL == n->child);
t = "element";
argv = n->data.elem.argv;
argc = n->data.elem.argc;
+ params = n->data.elem.args;
+ sz = n->data.elem.sz;
break;
case (MDOC_BLOCK):
p = mdoc_macronames[n->data.block.tok];
(void)printf(" \"%s\"", argv[i].value[j]);
}
+ for (i = 0; i < (int)sz; i++)
+ (void)printf(" \"%s\"", params[i]);
+
(void)printf("\n");
if (n->child)
case (ERR_SYNTAX_ARGFORM):
fmt = "syntax: macro `%s' arguments malformed";
break;
+ case (ERR_SYNTAX_NOPUNCT):
+ fmt = "syntax: macro `%s' doesn't understand punctuation";
+ break;
case (ERR_SYNTAX_ARG):
fmt = "syntax: unknown argument for macro `%s'";
break;
fmt = "scope: closure macro `%s' has no context";
break;
case (ERR_SCOPE_NONEST):
- fmt = "scope: macro `%s' may not be nested";
+ fmt = "scope: macro `%s' may not be nested in the current context";
break;
case (ERR_MACRO_NOTSUP):
fmt = "macro `%s' not supported";
case (ERR_SEC_NPROLOGUE):
fmt = "macro `%s' called outside of prologue";
break;
+ case (ERR_ARGS_EQ0):
+ fmt = "macro `%s' expects zero arguments";
+ break;
case (ERR_ARGS_GE1):
fmt = "macro `%s' expects one or more arguments";
break;
+ case (ERR_ARGS_LE2):
+ fmt = "macro `%s' expects two or fewer arguments";
+ break;
case (ERR_ARGS_MANY):
fmt = "macro `%s' has too many arguments";
break;
case (WARN_IGN_BEFORE_BLK):
fmt = "ignore: macro before block macro `%s' ignored";
break;
+ case (WARN_COMPAT_TROFF):
+ fmt = "compat: macro `%s' behaves differently in troff and nroff";
+ break;
default:
abort();
/* NOTREACHED */