+ char *fmt, *lit;
+ struct md_parse *p;
+ int i;
+
+ p = (struct md_parse *)arg;
+
+ fmt = lit = NULL;
+
+ switch (type) {
+ case (ERR_SYNTAX_QUOTE):
+ lit = "syntax: disallowed argument quotation";
+ break;
+ case (ERR_SYNTAX_UNQUOTE):
+ lit = "syntax: unterminated quotation";
+ break;
+ case (ERR_SYNTAX_WS):
+ lit = "syntax: whitespace in argument";
+ break;
+ 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;
+ case (ERR_SCOPE_BREAK):
+ /* Which scope is broken? */
+ fmt = "scope: macro `%s' breaks prior explicit scope";
+ break;
+ case (ERR_SCOPE_NOCTX):
+ fmt = "scope: closure macro `%s' has no context";
+ break;
+ case (ERR_SCOPE_NONEST):
+ fmt = "scope: macro `%s' may not be nested in the current context";
+ break;
+ case (ERR_MACRO_NOTSUP):
+ fmt = "macro `%s' not supported";
+ break;
+ case (ERR_MACRO_NOTCALL):
+ fmt = "macro `%s' not callable";
+ break;
+ case (ERR_SEC_PROLOGUE):
+ fmt = "macro `%s' cannot be called in the prologue";
+ break;
+ 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_EQ1):
+ fmt = "macro `%s' expects one argument";
+ 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 (ERR_SEC_PROLOGUE_OO):
+ fmt = "prologue macro `%s' is out-of-order";
+ break;
+ case (ERR_SEC_PROLOGUE_REP):
+ fmt = "prologue macro `%s' repeated";
+ break;
+ case (ERR_SEC_NAME):
+ lit = "`NAME' section must be first";
+ break;
+ case (ERR_SYNTAX_ARGVAL):
+ lit = "syntax: expected value for macro argument";
+ break;
+ case (ERR_SYNTAX_ARGBAD):
+ lit = "syntax: invalid value for macro argument";
+ break;
+ case (ERR_SYNTAX_ARGMANY):
+ lit = "syntax: too many values for macro argument";
+ break;
+ default:
+ abort();
+ /* NOTREACHED */
+ }