version 1.121, 2010/04/06 11:33:00 |
version 1.122, 2010/04/08 07:06:15 |
|
|
mdoc_macro(struct mdoc *m, enum mdoct tok, |
mdoc_macro(struct mdoc *m, enum mdoct tok, |
int ln, int pp, int *pos, char *buf) |
int ln, int pp, int *pos, char *buf) |
{ |
{ |
|
|
assert(tok < MDOC_MAX); |
assert(tok < MDOC_MAX); |
/* |
|
* If we're in the prologue, deny "body" macros. Similarly, if |
/* If we're in the body, deny prologue calls. */ |
* we're in the body, deny prologue calls. |
|
*/ |
|
if (MDOC_PROLOGUE & mdoc_macros[tok].flags && |
if (MDOC_PROLOGUE & mdoc_macros[tok].flags && |
MDOC_PBODY & m->flags) { |
MDOC_PBODY & m->flags) |
|
return(mdoc_perr(m, ln, pp, EPROLBODY)); |
|
|
|
/* If we're in the prologue, deny "body" macros. */ |
|
|
|
if ( ! (MDOC_PROLOGUE & mdoc_macros[tok].flags) && |
|
! (MDOC_PBODY & m->flags)) { |
if ( ! mdoc_pwarn(m, ln, pp, EBODYPROL)) |
if ( ! mdoc_pwarn(m, ln, pp, EBODYPROL)) |
return(0); |
return(0); |
/* |
|
* FIXME: do this in mdoc_action.c. |
|
*/ |
|
if (NULL == m->meta.title) |
if (NULL == m->meta.title) |
m->meta.title = mandoc_strdup("unknown"); |
m->meta.title = mandoc_strdup("unknown"); |
if (NULL == m->meta.vol) |
if (NULL == m->meta.vol) |
Line 371 mdoc_macro(struct mdoc *m, enum mdoct tok, |
|
Line 372 mdoc_macro(struct mdoc *m, enum mdoct tok, |
|
m->meta.date = time(NULL); |
m->meta.date = time(NULL); |
m->flags |= MDOC_PBODY; |
m->flags |= MDOC_PBODY; |
} |
} |
if ( ! (MDOC_PROLOGUE & mdoc_macros[tok].flags) && |
|
! (MDOC_PBODY & m->flags)) |
|
return(mdoc_perr(m, ln, pp, EBODYPROL)); |
|
|
|
return((*mdoc_macros[tok].fp)(m, tok, ln, pp, pos, buf)); |
return((*mdoc_macros[tok].fp)(m, tok, ln, pp, pos, buf)); |
} |
} |