source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Let the line-number of a tbl_span be remembered.
@ 2011-02-06 22:02 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2011-02-06 22:02 UTC (permalink / raw)
  To: source

Log Message:
-----------
Let the line-number of a tbl_span be remembered.

Modified Files:
--------------
    mdocml:
        man.c
        mandoc.h
        mdoc.c
        tbl_data.c
        tree.c

Revision Data
-------------
Index: tbl_data.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/tbl_data.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -Ltbl_data.c -Ltbl_data.c -u -p -r1.21 -r1.22
--- tbl_data.c
+++ tbl_data.c
@@ -29,10 +29,10 @@
 #include "libmandoc.h"
 #include "libroff.h"
 
-static	int	data(struct tbl_node *, struct tbl_span *, 
-			int, const char *, int *);
-static	struct tbl_span	*newspan(struct tbl_node *, struct tbl_row *);
-
+static	int		 data(struct tbl_node *, struct tbl_span *, 
+				int, const char *, int *);
+static	struct tbl_span	*newspan(struct tbl_node *, int, 
+				struct tbl_row *);
 
 static int
 data(struct tbl_node *tbl, struct tbl_span *dp, 
@@ -176,11 +176,12 @@ tbl_cdata(struct tbl_node *tbl, int ln, 
 }
 
 static struct tbl_span *
-newspan(struct tbl_node *tbl, struct tbl_row *rp)
+newspan(struct tbl_node *tbl, int line, struct tbl_row *rp)
 {
 	struct tbl_span	*dp;
 
 	dp = mandoc_calloc(1, sizeof(struct tbl_span));
+	dp->line = line;
 	dp->tbl = &tbl->opts;
 	dp->layout = rp;
 	dp->head = tbl->first_head;
@@ -226,11 +227,11 @@ tbl_data(struct tbl_node *tbl, int ln, c
 					rp && rp->first; rp = rp->next) {
 				switch (rp->first->pos) {
 				case (TBL_CELL_HORIZ):
-					dp = newspan(tbl, rp);
+					dp = newspan(tbl, ln, rp);
 					dp->pos = TBL_SPAN_HORIZ;
 					continue;
 				case (TBL_CELL_DHORIZ):
-					dp = newspan(tbl, rp);
+					dp = newspan(tbl, ln, rp);
 					dp->pos = TBL_SPAN_DHORIZ;
 					continue;
 				default:
@@ -248,7 +249,7 @@ tbl_data(struct tbl_node *tbl, int ln, c
 
 	assert(rp);
 
-	dp = newspan(tbl, rp);
+	dp = newspan(tbl, ln, rp);
 
 	if ( ! strcmp(p, "_")) {
 		dp->pos = TBL_SPAN_HORIZ;
Index: man.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man.c,v
retrieving revision 1.97
retrieving revision 1.98
diff -Lman.c -Lman.c -u -p -r1.97 -r1.98
--- man.c
+++ man.c
@@ -305,8 +305,7 @@ man_span_alloc(struct man *m, const stru
 {
 	struct man_node	*n;
 
-	/* FIXME: grab from span */
-	n = man_node_alloc(m, 0, 0, MAN_TBL, MAN_MAX);
+	n = man_node_alloc(m, span->line, 0, MAN_TBL, MAN_MAX);
 	n->span = span;
 
 	if ( ! man_node_append(m, n))
Index: mdoc.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.c,v
retrieving revision 1.177
retrieving revision 1.178
diff -Lmdoc.c -Lmdoc.c -u -p -r1.177 -r1.178
--- mdoc.c
+++ mdoc.c
@@ -551,8 +551,7 @@ mdoc_span_alloc(struct mdoc *m, const st
 {
 	struct mdoc_node *n;
 
-	/* FIXME: grab from tbl_span. */
-	n = node_alloc(m, 0, 0, MDOC_MAX, MDOC_TBL);
+	n = node_alloc(m, sp->line, 0, MDOC_MAX, MDOC_TBL);
 	n->span = sp;
 
 	if ( ! node_append(m, n))
Index: mandoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.h,v
retrieving revision 1.55
retrieving revision 1.56
diff -Lmandoc.h -Lmandoc.h -u -p -r1.55 -r1.56
--- mandoc.h
+++ mandoc.h
@@ -260,6 +260,7 @@ struct	tbl_span {
 	struct tbl_row	 *layout; /* layout row */
 	struct tbl_dat	 *first;
 	struct tbl_dat	 *last;
+	int		  line; /* parse line */
 	int		  flags;
 #define	TBL_SPAN_FIRST	 (1 << 0)
 #define	TBL_SPAN_LAST	 (1 << 1)
Index: tree.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/tree.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -Ltree.c -Ltree.c -u -p -r1.33 -r1.34
--- tree.c
+++ tree.c
@@ -266,8 +266,6 @@ print_span(const struct tbl_span *sp, in
 	for (i = 0; i < indent; i++)
 		putchar('\t');
 
-	printf("tbl: ");
-
 	switch (sp->pos) {
 	case (TBL_SPAN_HORIZ):
 		putchar('-');
@@ -300,7 +298,8 @@ print_span(const struct tbl_span *sp, in
 		if (NULL == dp->layout)
 			putchar('*');
 		putchar(']');
-		if (dp->next)
-			putchar(' ');
+		putchar(' ');
 	}
+
+	printf("(tbl) %d:1", sp->line);
 }
--
 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:[~2011-02-06 22:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-06 22:02 mdocml: Let the line-number of a tbl_span be remembered kristaps

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).