version 1.136, 2015/04/18 17:01:58 |
version 1.137, 2015/04/18 17:28:36 |
Line 289 choose_parser(struct mparse *curp) |
|
Line 289 choose_parser(struct mparse *curp) |
|
} |
} |
} |
} |
|
|
if (format == MPARSE_MDOC) { |
if (curp->man == NULL) { |
if (curp->man == NULL) |
curp->man = roff_man_alloc(curp->roff, curp, curp->defos, |
curp->man = mdoc_alloc( |
curp->options & MPARSE_QUICK ? 1 : 0); |
curp->roff, curp, curp->defos, |
curp->man->macroset = MACROSET_MAN; |
MPARSE_QUICK & curp->options ? 1 : 0); |
curp->man->first->tok = MDOC_MAX; |
else |
|
curp->man->macroset = MACROSET_MDOC; |
|
mdoc_hash_init(); |
|
return; |
|
} |
} |
|
|
/* Fall back to man(7) as a last resort. */ |
if (format == MPARSE_MDOC) { |
|
mdoc_hash_init(); |
if (curp->man == NULL) |
curp->man->macroset = MACROSET_MDOC; |
curp->man = man_alloc( |
curp->man->first->tok = MDOC_MAX; |
curp->roff, curp, curp->defos, |
} else { |
MPARSE_QUICK & curp->options ? 1 : 0); |
man_hash_init(); |
else |
|
curp->man->macroset = MACROSET_MAN; |
curp->man->macroset = MACROSET_MAN; |
man_hash_init(); |
curp->man->first->tok = MAN_MAX; |
|
} |
} |
} |
|
|
/* |
/* |
Line 690 mparse_end(struct mparse *curp) |
|
Line 686 mparse_end(struct mparse *curp) |
|
{ |
{ |
|
|
if (curp->man == NULL && curp->sodest == NULL) |
if (curp->man == NULL && curp->sodest == NULL) |
curp->man = man_alloc(curp->roff, curp, curp->defos, |
curp->man = roff_man_alloc(curp->roff, curp, curp->defos, |
curp->options & MPARSE_QUICK ? 1 : 0); |
curp->options & MPARSE_QUICK ? 1 : 0); |
if (curp->man->macroset == MACROSET_NONE) |
if (curp->man->macroset == MACROSET_NONE) |
curp->man->macroset = MACROSET_MAN; |
curp->man->macroset = MACROSET_MAN; |
Line 892 mparse_alloc(int options, enum mandoclevel wlevel, man |
|
Line 888 mparse_alloc(int options, enum mandoclevel wlevel, man |
|
|
|
curp->mchars = mchars; |
curp->mchars = mchars; |
curp->roff = roff_alloc(curp, curp->mchars, options); |
curp->roff = roff_alloc(curp, curp->mchars, options); |
|
curp->man = roff_man_alloc( curp->roff, curp, curp->defos, |
|
curp->options & MPARSE_QUICK ? 1 : 0); |
if (curp->options & MPARSE_MDOC) { |
if (curp->options & MPARSE_MDOC) { |
curp->man = mdoc_alloc( |
|
curp->roff, curp, curp->defos, |
|
curp->options & MPARSE_QUICK ? 1 : 0); |
|
mdoc_hash_init(); |
mdoc_hash_init(); |
} |
curp->man->macroset = MACROSET_MDOC; |
if (curp->options & MPARSE_MAN) { |
curp->man->first->tok = MDOC_MAX; |
curp->man = man_alloc( |
} else if (curp->options & MPARSE_MAN) { |
curp->roff, curp, curp->defos, |
|
curp->options & MPARSE_QUICK ? 1 : 0); |
|
man_hash_init(); |
man_hash_init(); |
|
curp->man->macroset = MACROSET_MAN; |
|
curp->man->first->tok = MAN_MAX; |
} |
} |
|
|
return(curp); |
return(curp); |
} |
} |
|
|
Line 914 mparse_reset(struct mparse *curp) |
|
Line 908 mparse_reset(struct mparse *curp) |
|
|
|
roff_reset(curp->roff); |
roff_reset(curp->roff); |
|
|
if (curp->man != NULL) { |
if (curp->man != NULL) |
if (curp->man->macroset == MACROSET_MDOC) |
roff_man_reset(curp->man); |
mdoc_reset(curp->man); |
|
else |
|
man_reset(curp->man); |
|
curp->man->macroset = MACROSET_NONE; |
|
} |
|
if (curp->secondary) |
if (curp->secondary) |
curp->secondary->sz = 0; |
curp->secondary->sz = 0; |
|
|
|
|
mparse_free(struct mparse *curp) |
mparse_free(struct mparse *curp) |
{ |
{ |
|
|
if (curp->man->macroset == MACROSET_MDOC) |
roff_man_free(curp->man); |
mdoc_free(curp->man); |
|
if (curp->man->macroset == MACROSET_MAN) |
|
man_free(curp->man); |
|
if (curp->roff) |
if (curp->roff) |
roff_free(curp->roff); |
roff_free(curp->roff); |
if (curp->secondary) |
if (curp->secondary) |