source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Line-breaking roff(7) requests also break man(7) next-line
@ 2017-05-08 20:34 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2017-05-08 20:34 UTC (permalink / raw)
  To: source

Log Message:
-----------
Line-breaking roff(7) requests also break man(7) next-line scope.
Considering that real roff implements next-line scope using input
line traps, that isn't all that surprising.
Issue found in the games/xbattle port.

Modified Files:
--------------
    mdocml:
        man.c
        roff.c

Revision Data
-------------
Index: man.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/man.c,v
retrieving revision 1.172
retrieving revision 1.173
diff -Lman.c -Lman.c -u -p -r1.172 -r1.173
--- man.c
+++ man.c
@@ -94,6 +94,7 @@ man_ptext(struct roff_man *man, int line
 	 */
 
 	if (buf[i] == '\0') {
+		man_breakscope(man, ROFF_sp);
 		/* Allocate a blank entry. */
 		if (man->last->tok != MAN_SH &&
 		    man->last->tok != MAN_SS) {
@@ -258,7 +259,7 @@ man_breakscope(struct roff_man *man, int
 	 * Delete the element that is being broken.
 	 */
 
-	if (man->flags & MAN_ELINE && (tok == TOKEN_NONE ||
+	if (man->flags & MAN_ELINE && (tok < MAN_TH ||
 	    ! (man_macros[tok].flags & MAN_NSCOPED))) {
 		n = man->last;
 		assert(n->type != ROFFT_TEXT);
@@ -267,8 +268,7 @@ man_breakscope(struct roff_man *man, int
 
 		mandoc_vmsg(MANDOCERR_BLK_LINE, man->parse,
 		    n->line, n->pos, "%s breaks %s",
-		    tok == TOKEN_NONE ? "TS" : roff_name[tok],
-		    roff_name[n->tok]);
+		    roff_name[tok], roff_name[n->tok]);
 
 		roff_node_delete(man, n);
 		man->flags &= ~MAN_ELINE;
@@ -294,7 +294,7 @@ man_breakscope(struct roff_man *man, int
 	 * Delete the block that is being broken.
 	 */
 
-	if (man->flags & MAN_BLINE && (tok == TOKEN_NONE ||
+	if (man->flags & MAN_BLINE && (tok < MAN_TH ||
 	    man_macros[tok].flags & MAN_BSCOPE)) {
 		n = man->last;
 		if (n->type == ROFFT_TEXT)
@@ -309,8 +309,7 @@ man_breakscope(struct roff_man *man, int
 
 		mandoc_vmsg(MANDOCERR_BLK_LINE, man->parse,
 		    n->line, n->pos, "%s breaks %s",
-		    tok == TOKEN_NONE ? "TS" : roff_name[tok],
-		    roff_name[n->tok]);
+		    roff_name[tok], roff_name[n->tok]);
 
 		roff_node_delete(man, n);
 		man->flags &= ~MAN_BLINE;
Index: roff.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/roff.c,v
retrieving revision 1.301
retrieving revision 1.302
diff -Lroff.c -Lroff.c -u -p -r1.301 -r1.302
--- roff.c
+++ roff.c
@@ -1009,7 +1009,7 @@ roff_addtbl(struct roff_man *man, const 
 	struct roff_node	*n;
 
 	if (man->macroset == MACROSET_MAN)
-		man_breakscope(man, TOKEN_NONE);
+		man_breakscope(man, ROFF_TS);
 	n = roff_node_alloc(man, tbl->line, 0, ROFFT_TBL, TOKEN_NONE);
 	n->span = tbl;
 	roff_node_append(man, n);
@@ -2778,6 +2778,10 @@ roff_onearg(ROFF_ARGS)
 	struct roff_node	*n;
 	char			*cp;
 
+	if (r->man->flags & (MAN_BLINE | MAN_ELINE) &&
+	    (tok == ROFF_sp || tok == ROFF_ti))
+		man_breakscope(r->man, tok);
+
 	roff_elem_alloc(r->man, ln, ppos, tok);
 	n = r->man->last;
 
@@ -2826,6 +2830,8 @@ roff_manyarg(ROFF_ARGS)
 static enum rofferr
 roff_br(ROFF_ARGS)
 {
+	if (r->man->flags & (MAN_BLINE | MAN_ELINE))
+		man_breakscope(r->man, ROFF_br);
 	roff_elem_alloc(r->man, ln, ppos, ROFF_br);
 	if (buf->buf[pos] != '\0')
 		mandoc_vmsg(MANDOCERR_ARG_SKIP, r->parse, ln, pos,
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-05-08 20:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-08 20:34 mdocml: Line-breaking roff(7) requests also break man(7) next-line schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).