version 1.55, 2010/01/01 17:14:28 |
version 1.56, 2010/03/22 05:59:32 |
|
|
struct termact { |
struct termact { |
int (*pre)(DECL_ARGS); |
int (*pre)(DECL_ARGS); |
void (*post)(DECL_ARGS); |
void (*post)(DECL_ARGS); |
|
int flags; |
|
#define MAN_NOTEXT (1 << 0) /* Never has text children. */ |
}; |
}; |
|
|
static int a2width(const struct man_node *); |
static int a2width(const struct man_node *); |
Line 105 static void post_SS(DECL_ARGS); |
|
Line 107 static void post_SS(DECL_ARGS); |
|
static void post_TP(DECL_ARGS); |
static void post_TP(DECL_ARGS); |
|
|
static const struct termact termacts[MAN_MAX] = { |
static const struct termact termacts[MAN_MAX] = { |
{ pre_br, NULL }, /* br */ |
{ pre_br, NULL, MAN_NOTEXT }, /* br */ |
{ NULL, NULL }, /* TH */ |
{ NULL, NULL, 0 }, /* TH */ |
{ pre_SH, post_SH }, /* SH */ |
{ pre_SH, post_SH, 0 }, /* SH */ |
{ pre_SS, post_SS }, /* SS */ |
{ pre_SS, post_SS, 0 }, /* SS */ |
{ pre_TP, post_TP }, /* TP */ |
{ pre_TP, post_TP, 0 }, /* TP */ |
{ pre_PP, NULL }, /* LP */ |
{ pre_PP, NULL, 0 }, /* LP */ |
{ pre_PP, NULL }, /* PP */ |
{ pre_PP, NULL, 0 }, /* PP */ |
{ pre_PP, NULL }, /* P */ |
{ pre_PP, NULL, 0 }, /* P */ |
{ pre_IP, post_IP }, /* IP */ |
{ pre_IP, post_IP, 0 }, /* IP */ |
{ pre_HP, post_HP }, /* HP */ |
{ pre_HP, post_HP, 0 }, /* HP */ |
{ NULL, NULL }, /* SM */ |
{ NULL, NULL, 0 }, /* SM */ |
{ pre_B, NULL }, /* SB */ |
{ pre_B, NULL, 0 }, /* SB */ |
{ pre_BI, NULL }, /* BI */ |
{ pre_BI, NULL, 0 }, /* BI */ |
{ pre_BI, NULL }, /* IB */ |
{ pre_BI, NULL, 0 }, /* IB */ |
{ pre_RB, NULL }, /* BR */ |
{ pre_RB, NULL, 0 }, /* BR */ |
{ pre_RB, NULL }, /* RB */ |
{ pre_RB, NULL, 0 }, /* RB */ |
{ NULL, NULL }, /* R */ |
{ NULL, NULL, 0 }, /* R */ |
{ pre_B, NULL }, /* B */ |
{ pre_B, NULL, 0 }, /* B */ |
{ pre_I, NULL }, /* I */ |
{ pre_I, NULL, 0 }, /* I */ |
{ pre_RI, NULL }, /* IR */ |
{ pre_RI, NULL, 0 }, /* IR */ |
{ pre_RI, NULL }, /* RI */ |
{ pre_RI, NULL, 0 }, /* RI */ |
{ NULL, NULL }, /* na */ |
{ NULL, NULL, MAN_NOTEXT }, /* na */ |
{ pre_I, NULL }, /* i */ |
{ pre_I, NULL, 0 }, /* i */ |
{ pre_sp, NULL }, /* sp */ |
{ pre_sp, NULL, MAN_NOTEXT }, /* sp */ |
{ pre_nf, NULL }, /* nf */ |
{ pre_nf, NULL, 0 }, /* nf */ |
{ pre_fi, NULL }, /* fi */ |
{ pre_fi, NULL, 0 }, /* fi */ |
{ NULL, NULL }, /* r */ |
{ NULL, NULL, 0 }, /* r */ |
{ NULL, NULL }, /* RE */ |
{ NULL, NULL, 0 }, /* RE */ |
{ pre_RS, post_RS }, /* RS */ |
{ pre_RS, post_RS, 0 }, /* RS */ |
{ pre_ign, NULL }, /* DT */ |
{ pre_ign, NULL, 0 }, /* DT */ |
{ pre_ign, NULL }, /* UC */ |
{ pre_ign, NULL, 0 }, /* UC */ |
{ pre_ign, NULL }, /* PD */ |
{ pre_ign, NULL, 0 }, /* PD */ |
}; |
}; |
|
|
|
|
Line 574 pre_TP(DECL_ARGS) |
|
Line 576 pre_TP(DECL_ARGS) |
|
|
|
/* Calculate offset. */ |
/* Calculate offset. */ |
|
|
if (NULL != (nn = n->parent->head->child)) |
if (NULL != (nn = n->parent->head->child)) { |
if (NULL != nn->next) |
while (nn && MAN_TEXT != nn->type) |
|
nn = nn->next; |
|
if (nn && nn->next) |
if ((ival = a2width(nn)) >= 0) |
if ((ival = a2width(nn)) >= 0) |
len = (size_t)ival; |
len = (size_t)ival; |
|
} |
|
|
switch (n->type) { |
switch (n->type) { |
case (MAN_HEAD): |
case (MAN_HEAD): |
Line 803 print_man_node(DECL_ARGS) |
|
Line 808 print_man_node(DECL_ARGS) |
|
} |
} |
break; |
break; |
default: |
default: |
term_fontrepl(p, TERMFONT_NONE); |
if ( ! (MAN_NOTEXT & termacts[n->tok].flags)) |
|
term_fontrepl(p, TERMFONT_NONE); |
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, m); |
break; |
break; |
Line 815 print_man_node(DECL_ARGS) |
|
Line 821 print_man_node(DECL_ARGS) |
|
if (MAN_TEXT != n->type) { |
if (MAN_TEXT != n->type) { |
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, m); |
term_fontrepl(p, TERMFONT_NONE); |
if ( ! (MAN_NOTEXT & termacts[n->tok].flags)) |
|
term_fontrepl(p, TERMFONT_NONE); |
} |
} |
} |
} |
|
|