diff options
-rw-r--r-- | man_html.c | 1 | ||||
-rw-r--r-- | man_macro.c | 1 | ||||
-rw-r--r-- | man_term.c | 10 | ||||
-rw-r--r-- | man_validate.c | 1 | ||||
-rw-r--r-- | mandocdb.c | 1 | ||||
-rw-r--r-- | mdoc_argv.c | 1 | ||||
-rw-r--r-- | mdoc_html.c | 1 | ||||
-rw-r--r-- | mdoc_macro.c | 3 | ||||
-rw-r--r-- | mdoc_man.c | 48 | ||||
-rw-r--r-- | mdoc_markdown.c | 6 | ||||
-rw-r--r-- | mdoc_state.c | 1 | ||||
-rw-r--r-- | mdoc_term.c | 23 | ||||
-rw-r--r-- | mdoc_validate.c | 1 | ||||
-rw-r--r-- | roff.c | 7 | ||||
-rw-r--r-- | roff.h | 4 | ||||
-rw-r--r-- | roff_term.c | 11 | ||||
-rw-r--r-- | roff_validate.c | 1 |
17 files changed, 45 insertions, 76 deletions
@@ -107,7 +107,6 @@ static const struct htmlman __mans[MAN_MAX - MAN_TH] = { { NULL, NULL }, /* EE */ { man_UR_pre, NULL }, /* UR */ { NULL, NULL }, /* UE */ - { man_ign_pre, NULL }, /* ll */ }; static const struct htmlman *const mans = __mans - MAN_TH; diff --git a/man_macro.c b/man_macro.c index 1ad1e490..a857957b 100644 --- a/man_macro.c +++ b/man_macro.c @@ -76,7 +76,6 @@ const struct man_macro __man_macros[MAN_MAX - MAN_TH] = { { in_line_eoln, MAN_BSCOPE }, /* EE */ { blk_exp, MAN_BSCOPE }, /* UR */ { blk_close, MAN_BSCOPE }, /* UE */ - { in_line_eoln, 0 }, /* ll */ }; const struct man_macro *const man_macros = __man_macros - MAN_TH; @@ -83,7 +83,6 @@ static int pre_alternate(DECL_ARGS); static int pre_ign(DECL_ARGS); static int pre_in(DECL_ARGS); static int pre_literal(DECL_ARGS); -static int pre_ll(DECL_ARGS); static int pre_sp(DECL_ARGS); static void post_IP(DECL_ARGS); @@ -130,7 +129,6 @@ static const struct termact __termacts[MAN_MAX - MAN_TH] = { { pre_literal, NULL, 0 }, /* EE */ { pre_UR, post_UR, 0 }, /* UR */ { NULL, NULL, 0 }, /* UE */ - { pre_ll, NULL, MAN_NOTEXT }, /* ll */ }; static const struct termact *termacts = __termacts - MAN_TH; @@ -217,14 +215,6 @@ pre_ign(DECL_ARGS) } static int -pre_ll(DECL_ARGS) -{ - - term_setwidth(p, n->child != NULL ? n->child->string : NULL); - return 0; -} - -static int pre_I(DECL_ARGS) { diff --git a/man_validate.c b/man_validate.c index 812e7743..9b3ae239 100644 --- a/man_validate.c +++ b/man_validate.c @@ -89,7 +89,6 @@ static const v_check __man_valids[MAN_MAX - MAN_TH] = { NULL, /* EE */ post_UR, /* UR */ NULL, /* UE */ - NULL, /* ll */ }; static const v_check *man_valids = __man_valids - MAN_TH; @@ -305,7 +305,6 @@ static const struct mdoc_handler __mdocs[MDOC_MAX - MDOC_Dd] = { { NULL, 0, 0 }, /* sp */ { NULL, 0, 0 }, /* %U */ { NULL, 0, 0 }, /* Ta */ - { NULL, 0, 0 }, /* ll */ }; static const struct mdoc_handler *const mdocs = __mdocs - MDOC_Dd; diff --git a/mdoc_argv.c b/mdoc_argv.c index bf5d370f..3f22ec77 100644 --- a/mdoc_argv.c +++ b/mdoc_argv.c @@ -266,7 +266,6 @@ static const struct mdocarg __mdocargs[MDOC_MAX - MDOC_Dd] = { { ARGSFL_NONE, NULL }, /* sp */ { ARGSFL_NONE, NULL }, /* %U */ { ARGSFL_NONE, NULL }, /* Ta */ - { ARGSFL_NONE, NULL }, /* ll */ }; static const struct mdocarg *const mdocargs = __mdocargs - MDOC_Dd; diff --git a/mdoc_html.c b/mdoc_html.c index 87c06470..3c8ebdf8 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -240,7 +240,6 @@ static const struct htmlmdoc __mdocs[MDOC_MAX - MDOC_Dd] = { {mdoc_sp_pre, NULL}, /* sp */ {mdoc__x_pre, mdoc__x_post}, /* %U */ {NULL, NULL}, /* Ta */ - {mdoc_skip_pre, NULL}, /* ll */ }; static const struct htmlmdoc *const mdocs = __mdocs - MDOC_Dd; diff --git a/mdoc_macro.c b/mdoc_macro.c index 09184fe8..ac2600c4 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -200,7 +200,6 @@ const struct mdoc_macro __mdoc_macros[MDOC_MAX - MDOC_Dd] = { { in_line_eoln, 0 }, /* sp */ { in_line_eoln, 0 }, /* %U */ { phrase_ta, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Ta */ - { in_line_eoln, MDOC_PROLOGUE }, /* ll */ }; const struct mdoc_macro *const mdoc_macros = __mdoc_macros - MDOC_Dd; @@ -250,7 +249,7 @@ lookup(struct roff_man *mdoc, int from, int line, int ppos, const char *p) if (res != TOKEN_NONE) { if (mdoc_macros[res].flags & MDOC_CALLABLE) return res; - if (res != MDOC_sp && res != MDOC_ll) + if (res != MDOC_sp) mandoc_msg(MANDOCERR_MACRO_CALL, mdoc->parse, line, ppos, p); } @@ -33,10 +33,13 @@ #define DECL_ARGS const struct roff_meta *meta, struct roff_node *n +typedef int (*int_fp)(DECL_ARGS); +typedef void (*void_fp)(DECL_ARGS); + struct manact { - int (*cond)(DECL_ARGS); /* DON'T run actions */ - int (*pre)(DECL_ARGS); /* pre-node action */ - void (*post)(DECL_ARGS); /* post-node action */ + int_fp cond; /* DON'T run actions */ + int_fp pre; /* pre-node action */ + void_fp post; /* post-node action */ const char *prefix; /* pre-node string constant */ const char *suffix; /* post-node string constant */ }; @@ -80,7 +83,7 @@ static int pre_bd(DECL_ARGS); static int pre_bf(DECL_ARGS); static int pre_bk(DECL_ARGS); static int pre_bl(DECL_ARGS); -static int pre_br(DECL_ARGS); +static void pre_br(DECL_ARGS); static int pre_dl(DECL_ARGS); static int pre_en(DECL_ARGS); static int pre_enc(DECL_ARGS); @@ -93,13 +96,13 @@ static int pre_fd(DECL_ARGS); static int pre_fl(DECL_ARGS); static int pre_fn(DECL_ARGS); static int pre_fo(DECL_ARGS); -static int pre_ft(DECL_ARGS); +static void pre_ft(DECL_ARGS); static int pre_Ft(DECL_ARGS); static int pre_in(DECL_ARGS); static int pre_it(DECL_ARGS); static int pre_lk(DECL_ARGS); static int pre_li(DECL_ARGS); -static int pre_ll(DECL_ARGS); +static void pre_ll(DECL_ARGS); static int pre_nm(DECL_ARGS); static int pre_no(DECL_ARGS); static int pre_ns(DECL_ARGS); @@ -121,6 +124,12 @@ static void print_width(const struct mdoc_bl *, static void print_count(int *); static void print_node(DECL_ARGS); +static const void_fp roff_manacts[ROFF_MAX] = { + pre_br, + pre_ft, + pre_ll, +}; + static const struct manact __manacts[MDOC_MAX - MDOC_Dd] = { { NULL, NULL, NULL, NULL, NULL }, /* Dd */ { NULL, NULL, NULL, NULL, NULL }, /* Dt */ @@ -243,7 +252,6 @@ static const struct manact __manacts[MDOC_MAX - MDOC_Dd] = { { NULL, pre_sp, post_sp, NULL, NULL }, /* sp */ { NULL, NULL, post_percent, NULL, NULL }, /* %U */ { NULL, NULL, NULL, NULL, NULL }, /* Ta */ - { NULL, pre_ll, post_sp, NULL, NULL }, /* ll */ }; static const struct manact *const manacts = __manacts - MDOC_Dd; @@ -653,16 +661,8 @@ print_node(DECL_ARGS) else if (outflags & MMAN_Sm) outflags |= MMAN_spc; } else if (n->tok < ROFF_MAX) { - switch (n->tok) { - case ROFF_br: - do_sub = pre_br(meta, n); - break; - case ROFF_ft: - do_sub = pre_ft(meta, n); - break; - default: - abort(); - } + (*roff_manacts[n->tok])(meta, n); + return; } else { assert(n->tok >= MDOC_Dd && n->tok < MDOC_MAX); /* @@ -1068,12 +1068,10 @@ post_bl(DECL_ARGS) } -static int +static void pre_br(DECL_ARGS) { - outflags |= MMAN_br; - return 0; } static int @@ -1326,13 +1324,12 @@ pre_Ft(DECL_ARGS) return 1; } -static int +static void pre_ft(DECL_ARGS) { print_line(".ft", 0); print_word(n->child->string); outflags |= MMAN_nl; - return 0; } static int @@ -1567,12 +1564,13 @@ pre_lk(DECL_ARGS) return 0; } -static int +static void pre_ll(DECL_ARGS) { - print_line(".ll", 0); - return 1; + if (n->child != NULL) + print_word(n->child->string); + outflags |= MMAN_nl; } static int diff --git a/mdoc_markdown.c b/mdoc_markdown.c index 9d45b771..abb97836 100644 --- a/mdoc_markdown.c +++ b/mdoc_markdown.c @@ -19,7 +19,6 @@ #include <assert.h> #include <ctype.h> #include <stdio.h> -#include <stdlib.h> #include <string.h> #include "mandoc_aux.h" @@ -226,7 +225,6 @@ static const struct md_act __md_acts[MDOC_MAX - MDOC_Dd] = { { NULL, md_pre_Pp, NULL, NULL, NULL }, /* sp */ { NULL, md_pre_Lk, md_post_pc, NULL, NULL }, /* %U */ { NULL, NULL, NULL, NULL, NULL }, /* Ta */ - { NULL, NULL, NULL, NULL, NULL }, /* ll */ }; static const struct md_act *const md_acts = __md_acts - MDOC_Dd; @@ -325,11 +323,9 @@ md_node(struct roff_node *n) case ROFF_br: process_children = md_pre_br(n); break; - case ROFF_ft: + default: process_children = 0; break; - default: - abort(); } } else { assert(n->tok >= MDOC_Dd && n->tok < MDOC_MAX); diff --git a/mdoc_state.c b/mdoc_state.c index 99230b22..2e67c63c 100644 --- a/mdoc_state.c +++ b/mdoc_state.c @@ -158,7 +158,6 @@ static const state_handler __state_handlers[MDOC_MAX - MDOC_Dd] = { NULL, /* sp */ NULL, /* %U */ NULL, /* Ta */ - NULL, /* ll */ }; static const state_handler *const state_handlers = __state_handlers - MDOC_Dd; diff --git a/mdoc_term.c b/mdoc_term.c index 9ca1368a..8f8938fd 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -106,7 +106,6 @@ static int termp_ft_pre(DECL_ARGS); static int termp_in_pre(DECL_ARGS); static int termp_it_pre(DECL_ARGS); static int termp_li_pre(DECL_ARGS); -static int termp_ll_pre(DECL_ARGS); static int termp_lk_pre(DECL_ARGS); static int termp_nd_pre(DECL_ARGS); static int termp_nm_pre(DECL_ARGS); @@ -247,7 +246,6 @@ static const struct termact __termacts[MDOC_MAX - MDOC_Dd] = { { termp_sp_pre, NULL }, /* sp */ { NULL, termp____post }, /* %U */ { NULL, NULL }, /* Ta */ - { termp_ll_pre, NULL }, /* ll */ }; static const struct termact *const termacts = __termacts - MDOC_Dd; @@ -366,8 +364,7 @@ print_mdoc_node(DECL_ARGS) default: if (n->tok < ROFF_MAX) { roff_term_pre(p, n); - chld = 0; - break; + return; } assert(n->tok >= MDOC_Dd && n->tok < MDOC_MAX); if (termacts[n->tok].pre != NULL && @@ -391,9 +388,7 @@ print_mdoc_node(DECL_ARGS) case ROFFT_EQN: break; default: - if (n->tok < ROFF_MAX || - termacts[n->tok].post == NULL || - n->flags & NODE_ENDED) + if (termacts[n->tok].post == NULL || n->flags & NODE_ENDED) break; (void)(*termacts[n->tok].post)(p, &npair, meta, n); @@ -410,10 +405,8 @@ print_mdoc_node(DECL_ARGS) if (NODE_EOS & n->flags) p->flags |= TERMP_SENTENCE; - if (MDOC_ll != n->tok) { - p->offset = offset; - p->rmargin = rmargin; - } + p->offset = offset; + p->rmargin = rmargin; } static void @@ -605,14 +598,6 @@ print_bvspace(struct termp *p, static int -termp_ll_pre(DECL_ARGS) -{ - - term_setwidth(p, n->child != NULL ? n->child->string : NULL); - return 0; -} - -static int termp_it_pre(DECL_ARGS) { struct roffsu su; diff --git a/mdoc_validate.c b/mdoc_validate.c index 3fd00c18..50ccab6d 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -230,7 +230,6 @@ static const v_post __mdoc_valids[MDOC_MAX - MDOC_Dd] = { post_par, /* sp */ NULL, /* %U */ NULL, /* Ta */ - NULL, /* ll */ }; static const v_post *const mdoc_valids = __mdoc_valids - MDOC_Dd; @@ -211,7 +211,7 @@ static enum rofferr roff_userdef(ROFF_ARGS); #define ROFFNUM_WHITE (1 << 1) /* Skip whitespace in roff_evalnum(). */ const char *__roff_name[MAN_MAX + 1] = { - "br", "ft", NULL, + "br", "ft", "ll", NULL, "ab", "ad", "af", "aln", "als", "am", "am1", "ami", "ami1", "as", "as1", "asciify", @@ -302,7 +302,7 @@ const char *__roff_name[MAN_MAX + 1] = { "Lk", "Mt", "Brq", "Bro", "Brc", "%C", "Es", "En", "Dx", "%Q", "sp", - "%U", "Ta", "ll", NULL, + "%U", "Ta", NULL, "TH", "SH", "SS", "TP", "LP", "PP", "P", "IP", "HP", "SM", "SB", "BI", @@ -312,13 +312,14 @@ const char *__roff_name[MAN_MAX + 1] = { "RE", "RS", "DT", "UC", "PD", "AT", "in", "OP", "EX", "EE", "UR", - "UE", "ll", NULL + "UE", NULL }; const char *const *roff_name = __roff_name; static struct roffmac roffs[TOKEN_NONE] = { { roff_br, NULL, NULL, 0 }, /* br */ { roff_onearg, NULL, NULL, 0 }, /* ft */ + { roff_onearg, NULL, NULL, 0 }, /* ll */ { NULL, NULL, NULL, 0 }, /* ROFF_MAX */ { roff_unsupp, NULL, NULL, 0 }, /* ab */ { roff_line_ignore, NULL, NULL, 0 }, /* ad */ @@ -68,6 +68,7 @@ enum roff_type { enum roff_tok { ROFF_br = 0, ROFF_ft, + ROFF_ll, ROFF_MAX, ROFF_ab, ROFF_ad, @@ -196,7 +197,6 @@ enum roff_tok { ROFF_lg, ROFF_lhang, ROFF_linetabs, - /* MAN_ll, MDOC_ll */ ROFF_lnr, ROFF_lnrf, ROFF_lpfx, @@ -432,7 +432,6 @@ enum roff_tok { MDOC_sp, MDOC__U, MDOC_Ta, - MDOC_ll, MDOC_MAX, MAN_TH, MAN_SH, @@ -469,7 +468,6 @@ enum roff_tok { MAN_EE, MAN_UR, MAN_UE, - MAN_ll, MAN_MAX }; diff --git a/roff_term.c b/roff_term.c index cd9fba37..783bd2ee 100644 --- a/roff_term.c +++ b/roff_term.c @@ -1,6 +1,6 @@ /* $OpenBSD$ */ /* - * Copyright (c) 2010, 2017 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2010, 2014, 2017 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -17,6 +17,7 @@ #include <sys/types.h> #include <assert.h> +#include <stddef.h> #include "roff.h" #include "out.h" @@ -28,10 +29,12 @@ typedef void (*roff_term_pre_fp)(ROFF_TERM_ARGS); static void roff_term_pre_br(ROFF_TERM_ARGS); static void roff_term_pre_ft(ROFF_TERM_ARGS); +static void roff_term_pre_ll(ROFF_TERM_ARGS); static const roff_term_pre_fp roff_term_pre_acts[ROFF_MAX] = { roff_term_pre_br, /* br */ roff_term_pre_ft, /* ft */ + roff_term_pre_ll, /* ft */ }; @@ -78,3 +81,9 @@ roff_term_pre_ft(ROFF_TERM_ARGS) break; } } + +static void +roff_term_pre_ll(ROFF_TERM_ARGS) +{ + term_setwidth(p, n->child != NULL ? n->child->string : NULL); +} diff --git a/roff_validate.c b/roff_validate.c index 269de1c4..4fca0406 100644 --- a/roff_validate.c +++ b/roff_validate.c @@ -33,6 +33,7 @@ static void roff_valid_ft(ROFF_VALID_ARGS); static const roff_valid_fp roff_valids[ROFF_MAX] = { NULL, /* br */ roff_valid_ft, /* ft */ + NULL, /* ll */ }; |