2 #include <data/data-in.h>
3 #include <data/data-out.h>
4 #include <libpspp/message.h>
6 #include <libpspp/i18n.h>
10 #include <data/settings.h>
12 /* Formats a value according to FORMAT
13 The returned string must be freed when no longer required */
15 value_to_text(union value v, struct fmt_spec format)
19 s = g_new(gchar, format.w + 1);
20 data_out(&v, &format, s);
30 text_to_value(const gchar *text, union value *v,
31 struct fmt_spec format)
35 if ( format.type != FMT_A)
37 if ( ! text ) return FALSE;
40 const gchar *s = text;
48 if ( !*s) return FALSE;
53 ok = data_in (ss_cstr (text), format.type, 0, 0,
54 v, fmt_var_width (&format));
62 get_widget_assert(GladeXML *xml, const gchar *name)
68 w = glade_xml_get_widget(xml, name);
71 g_warning("Widget \"%s\" could not be found\n", name);
76 /* Converts a string in the pspp locale to utf-8 */
78 pspp_locale_to_utf8(const gchar *text, gssize len, GError **err)
80 return recode_string(CONV_PSPP_TO_UTF8, text, len);