version 1.100, 2009/08/18 14:27:16 |
version 1.103, 2009/08/20 11:44:47 |
Line 459 mdoc_tail_alloc(struct mdoc *m, int line, int pos, int |
|
Line 459 mdoc_tail_alloc(struct mdoc *m, int line, int pos, int |
|
p = node_alloc(m, line, pos, tok, MDOC_TAIL); |
p = node_alloc(m, line, pos, tok, MDOC_TAIL); |
if (NULL == p) |
if (NULL == p) |
return(0); |
return(0); |
return(node_append(m, p)); |
if ( ! node_append(m, p)) |
|
return(0); |
|
m->next = MDOC_NEXT_CHILD; |
|
return(1); |
} |
} |
|
|
|
|
Line 474 mdoc_head_alloc(struct mdoc *m, int line, int pos, int |
|
Line 477 mdoc_head_alloc(struct mdoc *m, int line, int pos, int |
|
p = node_alloc(m, line, pos, tok, MDOC_HEAD); |
p = node_alloc(m, line, pos, tok, MDOC_HEAD); |
if (NULL == p) |
if (NULL == p) |
return(0); |
return(0); |
return(node_append(m, p)); |
if ( ! node_append(m, p)) |
|
return(0); |
|
m->next = MDOC_NEXT_CHILD; |
|
return(1); |
} |
} |
|
|
|
|
Line 486 mdoc_body_alloc(struct mdoc *m, int line, int pos, int |
|
Line 492 mdoc_body_alloc(struct mdoc *m, int line, int pos, int |
|
p = node_alloc(m, line, pos, tok, MDOC_BODY); |
p = node_alloc(m, line, pos, tok, MDOC_BODY); |
if (NULL == p) |
if (NULL == p) |
return(0); |
return(0); |
return(node_append(m, p)); |
if ( ! node_append(m, p)) |
|
return(0); |
|
m->next = MDOC_NEXT_CHILD; |
|
return(1); |
} |
} |
|
|
|
|
Line 502 mdoc_block_alloc(struct mdoc *m, int line, int pos, |
|
Line 511 mdoc_block_alloc(struct mdoc *m, int line, int pos, |
|
p->args = args; |
p->args = args; |
if (p->args) |
if (p->args) |
(args->refcnt)++; |
(args->refcnt)++; |
return(node_append(m, p)); |
if ( ! node_append(m, p)) |
|
return(0); |
|
m->next = MDOC_NEXT_CHILD; |
|
return(1); |
} |
} |
|
|
|
|
Line 518 mdoc_elem_alloc(struct mdoc *m, int line, int pos, |
|
Line 530 mdoc_elem_alloc(struct mdoc *m, int line, int pos, |
|
p->args = args; |
p->args = args; |
if (p->args) |
if (p->args) |
(args->refcnt)++; |
(args->refcnt)++; |
return(node_append(m, p)); |
if ( ! node_append(m, p)) |
|
return(0); |
|
m->next = MDOC_NEXT_CHILD; |
|
return(1); |
} |
} |
|
|
|
|
Line 543 pstring(struct mdoc *m, int line, int pos, const char |
|
Line 558 pstring(struct mdoc *m, int line, int pos, const char |
|
/* Prohibit truncation. */ |
/* Prohibit truncation. */ |
assert(sv < len + 1); |
assert(sv < len + 1); |
|
|
return(node_append(m, n)); |
if ( ! node_append(m, n)) |
|
return(0); |
|
m->next = MDOC_NEXT_SIBLING; |
|
return(1); |
} |
} |
|
|
|
|
Line 600 parsetext(struct mdoc *m, int line, char *buf) |
|
Line 618 parsetext(struct mdoc *m, int line, char *buf) |
|
* back-end, as it should be preserved as a single term. |
* back-end, as it should be preserved as a single term. |
*/ |
*/ |
|
|
if (MDOC_LITERAL & m->flags) { |
if (MDOC_LITERAL & m->flags) |
if ( ! mdoc_word_alloc(m, line, 0, buf)) |
return(mdoc_word_alloc(m, line, 0, buf)); |
return(0); |
|
m->next = MDOC_NEXT_SIBLING; |
|
return(1); |
|
} |
|
|
|
/* Disallow blank/white-space lines in non-literal mode. */ |
/* Disallow blank/white-space lines in non-literal mode. */ |
|
|
Line 630 parsetext(struct mdoc *m, int line, char *buf) |
|
Line 644 parsetext(struct mdoc *m, int line, char *buf) |
|
buf[i++] = 0; |
buf[i++] = 0; |
if ( ! pstring(m, line, j, &buf[j], (size_t)(i - j))) |
if ( ! pstring(m, line, j, &buf[j], (size_t)(i - j))) |
return(0); |
return(0); |
m->next = MDOC_NEXT_SIBLING; |
|
|
|
for ( ; ' ' == buf[i]; i++) |
for ( ; ' ' == buf[i]; i++) |
/* Skip trailing whitespace. */ ; |
/* Skip trailing whitespace. */ ; |
Line 669 macrowarn(struct mdoc *m, int ln, const char *buf) |
|
Line 682 macrowarn(struct mdoc *m, int ln, const char *buf) |
|
int |
int |
parsemacro(struct mdoc *m, int ln, char *buf) |
parsemacro(struct mdoc *m, int ln, char *buf) |
{ |
{ |
int i, j, c, ppos; |
int i, j, c; |
char mac[5]; |
char mac[5]; |
|
|
/* Empty lines are ignored. */ |
/* Empty lines are ignored. */ |
Line 689 parsemacro(struct mdoc *m, int ln, char *buf) |
|
Line 702 parsemacro(struct mdoc *m, int ln, char *buf) |
|
return(1); |
return(1); |
} |
} |
|
|
ppos = i; |
|
|
|
/* Copy the first word into a nil-terminated buffer. */ |
/* Copy the first word into a nil-terminated buffer. */ |
|
|
for (j = 0; j < 4; j++, i++) { |
for (j = 0; j < 4; j++, i++) { |
Line 723 parsemacro(struct mdoc *m, int ln, char *buf) |
|
Line 734 parsemacro(struct mdoc *m, int ln, char *buf) |
|
* Begin recursive parse sequence. Since we're at the start of |
* Begin recursive parse sequence. Since we're at the start of |
* the line, we don't need to do callable/parseable checks. |
* the line, we don't need to do callable/parseable checks. |
*/ |
*/ |
if ( ! mdoc_macro(m, c, ln, ppos, &i, buf)) |
if ( ! mdoc_macro(m, c, ln, 1, &i, buf)) |
goto err; |
goto err; |
|
|
return(1); |
return(1); |