version 1.139, 2011/05/24 14:00:39 |
version 1.140, 2011/05/24 15:22:14 |
Line 853 roff_cond_sub(ROFF_ARGS) |
|
Line 853 roff_cond_sub(ROFF_ARGS) |
|
*/ |
*/ |
|
|
if (ROFF_MAX == (t = roff_parse(r, *bufp, &pos))) { |
if (ROFF_MAX == (t = roff_parse(r, *bufp, &pos))) { |
/* |
|
* Jump through hoops to detect a \}, because it could |
|
* be (say) \\}, which is something completely |
|
* different. |
|
*/ |
|
ep = &(*bufp)[pos]; |
ep = &(*bufp)[pos]; |
for ( ; NULL != (ep = strchr(ep, '\\')); ep++) { |
for ( ; NULL != (ep = strchr(ep, '\\')); ep++) { |
ep++; |
ep++; |
if ('}' != *ep) |
if ('}' != *ep) |
continue; |
continue; |
*--ep = '\0'; |
*ep = '&'; |
roff_ccond(r, ROFF_ccond, bufp, szp, |
roff_ccond(r, ROFF_ccond, bufp, szp, |
ln, pos, pos + 2, offs); |
ln, pos, pos + 2, offs); |
break; |
break; |
Line 887 roff_cond_sub(ROFF_ARGS) |
|
Line 882 roff_cond_sub(ROFF_ARGS) |
|
ln, ppos, pos, offs)); |
ln, ppos, pos, offs)); |
} |
} |
|
|
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
static enum rofferr |
static enum rofferr |
roff_cond_text(ROFF_ARGS) |
roff_cond_text(ROFF_ARGS) |
{ |
{ |
char *ep, *st; |
char *ep; |
enum roffrule rr; |
enum roffrule rr; |
|
|
rr = r->last->rule; |
rr = r->last->rule; |
|
roffnode_cleanscope(r); |
|
|
/* |
ep = &(*bufp)[pos]; |
* We display the value of the text if out current evaluation |
for ( ; NULL != (ep = strchr(ep, '\\')); ep++) { |
* scope permits us to do so. |
ep++; |
*/ |
if ('}' != *ep) |
|
continue; |
/* FIXME: use roff_ccond? */ |
*ep = '&'; |
|
roff_ccond(r, ROFF_ccond, bufp, szp, |
st = &(*bufp)[pos]; |
ln, pos, pos + 2, offs); |
if (NULL == (ep = strstr(st, "\\}"))) { |
|
roffnode_cleanscope(r); |
|
return(ROFFRULE_DENY == rr ? ROFF_IGN : ROFF_CONT); |
|
} |
} |
|
|
if (ep == st || (ep > st && '\\' != *(ep - 1))) |
|
roffnode_pop(r); |
|
|
|
roffnode_cleanscope(r); |
|
return(ROFFRULE_DENY == rr ? ROFF_IGN : ROFF_CONT); |
return(ROFFRULE_DENY == rr ? ROFF_IGN : ROFF_CONT); |
} |
} |
|
|
|
|
static enum roffrule |
static enum roffrule |
roff_evalcond(const char *v, int *pos) |
roff_evalcond(const char *v, int *pos) |