=================================================================== RCS file: /cvs/mandoc/tree.c,v retrieving revision 1.38 retrieving revision 1.47 diff -u -p -r1.38 -r1.47 --- mandoc/tree.c 2011/07/21 11:34:53 1.38 +++ mandoc/tree.c 2011/09/18 14:14:15 1.47 @@ -1,6 +1,6 @@ -/* $Id: tree.c,v 1.38 2011/07/21 11:34:53 kristaps Exp $ */ +/* $Id: tree.c,v 1.47 2011/09/18 14:14:15 schwarze Exp $ */ /* - * Copyright (c) 2008, 2009 Kristaps Dzonsons + * Copyright (c) 2008, 2009, 2011 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -19,6 +19,7 @@ #endif #include +#include #include #include #include @@ -262,24 +263,42 @@ static void print_box(const struct eqn_box *ep, int indent) { int i; + const char *t; if (NULL == ep) return; for (i = 0; i < indent; i++) putchar('\t'); + t = NULL; switch (ep->type) { case (EQN_ROOT): - puts("eqn-root"); - print_box(ep->child, indent + 1); - return; + t = "eqn-root"; + break; + case (EQN_LIST): + t = "eqn-list"; + break; + case (EQN_SUBEXPR): + t = "eqn-expr"; + break; case (EQN_TEXT): - printf("eqn-text: [%s]\n", ep->text); - print_box(ep->next, indent); - return; - default: + t = "eqn-text"; break; + case (EQN_MATRIX): + t = "eqn-matrix"; + break; } + + assert(t); + printf("%s(%d, %d, %d, %d, %d, \"%s\", \"%s\") %s\n", + t, EQN_DEFSIZE == ep->size ? 0 : ep->size, + ep->pos, ep->font, ep->mark, ep->pile, + ep->left ? ep->left : "", + ep->right ? ep->right : "", + ep->text ? ep->text : ""); + + print_box(ep->first, indent + 1); + print_box(ep->next, indent); } static void