version 1.56, 2010/03/27 10:21:38 |
version 1.59, 2010/03/29 10:10:35 |
Line 478 macrowarn(struct man *m, int ln, const char *buf) |
|
Line 478 macrowarn(struct man *m, int ln, const char *buf) |
|
int |
int |
man_pmacro(struct man *m, int ln, char *buf) |
man_pmacro(struct man *m, int ln, char *buf) |
{ |
{ |
int i, j, ppos, fl; |
int i, j, ppos; |
enum mant tok; |
enum mant tok; |
char mac[5]; |
char mac[5]; |
struct man_node *n; |
struct man_node *n; |
|
|
/* Comments and empties are quickly ignored. */ |
/* Comments and empties are quickly ignored. */ |
|
|
fl = m->flags; |
|
|
|
if ('\0' == buf[1]) |
if ('\0' == buf[1]) |
return(1); |
return(1); |
|
|
Line 496 man_pmacro(struct man *m, int ln, char *buf) |
|
Line 494 man_pmacro(struct man *m, int ln, char *buf) |
|
* Skip whitespace between the control character and initial |
* Skip whitespace between the control character and initial |
* text. "Whitespace" is both spaces and tabs. |
* text. "Whitespace" is both spaces and tabs. |
*/ |
*/ |
if (' ' == buf[i]) { |
if (' ' == buf[i] || '\t' == buf[i]) { |
i++; |
i++; |
while (buf[i] && (' ' == buf[i] || '\t' == buf[i])) |
while (buf[i] && (' ' == buf[i] || '\t' == buf[i])) |
i++; |
i++; |
Line 554 man_pmacro(struct man *m, int ln, char *buf) |
|
Line 552 man_pmacro(struct man *m, int ln, char *buf) |
|
* Remove prior ELINE macro, as it's being clobbering by a new |
* Remove prior ELINE macro, as it's being clobbering by a new |
* macro. Note that NSCOPED macros do not close out ELINE |
* macro. Note that NSCOPED macros do not close out ELINE |
* macros---they don't print text---so we let those slip by. |
* macros---they don't print text---so we let those slip by. |
|
* NOTE: we don't allow roff blocks (NOCLOSE) to be embedded |
|
* here because that would stipulate blocks as children of |
|
* elements! |
*/ |
*/ |
|
|
if ( ! (MAN_NSCOPED & man_macros[tok].flags) && |
if ( ! (MAN_NSCOPED & man_macros[tok].flags) && |
Line 585 man_pmacro(struct man *m, int ln, char *buf) |
|
Line 586 man_pmacro(struct man *m, int ln, char *buf) |
|
m->flags &= ~MAN_ELINE; |
m->flags &= ~MAN_ELINE; |
} |
} |
|
|
/* Begin recursive parse sequence. */ |
/* |
|
* Save the fact that we're in the next-line for a block. In |
|
* this way, embedded roff instructions can "remember" state |
|
* when they exit. |
|
*/ |
|
|
assert(man_macros[tok].fp); |
if (MAN_BLINE & m->flags) |
|
m->flags |= MAN_BPLINE; |
|
|
|
/* Call to handler... */ |
|
|
|
assert(man_macros[tok].fp); |
if ( ! (*man_macros[tok].fp)(m, tok, ln, ppos, &i, buf)) |
if ( ! (*man_macros[tok].fp)(m, tok, ln, ppos, &i, buf)) |
goto err; |
goto err; |
|
|
|
|
/* |
/* |
* We weren't in a block-line scope when entering the |
* We weren't in a block-line scope when entering the |
* above-parsed macro, so return. |
* above-parsed macro, so return. |
* |
|
* FIXME: this prohibits the nesting of blocks (e.g., `de' and |
|
* family) within BLINE or ELINE systems. This is annoying. |
|
*/ |
*/ |
|
|
if ( ! (MAN_BLINE & fl)) { |
if ( ! (MAN_BPLINE & m->flags)) { |
m->flags &= ~MAN_ILINE; |
m->flags &= ~MAN_ILINE; |
return(1); |
return(1); |
} |
} |
|
m->flags &= ~MAN_BPLINE; |
|
|
/* |
/* |
* If we're in a block scope, then allow this macro to slip by |
* If we're in a block scope, then allow this macro to slip by |