aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-02-06 22:02:58 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-02-06 22:02:58 +0000
commit3a8ad8057352b753c868261c2eb7a11b81d3c325 (patch)
tree99b6211a0df6a943ca0cf1c08c926adb80784e1c
parentd9c6b1be15e48dc43678c02ee4e86d280ea73046 (diff)
downloadmandoc-3a8ad8057352b753c868261c2eb7a11b81d3c325.tar.gz
mandoc-3a8ad8057352b753c868261c2eb7a11b81d3c325.tar.zst
mandoc-3a8ad8057352b753c868261c2eb7a11b81d3c325.zip
Let the line-number of a tbl_span be remembered.
-rw-r--r--man.c5
-rw-r--r--mandoc.h3
-rw-r--r--mdoc.c5
-rw-r--r--tbl_data.c19
-rw-r--r--tree.c9
5 files changed, 20 insertions, 21 deletions
diff --git a/man.c b/man.c
index 78c311b7..da58c662 100644
--- a/man.c
+++ b/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.97 2011/01/12 10:43:22 kristaps Exp $ */
+/* $Id: man.c,v 1.98 2011/02/06 22:02:58 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -305,8 +305,7 @@ man_span_alloc(struct man *m, const struct tbl_span *span)
{
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))
diff --git a/mandoc.h b/mandoc.h
index 746b20d6..845c85a5 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc.h,v 1.55 2011/02/06 20:36:36 kristaps Exp $ */
+/* $Id: mandoc.h,v 1.56 2011/02/06 22:02:58 kristaps Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -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)
diff --git a/mdoc.c b/mdoc.c
index af395217..187b5b25 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.177 2011/01/03 11:27:33 kristaps Exp $ */
+/* $Id: mdoc.c,v 1.178 2011/02/06 22:02:58 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -551,8 +551,7 @@ mdoc_span_alloc(struct mdoc *m, const struct tbl_span *sp)
{
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))
diff --git a/tbl_data.c b/tbl_data.c
index e21db323..70da2311 100644
--- a/tbl_data.c
+++ b/tbl_data.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_data.c,v 1.21 2011/01/25 12:24:27 schwarze Exp $ */
+/* $Id: tbl_data.c,v 1.22 2011/02/06 22:02:58 kristaps Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -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, const char *p)
}
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, const char *p)
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, const char *p)
assert(rp);
- dp = newspan(tbl, rp);
+ dp = newspan(tbl, ln, rp);
if ( ! strcmp(p, "_")) {
dp->pos = TBL_SPAN_HORIZ;
diff --git a/tree.c b/tree.c
index 84568474..65652adb 100644
--- a/tree.c
+++ b/tree.c
@@ -1,4 +1,4 @@
-/* $Id: tree.c,v 1.33 2011/02/06 21:44:36 kristaps Exp $ */
+/* $Id: tree.c,v 1.34 2011/02/06 22:02:58 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -266,8 +266,6 @@ print_span(const struct tbl_span *sp, int indent)
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, int indent)
if (NULL == dp->layout)
putchar('*');
putchar(']');
- if (dp->next)
- putchar(' ');
+ putchar(' ');
}
+
+ printf("(tbl) %d:1", sp->line);
}