diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-02-21 21:00:06 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-02-21 21:00:06 +0000 |
commit | 9275a05a090b366b47ed479d15472e058b8d8318 (patch) | |
tree | 3ee741683a39572e6e73698ebeb3cb303cd2edae /termact.c | |
parent | e4966b859ee26adbd25172e1e2e7d266feb6d36c (diff) | |
download | mandoc-9275a05a090b366b47ed479d15472e058b8d8318.tar.gz mandoc-9275a05a090b366b47ed479d15472e058b8d8318.tar.zst mandoc-9275a05a090b366b47ed479d15472e058b8d8318.zip |
Split mdocml -> mdocterm, mdoctree (new manuals, etc.).
Escape-recognition term.c.
Diffstat (limited to 'termact.c')
-rw-r--r-- | termact.c | 77 |
1 files changed, 28 insertions, 49 deletions
@@ -1,4 +1,4 @@ -/* $Id: termact.c,v 1.1 2009/02/21 19:05:28 kristaps Exp $ */ +/* $Id: termact.c,v 1.2 2009/02/21 21:00:06 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -56,11 +56,10 @@ static int arg_getattr(int, size_t, const struct mdoc_meta *meta, \ const struct mdoc_node *node -#define DECL_PREPOST(name, suffix) \ -static int name##_##suffix(DECL_ARGS) - -#define DECL_PRE(name) DECL_PREPOST(name, pre) -#define DECL_POST(name) DECL_PREPOST(name, post) +#define DECL_PRE(name) \ +static int name##_pre(DECL_ARGS) +#define DECL_POST(name) \ +static void name##_post(DECL_ARGS) DECL_PRE(termp_aq); DECL_PRE(termp_ar); @@ -216,21 +215,20 @@ termp_dq_pre(DECL_ARGS) /* ARGSUSED */ -static int +static void termp_dq_post(DECL_ARGS) { if (MDOC_BODY != node->type) - return(1); + return; p->flags |= TERMP_NOSPACE; word(p, "''"); - return(1); } /* ARGSUSED */ -static int +static void termp_it_post(DECL_ARGS) { const struct mdoc_node *n, *it; @@ -251,7 +249,7 @@ termp_it_post(DECL_ARGS) case (MDOC_HEAD): break; default: - return(1); + return; } it = node->parent; @@ -283,8 +281,6 @@ termp_it_post(DECL_ARGS) p->flags &= ~TERMP_NOLPAD; } } - - return(1); } @@ -362,22 +358,20 @@ termp_it_pre(DECL_ARGS) /* ARGSUSED */ -static int +static void termp_nm_post(DECL_ARGS) { p->flags &= ~ttypes[TTYPE_PROG]; - return(1); } /* ARGSUSED */ -static int +static void termp_fl_post(DECL_ARGS) { p->flags &= ~ttypes[TTYPE_CMD_FLAG]; - return(1); } @@ -426,12 +420,11 @@ termp_pp_pre(DECL_ARGS) /* ARGSUSED */ -static int +static void termp_ar_post(DECL_ARGS) { p->flags &= ~ttypes[TTYPE_CMD_ARG]; - return(1); } @@ -466,40 +459,29 @@ termp_nd_pre(DECL_ARGS) /* ARGSUSED */ -static int +static void termp_bl_post(DECL_ARGS) { - switch (node->type) { - case (MDOC_BLOCK): + if (MDOC_BLOCK == node->type) newln(p); - break; - default: - break; - } - return(1); } /* ARGSUSED */ -static int +static void termp_op_post(DECL_ARGS) { - switch (node->type) { - case (MDOC_BODY): - p->flags |= TERMP_NOSPACE; - word(p, "\\]"); - break; - default: - break; - } - return(1); + if (MDOC_BODY != node->type) + return; + p->flags |= TERMP_NOSPACE; + word(p, "\\(rB"); } /* ARGSUSED */ -static int +static void termp_sh_post(DECL_ARGS) { @@ -515,7 +497,6 @@ termp_sh_post(DECL_ARGS) default: break; } - return(1); } @@ -536,11 +517,11 @@ termp_xr_pre(DECL_ARGS) assert(MDOC_TEXT == n->type); p->flags |= TERMP_NOSPACE; - word(p, "\\("); + word(p, "("); p->flags |= TERMP_NOSPACE; word(p, n->data.text.string); p->flags |= TERMP_NOSPACE; - word(p, "\\)"); + word(p, ")"); return(0); } @@ -573,7 +554,7 @@ termp_op_pre(DECL_ARGS) switch (node->type) { case (MDOC_BODY): - word(p, "\\["); + word(p, "\\(lB"); p->flags |= TERMP_NOSPACE; break; default: @@ -619,15 +600,14 @@ termp_d1_pre(DECL_ARGS) /* ARGSUSED */ -static int +static void termp_d1_post(DECL_ARGS) { - if (MDOC_BODY != node->type) - return(1); + if (MDOC_BODY != node->type) + return; newln(p); p->offset -= 4; - return(1); } @@ -645,15 +625,14 @@ termp_aq_pre(DECL_ARGS) /* ARGSUSED */ -static int +static void termp_aq_post(DECL_ARGS) { if (MDOC_BODY != node->type) - return(1); + return; p->flags |= TERMP_NOSPACE; word(p, "\\>"); - return(1); } |