version 1.131, 2018/12/30 00:49:55 |
version 1.135, 2020/02/20 22:55:42 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2011-2018 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2011-2020 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 104 static int pre_lk(DECL_ARGS); |
|
Line 104 static int pre_lk(DECL_ARGS); |
|
static int pre_li(DECL_ARGS); |
static int pre_li(DECL_ARGS); |
static int pre_nm(DECL_ARGS); |
static int pre_nm(DECL_ARGS); |
static int pre_no(DECL_ARGS); |
static int pre_no(DECL_ARGS); |
|
static void pre_noarg(DECL_ARGS); |
static int pre_ns(DECL_ARGS); |
static int pre_ns(DECL_ARGS); |
static void pre_onearg(DECL_ARGS); |
static void pre_onearg(DECL_ARGS); |
static int pre_pp(DECL_ARGS); |
static int pre_pp(DECL_ARGS); |
Line 128 static void print_node(DECL_ARGS); |
|
Line 129 static void print_node(DECL_ARGS); |
|
static const void_fp roff_man_acts[ROFF_MAX] = { |
static const void_fp roff_man_acts[ROFF_MAX] = { |
pre_br, /* br */ |
pre_br, /* br */ |
pre_onearg, /* ce */ |
pre_onearg, /* ce */ |
|
pre_noarg, /* fi */ |
pre_ft, /* ft */ |
pre_ft, /* ft */ |
pre_onearg, /* ll */ |
pre_onearg, /* ll */ |
pre_onearg, /* mc */ |
pre_onearg, /* mc */ |
|
pre_noarg, /* nf */ |
pre_onearg, /* po */ |
pre_onearg, /* po */ |
pre_onearg, /* rj */ |
pre_onearg, /* rj */ |
pre_sp, /* sp */ |
pre_sp, /* sp */ |
Line 259 static const struct mdoc_man_act mdoc_man_acts[MDOC_MA |
|
Line 262 static const struct mdoc_man_act mdoc_man_acts[MDOC_MA |
|
{ NULL, NULL, post_percent, NULL, NULL }, /* %Q */ |
{ NULL, NULL, post_percent, NULL, NULL }, /* %Q */ |
{ NULL, NULL, post_percent, NULL, NULL }, /* %U */ |
{ NULL, NULL, post_percent, NULL, NULL }, /* %U */ |
{ NULL, NULL, NULL, NULL, NULL }, /* Ta */ |
{ NULL, NULL, NULL, NULL, NULL }, /* Ta */ |
|
{ NULL, pre_skip, NULL, NULL, NULL }, /* Tg */ |
}; |
}; |
static const struct mdoc_man_act *mdoc_man_act(enum roff_tok); |
static const struct mdoc_man_act *mdoc_man_act(enum roff_tok); |
|
|
Line 579 print_width(const struct mdoc_bl *bl, const struct rof |
|
Line 583 print_width(const struct mdoc_bl *bl, const struct rof |
|
|
|
/* Set up the current list. */ |
/* Set up the current list. */ |
if (chsz > sz && bl->type != LIST_tag) |
if (chsz > sz && bl->type != LIST_tag) |
print_block(".HP", 0); |
print_block(".HP", MMAN_spc); |
else { |
else { |
print_block(".TP", 0); |
print_block(".TP", MMAN_spc); |
remain = sz + 2; |
remain = sz + 2; |
} |
} |
if (numeric) { |
if (numeric) { |
Line 936 post_aq(DECL_ARGS) |
|
Line 940 post_aq(DECL_ARGS) |
|
static int |
static int |
pre_bd(DECL_ARGS) |
pre_bd(DECL_ARGS) |
{ |
{ |
|
|
outflags &= ~(MMAN_PP | MMAN_sp | MMAN_br); |
outflags &= ~(MMAN_PP | MMAN_sp | MMAN_br); |
|
|
if (DISP_unfilled == n->norm->Bd.type || |
if (DISP_unfilled == n->norm->Bd.type || |
Line 951 pre_bd(DECL_ARGS) |
|
Line 954 pre_bd(DECL_ARGS) |
|
static void |
static void |
post_bd(DECL_ARGS) |
post_bd(DECL_ARGS) |
{ |
{ |
|
enum roff_tok bef, now; |
|
|
/* Close out this display. */ |
/* Close out this display. */ |
print_line(".RE", MMAN_nl); |
print_line(".RE", MMAN_nl); |
if (DISP_unfilled == n->norm->Bd.type || |
bef = n->flags & NODE_NOFILL ? ROFF_nf : ROFF_fi; |
DISP_literal == n->norm->Bd.type) |
if (n->last == NULL) |
print_line(".fi", MMAN_nl); |
now = n->norm->Bd.type == DISP_unfilled || |
|
n->norm->Bd.type == DISP_literal ? ROFF_nf : ROFF_fi; |
|
else if (n->last->tok == ROFF_nf) |
|
now = ROFF_nf; |
|
else if (n->last->tok == ROFF_fi) |
|
now = ROFF_fi; |
|
else |
|
now = n->last->flags & NODE_NOFILL ? ROFF_nf : ROFF_fi; |
|
if (bef != now) { |
|
outflags |= MMAN_nl; |
|
print_word("."); |
|
outflags &= ~MMAN_spc; |
|
print_word(roff_name[bef]); |
|
outflags |= MMAN_nl; |
|
} |
|
|
/* Maybe we are inside an enclosing list? */ |
/* Maybe we are inside an enclosing list? */ |
if (NULL != n->parent->next) |
if (NULL != n->parent->next) |
Line 1607 pre_onearg(DECL_ARGS) |
|
Line 1625 pre_onearg(DECL_ARGS) |
|
static int |
static int |
pre_li(DECL_ARGS) |
pre_li(DECL_ARGS) |
{ |
{ |
|
|
font_push('R'); |
font_push('R'); |
return 1; |
return 1; |
} |
} |
Line 1640 pre_nm(DECL_ARGS) |
|
Line 1657 pre_nm(DECL_ARGS) |
|
static void |
static void |
post_nm(DECL_ARGS) |
post_nm(DECL_ARGS) |
{ |
{ |
|
|
switch (n->type) { |
switch (n->type) { |
case ROFFT_BLOCK: |
case ROFFT_BLOCK: |
outflags &= ~MMAN_Bk; |
outflags &= ~MMAN_Bk; |
Line 1658 post_nm(DECL_ARGS) |
|
Line 1674 post_nm(DECL_ARGS) |
|
static int |
static int |
pre_no(DECL_ARGS) |
pre_no(DECL_ARGS) |
{ |
{ |
|
|
outflags |= MMAN_spc_force; |
outflags |= MMAN_spc_force; |
return 1; |
return 1; |
} |
} |
|
|
|
static void |
|
pre_noarg(DECL_ARGS) |
|
{ |
|
outflags |= MMAN_nl; |
|
print_word("."); |
|
outflags &= ~MMAN_spc; |
|
print_word(roff_name[n->tok]); |
|
outflags |= MMAN_nl; |
|
} |
|
|
static int |
static int |
pre_ns(DECL_ARGS) |
pre_ns(DECL_ARGS) |
{ |
{ |
|
|
outflags &= ~MMAN_spc; |
outflags &= ~MMAN_spc; |
return 0; |
return 0; |
} |
} |