version 1.39, 2009/01/19 17:02:59 |
version 1.40, 2009/01/19 17:51:33 |
Line 44 static int pre_check_msecs(struct mdoc *, struct mdoc_ |
|
Line 44 static int pre_check_msecs(struct mdoc *, struct mdoc_ |
|
int, enum mdoc_msec *); |
int, enum mdoc_msec *); |
static int pre_check_stdarg(struct mdoc *, struct mdoc_node *); |
static int pre_check_stdarg(struct mdoc *, struct mdoc_node *); |
static int post_check_children_count(struct mdoc *); |
static int post_check_children_count(struct mdoc *); |
static int post_check_children_lt(struct mdoc *, int); |
static int post_check_children_lt(struct mdoc *, const char *, int); |
static int post_check_children_gt(struct mdoc *, int); |
static int post_check_children_gt(struct mdoc *, const char *, int); |
static int post_check_children_wgt(struct mdoc *, int); |
static int post_check_children_wgt(struct mdoc *, const char *, int); |
static int post_check_children_eq(struct mdoc *, int); |
static int post_check_children_eq(struct mdoc *, const char *, int); |
static int post_check_children_weq(struct mdoc *, int); |
static int post_check_children_weq(struct mdoc *, const char *, int); |
|
|
/* Specific pre-child-parse routines. */ |
/* Specific pre-child-parse routines. */ |
|
|
Line 258 post_check_children_count(struct mdoc *mdoc) |
|
Line 258 post_check_children_count(struct mdoc *mdoc) |
|
|
|
|
|
static int |
static int |
post_check_children_wgt(struct mdoc *mdoc, int sz) |
post_check_children_wgt(struct mdoc *mdoc, const char *p, int sz) |
{ |
{ |
int i; |
int i; |
|
|
if ((i = post_check_children_count(mdoc)) > sz) |
if ((i = post_check_children_count(mdoc)) > sz) |
return(1); |
return(1); |
return(mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests more " |
return(mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests more " |
"than %d parameters (has %d)", sz, i)); |
"than %d %s (has %d)", sz, p, i)); |
} |
} |
|
|
|
|
static int |
static int |
post_check_children_gt(struct mdoc *mdoc, int sz) |
post_check_children_gt(struct mdoc *mdoc, const char *p, int sz) |
{ |
{ |
int i; |
int i; |
|
|
if ((i = post_check_children_count(mdoc)) > sz) |
if ((i = post_check_children_count(mdoc)) > sz) |
return(1); |
return(1); |
return(mdoc_err(mdoc, "macro requires more than %d " |
return(mdoc_err(mdoc, "macro requires more than %d " |
"parameters (has %d)", sz, i)); |
"%s (has %d)", sz, p, i)); |
} |
} |
|
|
|
|
static int |
static int |
post_check_children_weq(struct mdoc *mdoc, int sz) |
post_check_children_weq(struct mdoc *mdoc, const char *p, int sz) |
{ |
{ |
int i; |
int i; |
|
|
if ((i = post_check_children_count(mdoc)) == sz) |
if ((i = post_check_children_count(mdoc)) == sz) |
return(1); |
return(1); |
return(mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests %d " |
return(mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests %d " |
"parameters (has %d)", sz, i)); |
"%s (has %d)", sz, p, i)); |
} |
} |
|
|
|
|
static int |
static int |
post_check_children_eq(struct mdoc *mdoc, int sz) |
post_check_children_eq(struct mdoc *mdoc, const char *p, int sz) |
{ |
{ |
int i; |
int i; |
|
|
if ((i = post_check_children_count(mdoc)) == sz) |
if ((i = post_check_children_count(mdoc)) == sz) |
return(1); |
return(1); |
return(mdoc_err(mdoc, "macro requires %d parameters " |
return(mdoc_err(mdoc, "macro requires %d %s " |
"(have %d)", sz, i)); |
"(have %d)", sz, p, i)); |
} |
} |
|
|
|
|
static int |
static int |
post_check_children_lt(struct mdoc *mdoc, int sz) |
post_check_children_lt(struct mdoc *mdoc, const char *p, int sz) |
{ |
{ |
int i; |
int i; |
|
|
if ((i = post_check_children_count(mdoc)) < sz) |
if ((i = post_check_children_count(mdoc)) < sz) |
return(1); |
return(1); |
return(mdoc_err(mdoc, "macro requires less than %d " |
return(mdoc_err(mdoc, "macro requires less than %d " |
"parameters (have %d)", sz, i)); |
"%s (have %d)", sz, p, i)); |
} |
} |
|
|
|
|
Line 367 berr_eq0(struct mdoc *mdoc) |
|
Line 367 berr_eq0(struct mdoc *mdoc) |
|
|
|
if (MDOC_BODY != mdoc->last->type) |
if (MDOC_BODY != mdoc->last->type) |
return(1); |
return(1); |
return(post_check_children_eq(mdoc, 0)); |
return(post_check_children_eq(mdoc, "body children", 0)); |
} |
} |
|
|
|
|
Line 377 bwarn_ge1(struct mdoc *mdoc) |
|
Line 377 bwarn_ge1(struct mdoc *mdoc) |
|
|
|
if (MDOC_BODY != mdoc->last->type) |
if (MDOC_BODY != mdoc->last->type) |
return(1); |
return(1); |
return(post_check_children_wgt(mdoc, 0)); |
return(post_check_children_wgt(mdoc, "body children", 0)); |
} |
} |
|
|
|
|
Line 386 ewarn_eq1(struct mdoc *mdoc) |
|
Line 386 ewarn_eq1(struct mdoc *mdoc) |
|
{ |
{ |
|
|
assert(MDOC_ELEM == mdoc->last->type); |
assert(MDOC_ELEM == mdoc->last->type); |
return(post_check_children_weq(mdoc, 1)); |
return(post_check_children_weq(mdoc, "parameters", 1)); |
} |
} |
|
|
|
|
Line 395 ewarn_eq0(struct mdoc *mdoc) |
|
Line 395 ewarn_eq0(struct mdoc *mdoc) |
|
{ |
{ |
|
|
assert(MDOC_ELEM == mdoc->last->type); |
assert(MDOC_ELEM == mdoc->last->type); |
return(post_check_children_weq(mdoc, 0)); |
return(post_check_children_weq(mdoc, "parameters", 0)); |
} |
} |
|
|
|
|
Line 404 ewarn_ge1(struct mdoc *mdoc) |
|
Line 404 ewarn_ge1(struct mdoc *mdoc) |
|
{ |
{ |
|
|
assert(MDOC_ELEM == mdoc->last->type); |
assert(MDOC_ELEM == mdoc->last->type); |
return(post_check_children_wgt(mdoc, 0)); |
return(post_check_children_wgt(mdoc, "parameters", 0)); |
} |
} |
|
|
|
|
Line 413 eerr_eq1(struct mdoc *mdoc) |
|
Line 413 eerr_eq1(struct mdoc *mdoc) |
|
{ |
{ |
|
|
assert(MDOC_ELEM == mdoc->last->type); |
assert(MDOC_ELEM == mdoc->last->type); |
return(post_check_children_eq(mdoc, 1)); |
return(post_check_children_eq(mdoc, "parameters", 1)); |
} |
} |
|
|
|
|
Line 422 eerr_le2(struct mdoc *mdoc) |
|
Line 422 eerr_le2(struct mdoc *mdoc) |
|
{ |
{ |
|
|
assert(MDOC_ELEM == mdoc->last->type); |
assert(MDOC_ELEM == mdoc->last->type); |
return(post_check_children_lt(mdoc, 3)); |
return(post_check_children_lt(mdoc, "parameters", 3)); |
} |
} |
|
|
|
|
Line 431 eerr_le1(struct mdoc *mdoc) |
|
Line 431 eerr_le1(struct mdoc *mdoc) |
|
{ |
{ |
|
|
assert(MDOC_ELEM == mdoc->last->type); |
assert(MDOC_ELEM == mdoc->last->type); |
return(post_check_children_lt(mdoc, 2)); |
return(post_check_children_lt(mdoc, "parameters", 2)); |
} |
} |
|
|
|
|
Line 440 eerr_eq0(struct mdoc *mdoc) |
|
Line 440 eerr_eq0(struct mdoc *mdoc) |
|
{ |
{ |
|
|
assert(MDOC_ELEM == mdoc->last->type); |
assert(MDOC_ELEM == mdoc->last->type); |
return(post_check_children_eq(mdoc, 0)); |
return(post_check_children_eq(mdoc, "parameters", 0)); |
} |
} |
|
|
|
|
Line 449 eerr_ge1(struct mdoc *mdoc) |
|
Line 449 eerr_ge1(struct mdoc *mdoc) |
|
{ |
{ |
|
|
assert(MDOC_ELEM == mdoc->last->type); |
assert(MDOC_ELEM == mdoc->last->type); |
return(post_check_children_gt(mdoc, 0)); |
return(post_check_children_gt(mdoc, "parameters", 0)); |
} |
} |
|
|
|
|
Line 459 herr_eq0(struct mdoc *mdoc) |
|
Line 459 herr_eq0(struct mdoc *mdoc) |
|
|
|
if (MDOC_HEAD != mdoc->last->type) |
if (MDOC_HEAD != mdoc->last->type) |
return(1); |
return(1); |
return(post_check_children_eq(mdoc, 0)); |
return(post_check_children_eq(mdoc, "parameters", 0)); |
} |
} |
|
|
|
|
Line 469 hwarn_ge1(struct mdoc *mdoc) |
|
Line 469 hwarn_ge1(struct mdoc *mdoc) |
|
|
|
if (MDOC_HEAD != mdoc->last->type) |
if (MDOC_HEAD != mdoc->last->type) |
return(1); |
return(1); |
return(post_check_children_wgt(mdoc, 0)); |
return(post_check_children_wgt(mdoc, "parameters", 0)); |
} |
} |
|
|
|
|
Line 479 herr_ge1(struct mdoc *mdoc) |
|
Line 479 herr_ge1(struct mdoc *mdoc) |
|
|
|
if (MDOC_HEAD != mdoc->last->type) |
if (MDOC_HEAD != mdoc->last->type) |
return(1); |
return(1); |
return(post_check_children_gt(mdoc, 0)); |
return(post_check_children_gt(mdoc, "parameters", 0)); |
} |
} |
|
|
|
|