From 319ecfbbfaef23a807ac0d2cba59afe223754ad0 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 6 Jun 2019 06:42:31 +0900 Subject: [PATCH] Create a usable dot for vector expressions It leaves a lot to be desired, but it beats "FIXME". --- tools/qfcc/source/dot_expr.c | 37 +++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/tools/qfcc/source/dot_expr.c b/tools/qfcc/source/dot_expr.c index 191c8208d..175b8c800 100644 --- a/tools/qfcc/source/dot_expr.c +++ b/tools/qfcc/source/dot_expr.c @@ -367,7 +367,42 @@ print_vector (dstring_t *dstr, expr_t *e, int level, int id, expr_t *next) { int indent = level * 2 + 2; - dasprintf (dstr, "%*se_%p [label=\"vector FIXME\"];\n", indent, "", e); + if (e->e.vector.type == &type_vector) { + expr_t *x = e->e.vector.list; + expr_t *y = x->next; + expr_t *z = y->next; + _print_expr (dstr, x, level, id, next); + _print_expr (dstr, y, level, id, next); + _print_expr (dstr, z, level, id, next); + dasprintf (dstr, "%*se_%p -> \"e_%p\";\n", indent, "", e, x); + dasprintf (dstr, "%*se_%p -> \"e_%p\";\n", indent, "", e, y); + dasprintf (dstr, "%*se_%p -> \"e_%p\";\n", indent, "", e, z); + } + if (e->e.vector.type == &type_quaternion) { + if (e->e.vector.list->next->next) { + expr_t *x = e->e.vector.list; + expr_t *y = x->next; + expr_t *z = y->next; + expr_t *w = z->next; + _print_expr (dstr, x, level, id, next); + _print_expr (dstr, y, level, id, next); + _print_expr (dstr, z, level, id, next); + _print_expr (dstr, w, level, id, next); + dasprintf (dstr, "%*se_%p -> \"e_%p\";\n", indent, "", e, x); + dasprintf (dstr, "%*se_%p -> \"e_%p\";\n", indent, "", e, y); + dasprintf (dstr, "%*se_%p -> \"e_%p\";\n", indent, "", e, z); + dasprintf (dstr, "%*se_%p -> \"e_%p\";\n", indent, "", e, w); + } else { + expr_t *v = e->e.vector.list; + expr_t *s = v->next; + _print_expr (dstr, v, level, id, next); + _print_expr (dstr, s, level, id, next); + dasprintf (dstr, "%*se_%p -> \"e_%p\";\n", indent, "", e, v); + dasprintf (dstr, "%*se_%p -> \"e_%p\";\n", indent, "", e, s); + } + } + dasprintf (dstr, "%*se_%p [label=\"vector %d\"];\n", indent, "", e, + e->line); } static void