version 1.131, 2011/04/05 22:22:33 |
version 1.134, 2011/04/13 16:26:11 |
Line 277 roffnode_pop(struct roff *r) |
|
Line 277 roffnode_pop(struct roff *r) |
|
assert(r->last); |
assert(r->last); |
p = r->last; |
p = r->last; |
|
|
if (ROFF_el == p->tok) |
|
if (r->rstackpos > -1) |
|
r->rstackpos--; |
|
|
|
r->last = r->last->parent; |
r->last = r->last->parent; |
free(p->name); |
free(p->name); |
free(p->end); |
free(p->end); |
Line 976 roff_cond(ROFF_ARGS) |
|
Line 972 roff_cond(ROFF_ARGS) |
|
int sv; |
int sv; |
enum roffrule rule; |
enum roffrule rule; |
|
|
/* Stack overflow! */ |
/* |
|
* An `.el' has no conditional body: it will consume the value |
|
* of the current rstack entry set in prior `ie' calls or |
|
* defaults to DENY. |
|
* |
|
* If we're not an `el', however, then evaluate the conditional. |
|
*/ |
|
|
if (ROFF_ie == tok && r->rstackpos == RSTACK_MAX - 1) { |
rule = ROFF_el == tok ? |
mandoc_msg(MANDOCERR_MEM, r->parse, ln, ppos, NULL); |
(r->rstackpos < 0 ? |
return(ROFF_ERR); |
ROFFRULE_DENY : r->rstack[r->rstackpos--]) : |
} |
roff_evalcond(*bufp, &pos); |
|
|
/* First, evaluate the conditional. */ |
|
|
|
if (ROFF_el == tok) { |
|
/* |
|
* An `.el' will get the value of the current rstack |
|
* entry set in prior `ie' calls or defaults to DENY. |
|
*/ |
|
if (r->rstackpos < 0) |
|
rule = ROFFRULE_DENY; |
|
else |
|
rule = r->rstack[r->rstackpos]; |
|
} else |
|
rule = roff_evalcond(*bufp, &pos); |
|
|
|
sv = pos; |
sv = pos; |
|
|
while (' ' == (*bufp)[pos]) |
while (' ' == (*bufp)[pos]) |
pos++; |
pos++; |
|
|
Line 1018 roff_cond(ROFF_ARGS) |
|
Line 1005 roff_cond(ROFF_ARGS) |
|
|
|
r->last->rule = rule; |
r->last->rule = rule; |
|
|
|
/* |
|
* An if-else will put the NEGATION of the current evaluated |
|
* conditional into the stack of rules. |
|
*/ |
|
|
if (ROFF_ie == tok) { |
if (ROFF_ie == tok) { |
/* |
if (r->rstackpos == RSTACK_MAX - 1) { |
* An if-else will put the NEGATION of the current |
mandoc_msg(MANDOCERR_MEM, |
* evaluated conditional into the stack. |
r->parse, ln, ppos, NULL); |
*/ |
return(ROFF_ERR); |
r->rstackpos++; |
} |
if (ROFFRULE_DENY == r->last->rule) |
r->rstack[++r->rstackpos] = |
r->rstack[r->rstackpos] = ROFFRULE_ALLOW; |
ROFFRULE_DENY == r->last->rule ? |
else |
ROFFRULE_ALLOW : ROFFRULE_DENY; |
r->rstack[r->rstackpos] = ROFFRULE_DENY; |
|
} |
} |
|
|
/* If the parent has false as its rule, then so do we. */ |
/* If the parent has false as its rule, then so do we. */ |