4 #include <data/data-in.h>
5 #include <data/data-out.h>
6 #include <libpspp/message.h>
8 #include <libpspp/i18n.h>
12 #include <data/settings.h>
14 /* Formats a value according to FORMAT
15 The returned string must be freed when no longer required */
17 value_to_text (union value v, struct fmt_spec format)
21 s = g_new (gchar, format.w + 1);
22 data_out (&v, &format, s);
32 text_to_value (const gchar *text, union value *v,
33 struct fmt_spec format)
37 if ( format.type != FMT_A)
39 if ( ! text ) return FALSE;
42 const gchar *s = text;
50 if ( !*s) return FALSE;
55 ok = data_in (ss_cstr (text), format.type, 0, 0,
56 v, fmt_var_width (&format));
64 get_widget_assert (GladeXML *xml, const gchar *name)
70 w = glade_xml_get_widget (xml, name);
73 g_warning ("Widget \"%s\" could not be found\n", name);
78 /* Converts a string in the pspp locale to utf-8 */
80 pspp_locale_to_utf8 (const gchar *text, gssize len, GError **err)
82 return recode_string (CONV_PSPP_TO_UTF8, text, len);