version 1.20, 2009/01/07 15:53:00 |
version 1.22, 2009/01/07 16:11:40 |
Line 121 const struct mdoc_macro __mdoc_macros[MDOC_MAX] = { |
|
Line 121 const struct mdoc_macro __mdoc_macros[MDOC_MAX] = { |
|
{ macro_obsolete, 0 }, /* Ot */ |
{ macro_obsolete, 0 }, /* Ot */ |
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Pa */ |
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Pa */ |
{ macro_constant, 0 }, /* Rv */ |
{ macro_constant, 0 }, /* Rv */ |
/* XXX - supposed to be (but isn't) callable. */ |
/* XXX - .St supposed to be (but isn't) callable. */ |
{ macro_constant_delimited, MDOC_PARSED }, /* St */ |
{ macro_constant_delimited, MDOC_PARSED }, /* St */ |
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Va */ |
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Va */ |
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Vt */ |
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Vt */ |
Line 278 mdoc_parseln(struct mdoc *mdoc, int line, char *buf) |
|
Line 278 mdoc_parseln(struct mdoc *mdoc, int line, char *buf) |
|
if ('.' != *buf) { |
if ('.' != *buf) { |
if (SEC_PROLOGUE == mdoc->sec_lastn) |
if (SEC_PROLOGUE == mdoc->sec_lastn) |
return(mdoc_err(mdoc, -1, 0, ERR_SYNTAX_NOTEXT)); |
return(mdoc_err(mdoc, -1, 0, ERR_SYNTAX_NOTEXT)); |
mdoc_word_alloc(mdoc, 0, buf); |
mdoc_word_alloc(mdoc, line, 0, buf); |
mdoc->next = MDOC_NEXT_SIBLING; |
mdoc->next = MDOC_NEXT_SIBLING; |
return(1); |
return(1); |
} |
} |
Line 312 mdoc_parseln(struct mdoc *mdoc, int line, char *buf) |
|
Line 312 mdoc_parseln(struct mdoc *mdoc, int line, char *buf) |
|
while (buf[i] && isspace(buf[i])) |
while (buf[i] && isspace(buf[i])) |
i++; |
i++; |
|
|
if ( ! mdoc_macro(mdoc, c, 1, &i, buf)) { |
if ( ! mdoc_macro(mdoc, c, line, 1, &i, buf)) { |
mdoc->flags |= MDOC_HALT; |
mdoc->flags |= MDOC_HALT; |
return(0); |
return(0); |
} |
} |
Line 358 mdoc_warn(struct mdoc *mdoc, int tok, int pos, enum md |
|
Line 358 mdoc_warn(struct mdoc *mdoc, int tok, int pos, enum md |
|
|
|
|
|
int |
int |
mdoc_macro(struct mdoc *mdoc, int tok, int ppos, int *pos, char *buf) |
mdoc_macro(struct mdoc *mdoc, int tok, |
|
int line, int ppos, int *pos, char *buf) |
{ |
{ |
|
|
if ( ! (MDOC_PROLOGUE & mdoc_macros[tok].flags) && |
if ( ! (MDOC_PROLOGUE & mdoc_macros[tok].flags) && |
Line 375 mdoc_macro(struct mdoc *mdoc, int tok, int ppos, int * |
|
Line 376 mdoc_macro(struct mdoc *mdoc, int tok, int ppos, int * |
|
return(0); |
return(0); |
} |
} |
|
|
return((*mdoc_macros[tok].fp)(mdoc, tok, ppos, pos, buf)); |
return((*mdoc_macros[tok].fp)(mdoc, tok, |
|
line, ppos, pos, buf)); |
} |
} |
|
|
|
|
Line 477 mdoc_node_append(struct mdoc *mdoc, int pos, struct md |
|
Line 479 mdoc_node_append(struct mdoc *mdoc, int pos, struct md |
|
|
|
|
|
void |
void |
mdoc_tail_alloc(struct mdoc *mdoc, int pos, int tok) |
mdoc_tail_alloc(struct mdoc *mdoc, int line, int pos, int tok) |
{ |
{ |
struct mdoc_node *p; |
struct mdoc_node *p; |
|
|
Line 486 mdoc_tail_alloc(struct mdoc *mdoc, int pos, int tok) |
|
Line 488 mdoc_tail_alloc(struct mdoc *mdoc, int pos, int tok) |
|
|
|
p = xcalloc(1, sizeof(struct mdoc_node)); |
p = xcalloc(1, sizeof(struct mdoc_node)); |
|
|
|
p->line = line; |
|
p->pos = pos; |
p->type = MDOC_TAIL; |
p->type = MDOC_TAIL; |
p->data.tail.tok = tok; |
p->data.tail.tok = tok; |
|
|
Line 494 mdoc_tail_alloc(struct mdoc *mdoc, int pos, int tok) |
|
Line 498 mdoc_tail_alloc(struct mdoc *mdoc, int pos, int tok) |
|
|
|
|
|
void |
void |
mdoc_head_alloc(struct mdoc *mdoc, int pos, int tok) |
mdoc_head_alloc(struct mdoc *mdoc, int line, int pos, int tok) |
{ |
{ |
struct mdoc_node *p; |
struct mdoc_node *p; |
|
|
Line 503 mdoc_head_alloc(struct mdoc *mdoc, int pos, int tok) |
|
Line 507 mdoc_head_alloc(struct mdoc *mdoc, int pos, int tok) |
|
|
|
p = xcalloc(1, sizeof(struct mdoc_node)); |
p = xcalloc(1, sizeof(struct mdoc_node)); |
|
|
|
p->line = line; |
|
p->pos = pos; |
p->type = MDOC_HEAD; |
p->type = MDOC_HEAD; |
p->data.head.tok = tok; |
p->data.head.tok = tok; |
|
|
Line 511 mdoc_head_alloc(struct mdoc *mdoc, int pos, int tok) |
|
Line 517 mdoc_head_alloc(struct mdoc *mdoc, int pos, int tok) |
|
|
|
|
|
void |
void |
mdoc_body_alloc(struct mdoc *mdoc, int pos, int tok) |
mdoc_body_alloc(struct mdoc *mdoc, int line, int pos, int tok) |
{ |
{ |
struct mdoc_node *p; |
struct mdoc_node *p; |
|
|
Line 520 mdoc_body_alloc(struct mdoc *mdoc, int pos, int tok) |
|
Line 526 mdoc_body_alloc(struct mdoc *mdoc, int pos, int tok) |
|
|
|
p = xcalloc(1, sizeof(struct mdoc_node)); |
p = xcalloc(1, sizeof(struct mdoc_node)); |
|
|
|
p->line = line; |
|
p->pos = pos; |
p->type = MDOC_BODY; |
p->type = MDOC_BODY; |
p->data.body.tok = tok; |
p->data.body.tok = tok; |
|
|
Line 528 mdoc_body_alloc(struct mdoc *mdoc, int pos, int tok) |
|
Line 536 mdoc_body_alloc(struct mdoc *mdoc, int pos, int tok) |
|
|
|
|
|
void |
void |
mdoc_block_alloc(struct mdoc *mdoc, int pos, int tok, |
mdoc_block_alloc(struct mdoc *mdoc, int line, int pos, |
size_t argsz, const struct mdoc_arg *args) |
int tok, size_t argsz, const struct mdoc_arg *args) |
{ |
{ |
struct mdoc_node *p; |
struct mdoc_node *p; |
|
|
p = xcalloc(1, sizeof(struct mdoc_node)); |
p = xcalloc(1, sizeof(struct mdoc_node)); |
|
|
|
p->pos = pos; |
|
p->line = line; |
p->type = MDOC_BLOCK; |
p->type = MDOC_BLOCK; |
p->data.block.tok = tok; |
p->data.block.tok = tok; |
p->data.block.argc = argsz; |
p->data.block.argc = argsz; |
Line 545 mdoc_block_alloc(struct mdoc *mdoc, int pos, int tok, |
|
Line 555 mdoc_block_alloc(struct mdoc *mdoc, int pos, int tok, |
|
|
|
|
|
void |
void |
mdoc_elem_alloc(struct mdoc *mdoc, int pos, int tok, |
mdoc_elem_alloc(struct mdoc *mdoc, int line, int pos, |
size_t argsz, const struct mdoc_arg *args) |
int tok, size_t argsz, const struct mdoc_arg *args) |
{ |
{ |
struct mdoc_node *p; |
struct mdoc_node *p; |
|
|
p = xcalloc(1, sizeof(struct mdoc_node)); |
p = xcalloc(1, sizeof(struct mdoc_node)); |
|
|
|
p->line = line; |
|
p->pos = pos; |
p->type = MDOC_ELEM; |
p->type = MDOC_ELEM; |
p->data.elem.tok = tok; |
p->data.elem.tok = tok; |
p->data.elem.argc = argsz; |
p->data.elem.argc = argsz; |
Line 561 mdoc_elem_alloc(struct mdoc *mdoc, int pos, int tok, |
|
Line 574 mdoc_elem_alloc(struct mdoc *mdoc, int pos, int tok, |
|
|
|
|
|
void |
void |
mdoc_word_alloc(struct mdoc *mdoc, int pos, const char *word) |
mdoc_word_alloc(struct mdoc *mdoc, |
|
int line, int pos, const char *word) |
{ |
{ |
struct mdoc_node *p; |
struct mdoc_node *p; |
|
|
p = xcalloc(1, sizeof(struct mdoc_node)); |
p = xcalloc(1, sizeof(struct mdoc_node)); |
|
p->line = line; |
|
p->pos = pos; |
p->type = MDOC_TEXT; |
p->type = MDOC_TEXT; |
p->data.text.string = xstrdup(word); |
p->data.text.string = xstrdup(word); |
|
|