version 1.245, 2014/08/19 17:31:55 |
version 1.247, 2014/09/07 23:25:01 |
Line 67 static void check_text(struct mdoc *, int, int, char |
|
Line 67 static void check_text(struct mdoc *, int, int, char |
|
static void check_argv(struct mdoc *, |
static void check_argv(struct mdoc *, |
struct mdoc_node *, struct mdoc_argv *); |
struct mdoc_node *, struct mdoc_argv *); |
static void check_args(struct mdoc *, struct mdoc_node *); |
static void check_args(struct mdoc *, struct mdoc_node *); |
|
static int child_an(const struct mdoc_node *); |
static enum mdoc_sec a2sec(const char *); |
static enum mdoc_sec a2sec(const char *); |
static size_t macro2len(enum mdoct); |
static size_t macro2len(enum mdoct); |
|
|
Line 114 static int post_par(POST_ARGS); |
|
Line 115 static int post_par(POST_ARGS); |
|
static int post_root(POST_ARGS); |
static int post_root(POST_ARGS); |
static int post_rs(POST_ARGS); |
static int post_rs(POST_ARGS); |
static int post_sh(POST_ARGS); |
static int post_sh(POST_ARGS); |
static int post_sh_body(POST_ARGS); |
|
static int post_sh_head(POST_ARGS); |
static int post_sh_head(POST_ARGS); |
|
static int post_sh_name(POST_ARGS); |
|
static int post_sh_authors(POST_ARGS); |
static int post_st(POST_ARGS); |
static int post_st(POST_ARGS); |
static int post_vt(POST_ARGS); |
static int post_vt(POST_ARGS); |
static int pre_an(PRE_ARGS); |
static int pre_an(PRE_ARGS); |
Line 1643 post_root(POST_ARGS) |
|
Line 1645 post_root(POST_ARGS) |
|
mdoc->meta.os = mandoc_strdup(""); |
mdoc->meta.os = mandoc_strdup(""); |
} |
} |
|
|
n = mdoc->first; |
|
assert(n); |
|
|
|
/* Check that we begin with a proper `Sh'. */ |
/* Check that we begin with a proper `Sh'. */ |
|
|
if (NULL == n->child) |
n = mdoc->first->child; |
mandoc_msg(MANDOCERR_DOC_EMPTY, mdoc->parse, |
while (n != NULL && mdoc_macros[n->tok].flags & MDOC_PROLOGUE) |
n->line, n->pos, NULL); |
n = n->next; |
else if (MDOC_Sh != n->child->tok) |
|
|
if (n == NULL) |
|
mandoc_msg(MANDOCERR_DOC_EMPTY, mdoc->parse, 0, 0, NULL); |
|
else if (n->tok != MDOC_Sh) |
mandoc_msg(MANDOCERR_SEC_BEFORE, mdoc->parse, |
mandoc_msg(MANDOCERR_SEC_BEFORE, mdoc->parse, |
n->child->line, n->child->pos, |
n->line, n->pos, mdoc_macronames[n->tok]); |
mdoc_macronames[n->child->tok]); |
|
|
|
return(1); |
return(1); |
} |
} |
Line 1848 post_sh(POST_ARGS) |
|
Line 1849 post_sh(POST_ARGS) |
|
|
|
post_ignpar(mdoc); |
post_ignpar(mdoc); |
|
|
if (MDOC_HEAD == mdoc->last->type) |
switch (mdoc->last->type) { |
|
case MDOC_HEAD: |
return(post_sh_head(mdoc)); |
return(post_sh_head(mdoc)); |
if (MDOC_BODY == mdoc->last->type) |
case MDOC_BODY: |
return(post_sh_body(mdoc)); |
switch (mdoc->lastsec) { |
|
case SEC_NAME: |
|
return(post_sh_name(mdoc)); |
|
case SEC_AUTHORS: |
|
return(post_sh_authors(mdoc)); |
|
default: |
|
break; |
|
} |
|
break; |
|
default: |
|
break; |
|
} |
|
|
return(1); |
return(1); |
} |
} |
|
|
static int |
static int |
post_sh_body(POST_ARGS) |
post_sh_name(POST_ARGS) |
{ |
{ |
struct mdoc_node *n; |
struct mdoc_node *n; |
|
|
if (SEC_NAME != mdoc->lastsec) |
|
return(1); |
|
|
|
/* |
/* |
* Warn if the NAME section doesn't contain the `Nm' and `Nd' |
* Warn if the NAME section doesn't contain the `Nm' and `Nd' |
* macros (can have multiple `Nm' and one `Nd'). Note that the |
* macros (can have multiple `Nm' and one `Nd'). Note that the |
Line 1891 post_sh_body(POST_ARGS) |
|
Line 1901 post_sh_body(POST_ARGS) |
|
|
|
mandoc_msg(MANDOCERR_NAMESEC_BAD, mdoc->parse, |
mandoc_msg(MANDOCERR_NAMESEC_BAD, mdoc->parse, |
n->line, n->pos, mdoc_macronames[n->tok]); |
n->line, n->pos, mdoc_macronames[n->tok]); |
|
return(1); |
|
} |
|
|
|
static int |
|
child_an(const struct mdoc_node *n) |
|
{ |
|
|
|
for (n = n->child; n != NULL; n = n->next) |
|
if ((n->tok == MDOC_An && n->nchild) || child_an(n)) |
|
return(1); |
|
return(0); |
|
} |
|
|
|
static int |
|
post_sh_authors(POST_ARGS) |
|
{ |
|
|
|
if ( ! child_an(mdoc->last)) |
|
mandoc_msg(MANDOCERR_AN_MISSING, mdoc->parse, |
|
mdoc->last->line, mdoc->last->pos, NULL); |
return(1); |
return(1); |
} |
} |
|
|