Encapsulated the static data of procedure.[ch] into a single object, to be
[pspp-builds.git] / src / language / data-io / list.q
index e377cb41c96a944974252f74c52703b2d0e069bf..54b09c34f7a8548fbbdc7f76805ae7da16f2dbe1 100644 (file)
@@ -52,9 +52,9 @@
    list (lst_):
      *variables=varlist("PV_NO_SCRATCH");
      cases=:from n:first,"%s>0"/by n:step,"%s>0"/ *to n:last,"%s>0";
-     format=numbering:numbered/!unnumbered,
-            wrap:!wrap/single,
-            weight:weight/!noweight.
+     +format=numbering:numbered/!unnumbered,
+             wrap:!wrap/single,
+             weight:weight/!noweight.
 */
 /* (declarations) */
 /* (functions) */
@@ -134,7 +134,7 @@ cmd_list (void)
   struct variable casenum_var;
   bool ok;
 
-  if (!parse_list (&cmd))
+  if (!parse_list (&cmd, NULL))
     return CMD_FAILURE;
   
   /* Fill in defaults. */
@@ -145,7 +145,7 @@ cmd_list (void)
   if (cmd.last == NOT_LONG)
     cmd.last = LONG_MAX;
   if (!cmd.sbc_variables)
-    dict_get_vars (default_dict, &cmd.v_variables, &cmd.n_variables,
+    dict_get_vars (dataset_dict (current_dataset), &cmd.v_variables, &cmd.n_variables,
                   (1u << DC_SYSTEM) | (1u << DC_SCRATCH));
   if (cmd.n_variables == 0)
     {
@@ -185,12 +185,12 @@ cmd_list (void)
   /* Weighting variable. */
   if (cmd.weight == LST_WEIGHT)
     {
-      if (dict_get_weight (default_dict) != NULL)
+      if (dict_get_weight (dataset_dict (current_dataset)) != NULL)
        {
          size_t i;
 
          for (i = 0; i < cmd.n_variables; i++)
-           if (cmd.v_variables[i] == dict_get_weight (default_dict))
+           if (cmd.v_variables[i] == dict_get_weight (dataset_dict (current_dataset)))
              break;
          if (i >= cmd.n_variables)
            {
@@ -199,7 +199,7 @@ cmd_list (void)
              cmd.v_variables = xnrealloc (cmd.v_variables, cmd.n_variables,
                                            sizeof *cmd.v_variables);
              cmd.v_variables[cmd.n_variables - 1]
-                = dict_get_weight (default_dict);
+                = dict_get_weight (dataset_dict (current_dataset));
            }
        }
       else
@@ -229,7 +229,7 @@ cmd_list (void)
   determine_layout ();
 
   case_idx = 0;
-  ok = procedure_with_splits (write_all_headers, list_cases, NULL, NULL);
+  ok = procedure_with_splits (current_dataset, write_all_headers, list_cases, NULL, NULL);
   ds_destroy(&line_buffer);
 
   clean_up ();
@@ -269,7 +269,7 @@ write_all_headers (const struct ccase *c, void *aux UNUSED)
          fputs ("  </TR>\n", x->file);
        }
       else
-       assert (0);
+       NOT_REACHED ();
     }
 }
 
@@ -387,7 +387,7 @@ clean_up (void)
          }
       }
     else
-      assert (0);
+      NOT_REACHED ();
   
   free (cmd.v_variables);
 }
@@ -718,7 +718,7 @@ list_cases (const struct ccase *c, void *aux UNUSED)
        fputs ("  </TR>\n", x->file);
       }
     else
-      assert (0);
+      NOT_REACHED ();
 
   return true;
 }