From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (kristaps@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id p01DswJF013823 for ; Sat, 1 Jan 2011 08:54:58 -0500 (EST) Received: (from kristaps@localhost) by krisdoz.my.domain (8.14.3/8.14.3/Submit) id p01Dswve008453; Sat, 1 Jan 2011 08:54:58 -0500 (EST) Date: Sat, 1 Jan 2011 08:54:58 -0500 (EST) Message-Id: <201101011354.p01Dswve008453@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: kristaps@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Make -Ttree spit out table columns. X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Make -Ttree spit out table columns. Add forgotten assignment of span to -man's TBL nodes. Modified Files: -------------- mdocml: man.c tree.c Revision Data ------------- Index: man.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man.c,v retrieving revision 1.94 retrieving revision 1.95 diff -Lman.c -Lman.c -u -p -r1.94 -r1.95 --- man.c +++ man.c @@ -301,6 +301,7 @@ man_span_alloc(struct man *m, const stru /* FIXME: grab from span */ n = man_node_alloc(0, 0, MAN_TBL, MAN_MAX); + n->span = span; if ( ! man_node_append(m, n)) return(0); Index: tree.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/tree.c,v retrieving revision 1.25 retrieving revision 1.26 diff -Ltree.c -Ltree.c -u -p -r1.25 -r1.26 --- tree.c +++ tree.c @@ -58,6 +58,7 @@ print_mdoc(const struct mdoc_node *n, in size_t argc, sz; char **params; struct mdoc_argv *argv; + const struct tbl_dat *dp; argv = NULL; argc = sz = 0; @@ -96,6 +97,8 @@ print_mdoc(const struct mdoc_node *n, in /* NOTREACHED */ } + p = NULL; + switch (n->type) { case (MDOC_TEXT): p = n->string; @@ -124,7 +127,6 @@ print_mdoc(const struct mdoc_node *n, in } break; case (MDOC_TBL): - p = "tbl"; break; case (MDOC_ROOT): p = "root"; @@ -135,23 +137,36 @@ print_mdoc(const struct mdoc_node *n, in } for (i = 0; i < indent; i++) - (void)printf(" "); - (void)printf("%s (%s)", p, t); + putchar('\t'); - for (i = 0; i < (int)argc; i++) { - (void)printf(" -%s", mdoc_argnames[argv[i].arg]); - if (argv[i].sz > 0) - (void)printf(" ["); - for (j = 0; j < (int)argv[i].sz; j++) - (void)printf(" [%s]", argv[i].value[j]); - if (argv[i].sz > 0) - (void)printf(" ]"); - } + if (n->span) { + assert(NULL == p); + printf("tbl: "); + for (dp = n->span->first; dp; dp = dp->next) { + printf("[%s]", dp->string); + if (dp->next) + putchar(' '); + } + } else { + printf("%s (%s)", p, t); + + for (i = 0; i < (int)argc; i++) { + printf(" -%s", mdoc_argnames[argv[i].arg]); + if (argv[i].sz > 0) + printf(" ["); + for (j = 0; j < (int)argv[i].sz; j++) + printf(" [%s]", argv[i].value[j]); + if (argv[i].sz > 0) + printf(" ]"); + } + + for (i = 0; i < (int)sz; i++) + printf(" [%s]", params[i]); - for (i = 0; i < (int)sz; i++) - (void)printf(" [%s]", params[i]); + printf(" %d:%d", n->line, n->pos); + } - (void)printf(" %d:%d\n", n->line, n->pos); + putchar('\n'); if (n->child) print_mdoc(n->child, indent + 1); @@ -165,6 +180,7 @@ print_man(const struct man_node *n, int { const char *p, *t; int i; + const struct tbl_dat *dp; switch (n->type) { case (MAN_ROOT): @@ -193,6 +209,8 @@ print_man(const struct man_node *n, int /* NOTREACHED */ } + p = NULL; + switch (n->type) { case (MAN_TEXT): p = n->string; @@ -210,7 +228,6 @@ print_man(const struct man_node *n, int p = "root"; break; case (MAN_TBL): - p = "tbl"; break; default: abort(); @@ -218,8 +235,19 @@ print_man(const struct man_node *n, int } for (i = 0; i < indent; i++) - (void)printf(" "); - (void)printf("%s (%s) %d:%d\n", p, t, n->line, n->pos); + putchar('\t'); + + if (n->span) { + assert(NULL == p); + for (dp = n->span->first; dp; dp = dp->next) { + printf("tbl: [%s]", dp->string); + if (dp->next) + putchar(' '); + } + } else + printf("%s (%s) %d:%d", p, t, n->line, n->pos); + + putchar('\n'); if (n->child) print_man(n->child, indent + 1); -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv