version 1.139, 2013/12/22 23:34:13 |
version 1.145, 2014/04/08 07:13:11 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2010, 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
* purpose with or without fee is hereby granted, provided that the above |
* purpose with or without fee is hereby granted, provided that the above |
Line 84 static int pre_ft(DECL_ARGS); |
|
Line 84 static int pre_ft(DECL_ARGS); |
|
static int pre_ign(DECL_ARGS); |
static int pre_ign(DECL_ARGS); |
static int pre_in(DECL_ARGS); |
static int pre_in(DECL_ARGS); |
static int pre_literal(DECL_ARGS); |
static int pre_literal(DECL_ARGS); |
|
static int pre_ll(DECL_ARGS); |
static int pre_sp(DECL_ARGS); |
static int pre_sp(DECL_ARGS); |
|
|
static void post_IP(DECL_ARGS); |
static void post_IP(DECL_ARGS); |
Line 133 static const struct termact termacts[MAN_MAX] = { |
|
Line 134 static const struct termact termacts[MAN_MAX] = { |
|
{ pre_literal, NULL, 0 }, /* EE */ |
{ pre_literal, NULL, 0 }, /* EE */ |
{ pre_UR, post_UR, 0 }, /* UR */ |
{ pre_UR, post_UR, 0 }, /* UR */ |
{ NULL, NULL, 0 }, /* UE */ |
{ NULL, NULL, 0 }, /* UE */ |
|
{ pre_ll, NULL, MAN_NOTEXT }, /* ll */ |
}; |
}; |
|
|
|
|
Line 237 pre_ign(DECL_ARGS) |
|
Line 239 pre_ign(DECL_ARGS) |
|
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
static int |
static int |
|
pre_ll(DECL_ARGS) |
|
{ |
|
|
|
term_setwidth(p, n->nchild ? n->child->string : NULL); |
|
return(0); |
|
} |
|
|
|
|
|
/* ARGSUSED */ |
|
static int |
pre_I(DECL_ARGS) |
pre_I(DECL_ARGS) |
{ |
{ |
|
|
Line 266 pre_literal(DECL_ARGS) |
|
Line 278 pre_literal(DECL_ARGS) |
|
p->offset = p->rmargin; |
p->offset = p->rmargin; |
p->rmargin = p->maxrmargin; |
p->rmargin = p->maxrmargin; |
p->trailspace = 0; |
p->trailspace = 0; |
p->flags &= ~TERMP_NOBREAK; |
p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND); |
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
} |
} |
|
|
Line 535 pre_HP(DECL_ARGS) |
|
Line 547 pre_HP(DECL_ARGS) |
|
} |
} |
|
|
if ( ! (MANT_LITERAL & mt->fl)) { |
if ( ! (MANT_LITERAL & mt->fl)) { |
p->flags |= TERMP_NOBREAK; |
p->flags |= TERMP_NOBREAK | TERMP_BRIND; |
p->trailspace = 2; |
p->trailspace = 2; |
} |
} |
|
|
Line 570 post_HP(DECL_ARGS) |
|
Line 582 post_HP(DECL_ARGS) |
|
switch (n->type) { |
switch (n->type) { |
case (MAN_BODY): |
case (MAN_BODY): |
term_newln(p); |
term_newln(p); |
p->flags &= ~TERMP_NOBREAK; |
p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND); |
p->trailspace = 0; |
p->trailspace = 0; |
p->offset = mt->offset; |
p->offset = mt->offset; |
p->rmargin = p->maxrmargin; |
p->rmargin = p->maxrmargin; |
Line 658 pre_IP(DECL_ARGS) |
|
Line 670 pre_IP(DECL_ARGS) |
|
return(0); |
return(0); |
case (MAN_BODY): |
case (MAN_BODY): |
p->offset = mt->offset + len; |
p->offset = mt->offset + len; |
p->rmargin = p->maxrmargin; |
p->rmargin = p->maxrmargin > p->offset ? |
|
p->maxrmargin : p->offset; |
break; |
break; |
default: |
default: |
break; |
break; |
Line 719 pre_TP(DECL_ARGS) |
|
Line 732 pre_TP(DECL_ARGS) |
|
/* Calculate offset. */ |
/* Calculate offset. */ |
|
|
if (NULL != (nn = n->parent->head->child)) |
if (NULL != (nn = n->parent->head->child)) |
if (nn->string && nn->parent->line == nn->line) |
if (nn->string && 0 == (MAN_LINE & nn->flags)) |
if ((ival = a2width(p, nn->string)) >= 0) |
if ((ival = a2width(p, nn->string)) >= 0) |
len = (size_t)ival; |
len = (size_t)ival; |
|
|
Line 736 pre_TP(DECL_ARGS) |
|
Line 749 pre_TP(DECL_ARGS) |
|
mt->fl &= ~MANT_LITERAL; |
mt->fl &= ~MANT_LITERAL; |
|
|
/* Don't print same-line elements. */ |
/* Don't print same-line elements. */ |
for (nn = n->child; nn; nn = nn->next) |
nn = n->child; |
if (nn->line > n->line) |
while (NULL != nn && 0 == (MAN_LINE & nn->flags)) |
print_man_node(p, mt, nn, meta); |
nn = nn->next; |
|
|
|
while (NULL != nn) { |
|
print_man_node(p, mt, nn, meta); |
|
nn = nn->next; |
|
} |
|
|
if (savelit) |
if (savelit) |
mt->fl |= MANT_LITERAL; |
mt->fl |= MANT_LITERAL; |
if (ival >= 0) |
if (ival >= 0) |
Line 748 pre_TP(DECL_ARGS) |
|
Line 766 pre_TP(DECL_ARGS) |
|
return(0); |
return(0); |
case (MAN_BODY): |
case (MAN_BODY): |
p->offset = mt->offset + len; |
p->offset = mt->offset + len; |
p->rmargin = p->maxrmargin; |
p->rmargin = p->maxrmargin > p->offset ? |
|
p->maxrmargin : p->offset; |
p->trailspace = 0; |
p->trailspace = 0; |
p->flags &= ~TERMP_NOBREAK; |
p->flags &= ~TERMP_NOBREAK; |
break; |
break; |
Line 909 pre_RS(DECL_ARGS) |
|
Line 928 pre_RS(DECL_ARGS) |
|
sz = (size_t)ival; |
sz = (size_t)ival; |
|
|
mt->offset += sz; |
mt->offset += sz; |
p->rmargin = p->maxrmargin; |
p->offset = mt->offset; |
p->offset = mt->offset < p->rmargin ? mt->offset : p->rmargin; |
p->rmargin = p->maxrmargin > p->offset ? |
|
p->maxrmargin : p->offset; |
|
|
if (++mt->lmarginsz < MAXMARGINS) |
if (++mt->lmarginsz < MAXMARGINS) |
mt->lmargincur = mt->lmarginsz; |
mt->lmargincur = mt->lmarginsz; |
|
|
* more specific than this. |
* more specific than this. |
*/ |
*/ |
if (MANT_LITERAL & mt->fl && ! (TERMP_NOBREAK & p->flags) && |
if (MANT_LITERAL & mt->fl && ! (TERMP_NOBREAK & p->flags) && |
(NULL == n->next || n->next->line > n->line)) { |
(NULL == n->next || MAN_LINE & n->next->flags)) { |
rm = p->rmargin; |
rm = p->rmargin; |
rmax = p->maxrmargin; |
rmax = p->maxrmargin; |
p->rmargin = p->maxrmargin = TERM_MAXMARGIN; |
p->rmargin = p->maxrmargin = TERM_MAXMARGIN; |