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 di.e = text + strlen(text);
55 di.flags = DI_IGNORE_ERROR;
65 get_widget_assert(GladeXML *xml, const gchar *name)
71 w = glade_xml_get_widget(xml, name);
74 g_warning("Widget \"%s\" could not be found\n", name);
79 /* Converts a string in the pspp locale to utf-8 */
81 pspp_locale_to_utf8(const gchar *text, gssize len, GError **err)
83 return recode_string(CONV_PSPP_TO_UTF8, text, len);