2 PSPP - a program for statistical analysis.
3 Copyright (C) 2017 Free Software Foundation, Inc.
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "var-display.h"
22 #include <data/variable.h>
23 #include <data/format.h>
25 #include "psppire-dict.h"
28 #define _(msgid) gettext (msgid)
29 #define N_(msgid) msgid
32 #include <libpspp/i18n.h>
34 static const gchar none[] = N_("None");
38 missing_values_to_string (const struct variable *pv, GError **err)
41 const struct missing_values *miss = var_get_missing_values (pv);
42 if ( mv_is_empty (miss))
43 return xstrdup (gettext (none));
46 if ( ! mv_has_range (miss))
48 GString *gstr = g_string_sized_new (10);
49 const int n = mv_n_values (miss);
50 gchar *mv[4] = {0,0,0,0};
52 for (i = 0 ; i < n; ++i )
54 mv[i] = value_to_text (*mv_get_value (miss, i), pv);
56 g_string_append (gstr, ", ");
57 g_string_append (gstr, mv[i]);
61 g_string_free (gstr, FALSE);
65 GString *gstr = g_string_sized_new (10);
67 union value low, high;
68 mv_get_range (miss, &low.f, &high.f);
70 l = value_to_text (low, pv);
71 h = value_to_text (high, pv);
73 g_string_printf (gstr, "%s - %s", l, h);
77 if ( mv_has_value (miss))
81 ss = value_to_text (*mv_get_value (miss, 0), pv);
83 g_string_append (gstr, ", ");
84 g_string_append (gstr, ss);
88 g_string_free (gstr, FALSE);