version 1.28, 2009/07/12 17:25:07 |
version 1.30, 2009/07/12 17:49:32 |
Line 86 const int ttypes[TTYPE_NMAX] = { |
|
Line 86 const int ttypes[TTYPE_NMAX] = { |
|
*/ |
*/ |
struct termpair { |
struct termpair { |
struct termpair *ppair; |
struct termpair *ppair; |
int flag; /* Whether being used. */ |
int flag; /* Cross-body struct termp:flags. */ |
size_t offset; /* Left margin. */ |
|
size_t rmargin; /* Right margin. */ |
|
int count; /* Enum count. */ |
int count; /* Enum count. */ |
}; |
}; |
|
|
Line 347 print_node(DECL_ARGS) |
|
Line 345 print_node(DECL_ARGS) |
|
{ |
{ |
int dochild; |
int dochild; |
struct termpair npair; |
struct termpair npair; |
|
size_t offset, rmargin; |
|
|
/* Pre-processing. */ |
|
|
|
dochild = 1; |
dochild = 1; |
|
offset = p->offset; |
|
rmargin = p->rmargin; |
|
|
npair.ppair = pair; |
npair.ppair = pair; |
npair.offset = npair.rmargin = 0; |
|
npair.flag = 0; |
npair.flag = 0; |
npair.count = 0; |
npair.count = 0; |
|
|
Line 370 print_node(DECL_ARGS) |
|
Line 369 print_node(DECL_ARGS) |
|
if (dochild && node->child) |
if (dochild && node->child) |
print_body(p, &npair, meta, node->child); |
print_body(p, &npair, meta, node->child); |
|
|
p->flags &= ~npair.flag; |
|
|
|
/* Post-processing. */ |
/* Post-processing. */ |
|
|
if (MDOC_TEXT != node->type) |
if (MDOC_TEXT != node->type) |
if (termacts[node->tok].post) |
if (termacts[node->tok].post) |
(*termacts[node->tok].post)(p, &npair, meta, node); |
(*termacts[node->tok].post)(p, &npair, meta, node); |
|
|
|
p->offset = offset; |
|
p->rmargin = rmargin; |
|
p->flags &= ~npair.flag; |
} |
} |
|
|
|
|
Line 705 termp_it_pre(DECL_ARGS) |
|
Line 706 termp_it_pre(DECL_ARGS) |
|
|
|
/* Save parent attributes. */ |
/* Save parent attributes. */ |
|
|
pair->offset = p->offset; |
|
pair->rmargin = p->rmargin; |
|
pair->flag = p->flags; |
pair->flag = p->flags; |
|
|
/* Get list width and offset. */ |
/* Get list width and offset. */ |
Line 969 termp_it_post(DECL_ARGS) |
|
Line 968 termp_it_post(DECL_ARGS) |
|
break; |
break; |
} |
} |
|
|
p->offset = pair->offset; |
|
p->rmargin = pair->rmargin; |
|
p->flags = pair->flag; |
p->flags = pair->flag; |
} |
} |
|
|
Line 1124 termp_nd_pre(DECL_ARGS) |
|
Line 1121 termp_nd_pre(DECL_ARGS) |
|
|
|
if (MDOC_BODY != node->type) |
if (MDOC_BODY != node->type) |
return(1); |
return(1); |
|
|
/* |
/* |
* XXX: signed off by jmc@openbsd.org. This technically |
* XXX: signed off by jmc@openbsd.org. This technically |
* produces a minus sign after the Nd, which is wrong, but is |
* produces a minus sign after the Nd, which is wrong, but is |
Line 1188 termp_vt_pre(DECL_ARGS) |
|
Line 1186 termp_vt_pre(DECL_ARGS) |
|
{ |
{ |
|
|
/* FIXME: this can be "type name". */ |
/* FIXME: this can be "type name". */ |
pair->flag |= TTYPE_VAR_DECL; |
pair->flag |= ttypes[TTYPE_VAR_DECL]; |
return(1); |
return(1); |
} |
} |
|
|
|
|
termp_fd_pre(DECL_ARGS) |
termp_fd_pre(DECL_ARGS) |
{ |
{ |
|
|
pair->flag |= TTYPE_FUNC_DECL; |
pair->flag |= ttypes[TTYPE_FUNC_DECL]; |
return(1); |
return(1); |
} |
} |
|
|
Line 1220 termp_fd_post(DECL_ARGS) |
|
Line 1218 termp_fd_post(DECL_ARGS) |
|
|
|
if (node->sec != SEC_SYNOPSIS) |
if (node->sec != SEC_SYNOPSIS) |
return; |
return; |
|
|
term_newln(p); |
term_newln(p); |
if (node->next && MDOC_Fd != node->next->tok) |
if (node->next && MDOC_Fd != node->next->tok) |
term_vspace(p); |
term_vspace(p); |
Line 1336 termp_d1_pre(DECL_ARGS) |
|
Line 1335 termp_d1_pre(DECL_ARGS) |
|
if (MDOC_BLOCK != node->type) |
if (MDOC_BLOCK != node->type) |
return(1); |
return(1); |
term_newln(p); |
term_newln(p); |
pair->offset = INDENT + 1; |
p->offset += (INDENT + 1); |
p->offset += pair->offset; |
|
return(1); |
return(1); |
} |
} |
|
|
Line 1350 termp_d1_post(DECL_ARGS) |
|
Line 1348 termp_d1_post(DECL_ARGS) |
|
if (MDOC_BLOCK != node->type) |
if (MDOC_BLOCK != node->type) |
return; |
return; |
term_newln(p); |
term_newln(p); |
p->offset -= pair->offset; |
|
} |
} |
|
|
|
|
Line 1519 termp_bd_pre(DECL_ARGS) |
|
Line 1516 termp_bd_pre(DECL_ARGS) |
|
if (NULL == node->parent->args) |
if (NULL == node->parent->args) |
errx(1, "missing display type"); |
errx(1, "missing display type"); |
|
|
pair->offset = p->offset; |
|
|
|
for (type = -1, i = 0; |
for (type = -1, i = 0; |
i < (int)node->parent->args->argc; i++) { |
i < (int)node->parent->args->argc; i++) { |
switch (node->parent->args->argv[i].arg) { |
switch (node->parent->args->argv[i].arg) { |
Line 1590 termp_bd_post(DECL_ARGS) |
|
Line 1585 termp_bd_post(DECL_ARGS) |
|
|
|
term_flushln(p); |
term_flushln(p); |
p->flags &= ~TERMP_LITERAL; |
p->flags &= ~TERMP_LITERAL; |
p->offset = pair->offset; |
|
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
} |
} |
|
|
|
|
termp_ss_post(DECL_ARGS) |
termp_ss_post(DECL_ARGS) |
{ |
{ |
|
|
switch (node->type) { |
if (MDOC_HEAD == node->type) |
case (MDOC_HEAD): |
|
term_newln(p); |
term_newln(p); |
p->offset = INDENT; |
|
break; |
|
default: |
|
break; |
|
} |
|
} |
} |
|
|
|
|