From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (schwarze@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.5/8.14.5) with ESMTP id q699VnV2019518 for ; Mon, 9 Jul 2012 05:31:49 -0400 (EDT) Received: (from schwarze@localhost) by krisdoz.my.domain (8.14.5/8.14.3/Submit) id q699VmXT000254; Mon, 9 Jul 2012 05:31:48 -0400 (EDT) Date: Mon, 9 Jul 2012 05:31:48 -0400 (EDT) Message-Id: <201207090931.q699VmXT000254@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: implement -Tman .No and .Mt; OpenBSD rev. X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- implement -Tman .No and .Mt; OpenBSD rev. 1.23 Modified Files: -------------- mdocml: mdoc_man.c Revision Data ------------- Index: mdoc_man.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_man.c,v retrieving revision 1.24 retrieving revision 1.25 diff -Lmdoc_man.c -Lmdoc_man.c -u -p -r1.24 -r1.25 --- mdoc_man.c +++ mdoc_man.c @@ -72,6 +72,7 @@ static int pre_in(DECL_ARGS); static int pre_it(DECL_ARGS); static int pre_lk(DECL_ARGS); static int pre_nm(DECL_ARGS); +static int pre_no(DECL_ARGS); static int pre_ns(DECL_ARGS); static int pre_pp(DECL_ARGS); static int pre_sm(DECL_ARGS); @@ -164,7 +165,7 @@ static const struct manact manacts[MDOC_ { NULL, NULL, NULL, NULL, NULL }, /* _Eo */ { NULL, pre_ux, NULL, "FreeBSD", NULL }, /* Fx */ { NULL, pre_enc, post_enc, "\\fB", "\\fP" }, /* Ms */ - { NULL, NULL, NULL, NULL, NULL }, /* No */ + { NULL, pre_no, NULL, NULL, NULL }, /* No */ { NULL, pre_ns, NULL, NULL, NULL }, /* Ns */ { NULL, pre_ux, NULL, "NetBSD", NULL }, /* Nx */ { NULL, pre_ux, NULL, "OpenBSD", NULL }, /* Ox */ @@ -201,7 +202,7 @@ static const struct manact manacts[MDOC_ { NULL, NULL, post_lb, NULL, NULL }, /* Lb */ { NULL, pre_pp, NULL, NULL, NULL }, /* Lp */ { NULL, pre_lk, NULL, NULL, NULL }, /* Lk */ - { NULL, NULL, NULL, NULL, NULL }, /* _Mt */ + { NULL, pre_enc, post_enc, "\\fI", "\\fP" }, /* Mt */ { cond_body, pre_enc, post_enc, "{", "}" }, /* Brq */ { cond_body, pre_enc, post_enc, "{", "}" }, /* Bro */ { NULL, NULL, NULL, NULL, NULL }, /* Brc */ @@ -219,13 +220,14 @@ static const struct manact manacts[MDOC_ static int outflags; #define MMAN_spc (1 << 0) -#define MMAN_nl (1 << 1) -#define MMAN_br (1 << 2) -#define MMAN_sp (1 << 3) -#define MMAN_Sm (1 << 4) -#define MMAN_Bk (1 << 5) -#define MMAN_An_split (1 << 6) -#define MMAN_An_nosplit (1 << 7) +#define MMAN_spc_force (1 << 1) +#define MMAN_nl (1 << 2) +#define MMAN_br (1 << 3) +#define MMAN_sp (1 << 4) +#define MMAN_Sm (1 << 5) +#define MMAN_Bk (1 << 6) +#define MMAN_An_split (1 << 7) +#define MMAN_An_nosplit (1 << 8) static void print_word(const char *s) @@ -244,12 +246,13 @@ print_word(const char *s) outflags &= ~(MMAN_sp|MMAN_br|MMAN_nl|MMAN_spc); } else if (MMAN_spc & outflags && '\0' != s[0]) /* - * If we need a space, only print it before - * (1) a nonzero length word; - * (2) a word that is non-punctuation; and - * (3) if punctuation, non-terminating puncutation. + * If we need a space, only print it if + * (1) it is forced by `No' or + * (2) what follows is not terminating punctuation or + * (3) what follows is longer than one character. */ - if (NULL == strchr(".,:;)]?!", s[0]) || '\0' != s[1]) { + if (MMAN_spc_force & outflags || + NULL == strchr(".,:;)]?!", s[0]) || '\0' != s[1]) { if (MMAN_Bk & outflags) { putchar('\\'); putchar('~'); @@ -266,6 +269,7 @@ print_word(const char *s) outflags |= MMAN_spc; else outflags &= ~MMAN_spc; + outflags &= ~MMAN_spc_force; for ( ; *s; s++) { switch (*s) { @@ -884,6 +888,14 @@ post_nm(DECL_ARGS) return; outflags &= ~MMAN_spc; print_word("\\fP"); +} + +static int +pre_no(DECL_ARGS) +{ + + outflags |= MMAN_spc_force; + return(1); } static int -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv