2 #include <data/data-in.h>
3 #include <libpspp/message.h>
5 #include <libpspp/i18n.h>
9 #include <data/settings.h>
11 /* Formats a value according to FORMAT
12 The returned string must be freed when no longer required */
14 value_to_text(union value v, struct fmt_spec format)
18 s = g_new(gchar, format.w + 1);
19 if ( ! data_out(s, &format, &v) )
21 g_warning("Can't format missing discrete value \n");
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 di.e = text + strlen(text);
57 di.flags = DI_IGNORE_ERROR;
67 get_widget_assert(GladeXML *xml, const gchar *name)
73 w = glade_xml_get_widget(xml, name);
76 g_warning("Widget \"%s\" could not be found\n", name);
81 /* Converts a string in the pspp locale to utf-8 */
83 pspp_locale_to_utf8(const gchar *text, gssize len, GError **err)
85 return recode_string(CONV_PSPP_TO_UTF8, text, len);