Improve CROSSTABS description
[pspp] / src / recode.c
index d799a38b4a70b838e9c2f32d90fbf15ba430b609..185067bae8a263e337b763a3b67035f23d57c6b4 100644 (file)
@@ -23,7 +23,6 @@
 #include <stdlib.h>
 #include "alloc.h"
 #include "approx.h"
-#include "cases.h"
 #include "command.h"
 #include "error.h"
 #include "lexer.h"
@@ -31,8 +30,6 @@
 #include "str.h"
 #include "var.h"
 
-#undef DEBUGGING
-/*#define DEBUGGING 1 */
 #include "debug-print.h"
 \f
 /* Definitions. */
@@ -112,7 +109,7 @@ static void recode_trns_free (struct trns_header *);
 static double convert_to_double (char *, int);
 
 #if DEBUGGING
-static void debug_print (rcd_var * head);
+static void debug_print (struct rcd_var * head);
 #endif
 \f
 /* Parser. */
@@ -167,7 +164,7 @@ cmd_recode (void)
       rcd->sysmis.f = 0;
 
       /* Parse variable names. */
-      if (!parse_variables (NULL, &v, &nv, PV_SAME_TYPE))
+      if (!parse_variables (default_dict, &v, &nv, PV_SAME_TYPE))
        goto lossage;
 
       /* Ensure all variables are same type; find length of longest
@@ -297,7 +294,7 @@ cmd_recode (void)
          if ((rcd->flags & RCD_DEST_MASK) == RCD_DEST_STRING)
            for (i = 0, iter = rcd; i < nv; i++, iter = iter->next)
              {
-               struct variable *v = find_variable (names[i]);
+               struct variable *v = dict_lookup_var (default_dict, names[i]);
 
                if (!v)
                  {
@@ -323,7 +320,7 @@ cmd_recode (void)
          else
            for (i = 0, iter = rcd; i < nv; i++, iter = iter->next)
              {
-               struct variable *v = find_variable (names[i]);
+               struct variable *v = dict_lookup_var (default_dict, names[i]);
 
                if (v)
                  {
@@ -415,17 +412,14 @@ cmd_recode (void)
   for (rcd = head; rcd; rcd = rcd->next)
     if (rcd->dest_name[0])
       {
-       rcd->dest = create_variable (&default_dict, rcd->dest_name,
-                                    NUMERIC, 0);
+       rcd->dest = dict_create_var (default_dict, rcd->dest_name, 0);
        if (!rcd->dest)
          {
-           /* This can occur if a destname is duplicated.  We could
-              give an error at parse time but I don't care enough. */
-           rcd->dest = find_variable (rcd->dest_name);
-           assert (rcd->dest != NULL);
+           /* FIXME: This can occur if a destname is duplicated.
+              We could give an error at parse time but I don't
+              care enough. */
+           rcd->dest = dict_lookup_var_assert (default_dict, rcd->dest_name);
          }
-       else
-         envector (rcd->dest);
       }
 
   trns = xmalloc (sizeof *trns);
@@ -931,7 +925,7 @@ debug_print (struct rcd_var * head)
    success, NOT_LONG on failure.  On success stores a pointer to the
    first character after the number into *ENDPTR.  From the GNU C
    library. */
-long int
+static long int
 string_to_long (char *nptr, int width, char **endptr)
 {
   int negative;