SYSFILE INFO: Get rid of nested tables.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 2 Dec 2018 21:28:44 +0000 (13:28 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Mon, 3 Dec 2018 02:42:51 +0000 (18:42 -0800)
Nested tables aren't really necessary and make a number of things harder in
the output subsystem.  SYSFILE INFO and DISPLAY, which share code, were the
only code that used them, so this removes them from that code.

20 files changed:
perl-module/t/Pspp.t
src/language/dictionary/sys-file-info.c
tests/data/pc+-file-reader.at
tests/data/por-file.at
tests/data/sys-file-reader.at
tests/data/sys-file.at
tests/language/data-io/get-data-psql.at
tests/language/data-io/get-data-spreadsheet.at
tests/language/data-io/list.at
tests/language/data-io/matrix-data.at
tests/language/dictionary/attributes.at
tests/language/dictionary/formats.at
tests/language/dictionary/missing-values.at
tests/language/dictionary/sort-variables.at
tests/language/dictionary/sys-file-info.at
tests/language/dictionary/value-labels.at
tests/language/dictionary/variable-display.at
tests/language/stats/autorecode.at
tests/language/stats/rank.at
tests/perl-module.at

index c2c9dbde0aa3f8e0578f771b1114e9a61ad5e205..f7ff632cf78fdf4407a420a00db7293b62170b74 100644 (file)
@@ -175,9 +175,10 @@ sub run_pspp_syntax_cmp
        DISPLAY DOCUMENTS.
        LIST.
 SYNTAX
-Variable,Description,Position
-id,Format: F2.0,1
-name,Format: A20,2
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+id,1,,Scale,Input,8,Right,F2.0,F2.0,
+name,2,,Nominal,Input,20,Left,A20,A20,
 
 File label: This is the file label
 
@@ -243,27 +244,20 @@ RESULT
 GET FILE='$tempfile'.
 DISPLAY DICTIONARY.
 SYNTAX
-Variable,Description,Position
-integer,"Label: My Integer
-Format: F8.0
-Missing Values: 9; 99
-
-Value,Label
-0,Zero
-1,Unity
-2,Duality",1
-string,"Label: My String
-Format: A8
-Missing Values: ""this    ""; ""that    ""
-
-Value,Label
-xx      ,foo
-yy      ,bar",2
-longstring,"Label: My Long String
-Format: A9
-
-Value,Label
-xxx      ,xfoo",3
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+integer,1,My Integer,Scale,Input,8,Right,F8.0,F8.0,9; 99
+string,2,My String,Nominal,Input,8,Left,A8,A8,"""this    ""; ""that    """
+longstring,3,My Long String,Nominal,Input,9,Left,A9,A9,
+
+Table: Value Labels
+Variable,Value,Label
+integer,0,Zero
+,1,Unity
+,2,Duality
+string,xx      ,foo
+,yy      ,bar
+longstring,xxx      ,xfoo
 RESULT
 
   }
index ead50a6c6a0258f7951041658b86ae2a172ba270..b0c35ec0ce47f9b9206ce1cc2170c226d878e28e 100644 (file)
@@ -13,7 +13,6 @@
 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
-
 #include <config.h>
 
 #include <ctype.h>
@@ -47,6 +46,7 @@
 #include "output/text-item.h"
 #include "output/table-item.h"
 
+#include "gl/count-one-bits.h"
 #include "gl/localcharset.h"
 #include "gl/intprops.h"
 #include "gl/minmax.h"
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
+#define N_(msgid) (msgid)
 
 /* Information to include in displaying a dictionary. */
 enum
   {
-    DF_DICT_INDEX       = 1 << 0,
-    DF_FORMATS          = 1 << 1,
-    DF_VALUE_LABELS     = 1 << 2,
-    DF_VARIABLE_LABELS  = 1 << 3,
-    DF_MISSING_VALUES   = 1 << 4,
-    DF_AT_ATTRIBUTES    = 1 << 5, /* Attributes whose names begin with @. */
-    DF_ATTRIBUTES       = 1 << 6, /* All other attributes. */
-    DF_MEASURE          = 1 << 7,
-    DF_ROLE             = 1 << 8,
-    DF_ALIGNMENT        = 1 << 9,
-    DF_WIDTH            = 1 << 10,
-    DF_ALL              = (1 << 11) - 1
+    /* Variable table. */
+    DF_NAME              = 1 << 0,
+    DF_POSITION          = 1 << 1,
+    DF_LABEL             = 1 << 2,
+    DF_MEASUREMENT_LEVEL = 1 << 3,
+    DF_ROLE              = 1 << 4,
+    DF_WIDTH             = 1 << 5,
+    DF_ALIGNMENT         = 1 << 6,
+    DF_PRINT_FORMAT      = 1 << 7,
+    DF_WRITE_FORMAT      = 1 << 8,
+    DF_MISSING_VALUES    = 1 << 9,
+#define DF_ALL_VARIABLE ((1 << 10) - 1)
+
+    /* Value labels table. */
+    DF_VALUE_LABELS      = 1 << 10,
+
+    /* Attribute table. */
+    DF_AT_ATTRIBUTES     = 1 << 11, /* Attributes whose names begin with @. */
+    DF_ATTRIBUTES        = 1 << 12, /* All other attributes. */
   };
 
-static unsigned int dict_display_mask (const struct dictionary *);
-
-static struct table *describe_variable (const struct variable *v, int flags);
+static void display_variables (const struct variable **, size_t, int flags);
+static void display_value_labels (const struct variable **, size_t);
+static void display_attributes (const struct attrset *,
+                                const struct variable **, size_t, int flags);
 
 static void report_encodings (const struct file_handle *, struct pool *,
                               char **titles, bool *ids,
@@ -91,8 +100,7 @@ cmd_sysfile_info (struct lexer *lexer, struct dataset *ds UNUSED)
   struct casereader *reader;
   struct any_read_info info;
   char *encoding;
-  struct table *table;
-  int r, i;
+  int r;
 
   h = NULL;
   encoding = NULL;
@@ -235,20 +243,14 @@ cmd_sysfile_info (struct lexer *lexer, struct dataset *ds UNUSED)
 
   tab_submit (t);
 
-  t = tab_create (3, 1);
-  tab_headers (t, 0, 0, 1, 0);
-  tab_text (t, 0, 0, TAB_LEFT | TAT_TITLE, _("Variable"));
-  tab_text (t, 1, 0, TAB_LEFT | TAT_TITLE, _("Description"));
-  tab_text (t, 2, 0, TAB_LEFT | TAT_TITLE, _("Position"));
-  tab_hline (t, TAL_2, 0, 2, 1);
-
-  table = &t->table;
-  for (i = 0; i < dict_get_var_cnt (d); i++)
-    table = table_vpaste (table,
-                          describe_variable (dict_get_var (d, i),
-                                             DF_ALL & ~DF_AT_ATTRIBUTES));
-
-  table_item_submit (table_item_create (table, NULL /* XXX */, NULL));
+  size_t n_vars = dict_get_var_cnt (d);
+  const struct variable **vars = xnmalloc (n_vars, sizeof *vars);
+  for (size_t i = 0; i < dict_get_var_cnt (d); i++)
+    vars[i] = dict_get_var (d, i);
+  display_variables (vars, n_vars, DF_ALL_VARIABLE);
+  display_value_labels (vars, n_vars);
+  display_attributes (dict_get_attributes (dataset_dict (ds)),
+                      vars, n_vars, DF_ATTRIBUTES);
 
   dict_unref (d);
 
@@ -267,9 +269,7 @@ error:
 
 static void display_macros (void);
 static void display_documents (const struct dictionary *dict);
-static void display_variables (const struct variable **, size_t, int);
 static void display_vectors (const struct dictionary *dict, int sorted);
-static void display_data_file_attributes (struct attrset *, int flags);
 
 int
 cmd_display (struct lexer *lexer, struct dataset *ds)
@@ -310,7 +310,7 @@ cmd_display (struct lexer *lexer, struct dataset *ds)
       else if (lex_match_id (lexer, "SCRATCH"))
         {
           dict_get_vars (dataset_dict (ds), &vl, &n, DC_ORDINARY);
-          flags = 0;
+          flags = DF_NAME;
         }
       else
         {
@@ -323,13 +323,16 @@ cmd_display (struct lexer *lexer, struct dataset *ds)
             {
               {"@ATTRIBUTES", DF_ATTRIBUTES | DF_AT_ATTRIBUTES},
               {"ATTRIBUTES", DF_ATTRIBUTES},
-              {"DICTIONARY", DF_ALL & ~DF_AT_ATTRIBUTES},
-              {"INDEX", DF_DICT_INDEX},
-              {"LABELS", DF_DICT_INDEX | DF_VARIABLE_LABELS},
-              {"NAMES", 0},
-              {"VARIABLES",
-               DF_DICT_INDEX | DF_FORMATS | DF_MISSING_VALUES
-               | DF_MEASURE | DF_ROLE | DF_ALIGNMENT | DF_WIDTH},
+              {"DICTIONARY", (DF_NAME | DF_POSITION | DF_LABEL
+                              | DF_MEASUREMENT_LEVEL | DF_ROLE | DF_WIDTH
+                              | DF_ALIGNMENT | DF_PRINT_FORMAT
+                              | DF_WRITE_FORMAT | DF_MISSING_VALUES
+                              | DF_VALUE_LABELS)},
+              {"INDEX", DF_NAME | DF_POSITION},
+              {"LABELS", DF_NAME | DF_POSITION | DF_LABEL},
+              {"NAMES", DF_NAME},
+              {"VARIABLES", (DF_NAME | DF_POSITION | DF_PRINT_FORMAT
+                             | DF_WRITE_FORMAT | DF_MISSING_VALUES)},
               {NULL, 0},
             };
           const struct subcommand *sbc;
@@ -339,7 +342,7 @@ cmd_display (struct lexer *lexer, struct dataset *ds)
           for (sbc = subcommands; sbc->name != NULL; sbc++)
             if (lex_match_id (lexer, sbc->name))
               {
-                flags = sbc->flags & dict_display_mask (dict);
+                flags = sbc->flags;
                 break;
               }
 
@@ -361,19 +364,26 @@ cmd_display (struct lexer *lexer, struct dataset *ds)
 
       if (n > 0)
         {
-          sort (vl, n, sizeof *vl,
-                (sorted
-                 ? compare_var_ptrs_by_name
-                 : compare_var_ptrs_by_dict_index), NULL);
-          display_variables (vl, n, flags);
+          sort (vl, n, sizeof *vl, (sorted
+                                    ? compare_var_ptrs_by_name
+                                    : compare_var_ptrs_by_dict_index), NULL);
+
+          int variable_flags = flags & DF_ALL_VARIABLE;
+          if (variable_flags)
+            display_variables (vl, n, variable_flags);
+
+          if (flags & DF_VALUE_LABELS)
+            display_value_labels (vl, n);
+
+          int attribute_flags = flags & (DF_ATTRIBUTES | DF_AT_ATTRIBUTES);
+          if (attribute_flags)
+            display_attributes (dict_get_attributes (dataset_dict (ds)),
+                                vl, n, attribute_flags);
         }
       else
         msg (SW, _("No variables to display."));
-      free (vl);
 
-      if (flags & (DF_ATTRIBUTES | DF_AT_ATTRIBUTES))
-        display_data_file_attributes (dict_get_attributes (dataset_dict (ds)),
-                                      flags);
+      free (vl);
     }
 
   return CMD_SUCCESS;
@@ -404,53 +414,174 @@ display_documents (const struct dictionary *dict)
     }
 }
 
-static int
-count_columns (int flags)
+static void
+display_variables (const struct variable **vl, size_t n, int flags)
 {
-  int nc = 1;
-  if (flags & ~DF_DICT_INDEX)
-    nc++;
-  if (flags & DF_DICT_INDEX)
-    nc++;
+  int nc = count_one_bits (flags);
+  struct tab_table *t = tab_create (nc, n + 1);
+  tab_title (t, "%s", _("Variables"));
+  tab_headers (t, 0, 0, 1, 0);
+  tab_hline (t, TAL_2, 0, nc - 1, 1);
 
-  return nc;
-}
+  struct heading
+    {
+      int flag;
+      const char *title;
+    };
+  static const struct heading headings[] = {
+    { DF_NAME, N_("Name") },
+    { DF_POSITION, N_("Position") },
+    { DF_LABEL, N_("Label") },
+    { DF_MEASUREMENT_LEVEL, N_("Measurement Level") },
+    { DF_ROLE, N_("Role") },
+    { DF_WIDTH, N_("Width") },
+    { DF_ALIGNMENT, N_("Alignment") },
+    { DF_PRINT_FORMAT, N_("Print Format") },
+    { DF_WRITE_FORMAT, N_("Write Format") },
+    { DF_MISSING_VALUES, N_("Missing Values") },
+  };
+  for (size_t i = 0, x = 0; i < sizeof headings / sizeof *headings; i++)
+    if (flags & headings[i].flag)
+      tab_text (t, x++, 0, TAB_LEFT | TAT_TITLE, gettext (headings[i].title));
 
