version 1.81, 2010/05/24 12:31:16 |
version 1.87, 2010/05/30 22:56:02 |
Line 83 static int post_at(POST_ARGS); |
|
Line 83 static int post_at(POST_ARGS); |
|
static int post_bf(POST_ARGS); |
static int post_bf(POST_ARGS); |
static int post_bl(POST_ARGS); |
static int post_bl(POST_ARGS); |
static int post_bl_head(POST_ARGS); |
static int post_bl_head(POST_ARGS); |
|
static int post_dt(POST_ARGS); |
static int post_it(POST_ARGS); |
static int post_it(POST_ARGS); |
static int post_lb(POST_ARGS); |
static int post_lb(POST_ARGS); |
static int post_nm(POST_ARGS); |
static int post_nm(POST_ARGS); |
Line 92 static int post_sh(POST_ARGS); |
|
Line 93 static int post_sh(POST_ARGS); |
|
static int post_sh_body(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_st(POST_ARGS); |
static int post_st(POST_ARGS); |
|
static int post_eoln(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); |
static int pre_bd(PRE_ARGS); |
static int pre_bd(PRE_ARGS); |
Line 111 static v_post posts_bd[] = { hwarn_eq0, bwarn_ge1, NU |
|
Line 113 static v_post posts_bd[] = { hwarn_eq0, bwarn_ge1, NU |
|
static v_post posts_bf[] = { hwarn_le1, post_bf, NULL }; |
static v_post posts_bf[] = { hwarn_le1, post_bf, NULL }; |
static v_post posts_bl[] = { bwarn_ge1, post_bl, NULL }; |
static v_post posts_bl[] = { bwarn_ge1, post_bl, NULL }; |
static v_post posts_bool[] = { eerr_eq1, ebool, NULL }; |
static v_post posts_bool[] = { eerr_eq1, ebool, NULL }; |
|
static v_post posts_eoln[] = { post_eoln, NULL }; |
|
static v_post posts_dt[] = { post_dt, NULL }; |
static v_post posts_fo[] = { hwarn_eq1, bwarn_ge1, NULL }; |
static v_post posts_fo[] = { hwarn_eq1, bwarn_ge1, NULL }; |
static v_post posts_it[] = { post_it, NULL }; |
static v_post posts_it[] = { post_it, NULL }; |
static v_post posts_lb[] = { eerr_eq1, post_lb, NULL }; |
static v_post posts_lb[] = { eerr_eq1, post_lb, NULL }; |
Line 127 static v_post posts_text1[] = { eerr_eq1, NULL }; |
|
Line 131 static v_post posts_text1[] = { eerr_eq1, NULL }; |
|
static v_post posts_vt[] = { post_vt, NULL }; |
static v_post posts_vt[] = { post_vt, NULL }; |
static v_post posts_wline[] = { bwarn_ge1, herr_eq0, NULL }; |
static v_post posts_wline[] = { bwarn_ge1, herr_eq0, NULL }; |
static v_post posts_wtext[] = { ewarn_ge1, NULL }; |
static v_post posts_wtext[] = { ewarn_ge1, NULL }; |
static v_post posts_xr[] = { ewarn_ge1, NULL }; |
|
static v_pre pres_an[] = { pre_an, NULL }; |
static v_pre pres_an[] = { pre_an, NULL }; |
static v_pre pres_bd[] = { pre_display, pre_bd, NULL }; |
static v_pre pres_bd[] = { pre_display, pre_bd, NULL }; |
static v_pre pres_bl[] = { pre_bl, NULL }; |
static v_pre pres_bl[] = { pre_bl, NULL }; |
Line 138 static v_pre pres_er[] = { NULL, NULL }; |
|
Line 141 static v_pre pres_er[] = { NULL, NULL }; |
|
static v_pre pres_ex[] = { NULL, NULL }; |
static v_pre pres_ex[] = { NULL, NULL }; |
static v_pre pres_fd[] = { NULL, NULL }; |
static v_pre pres_fd[] = { NULL, NULL }; |
static v_pre pres_it[] = { pre_it, NULL }; |
static v_pre pres_it[] = { pre_it, NULL }; |
static v_pre pres_lb[] = { NULL, NULL }; |
|
static v_pre pres_os[] = { pre_os, NULL }; |
static v_pre pres_os[] = { pre_os, NULL }; |
static v_pre pres_rv[] = { pre_rv, NULL }; |
static v_pre pres_rv[] = { pre_rv, NULL }; |
static v_pre pres_sh[] = { pre_sh, NULL }; |
static v_pre pres_sh[] = { pre_sh, NULL }; |
Line 147 static v_pre pres_ss[] = { pre_ss, NULL }; |
|
Line 149 static v_pre pres_ss[] = { pre_ss, NULL }; |
|
const struct valids mdoc_valids[MDOC_MAX] = { |
const struct valids mdoc_valids[MDOC_MAX] = { |
{ NULL, NULL }, /* Ap */ |
{ NULL, NULL }, /* Ap */ |
{ pres_dd, posts_text }, /* Dd */ |
{ pres_dd, posts_text }, /* Dd */ |
{ pres_dt, NULL }, /* Dt */ |
{ pres_dt, posts_dt }, /* Dt */ |
{ pres_os, NULL }, /* Os */ |
{ pres_os, NULL }, /* Os */ |
{ pres_sh, posts_sh }, /* Sh */ |
{ pres_sh, posts_sh }, /* Sh */ |
{ pres_ss, posts_ss }, /* Ss */ |
{ pres_ss, posts_ss }, /* Ss */ |
Line 185 const struct valids mdoc_valids[MDOC_MAX] = { |
|
Line 187 const struct valids mdoc_valids[MDOC_MAX] = { |
|
{ NULL, posts_st }, /* St */ |
{ NULL, posts_st }, /* St */ |
{ NULL, NULL }, /* Va */ |
{ NULL, NULL }, /* Va */ |
{ NULL, posts_vt }, /* Vt */ |
{ NULL, posts_vt }, /* Vt */ |
{ NULL, posts_xr }, /* Xr */ |
{ NULL, posts_wtext }, /* Xr */ |
{ NULL, posts_text }, /* %A */ |
{ NULL, posts_text }, /* %A */ |
{ NULL, posts_text }, /* %B */ /* FIXME: can be used outside Rs/Re. */ |
{ NULL, posts_text }, /* %B */ /* FIXME: can be used outside Rs/Re. */ |
{ NULL, posts_text }, /* %D */ /* FIXME: check date with mandoc_a2time(). */ |
{ NULL, posts_text }, /* %D */ /* FIXME: check date with mandoc_a2time(). */ |
Line 247 const struct valids mdoc_valids[MDOC_MAX] = { |
|
Line 249 const struct valids mdoc_valids[MDOC_MAX] = { |
|
{ NULL, NULL }, /* Oc */ |
{ NULL, NULL }, /* Oc */ |
{ NULL, posts_wline }, /* Bk */ |
{ NULL, posts_wline }, /* Bk */ |
{ NULL, NULL }, /* Ek */ |
{ NULL, NULL }, /* Ek */ |
{ NULL, posts_notext }, /* Bt */ |
{ NULL, posts_eoln }, /* Bt */ |
{ NULL, NULL }, /* Hf */ |
{ NULL, NULL }, /* Hf */ |
{ NULL, NULL }, /* Fr */ |
{ NULL, NULL }, /* Fr */ |
{ NULL, posts_notext }, /* Ud */ |
{ NULL, posts_eoln }, /* Ud */ |
{ pres_lb, posts_lb }, /* Lb */ |
{ NULL, posts_lb }, /* Lb */ |
{ NULL, posts_notext }, /* Lp */ |
{ NULL, posts_notext }, /* Lp */ |
{ NULL, posts_text }, /* Lk */ |
{ NULL, posts_text }, /* Lk */ |
{ NULL, posts_text }, /* Mt */ |
{ NULL, posts_text }, /* Mt */ |
Line 392 CHECK_CHILD_DEFN(err, lt, <) /* err_child_lt() */ |
|
Line 394 CHECK_CHILD_DEFN(err, lt, <) /* err_child_lt() */ |
|
CHECK_CHILD_DEFN(warn, lt, <) /* warn_child_lt() */ |
CHECK_CHILD_DEFN(warn, lt, <) /* warn_child_lt() */ |
CHECK_BODY_DEFN(ge1, warn, warn_child_gt, 0) /* bwarn_ge1() */ |
CHECK_BODY_DEFN(ge1, warn, warn_child_gt, 0) /* bwarn_ge1() */ |
CHECK_BODY_DEFN(ge1, err, err_child_gt, 0) /* berr_ge1() */ |
CHECK_BODY_DEFN(ge1, err, err_child_gt, 0) /* berr_ge1() */ |
CHECK_ELEM_DEFN(ge1, warn, warn_child_gt, 0) /* ewarn_gt1() */ |
CHECK_ELEM_DEFN(ge1, warn, warn_child_gt, 0) /* ewarn_ge1() */ |
CHECK_ELEM_DEFN(eq1, err, err_child_eq, 1) /* eerr_eq1() */ |
CHECK_ELEM_DEFN(eq1, err, err_child_eq, 1) /* eerr_eq1() */ |
CHECK_ELEM_DEFN(le1, err, err_child_lt, 2) /* eerr_le1() */ |
CHECK_ELEM_DEFN(le1, err, err_child_lt, 2) /* eerr_le1() */ |
CHECK_ELEM_DEFN(eq0, err, err_child_eq, 0) /* eerr_eq0() */ |
CHECK_ELEM_DEFN(eq0, err, err_child_eq, 0) /* eerr_eq0() */ |
Line 463 check_text(struct mdoc *mdoc, int line, int pos, const |
|
Line 465 check_text(struct mdoc *mdoc, int line, int pos, const |
|
if ( ! (MDOC_LITERAL & mdoc->flags)) |
if ( ! (MDOC_LITERAL & mdoc->flags)) |
if ( ! mdoc_pmsg(mdoc, line, pos, MANDOCERR_BADCHAR)) |
if ( ! mdoc_pmsg(mdoc, line, pos, MANDOCERR_BADCHAR)) |
return(0); |
return(0); |
} else if ( ! isprint((u_char)*p)) |
} else if ( ! isprint((u_char)*p) && ASCII_HYPH != *p) |
if ( ! mdoc_pmsg(mdoc, line, pos, MANDOCERR_BADCHAR)) |
if ( ! mdoc_pmsg(mdoc, line, pos, MANDOCERR_BADCHAR)) |
return(0); |
return(0); |
|
|
Line 738 pre_rv(PRE_ARGS) |
|
Line 740 pre_rv(PRE_ARGS) |
|
|
|
|
|
static int |
static int |
pre_dt(PRE_ARGS) |
post_dt(POST_ARGS) |
{ |
{ |
|
const struct mdoc_node *nn; |
|
const char *p; |
|
|
/* FIXME: make sure is capitalised. */ |
if (NULL != (nn = mdoc->last->child)) |
|
for (p = nn->string; *p; p++) { |
|
if (toupper((u_char)*p) == *p) |
|
continue; |
|
if ( ! mdoc_nmsg(mdoc, nn, MANDOCERR_UPPERCASE)) |
|
return(0); |
|
break; |
|
} |
|
|
|
return(1); |
|
} |
|
|
|
|
|
static int |
|
pre_dt(PRE_ARGS) |
|
{ |
|
|
if (0 == mdoc->meta.date || mdoc->meta.os) |
if (0 == mdoc->meta.date || mdoc->meta.os) |
if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_PROLOGOOO)) |
if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_PROLOGOOO)) |
return(0); |
return(0); |
Line 830 post_lb(POST_ARGS) |
|
Line 849 post_lb(POST_ARGS) |
|
|
|
|
|
static int |
static int |
|
post_eoln(POST_ARGS) |
|
{ |
|
|
|
if (NULL == mdoc->last->child) |
|
return(1); |
|
return(mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_ARGSLOST)); |
|
} |
|
|
|
|
|
static int |
post_vt(POST_ARGS) |
post_vt(POST_ARGS) |
{ |
{ |
const struct mdoc_node *n; |
const struct mdoc_node *n; |
Line 899 post_an(POST_ARGS) |
|
Line 928 post_an(POST_ARGS) |
|
static int |
static int |
post_it(POST_ARGS) |
post_it(POST_ARGS) |
{ |
{ |
|
/* FIXME: use mdoc_list! */ |
int type, i, cols; |
int type, i, cols; |
struct mdoc_node *n, *c; |
struct mdoc_node *n, *c; |
|
|
Line 988 post_it(POST_ARGS) |
|
Line 1018 post_it(POST_ARGS) |
|
return(0); |
return(0); |
break; |
break; |
case (MDOC_Column): |
case (MDOC_Column): |
if (NULL == mdoc->last->head->child) |
assert(NULL == mdoc->last->head->child); |
if ( ! mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOARGS)) |
if (NULL == mdoc->last->body->child) |
|
if ( ! mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_NOBODY)) |
return(0); |
return(0); |
if (mdoc->last->body->child) |
|
if ( ! mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_BODYLOST)) |
/* Count up the number of columns. */ |
return(0); |
|
c = mdoc->last->child; |
c = mdoc->last->child; |
for (i = 0; c && MDOC_HEAD == c->type; c = c->next) |
for (i = 0; c; c = c->next) |
i++; |
if (MDOC_BODY == c->type) |
|
i++; |
|
|
if (i < cols) { |
if (i < cols) { |
if ( ! mdoc_vmsg(mdoc, MANDOCERR_ARGCOUNT, |
if ( ! mdoc_vmsg(mdoc, MANDOCERR_ARGCOUNT, |