source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Fix table to print nicely (merging error).
@ 2011-01-02 20:34 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2011-01-02 20:34 UTC (permalink / raw)
  To: source

Log Message:
-----------
Fix table to print nicely (merging error).  Also have -Ttree push out some
header stuff.

Modified Files:
--------------
    mdocml:
        tbl.c
        tbl_layout.c
        tree.c

Revision Data
-------------
Index: tbl_layout.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/tbl_layout.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -Ltbl_layout.c -Ltbl_layout.c -u -p -r1.7 -r1.8
--- tbl_layout.c
+++ tbl_layout.c
@@ -294,7 +294,7 @@ cell_alloc(struct tbl_node *tbl, struct 
 	 * ones.
 	 */
 
-	h = pp ? pp->head->prev : tbl->first_head;
+	h = pp ? pp->head->next : tbl->first_head;
 
 	if (h) {
 		/* Re-use data header. */
Index: tbl.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/tbl.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -Ltbl.c -Ltbl.c -u -p -r1.18 -r1.19
--- tbl.c
+++ tbl.c
@@ -199,9 +199,6 @@ static void
 tbl_calc_data(struct tbl_node *tbl, struct tbl_dat *data)
 {
 
-	/*
-	 * This is the case with overrunning cells... 
-	 */
 	if (NULL == data->layout)
 		return;
 
@@ -313,5 +310,3 @@ tbl_calc_data_literal(struct tbl_dat *da
 	if (data->layout->head->width < sz)
 		data->layout->head->width = sz;
 }
-
-
Index: tree.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/tree.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -Ltree.c -Ltree.c -u -p -r1.29 -r1.30
--- tree.c
+++ tree.c
@@ -30,7 +30,7 @@
 
 static	void	print_mdoc(const struct mdoc_node *, int);
 static	void	print_man(const struct man_node *, int);
-static	void	print_span(const struct tbl_span *);
+static	void	print_span(const struct tbl_span *, int);
 
 
 /* ARGSUSED */
@@ -136,13 +136,13 @@ print_mdoc(const struct mdoc_node *n, in
 		/* NOTREACHED */
 	}
 
-	for (i = 0; i < indent; i++)
-		putchar('\t');
-
 	if (n->span) {
 		assert(NULL == p);
-		print_span(n->span);
+		print_span(n->span, indent);
 	} else {
+		for (i = 0; i < indent; i++)
+			putchar('\t');
+
 		printf("%s (%s)", p, t);
 
 		for (i = 0; i < (int)argc; i++) {
@@ -228,14 +228,14 @@ print_man(const struct man_node *n, int 
 		/* NOTREACHED */
 	}
 
-	for (i = 0; i < indent; i++)
-		putchar('\t');
-
 	if (n->span) {
 		assert(NULL == p);
-		print_span(n->span);
-	} else
+		print_span(n->span, indent);
+	} else {
+		for (i = 0; i < indent; i++)
+			putchar('\t');
 		printf("%s (%s) %d:%d", p, t, n->line, n->pos);
+	}
 
 	putchar('\n');
 
@@ -246,9 +246,26 @@ print_man(const struct man_node *n, int 
 }
 
 static void
-print_span(const struct tbl_span *sp)
+print_span(const struct tbl_span *sp, int indent)
 {
 	const struct tbl_dat *dp;
+	const struct tbl_head *hp;
+	int		 i;
+
+	if (TBL_SPAN_FIRST & sp->flags) {
+		for (i = 0; i < indent; i++)
+			putchar('\t');
+		printf("tbl-head: ");
+		for (hp = sp->head; hp; hp = hp->next) {
+			printf("[%d]", hp->width);
+			if (hp->next)
+				putchar(' ');
+		}
+		putchar('\n');
+	}
+
+	for (i = 0; i < indent; i++)
+		putchar('\t');
 
 	printf("tbl: ");
 
--
 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-01-02 20:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-02 20:34 mdocml: Fix table to print nicely (merging error) 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).