version 1.26, 2009/07/12 20:30:35 |
version 1.34, 2009/07/26 10:29:39 |
Line 41 static int post_bl_width(POST_ARGS); |
|
Line 41 static int post_bl_width(POST_ARGS); |
|
static int post_dd(POST_ARGS); |
static int post_dd(POST_ARGS); |
static int post_display(POST_ARGS); |
static int post_display(POST_ARGS); |
static int post_dt(POST_ARGS); |
static int post_dt(POST_ARGS); |
static int post_lk(POST_ARGS); |
static int post_lb(POST_ARGS); |
static int post_nm(POST_ARGS); |
static int post_nm(POST_ARGS); |
static int post_os(POST_ARGS); |
static int post_os(POST_ARGS); |
static int post_prol(POST_ARGS); |
static int post_prol(POST_ARGS); |
static int post_sh(POST_ARGS); |
static int post_sh(POST_ARGS); |
static int post_st(POST_ARGS); |
static int post_st(POST_ARGS); |
static int post_std(POST_ARGS); |
static int post_std(POST_ARGS); |
|
static int post_tilde(POST_ARGS); |
|
|
static int pre_bd(PRE_ARGS); |
static int pre_bd(PRE_ARGS); |
static int pre_dl(PRE_ARGS); |
static int pre_dl(PRE_ARGS); |
Line 88 const struct actions mdoc_actions[MDOC_MAX] = { |
|
Line 89 const struct actions mdoc_actions[MDOC_MAX] = { |
|
{ NULL, post_nm }, /* Nm */ |
{ NULL, post_nm }, /* Nm */ |
{ NULL, NULL }, /* Op */ |
{ NULL, NULL }, /* Op */ |
{ NULL, NULL }, /* Ot */ |
{ NULL, NULL }, /* Ot */ |
{ NULL, NULL }, /* Pa */ |
{ NULL, post_tilde }, /* Pa */ |
{ NULL, post_std }, /* Rv */ |
{ NULL, post_std }, /* Rv */ |
{ NULL, post_st }, /* St */ |
{ NULL, post_st }, /* St */ |
{ NULL, NULL }, /* Va */ |
{ NULL, NULL }, /* Va */ |
Line 159 const struct actions mdoc_actions[MDOC_MAX] = { |
|
Line 160 const struct actions mdoc_actions[MDOC_MAX] = { |
|
{ NULL, NULL }, /* Hf */ |
{ NULL, NULL }, /* Hf */ |
{ NULL, NULL }, /* Fr */ |
{ NULL, NULL }, /* Fr */ |
{ NULL, NULL }, /* Ud */ |
{ NULL, NULL }, /* Ud */ |
{ NULL, NULL }, /* Lb */ |
{ NULL, post_lb }, /* Lb */ |
{ NULL, NULL }, /* Lp */ |
{ NULL, NULL }, /* Lp */ |
{ NULL, post_lk }, /* Lk */ |
{ NULL, post_tilde }, /* Lk */ |
{ NULL, NULL }, /* Mt */ |
{ NULL, NULL }, /* Mt */ |
{ NULL, NULL }, /* Brq */ |
{ NULL, NULL }, /* Brq */ |
{ NULL, NULL }, /* Bro */ |
{ NULL, NULL }, /* Bro */ |
Line 171 const struct actions mdoc_actions[MDOC_MAX] = { |
|
Line 172 const struct actions mdoc_actions[MDOC_MAX] = { |
|
{ NULL, NULL }, /* En */ |
{ NULL, NULL }, /* En */ |
{ NULL, NULL }, /* Dx */ |
{ NULL, NULL }, /* Dx */ |
{ NULL, NULL }, /* %Q */ |
{ NULL, NULL }, /* %Q */ |
|
{ NULL, NULL }, /* br */ |
|
{ NULL, NULL }, /* sp */ |
}; |
}; |
|
|
static int concat(struct mdoc *, const struct mdoc_node *, |
static int concat(struct mdoc *, const struct mdoc_node *, |
Line 291 post_nm(POST_ARGS) |
|
Line 294 post_nm(POST_ARGS) |
|
|
|
|
|
static int |
static int |
|
post_lb(POST_ARGS) |
|
{ |
|
const char *p; |
|
char *buf; |
|
size_t sz; |
|
|
|
assert(MDOC_TEXT == m->last->child->type); |
|
p = mdoc_a2lib(m->last->child->string); |
|
if (NULL == p) { |
|
sz = strlen(m->last->child->string) + |
|
2 + strlen("\\(lqlibrary\\(rq"); |
|
buf = malloc(sz); |
|
if (NULL == buf) |
|
return(mdoc_nerr(m, m->last, EMALLOC)); |
|
(void)snprintf(buf, sz, "library \\(lq%s\\(rq", |
|
m->last->child->string); |
|
free(m->last->child->string); |
|
m->last->child->string = buf; |
|
return(1); |
|
} |
|
|
|
free(m->last->child->string); |
|
m->last->child->string = strdup(p); |
|
if (NULL == m->last->child->string) |
|
return(mdoc_nerr(m, m->last, EMALLOC)); |
|
return(1); |
|
} |
|
|
|
|
|
static int |
post_st(POST_ARGS) |
post_st(POST_ARGS) |
{ |
{ |
const char *p; |
const char *p; |
Line 454 post_dt(POST_ARGS) |
|
Line 487 post_dt(POST_ARGS) |
|
free(m->meta.vol); |
free(m->meta.vol); |
if (NULL == (m->meta.vol = strdup(cp))) |
if (NULL == (m->meta.vol = strdup(cp))) |
return(mdoc_nerr(m, m->last, EMALLOC)); |
return(mdoc_nerr(m, m->last, EMALLOC)); |
n = n->next; |
|
} else { |
} else { |
cp = mdoc_a2arch(n->string); |
cp = mdoc_a2arch(n->string); |
if (NULL == cp) { |
if (NULL == cp) { |
Line 498 post_os(POST_ARGS) |
|
Line 530 post_os(POST_ARGS) |
|
if (NULL == (m->meta.os = strdup(buf))) |
if (NULL == (m->meta.os = strdup(buf))) |
return(mdoc_nerr(m, m->last, EMALLOC)); |
return(mdoc_nerr(m, m->last, EMALLOC)); |
|
|
m->flags |= MDOC_PBODY; |
|
return(post_prol(m)); |
return(post_prol(m)); |
} |
} |
|
|
Line 702 post_bl(POST_ARGS) |
|
Line 733 post_bl(POST_ARGS) |
|
|
|
|
|
static int |
static int |
post_lk(POST_ARGS) |
post_tilde(POST_ARGS) |
{ |
{ |
struct mdoc_node *n; |
struct mdoc_node *n; |
|
|
Line 712 post_lk(POST_ARGS) |
|
Line 743 post_lk(POST_ARGS) |
|
n = m->last; |
n = m->last; |
m->next = MDOC_NEXT_CHILD; |
m->next = MDOC_NEXT_CHILD; |
|
|
/* XXX: this isn't documented anywhere! */ |
/* XXX: not documented for `Lk'. */ |
if ( ! mdoc_word_alloc(m, m->last->line, m->last->pos, "~")) |
if ( ! mdoc_word_alloc(m, m->last->line, m->last->pos, "~")) |
return(0); |
return(0); |
|
|
Line 790 post_prol(POST_ARGS) |
|
Line 821 post_prol(POST_ARGS) |
|
} |
} |
|
|
mdoc_node_freelist(n); |
mdoc_node_freelist(n); |
|
|
|
if (m->meta.title && m->meta.date && m->meta.os) |
|
m->flags |= MDOC_PBODY; |
return(1); |
return(1); |
} |
} |
|
|
Line 800 pre_dl(PRE_ARGS) |
|
Line 834 pre_dl(PRE_ARGS) |
|
|
|
if (MDOC_BODY == n->type) |
if (MDOC_BODY == n->type) |
m->flags |= MDOC_LITERAL; |
m->flags |= MDOC_LITERAL; |
|
|
return(1); |
return(1); |
} |
} |
|
|
Line 812 pre_bd(PRE_ARGS) |
|
Line 847 pre_bd(PRE_ARGS) |
|
if (MDOC_BODY != n->type) |
if (MDOC_BODY != n->type) |
return(1); |
return(1); |
|
|
/* Enter literal context if `Bd -literal' or * -unfilled'. */ |
/* Enter literal context if `Bd -literal' or `-unfilled'. */ |
|
|
|
/* |
|
* TODO: `-offset' without an argument should be the width of |
|
* the literal "<string>". |
|
*/ |
|
|
for (n = n->parent, i = 0; i < (int)n->args->argc; i++) |
for (n = n->parent, i = 0; i < (int)n->args->argc; i++) |
if (MDOC_Literal == n->args->argv[i].arg) |
if (MDOC_Literal == n->args->argv[i].arg) |