2 #include "var-display.h"
4 #include <data/variable.h>
5 #include <data/format.h>
7 #include "psppire-dict.h"
10 #define _(msgid) gettext (msgid)
11 #define N_(msgid) msgid
14 #include <libpspp/i18n.h>
16 static const gchar none[] = N_("None");
20 missing_values_to_string (const PsppireDict *dict, const struct variable *pv, GError **err)
23 const struct missing_values *miss = var_get_missing_values (pv);
24 if ( mv_is_empty (miss))
25 return xstrdup (gettext (none));
28 if ( ! mv_has_range (miss))
30 GString *gstr = g_string_sized_new (10);
31 const int n = mv_n_values (miss);
32 gchar *mv[4] = {0,0,0,0};
34 for (i = 0 ; i < n; ++i )
36 mv[i] = value_to_text (*mv_get_value (miss, i), pv);
38 g_string_append (gstr, ", ");
39 g_string_append (gstr, mv[i]);
43 g_string_free (gstr, FALSE);
47 GString *gstr = g_string_sized_new (10);
49 union value low, high;
50 mv_get_range (miss, &low.f, &high.f);
52 l = value_to_text (low, pv);
53 h = value_to_text (high, pv);
55 g_string_printf (gstr, "%s - %s", l, h);
59 if ( mv_has_value (miss))
63 ss = value_to_text (*mv_get_value (miss, 0), pv);
65 g_string_append (gstr, ", ");
66 g_string_append (gstr, ss);
70 g_string_free (gstr, FALSE);