From 7b043a3bdd0a3f24e5836f25de51cd17ce6ff255 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Tue, 20 Oct 2009 19:27:54 +0200 Subject: [PATCH] Allow dump function to work with numeric variables --- src/math/categoricals.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/math/categoricals.c b/src/math/categoricals.c index 033b6a18..b57851d3 100644 --- a/src/math/categoricals.c +++ b/src/math/categoricals.c @@ -27,6 +27,7 @@ #include #include +#include struct value_node { @@ -104,16 +105,25 @@ categoricals_dump (const struct categoricals *cat) printf ("Reverse map\n"); for (x = 0 ; x < vp->n_cats; ++x) { + struct string s; const struct value_node *vn = vp->reverse_value_map[x]; - printf ("Value for %d is %s\n", x, value_str (&vn->value, width)); + ds_init_empty (&s); + var_append_value_name (cat->vars[v], &vn->value, &s); + printf ("Value for %d is %s\n", x, ds_cstr(&s)); + ds_destroy (&s); } printf ("\nForward map\n"); for (node = hmap_first (m); node; node = hmap_next (m, node)) { + struct string s; + ds_init_empty (&s); const struct value_node *vn = HMAP_DATA (node, struct value_node, node); + var_append_value_name (cat->vars[v], &vn->value, &s); printf ("Value: %s; Index %d; CC %g\n", - value_str (&vn->value, width), vn->subscript, vn->cc); + ds_cstr (&s), + vn->subscript, vn->cc); + ds_destroy (&s); } } } -- 2.30.2