From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]); by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id 80168e79; for ; Fri, 23 Jan 2015 20:59:04 -0500 (EST) Date: Fri, 23 Jan 2015 20:59:04 -0500 (EST) Message-Id: <9026047973934858840.enqueue@fantadrom.bsd.lv> 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: Support .RE with an argument; needed for audio/pms(1). X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Support .RE with an argument; needed for audio/pms(1). Modified Files: -------------- mdocml: man.7 man_macro.c mandoc.1 mandoc.h read.c Revision Data ------------- Index: read.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/read.c,v retrieving revision 1.114 retrieving revision 1.115 diff -Lread.c -Lread.c -u -p -r1.114 -r1.115 --- read.c +++ read.c @@ -195,6 +195,7 @@ static const char * const mandocerrs[MAN "skipping item outside list", "skipping column outside column list", "skipping end of block that is not open", + "fewer RS blocks open, skipping", "inserting missing end of block", "appending missing end of block", Index: mandoc.h =================================================================== RCS file: /home/cvs/mdocml/mdocml/mandoc.h,v retrieving revision 1.185 retrieving revision 1.186 diff -Lmandoc.h -Lmandoc.h -u -p -r1.185 -r1.186 --- mandoc.h +++ mandoc.h @@ -151,6 +151,7 @@ enum mandocerr { MANDOCERR_IT_STRAY, /* skipping item outside list: It ... */ MANDOCERR_TA_STRAY, /* skipping column outside column list: Ta */ MANDOCERR_BLK_NOTOPEN, /* skipping end of block that is not open */ + MANDOCERR_RE_NOTOPEN, /* fewer RS blocks open, skipping: RE arg */ MANDOCERR_BLK_BROKEN, /* inserting missing end of block: macro ... */ MANDOCERR_BLK_NOEND, /* appending missing end of block: macro */ Index: mandoc.1 =================================================================== RCS file: /home/cvs/mdocml/mdocml/mandoc.1,v retrieving revision 1.134 retrieving revision 1.135 diff -Lmandoc.1 -Lmandoc.1 -u -p -r1.134 -r1.135 --- mandoc.1 +++ mandoc.1 @@ -1369,6 +1369,16 @@ right delimiter or closing brace, or the .Xr roff 7 conditional request is encountered but no matching block is open. The offending request or macro is discarded. +.It Sy "fewer RS blocks open, skipping" +.Pq man +The +.Ic \&RE +macro is invoked with an argument, but less than the specified number of +.Ic \&RS +blocks is open. +The +.Ic \&RE +macro is discarded. .It Sy "inserting missing end of block" .Pq mdoc , tbl Various @@ -1537,10 +1547,13 @@ macro, or a block closing request is invoked with at least one argument. All arguments are ignored. .It Sy "skipping excess arguments" -.Pq mdoc , roff +.Pq mdoc , man , roff The .Ic \&Bf -macro is invoked with more than one argument, or a request of the +macro is invoked with more than one argument, the +.Ic \&RE +macro is invoked with more than one argument +or with a non-integer argument, or a request of the .Ic \&de family is invoked with more than two arguments. The excess arguments are ignored. Index: man.7 =================================================================== RCS file: /home/cvs/mdocml/mdocml/man.7,v retrieving revision 1.128 retrieving revision 1.129 diff -Lman.7 -Lman.7 -u -p -r1.128 -r1.129 --- man.7 +++ man.7 @@ -1,7 +1,7 @@ .\" $Id$ .\" .\" Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons -.\" Copyright (c) 2011, 2012, 2013 Ingo Schwarze +.\" Copyright (c) 2011-2015 Ingo Schwarze .\" Copyright (c) 2010 Joerg Sonnenberger .\" .\" Permission to use, copy, modify, and distribute this software for any @@ -555,9 +555,29 @@ and .Ss \&RE Explicitly close out the scope of a prior .Sx \&RS . -The default left margin is restored to the state of the original +The default left margin is restored to the state before that .Sx \&RS invocation. +.Pp +The syntax is as follows: +.Bd -filled -offset indent +.Pf \. Sx \&RE +.Op Ar level +.Ed +.Pp +Without an argument, the most recent +.Sx \&RS +block is closed out. +If +.Ar level +is 1, all open +.Sx \&RS +blocks are closed out. +Otherwise, +.Ar level No \(mi 1 +nested +.Sx \&RS +blocks remain open. .Ss \&RI Text is rendered alternately in roman (the default font) and italics. Whitespace between arguments is omitted in output. Index: man_macro.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/man_macro.c,v retrieving revision 1.92 retrieving revision 1.93 diff -Lman_macro.c -Lman_macro.c -u -p -r1.92 -r1.93 --- man_macro.c +++ man_macro.c @@ -1,7 +1,7 @@ /* $Id$ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons - * Copyright (c) 2012, 2013, 2014 Ingo Schwarze + * Copyright (c) 2012, 2013, 2014, 2015 Ingo Schwarze * Copyright (c) 2013 Franco Fichtner * * Permission to use, copy, modify, and distribute this software for any @@ -279,10 +279,30 @@ blk_close(MACRO_PROT_ARGS) { enum mant ntok; const struct man_node *nn; + char *p; + int nrew, target; + nrew = 1; switch (tok) { case MAN_RE: ntok = MAN_RS; + if ( ! man_args(man, line, pos, buf, &p)) + break; + for (nn = man->last->parent; nn; nn = nn->parent) + if (nn->tok == ntok && nn->type == MAN_BLOCK) + nrew++; + target = strtol(p, &p, 10); + if (*p != '\0') + mandoc_vmsg(MANDOCERR_ARG_EXCESS, man->parse, + line, p - buf, "RE ... %s", p); + if (target == 0) + target = 1; + nrew -= target; + if (nrew < 1) { + mandoc_vmsg(MANDOCERR_RE_NOTOPEN, man->parse, + line, ppos, "RE %d", target); + return; + } break; case MAN_UE: ntok = MAN_UR; @@ -293,7 +313,7 @@ blk_close(MACRO_PROT_ARGS) } for (nn = man->last->parent; nn; nn = nn->parent) - if (nn->tok == ntok && nn->type == MAN_BLOCK) + if (nn->tok == ntok && nn->type == MAN_BLOCK && ! --nrew) break; if (nn == NULL) { -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv