version 1.134, 2012/07/29 12:35:42 |
version 1.135, 2012/11/17 00:26:33 |
|
|
#define DECL_ARGS struct termp *p, \ |
#define DECL_ARGS struct termp *p, \ |
struct mtermp *mt, \ |
struct mtermp *mt, \ |
const struct man_node *n, \ |
const struct man_node *n, \ |
const struct man_meta *m |
const struct man_meta *meta |
|
|
struct termact { |
struct termact { |
int (*pre)(DECL_ARGS); |
int (*pre)(DECL_ARGS); |
Line 138 terminal_man(void *arg, const struct man *man) |
|
Line 138 terminal_man(void *arg, const struct man *man) |
|
{ |
{ |
struct termp *p; |
struct termp *p; |
const struct man_node *n; |
const struct man_node *n; |
const struct man_meta *m; |
const struct man_meta *meta; |
struct mtermp mt; |
struct mtermp mt; |
|
|
p = (struct termp *)arg; |
p = (struct termp *)arg; |
Line 154 terminal_man(void *arg, const struct man *man) |
|
Line 154 terminal_man(void *arg, const struct man *man) |
|
p->symtab = mchars_alloc(); |
p->symtab = mchars_alloc(); |
|
|
n = man_node(man); |
n = man_node(man); |
m = man_meta(man); |
meta = man_meta(man); |
|
|
term_begin(p, print_man_head, print_man_foot, m); |
term_begin(p, print_man_head, print_man_foot, meta); |
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
|
|
memset(&mt, 0, sizeof(struct mtermp)); |
memset(&mt, 0, sizeof(struct mtermp)); |
Line 166 terminal_man(void *arg, const struct man *man) |
|
Line 166 terminal_man(void *arg, const struct man *man) |
|
mt.pardist = 1; |
mt.pardist = 1; |
|
|
if (n->child) |
if (n->child) |
print_man_nodelist(p, &mt, n->child, m); |
print_man_nodelist(p, &mt, n->child, meta); |
|
|
term_end(p); |
term_end(p); |
} |
} |
Line 327 pre_alternate(DECL_ARGS) |
|
Line 327 pre_alternate(DECL_ARGS) |
|
term_fontrepl(p, font[i]); |
term_fontrepl(p, font[i]); |
if (savelit && NULL == nn->next) |
if (savelit && NULL == nn->next) |
mt->fl |= MANT_LITERAL; |
mt->fl |= MANT_LITERAL; |
print_man_node(p, mt, nn, m); |
print_man_node(p, mt, nn, meta); |
if (nn->next) |
if (nn->next) |
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
} |
} |
Line 644 pre_IP(DECL_ARGS) |
|
Line 644 pre_IP(DECL_ARGS) |
|
mt->fl &= ~MANT_LITERAL; |
mt->fl &= ~MANT_LITERAL; |
|
|
if (n->child) |
if (n->child) |
print_man_node(p, mt, n->child, m); |
print_man_node(p, mt, n->child, meta); |
|
|
if (savelit) |
if (savelit) |
mt->fl |= MANT_LITERAL; |
mt->fl |= MANT_LITERAL; |
Line 729 pre_TP(DECL_ARGS) |
|
Line 729 pre_TP(DECL_ARGS) |
|
/* Don't print same-line elements. */ |
/* Don't print same-line elements. */ |
for (nn = n->child; nn; nn = nn->next) |
for (nn = n->child; nn; nn = nn->next) |
if (nn->line > n->line) |
if (nn->line > n->line) |
print_man_node(p, mt, nn, m); |
print_man_node(p, mt, nn, meta); |
|
|
if (savelit) |
if (savelit) |
mt->fl |= MANT_LITERAL; |
mt->fl |= MANT_LITERAL; |
Line 982 print_man_node(DECL_ARGS) |
|
Line 982 print_man_node(DECL_ARGS) |
|
|
|
c = 1; |
c = 1; |
if (termacts[n->tok].pre) |
if (termacts[n->tok].pre) |
c = (*termacts[n->tok].pre)(p, mt, n, m); |
c = (*termacts[n->tok].pre)(p, mt, n, meta); |
|
|
if (c && n->child) |
if (c && n->child) |
print_man_nodelist(p, mt, n->child, m); |
print_man_nodelist(p, mt, n->child, meta); |
|
|
if (termacts[n->tok].post) |
if (termacts[n->tok].post) |
(*termacts[n->tok].post)(p, mt, n, m); |
(*termacts[n->tok].post)(p, mt, n, meta); |
if ( ! (MAN_NOTEXT & termacts[n->tok].flags)) |
if ( ! (MAN_NOTEXT & termacts[n->tok].flags)) |
term_fontrepl(p, TERMFONT_NONE); |
term_fontrepl(p, TERMFONT_NONE); |
|
|
|
|
print_man_nodelist(DECL_ARGS) |
print_man_nodelist(DECL_ARGS) |
{ |
{ |
|
|
print_man_node(p, mt, n, m); |
print_man_node(p, mt, n, meta); |
if ( ! n->next) |
if ( ! n->next) |
return; |
return; |
print_man_nodelist(p, mt, n->next, m); |
print_man_nodelist(p, mt, n->next, meta); |
} |
} |
|
|
|
|
Line 1104 print_man_head(struct termp *p, const void *arg) |
|
Line 1104 print_man_head(struct termp *p, const void *arg) |
|
{ |
{ |
char buf[BUFSIZ], title[BUFSIZ]; |
char buf[BUFSIZ], title[BUFSIZ]; |
size_t buflen, titlen; |
size_t buflen, titlen; |
const struct man_meta *m; |
const struct man_meta *meta; |
|
|
m = (const struct man_meta *)arg; |
meta = (const struct man_meta *)arg; |
assert(m->title); |
assert(meta->title); |
assert(m->msec); |
assert(meta->msec); |
|
|
if (m->vol) |
if (meta->vol) |
strlcpy(buf, m->vol, BUFSIZ); |
strlcpy(buf, meta->vol, BUFSIZ); |
else |
else |
buf[0] = '\0'; |
buf[0] = '\0'; |
buflen = term_strlen(p, buf); |
buflen = term_strlen(p, buf); |
|
|
/* Top left corner: manual title and section. */ |
/* Top left corner: manual title and section. */ |
|
|
snprintf(title, BUFSIZ, "%s(%s)", m->title, m->msec); |
snprintf(title, BUFSIZ, "%s(%s)", meta->title, meta->msec); |
titlen = term_strlen(p, title); |
titlen = term_strlen(p, title); |
|
|
p->flags |= TERMP_NOBREAK | TERMP_NOSPACE; |
p->flags |= TERMP_NOBREAK | TERMP_NOSPACE; |