Redo VFM interface. Get rid of compaction_necessary, compaction_nval,
[pspp] / src / print.c
index 7d5b73b8cc75a81fc38916b761d142d40737c16a..17c0eab2376c9ba146af38c28c3448f796e06e21 100644 (file)
@@ -17,6 +17,8 @@
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    02111-1307, USA. */
 
+/* FIXME: seems like a lot of code duplication with data-list.c. */
+
 #include <config.h>
 #include <assert.h>
 #include <stdlib.h>
@@ -96,8 +98,8 @@ static struct prt_out_spec *next;
 static int nrec;
 
 static int internal_cmd_print (int flags);
-static int print_trns_proc (struct trns_header *, struct ccase *);
-static void print_trns_free (struct trns_header *);
+static trns_proc_func print_trns_proc;
+static trns_free_func print_trns_free;
 static int parse_specs (void);
 static void dump_table (void);
 static void append_var_spec (struct prt_out_spec *spec);
@@ -717,7 +719,7 @@ dump_fmt_list (struct fmt_list * f)
 static struct fmt_list *
 fixed_parse_fortran (void)
 {
-  struct fmt_list *head;
+  struct fmt_list *head = NULL;
   struct fmt_list *fl = NULL;
 
   lex_get ();                  /* skip opening parenthesis */
@@ -886,8 +888,8 @@ alloc_line (void)
          pot_w = i->fc + 1;
          break;
        case PRT_ERROR:
+        default:
          assert (0);
-         break;
        }
       if (pot_w > w)
        w = pot_w;
@@ -900,7 +902,8 @@ alloc_line (void)
 
 /* Performs the transformation inside print_trns T on case C. */
 static int
-print_trns_proc (struct trns_header * trns, struct ccase * c)
+print_trns_proc (struct trns_header * trns, struct ccase * c,
+                 int case_num UNUSED)
 {
   /* Transformation. */
   struct print_trns *t = (struct print_trns *) trns;
@@ -958,14 +961,7 @@ print_trns_proc (struct trns_header * trns, struct ccase * c)
        break;
 
       case PRT_VAR:
-       if (i->u.v.v->type == NUMERIC)
-         data_out (&buf[i->fc], &i->u.v.f, &c->data[i->u.v.v->fv]);
-       else
-         {
-           union value t;
-           t.c = c->data[i->u.v.v->fv].s;
-           data_out (&buf[i->fc], &i->u.v.f, &t);
-         }
+        data_out (&buf[i->fc], &i->u.v.f, &c->data[i->u.v.v->fv]);
        len = i->fc + i->u.v.f.w;
        break;
 
@@ -1022,8 +1018,8 @@ struct print_space_trns
 }
 print_space_trns;
 
-static int print_space_trns_proc (struct trns_header *, struct ccase *);
-static void print_space_trns_free (struct trns_header *);
+static trns_proc_func print_space_trns_proc;
+static trns_free_func print_space_trns_free;
 
 int
 cmd_print_space (void)
@@ -1082,7 +1078,8 @@ cmd_print_space (void)
 }
 
 static int
-print_space_trns_proc (struct trns_header * trns, struct ccase * c)
+print_space_trns_proc (struct trns_header * trns, struct ccase * c,
+                       int case_num UNUSED)
 {
   struct print_space_trns *t = (struct print_space_trns *) trns;
   int n;
@@ -1091,7 +1088,7 @@ print_space_trns_proc (struct trns_header * trns, struct ccase * c)
     {
       union value v;
 
-      expr_evaluate (t->e, c, &v);
+      expr_evaluate (t->e, c, case_num, &v);
       n = v.f;
       if (n < 0)
        {