version 1.98, 2010/06/12 12:38:01 |
version 1.103, 2010/07/01 21:44:47 |
Line 107 static int pre_ss(PRE_ARGS); |
|
Line 107 static int pre_ss(PRE_ARGS); |
|
|
|
static v_post posts_an[] = { post_an, NULL }; |
static v_post posts_an[] = { post_an, NULL }; |
static v_post posts_at[] = { post_at, NULL }; |
static v_post posts_at[] = { post_at, NULL }; |
static v_post posts_bd[] = { hwarn_eq0, bwarn_ge1, NULL }; |
static v_post posts_bd_bk[] = { hwarn_eq0, bwarn_ge1, NULL }; |
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 }; |
Line 154 const struct valids mdoc_valids[MDOC_MAX] = { |
|
Line 154 const struct valids mdoc_valids[MDOC_MAX] = { |
|
{ NULL, posts_notext }, /* Pp */ |
{ NULL, posts_notext }, /* Pp */ |
{ pres_d1, posts_wline }, /* D1 */ |
{ pres_d1, posts_wline }, /* D1 */ |
{ pres_d1, posts_wline }, /* Dl */ |
{ pres_d1, posts_wline }, /* Dl */ |
{ pres_bd, posts_bd }, /* Bd */ |
{ pres_bd, posts_bd_bk }, /* Bd */ |
{ NULL, NULL }, /* Ed */ |
{ NULL, NULL }, /* Ed */ |
{ pres_bl, posts_bl }, /* Bl */ |
{ pres_bl, posts_bl }, /* Bl */ |
{ NULL, NULL }, /* El */ |
{ NULL, NULL }, /* El */ |
Line 245 const struct valids mdoc_valids[MDOC_MAX] = { |
|
Line 245 const struct valids mdoc_valids[MDOC_MAX] = { |
|
{ NULL, NULL }, /* Fc */ |
{ NULL, NULL }, /* Fc */ |
{ NULL, NULL }, /* Oo */ |
{ NULL, NULL }, /* Oo */ |
{ NULL, NULL }, /* Oc */ |
{ NULL, NULL }, /* Oc */ |
{ NULL, posts_wline }, /* Bk */ |
{ NULL, posts_bd_bk }, /* Bk */ |
{ NULL, NULL }, /* Ek */ |
{ NULL, NULL }, /* Ek */ |
{ NULL, posts_eoln }, /* Bt */ |
{ NULL, posts_eoln }, /* Bt */ |
{ NULL, NULL }, /* Hf */ |
{ NULL, NULL }, /* Hf */ |
Line 458 check_text(struct mdoc *mdoc, int line, int pos, char |
|
Line 458 check_text(struct mdoc *mdoc, int line, int pos, char |
|
{ |
{ |
int c; |
int c; |
|
|
|
/* |
|
* FIXME: we absolutely cannot let \b get through or it will |
|
* destroy some assumptions in terms of format. |
|
*/ |
|
|
for ( ; *p; p++, pos++) { |
for ( ; *p; p++, pos++) { |
if ('\t' == *p) { |
if ('\t' == *p) { |
if ( ! (MDOC_LITERAL & mdoc->flags)) |
if ( ! (MDOC_LITERAL & mdoc->flags)) |
Line 532 pre_display(PRE_ARGS) |
|
Line 537 pre_display(PRE_ARGS) |
|
static int |
static int |
pre_bl(PRE_ARGS) |
pre_bl(PRE_ARGS) |
{ |
{ |
int i, width, comp, dup; |
int i, comp, dup; |
const char *offs; |
const char *offs, *width; |
enum mdoc_list lt; |
enum mdoc_list lt; |
|
|
if (MDOC_BLOCK != n->type) { |
if (MDOC_BLOCK != n->type) { |
assert(n->parent); |
assert(n->parent); |
|
if (ENDBODY_NOT != n->end) |
|
return(1); |
assert(MDOC_BLOCK == n->parent->type); |
assert(MDOC_BLOCK == n->parent->type); |
assert(MDOC_Bl == n->parent->tok); |
assert(MDOC_Bl == n->parent->tok); |
assert(LIST__NONE != n->parent->data.Bl.type); |
assert(LIST__NONE != n->parent->data.Bl.type); |
Line 553 pre_bl(PRE_ARGS) |
|
Line 560 pre_bl(PRE_ARGS) |
|
*/ |
*/ |
|
|
assert(LIST__NONE == n->data.Bl.type); |
assert(LIST__NONE == n->data.Bl.type); |
width = -1; |
|
|
|
/* LINTED */ |
/* LINTED */ |
for (i = 0; n->args && i < (int)n->args->argc; i++) { |
for (i = 0; n->args && i < (int)n->args->argc; i++) { |
lt = LIST__NONE; |
lt = LIST__NONE; |
dup = comp = 0; |
dup = comp = 0; |
offs = NULL; |
width = offs = NULL; |
switch (n->args->argv[i].arg) { |
switch (n->args->argv[i].arg) { |
/* Set list types. */ |
/* Set list types. */ |
case (MDOC_Bullet): |
case (MDOC_Bullet): |
Line 601 pre_bl(PRE_ARGS) |
|
Line 607 pre_bl(PRE_ARGS) |
|
comp = 1; |
comp = 1; |
break; |
break; |
case (MDOC_Width): |
case (MDOC_Width): |
if (width >= 0) |
dup = (NULL != n->data.Bl.width); |
dup++; |
width = n->args->argv[i].value[0]; |
width = i; |
|
break; |
break; |
case (MDOC_Offset): |
case (MDOC_Offset): |
/* NB: this can be empty! */ |
/* NB: this can be empty! */ |
if (n->args->argv[i].sz) { |
if (n->args->argv[i].sz) { |
offs = n->args->argv[i].value[0]; |
offs = n->args->argv[i].value[0]; |
dup = (NULL != n->data.Bd.offs); |
dup = (NULL != n->data.Bl.offs); |
break; |
break; |
} |
} |
if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_IGNARGV)) |
if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_IGNARGV)) |
Line 626 pre_bl(PRE_ARGS) |
|
Line 631 pre_bl(PRE_ARGS) |
|
n->data.Bl.comp = comp; |
n->data.Bl.comp = comp; |
if (offs && ! dup) |
if (offs && ! dup) |
n->data.Bl.offs = offs; |
n->data.Bl.offs = offs; |
|
if (width && ! dup) |
|
n->data.Bl.width = width; |
|
|
/* Check: multiple list types. */ |
/* Check: multiple list types. */ |
|
|
Line 641 pre_bl(PRE_ARGS) |
|
Line 648 pre_bl(PRE_ARGS) |
|
/* The list type should come first. */ |
/* The list type should come first. */ |
|
|
if (n->data.Bl.type == LIST__NONE) |
if (n->data.Bl.type == LIST__NONE) |
if (width >= 0 || n->data.Bl.offs || n->data.Bl.comp) |
if (n->data.Bl.width || |
|
n->data.Bl.offs || |
|
n->data.Bl.comp) |
if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_LISTFIRST)) |
if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_LISTFIRST)) |
return(0); |
return(0); |
|
|
Line 664 pre_bl(PRE_ARGS) |
|
Line 673 pre_bl(PRE_ARGS) |
|
|
|
switch (n->data.Bl.type) { |
switch (n->data.Bl.type) { |
case (LIST_tag): |
case (LIST_tag): |
if (width >= 0) |
if (n->data.Bl.width) |
break; |
break; |
if (mdoc_nmsg(mdoc, n, MANDOCERR_NOWIDTHARG)) |
if (mdoc_nmsg(mdoc, n, MANDOCERR_NOWIDTHARG)) |
break; |
break; |
Line 678 pre_bl(PRE_ARGS) |
|
Line 687 pre_bl(PRE_ARGS) |
|
case (LIST_inset): |
case (LIST_inset): |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case (LIST_item): |
case (LIST_item): |
if (width < 0) |
if (NULL == n->data.Bl.width) |
break; |
break; |
if (mdoc_nmsg(mdoc, n, MANDOCERR_WIDTHARG)) |
if (mdoc_nmsg(mdoc, n, MANDOCERR_WIDTHARG)) |
break; |
break; |
Line 804 pre_sh(PRE_ARGS) |
|
Line 813 pre_sh(PRE_ARGS) |
|
|
|
if (MDOC_BLOCK != n->type) |
if (MDOC_BLOCK != n->type) |
return(1); |
return(1); |
|
|
|
mdoc->regs->regs[(int)REG_nS].set = 0; |
return(check_parent(mdoc, n, MDOC_MAX, MDOC_ROOT)); |
return(check_parent(mdoc, n, MDOC_MAX, MDOC_ROOT)); |
} |
} |
|
|