Added most of the calculations for the ONEWAY command.
[pspp-builds.git] / src / inpt-pgm.c
index 69f5b0483db015877d4942ef5ec15196cbed4763..0cbf66f325569d54b828c98eac639c2124ac029b 100644 (file)
@@ -22,6 +22,7 @@
 #include <float.h>
 #include <stdlib.h>
 #include "alloc.h"
+#include "case.h"
 #include "command.h"
 #include "data-list.h"
 #include "dfm.h"
@@ -130,14 +131,14 @@ init_case (const struct input_program_pgm *inp, struct ccase *c)
     switch (inp->init[i]) 
       {
       case INP_NUMERIC | INP_INIT_ONCE:
-        c->data[i].f = 0.0;
+        case_data_rw (c, i)->f = 0.0;
         break;
       case INP_NUMERIC | INP_REINIT:
-        c->data[i].f = SYSMIS;
+        case_data_rw (c, i)->f = SYSMIS;
         break;
       case INP_STRING | INP_INIT_ONCE:
       case INP_STRING | INP_REINIT:
-        memset (c->data[i].s, ' ', sizeof c->data[i].s);
+        memset (case_data_rw (c, i)->s, ' ', sizeof case_data_rw (c, i)->s);
         break;
       default:
         assert (0);
@@ -156,12 +157,12 @@ clear_case (const struct input_program_pgm *inp, struct ccase *c)
       case INP_NUMERIC | INP_INIT_ONCE:
         break;
       case INP_NUMERIC | INP_REINIT:
-        c->data[i].f = SYSMIS;
+        case_data_rw (c, i)->f = SYSMIS;
         break;
       case INP_STRING | INP_INIT_ONCE:
         break;
       case INP_STRING | INP_REINIT:
-        memset (c->data[i].s, ' ', sizeof c->data[i].s);
+        memset (case_data_rw (c, i)->s, ' ', sizeof case_data_rw (c, i)->s);
         break;
       default:
         assert (0);
@@ -383,7 +384,7 @@ reread_trns_proc (struct trns_header * pt, struct ccase * c,
   struct reread_trns *t = (struct reread_trns *) pt;
 
   if (t->column == NULL)
-    dfm_bkwd_record (t->handle, 1);
+    dfm_reread_record (t->handle, 1);
   else
     {
       union value column;
@@ -393,10 +394,10 @@ reread_trns_proc (struct trns_header * pt, struct ccase * c,
        {
          msg (SE, _("REREAD: Column numbers must be positive finite "
               "numbers.  Column set to 1."));
-         dfm_bkwd_record (t->handle, 1);
+         dfm_reread_record (t->handle, 1);
        }
       else
-       dfm_bkwd_record (t->handle, column.f);
+       dfm_reread_record (t->handle, column.f);
     }
   return -1;
 }