-static int
-position_column (int flags)
-{
-  int pc = 1;
-  if (flags & ~DF_DICT_INDEX)
-    pc++;
-  return pc;
+  for (size_t i = 0; i < n; i++)
+    {
+      const struct variable *v = vl[i];
+      size_t y = i + 1;
+      size_t x = 0;
+      if (flags & DF_NAME)
+        tab_text (t, x++, y, TAB_LEFT, var_get_name (v));
+      if (flags & DF_POSITION)
+        {
+          char s[INT_BUFSIZE_BOUND (size_t)];
+
+          sprintf (s, "%zu", var_get_dict_index (v) + 1);
+          tab_text (t, x++, y, TAB_LEFT, s);
+        }
+      if (flags & DF_LABEL)
+        {
+          const char *label = var_get_label (v);
+          if (label)
+            tab_text (t, x, y, TAB_LEFT, label);
+          x++;
+        }
+      if (flags & DF_MEASUREMENT_LEVEL)
+        tab_text (t, x++, y, TAB_LEFT,
+                  measure_to_string (var_get_measure (v)));
+      if (flags & DF_ROLE)
+        tab_text (t, x++, y, TAB_LEFT,
+                  var_role_to_string (var_get_role (v)));
+      if (flags & DF_WIDTH)
+        {
+          char s[INT_BUFSIZE_BOUND (int)];
+          sprintf (s, "%d", var_get_display_width (v));
+          tab_text (t, x++, y, TAB_RIGHT, s);
+        }
+      if (flags & DF_ALIGNMENT)
+        tab_text (t, x++, y, TAB_LEFT,
+                  alignment_to_string (var_get_alignment (v)));
+      if (flags & DF_PRINT_FORMAT)
+        {
+          const struct fmt_spec *print = var_get_print_format (v);
+          char s[FMT_STRING_LEN_MAX + 1];
+
+          tab_text (t, x++, y, TAB_LEFT, fmt_to_string (print, s));
+        }
+      if (flags & DF_WRITE_FORMAT)
+        {
+          const struct fmt_spec *write = var_get_write_format (v);
+          char s[FMT_STRING_LEN_MAX + 1];
+
+          tab_text (t, x++, y, TAB_LEFT, fmt_to_string (write, s));
+        }
+      if (flags & DF_MISSING_VALUES)
+        {
+          const struct missing_values *mv = var_get_missing_values (v);
+
+          struct string s = DS_EMPTY_INITIALIZER;
+          if (mv_has_range (mv))
+            {
+              double x, y;
+              mv_get_range (mv, &x, &y);
+              if (x == LOWEST)
+                ds_put_format (&s, "LOWEST THRU %.*g", DBL_DIG + 1, y);
+              else if (y == HIGHEST)
+                ds_put_format (&s, "%.*g THRU HIGHEST", DBL_DIG + 1, x);
+              else
+                ds_put_format (&s, "%.*g THRU %.*g",
+                               DBL_DIG + 1, x,
+                               DBL_DIG + 1, y);
+            }
+          for (size_t j = 0; j < mv_n_values (mv); j++)
+            {
+              const union value *value = mv_get_value (mv, j);
+              if (!ds_is_empty (&s))
+                ds_put_cstr (&s, "; ");
+              if (var_is_numeric (v))
+                ds_put_format (&s, "%.*g", DBL_DIG + 1, value->f);
+              else
+                {
+                  int width = var_get_width (v);
+                  int mv_width = MIN (width, MV_MAX_STRING);
+
+                  ds_put_byte (&s, '"');
+                  memcpy (ds_put_uninit (&s, mv_width),
+                          value_str (value, width), mv_width);
+                  ds_put_byte (&s, '"');
+                }
+            }
+          if (!ds_is_empty (&s))
+            tab_text (t, x, y, TAB_LEFT, ds_cstr (&s));
+          ds_destroy (&s);
+          x++;
+
+          assert (x == nc);
+        }
+    }
+
+  tab_submit (t);
 }
 
 static void
-display_variables (const struct variable **vl, size_t n, int flags)
+display_value_labels (const struct variable **vars, size_t n_vars)
 {
-  struct tab_table *t;
-  struct table *table;
-  size_t i;
-  int nc;
+  size_t n_value_labels = 0;
+  for (size_t i = 0; i < n_vars; i++)
+    n_value_labels += val_labs_count (var_get_value_labels (vars[i]));
+  if (!n_value_labels)
+    return;
 
-  nc = count_columns (flags);
-  t = tab_create (nc, 1);
+  struct tab_table *t = tab_create (3, n_value_labels + 1);
+  tab_title (t, "%s", _("Value Labels"));
   tab_headers (t, 0, 0, 1, 0);
-  tab_hline (t, TAL_2, 0, nc - 1, 1);
+  tab_hline (t, TAL_2, 0, 2, 1);
   tab_text (t, 0, 0, TAB_LEFT | TAT_TITLE, _("Variable"));
-  if (flags & ~DF_DICT_INDEX)
-    tab_text (t, 1, 0, TAB_LEFT | TAT_TITLE,
-              (flags & ~(DF_DICT_INDEX | DF_VARIABLE_LABELS)
-               ? _("Description") : _("Label")));
-  if (flags & DF_DICT_INDEX)
-    tab_text (t, position_column (flags), 0, TAB_LEFT | TAT_TITLE,
-              _("Position"));
-
-  table = &t->table;
-  for (i = 0; i < n; i++)
-    table = table_vpaste (table, describe_variable (vl[i], flags));
+  tab_text (t, 1, 0, TAB_LEFT | TAT_TITLE, _("Value"));
+  tab_text (t, 2, 0, TAB_LEFT | TAT_TITLE, _("Label"));
 
-  table_item_submit (table_item_create (table, NULL /* XXX */, NULL));
+  int y = 1;
+  for (size_t i = 0; i < n_vars; i++)
+    {
+      const struct val_labs *val_labs = var_get_value_labels (vars[i]);
+      size_t n_labels = val_labs_count (val_labs);
+      if (!n_labels)
+        continue;
+
+      tab_joint_text (t, 0, y, 0, y + (n_labels - 1), TAB_LEFT,
+                      var_get_name (vars[i]));
+
+      const struct val_lab **labels = val_labs_sorted (val_labs);
+      for (size_t j = 0; j < n_labels; j++)
+        {
+          const struct val_lab *vl = labels[j];
+
+          tab_value (t, 1, y, TAB_NONE, &vl->value, vars[i], NULL);
+          tab_text (t, 2, y, TAB_LEFT, val_lab_get_escaped_label (vl));
+          y++;
+        }
+      free (labels);
+    }
+  tab_submit (t);
 }
 \f
 static bool
@@ -474,229 +605,66 @@ count_attributes (const struct attrset *set, int flags)
   return n_attrs;
 }
 
-static struct table *
-describe_attributes (const struct attrset *set, int flags)
+static int
+display_attrset (const char *name, const struct attrset *set, int flags,
+                 struct tab_table *t, int y)
 {
-  struct attribute **attrs;
-  struct tab_table *t;
-  size_t n_attrs;
-  size_t i;
-  int r = 1;
+  size_t n_total = count_attributes (set, flags);
+  if (!n_total)
+    return y;
 
-  t = tab_create (2, 1 + count_attributes (set, flags));
-  tab_headers (t, 0, 0, 1, 0);
-  tab_box (t, TAL_1, TAL_1, -1, TAL_1, 0, 0, tab_nc (t) - 1, tab_nr (t) - 1);
-  tab_hline (t, TAL_1, 0, 1, 1);
-  tab_text (t, 0, 0, TAB_LEFT | TAT_TITLE, _("Attribute"));
-  tab_text (t, 1, 0, TAB_LEFT | TAT_TITLE, _("Value"));
+  tab_joint_text (t, 0, y, 0, y + (n_total - 1), TAB_LEFT, name);
 
-  n_attrs = attrset_count (set);
-  attrs = attrset_sorted (set);
-  for (i = 0; i < n_attrs; i++)
+  size_t n_attrs = attrset_count (set);
+  struct attribute **attrs = attrset_sorted (set);
+  for (size_t i = 0; i < n_attrs; i++)
     {
       const struct attribute *attr = attrs[i];
       const char *name = attribute_get_name (attr);
-      size_t n_values;
-      size_t j;
 
       if (!(flags & DF_AT_ATTRIBUTES) && is_at_name (name))
         continue;
 
-      n_values = attribute_get_n_values (attr);
-      for (j = 0; j < n_values; j++)
+      size_t n_values = attribute_get_n_values (attr);
+      for (size_t j = 0; j < n_values; j++)
         {
           if (n_values > 1)
-            tab_text_format (t, 0, r, TAB_LEFT, "%s[%zu]", name, j + 1);
+            tab_text_format (t, 1, y, TAB_LEFT, "%s[%zu]", name, j + 1);
           else
-            tab_text (t, 0, r, TAB_LEFT, name);
-          tab_text (t, 1, r, TAB_LEFT, attribute_get_value (attr, j));
-          r++;
+            tab_text (t, 1, y, TAB_LEFT, name);
+          tab_text (t, 2, y, TAB_LEFT, attribute_get_value (attr, j));
+          y++;
         }
     }
   free (attrs);
 
-  return &t->table;
+  return y;
 }
 
 static void
