version 1.98, 2010/08/20 01:02:07 |
version 1.100, 2010/08/29 11:29:51 |
|
|
ROFF_rm, |
ROFF_rm, |
ROFF_tr, |
ROFF_tr, |
ROFF_cblock, |
ROFF_cblock, |
ROFF_ccond, |
ROFF_ccond, /* FIXME: remove this. */ |
ROFF_nr, |
ROFF_nr, |
ROFF_MAX |
ROFF_MAX |
}; |
}; |
Line 136 static int roff_res(struct roff *, |
|
Line 136 static int roff_res(struct roff *, |
|
char **, size_t *, int); |
char **, size_t *, int); |
static void roff_setstr(struct roff *, |
static void roff_setstr(struct roff *, |
const char *, const char *); |
const char *, const char *); |
|
static char *roff_strdup(const char *); |
|
|
/* See roff_hash_find() */ |
/* See roff_hash_find() */ |
|
|
Line 763 roff_cond_sub(ROFF_ARGS) |
|
Line 764 roff_cond_sub(ROFF_ARGS) |
|
if (l != r->last) |
if (l != r->last) |
return(ROFFRULE_DENY == rr ? ROFF_IGN : ROFF_CONT); |
return(ROFFRULE_DENY == rr ? ROFF_IGN : ROFF_CONT); |
|
|
if (ROFF_MAX == (t = roff_parse(*bufp, &pos))) |
if (ROFF_MAX == (t = roff_parse(*bufp, &pos))) { |
|
if ('\\' == (*bufp)[pos] && '}' == (*bufp)[pos + 1]) |
|
return(roff_ccond |
|
(r, ROFF_ccond, bufp, szp, |
|
ln, pos, pos + 2, offs)); |
return(ROFFRULE_DENY == rr ? ROFF_IGN : ROFF_CONT); |
return(ROFFRULE_DENY == rr ? ROFF_IGN : ROFF_CONT); |
|
} |
|
|
/* |
/* |
* A denied conditional must evaluate its children if and only |
* A denied conditional must evaluate its children if and only |
Line 796 roff_cond_text(ROFF_ARGS) |
|
Line 802 roff_cond_text(ROFF_ARGS) |
|
* scope permits us to do so. |
* scope permits us to do so. |
*/ |
*/ |
|
|
|
/* FIXME: use roff_ccond? */ |
|
|
st = &(*bufp)[pos]; |
st = &(*bufp)[pos]; |
if (NULL == (ep = strstr(st, "\\}"))) { |
if (NULL == (ep = strstr(st, "\\}"))) { |
roffnode_cleanscope(r); |
roffnode_cleanscope(r); |
Line 1035 roff_nr(ROFF_ARGS) |
|
Line 1043 roff_nr(ROFF_ARGS) |
|
} |
} |
|
|
|
|
|
static char * |
|
roff_strdup(const char *name) |
|
{ |
|
char *namecopy, *sv; |
|
|
|
/* |
|
* This isn't a nice simple mandoc_strdup() because we must |
|
* handle roff's stupid double-escape rule. |
|
*/ |
|
sv = namecopy = mandoc_malloc(strlen(name) + 1); |
|
while (*name) { |
|
if ('\\' == *name && '\\' == *(name + 1)) |
|
name++; |
|
*namecopy++ = *name++; |
|
} |
|
|
|
*namecopy = '\0'; |
|
return(sv); |
|
} |
|
|
|
|
static void |
static void |
roff_setstr(struct roff *r, const char *name, const char *string) |
roff_setstr(struct roff *r, const char *name, const char *string) |
{ |
{ |
Line 1054 roff_setstr(struct roff *r, const char *name, const ch |
|
Line 1083 roff_setstr(struct roff *r, const char *name, const ch |
|
} else |
} else |
free(n->string); |
free(n->string); |
|
|
ROFF_DEBUG("roff: new symbol: [%s] = [%s]\n", name, string); |
/* Don't use mandoc_strdup: clean out double-escapes. */ |
n->string = string ? strdup(string) : NULL; |
n->string = string ? roff_strdup(string) : NULL; |
|
ROFF_DEBUG("roff: new symbol: [%s] = [%s]\n", name, n->string); |
} |
} |
|
|
|
|