version 1.214, 2018/08/17 20:33:37 |
version 1.222, 2018/12/13 11:55:46 |
|
|
#include <string.h> |
#include <string.h> |
|
|
#include "mandoc_aux.h" |
#include "mandoc_aux.h" |
#include "mandoc.h" |
|
#include "roff.h" |
#include "roff.h" |
#include "man.h" |
#include "man.h" |
#include "out.h" |
#include "out.h" |
Line 78 static int pre_PP(DECL_ARGS); |
|
Line 77 static int pre_PP(DECL_ARGS); |
|
static int pre_RS(DECL_ARGS); |
static int pre_RS(DECL_ARGS); |
static int pre_SH(DECL_ARGS); |
static int pre_SH(DECL_ARGS); |
static int pre_SS(DECL_ARGS); |
static int pre_SS(DECL_ARGS); |
|
static int pre_SY(DECL_ARGS); |
static int pre_TP(DECL_ARGS); |
static int pre_TP(DECL_ARGS); |
static int pre_UR(DECL_ARGS); |
static int pre_UR(DECL_ARGS); |
|
static int pre_abort(DECL_ARGS); |
static int pre_alternate(DECL_ARGS); |
static int pre_alternate(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); |
Line 90 static void post_HP(DECL_ARGS); |
|
Line 91 static void post_HP(DECL_ARGS); |
|
static void post_RS(DECL_ARGS); |
static void post_RS(DECL_ARGS); |
static void post_SH(DECL_ARGS); |
static void post_SH(DECL_ARGS); |
static void post_SS(DECL_ARGS); |
static void post_SS(DECL_ARGS); |
|
static void post_SY(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); |
|
|
Line 99 static const struct man_term_act man_term_acts[MAN_MAX |
|
Line 101 static const struct man_term_act man_term_acts[MAN_MAX |
|
{ 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_TP, post_TP, 0 }, /* TQ */ |
{ pre_PP, NULL, 0 }, /* LP */ |
{ pre_abort, NULL, 0 }, /* LP */ |
{ pre_PP, NULL, 0 }, /* PP */ |
{ pre_PP, NULL, 0 }, /* PP */ |
{ pre_PP, NULL, 0 }, /* P */ |
{ pre_abort, NULL, 0 }, /* P */ |
{ pre_IP, post_IP, 0 }, /* IP */ |
{ pre_IP, post_IP, 0 }, /* IP */ |
{ pre_HP, post_HP, 0 }, /* HP */ |
{ pre_HP, post_HP, 0 }, /* HP */ |
{ NULL, NULL, 0 }, /* SM */ |
{ NULL, NULL, 0 }, /* SM */ |
Line 115 static const struct man_term_act man_term_acts[MAN_MAX |
|
Line 117 static const struct man_term_act man_term_acts[MAN_MAX |
|
{ pre_I, NULL, 0 }, /* I */ |
{ pre_I, NULL, 0 }, /* I */ |
{ pre_alternate, NULL, 0 }, /* IR */ |
{ pre_alternate, NULL, 0 }, /* IR */ |
{ pre_alternate, NULL, 0 }, /* RI */ |
{ pre_alternate, NULL, 0 }, /* RI */ |
{ pre_literal, NULL, 0 }, /* nf */ |
{ pre_literal, NULL, MAN_NOTEXT }, /* nf */ |
{ pre_literal, NULL, 0 }, /* fi */ |
{ pre_literal, NULL, MAN_NOTEXT }, /* fi */ |
{ NULL, NULL, 0 }, /* RE */ |
{ NULL, NULL, 0 }, /* RE */ |
{ pre_RS, post_RS, 0 }, /* RS */ |
{ pre_RS, post_RS, 0 }, /* RS */ |
{ pre_DT, NULL, 0 }, /* DT */ |
{ pre_DT, NULL, 0 }, /* DT */ |
Line 124 static const struct man_term_act man_term_acts[MAN_MAX |
|
Line 126 static const struct man_term_act man_term_acts[MAN_MAX |
|
{ pre_PD, NULL, MAN_NOTEXT }, /* PD */ |
{ pre_PD, NULL, MAN_NOTEXT }, /* PD */ |
{ pre_ign, NULL, 0 }, /* AT */ |
{ pre_ign, NULL, 0 }, /* AT */ |
{ pre_in, NULL, MAN_NOTEXT }, /* in */ |
{ pre_in, NULL, MAN_NOTEXT }, /* in */ |
|
{ pre_SY, post_SY, 0 }, /* SY */ |
|
{ NULL, NULL, 0 }, /* YS */ |
{ pre_OP, NULL, 0 }, /* OP */ |
{ pre_OP, NULL, 0 }, /* OP */ |
{ pre_literal, NULL, 0 }, /* EX */ |
{ pre_literal, NULL, 0 }, /* EX */ |
{ pre_literal, NULL, 0 }, /* EE */ |
{ pre_literal, NULL, 0 }, /* EE */ |
Line 218 print_bvspace(struct termp *p, const struct roff_node |
|
Line 222 print_bvspace(struct termp *p, const struct roff_node |
|
|
|
|
|
static int |
static int |
|
pre_abort(DECL_ARGS) |
|
{ |
|
abort(); |
|
} |
|
|
|
static int |
pre_ign(DECL_ARGS) |
pre_ign(DECL_ARGS) |
{ |
{ |
|
|
Line 342 pre_OP(DECL_ARGS) |
|
Line 352 pre_OP(DECL_ARGS) |
|
{ |
{ |
|
|
term_word(p, "["); |
term_word(p, "["); |
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_KEEP | TERMP_NOSPACE; |
|
|
if (NULL != (n = n->child)) { |
if (NULL != (n = n->child)) { |
term_fontrepl(p, TERMFONT_BOLD); |
term_fontrepl(p, TERMFONT_BOLD); |
Line 354 pre_OP(DECL_ARGS) |
|
Line 364 pre_OP(DECL_ARGS) |
|
} |
} |
|
|
term_fontrepl(p, TERMFONT_NONE); |
term_fontrepl(p, TERMFONT_NONE); |
|
p->flags &= ~TERMP_KEEP; |
p->flags |= TERMP_NOSPACE; |
p->flags |= TERMP_NOSPACE; |
term_word(p, "]"); |
term_word(p, "]"); |
return 0; |
return 0; |
Line 849 post_RS(DECL_ARGS) |
|
Line 860 post_RS(DECL_ARGS) |
|
} |
} |
|
|
static int |
static int |
|
pre_SY(DECL_ARGS) |
|
{ |
|
const struct roff_node *nn; |
|
int len; |
|
|
|
switch (n->type) { |
|
case ROFFT_BLOCK: |
|
if (n->prev == NULL || n->prev->tok != MAN_SY) |
|
print_bvspace(p, n, mt->pardist); |
|
return 1; |
|
case ROFFT_HEAD: |
|
case ROFFT_BODY: |
|
break; |
|
default: |
|
abort(); |
|
} |
|
|
|
nn = n->parent->head->child; |
|
len = nn == NULL ? 1 : term_strlen(p, nn->string) + 1; |
|
|
|
switch (n->type) { |
|
case ROFFT_HEAD: |
|
p->tcol->offset = mt->offset; |
|
p->tcol->rmargin = mt->offset + len; |
|
p->flags |= TERMP_NOBREAK; |
|
term_fontrepl(p, TERMFONT_BOLD); |
|
break; |
|
case ROFFT_BODY: |
|
mt->lmargin[mt->lmargincur] = len; |
|
p->tcol->offset = mt->offset + len; |
|
p->tcol->rmargin = p->maxrmargin; |
|
p->flags |= TERMP_NOSPACE; |
|
break; |
|
default: |
|
abort(); |
|
} |
|
return 1; |
|
} |
|
|
|
static void |
|
post_SY(DECL_ARGS) |
|
{ |
|
switch (n->type) { |
|
case ROFFT_HEAD: |
|
term_flushln(p); |
|
p->flags &= ~TERMP_NOBREAK; |
|
break; |
|
case ROFFT_BODY: |
|
term_newln(p); |
|
p->tcol->offset = mt->offset; |
|
break; |
|
default: |
|
break; |
|
} |
|
} |
|
|
|
static int |
pre_UR(DECL_ARGS) |
pre_UR(DECL_ARGS) |
{ |
{ |
|
|
Line 923 print_man_node(DECL_ARGS) |
|
Line 991 print_man_node(DECL_ARGS) |
|
} |
} |
|
|
act = man_term_act(n->tok); |
act = man_term_act(n->tok); |
if ((act->flags & MAN_NOTEXT) == 0) |
if ((act->flags & MAN_NOTEXT) == 0 && n->tok != MAN_SM) |
term_fontrepl(p, TERMFONT_NONE); |
term_fontrepl(p, TERMFONT_NONE); |
|
|
c = 1; |
c = 1; |
Line 935 print_man_node(DECL_ARGS) |
|
Line 1003 print_man_node(DECL_ARGS) |
|
|
|
if (act->post != NULL) |
if (act->post != NULL) |
(*act->post)(p, mt, n, meta); |
(*act->post)(p, mt, n, meta); |
if ((act->flags & MAN_NOTEXT) == 0) |
if ((act->flags & MAN_NOTEXT) == 0 && n->tok != MAN_SM) |
term_fontrepl(p, TERMFONT_NONE); |
term_fontrepl(p, TERMFONT_NONE); |
|
|
out: |
out: |