-display_data_file_attributes (struct attrset *set, int flags)
+display_attributes (const struct attrset *dict_attrset,
+                    const struct variable **vars, size_t n_vars, int flags)
 {
-  if (count_attributes (set, flags))
-    table_item_submit (table_item_create (describe_attributes (set, flags),
-                                          _("Custom data file attributes."),
-                                          NULL));
-}
-
-static struct table *
-describe_value_labels (const struct variable *var)
-{
-  const struct val_labs *val_labs = var_get_value_labels (var);
-  size_t n_labels = val_labs_count (val_labs);
-  const struct val_lab **labels;
-  struct tab_table *t;
-  size_t i;
-
-  t = tab_create (2, n_labels + 1);
-  tab_box (t, TAL_1, TAL_1, -1, TAL_1, 0, 0, tab_nc (t) - 1, tab_nr (t) - 1);
-
-  tab_text (t, 0, 0, TAB_LEFT | TAT_TITLE, _("Value"));
-  tab_text (t, 1, 0, TAB_LEFT | TAT_TITLE, _("Label"));
-
-  tab_hline (t, TAL_1, 0, 1, 1);
-  tab_vline (t, TAL_1, 1, 0, n_labels);
-
-  labels = val_labs_sorted (val_labs);
-  for (i = 0; i < n_labels; i++)
-    {
-      const struct val_lab *vl = labels[i];
-
-      tab_value (t, 0, i + 1, TAB_NONE, &vl->value, var, NULL);
-      tab_text (t, 1, i + 1, TAB_LEFT, val_lab_get_escaped_label (vl));
-    }
-  free (labels);
-
-  return &t->table;
-}
-
-static struct table *
-describe_variable_details (const struct variable *v, int flags)
-{
-  struct table *table;
-  struct string s;
-
-  ds_init_empty (&s);
-
-  /* Variable label. */
-  if (flags & DF_VARIABLE_LABELS && var_has_label (v))
-    {
-      if (flags & ~(DF_DICT_INDEX | DF_VARIABLE_LABELS))
-        ds_put_format (&s, _("Label: %s\n"), var_get_label (v));
-      else
-        ds_put_format (&s, "%s\n", var_get_label (v));
-    }
-
-  /* Print/write format, or print and write formats. */
-  if (flags & DF_FORMATS)
-    {
-      const struct fmt_spec *print = var_get_print_format (v);
-      const struct fmt_spec *write = var_get_write_format (v);
-      char str[FMT_STRING_LEN_MAX + 1];
-
-      if (fmt_equal (print, write))
-        ds_put_format (&s, _("Format: %s\n"), fmt_to_string (print, str));
-      else
-        {
-          ds_put_format (&s, _("Print Format: %s\n"),
-                         fmt_to_string (print, str));
-          ds_put_format (&s, _("Write Format: %s\n"),
-                         fmt_to_string (write, str));
-        }
-    }
-
-  /* Measurement level, role, display width, alignment. */
-  if (flags & DF_MEASURE)
-    ds_put_format (&s, _("Measure: %s\n"),
-                   measure_to_string (var_get_measure (v)));
-
-  if (flags & DF_ROLE)
-    ds_put_format (&s, _("Role: %s\n"), var_role_to_string (var_get_role (v)));
-
-
-  if (flags & DF_ALIGNMENT)
-    ds_put_format (&s, _("Display Alignment: %s\n"),
-                   alignment_to_string (var_get_alignment (v)));
-
-  if (flags & DF_WIDTH)
-    ds_put_format (&s, _("Display Width: %d\n"), var_get_display_width (v));
-
-  /* Missing values if any. */
-  if (flags & DF_MISSING_VALUES && var_has_missing_values (v))
-    {
-      const struct missing_values *mv = var_get_missing_values (v);
-      int cnt = 0;
-      int i;
-
-      ds_put_cstr (&s, _("Missing Values: "));
-
-      if (mv_has_range (mv))
-        {
-          double x, y;
-          mv_get_range (mv, &x, &y);
-          if (x == LOWEST)
-            ds_put_format (&s, "LOWEST THRU %.*g", DBL_DIG + 1, y);
-          else if (y == HIGHEST)
-            ds_put_format (&s, "%.*g THRU HIGHEST", DBL_DIG + 1, x);
-          else
-            ds_put_format (&s, "%.*g THRU %.*g",
-                           DBL_DIG + 1, x,
-                           DBL_DIG + 1, y);
-          cnt++;
-        }
-      for (i = 0; i < mv_n_values (mv); i++)
-        {
-          const union value *value = mv_get_value (mv, i);
-          if (cnt++ > 0)
-            ds_put_cstr (&s, "; ");
-          if (var_is_numeric (v))
-            ds_put_format (&s, "%.*g", DBL_DIG + 1, value->f);
-          else
-            {
-              int width = var_get_width (v);
-              int mv_width = MIN (width, MV_MAX_STRING);
-
-              ds_put_byte (&s, '"');
-              memcpy (ds_put_uninit (&s, mv_width),
-                      value_str (value, width), mv_width);
-              ds_put_byte (&s, '"');
-            }
-        }
-      ds_put_byte (&s, '\n');
-    }
-
-  ds_chomp_byte (&s, '\n');
-
-  table = (ds_is_empty (&s)
-           ? NULL
-           : table_from_string (TAB_LEFT, ds_cstr (&s)));
-  ds_destroy (&s);
-
-  /* Value labels. */
-  if (flags & DF_VALUE_LABELS && var_has_value_labels (v))
-    table = table_vpaste (table, table_create_nested (describe_value_labels (v)));
-
-  if (flags & (DF_ATTRIBUTES | DF_AT_ATTRIBUTES))
-    {
-      struct attrset *attrs = var_get_attributes (v);
-
-      if (count_attributes (attrs, flags))
-        table = table_vpaste (
-          table, table_create_nested (describe_attributes (attrs, flags)));
-    }
-
-  return table ? table : table_from_string (TAB_LEFT, "");
-}
-
-/* Puts a description of variable V into table T starting at row
-   R.  The variable will be described in the format given by
-   FLAGS.  Returns the next row available for use in the
-   table. */
-static struct table *
-describe_variable (const struct variable *v, int flags)
-{
-  struct table *table;
+  size_t n_attributes = count_attributes (dict_attrset, flags);
+  for (size_t i = 0; i < n_vars; i++)
+    n_attributes += count_attributes (var_get_attributes (vars[i]), flags);
+  if (!n_attributes)
+    return;
 
-  table = flags & ~DF_DICT_INDEX ? describe_variable_details (v, flags) : NULL;
-  table = table_hpaste (table_from_string (0, var_get_name (v)),
-                        table ? table_stomp (table) : NULL);
-  if (flags & DF_DICT_INDEX)
-    {
-      char s[INT_BUFSIZE_BOUND (size_t)];
+  struct tab_table *t = tab_create (3, n_attributes + 1);
+  tab_title (t, "%s", _("Variable and Dataset Attributes"));
+  tab_headers (t, 0, 0, 1, 0);
+  tab_hline (t, TAL_2, 0, 2, 1);
+  tab_text (t, 0, 0, TAB_LEFT | TAT_TITLE, _("Variable"));
+  tab_text (t, 1, 0, TAB_LEFT | TAT_TITLE, _("Name"));
+  tab_text (t, 2, 0, TAB_LEFT | TAT_TITLE, _("Value"));
 
-      sprintf (s, "%zu", var_get_dict_index (v) + 1);
-      table = table_hpaste (table, table_from_string (0, s));
-    }
+  int y = display_attrset (_("(dataset)"), dict_attrset, flags, t, 1);
+  for (size_t i = 0; i < n_vars; i++)
+    y = display_attrset (var_get_name (vars[i]), var_get_attributes (vars[i]),
+                         flags, t, y);
 
-  return table;
+  tab_submit (t);
 }
 
 /* Display a list of vectors.  If SORTED is nonzero then they are
@@ -1086,33 +1054,3 @@ report_encodings (const struct file_handle *h, struct pool *pool,
       }
   tab_submit (t);
 }
-
-static unsigned int
-dict_display_mask (const struct dictionary *d)
-{
-  size_t n_vars = dict_get_var_cnt (d);
-  unsigned int mask;
-  size_t i;
-
-  mask = DF_ALL & ~(DF_MEASURE | DF_ROLE | DF_ALIGNMENT | DF_WIDTH);
-  for (i = 0; i < n_vars; i++)
-    {
-      const struct variable *v = dict_get_var (d, i);
-      enum val_type val = var_get_type (v);
-      int width = var_get_width (v);
-
-      if (var_get_measure (v) != var_default_measure (val))
-        mask |= DF_MEASURE;
-
-      if (var_get_role (v) != ROLE_INPUT)
-        mask |= DF_ROLE;
-
-      if (var_get_alignment (v) != var_default_alignment (val))
-        mask |= DF_ALIGNMENT;
-
-      if (var_get_display_width (v) != var_default_display_width (width))
-        mask |= DF_WIDTH;
-    }
-
-  return mask;
-}
index 2e032cdfb6a46fecaf6ed169fdbc717aed9cbd82..44de36a7b00c161e803a2521d35cccfb2cdfc70c 100644 (file)
@@ -107,26 +107,18 @@ AT_CHECK([pspp -o pspp.csv pc+-file.sps])
 AT_CHECK([cat pspp.csv], [0], [dnl
 File label: PSPP synthetic test file
 
-Variable,Description,Position
-NUM1,Format: F8.0,1
-NUM2,"Label: Numeric variable 2's label
-Format: F8.0",2
-NUM3,"Format: F8.0
-Missing Values: 1",3
-NUM4,"Label: Another numeric variable label
-Format: F8.0
-Missing Values: 2",4
-STR1,Format: A8,5
-STR2,"Label: STR2's variable label
-Format: A4",6
-STR3,"Format: A5
-Missing Values: ""MISS """,7
-STR4,"Label: STR4's variable label
-Format: A1
-Missing Values: ""O""",8
-STR5,Format: A11,9
-STR6,"Label: Another string variable's label
-Format: A11",10
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+NUM1,1,,Scale,Input,8,Right,F8.0,F8.0,
+NUM2,2,Numeric variable 2's label,Scale,Input,8,Right,F8.0,F8.0,
+NUM3,3,,Scale,Input,8,Right,F8.0,F8.0,1
+NUM4,4,Another numeric variable label,Scale,Input,8,Right,F8.0,F8.0,2
+STR1,5,,Nominal,Input,8,Left,A8,A8,
+STR2,6,STR2's variable label,Nominal,Input,4,Left,A4,A4,
+STR3,7,,Nominal,Input,5,Left,A5,A5,"""MISS """
+STR4,8,STR4's variable label,Nominal,Input,1,Left,A1,A1,"""O"""
+STR5,9,,Nominal,Input,11,Left,A11,A11,
+STR6,10,Another string variable's label,Nominal,Input,11,Left,A11,A11,
 
 Table: Data List
 NUM1,NUM2,NUM3,NUM4,STR1,STR2,STR3,STR4,STR5,STR6
@@ -227,71 +219,49 @@ AT_CHECK([pspp -o pspp.csv pc+-file.sps])
 AT_CHECK([cat pspp.csv], [0], [dnl
 File label: PSPP synthetic test file
 
-Variable,Description,Position
-NUM1,"Format: F8.0
-
-Value,Label
-1,one",1
-NUM2,"Format: F8.0
-
-Value,Label
-2,two
-3,three",2
-NUM3,"Format: F8.0
-
-Value,Label
-3,three
-4,four",3
-NUM4,"Format: F8.0
-
-Value,Label
-4,four",4
-NUM5,"Format: F8.0
-
-Value,Label
-4,four
-5,five",5
-STR1,"Format: A1
-
-Value,Label
-a,value label for `a'",6
-STR2,"Format: A2
-
-Value,Label
-ab,value label for `ab'",7
-STR3,"Format: A3
-
-Value,Label
-abc,value label for `abc'",8
-STR4,"Format: A4
-
-Value,Label
-abcd,value label for abcdefgh",9
-STR5,"Format: A5
-
-Value,Label
-abcde,value label for abcdefgh
-ijklm,value label for ijklmnop",10
-STR6,"Format: A6
-
-Value,Label
-abcdef,value label for abcdefgh
-ijklmn,value label for ijklmnop
-qrstuv,value label for qrstuvwx",11
-STR7,"Format: A7
-
-Value,Label
-abcdefg,value label for abcdefgh
-ijklmno,value label for ijklmnop
-qrstuvw,value label for qrstuvwx
-yzABCDE,value label for yzABCDEF",12
-STR8,"Format: A8
-
-Value,Label
-GHIJKLMN,value label for GHIJKLMN
-ijklmnop,value label for ijklmnop
-qrstuvwx,value label for qrstuvwx
-yzABCDEF,value label for yzABCDEF",13
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+NUM1,1,,Scale,Input,8,Right,F8.0,F8.0,
+NUM2,2,,Scale,Input,8,Right,F8.0,F8.0,
+NUM3,3,,Scale,Input,8,Right,F8.0,F8.0,
+NUM4,4,,Scale,Input,8,Right,F8.0,F8.0,
+NUM5,5,,Scale,Input,8,Right,F8.0,F8.0,
+STR1,6,,Nominal,Input,1,Left,A1,A1,
+STR2,7,,Nominal,Input,2,Left,A2,A2,
+STR3,8,,Nominal,Input,3,Left,A3,A3,
+STR4,9,,Nominal,Input,4,Left,A4,A4,
+STR5,10,,Nominal,Input,5,Left,A5,A5,
+STR6,11,,Nominal,Input,6,Left,A6,A6,
+STR7,12,,Nominal,Input,7,Left,A7,A7,
+STR8,13,,Nominal,Input,8,Left,A8,A8,
+
+Table: Value Labels
+Variable,Value,Label
+NUM1,1,one
+NUM2,2,two
+,3,three
+NUM3,3,three
+,4,four
+NUM4,4,four
+NUM5,4,four
+,5,five
+STR1,a,value label for `a'
+STR2,ab,value label for `ab'
+STR3,abc,value label for `abc'
+STR4,abcd,value label for abcdefgh
+STR5,abcde,value label for abcdefgh
+,ijklm,value label for ijklmnop
+STR6,abcdef,value label for abcdefgh
+,ijklmn,value label for ijklmnop
+,qrstuv,value label for qrstuvwx
+STR7,abcdefg,value label for abcdefgh
+,ijklmno,value label for ijklmnop
+,qrstuvw,value label for qrstuvwx
+,yzABCDE,value label for yzABCDEF
+STR8,GHIJKLMN,value label for GHIJKLMN
+,ijklmnop,value label for ijklmnop
+,qrstuvwx,value label for qrstuvwx
+,yzABCDEF,value label for yzABCDEF
 
 Table: Data List
 NUM1,NUM2,NUM3,NUM4,NUM5,STR1,STR2,STR3,STR4,STR5,STR6,STR7,STR8
@@ -362,12 +332,13 @@ AT_CHECK([pspp -o pspp.csv pc+-file.sps])
 AT_CHECK([cat pspp.csv], [0], [dnl
 File label: PSPP synthetic test file
 
-Variable,Description,Position
-NUM1,Format: F8.0,1
-NUM2,Format: F8.0,2
-STR4,Format: A4,3
-STR8,Format: A8,4
-STR15,Format: A15,5
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+NUM1,1,,Scale,Input,8,Right,F8.0,F8.0,
+NUM2,2,,Scale,Input,8,Right,F8.0,F8.0,
+STR4,3,,Nominal,Input,4,Left,A4,A4,
+STR8,4,,Nominal,Input,8,Left,A8,A8,
+STR15,5,,Nominal,Input,15,Left,A15,A15,
 
 Table: Data List
 NUM1,NUM2,STR4,STR8,STR15
@@ -436,27 +407,12 @@ Weight:,NUM3
 Compression:,None
 Encoding:,us-ascii
 
-Variable,Description,Position
-NUM1,"Format: F8.0
-Measure: Scale
-Role: Input
-Display Alignment: Right
-Display Width: 8",1
-NUM2,"Format: F8.0
-Measure: Scale
-Role: Input
-Display Alignment: Right
-Display Width: 8",2
-NUM3,"Format: F8.0
-Measure: Scale
-Role: Input
-Display Alignment: Right
-Display Width: 8",3
-NUM4,"Format: F8.0
-Measure: Scale
-Role: Input
-Display Alignment: Right
-Display Width: 8",4
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+NUM1,1,,Scale,Input,8,Right,F8.0,F8.0,
+NUM2,2,,Scale,Input,8,Right,F8.0,F8.0,
+NUM3,3,,Scale,Input,8,Right,F8.0,F8.0,
+NUM4,4,,Scale,Input,8,Right,F8.0,F8.0,
 ])
 AT_CLEANUP
 \f
@@ -520,11 +476,12 @@ AT_CHECK([sed 's/default encoding.*For/default encoding.  For/' stdout], [0], [d
 
 File label: PSPP synthetic test file
 
-Variable,Description,Position
-NUM1,Format: F8.0,1
-NUM2,Format: F8.0,2
-NUM3,Format: F8.0,3
-NUM4,Format: F8.0,4
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+NUM1,1,,Scale,Input,8,Right,F8.0,F8.0,
+NUM2,2,,Scale,Input,8,Right,F8.0,F8.0,
+NUM3,3,,Scale,Input,8,Right,F8.0,F8.0,
+NUM4,4,,Scale,Input,8,Right,F8.0,F8.0,
 
 Table: Data List
 NUM1,NUM2,NUM3,NUM4
@@ -542,27 +499,12 @@ Weight:,Not weighted.
 Compression:,None
 Encoding:,us-ascii
 
-Variable,Description,Position
-NUM1,"Format: F8.0
-Measure: Scale
-Role: Input
-Display Alignment: Right
-Display Width: 8",1
-NUM2,"Format: F8.0
-Measure: Scale
-Role: Input
-Display Alignment: Right
-Display Width: 8",2
-NUM3,"Format: F8.0
-Measure: Scale
-Role: Input
-Display Alignment: Right
-Display Width: 8",3
-NUM4,"Format: F8.0
-Measure: Scale
-Role: Input
-Display Alignment: Right
-Display Width: 8",4
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+NUM1,1,,Scale,Input,8,Right,F8.0,F8.0,
+NUM2,2,,Scale,Input,8,Right,F8.0,F8.0,
+NUM3,3,,Scale,Input,8,Right,F8.0,F8.0,
+NUM4,4,,Scale,Input,8,Right,F8.0,F8.0,
 ])
 AT_CLEANUP
 
@@ -1300,12 +1242,13 @@ LIST.
 AT_CHECK([pspp -O format=csv pc+-file.sps], [0], [dnl
 File label: PSPP synthetic test file
 
-Variable,Description,Position
-NUM1,Format: F8.0,1
-NUM2,Format: F8.0,2
-STR4,Format: A4,3
-STR8,Format: A8,4
-STR15,Format: A15,5
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+NUM1,1,,Scale,Input,8,Right,F8.0,F8.0,
+NUM2,2,,Scale,Input,8,Right,F8.0,F8.0,
+STR4,3,,Nominal,Input,4,Left,A4,A4,
+STR8,4,,Nominal,Input,8,Left,A8,A8,
+STR15,5,,Nominal,Input,15,Left,A15,A15,
 
 warning: `pc+-file.sav' near offset 0x308: Possible compressed data corruption: string contains compressed integer (opcode 101).
 
index d7ba8048650e9d3f382ab87f906424bc72185cfc..3139bbf490e305b9ee5151c60a96d34b2aa34228 100644 (file)
@@ -104,27 +104,21 @@ DISPLAY DICTIONARY.
 LIST.
 ])
 AT_CHECK([pspp -O format=csv import.sps], [0], [dnl
-Variable,Description,Position
-VAR1,"Format: F1.0
-
-Value,Label
-1,one",1
-VAR2,"Format: F1.0
-
-Value,Label
-2,two",2
-VAR3,"Format: F1.0
-
-Value,Label
-3,three",3
-VAR4,"Format: F1.0
-
-Value,Label
-4,four",4
-VAR5,"Format: F1.0
-
-Value,Label
-5,five",5
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+VAR1,1,,Scale,Input,8,Right,F1.0,F1.0,
+VAR2,2,,Scale,Input,8,Right,F1.0,F1.0,
+VAR3,3,,Scale,Input,8,Right,F1.0,F1.0,
+VAR4,4,,Scale,Input,8,Right,F1.0,F1.0,
+VAR5,5,,Scale,Input,8,Right,F1.0,F1.0,
+
+Table: Value Labels
+Variable,Value,Label
+VAR1,1,one
+VAR2,2,two
+VAR3,3,three
+VAR4,4,four
+VAR5,5,five
 
 Table: Data List
 VAR1,VAR2,VAR3,VAR4,VAR5
@@ -146,46 +140,20 @@ Type:,SPSS Portable File
 Weight:,Not weighted.
 Compression:,None
 
-Variable,Description,Position
-VAR1,"Format: F1.0
-Measure: Scale
-Role: Input
-Display Alignment: Right
-Display Width: 8
-
-Value,Label
-1,one",1
-VAR2,"Format: F1.0
-Measure: Scale
-Role: Input
-Display Alignment: Right
-Display Width: 8
-
-Value,Label
-2,two",2
-VAR3,"Format: F1.0
-Measure: Scale
-Role: Input
-Display Alignment: Right
-Display Width: 8
-
-Value,Label
-3,three",3
-VAR4,"Format: F1.0
-Measure: Scale
-Role: Input
-Display Alignment: Right
-Display Width: 8
-
-Value,Label
-4,four",4
-VAR5,"Format: F1.0
-Measure: Scale
-Role: Input
-Display Alignment: Right
-Display Width: 8
-
-Value,Label
-5,five",5
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+VAR1,1,,Scale,Input,8,Right,F1.0,F1.0,
+VAR2,2,,Scale,Input,8,Right,F1.0,F1.0,
+VAR3,3,,Scale,Input,8,Right,F1.0,F1.0,
+VAR4,4,,Scale,Input,8,Right,F1.0,F1.0,
+VAR5,5,,Scale,Input,8,Right,F1.0,F1.0,
+
+Table: Value Labels
+Variable,Value,Label
+VAR1,1,one
+VAR2,2,two
+VAR3,3,three
+VAR4,4,four
+VAR5,5,five
 ])
 AT_CLEANUP
index b8cd4a2650dbc1c2ec2b712a35353b822484cdfc..afe3bff3b5d87195ebad697c8d048706bcb0445c 100644 (file)
@@ -149,49 +149,29 @@ LIST.
   AT_CHECK([cat pspp.csv], [0], [dnl
 File label: PSPP synthetic test file: Ã´ÃµÃ¶Ã¸
 
-Variable,Description,Position
-num1,Format: F8.0,1
-num2,"Label: Numeric variable 2's label (ùúû)
-Format: F8.0",2
-num3,"Format: F8.0
-Missing Values: 1",3
-num4,"Label: Another numeric variable label
-Format: F8.0
-Missing Values: 1",4
-num5,"Format: F8.0
-Missing Values: 1; 2",5
-num6,"Format: F8.0
-Missing Values: 1; 2; 3",6
-num7,"Format: F8.0
-Missing Values: 1 THRU 3",7
-num8,"Format: F8.0
-Missing Values: 1 THRU 3; 5",8
-num9,"Format: F8.0
-Missing Values: 1 THRU HIGHEST; -5",9
-numàèìñò,"Format: F8.0
-Missing Values: LOWEST THRU 1; 5",10
-str1,Format: A4,11
-str2,"Label: String variable 2's label
-Format: A4",12
-str3,"Format: A4
-Missing Values: ""MISS""",13
-str4,"Label: Another string variable label
-Format: A4
-Missing Values: ""OTHR""",14
-str5,"Format: A4
-Missing Values: ""MISS""; ""OTHR""",15
-str6,"Format: A4
-Missing Values: ""MISS""; ""OTHR""; ""MORE""",16
-str7,"Format: A11
-Missing Values: ""first8by""",17
-str8,"Format: A9
-Missing Values: ""abcdefgh""",18
-str9,"Format: A10
-Missing Values: ""abcdefgh""; ""01234567""",19
-str10,"Format: A11
-Missing Values: ""abcdefgh""; ""01234567""; ""0       """,20
-str11,"Label: 25-byte string
-Format: A25",21
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+num1,1,,Scale,Input,8,Right,F8.0,F8.0,
+num2,2,Numeric variable 2's label (ùúû),Scale,Input,8,Right,F8.0,F8.0,
+num3,3,,Scale,Input,8,Right,F8.0,F8.0,1
+num4,4,Another numeric variable label,Scale,Input,8,Right,F8.0,F8.0,1
+num5,5,,Scale,Input,8,Right,F8.0,F8.0,1; 2
+num6,6,,Scale,Input,8,Right,F8.0,F8.0,1; 2; 3
+num7,7,,Scale,Input,8,Right,F8.0,F8.0,1 THRU 3
+num8,8,,Scale,Input,8,Right,F8.0,F8.0,1 THRU 3; 5
+num9,9,,Scale,Input,8,Right,F8.0,F8.0,1 THRU HIGHEST; -5
+numàèìñò,10,,Scale,Input,8,Right,F8.0,F8.0,LOWEST THRU 1; 5
+str1,11,,Nominal,Input,4,Left,A4,A4,
+str2,12,String variable 2's label,Nominal,Input,4,Left,A4,A4,
+str3,13,,Nominal,Input,4,Left,A4,A4,"""MISS"""
+str4,14,Another string variable label,Nominal,Input,4,Left,A4,A4,"""OTHR"""
+str5,15,,Nominal,Input,4,Left,A4,A4,"""MISS""; ""OTHR"""
+str6,16,,Nominal,Input,4,Left,A4,A4,"""MISS""; ""OTHR""; ""MORE"""
+str7,17,,Nominal,Input,11,Left,A11,A11,"""first8by"""
+str8,18,,Nominal,Input,9,Left,A9,A9,"""abcdefgh"""
+str9,19,,Nominal,Input,10,Left,A10,A10,"""abcdefgh""; ""01234567"""
+str10,20,,Nominal,Input,11,Left,A11,A11,"""abcdefgh""; ""01234567""; ""0       """
+str11,21,25-byte string,Nominal,Input,25,Left,A25,A25,
 
 Table: Data List
 num1,num2,num3,num4,num5,num6,num7,num8,num9,numàèìñò,str1,str2,str3,str4,str5,str6,str7,str8,str9,str10,str11
@@ -239,10 +219,10 @@ LIST.
 ])
   AT_CHECK([pspp -o pspp.csv sys-file.sps])
   AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,Position
-num1,Format: F8.0,1
-num2,"Label: Numeric variable 2's label
-Format: F8.0",2
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+num1,1,,Scale,Input,8,Right,F8.0,F8.0,
+num2,2,Numeric variable 2's label,Scale,Input,8,Right,F8.0,F8.0,
 
 Table: Data List
 num1,num2
@@ -293,10 +273,10 @@ LIST.
 ])
   AT_CHECK([pspp -o pspp.csv sys-file.sps])
   AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,Position
-num1,Format: F8.0,1
-num2,"Label: Numeric variable 2's label
-Format: F8.0",2
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+num1,1,,Scale,Input,8,Right,F8.0,F8.0,
+num2,2,Numeric variable 2's label,Scale,Input,8,Right,F8.0,F8.0,
 
 Table: Data List
 num1,num2
@@ -426,94 +406,64 @@ DISPLAY DICTIONARY.
 ])
   AT_CHECK([pspp -o pspp.csv sys-file.sps])
   AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,Position
-num1,"Format: F8.0
-
-Value,Label
-1,один (in Russian)",1
-num2,"Format: F8.0
-
-Value,Label
-1,one
-2,two",2
-num3,"Format: F8.0
-
-Value,Label
-3,three
-4,four",3
-num4,"Format: F8.0
-
-Value,Label
-5,five
-7,seven
-8,eight
-9,nine",4
-num5,"Format: F8.0
-
-Value,Label
-6,six
-7,seven
-8,eight
-10,ten",5
-str1,"Format: A1
-
-Value,Label
-a,value label for `a'",6
-str2,"Format: A2
-
-Value,Label
-bc,value label for `bc'
-de,value label for `de'",7
-str3,"Format: A3
-
-Value,Label
-fgh,value label for `fgh'
-ijk,value label for `ijk'",8
-str4,"Format: A4
-
-Value,Label
-BCDE,value label for `BCDE'
-lmno,value label for `lmno'
-tuvw,value label for `tuvw'
-xyzA,value label for `xyzA'",9
-str5,"Format: A4
-
-Value,Label
-FGHI,value label for `FGHI'
-pqrs,value label for `pqrs'
-tuvw,value label for `tuvw'
-xyzA,value label for `xyzA'",10
-str6,"Format: A6
-
-Value,Label
-JKLMNO,value label for `JKLMNO'",11
-str7,"Format: A7
-
-Value,Label
-JKLMNOP,value label for `JKLMNOP'",12
-str8,"Format: A8
-
-Value,Label
-JKLMNOPQ,value label for `JKLMNOPQ'",13
-str9ж,"Format: A9
-
-Value,Label
-RSTUVWXYZ,value label for `RSTUVWXYZ'",14
-str12,"Format: A12
-
-Value,Label
-0123456789ab,value label for `0123456789ab'
-cdefghijklmn,value label for `cdefghijklmn'",15
-str16,"Format: A16
-
-Value,Label
-EFGHIJKLMNOPQRST,value label for `EFGHIJKLMNOPQRST'
-UVWXYZ0123456789,value label for `UVWXYZ0123456789' with Cyrillic letters: `фхц'
-opqrstuvwxyzABCD,value label for `opqrstuvwxyzABCD'",16
-str17,"Format: A17
-
-Value,Label
-abcdefghijklmnopq,value label for `abcdefghijklmnopq'",17
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+num1,1,,Scale,Input,8,Right,F8.0,F8.0,
+num2,2,,Scale,Input,8,Right,F8.0,F8.0,
+num3,3,,Scale,Input,8,Right,F8.0,F8.0,
+num4,4,,Scale,Input,8,Right,F8.0,F8.0,
+num5,5,,Scale,Input,8,Right,F8.0,F8.0,
+str1,6,,Nominal,Input,1,Left,A1,A1,
+str2,7,,Nominal,Input,2,Left,A2,A2,
+str3,8,,Nominal,Input,3,Left,A3,A3,
+str4,9,,Nominal,Input,4,Left,A4,A4,
+str5,10,,Nominal,Input,4,Left,A4,A4,
+str6,11,,Nominal,Input,6,Left,A6,A6,
+str7,12,,Nominal,Input,7,Left,A7,A7,
+str8,13,,Nominal,Input,8,Left,A8,A8,
+str9ж,14,,Nominal,Input,9,Left,A9,A9,
+str12,15,,Nominal,Input,12,Left,A12,A12,
+str16,16,,Nominal,Input,16,Left,A16,A16,
+str17,17,,Nominal,Input,17,Left,A17,A17,
+
+Table: Value Labels
+Variable,Value,Label
+num1,1,один (in Russian)
+num2,1,one
+,2,two
+num3,3,three
+,4,four
+num4,5,five
+,7,seven
+,8,eight
+,9,nine
+num5,6,six
+,7,seven
+,8,eight
+,10,ten
+str1,a,value label for `a'
+str2,bc,value label for `bc'
+,de,value label for `de'
+str3,fgh,value label for `fgh'
+,ijk,value label for `ijk'
+str4,BCDE,value label for `BCDE'
+,lmno,value label for `lmno'
+,tuvw,value label for `tuvw'
+,xyzA,value label for `xyzA'
+str5,FGHI,value label for `FGHI'
+,pqrs,value label for `pqrs'
+,tuvw,value label for `tuvw'
+,xyzA,value label for `xyzA'
+str6,JKLMNO,value label for `JKLMNO'
+str7,JKLMNOP,value label for `JKLMNOP'
+str8,JKLMNOPQ,value label for `JKLMNOPQ'
+str9ж,RSTUVWXYZ,value label for `RSTUVWXYZ'
+str12,0123456789ab,value label for `0123456789ab'
+,cdefghijklmn,value label for `cdefghijklmn'
+str16,EFGHIJKLMNOPQRST,value label for `EFGHIJKLMNOPQRST'
+,UVWXYZ0123456789,value label for `UVWXYZ0123456789' with Cyrillic letters: `фхц'
+,opqrstuvwxyzABCD,value label for `opqrstuvwxyzABCD'
+str17,abcdefghijklmnopq,value label for `abcdefghijklmnopq'
 ])
 done
 AT_CLEANUP
@@ -860,43 +810,20 @@ DISPLAY DICTIONARY.
 ])
   AT_CHECK([pspp -o pspp.csv sys-file.sps])
   AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,Position
-a,"Format: F8.0
-Measure: Nominal
-Display Alignment: Left",1
-b,"Format: F8.0
-Measure: Ordinal
-Display Alignment: Left",2
-c,"Format: F8.0
-Measure: Scale
-Display Alignment: Left",3
-d,"Format: F8.0
-Measure: Nominal
-Display Alignment: Right",4
-h,"Format: A3
-Measure: Ordinal
-Display Alignment: Right",5
-i,"Format: A3
-Measure: Scale
-Display Alignment: Right",6
-j,"Format: A3
-Measure: Nominal
-Display Alignment: Center",7
-k,"Format: A3
-Measure: Ordinal
-Display Alignment: Center",8
-l,"Format: A9
-Measure: Scale
-Display Alignment: Center",9
-m,"Format: A10
-Measure: Nominal
-Display Alignment: Left",10
-n,"Format: A17
-Measure: Nominal
-Display Alignment: Right",11
-o,"Format: A25
-Measure: Nominal
-Display Alignment: Center",12
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+a,1,,Nominal,Input,8,Left,F8.0,F8.0,
+b,2,,Ordinal,Input,8,Left,F8.0,F8.0,
+c,3,,Scale,Input,8,Left,F8.0,F8.0,
+d,4,,Nominal,Input,8,Right,F8.0,F8.0,
+h,5,,Ordinal,Input,3,Right,A3,A3,
+i,6,,Scale,Input,3,Right,A3,A3,
+j,7,,Nominal,Input,3,Center,A3,A3,
+k,8,,Ordinal,Input,3,Center,A3,A3,
+l,9,,Scale,Input,9,Center,A9,A9,
+m,10,,Nominal,Input,10,Left,A10,A10,
+n,11,,Nominal,Input,17,Right,A17,A17,
+o,12,,Nominal,Input,25,Center,A25,A25,
 ])
 done
 AT_CLEANUP
@@ -966,55 +893,20 @@ DISPLAY DICTIONARY.
 ])
   AT_CHECK([pspp -o pspp.csv sys-file.sps])
   AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,Position
-a,"Format: F8.0
-Measure: Nominal
-Display Alignment: Left
-Display Width: 1",1
-b,"Format: F8.0
-Measure: Ordinal
-Display Alignment: Left
-Display Width: 2",2
-c,"Format: F8.0
-Measure: Scale
-Display Alignment: Left
-Display Width: 3",3
-d,"Format: F8.0
-Measure: Nominal
-Display Alignment: Right
-Display Width: 4",4
-h,"Format: A3
-Measure: Ordinal
-Display Alignment: Right
-Display Width: 5",5
-i,"Format: A3
-Measure: Scale
-Display Alignment: Right
-Display Width: 6",6
-j,"Format: A3
-Measure: Nominal
-Display Alignment: Center
-Display Width: 7",7
-k,"Format: A3
-Measure: Ordinal
-Display Alignment: Center
-Display Width: 8",8
-l,"Format: A9
-Measure: Scale
-Display Alignment: Center
-Display Width: 9",9
-m,"Format: A10
-Measure: Nominal
-Display Alignment: Left
-Display Width: 10",10
-n,"Format: A17
-Measure: Nominal
-Display Alignment: Right
-Display Width: 11",11
-o,"Format: A25
-Measure: Nominal
-Display Alignment: Center
-Display Width: 12",12
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+a,1,,Nominal,Input,1,Left,F8.0,F8.0,
+b,2,,Ordinal,Input,2,Left,F8.0,F8.0,
+c,3,,Scale,Input,3,Left,F8.0,F8.0,
+d,4,,Nominal,Input,4,Right,F8.0,F8.0,
+h,5,,Ordinal,Input,5,Right,A3,A3,
+i,6,,Scale,Input,6,Right,A3,A3,
+j,7,,Nominal,Input,7,Center,A3,A3,
+k,8,,Ordinal,Input,8,Center,A3,A3,
+l,9,,Scale,Input,9,Center,A9,A9,
+m,10,,Nominal,Input,10,Left,A10,A10,
+n,11,,Nominal,Input,11,Right,A17,A17,
+o,12,,Nominal,Input,12,Center,A25,A25,
 ])
 done
 AT_CLEANUP
@@ -1073,14 +965,15 @@ DISPLAY DICTIONARY.
 ])
   AT_CHECK([pspp -o pspp.csv sys-file.sps])
   AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,Position
-LongVariableName1,Format: F8.0,1
-LongVariableName2,Format: F8.0,2
-LongVariableName3,Format: F8.0,3
-LongVariableName4,Format: F8.0,4
-Coördinate_X,Format: F8.0,5
-Coördinate_Y,Format: F8.0,6
-Coördinate_Z,Format: F8.0,7
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+LongVariableName1,1,,Scale,Input,8,Right,F8.0,F8.0,
+LongVariableName2,2,,Scale,Input,8,Right,F8.0,F8.0,
+LongVariableName3,3,,Scale,Input,8,Right,F8.0,F8.0,
+LongVariableName4,4,,Scale,Input,8,Right,F8.0,F8.0,
+Coördinate_X,5,,Scale,Input,8,Right,F8.0,F8.0,
+Coördinate_Y,6,,Scale,Input,8,Right,F8.0,F8.0,
+Coördinate_Z,7,,Scale,Input,8,Right,F8.0,F8.0,
 ])
 done
 AT_CLEANUP
@@ -1142,9 +1035,10 @@ LIST.
 ])
   AT_CHECK([pspp -o pspp.csv sys-file.sps])
   AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,Position
-séq256,Format: A256,1
-str600,Format: A600,2
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+séq256,1,,Nominal,Input,32,Left,A256,A256,
+str600,2,,Nominal,Input,32,Left,A600,A600,
 
 Table: Data List
 séq256,str600
@@ -1217,23 +1111,18 @@ DISPLAY @ATTRIBUTES.
 ])
   AT_CHECK([pspp -o pspp.csv sys-file.sps])
   AT_CHECK([cat pspp.csv], [0],
-[[Variable,Description
-FirstVariable,"Attribute,Value
-$@Role,1
-adèle[1],23
-adèle[2],34
-bert,123"
-SécondVariable,"Attribute,Value
-xyzzy,quux"
-ThirdVariable,"Attribute,Value
-fizz,buzz"
-
-Table: Custom data file attributes.
-Attribute,Value
-Attr1[1],Value1
-Attr1[2],'déclaration'
-SécondAttr[1],123
-SécondAttr[2],456
+[[Table: Variable and Dataset Attributes
+Variable,Name,Value
+(dataset),Attr1[1],Value1
+,Attr1[2],'déclaration'
+,SécondAttr[1],123
+,SécondAttr[2],456
+FirstVariable,$@Role,1
+,adèle[1],23
+,adèle[2],34
+,bert,123
+SécondVariable,xyzzy,quux
+ThirdVariable,fizz,buzz
 ]])
   AT_DATA([sys-file.sps], [dnl
 GET FILE='sys-file.sav'.
@@ -1241,31 +1130,11 @@ DISPLAY DICTIONARY.
 ])
   AT_CHECK([pspp -o pspp.csv sys-file.sps])
   AT_CHECK([cat pspp.csv], [0],
-[[Variable,Description,Position
-FirstVariable,"Format: F8.0
-Role: Output
-
-Attribute,Value
-adèle[1],23
-adèle[2],34
-bert,123",1
-SécondVariable,"Format: F8.0
-Role: Input
-
-Attribute,Value
-xyzzy,quux",2
-ThirdVariable,"Format: F8.0
-Role: Input
-
-Attribute,Value
-fizz,buzz",3
-
-Table: Custom data file attributes.
-Attribute,Value
-Attr1[1],Value1
-Attr1[2],'déclaration'
-SécondAttr[1],123
-SécondAttr[2],456
+[[Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+FirstVariable,1,,Scale,Output,8,Right,F8.0,F8.0,
+SécondVariable,2,,Scale,Input,8,Right,F8.0,F8.0,
+ThirdVariable,3,,Scale,Input,8,Right,F8.0,F8.0,
 ]])
 done
 AT_CLEANUP
@@ -1325,21 +1194,15 @@ warning: `sys-file.sav': Invalid role for variable x.
   AT_CHECK([cat pspp.csv], [0], [dnl
 warning: `sys-file.sav': Invalid role for variable x.
 
-Variable,Description,Position
-i,"Format: F8.0
-Role: Input",1
-o,"Format: F8.0
-Role: Output",2
-b,"Format: F8.0
-Role: Both",3
-n,"Format: F8.0
-Role: None",4
-p,"Format: F8.0
-Role: Partition",5
-s,"Format: F8.0
-Role: Split",6
-x,"Format: F8.0
-Role: Input",7
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+i,1,,Scale,Input,8,Right,F8.0,F8.0,
+o,2,,Scale,Output,8,Right,F8.0,F8.0,
+b,3,,Scale,Both,8,Right,F8.0,F8.0,
+n,4,,Scale,None,8,Right,F8.0,F8.0,
+p,5,,Scale,Partition,8,Right,F8.0,F8.0,
+s,6,,Scale,Split,8,Right,F8.0,F8.0,
+x,7,,Scale,Input,8,Right,F8.0,F8.0,
 ])
 done
 AT_CLEANUP
@@ -1390,12 +1253,13 @@ LIST.
 ])
   AT_CHECK([pspp -o pspp.csv sys-file.sps])
   AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,Position
-num1,Format: F8.0,1
-num2,Format: F8.0,2
-str4,Format: A4,3
-str8,Format: A8,4
-str15,Format: A15,5
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+num1,1,,Scale,Input,8,Right,F8.0,F8.0,
+num2,2,,Scale,Input,8,Right,F8.0,F8.0,
+str4,3,,Nominal,Input,4,Left,A4,A4,
+str8,4,,Nominal,Input,8,Left,A8,A8,
+str15,5,,Nominal,Input,15,Left,A15,A15,
 
 Table: Data List
 num1,num2,str4,str8,str15
@@ -1452,12 +1316,13 @@ LIST.
 ])
   AT_CHECK([pspp -o pspp.csv sys-file.sps], [0])
   AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,Position
-num1,Format: F8.0,1
-num2,Format: F8.0,2
-str4,Format: A4,3
-str8,Format: A8,4
-str15,Format: A15,5
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+num1,1,,Scale,Input,8,Right,F8.0,F8.0,
+num2,2,,Scale,Input,8,Right,F8.0,F8.0,
+str4,3,,Nominal,Input,4,Left,A4,A4,
+str8,4,,Nominal,Input,8,Left,A8,A8,
+str15,5,,Nominal,Input,15,Left,A15,A15,
 
 Table: Data List
 num1,num2,str4,str8,str15
@@ -1518,12 +1383,13 @@ LIST.
   AT_CHECK([cat pspp.csv], [0], [dnl
 "warning: `sys-file.sav' near offset 0x54: Compression bias is not the usual value of 100, or system file uses unrecognized floating-point format."
 
-Variable,Description,Position
-num1,Format: F8.0,1
-num2,Format: F8.0,2
-str4,Format: A4,3
-str8,Format: A8,4
-str15,Format: A15,5
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+num1,1,,Scale,Input,8,Right,F8.0,F8.0,
+num2,2,,Scale,Input,8,Right,F8.0,F8.0,
+str4,3,,Nominal,Input,4,Left,A4,A4,
+str8,4,,Nominal,Input,8,Left,A8,A8,
+str15,5,,Nominal,Input,15,Left,A15,A15,
 
 Table: Data List
 num1,num2,str4,str8,str15
@@ -1615,12 +1481,13 @@ LIST.
 ])
   AT_CHECK([pspp -o pspp.csv sys-file.sps])
   AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,Position
-num1,Format: F8.0,1
-num2,Format: F8.0,2
-str4,Format: A4,3
-str8,Format: A8,4
-str15,Format: A15,5
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+num1,1,,Scale,Input,8,Right,F8.0,F8.0,
+num2,2,,Scale,Input,8,Right,F8.0,F8.0,
+str4,3,,Nominal,Input,4,Left,A4,A4,
+str8,4,,Nominal,Input,8,Left,A8,A8,
+str15,5,,Nominal,Input,15,Left,A15,A15,
 
 Table: Data List
 num1,num2,str4,str8,str15
@@ -1883,9 +1750,10 @@ DISPLAY DICTIONARY.
   AT_CHECK([pspp -O format=csv sys-file.sps], [0],
    [warning: `sys-file.sav' near offset 0xd4: Renaming variable with duplicate name `VAR1' to `VAR001'.
 
-Variable,Description,Position
-var1,Format: F8.0,1
-var001,Format: F8.0,2
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+var1,1,,Scale,Input,8,Right,F8.0,F8.0,
+var001,2,,Scale,Input,8,Right,F8.0,F8.0,
 ])
 done
 AT_CLEANUP
@@ -2123,12 +1991,12 @@ warning: `sys-file.sav' near offset 0x257: Ignoring long string missing value re
 
 "warning: `sys-file.sav' near offset 0x270: Ignoring long string missing value 0 for variable str3, with width 11, that has bad value width 12."
 
-Variable,Description,Position
-num1,Format: F8.0,1
-str1,Format: A9,2
-str2,"Format: A10
-Missing Values: ""abcdefgh""; ""ijklmnop""; ""qrstuvwx""",3
-str3,Format: A11,4
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+num1,1,,Scale,Input,8,Right,F8.0,F8.0,
+str1,2,,Nominal,Input,9,Left,A9,A9,
+str2,3,,Nominal,Input,10,Left,A10,A10,"""abcdefgh""; ""ijklmnop""; ""qrstuvwx"""
+str3,4,,Nominal,Input,11,Left,A11,A11,
 ])
 done
 AT_CLEANUP
@@ -2160,9 +2028,10 @@ DISPLAY DICTIONARY.
   AT_CHECK([pspp -O format=csv sys-file.sps], [0],
    [warning: `sys-file.sav': Ignoring string variable `STR1' set as weighting variable.
 
-Variable,Description,Position
-num1,Format: F8.0,1
-str1,Format: A4,2
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+num1,1,,Scale,Input,8,Right,F8.0,F8.0,
+str1,2,,Nominal,Input,4,Left,A4,A4,
 ])
 done
 AT_CLEANUP
@@ -2403,8 +2272,9 @@ DISPLAY DICTIONARY.
   AT_CHECK_UNQUOTED([pspp -O format=csv sys-file.sps], [0], [dnl
 warning: \`sys-file.sav' near offset 0xd8: Integer format indicated by system file (3) differs from expected ($[2]).
 
-Variable,Description,Position
-num1,Format: F8.0,1
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+num1,1,,Scale,Input,8,Right,F8.0,F8.0,
 ])
 done
 AT_CLEANUP
index 6e49b783c4eaa29665cf24373c3c626a743f293a..b6c17b35fa9369fa75265b32bfb0cb4057ff4c36 100644 (file)
@@ -89,23 +89,20 @@ DISPLAY DICTIONARY.
 EOF
     AT_CHECK([pspp -o pspp.csv sysfile.sps])
     AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,Position
-s1,"Format: A9
-Missing Values: ""0       ""
-
-Value,Label
-abc      ,First value label
-abcdefgh ,Second value label
-abcdefghi,Third value label",1
-s2,"Format: A9
-Missing Values: ""12      ""; ""123     ""
-
-Value,Label
-0        ,Fourth value label
-01234567 ,Fifth value label
-012345678,Sixth value label",2
-s3,"Format: A9
-Missing Values: ""1234    ""; ""12345   ""; ""12345678""",3
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+s1,1,,Nominal,Input,9,Left,A9,A9,"""0       """
+s2,2,,Nominal,Input,9,Left,A9,A9,"""12      ""; ""123     """
+s3,3,,Nominal,Input,9,Left,A9,A9,"""1234    ""; ""12345   ""; ""12345678"""
+
+Table: Value Labels
+Variable,Value,Label
+s1,abc      ,First value label
+,abcdefgh ,Second value label
+,abcdefghi,Third value label
+s2,0        ,Fourth value label
+,01234567 ,Fifth value label
+,012345678,Sixth value label
 ])
     AT_CHECK_UNQUOTED([dd if=foo.sav bs=1 count=4; echo], [0], [$magic
 ], [ignore])
@@ -270,11 +267,12 @@ LIST.
 ])
 AT_CHECK([pspp -o pspp.csv get.sps])
 AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Label,Position
-cont,continents of the world,1
-size,sq km,2
-pop,population,3
-count,number of countries,4
+Table: Variables
+Name,Position,Label
+cont,1,continents of the world
+size,2,sq km
+pop,3,population
+count,4,number of countries
 
 Table: Data List
 cont,size,pop,count
@@ -338,15 +336,12 @@ LIST.
 ])
 AT_CHECK([pspp -o pspp.csv sys-file.sps])
 AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,Position
-N,"Format: F8.2
-Display Width: 10",1
-A255,"Format: A255
-Display Width: 32",2
-A258,"Format: A258
-Display Width: 32",3
-A2000,"Format: A2000
-Display Width: 32",4
+Table: Variables
+Name,Position,Print Format,Write Format,Missing Values
+N,1,F8.2,F8.2,
+A255,2,A255,A255,
+A258,3,A258,A258,
+A2000,4,A2000,A2000,
 
 Table: Data List
 N,A255,A258,A2000
@@ -364,15 +359,12 @@ LIST.
 ])
 AT_CHECK([pspp -o pspp.csv sys-file.sps])
 AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,Position
-vl255,"Format: A255
-Display Width: 26",1
-vl256,"Format: A256
-Display Width: 26",2
-vl1335,"Format: A1335
-Display Width: 26",3
-vl2000,"Format: A2000
-Display Width: 26",4
+Table: Variables
+Name,Position,Print Format,Write Format,Missing Values
+vl255,1,A255,A255,
+vl256,2,A256,A256,
+vl1335,3,A1335,A1335,
+vl2000,4,A2000,A2000,
 
 Table: Data List
 vl255,vl256,vl1335,vl2000
@@ -416,11 +408,12 @@ EXECUTE.
 ])
    AT_CHECK([pspp -o pspp.csv get.sps])
    AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,Position
-a,Format: A10,1
-b,Format: A256,2
-c,Format: A200,3
-d,Format: A32767,4
+Table: Variables
+Name,Position,Print Format,Write Format,Missing Values
+a,1,A10,A10,
+b,2,A256,A256,
+c,3,A200,A200,
+d,4,A32767,A32767,
 ])
    AT_CLEANUP])
 
@@ -462,6 +455,7 @@ GET FILE='foo.sav'.
 DISPLAY FILE LABEL.
 DISPLAY DOCUMENTS.
 DISPLAY DICTIONARY.
+DISPLAY ATTRIBUTES.
 ])
 AT_CHECK([pspp -o pspp.csv get.sps])
 AT_CHECK([[sed 's/(Entered [^)]*)/(Entered <date>)/' pspp.csv]], [0], [dnl
@@ -477,23 +471,20 @@ jalapeño vicuña.
 
 (Entered <date>)
 
-Variable,Description,Position
-àéîöçxyzabc,"Format: F8.2
-
-Value,Label
-1.00,éclair Ã©lan
-
-Attribute,Value
-Atatürk,Düsseldorf Gewürztraminer",1
-roué,"Label: Provençal soupçon
-Format: A9
-
-Value,Label
-abcdefghi,sauté précis",2
-croûton,Format: A1000,3
-
-Table: Custom data file attributes.
-Attribute,Value
-Furtwängler,kindergärtner
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+àéîöçxyzabc,1,,Scale,Input,8,Right,F8.2,F8.2,
+roué,2,Provençal soupçon,Nominal,Input,9,Left,A9,A9,
+croûton,3,,Nominal,Input,32,Left,A1000,A1000,
+
+Table: Value Labels
+Variable,Value,Label
+àéîöçxyzabc,1.00,éclair Ã©lan
+roué,abcdefghi,sauté précis
+
+Table: Variable and Dataset Attributes
+Variable,Name,Value
+(dataset),Furtwängler,kindergärtner
+àéîöçxyzabc,Atatürk,Düsseldorf Gewürztraminer
 ])
 AT_CLEANUP
index 3096073b03f4a8db7d85348d035ea1ddc1eeeea8..b389797c9830e01036d882df7d4681b418cde5c0 100644 (file)
@@ -161,29 +161,30 @@ EOF
 ])
 AT_CHECK([pspp -o pspp.csv ordinary-query.sps])
 AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,Position
-bool,Format: F8.2,1
-bytea,Format: AHEX2,2
-char,Format: A8,3
-int8,Format: F8.2,4
-int2,Format: F8.2,5
-int4,Format: F8.2,6
-numeric,Format: E40.6,7
-text,Format: A16,8
-oid,Format: F8.2,9
-float4,Format: F8.2,10
-float8,Format: F8.2,11
-money,Format: DOLLAR8.2,12
-pbchar,Format: A8,13
-varchar,Format: A8,14
-date,Format: DATE11,15
-time,Format: TIME11.0,16
-timestamp,Format: DATETIME22.0,17
-timestamptz,Format: DATETIME22.0,18
-interval,Format: DTIME13.0,19
-interval_months,Format: F3.0,20
-timetz,Format: TIME11.0,21
-timetz_zone,Format: F8.2,22
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+bool,1,,Scale,Input,8,Right,F8.2,F8.2,
+bytea,2,,Nominal,Input,1,Left,AHEX2,AHEX2,
+char,3,,Nominal,Input,8,Left,A8,A8,
+int8,4,,Scale,Input,8,Right,F8.2,F8.2,
+int2,5,,Scale,Input,8,Right,F8.2,F8.2,
+int4,6,,Scale,Input,8,Right,F8.2,F8.2,
+numeric,7,,Scale,Input,8,Right,E40.6,E40.6,
+text,8,,Nominal,Input,16,Left,A16,A16,
+oid,9,,Scale,Input,8,Right,F8.2,F8.2,
+float4,10,,Scale,Input,8,Right,F8.2,F8.2,
+float8,11,,Scale,Input,8,Right,F8.2,F8.2,
+money,12,,Scale,Input,8,Right,DOLLAR8.2,DOLLAR8.2,
+pbchar,13,,Nominal,Input,8,Left,A8,A8,
+varchar,14,,Nominal,Input,8,Left,A8,A8,
+date,15,,Scale,Input,8,Right,DATE11,DATE11,
+time,16,,Scale,Input,8,Right,TIME11.0,TIME11.0,
+timestamp,17,,Scale,Input,8,Right,DATETIME22.0,DATETIME22.0,
+timestamptz,18,,Scale,Input,8,Right,DATETIME22.0,DATETIME22.0,
+interval,19,,Scale,Input,8,Right,DTIME13.0,DTIME13.0,
+interval_months,20,,Scale,Input,8,Right,F3.0,F3.0,
+timetz,21,,Scale,Input,8,Right,TIME11.0,TIME11.0,
+timetz_zone,22,,Scale,Input,8,Right,F8.2,F8.2,
 
 Table: Data List
 bool,bytea,char,int8,int2,int4,numeric,text,oid,float4,float8,money,pbchar,varchar,date,time,timestamp,timestamptz,interval,interval_months,timetz,timetz_zone
@@ -206,10 +207,11 @@ EOF
 ])
 AT_CHECK([pspp -o pspp.csv empty-result.sps])
 AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,Position
-a,Format: F8.2,1
-b,Format: DATE11,2
-c,Format: E40.2,3
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+a,1,,Scale,Input,8,Right,F8.2,F8.2,
+b,2,,Scale,Input,8,Right,DATE11,DATE11,
+c,3,,Scale,Input,8,Right,E40.2,E40.2,
 ])
 
 dnl Test query with large result set.
index eca194a02dde0508735b318a1191a7ebc675fd54..86ca4554628fb419a69ede90fb0ac4d06d6cc528 100644 (file)
@@ -36,10 +36,11 @@ LIST.
 ])
 AT_CHECK([pspp -o pspp.csv get-data.sps])
 AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,Position
-VAR001,Format: F8.2,1
-VAR002,Format: A8,2
-VAR003,Format: F8.2,3
+Table: Variables
+Name,Position,Print Format,Write Format,Missing Values
+VAR001,1,F8.2,F8.2,
+VAR002,2,A8,A8,
+VAR003,3,F8.2,F8.2,
 
 Table: Data List
 VAR001,VAR002,VAR003
@@ -60,10 +61,11 @@ LIST.
 ])
 AT_CHECK([pspp -o pspp.csv get-data.sps])
 AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,Position
-V1,Format: F8.2,1
-V2,Format: A8,2
-VAR001,Format: F8.2,3
+Table: Variables
+Name,Position,Print Format,Write Format,Missing Values
+V1,1,F8.2,F8.2,
+V2,2,A8,A8,
+VAR001,3,F8.2,F8.2,
 
 Table: Data List
 V1,V2,VAR001
@@ -83,10 +85,11 @@ DISPLAY VARIABLES.
 LIST.
 ])
 AT_CHECK([pspp -O format=csv get-data.sps], [0], [dnl
-Variable,Description,Position
-name,Format: A8,1
-id,Format: F8.2,2
-height,Format: F8.2,3
+Table: Variables
+Name,Position,Print Format,Write Format,Missing Values
+name,1,A8,A8,
+id,2,F8.2,F8.2,
+height,3,F8.2,F8.2,
 
 warning: Cannot convert the value in the spreadsheet cell C4 to format (F8.2): Field contents are not numeric.
 
@@ -109,11 +112,12 @@ LIST.
 ])
 AT_CHECK([pspp -o pspp.csv get-data.sps])
 AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,Position
-vone,Format: F8.2,1
-vtwo,Format: F8.2,2
-vthree,Format: A8,3
-v4,Format: F8.2,4
+Table: Variables
+Name,Position,Print Format,Write Format,Missing Values
+vone,1,F8.2,F8.2,
+vtwo,2,F8.2,F8.2,
+vthree,3,A8,A8,
+v4,4,F8.2,F8.2,
 
 Table: Data List
 vone,vtwo,vthree,v4
@@ -399,15 +403,16 @@ LIST.
 ])
 
 
-AT_CHECK([pspp -O format=csv readnames.sps], [0],
-[Variable,Description,Position
-freda,Format: F8.2,1
-fred,Format: F8.2,2
-fred_A,Format: F8.2,3
-fred_B,Format: F8.2,4
-fred_C,Format: F8.2,5
-fred_D,Format: F8.2,6
-fred_E,Format: F8.2,7
+AT_CHECK([pspp -O format=csv readnames.sps], [0], [dnl
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+freda,1,,Scale,Input,8,Right,F8.2,F8.2,
+fred,2,,Scale,Input,8,Right,F8.2,F8.2,
+fred_A,3,,Scale,Input,8,Right,F8.2,F8.2,
+fred_B,4,,Scale,Input,8,Right,F8.2,F8.2,
+fred_C,5,,Scale,Input,8,Right,F8.2,F8.2,
+fred_D,6,,Scale,Input,8,Right,F8.2,F8.2,
+fred_E,7,,Scale,Input,8,Right,F8.2,F8.2,
 
 Table: Data List
 freda,fred,fred_A,fred_B,fred_C,fred_D,fred_E
index ccf03d66ff2d08025e33e1982debafc7d97bcea3..d495ddc51568a22cf2fe394aab547deed8eab79e 100644 (file)
@@ -255,8 +255,9 @@ LIST.
 ])
 AT_CHECK([pspp -o pspp.csv list.sps])
 AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,Position
-foo,Format: A2000,1
+Table: Variables
+Name,Position,Print Format,Write Format,Missing Values
+foo,1,A2000,A2000,
 
 Table: Data List
 foo
index f26cbe86426a2010fc4d7f39fd05de0d4ae6e61a..7d4c0f39fae4745fcb3f45c6ed1ff7aa7d159622 100644 (file)
@@ -232,14 +232,15 @@ list.
 
 
 AT_CHECK([pspp -O format=csv matrix-data.pspp], [0], [dnl
-Variable,Description,Position
-s1,Format: F4.0,1
-s2,Format: F4.0,2
-ROWTYPE_,Format: A8,3
-VARNAME_,Format: A8,4
-var01,Format: F10.4,5
-var02,Format: F10.4,6
-var03,Format: F10.4,7
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+s1,1,,Scale,Input,8,Right,F4.0,F4.0,
+s2,2,,Scale,Input,8,Right,F4.0,F4.0,
+ROWTYPE_,3,,Nominal,Input,8,Left,A8,A8,
+VARNAME_,4,,Nominal,Input,8,Left,A8,A8,
+var01,5,,Scale,Input,8,Right,F10.4,F10.4,
+var02,6,,Scale,Input,8,Right,F10.4,F10.4,
+var03,7,,Scale,Input,8,Right,F10.4,F10.4,
 
 Table: Data List
 s1,s2,ROWTYPE_,VARNAME_,var01,var02,var03
index 8b9e7c96b701291cc79df34f2fb981235ce83423..e3d63657d685a257f7c2b4ce53d14ec249bb3fc0 100644 (file)
@@ -50,34 +50,24 @@ VARIABLE ATTRIBUTE
 
 DISPLAY ATTRIBUTES.
 ]])
-AT_CHECK([pspp -O format=csv save-attrs.pspp], [0], 
-  [[Variable,Description
-a,"Attribute,Value
-ValidationRule[1],a * b > 3
-ValidationRule[2],a + b > 2"
-b,"Attribute,Value
-ValidationRule[1],a * b > 3
-ValidationRule[2],a + b > 2"
-c,"Attribute,Value
-QuestionWording,X or Y?"
-
-Table: Custom data file attributes.
-Attribute,Value
-array[1],array element 1
-array[2],array element 2
-key,value
+AT_CHECK([pspp -O format=csv save-attrs.pspp], [0],
+  [[Table: Variable and Dataset Attributes
+Variable,Name,Value
+(dataset),array[1],array element 1
+,array[2],array element 2
+,key,value
+a,ValidationRule[1],a * b > 3
+,ValidationRule[2],a + b > 2
+b,ValidationRule[1],a * b > 3
+,ValidationRule[2],a + b > 2
+c,QuestionWording,X or Y?
 ]])
 AT_CHECK([pspp -O format=csv get-attrs.pspp], [0], [dnl
-Variable,Description
-a,
-b,"Attribute,Value
-ValidationRule,a * b > 3"
-c,"Attribute,Value
-QuestionWording,X or Y?"
-
-Table: Custom data file attributes.
-Attribute,Value
-array,array element 2
-key,value
+Table: Variable and Dataset Attributes
+Variable,Name,Value
+(dataset),array,array element 2
+,key,value
+b,ValidationRule,a * b > 3
+c,QuestionWording,X or Y?
 ])
 AT_CLEANUP
index aa391f2c8a4a56200ed49e3fcb3950ecd8dc7c12..b9671b779807ffd0d87127f7673af44ea4508c97 100644 (file)
@@ -36,29 +36,32 @@ x,A1
 y,A2
 z,A3
 
-Variable,Description,Position
-a,Format: F8.2,1
-b,Format: F8.2,2
-c,Format: F8.2,3
-x,Format: A1,4
-y,Format: A2,5
-z,Format: A3,6
+Table: Variables
+Name,Position,Print Format,Write Format,Missing Values
+a,1,F8.2,F8.2,
+b,2,F8.2,F8.2,
+c,3,F8.2,F8.2,
+x,4,A1,A1,
+y,5,A2,A2,
+z,6,A3,A3,
 
-Variable,Description,Position
-a,Format: COMMA10.0,1
-b,Format: N4.0,2
-c,Format: F8.2,3
-x,Format: A1,4
-y,Format: A2,5
-z,Format: A3,6
+Table: Variables
+Name,Position,Print Format,Write Format,Missing Values
+a,1,COMMA10.0,COMMA10.0,
+b,2,N4.0,N4.0,
+c,3,F8.2,F8.2,
+x,4,A1,A1,
+y,5,A2,A2,
+z,6,A3,A3,
 
-Variable,Description,Position
-a,Format: COMMA10.0,1
-b,Format: N4.0,2
-c,Format: E8.1,3
-x,Format: A1,4
-y,Format: AHEX4,5
-z,Format: A3,6
+Table: Variables
+Name,Position,Print Format,Write Format,Missing Values
+a,1,COMMA10.0,COMMA10.0,
+b,2,N4.0,N4.0,
+c,3,E8.1,E8.1,
+x,4,A1,A1,
+y,5,AHEX4,AHEX4,
+z,6,A3,A3,
 ])
 AT_CLEANUP
 
index 8073ab79e1f1082a9ace2bd009222639774c4bd5..c3d3991356f85f5e28f783c24254da61cbbf5859 100644 (file)
@@ -78,8 +78,9 @@ MISSING VALUES ALL ().
 DISPLAY DICTIONARY
 ])
 AT_CHECK([pspp -o pspp.csv missing-values.sps])
-AT_CHECK([sed -n '/^$/p; /^@<:@^"@:>@*"@<:@^"@:>@*$/N; s/^\(@<:@a-z0-9@:>@*\),".*Missing Values: \(.*\)",@<:@0-9@:>@*$/\1: \2/p; s/^\(@<:@a-z0-9@:>@*\),Format: @<:@A-Z0-9.@:>@*,@<:@0-9@:>@*$/\1: none/p' pspp.csv
-], [0], [dnl
+AT_CHECK([cat pspp.csv | sed '/^Table/d
+/^Name/d
+s/^\([[a-z0-9]]*\),.*,\([[^,]]*\)$/\1: \2/'], [0], [dnl
 date1: 1
 num1: 1
 
@@ -130,15 +131,15 @@ num1: 1 THRU HIGHEST; -1
 
 num1: 1 THRU HIGHEST; -1
 
-str1: ""abc  ""; ""def  ""
-str2: ""abc""; ""def""
-longstr: ""abc     ""; ""def     ""
+str1: """abc  ""; ""def  """
+str2: """abc""; ""def"""
+longstr: """abc     ""; ""def     """
 
-str1: none
-str2: none
-date1: none
-num1: none
-longstr: none
+str1: @&t@
+str2: @&t@
+date1: @&t@
+num1: @&t@
+longstr: @&t@
 ])
 AT_CLEANUP
 
index 17d8017dc97c0f99ceab675e2e7b582efedd4db5..16614474f84e908a522723eac57302f4db646994 100644 (file)
@@ -35,10 +35,12 @@ SORT VARIABLES $3(D).
 DISPLAY NAMES.
 EOF
     AT_CHECK_UNQUOTED([pspp -O format=csv sort-variables.sps], [0],
-[Variable
+[Table: Variables
+Name
 `for var in $4; do echo $var; done`
 
-Variable
+Table: Variables
+Name
 `for var in $4; do echo $var; done | tac`
 ])
 }
index ac8e8cd54a9de16f507cf6646418961d4aa3da2d..25e38e45fef60fc9d02f494b926b68e78cfd7c0a 100644 (file)
@@ -29,6 +29,8 @@ SAVE OUTFILE='pro.sav'.
 sysfile info file='pro.sav'.
 ])
 AT_CHECK([pspp -o pspp.csv sysfile-info.sps])
+AT_CHECK([pspp -o pspp.pdf sysfile-info.sps])
+AT_CHECK([pspp -o pspp.txt sysfile-info.sps])
 AT_CHECK(
   [sed -e '/^Created:,/d' \
        -e '/^Endian:,/d' \
@@ -49,17 +51,10 @@ Type:,SPSS System File
 Weight:,Not weighted.
 Compression:,SAV
 
-Variable,Description,Position
-x,"Format: F8.2
-Measure: Scale
-Role: Input
-Display Alignment: Right
-Display Width: 8",1
-name,"Format: A10
-Measure: Nominal
-Role: Input
-Display Alignment: Left
-Display Width: 10",2
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+x,1,,Scale,Input,8,Right,F8.2,F8.2,
+name,2,,Nominal,Input,10,Left,A10,A10,
 ])
 AT_CLEANUP
 
@@ -97,7 +92,8 @@ DISPLAY SCRATCH.
 AT_CHECK([pspp -O format=csv sysfile-info.sps], [0], [dnl
 sysfile-info.sps:2: warning: DISPLAY: No variables to display.
 
-Variable
+Table: Variables
+Name
 #x
 ])
 AT_CLEANUP
@@ -108,7 +104,8 @@ DATA LIST LIST NOTABLE /x * name (a10) .
 DISPLAY INDEX.
 ])
 AT_CHECK([pspp -O format=csv sysfile-info.sps], [0], [dnl
-Variable,Position
+Table: Variables
+Name,Position
 x,1
 name,2
 ])
@@ -120,7 +117,8 @@ DATA LIST LIST NOTABLE /x * name (a10) .
 DISPLAY NAMES.
 ])
 AT_CHECK([pspp -O format=csv sysfile-info.sps], [0], [dnl
-Variable
+Table: Variables
+Name
 x
 name
 ])
@@ -134,9 +132,10 @@ VALUE LABEL x 1 'asdf' 2 'jkl;'.
 DISPLAY LABELS.
 ])
 AT_CHECK([pspp -O format=csv sysfile-info.sps], [0], [dnl
-Variable,Label,Position
-x,variable one,1
-name,variable two,2
+Table: Variables
+Name,Position,Label
+x,1,variable one
+name,2,variable two
 ])
 AT_CLEANUP
 
index 60bbdc33401cd532f22d553d3b4a879ba489cff4..b7e6eaf8d7499e2abc1829d598fec8ace060eb7c 100644 (file)
@@ -26,17 +26,17 @@ VALUE LABELS ad 'july 10, 1982' 'label 1'
 DISPLAY DICTIONARY.
 ])
 AT_CHECK([pspp -O format=csv value-labels.sps], [0], [dnl
-Variable,Description,Position
-ad,"Format: ADATE10
-
-Value,Label
-07/10/1982,label 1
-01/02/1993,label 2
-05/04/2003,label 3",1
-dt,"Format: DATETIME20.0
-
-Value,Label
-12-APR-2011 06:09:56,label 4",2
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+ad,1,,Scale,Input,8,Right,ADATE10,ADATE10,
+dt,2,,Scale,Input,8,Right,DATETIME20.0,DATETIME20.0,
+
+Table: Value Labels
+Variable,Value,Label
+ad,07/10/1982,label 1
+,01/02/1993,label 2
+,05/04/2003,label 3
+dt,12-APR-2011 06:09:56,label 4
 ])
 AT_CLEANUP
 
@@ -53,13 +53,15 @@ DISPLAY DICTIONARY.
 FREQUENCIES x/STAT=NONE.
 ])
 AT_CHECK([pspp -O format=csv value-labels.sps], [0], [dnl
-Variable,Description,Position
-x,"Format: F8.2
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+x,1,,Scale,Input,8,Right,F8.2,F8.2,
 
-Value,Label
-1.00,one
-2.00,first line\nsecond line
-3.00,three",1
+Table: Value Labels
+Variable,Value,Label
+x,1.00,one
+,2.00,first line\nsecond line
+,3.00,three
 
 Table: x
 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
@@ -89,13 +91,15 @@ DISPLAY DICTIONARY.
 FREQUENCIES x/STAT=NONE.
 ])
 AT_CHECK([pspp -O format=csv get.sps], [0], [dnl
-Variable,Description,Position
-x,"Format: F8.2
-
-Value,Label
-1.00,one
-2.00,first line\nsecond line
-3.00,three",1
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+x,1,,Scale,Input,8,Right,F8.2,F8.2,
+
+Table: Value Labels
+Variable,Value,Label
+x,1.00,one
+,2.00,first line\nsecond line
+,3.00,three
 
 Table: x
 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
index 16de8a2640fe3c2d0e7e44352654255757d3ca31..5daa3c1bbf645e54160dbae0f50d17bb16b6a252 100644 (file)
@@ -27,22 +27,11 @@ DISPLAY DICTIONARY.
 ])
 AT_CHECK([pspp -o pspp.csv var-display.sps])
 AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,Position
-x,"Format: F8.2
-Measure: Scale
-Role: Output
-Display Alignment: Left
-Display Width: 10",1
-y,"Format: F8.2
-Measure: Ordinal
-Role: Both
-Display Alignment: Right
-Display Width: 12",2
-z,"Format: F8.2
-Measure: Nominal
-Role: None
-Display Alignment: Center
-Display Width: 14",3
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+x,1,,Scale,Output,10,Left,F8.2,F8.2,
+y,2,,Ordinal,Both,12,Right,F8.2,F8.2,
+z,3,,Nominal,None,14,Center,F8.2,F8.2,
 ])
 AT_CLEANUP
 
index 5dfdf5250ec2efb85e3ca3beae1f553ba6afa75f..fdd7c33e6bfe6c8de63d87bff76237a2455ebc88 100644 (file)
@@ -103,16 +103,18 @@ oojars          ,5.00,1.00
 thingummies     ,6.00,3.00
 oojimiflips     ,7.00,2.00
 
-Variable,Description,Position
-s,Format: A16,1
-x,Format: F8.2,2
-new,"Format: F8.2
-
-Value,Label
-1.00,oojars
-2.00,oojimiflips
-3.00,thingummies
-4.00,widgets",3
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+s,1,,Nominal,Input,16,Left,A16,A16,
+x,2,,Scale,Input,8,Right,F8.2,F8.2,
+new,3,,Scale,Input,8,Right,F8.2,F8.2,
+
+Table: Value Labels
+Variable,Value,Label
+new,1.00,oojars
+,2.00,oojimiflips
+,3.00,thingummies
+,4.00,widgets
 ])
 
 AT_CLEANUP
index 589375b67bee32ff09ad2225d25c9d89c0c80101..40c69d0f97946794572c21dd13f9211fe1b0e3ae 100644 (file)
@@ -133,21 +133,16 @@ a into count(N of a)
 
 b into Nb(N of b)
 
-Variable,Description,Position
-a,Format: F8.2,1
-b,Format: F8.2,2
-Ra,"Label: RANK of a
-Format: F9.3",3
-RFR001,"Label: RFRACTION of a
-Format: F6.4",4
-count,"Label: N of a
-Format: F6.0",5
-Rb,"Label: RANK of b
-Format: F9.3",6
-RFR002,"Label: RFRACTION of b
-Format: F6.4",7
-Nb,"Label: N of b
-Format: F6.0",8
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+a,1,,Scale,Input,8,Right,F8.2,F8.2,
+b,2,,Scale,Input,8,Right,F8.2,F8.2,
+Ra,3,RANK of a,Scale,Input,8,Right,F9.3,F9.3,
+RFR001,4,RFRACTION of a,Scale,Input,8,Right,F6.4,F6.4,
+count,5,N of a,Scale,Input,8,Right,F6.0,F6.0,
+Rb,6,RANK of b,Scale,Input,8,Right,F9.3,F9.3,
+RFR002,7,RFRACTION of b,Scale,Input,8,Right,F6.4,F6.4,
+Nb,8,N of b,Scale,Input,8,Right,F6.0,F6.0,
 
 Table: Data List
 a,b,Ra,RFR001,count,Rb,RFR002,Nb
@@ -522,12 +517,12 @@ Variables Created By RANK
 
 foo into RAN001(RANK of foo)
 
-Variable,Description,Position
-foo,Format: F8.2,1
-rfoo,Format: F8.2,2
-ran003,Format: F8.2,3
-RAN001,"Label: RANK of foo
-Format: F9.3",4
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+foo,1,,Scale,Input,8,Right,F8.2,F8.2,
+rfoo,2,,Scale,Input,8,Right,F8.2,F8.2,
+ran003,3,,Scale,Input,8,Right,F8.2,F8.2,
+RAN001,4,RANK of foo,Scale,Input,8,Right,F9.3,F9.3,
 ])
 AT_CLEANUP
 
index c13a8b857a80bd4a31ea606b63a638b23984827e..175a09aae83bceab86c0f95fb72b9a3301cc614e 100644 (file)
@@ -26,6 +26,7 @@ dnl XXX "libtool --mode=execute" is probably better than setting
 dnl LD_LIBRARY_PATH.
 m4_define([RUN_PERL_MODULE],
   [LD_LIBRARY_PATH=$abs_top_builddir/src/.libs \
+   LD_PRELOAD=/usr/lib/i386-linux-gnu/libasan.so.4 \
    DYLD_LIBRARY_PATH=$abs_top_builddir/src/.libs \
    $PERL -I$abs_top_builddir/perl-module/blib/arch \
          -I$abs_top_builddir/perl-module/blib/lib])
@@ -82,9 +83,10 @@ Documents in the active dataset:
 
 These Documents
 
-Variable,Description,Position
-legal,Format: F9.2,1
-money,Format: DOLLAR6.2,2
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+legal,1,,Scale,Input,8,Right,F9.2,F9.2,
+money,2,,Scale,Input,8,Right,DOLLAR6.2,DOLLAR6.2,
 
 dump-dict.sps:5: note: SHOW: WEIGHT is money.
 ])
@@ -152,10 +154,11 @@ DISPLAY FILE LABEL.
 DISPLAY DOCUMENTS.
 LIST.
 ])
-AT_CHECK([pspp -O format=csv dump-dicts.sps], [0],
-  [Variable,Description,Position
-id,Format: F2.0,1
-name,Format: A20,2
+AT_CHECK([pspp -O format=csv dump-dicts.sps], [0], [dnl
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+id,1,,Scale,Input,8,Right,F2.0,F2.0,
+name,2,,Nominal,Input,20,Left,A20,A20,
 
 File label: This is the file label
 
@@ -167,9 +170,10 @@ Table: Data List
 id,name
 34,frederick           @&t@
 
-Variable,Description,Position
-id,Format: F2.0,1
-name,Format: A20,2
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+id,1,,Scale,Input,8,Right,F2.0,F2.0,
+name,2,,Nominal,Input,20,Left,A20,A20,
 
 File label: This is the file label
 
@@ -228,33 +232,27 @@ AT_DATA([test.pl],
 
     $sysfile->close ();
 ]])
-AT_CHECK([RUN_PERL_MODULE test.pl])
+AT_CHECK([RUN_PERL_MODULE test.pl], [0], [], [stderr])
+cat stderr
 AT_DATA([dump-dict.sps],
   [GET FILE='testfile.sav'.
 DISPLAY DICTIONARY.
 ])
-AT_CHECK([pspp -O format=csv dump-dict.sps], [0],
-  [Variable,Description,Position
-integer,"Label: My Integer
-Format: F8.0
-Missing Values: 9; 99
-
-Value,Label
-0,Zero
-1,Unity
-2,Duality",1
-string,"Label: My String
-Format: A8
-Missing Values: ""this    ""; ""that    ""
-
-Value,Label
-xx      ,foo
-yy      ,bar",2
-longstring,"Label: My Long String
-Format: A9
-
-Value,Label
-xxx      ,xfoo",3
+AT_CHECK([pspp -O format=csv dump-dict.sps], [0], [dnl
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+integer,1,My Integer,Scale,Input,8,Right,F8.0,F8.0,9; 99
+string,2,My String,Nominal,Input,8,Left,A8,A8,"""this    ""; ""that    """
+longstring,3,My Long String,Nominal,Input,9,Left,A9,A9,
+
+Table: Value Labels
+Variable,Value,Label
+integer,0,Zero
+,1,Unity
+,2,Duality
+string,xx      ,foo
+,yy      ,bar
+longstring,xxx      ,xfoo
 ])
 AT_CLEANUP
 
@@ -444,45 +442,40 @@ AT_CHECK([RUN_PERL_MODULE test.pl])
 AT_DATA([dump-dicts.sps],
   [GET FILE='sample.sav'.
 DISPLAY DICTIONARY.
+DISPLAY ATTRIBUTES
 LIST.
 
 GET FILE='copy.sav'.
 DISPLAY DICTIONARY.
+DISPLAY ATTRIBUTES
 LIST.
 ])
 AT_CHECK([pspp -O format=csv dump-dicts.sps], [0],
-  [[Variable,Description,Position
-string,"Label: A Short String Variable
-Format: A8
-Missing Values: ""3333    ""
-
-Value,Label
-1111    ,ones
-2222    ,twos
-3333    ,threes",1
-longstring,"Label: A Long String Variable
-Format: A12",2
-numeric,"Label: A Numeric Variable
-Format: F10.0
-Missing Values: 9; 5; 999
-
-Value,Label
-1,Unity
-2,Duality
-3,Thripality
-
-Attribute,Value
-colour[1],blue
-colour[2],pink
-colour[3],violet
-nationality,foreign
-size,large",3
-date,"Label: A Date Variable
-Format: DATE11",4
-dollar,"Label: A Dollar Variable
-Format: DOLLAR11.2",5
-datetime,"Label: A Datetime Variable
-Format: DATETIME17.0",6
+  [[Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+string,1,A Short String Variable,Nominal,Input,8,Left,A8,A8,"""3333    """
+longstring,2,A Long String Variable,Nominal,Input,12,Left,A12,A12,
+numeric,3,A Numeric Variable,Scale,Input,8,Right,F10.0,F10.0,9; 5; 999
+date,4,A Date Variable,Scale,Input,8,Right,DATE11,DATE11,
+dollar,5,A Dollar Variable,Scale,Input,8,Right,DOLLAR11.2,DOLLAR11.2,
+datetime,6,A Datetime Variable,Scale,Input,8,Right,DATETIME17.0,DATETIME17.0,
+
+Table: Value Labels
+Variable,Value,Label
+string,1111    ,ones
+,2222    ,twos
+,3333    ,threes
+numeric,1,Unity
+,2,Duality
+,3,Thripality
+
+Table: Variable and Dataset Attributes
+Variable,Name,Value
+numeric,colour[1],blue
+,colour[2],pink
+,colour[3],violet
+,nationality,foreign
+,size,large
 
 Table: Data List
 string,longstring,numeric,date,dollar,datetime
@@ -492,38 +485,31 @@ string,longstring,numeric,date,dollar,datetime
 .       ,.           ,.,.,.  ,.
 5555    ,Five        ,5,05-MAY-2005,$5.00,05-MAY-2005 05:05
 
-Variable,Description,Position
-string,"Label: A Short String Variable
-Format: A8
-Missing Values: ""3333    ""
-
-Value,Label
-1111    ,ones
-2222    ,twos
-3333    ,threes",1
-longstring,"Label: A Long String Variable
-Format: A12",2
-numeric,"Label: A Numeric Variable
-Format: F10.0
-Missing Values: 9; 5; 999
-
-Value,Label
-1,Unity
-2,Duality
-3,Thripality
-
-Attribute,Value
-colour[1],blue
-colour[2],pink
-colour[3],violet
-nationality,foreign
-size,large",3
-date,"Label: A Date Variable
-Format: DATE11",4
-dollar,"Label: A Dollar Variable
-Format: DOLLAR11.2",5
-datetime,"Label: A Datetime Variable
-Format: DATETIME17.0",6
+Table: Variables
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
+string,1,A Short String Variable,Nominal,Input,8,Left,A8,A8,"""3333    """
+longstring,2,A Long String Variable,Nominal,Input,12,Left,A12,A12,
+numeric,3,A Numeric Variable,Scale,Input,8,Right,F10.0,F10.0,9; 5; 999
+date,4,A Date Variable,Scale,Input,8,Right,DATE11,DATE11,
+dollar,5,A Dollar Variable,Scale,Input,8,Right,DOLLAR11.2,DOLLAR11.2,
+datetime,6,A Datetime Variable,Scale,Input,8,Right,DATETIME17.0,DATETIME17.0,
+
+Table: Value Labels
+Variable,Value,Label
+string,1111    ,ones
+,2222    ,twos
+,3333    ,threes
+numeric,1,Unity
+,2,Duality
+,3,Thripality
+
+Table: Variable and Dataset Attributes
+Variable,Name,Value
+numeric,colour[1],blue
+,colour[2],pink
+,colour[3],violet
+,nationality,foreign
+,size,large
 
 Table: Data List
 string,longstring,numeric,date,dollar,datetime