version 1.18, 2014/01/02 16:29:46 |
version 1.19, 2014/01/05 20:26:27 |
|
|
struct roff *roff; /* roff parser (!NULL) */ |
struct roff *roff; /* roff parser (!NULL) */ |
int reparse_count; /* finite interp. stack */ |
int reparse_count; /* finite interp. stack */ |
mandocmsg mmsg; /* warning/error message handler */ |
mandocmsg mmsg; /* warning/error message handler */ |
void *arg; /* argument to mmsg */ |
|
const char *file; |
const char *file; |
struct buf *secondary; |
struct buf *secondary; |
char *defos; /* default operating system */ |
char *defos; /* default operating system */ |
|
int quick; /* abort the parse early */ |
}; |
}; |
|
|
static void resize_buf(struct buf *, size_t); |
static void resize_buf(struct buf *, size_t); |
|
|
case (MPARSE_MDOC): |
case (MPARSE_MDOC): |
if (NULL == curp->pmdoc) |
if (NULL == curp->pmdoc) |
curp->pmdoc = mdoc_alloc(curp->roff, curp, |
curp->pmdoc = mdoc_alloc(curp->roff, curp, |
curp->defos); |
curp->defos, curp->quick); |
assert(curp->pmdoc); |
assert(curp->pmdoc); |
curp->mdoc = curp->pmdoc; |
curp->mdoc = curp->pmdoc; |
return; |
return; |
case (MPARSE_MAN): |
case (MPARSE_MAN): |
if (NULL == curp->pman) |
if (NULL == curp->pman) |
curp->pman = man_alloc(curp->roff, curp); |
curp->pman = man_alloc(curp->roff, curp, |
|
curp->quick); |
assert(curp->pman); |
assert(curp->pman); |
curp->man = curp->pman; |
curp->man = curp->pman; |
return; |
return; |
|
|
if (pos >= 3 && 0 == memcmp(buf, ".Dd", 3)) { |
if (pos >= 3 && 0 == memcmp(buf, ".Dd", 3)) { |
if (NULL == curp->pmdoc) |
if (NULL == curp->pmdoc) |
curp->pmdoc = mdoc_alloc(curp->roff, curp, |
curp->pmdoc = mdoc_alloc(curp->roff, curp, |
curp->defos); |
curp->defos, curp->quick); |
assert(curp->pmdoc); |
assert(curp->pmdoc); |
curp->mdoc = curp->pmdoc; |
curp->mdoc = curp->pmdoc; |
return; |
return; |
} |
} |
|
|
if (NULL == curp->pman) |
if (NULL == curp->pman) |
curp->pman = man_alloc(curp->roff, curp); |
curp->pman = man_alloc(curp->roff, curp, curp->quick); |
assert(curp->pman); |
assert(curp->pman); |
curp->man = curp->pman; |
curp->man = curp->pman; |
} |
} |
|
|
if (0 == rc) { |
if (0 == rc) { |
assert(MANDOCLEVEL_FATAL <= curp->file_status); |
assert(MANDOCLEVEL_FATAL <= curp->file_status); |
break; |
break; |
} |
} else if (2 == rc) |
|
break; |
|
|
/* Temporary buffers typically are not full. */ |
/* Temporary buffers typically are not full. */ |
|
|
|
|
|
|
struct mparse * |
struct mparse * |
mparse_alloc(enum mparset inttype, enum mandoclevel wlevel, |
mparse_alloc(enum mparset inttype, enum mandoclevel wlevel, |
mandocmsg mmsg, void *arg, char *defos) |
mandocmsg mmsg, char *defos, int quick) |
{ |
{ |
struct mparse *curp; |
struct mparse *curp; |
|
|
|
|
|
|
curp->wlevel = wlevel; |
curp->wlevel = wlevel; |
curp->mmsg = mmsg; |
curp->mmsg = mmsg; |
curp->arg = arg; |
|
curp->inttype = inttype; |
curp->inttype = inttype; |
curp->defos = defos; |
curp->defos = defos; |
|
curp->quick = quick; |
|
|
curp->roff = roff_alloc(inttype, curp); |
curp->roff = roff_alloc(inttype, curp); |
return(curp); |
return(curp); |