From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (kristaps@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id o6MN3GQp023132 for ; Thu, 22 Jul 2010 19:03:16 -0400 (EDT) Received: (from kristaps@localhost) by krisdoz.my.domain (8.14.3/8.14.3/Submit) id o6MN3FCp020517; Thu, 22 Jul 2010 19:03:15 -0400 (EDT) Date: Thu, 22 Jul 2010 19:03:15 -0400 (EDT) Message-Id: <201007222303.o6MN3FCp020517@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: kristaps@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Added `in' macro support for -man -Tascii. X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Added `in' macro support for -man -Tascii. This is not yet supported in -Thtml (I'm surprised to note that neither is LITERAL mode). Modified Files: -------------- mdocml: man.7 man.c man.h man_action.c man_html.c man_macro.c man_term.c man_validate.c out.c Revision Data ------------- Index: man.7 =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man.7,v retrieving revision 1.78 retrieving revision 1.79 diff -Lman.7 -Lman.7 -u -p -r1.78 -r1.79 --- man.7 +++ man.7 @@ -427,6 +427,7 @@ The syntax is as follows: .It Sx \&br Ta 0 Ta current Ta compat .It Sx \&fi Ta 0 Ta current Ta compat .It Sx \&i Ta n Ta current Ta compat +.It Sx \&in Ta 1 Ta current Ta compat .It Sx \&na Ta 0 Ta current Ta compat .It Sx \&nf Ta 0 Ta current Ta compat .It Sx \&r Ta 0 Ta current Ta compat @@ -853,6 +854,16 @@ See also .Sx \&b , and .Sx \&r . +.Ss \&in +Indent relative to the current indentation: +.Pp +.D1 Pf \. Sx \&in Op Cm width +.Pp +If +.Cm width +is signed, the new offset is relative. +Otherwise, it is absolute. +This value is reset upon the next paragraph, section, or sub-section. .Ss \&na Don't align to the right margin. .Ss \&nf Index: man_html.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_html.c,v retrieving revision 1.42 retrieving revision 1.43 diff -Lman_html.c -Lman_html.c -u -p -r1.42 -r1.43 --- man_html.c +++ man_html.c @@ -108,6 +108,7 @@ static const struct htmlman mans[MAN_MAX { man_ign_pre, NULL }, /* Vb */ { NULL, NULL }, /* Ve */ { man_ign_pre, NULL }, /* AT */ + { man-in_pre, NULL }, /* in */ }; Index: man.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man.c,v retrieving revision 1.83 retrieving revision 1.84 diff -Lman.c -Lman.c -u -p -r1.83 -r1.84 --- man.c +++ man.c @@ -41,6 +41,7 @@ const char *const __man_macronames[MAN_M "nf", "fi", "r", "RE", "RS", "DT", "UC", "PD", "Sp", "Vb", "Ve", "AT", + "in" }; const char * const *man_macronames = __man_macronames; Index: out.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/out.c,v retrieving revision 1.22 retrieving revision 1.23 diff -Lout.c -Lout.c -u -p -r1.22 -r1.23 --- out.c +++ out.c @@ -116,6 +116,7 @@ a2roffsu(const char *src, struct roffsu return(0); } + /* FIXME: do this in the caller. */ if ((dst->scale = atof(buf)) < 0) dst->scale = 0; dst->unit = unit; Index: man_term.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_term.c,v retrieving revision 1.82 retrieving revision 1.83 diff -Lman_term.c -Lman_term.c -u -p -r1.82 -r1.83 --- man_term.c +++ man_term.c @@ -94,6 +94,7 @@ static int pre_SS(DECL_ARGS); static int pre_TP(DECL_ARGS); static int pre_fi(DECL_ARGS); static int pre_ign(DECL_ARGS); +static int pre_in(DECL_ARGS); static int pre_nf(DECL_ARGS); static int pre_sp(DECL_ARGS); @@ -141,6 +142,7 @@ static const struct termact termacts[MAN { pre_nf, NULL, 0 }, /* Vb */ { pre_fi, NULL, 0 }, /* Ve */ { pre_ign, NULL, 0 }, /* AT */ + { pre_in, NULL, MAN_NOTEXT }, /* in */ }; @@ -349,6 +351,47 @@ pre_B(DECL_ARGS) term_fontrepl(p, TERMFONT_BOLD); return(1); +} + + +/* ARGSUSED */ +static int +pre_in(DECL_ARGS) +{ + int len, less; + size_t v; + const char *cp; + + term_newln(p); + + if (NULL == n->child) { + p->offset = mt->offset; + return(0); + } + + cp = n->child->string; + less = 0; + + if ('-' == *cp) + less = -1; + else if ('+' == *cp) + less = 1; + else + cp--; + + if ((len = a2width(p, ++cp)) < 0) + return(0); + + v = (size_t)len; + + if (less < 0) + p->offset -= p->offset > v ? v : p->offset; + else if (less > 0) + p->offset += v; + else + p->offset = v; + + return(0); } Index: man.h =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man.h,v retrieving revision 1.40 retrieving revision 1.41 diff -Lman.h -Lman.h -u -p -r1.40 -r1.41 --- man.h +++ man.h @@ -56,6 +56,7 @@ enum mant { MAN_Vb, MAN_Ve, MAN_AT, + MAN_in, MAN_MAX }; Index: man_action.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_action.c,v retrieving revision 1.39 retrieving revision 1.40 diff -Lman_action.c -Lman_action.c -u -p -r1.39 -r1.40 --- man_action.c +++ man_action.c @@ -73,6 +73,7 @@ const struct actions man_actions[MAN_MAX { post_nf }, /* Vb */ { post_fi }, /* Ve */ { post_AT }, /* AT */ + { NULL }, /* in */ }; Index: man_macro.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_macro.c,v retrieving revision 1.48 retrieving revision 1.49 diff -Lman_macro.c -Lman_macro.c -u -p -r1.48 -r1.49 --- man_macro.c +++ man_macro.c @@ -83,6 +83,7 @@ const struct man_macro __man_macros[MAN_ { in_line_eoln, 0 }, /* Vb */ { in_line_eoln, 0 }, /* Ve */ { in_line_eoln, 0 }, /* AT */ + { in_line_eoln, 0 }, /* in */ }; const struct man_macro * const man_macros = __man_macros; Index: man_validate.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_validate.c,v retrieving revision 1.46 retrieving revision 1.47 diff -Lman_validate.c -Lman_validate.c -u -p -r1.46 -r1.47 --- man_validate.c +++ man_validate.c @@ -83,9 +83,9 @@ static const struct man_valid man_valids { NULL, NULL }, /* I */ { NULL, NULL }, /* IR */ { NULL, NULL }, /* RI */ - { NULL, posts_eq0 }, /* na */ + { NULL, posts_eq0 }, /* na */ /* FIXME: should warn only. */ { NULL, NULL }, /* i */ - { NULL, posts_le1 }, /* sp */ + { NULL, posts_le1 }, /* sp */ /* FIXME: should warn only. */ { pres_bline, posts_eq0 }, /* nf */ { pres_bline, posts_eq0 }, /* fi */ { NULL, NULL }, /* r */ @@ -94,10 +94,11 @@ static const struct man_valid man_valids { NULL, NULL }, /* DT */ { NULL, NULL }, /* UC */ { NULL, NULL }, /* PD */ - { NULL, posts_le1 }, /* Sp */ - { pres_bline, posts_le1 }, /* Vb */ + { NULL, posts_le1 }, /* Sp */ /* FIXME: should warn only. */ + { pres_bline, posts_le1 }, /* Vb */ /* FIXME: should warn only. */ { pres_bline, posts_eq0 }, /* Ve */ { NULL, NULL }, /* AT */ + { NULL, NULL }, /* in */ }; -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv