-/* $Id: tree.c,v 1.28 2011/01/01 17:10:20 kristaps Exp $ */
+/* $Id: tree.c,v 1.32 2011/01/10 14:40:30 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
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 */
/* 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++) {
/* 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');
}
static void
-print_span(const struct tbl_span *sp)
+print_span(const struct tbl_span *sp, int indent)
{
const struct tbl_dat *dp;
+ int i;
+
+ for (i = 0; i < indent; i++)
+ putchar('\t');
printf("tbl: ");
default:
break;
}
- printf("[%s]", dp->string);
+ printf("[\"%s\"", dp->string ? dp->string : "");
+ if (dp->spans)
+ printf("(%d)", dp->spans);
+ if (NULL == dp->layout)
+ putchar('*');
+ putchar(']');
if (dp->next)
putchar(' ');
}