=================================================================== RCS file: /cvs/mandoc/tree.c,v retrieving revision 1.53 retrieving revision 1.58 diff -u -p -r1.53 -r1.58 --- mandoc/tree.c 2014/07/02 07:10:38 1.53 +++ mandoc/tree.c 2014/10/10 15:26:29 1.58 @@ -1,6 +1,6 @@ -/* $Id: tree.c,v 1.53 2014/07/02 07:10:38 schwarze Exp $ */ +/* $Id: tree.c,v 1.58 2014/10/10 15:26:29 schwarze Exp $ */ /* - * Copyright (c) 2008, 2009, 2011 Kristaps Dzonsons + * Copyright (c) 2008, 2009, 2011, 2014 Kristaps Dzonsons * Copyright (c) 2013, 2014 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any @@ -15,10 +15,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif +#include + #include #include #include @@ -265,6 +265,11 @@ print_box(const struct eqn_box *ep, int indent) int i; const char *t; + static const char *posnames[] = { + NULL, "sup", "subsup", "sub", + "to", "from", "fromto", + "over", "sqrt", NULL }; + if (NULL == ep) return; for (i = 0; i < indent; i++) @@ -275,6 +280,7 @@ print_box(const struct eqn_box *ep, int indent) case EQN_ROOT: t = "eqn-root"; break; + case EQN_LISTONE: case EQN_LIST: t = "eqn-list"; break; @@ -284,18 +290,36 @@ print_box(const struct eqn_box *ep, int indent) case EQN_TEXT: t = "eqn-text"; break; + case EQN_PILE: + t = "eqn-pile"; + 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 + 1, ep->font, ep->mark, ep->pile, - ep->left ? ep->left : "", - ep->right ? ep->right : "", - ep->text ? ep->text : ""); + fputs(t, stdout); + if (ep->pos) + printf(" pos=%s", posnames[ep->pos]); + if (ep->left) + printf(" left=\"%s\"", ep->left); + if (ep->right) + printf(" right=\"%s\"", ep->right); + if (ep->top) + printf(" top=\"%s\"", ep->top); + if (ep->bottom) + printf(" bottom=\"%s\"", ep->bottom); + if (ep->text) + printf(" text=\"%s\"", ep->text); + if (ep->font) + printf(" font=%d", ep->font); + if (ep->size != EQN_DEFSIZE) + printf(" size=%d", ep->size); + if (ep->expectargs != UINT_MAX && ep->expectargs != ep->args) + printf(" badargs=%zu(%zu)", ep->args, ep->expectargs); + else if (ep->args) + printf(" args=%zu", ep->args); + putchar('\n'); print_box(ep->first, indent + 1); print_box(ep->next, indent);