X-Git-Url: https://git.cameronkatri.com/mandoc.git/blobdiff_plain/dbd5746117cfc008d44b2e9e53c8f76c8d92673d..bf9cd278f0762f5462721f4edb03b4172663d23f:/tree.c diff --git a/tree.c b/tree.c index d56eeaf6..427a9d41 100644 --- a/tree.c +++ b/tree.c @@ -1,4 +1,4 @@ -/* $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 * @@ -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,13 @@ 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; + int i; + + for (i = 0; i < indent; i++) + putchar('\t'); printf("tbl: "); @@ -278,7 +282,12 @@ print_span(const struct tbl_span *sp) 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(' '); }