summaryrefslogtreecommitdiffstats
path: root/tree.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-07-23 12:01:54 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-07-23 12:01:54 +0000
commit581b17ce0c02a39a5fd6e297867f2ade9b2f3c63 (patch)
treecef51f2be08f7d2ae3a32b594b759ec0f7b63f7e /tree.c
parent2252d1a2cee8d276065b3b219c4566d375827af8 (diff)
downloadmandoc-581b17ce0c02a39a5fd6e297867f2ade9b2f3c63.tar.gz
Add matrix support. Also remove "above" notion, as all elements in a
list are delimited by their "aboveness" and it's superfluous.
Diffstat (limited to 'tree.c')
-rw-r--r--tree.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/tree.c b/tree.c
index 866e282a..a32ac253 100644
--- a/tree.c
+++ b/tree.c
@@ -263,46 +263,41 @@ 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):
- printf("eqn-root(%d, %d, %d, %d)\n",
- EQN_DEFSIZE == ep->size ? 0 : ep->size,
- ep->pos, ep->font, ep->mark);
- print_box(ep->first, indent + 1);
+ t = "eqn-root";
break;
case (EQN_LIST):
- printf("eqn-list(%d, %d, %d, %d, %d, %d, \"%s\", \"%s\")\n",
- EQN_DEFSIZE == ep->size ? 0 : ep->size,
- ep->pos, ep->font, ep->mark,
- ep->pile, ep->above,
- ep->left ? ep->left : "",
- ep->right ? ep->right : "");
- print_box(ep->first, indent + 1);
+ t = "eqn-list";
break;
case (EQN_SUBEXPR):
- printf("eqn-subxpr(%d, %d, %d, %d, %d, %d, \"%s\", \"%s\")\n",
- EQN_DEFSIZE == ep->size ? 0 : ep->size,
- ep->pos, ep->font, ep->mark,
- ep->pile, ep->above,
- ep->left ? ep->left : "",
- ep->right ? ep->right : "");
- print_box(ep->first, indent + 1);
+ t = "eqn-expr";
break;
case (EQN_TEXT):
- printf("eqn-text(%d, %d, %d, %d): [%s]\n",
- EQN_DEFSIZE == ep->size ? 0 : ep->size,
- ep->pos, ep->font, ep->mark, ep->text);
+ t = "eqn-text";
break;
- default:
+ 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);
}