=================================================================== RCS file: /cvs/mandoc/Attic/mdocml.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -p -r1.22 -r1.23 --- mandoc/Attic/mdocml.c 2008/12/15 02:23:12 1.22 +++ mandoc/Attic/mdocml.c 2008/12/17 17:18:38 1.23 @@ -1,4 +1,4 @@ -/* $Id: mdocml.c,v 1.22 2008/12/15 02:23:12 kristaps Exp $ */ +/* $Id: mdocml.c,v 1.23 2008/12/17 17:18:38 kristaps Exp $ */ /* * Copyright (c) 2008 Kristaps Dzonsons * @@ -265,9 +265,9 @@ parse_begin(struct md_parse *p) for (i = 0; i < sz; i++) { if ('\n' != p->buf[i]) { if (pos < sizeof(line)) { - /* LINTED */ - sv[pos] = p->buf[i]; - line[pos++] = p->buf[i]; + sv[(int)pos] = p->buf[(int)i]; + line[(int)pos++] = + p->buf[(int)i]; continue; } warnx("%s: line %d too long", @@ -306,6 +306,9 @@ msg_err(void *arg, int tok, int col, enum mdoc_err typ case (ERR_SYNTAX_WS): lit = "syntax: whitespace in argument"; break; + case (ERR_SYNTAX_ARGS): + fmt = "syntax: macro `%s' arguments malformed"; + break; case (ERR_SCOPE_BREAK): /* Which scope is broken? */ fmt = "macro `%s' breaks prior explicit scope"; @@ -316,9 +319,27 @@ msg_err(void *arg, int tok, int col, enum mdoc_err typ 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_GE1): fmt = "macro `%s' expects one or more 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; default: abort(); /* NOTREACHED */ @@ -333,8 +354,12 @@ msg_err(void *arg, int tok, int col, enum mdoc_err typ p->name, p->lnn, lit); if (p->dbg < 1) { - (void)fprintf(stderr, " (column %d)\n", col); + if (-1 != col) + (void)fprintf(stderr, " (column %d)\n", col); return(0); + } else if (-1 == col) { + (void)fprintf(stderr, "\nFrom: %s", p->line); + return(0); } (void)fprintf(stderr, "\nFrom: %s\n ", p->line); @@ -360,8 +385,12 @@ msg_msg(void *arg, int col, const char *msg) (void)printf("%s:%d: %s", p->name, p->lnn, msg); if (p->dbg < 3) { - (void)printf(" (column %d)\n", col); + if (-1 != col) + (void)printf(" (column %d)\n", col); return; + } else if (-1 == col) { + (void)printf("\nFrom %s\n", p->line); + return; } (void)printf("\nFrom: %s\n ", p->line); @@ -392,6 +421,9 @@ msg_warn(void *arg, int tok, int col, enum mdoc_warn t break; case (WARN_SYNTAX_MACLIKE): lit = "syntax: macro-like argument"; + break; + case (WARN_SEC_OO): + lit = "section is out of conventional order"; break; case (WARN_ARGS_GE1): fmt = "macro `%s' suggests one or more arguments";