version 1.51, 2014/06/21 22:24:01 |
version 1.73, 2014/07/30 17:06:26 |
|
|
mandocmsg mmsg; /* warning/error message handler */ |
mandocmsg mmsg; /* warning/error message handler */ |
const char *file; |
const char *file; |
struct buf *secondary; |
struct buf *secondary; |
char *defos; /* default operating system */ |
const char *defos; /* default operating system */ |
}; |
}; |
|
|
static void resize_buf(struct buf *, size_t); |
static void resize_buf(struct buf *, size_t); |
Line 93 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
Line 93 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
"generic warning", |
"generic warning", |
|
|
/* related to the prologue */ |
/* related to the prologue */ |
"no TH macro in document", |
"missing .TH macro, using \"unknown 1\"", |
"document title should be all caps", |
"lower case character in document title", |
"unknown manual section", |
"unknown manual section", |
"unknown manual volume or arch", |
"unknown manual volume or arch", |
"date missing, using today's date", |
"missing date, using today's date", |
"cannot parse date, using it verbatim", |
"cannot parse date, using it verbatim", |
"prologue macros out of order", |
"prologue macros out of order", |
"duplicate prologue macro", |
"duplicate prologue macro", |
"macro not allowed in prologue", |
"incomplete prologue, terminated by", |
"macro not allowed in body", |
"skipping prologue macro in body", |
|
|
/* related to document structure */ |
/* related to document structure */ |
".so is fragile, better use ln(1)", |
".so is fragile, better use ln(1)", |
"no document body", |
"no document body", |
"content before the first section header", |
"content before first section header", |
"NAME section must come first", |
"first section is not \"NAME\"", |
"bad NAME section contents", |
"bad NAME section contents", |
"sections out of conventional order", |
"sections out of conventional order", |
"duplicate section name", |
"duplicate section title", |
"section header suited to sections 2, 3, and 9 only", |
"unexpected section", |
|
|
/* related to macros and nesting */ |
/* related to macros and nesting */ |
"skipping obsolete macro", |
"obsolete macro", |
"skipping paragraph macro", |
"skipping paragraph macro", |
"moving paragraph macro out of list", |
"moving paragraph macro out of list", |
"skipping no-space macro", |
"skipping no-space macro", |
"blocks badly nested", |
"blocks badly nested", |
"child violates parent syntax", |
|
"nested displays are not portable", |
"nested displays are not portable", |
"already in literal mode", |
"moving content out of list", |
|
".Vt block has child macro", |
|
"fill mode already enabled, skipping .fi", |
|
"fill mode already disabled, skipping .nf", |
"line scope broken", |
"line scope broken", |
|
|
/* related to missing macro arguments */ |
/* related to missing macro arguments */ |
|
"skipping empty request", |
|
"conditional request controls empty scope", |
"skipping empty macro", |
"skipping empty macro", |
|
"empty argument, using 0n", |
"argument count wrong", |
"argument count wrong", |
"missing display type", |
"missing display type, using -ragged", |
"list type must come first", |
"list type is not the first argument", |
"tag lists require a width argument", |
"missing -width in -tag list, using 8n", |
"missing font type", |
"missing name for .Ex, using \"\"", |
"skipping end of block that is not open", |
"empty head in list item", |
|
"empty list item", |
|
"missing font type, using \\fR", |
|
"unknown font type, using \\fR", |
|
"missing -std argument, adding it", |
|
|
/* related to bad macro arguments */ |
/* related to bad macro arguments */ |
"skipping argument", |
"skipping argument", |
|
"unterminated quoted argument", |
"duplicate argument", |
"duplicate argument", |
"duplicate display type", |
"skipping duplicate display type", |
"duplicate list type", |
"skipping duplicate list type", |
"unknown AT&T UNIX version", |
"unknown AT&T UNIX version", |
"bad Boolean value", |
"invalid content in Rs block", |
"unknown font", |
"invalid Boolean argument", |
"unknown standard specifier", |
"unknown font, skipping request", |
"bad width argument", |
|
|
|
/* related to plain text */ |
/* related to plain text */ |
"blank line in non-literal context", |
"blank line in fill mode, using .sp", |
"tab in non-literal context", |
"tab in filled text", |
"end of line whitespace", |
"whitespace at end of input line", |
"bad comment style", |
"bad comment style", |
"bad escape sequence", |
"invalid escape sequence", |
"unterminated quoted string", |
"undefined string, using \"\"", |
|
|
/* related to equations */ |
|
"unexpected literal in equation", |
|
|
|
"generic error", |
"generic error", |
|
|
/* related to equations */ |
/* related to equations */ |
Line 175 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
Line 181 static const char * const mandocerrs[MANDOCERR_MAX] = |
|
"data block still open", |
"data block still open", |
"ignoring extra data cells", |
"ignoring extra data cells", |
|
|
|
/* related to document structure and macros */ |
"input stack limit exceeded, infinite loop?", |
"input stack limit exceeded, infinite loop?", |
"skipping bad character", |
"skipping bad character", |
"escaped character not allowed in a name", |
|
"manual name not yet set", |
|
"skipping text before the first section header", |
|
"skipping unknown macro", |
"skipping unknown macro", |
"NOT IMPLEMENTED, please use groff: skipping request", |
"skipping item outside list", |
"argument count wrong", |
|
"skipping column outside column list", |
"skipping column outside column list", |
"skipping end of block that is not open", |
"skipping end of block that is not open", |
"missing end of block", |
"inserting missing end of block", |
"scope open on exit", |
"appending missing end of block", |
"uname(3) system call failed", |
|
"macro requires line argument(s)", |
|
"macro requires body argument(s)", |
|
"macro requires argument(s)", |
|
"request requires a numeric argument", |
|
"missing list type", |
|
"line argument(s) will be lost", |
|
"body argument(s) will be lost", |
|
|
|
|
/* related to request and macro arguments */ |
|
"escaped character not allowed in a name", |
|
"argument count wrong", |
|
"missing list type, using -item", |
|
"missing manual name, using \"\"", |
|
"uname(3) system call failed, using UNKNOWN", |
|
"unknown standard specifier", |
|
"skipping request without numeric argument", |
|
"skipping all arguments", |
|
"skipping excess arguments", |
|
|
"generic fatal error", |
"generic fatal error", |
|
|
"input too large", |
"input too large", |
"not a manual", |
|
"column syntax is inconsistent", |
"column syntax is inconsistent", |
"NOT IMPLEMENTED: .Bd -file", |
"NOT IMPLEMENTED: .Bd -file", |
"argument count wrong, violates syntax", |
"argument count wrong, violates syntax", |
"child violates parent syntax", |
|
"argument count wrong, violates syntax", |
|
"NOT IMPLEMENTED: .so with absolute path or \"..\"", |
"NOT IMPLEMENTED: .so with absolute path or \"..\"", |
"no document prologue", |
".so request failed", |
"static buffer exhausted", |
"static buffer exhausted", |
|
|
/* system errors */ |
/* system errors */ |
Line 259 pset(const char *buf, int pos, struct mparse *curp) |
|
Line 262 pset(const char *buf, int pos, struct mparse *curp) |
|
} |
} |
|
|
if (MPARSE_MDOC & curp->options) { |
if (MPARSE_MDOC & curp->options) { |
if (NULL == curp->pmdoc) |
|
curp->pmdoc = mdoc_alloc( |
|
curp->roff, curp, curp->defos, |
|
MPARSE_QUICK & curp->options ? 1 : 0); |
|
assert(curp->pmdoc); |
|
curp->mdoc = curp->pmdoc; |
curp->mdoc = curp->pmdoc; |
return; |
return; |
} else if (MPARSE_MAN & curp->options) { |
} else if (MPARSE_MAN & curp->options) { |
if (NULL == curp->pman) |
|
curp->pman = man_alloc(curp->roff, curp, |
|
MPARSE_QUICK & curp->options ? 1 : 0); |
|
assert(curp->pman); |
|
curp->man = curp->pman; |
curp->man = curp->pman; |
return; |
return; |
} |
} |
|
|
if (curp->secondary) |
if (curp->secondary) |
curp->secondary->sz -= pos + 1; |
curp->secondary->sz -= pos + 1; |
mparse_readfd(curp, -1, ln.buf + of); |
mparse_readfd(curp, -1, ln.buf + of); |
if (MANDOCLEVEL_FATAL <= curp->file_status) |
if (MANDOCLEVEL_FATAL <= curp->file_status) { |
|
mandoc_vmsg(MANDOCERR_SO_FAIL, |
|
curp, curp->line, pos, |
|
".so %s", ln.buf + of); |
break; |
break; |
|
} |
pos = 0; |
pos = 0; |
continue; |
continue; |
default: |
default: |
Line 674 mparse_end(struct mparse *curp) |
|
Line 672 mparse_end(struct mparse *curp) |
|
if (MANDOCLEVEL_FATAL <= curp->file_status) |
if (MANDOCLEVEL_FATAL <= curp->file_status) |
return; |
return; |
|
|
|
if (curp->mdoc == NULL && |
|
curp->man == NULL && |
|
curp->sodest == NULL) { |
|
if (curp->options & MPARSE_MDOC) |
|
curp->mdoc = curp->pmdoc; |
|
else { |
|
if (curp->pman == NULL) |
|
curp->pman = man_alloc(curp->roff, curp, |
|
curp->options & MPARSE_QUICK ? 1 : 0); |
|
curp->man = curp->pman; |
|
} |
|
} |
|
|
if (curp->mdoc && ! mdoc_endparse(curp->mdoc)) { |
if (curp->mdoc && ! mdoc_endparse(curp->mdoc)) { |
assert(MANDOCLEVEL_FATAL <= curp->file_status); |
assert(MANDOCLEVEL_FATAL <= curp->file_status); |
return; |
return; |
Line 684 mparse_end(struct mparse *curp) |
|
Line 695 mparse_end(struct mparse *curp) |
|
return; |
return; |
} |
} |
|
|
if ( ! (curp->mdoc || curp->man || curp->sodest)) { |
|
mandoc_msg(MANDOCERR_NOTMANUAL, curp, 0, 0, NULL); |
|
curp->file_status = MANDOCLEVEL_FATAL; |
|
return; |
|
} |
|
|
|
roff_endparse(curp->roff); |
roff_endparse(curp->roff); |
} |
} |
|
|
|
|
|
|
struct mparse * |
struct mparse * |
mparse_alloc(int options, enum mandoclevel wlevel, |
mparse_alloc(int options, enum mandoclevel wlevel, |
mandocmsg mmsg, char *defos) |
mandocmsg mmsg, const char *defos) |
{ |
{ |
struct mparse *curp; |
struct mparse *curp; |
|
|
Line 787 mparse_alloc(int options, enum mandoclevel wlevel, |
|
Line 792 mparse_alloc(int options, enum mandoclevel wlevel, |
|
curp->defos = defos; |
curp->defos = defos; |
|
|
curp->roff = roff_alloc(curp, options); |
curp->roff = roff_alloc(curp, options); |
|
if (curp->options & MPARSE_MDOC) |
|
curp->pmdoc = mdoc_alloc( |
|
curp->roff, curp, curp->defos, |
|
curp->options & MPARSE_QUICK ? 1 : 0); |
|
if (curp->options & MPARSE_MAN) |
|
curp->pman = man_alloc(curp->roff, curp, |
|
curp->options & MPARSE_QUICK ? 1 : 0); |
|
|
return(curp); |
return(curp); |
} |
} |
|
|