version 1.202, 2017/06/04 22:44:15 |
version 1.203, 2017/06/07 17:38:26 |
Line 141 terminal_man(void *arg, const struct roff_man *man) |
|
Line 141 terminal_man(void *arg, const struct roff_man *man) |
|
size_t save_defindent; |
size_t save_defindent; |
|
|
p = (struct termp *)arg; |
p = (struct termp *)arg; |
p->rmargin = p->maxrmargin = p->defrmargin; |
p->tcol->rmargin = p->maxrmargin = p->defrmargin; |
term_tab_set(p, NULL); |
term_tab_set(p, NULL); |
term_tab_set(p, "T"); |
term_tab_set(p, "T"); |
term_tab_set(p, ".5i"); |
term_tab_set(p, ".5i"); |
Line 228 pre_literal(DECL_ARGS) |
|
Line 228 pre_literal(DECL_ARGS) |
|
|
|
term_newln(p); |
term_newln(p); |
|
|
if (MAN_nf == n->tok || MAN_EX == n->tok) |
if (n->tok == MAN_nf || n->tok == MAN_EX) |
mt->fl |= MANT_LITERAL; |
mt->fl |= MANT_LITERAL; |
else |
else |
mt->fl &= ~MANT_LITERAL; |
mt->fl &= ~MANT_LITERAL; |
Line 238 pre_literal(DECL_ARGS) |
|
Line 238 pre_literal(DECL_ARGS) |
|
* So in case a second call to term_flushln() is needed, |
* So in case a second call to term_flushln() is needed, |
* indentation has to be set up explicitly. |
* indentation has to be set up explicitly. |
*/ |
*/ |
if (MAN_HP == n->parent->tok && p->rmargin < p->maxrmargin) { |
if (n->parent->tok == MAN_HP && p->tcol->rmargin < p->maxrmargin) { |
p->offset = p->rmargin; |
p->tcol->offset = p->tcol->rmargin; |
p->rmargin = p->maxrmargin; |
p->tcol->rmargin = p->maxrmargin; |
p->trailspace = 0; |
p->trailspace = 0; |
p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND); |
p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND); |
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
Line 359 pre_in(DECL_ARGS) |
|
Line 359 pre_in(DECL_ARGS) |
|
|
|
term_newln(p); |
term_newln(p); |
|
|
if (NULL == n->child) { |
if (n->child == NULL) { |
p->offset = mt->offset; |
p->tcol->offset = mt->offset; |
return 0; |
return 0; |
} |
} |
|
|
Line 380 pre_in(DECL_ARGS) |
|
Line 380 pre_in(DECL_ARGS) |
|
v = (term_hspan(p, &su) + 11) / 24; |
v = (term_hspan(p, &su) + 11) / 24; |
|
|
if (less < 0) |
if (less < 0) |
p->offset -= p->offset > v ? v : p->offset; |
p->tcol->offset -= p->tcol->offset > v ? v : p->tcol->offset; |
else if (less > 0) |
else if (less > 0) |
p->offset += v; |
p->tcol->offset += v; |
else |
else |
p->offset = v; |
p->tcol->offset = v; |
if (p->offset > SHRT_MAX) |
if (p->tcol->offset > SHRT_MAX) |
p->offset = term_len(p, p->defindent); |
p->tcol->offset = term_len(p, p->defindent); |
|
|
return 0; |
return 0; |
} |
} |
Line 435 pre_HP(DECL_ARGS) |
|
Line 435 pre_HP(DECL_ARGS) |
|
} else |
} else |
len = mt->lmargin[mt->lmargincur]; |
len = mt->lmargin[mt->lmargincur]; |
|
|
p->offset = mt->offset; |
p->tcol->offset = mt->offset; |
p->rmargin = mt->offset + len; |
p->tcol->rmargin = mt->offset + len; |
return 1; |
return 1; |
} |
} |
|
|
Line 460 post_HP(DECL_ARGS) |
|
Line 460 post_HP(DECL_ARGS) |
|
|
|
p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND); |
p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND); |
p->trailspace = 0; |
p->trailspace = 0; |
p->offset = mt->offset; |
p->tcol->offset = mt->offset; |
p->rmargin = p->maxrmargin; |
p->tcol->rmargin = p->maxrmargin; |
break; |
break; |
default: |
default: |
break; |
break; |
Line 478 pre_PP(DECL_ARGS) |
|
Line 478 pre_PP(DECL_ARGS) |
|
print_bvspace(p, n, mt->pardist); |
print_bvspace(p, n, mt->pardist); |
break; |
break; |
default: |
default: |
p->offset = mt->offset; |
p->tcol->offset = mt->offset; |
break; |
break; |
} |
} |
|
|
Line 522 pre_IP(DECL_ARGS) |
|
Line 522 pre_IP(DECL_ARGS) |
|
|
|
switch (n->type) { |
switch (n->type) { |
case ROFFT_HEAD: |
case ROFFT_HEAD: |
p->offset = mt->offset; |
p->tcol->offset = mt->offset; |
p->rmargin = mt->offset + len; |
p->tcol->rmargin = mt->offset + len; |
|
|
savelit = MANT_LITERAL & mt->fl; |
savelit = MANT_LITERAL & mt->fl; |
mt->fl &= ~MANT_LITERAL; |
mt->fl &= ~MANT_LITERAL; |
Line 536 pre_IP(DECL_ARGS) |
|
Line 536 pre_IP(DECL_ARGS) |
|
|
|
return 0; |
return 0; |
case ROFFT_BODY: |
case ROFFT_BODY: |
p->offset = mt->offset + len; |
p->tcol->offset = mt->offset + len; |
p->rmargin = p->maxrmargin; |
p->tcol->rmargin = p->maxrmargin; |
break; |
break; |
default: |
default: |
break; |
break; |
Line 555 post_IP(DECL_ARGS) |
|
Line 555 post_IP(DECL_ARGS) |
|
term_flushln(p); |
term_flushln(p); |
p->flags &= ~TERMP_NOBREAK; |
p->flags &= ~TERMP_NOBREAK; |
p->trailspace = 0; |
p->trailspace = 0; |
p->rmargin = p->maxrmargin; |
p->tcol->rmargin = p->maxrmargin; |
break; |
break; |
case ROFFT_BODY: |
case ROFFT_BODY: |
term_newln(p); |
term_newln(p); |
p->offset = mt->offset; |
p->tcol->offset = mt->offset; |
break; |
break; |
default: |
default: |
break; |
break; |
Line 604 pre_TP(DECL_ARGS) |
|
Line 604 pre_TP(DECL_ARGS) |
|
|
|
switch (n->type) { |
switch (n->type) { |
case ROFFT_HEAD: |
case ROFFT_HEAD: |
p->offset = mt->offset; |
p->tcol->offset = mt->offset; |
p->rmargin = mt->offset + len; |
p->tcol->rmargin = mt->offset + len; |
|
|
savelit = MANT_LITERAL & mt->fl; |
savelit = MANT_LITERAL & mt->fl; |
mt->fl &= ~MANT_LITERAL; |
mt->fl &= ~MANT_LITERAL; |
Line 624 pre_TP(DECL_ARGS) |
|
Line 624 pre_TP(DECL_ARGS) |
|
mt->fl |= MANT_LITERAL; |
mt->fl |= MANT_LITERAL; |
return 0; |
return 0; |
case ROFFT_BODY: |
case ROFFT_BODY: |
p->offset = mt->offset + len; |
p->tcol->offset = mt->offset + len; |
p->rmargin = p->maxrmargin; |
p->tcol->rmargin = p->maxrmargin; |
p->trailspace = 0; |
p->trailspace = 0; |
p->flags &= ~(TERMP_NOBREAK | TERMP_BRTRSP); |
p->flags &= ~(TERMP_NOBREAK | TERMP_BRTRSP); |
break; |
break; |
Line 646 post_TP(DECL_ARGS) |
|
Line 646 post_TP(DECL_ARGS) |
|
break; |
break; |
case ROFFT_BODY: |
case ROFFT_BODY: |
term_newln(p); |
term_newln(p); |
p->offset = mt->offset; |
p->tcol->offset = mt->offset; |
break; |
break; |
default: |
default: |
break; |
break; |
Line 681 pre_SS(DECL_ARGS) |
|
Line 681 pre_SS(DECL_ARGS) |
|
break; |
break; |
case ROFFT_HEAD: |
case ROFFT_HEAD: |
term_fontrepl(p, TERMFONT_BOLD); |
term_fontrepl(p, TERMFONT_BOLD); |
p->offset = term_len(p, 3); |
p->tcol->offset = term_len(p, 3); |
p->rmargin = mt->offset; |
p->tcol->rmargin = mt->offset; |
p->trailspace = mt->offset; |
p->trailspace = mt->offset; |
p->flags |= TERMP_NOBREAK | TERMP_BRIND; |
p->flags |= TERMP_NOBREAK | TERMP_BRIND; |
break; |
break; |
case ROFFT_BODY: |
case ROFFT_BODY: |
p->offset = mt->offset; |
p->tcol->offset = mt->offset; |
p->rmargin = p->maxrmargin; |
p->tcol->rmargin = p->maxrmargin; |
p->trailspace = 0; |
p->trailspace = 0; |
p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND); |
p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND); |
break; |
break; |
Line 743 pre_SH(DECL_ARGS) |
|
Line 743 pre_SH(DECL_ARGS) |
|
break; |
break; |
case ROFFT_HEAD: |
case ROFFT_HEAD: |
term_fontrepl(p, TERMFONT_BOLD); |
term_fontrepl(p, TERMFONT_BOLD); |
p->offset = 0; |
p->tcol->offset = 0; |
p->rmargin = mt->offset; |
p->tcol->rmargin = mt->offset; |
p->trailspace = mt->offset; |
p->trailspace = mt->offset; |
p->flags |= TERMP_NOBREAK | TERMP_BRIND; |
p->flags |= TERMP_NOBREAK | TERMP_BRIND; |
break; |
break; |
case ROFFT_BODY: |
case ROFFT_BODY: |
p->offset = mt->offset; |
p->tcol->offset = mt->offset; |
p->rmargin = p->maxrmargin; |
p->tcol->rmargin = p->maxrmargin; |
p->trailspace = 0; |
p->trailspace = 0; |
p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND); |
p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND); |
break; |
break; |
Line 804 pre_RS(DECL_ARGS) |
|
Line 804 pre_RS(DECL_ARGS) |
|
n->aux = term_len(p, p->defindent); |
n->aux = term_len(p, p->defindent); |
|
|
mt->offset += n->aux; |
mt->offset += n->aux; |
p->offset = mt->offset; |
p->tcol->offset = mt->offset; |
p->rmargin = p->maxrmargin; |
p->tcol->rmargin = p->maxrmargin; |
|
|
if (++mt->lmarginsz < MAXMARGINS) |
if (++mt->lmarginsz < MAXMARGINS) |
mt->lmargincur = mt->lmarginsz; |
mt->lmargincur = mt->lmarginsz; |
Line 829 post_RS(DECL_ARGS) |
|
Line 829 post_RS(DECL_ARGS) |
|
} |
} |
|
|
mt->offset -= n->parent->head->aux; |
mt->offset -= n->parent->head->aux; |
p->offset = mt->offset; |
p->tcol->offset = mt->offset; |
|
|
if (--mt->lmarginsz < MAXMARGINS) |
if (--mt->lmarginsz < MAXMARGINS) |
mt->lmargincur = mt->lmarginsz; |
mt->lmargincur = mt->lmarginsz; |
|
|
else |
else |
term_newln(p); |
term_newln(p); |
p->flags &= ~TERMP_BRNEVER; |
p->flags &= ~TERMP_BRNEVER; |
if (p->rmargin < p->maxrmargin && n->parent->tok == MAN_HP) { |
if (p->tcol->rmargin < p->maxrmargin && |
p->offset = p->rmargin; |
n->parent->tok == MAN_HP) { |
p->rmargin = p->maxrmargin; |
p->tcol->offset = p->tcol->rmargin; |
|
p->tcol->rmargin = p->maxrmargin; |
} |
} |
} |
} |
if (NODE_EOS & n->flags) |
if (NODE_EOS & n->flags) |
Line 994 print_man_foot(struct termp *p, const struct roff_meta |
|
Line 995 print_man_foot(struct termp *p, const struct roff_meta |
|
|
|
p->flags |= TERMP_NOSPACE | TERMP_NOBREAK; |
p->flags |= TERMP_NOSPACE | TERMP_NOBREAK; |
p->trailspace = 1; |
p->trailspace = 1; |
p->offset = 0; |
p->tcol->offset = 0; |
p->rmargin = p->maxrmargin > datelen ? |
p->tcol->rmargin = p->maxrmargin > datelen ? |
(p->maxrmargin + term_len(p, 1) - datelen) / 2 : 0; |
(p->maxrmargin + term_len(p, 1) - datelen) / 2 : 0; |
|
|
if (meta->os) |
if (meta->os) |
Line 1004 print_man_foot(struct termp *p, const struct roff_meta |
|
Line 1005 print_man_foot(struct termp *p, const struct roff_meta |
|
|
|
/* At the bottom in the middle: manual date. */ |
/* At the bottom in the middle: manual date. */ |
|
|
p->offset = p->rmargin; |
p->tcol->offset = p->tcol->rmargin; |
titlen = term_strlen(p, title); |
titlen = term_strlen(p, title); |
p->rmargin = p->maxrmargin > titlen ? p->maxrmargin - titlen : 0; |
p->tcol->rmargin = p->maxrmargin > titlen ? |
|
p->maxrmargin - titlen : 0; |
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
|
|
term_word(p, meta->date); |
term_word(p, meta->date); |
Line 1017 print_man_foot(struct termp *p, const struct roff_meta |
|
Line 1019 print_man_foot(struct termp *p, const struct roff_meta |
|
p->flags &= ~TERMP_NOBREAK; |
p->flags &= ~TERMP_NOBREAK; |
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
p->trailspace = 0; |
p->trailspace = 0; |
p->offset = p->rmargin; |
p->tcol->offset = p->tcol->rmargin; |
p->rmargin = p->maxrmargin; |
p->tcol->rmargin = p->maxrmargin; |
|
|
term_word(p, title); |
term_word(p, title); |
term_flushln(p); |
term_flushln(p); |
Line 1045 print_man_head(struct termp *p, const struct roff_meta |
|
Line 1047 print_man_head(struct termp *p, const struct roff_meta |
|
|
|
p->flags |= TERMP_NOBREAK | TERMP_NOSPACE; |
p->flags |= TERMP_NOBREAK | TERMP_NOSPACE; |
p->trailspace = 1; |
p->trailspace = 1; |
p->offset = 0; |
p->tcol->offset = 0; |
p->rmargin = 2 * (titlen+1) + vollen < p->maxrmargin ? |
p->tcol->rmargin = 2 * (titlen+1) + vollen < p->maxrmargin ? |
(p->maxrmargin - vollen + term_len(p, 1)) / 2 : |
(p->maxrmargin - vollen + term_len(p, 1)) / 2 : |
vollen < p->maxrmargin ? p->maxrmargin - vollen : 0; |
vollen < p->maxrmargin ? p->maxrmargin - vollen : 0; |
|
|
Line 1056 print_man_head(struct termp *p, const struct roff_meta |
|
Line 1058 print_man_head(struct termp *p, const struct roff_meta |
|
/* At the top in the middle: manual volume. */ |
/* At the top in the middle: manual volume. */ |
|
|
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
p->offset = p->rmargin; |
p->tcol->offset = p->tcol->rmargin; |
p->rmargin = p->offset + vollen + titlen < p->maxrmargin ? |
p->tcol->rmargin = p->tcol->offset + vollen + titlen < |
p->maxrmargin - titlen : p->maxrmargin; |
p->maxrmargin ? p->maxrmargin - titlen : p->maxrmargin; |
|
|
term_word(p, volume); |
term_word(p, volume); |
term_flushln(p); |
term_flushln(p); |
Line 1067 print_man_head(struct termp *p, const struct roff_meta |
|
Line 1069 print_man_head(struct termp *p, const struct roff_meta |
|
|
|
p->flags &= ~TERMP_NOBREAK; |
p->flags &= ~TERMP_NOBREAK; |
p->trailspace = 0; |
p->trailspace = 0; |
if (p->rmargin + titlen <= p->maxrmargin) { |
if (p->tcol->rmargin + titlen <= p->maxrmargin) { |
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
p->offset = p->rmargin; |
p->tcol->offset = p->tcol->rmargin; |
p->rmargin = p->maxrmargin; |
p->tcol->rmargin = p->maxrmargin; |
term_word(p, title); |
term_word(p, title); |
term_flushln(p); |
term_flushln(p); |
} |
} |
|
|
p->flags &= ~TERMP_NOSPACE; |
p->flags &= ~TERMP_NOSPACE; |
p->offset = 0; |
p->tcol->offset = 0; |
p->rmargin = p->maxrmargin; |
p->tcol->rmargin = p->maxrmargin; |
|
|
/* |
/* |
* Groff prints three blank lines before the content. |
* Groff prints three blank lines before the content. |