added .gitattributes file such that lexer.at shows diff
[pspp] / src / ui / gui / psppire-data-store.c
index 012c010fe61ad7b6a1b7b5df417a78e1e48545ec..c0fc42a2f285a87ff32a5da5a9e3d1595990a621 100644 (file)
@@ -155,9 +155,20 @@ psppire_data_store_string_to_value (GtkTreeModel *model, gint col, gint row,
 
   union value val;
   value_init (&val, width);
-  char *xx =
-    data_in (ss_cstr (in), psppire_dict_encoding (store->dict),
-            fmt->type, &val, width, "UTF-8");
+  const struct val_labs *value_labels = var_get_value_labels (variable);
+  const union value *vp = NULL;
+  if (value_labels)
+    {
+      vp = val_labs_find_value (value_labels, in);
+      if (vp)
+       value_copy (&val, vp, width);
+    }
+  char *xx = NULL;
+  if (vp == NULL)
+    {
+      xx = data_in (ss_cstr (in), psppire_dict_encoding (store->dict),
+                   fmt->type, &val, width, "UTF-8");
+    }
 
   GVariant *vrnt = value_variant_new (&val, width);
   value_destroy (&val, width);
@@ -171,8 +182,12 @@ psppire_data_store_string_to_value (GtkTreeModel *model, gint col, gint row,
 static char *
 unlabeled_value (PsppireDataStore *store, const struct variable *variable, const union value *val)
 {
+  if (var_is_numeric (variable) &&
+      var_is_value_missing (variable, val, MV_SYSTEM))
+    return g_strdup ("");
+
   const struct fmt_spec *fmt = var_get_print_format (variable);
-  return data_out (val, psppire_dict_encoding (store->dict),  fmt);
+  return value_to_text__ (*val, fmt, psppire_dict_encoding (store->dict));
 }
 
 gchar *