version 1.212, 2018/08/14 01:27:48 |
version 1.214, 2018/08/17 20:33:37 |
|
|
struct roff_node *n, \ |
struct roff_node *n, \ |
const struct roff_meta *meta |
const struct roff_meta *meta |
|
|
struct termact { |
struct man_term_act { |
int (*pre)(DECL_ARGS); |
int (*pre)(DECL_ARGS); |
void (*post)(DECL_ARGS); |
void (*post)(DECL_ARGS); |
int flags; |
int flags; |
Line 93 static void post_SS(DECL_ARGS); |
|
Line 93 static void post_SS(DECL_ARGS); |
|
static void post_TP(DECL_ARGS); |
static void post_TP(DECL_ARGS); |
static void post_UR(DECL_ARGS); |
static void post_UR(DECL_ARGS); |
|
|
static const struct termact __termacts[MAN_MAX - MAN_TH] = { |
static const struct man_term_act man_term_acts[MAN_MAX - MAN_TH] = { |
{ NULL, NULL, 0 }, /* TH */ |
{ NULL, NULL, 0 }, /* TH */ |
{ pre_SH, post_SH, 0 }, /* SH */ |
{ pre_SH, post_SH, 0 }, /* SH */ |
{ pre_SS, post_SS, 0 }, /* SS */ |
{ pre_SS, post_SS, 0 }, /* SS */ |
{ pre_TP, post_TP, 0 }, /* TP */ |
{ pre_TP, post_TP, 0 }, /* TP */ |
|
{ pre_TP, post_TP, 0 }, /* TQ */ |
{ pre_PP, NULL, 0 }, /* LP */ |
{ pre_PP, NULL, 0 }, /* LP */ |
{ pre_PP, NULL, 0 }, /* PP */ |
{ pre_PP, NULL, 0 }, /* PP */ |
{ pre_PP, NULL, 0 }, /* P */ |
{ pre_PP, NULL, 0 }, /* P */ |
Line 131 static const struct termact __termacts[MAN_MAX - MAN_T |
|
Line 132 static const struct termact __termacts[MAN_MAX - MAN_T |
|
{ pre_UR, post_UR, 0 }, /* MT */ |
{ pre_UR, post_UR, 0 }, /* MT */ |
{ NULL, NULL, 0 }, /* ME */ |
{ NULL, NULL, 0 }, /* ME */ |
}; |
}; |
static const struct termact *termacts = __termacts - MAN_TH; |
static const struct man_term_act *man_term_act(enum roff_tok); |
|
|
|
|
|
static const struct man_term_act * |
|
man_term_act(enum roff_tok tok) |
|
{ |
|
assert(tok >= MAN_TH && tok <= MAN_MAX); |
|
return man_term_acts + (tok - MAN_TH); |
|
} |
|
|
void |
void |
terminal_man(void *arg, const struct roff_man *man) |
terminal_man(void *arg, const struct roff_man *man) |
{ |
{ |
Line 584 pre_TP(DECL_ARGS) |
|
Line 592 pre_TP(DECL_ARGS) |
|
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
break; |
break; |
case ROFFT_BLOCK: |
case ROFFT_BLOCK: |
print_bvspace(p, n, mt->pardist); |
if (n->tok == MAN_TP) |
|
print_bvspace(p, n, mt->pardist); |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
default: |
default: |
return 1; |
return 1; |
Line 674 pre_SS(DECL_ARGS) |
|
Line 683 pre_SS(DECL_ARGS) |
|
do { |
do { |
n = n->prev; |
n = n->prev; |
} while (n != NULL && n->tok >= MAN_TH && |
} while (n != NULL && n->tok >= MAN_TH && |
termacts[n->tok].flags & MAN_NOTEXT); |
man_term_act(n->tok)->flags & MAN_NOTEXT); |
if (n == NULL || n->type == ROFFT_COMMENT || |
if (n == NULL || n->type == ROFFT_COMMENT || |
(n->tok == MAN_SS && n->body->child == NULL)) |
(n->tok == MAN_SS && n->body->child == NULL)) |
break; |
break; |
Line 737 pre_SH(DECL_ARGS) |
|
Line 746 pre_SH(DECL_ARGS) |
|
do { |
do { |
n = n->prev; |
n = n->prev; |
} while (n != NULL && n->tok >= MAN_TH && |
} while (n != NULL && n->tok >= MAN_TH && |
termacts[n->tok].flags & MAN_NOTEXT); |
man_term_act(n->tok)->flags & MAN_NOTEXT); |
if (n == NULL || n->type == ROFFT_COMMENT || |
if (n == NULL || n->type == ROFFT_COMMENT || |
(n->tok == MAN_SH && n->body->child == NULL)) |
(n->tok == MAN_SH && n->body->child == NULL)) |
break; |
break; |
Line 866 post_UR(DECL_ARGS) |
|
Line 875 post_UR(DECL_ARGS) |
|
static void |
static void |
print_man_node(DECL_ARGS) |
print_man_node(DECL_ARGS) |
{ |
{ |
int c; |
const struct man_term_act *act; |
|
int c; |
|
|
switch (n->type) { |
switch (n->type) { |
case ROFFT_TEXT: |
case ROFFT_TEXT: |
Line 912 print_man_node(DECL_ARGS) |
|
Line 922 print_man_node(DECL_ARGS) |
|
return; |
return; |
} |
} |
|
|
assert(n->tok >= MAN_TH && n->tok <= MAN_MAX); |
act = man_term_act(n->tok); |
if ( ! (MAN_NOTEXT & termacts[n->tok].flags)) |
if ((act->flags & MAN_NOTEXT) == 0) |
term_fontrepl(p, TERMFONT_NONE); |
term_fontrepl(p, TERMFONT_NONE); |
|
|
c = 1; |
c = 1; |
if (termacts[n->tok].pre) |
if (act->pre != NULL) |
c = (*termacts[n->tok].pre)(p, mt, n, meta); |
c = (*act->pre)(p, mt, n, meta); |
|
|
if (c && n->child) |
if (c && n->child) |
print_man_nodelist(p, mt, n->child, meta); |
print_man_nodelist(p, mt, n->child, meta); |
|
|
if (termacts[n->tok].post) |
if (act->post != NULL) |
(*termacts[n->tok].post)(p, mt, n, meta); |
(*act->post)(p, mt, n, meta); |
if ( ! (MAN_NOTEXT & termacts[n->tok].flags)) |
if ((act->flags & MAN_NOTEXT) == 0) |
term_fontrepl(p, TERMFONT_NONE); |
term_fontrepl(p, TERMFONT_NONE); |
|
|
out: |
out: |