aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-01-02 20:34:05 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-01-02 20:34:05 +0000
commit298f818bf95cddb04543ee3777a239b4d7a7fe6d (patch)
treefd32680ae20bf9ab566a68afcc850e60e22661e6
parent7d5e0e2a6c6340e24187d9edfe8bfe7bb441ffd8 (diff)
downloadmandoc-298f818bf95cddb04543ee3777a239b4d7a7fe6d.tar.gz
mandoc-298f818bf95cddb04543ee3777a239b4d7a7fe6d.tar.zst
mandoc-298f818bf95cddb04543ee3777a239b4d7a7fe6d.zip
Fix table to print nicely (merging error). Also have -Ttree push out some
header stuff.
-rw-r--r--tbl.c7
-rw-r--r--tbl_layout.c4
-rw-r--r--tree.c41
3 files changed, 32 insertions, 20 deletions
diff --git a/tbl.c b/tbl.c
index 35ca9e09..e22dffd5 100644
--- a/tbl.c
+++ b/tbl.c
@@ -1,4 +1,4 @@
-/* $Id: tbl.c,v 1.18 2011/01/02 12:04:23 kristaps Exp $ */
+/* $Id: tbl.c,v 1.19 2011/01/02 20:34:05 kristaps Exp $ */
/*
* Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -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 *data)
if (data->layout->head->width < sz)
data->layout->head->width = sz;
}
-
-
diff --git a/tbl_layout.c b/tbl_layout.c
index d0a9c617..30e6b01a 100644
--- a/tbl_layout.c
+++ b/tbl_layout.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_layout.c,v 1.7 2011/01/02 12:04:23 kristaps Exp $ */
+/* $Id: tbl_layout.c,v 1.8 2011/01/02 20:34:05 kristaps Exp $ */
/*
* Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -294,7 +294,7 @@ cell_alloc(struct tbl_node *tbl, struct tbl_row *rp, enum tbl_cellt pos)
* ones.
*/
- h = pp ? pp->head->prev : tbl->first_head;
+ h = pp ? pp->head->next : tbl->first_head;
if (h) {
/* Re-use data header. */
diff --git a/tree.c b/tree.c
index d488c155..52e120f9 100644
--- a/tree.c
+++ b/tree.c
@@ -1,4 +1,4 @@
-/* $Id: tree.c,v 1.29 2011/01/01 22:27:08 kristaps Exp $ */
+/* $Id: tree.c,v 1.30 2011/01/02 20:34:05 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -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, int indent)
/* 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 indent)
/* 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 indent)
}
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: ");