pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp src/data/dictionary.c src/data/procedure.c...


From: John Darrington
Subject: [Pspp-cvs] pspp src/data/dictionary.c src/data/procedure.c...
Date: Thu, 26 Oct 2006 06:16:37 +0000

CVSROOT:        /sources/pspp
Module name:    pspp
Changes by:     John Darrington <jmd>   06/10/26 06:16:37

Modified files:
        src/data       : dictionary.c procedure.c procedure.h 
                         transformations.h 
        src/language   : command.c command.h 
        src/language/control: control-stack.c do-if.c loop.c repeat.c 
                              temporary.c 
        src/language/data-io: data-list.c data-reader.c file-handle.q 
                              get.c inpt-pgm.c list.q matrix-data.c 
                              print-space.c print.c 
        src/language/dictionary: apply-dictionary.c formats.c 
                                 missing-values.c modify-variables.c 
                                 numeric.c rename-variables.c 
                                 split-file.c split-file.h 
                                 sys-file-info.c value-labels.c 
                                 variable-display.c variable-label.c 
                                 vector.c weight.c 
        src/language/expressions: evaluate.c generate.pl operations.def 
                                  parse.c private.h public.h 
        src/language/lexer: q2c.c variable-parser.c variable-parser.h 
        src/language/stats: aggregate.c autorecode.c correlations.q 
                            crosstabs.q descriptives.c examine.q flip.c 
                            frequencies.q means.q oneway.q rank.q 
                            regression.q sort-cases.c t-test.q 
        src/language/tests: casefile-test.c moments-test.c pool-test.c 
        src/language/utilities: date.c echo.c include.c permissions.c 
                                set.q title.c 
        src/language/xforms: compute.c count.c fail.c recode.c sample.c 
                             select-if.c 
        src/math       : levene.c levene.h sort.c sort.h 
        src/ui/terminal: main.c 
        tests/bugs     : lag_crash.sh 

Log message:
        Eliminated global variable current_dataset.
        The dataset is now owned by main, and passed around by pointer.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/dictionary.c?cvsroot=pspp&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/procedure.c?cvsroot=pspp&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/procedure.h?cvsroot=pspp&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/transformations.h?cvsroot=pspp&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/command.c?cvsroot=pspp&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/command.h?cvsroot=pspp&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/control/control-stack.c?cvsroot=pspp&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/control/do-if.c?cvsroot=pspp&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/control/loop.c?cvsroot=pspp&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/control/repeat.c?cvsroot=pspp&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/control/temporary.c?cvsroot=pspp&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/data-io/data-list.c?cvsroot=pspp&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/data-io/data-reader.c?cvsroot=pspp&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/data-io/file-handle.q?cvsroot=pspp&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/data-io/get.c?cvsroot=pspp&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/data-io/inpt-pgm.c?cvsroot=pspp&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/data-io/list.q?cvsroot=pspp&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/data-io/matrix-data.c?cvsroot=pspp&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/data-io/print-space.c?cvsroot=pspp&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/data-io/print.c?cvsroot=pspp&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/dictionary/apply-dictionary.c?cvsroot=pspp&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/dictionary/formats.c?cvsroot=pspp&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/dictionary/missing-values.c?cvsroot=pspp&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/dictionary/modify-variables.c?cvsroot=pspp&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/dictionary/numeric.c?cvsroot=pspp&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/dictionary/rename-variables.c?cvsroot=pspp&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/dictionary/split-file.c?cvsroot=pspp&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/dictionary/split-file.h?cvsroot=pspp&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/dictionary/sys-file-info.c?cvsroot=pspp&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/dictionary/value-labels.c?cvsroot=pspp&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/dictionary/variable-display.c?cvsroot=pspp&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/dictionary/variable-label.c?cvsroot=pspp&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/dictionary/vector.c?cvsroot=pspp&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/dictionary/weight.c?cvsroot=pspp&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/expressions/evaluate.c?cvsroot=pspp&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/expressions/generate.pl?cvsroot=pspp&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/expressions/operations.def?cvsroot=pspp&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/expressions/parse.c?cvsroot=pspp&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/expressions/private.h?cvsroot=pspp&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/expressions/public.h?cvsroot=pspp&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/lexer/q2c.c?cvsroot=pspp&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/lexer/variable-parser.c?cvsroot=pspp&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/lexer/variable-parser.h?cvsroot=pspp&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/aggregate.c?cvsroot=pspp&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/autorecode.c?cvsroot=pspp&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/correlations.q?cvsroot=pspp&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/crosstabs.q?cvsroot=pspp&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/descriptives.c?cvsroot=pspp&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/examine.q?cvsroot=pspp&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/flip.c?cvsroot=pspp&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/frequencies.q?cvsroot=pspp&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/means.q?cvsroot=pspp&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/oneway.q?cvsroot=pspp&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/rank.q?cvsroot=pspp&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/regression.q?cvsroot=pspp&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/sort-cases.c?cvsroot=pspp&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/t-test.q?cvsroot=pspp&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/tests/casefile-test.c?cvsroot=pspp&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/tests/moments-test.c?cvsroot=pspp&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/tests/pool-test.c?cvsroot=pspp&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/utilities/date.c?cvsroot=pspp&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/utilities/echo.c?cvsroot=pspp&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/utilities/include.c?cvsroot=pspp&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/utilities/permissions.c?cvsroot=pspp&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/utilities/set.q?cvsroot=pspp&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/utilities/title.c?cvsroot=pspp&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/xforms/compute.c?cvsroot=pspp&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/xforms/count.c?cvsroot=pspp&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/xforms/fail.c?cvsroot=pspp&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/xforms/recode.c?cvsroot=pspp&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/xforms/sample.c?cvsroot=pspp&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/xforms/select-if.c?cvsroot=pspp&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/pspp/src/math/levene.c?cvsroot=pspp&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pspp/src/math/levene.h?cvsroot=pspp&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/pspp/src/math/sort.c?cvsroot=pspp&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/pspp/src/math/sort.h?cvsroot=pspp&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/terminal/main.c?cvsroot=pspp&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/pspp/tests/bugs/lag_crash.sh?cvsroot=pspp&r1=1.5&r2=1.6

Patches:
Index: src/data/dictionary.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/dictionary.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- src/data/dictionary.c       19 Oct 2006 15:04:52 -0000      1.15
+++ src/data/dictionary.c       26 Oct 2006 06:16:36 -0000      1.16
@@ -435,8 +435,8 @@
 /* Deletes variable V from dictionary D and frees V.
 
    This is a very bad idea if there might be any pointers to V
-   from outside D.  In general, no variable in current_dataset->dict
-   should be deleted when any transformations are active, because
+   from outside D.  In general, no variable in should be deleted when 
+   any transformations are active on the dictionary's dataset, because
    those transformations might reference the deleted variable.
    The safest time to delete a variable is just after a procedure
    has been executed, as done by MODIFY VARS.

Index: src/data/procedure.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/procedure.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- src/data/procedure.c        19 Oct 2006 15:04:52 -0000      1.14
+++ src/data/procedure.c        26 Oct 2006 06:16:36 -0000      1.15
@@ -43,7 +43,7 @@
 struct write_case_data
   {
     /* Function to call for each case. */
-    case_func_t case_func;
+    case_func *proc;
     void *aux;
 
     struct dataset *dataset;    /* The dataset concerned */
@@ -88,13 +88,11 @@
 }; /* struct dataset */
 
 
-struct dataset *current_dataset;
-
 static void add_case_limit_trns (struct dataset *ds);
 static void add_filter_trns (struct dataset *ds);
 
-static bool internal_procedure (struct dataset *ds, case_func_t,
-                                bool (*end_func) (void *),
+static bool internal_procedure (struct dataset *ds, case_func *,
+                                end_func *,
                                 void *aux);
 static void update_last_proc_invocation (struct dataset *ds);
 static void create_trns_case (struct ccase *, struct dictionary *);
@@ -135,7 +133,7 @@
 
    Returns true if successful, false if an I/O error occurred. */
 bool
-procedure (struct dataset *ds, case_func_t cf, void *aux)
+procedure (struct dataset *ds, case_func *cf, void *aux)
 {
   return internal_procedure (ds, cf, NULL, aux);
 }
@@ -152,7 +150,7 @@
 
 /* Case processing function for multipass_procedure(). */
 static bool
-multipass_case_func (const struct ccase *c, void *aux_data_) 
+multipass_case_func (const struct ccase *c, void *aux_data_, const struct 
dataset *ds UNUSED) 
 {
   struct multipass_aux_data *aux_data = aux_data_;
   return casefile_append (aux_data->casefile, c);
@@ -160,7 +158,7 @@
 
 /* End-of-file function for multipass_procedure(). */
 static bool
-multipass_end_func (void *aux_data_) 
+multipass_end_func (void *aux_data_, const struct dataset *ds UNUSED) 
 {
   struct multipass_aux_data *aux_data = aux_data_;
   return (aux_data->proc_func == NULL
@@ -171,7 +169,7 @@
    The entire active file is passed to PROC_FUNC, with the given
    AUX as auxiliary data, as a unit. */
 bool
-multipass_procedure (struct dataset *ds, casefile_func_t proc_func,  void 
*aux) 
+multipass_procedure (struct dataset *ds, casefile_func *proc_func,  void *aux) 
 {
   struct multipass_aux_data aux_data;
   bool ok;
@@ -197,8 +195,8 @@
    Returns true if successful, false if an I/O error occurred (or
    if CASE_FUNC or END_FUNC ever returned false). */
 static bool
-internal_procedure (struct dataset *ds, case_func_t case_func,
-                    bool (*end_func) (void *),
+internal_procedure (struct dataset *ds, case_func *proc,
+                   end_func *end,
                     void *aux) 
 {
   struct write_case_data wc_data;
@@ -210,7 +208,7 @@
 
   /* Optimize the trivial case where we're not going to do
      anything with the data, by not reading the data at all. */
-  if (case_func == NULL && end_func == NULL
+  if (proc == NULL && end == NULL
       && case_source_is_class (ds->proc_source, &storage_source_class)
       && ds->proc_sink == NULL
       && (ds->temporary_trns_chain == NULL
@@ -225,7 +223,7 @@
   
   open_active_file (ds);
   
-  wc_data.case_func = case_func;
+  wc_data.proc = proc;
   wc_data.aux = aux;
   wc_data.dataset = ds;
   create_trns_case (&wc_data.trns_case, ds->dict);
@@ -236,8 +234,8 @@
   ok = ds->proc_source->class->read (ds->proc_source,
                                  &wc_data.trns_case,
                                  write_case, &wc_data) && ok;
-  if (end_func != NULL)
-    ok = end_func (aux) && ok;
+  if (end != NULL)
+    ok = end (aux, ds) && ok;
 
   case_destroy (&wc_data.sink_case);
   case_destroy (&wc_data.trns_case);
@@ -365,8 +363,8 @@
     }
 
   /* Pass case to procedure. */
-  if (wc_data->case_func != NULL)
-    if (!wc_data->case_func (&wc_data->trns_case, wc_data->aux))
+  if (wc_data->proc != NULL)
+    if (!wc_data->proc (&wc_data->trns_case, wc_data->aux, ds))
       retval = TRNS_ERROR;
 
  done:
@@ -476,15 +474,15 @@
     struct ccase prev_case;     /* Data in previous case. */
 
     /* Callback functions. */
-    begin_func_t begin_func ; 
-    case_func_t proc_func ;
-    void (*end_func) (void *);
+    begin_func *begin; 
+    case_func *proc;
+    end_func *end;
     void *func_aux;
   };
 
 static int equal_splits (const struct ccase *, const struct ccase *, const 
struct dataset *ds);
-static bool split_procedure_case_func (const struct ccase *c, void *);
-static bool split_procedure_end_func (void *);
+static bool split_procedure_case_func (const struct ccase *c, void *, const 
struct dataset *);
+static bool split_procedure_end_func (void *, const struct dataset *);
 
 /* Like procedure(), but it automatically breaks the case stream
    into SPLIT FILE break groups.  Before each group of cases with
@@ -505,18 +503,18 @@
    Returns true if successful, false if an I/O error occurred. */
 bool
 procedure_with_splits (struct dataset *ds,
-                      begin_func_t begin_func, 
-                      case_func_t proc_func,
-                       void (*end_func) (void *aux),
+                      begin_func begin, 
+                      case_func *proc,
+                       end_func *end,
                        void *func_aux) 
 {
   struct split_aux_data split_aux;
   bool ok;
 
   case_nullify (&split_aux.prev_case);
-  split_aux.begin_func = begin_func;
-  split_aux.proc_func = proc_func;
-  split_aux.end_func = end_func;
+  split_aux.begin = begin;
+  split_aux.proc = proc;
+  split_aux.end = end;
   split_aux.func_aux = func_aux;
   split_aux.dataset = ds;
 
@@ -530,7 +528,7 @@
 
 /* Case callback used by procedure_with_splits(). */
 static bool
-split_procedure_case_func (const struct ccase *c, void *split_aux_) 
+split_procedure_case_func (const struct ccase *c, void *split_aux_, const 
struct dataset *ds) 
 {
   struct split_aux_data *split_aux = split_aux_;
 
@@ -538,29 +536,28 @@
   if (case_is_null (&split_aux->prev_case)
       || !equal_splits (c, &split_aux->prev_case, split_aux->dataset))
     {
-      if (!case_is_null (&split_aux->prev_case) && split_aux->end_func != NULL)
-        split_aux->end_func (split_aux->func_aux);
+      if (!case_is_null (&split_aux->prev_case) && split_aux->end != NULL)
+        split_aux->end (split_aux->func_aux, ds);
 
       case_destroy (&split_aux->prev_case);
       case_clone (&split_aux->prev_case, c);
 
-      if (split_aux->begin_func != NULL)
-       split_aux->begin_func (&split_aux->prev_case, split_aux->func_aux);
-
+      if (split_aux->begin != NULL)
+       split_aux->begin (&split_aux->prev_case, split_aux->func_aux, ds);
     }
 
-  return (split_aux->proc_func == NULL
-          || split_aux->proc_func (c, split_aux->func_aux));
+  return (split_aux->proc == NULL
+          || split_aux->proc (c, split_aux->func_aux, ds));
 }
 
 /* End-of-file callback used by procedure_with_splits(). */
 static bool
-split_procedure_end_func (void *split_aux_) 
+split_procedure_end_func (void *split_aux_, const struct dataset *ds) 
 {
   struct split_aux_data *split_aux = split_aux_;
 
-  if (!case_is_null (&split_aux->prev_case) && split_aux->end_func != NULL)
-    split_aux->end_func (split_aux->func_aux);
+  if (!case_is_null (&split_aux->prev_case) && split_aux->end != NULL)
+    split_aux->end (split_aux->func_aux, ds);
   return true;
 }
 
@@ -585,23 +582,19 @@
     struct dataset *dataset;    /* The dataset of the split */
     struct ccase prev_case;     /* Data in previous case. */
     struct casefile *casefile;  /* Accumulates data for a split. */
-
-    /* Function to call with the accumulated data. */
-    bool (*split_func) (const struct ccase *first, const struct casefile *,
-                        void *);
+    split_func *split;          /* Function to call with the accumulated 
+                                  data. */
     void *func_aux;                            /* Auxiliary data. */ 
   };
 
-static bool multipass_split_case_func (const struct ccase *c, void *aux_);
-static bool multipass_split_end_func (void *aux_);
-static bool multipass_split_output (struct multipass_split_aux_data *);
+static bool multipass_split_case_func (const struct ccase *c, void *aux_, 
const struct dataset *);
+static bool multipass_split_end_func (void *aux_, const struct dataset *ds);
+static bool multipass_split_output (struct multipass_split_aux_data *, const 
struct dataset *ds);
 
 /* Returns true if successful, false if an I/O error occurred. */
 bool
 multipass_procedure_with_splits (struct dataset *ds, 
-                                bool (*split_func) (const struct ccase *first,
-                                                     const struct casefile *,
-                                                     void *aux),
+                                split_func  *split,
                                  void *func_aux)
 {
   struct multipass_split_aux_data aux;
@@ -609,7 +602,7 @@
 
   case_nullify (&aux.prev_case);
   aux.casefile = NULL;
-  aux.split_func = split_func;
+  aux.split = split;
   aux.func_aux = func_aux;
   aux.dataset = ds;
 
@@ -622,10 +615,9 @@
 
 /* Case callback used by multipass_procedure_with_splits(). */
 static bool
-multipass_split_case_func (const struct ccase *c, void *aux_)
+multipass_split_case_func (const struct ccase *c, void *aux_, const struct 
dataset *ds)
 {
   struct multipass_split_aux_data *aux = aux_;
-  struct dataset *ds = aux->dataset;
   bool ok = true;
 
   /* Start a new series if needed. */
@@ -637,7 +629,7 @@
 
       /* Pass any cases to split_func. */
       if (aux->casefile != NULL)
-        ok = multipass_split_output (aux);
+        ok = multipass_split_output (aux, ds);
 
       /* Start a new casefile. */
       aux->casefile = 
@@ -649,19 +641,19 @@
 
 /* End-of-file callback used by multipass_procedure_with_splits(). */
 static bool
-multipass_split_end_func (void *aux_)
+multipass_split_end_func (void *aux_, const struct dataset *ds)
 {
   struct multipass_split_aux_data *aux = aux_;
-  return (aux->casefile == NULL || multipass_split_output (aux));
+  return (aux->casefile == NULL || multipass_split_output (aux, ds));
 }
 
 static bool
-multipass_split_output (struct multipass_split_aux_data *aux)
+multipass_split_output (struct multipass_split_aux_data *aux, const struct 
dataset *ds)
 {
   bool ok;
   
   assert (aux->casefile != NULL);
-  ok = aux->split_func (&aux->prev_case, aux->casefile, aux->func_aux);
+  ok = aux->split (&aux->prev_case, aux->casefile, aux->func_aux, ds);
   casefile_destroy (aux->casefile);
   aux->casefile = NULL;
 
@@ -827,6 +819,7 @@
 {
   discard_variables (ds);
   dict_destroy (ds->dict);
+  trns_chain_destroy (ds->permanent_trns_chain);
   free (ds);
 }
 
@@ -901,7 +894,7 @@
    *CASES_REMAINING. */
 static int
 case_limit_trns_proc (void *cases_remaining_,
-                      struct ccase *c UNUSED, casenum_t case_nr UNUSED) 
+                      struct ccase *c UNUSED, casenumber case_nr UNUSED) 
 {
   size_t *cases_remaining = cases_remaining_;
   if (*cases_remaining > 0) 
@@ -940,7 +933,7 @@
 /* FILTER transformation. */
 static int
 filter_trns_proc (void *filter_var_,
-                  struct ccase *c UNUSED, casenum_t case_nr UNUSED) 
+                  struct ccase *c UNUSED, casenumber case_nr UNUSED) 
   
 {
   struct variable *filter_var = filter_var_;

Index: src/data/procedure.h
===================================================================
RCS file: /sources/pspp/pspp/src/data/procedure.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- src/data/procedure.h        19 Oct 2006 15:04:52 -0000      1.5
+++ src/data/procedure.h        26 Oct 2006 06:16:36 -0000      1.6
@@ -68,26 +68,29 @@
 void proc_set_sink (struct dataset *ds, struct case_sink *);
 struct casefile *proc_capture_output (struct dataset *ds);
 
-typedef bool (*casefile_func_t) (const struct casefile *, void *);
-typedef bool (*case_func_t) (const struct ccase *, void *);
-typedef void (*begin_func_t) (const struct ccase *, void *);
+typedef bool casefile_func (const struct casefile *, void *);
+typedef bool case_func (const struct ccase *, void *, const struct dataset *);
+typedef void begin_func (const struct ccase *, void *, const struct dataset*);
 
+typedef bool end_func (void *, const struct dataset *);
 
+typedef bool split_func (const struct ccase *, const struct casefile *,
+                             void *, const struct dataset *);
 
-bool procedure (struct dataset *ds, case_func_t, void *aux)  
WARN_UNUSED_RESULT;
+
+
+bool procedure (struct dataset *ds, case_func *, void *aux)  
WARN_UNUSED_RESULT;
 
 bool procedure_with_splits (struct dataset *ds, 
-                           begin_func_t begin_func,
-                            case_func_t proc_func,
-                            void (*end_func) (void *),
+                           begin_func *,
+                            case_func *,
+                           end_func *,
                             void *aux)
      WARN_UNUSED_RESULT;
-bool multipass_procedure (struct dataset *ds, casefile_func_t, void  *aux)
+bool multipass_procedure (struct dataset *ds, casefile_func *, void  *aux)
      WARN_UNUSED_RESULT;
 bool multipass_procedure_with_splits (struct dataset *ds,
-                                          bool (*) (const struct ccase *,
-                                                    const struct casefile *,
-                                                    void *),
+                                          split_func *,
                                           void *aux)
      WARN_UNUSED_RESULT;
 
@@ -98,8 +101,6 @@
 
 struct ccase *lagged_case (const struct dataset *ds, int n_before);
 
-extern struct dataset *current_dataset;
-
 inline struct dictionary *dataset_dict (const struct dataset *ds);
 inline void dataset_set_dict ( struct dataset *ds, struct dictionary *dict);
 

Index: src/data/transformations.h
===================================================================
RCS file: /sources/pspp/pspp/src/data/transformations.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- src/data/transformations.h  25 Sep 2006 09:35:15 -0000      1.2
+++ src/data/transformations.h  26 Oct 2006 06:16:36 -0000      1.3
@@ -23,7 +23,7 @@
 #include <stdbool.h>
 #include <stddef.h>
 
-typedef unsigned long casenum_t ;
+typedef unsigned long casenumber ;
 
 /* trns_proc_func return values. */
 enum trns_result 
@@ -37,7 +37,7 @@
 
 struct ccase;
 typedef void trns_finalize_func (void *);
-typedef int trns_proc_func (void *, struct ccase *, casenum_t);
+typedef int trns_proc_func (void *, struct ccase *, casenumber);
 typedef bool trns_free_func (void *);
 
 /* Transformation chains. */

Index: src/language/command.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/command.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- src/language/command.c      19 Oct 2006 15:04:52 -0000      1.17
+++ src/language/command.c      26 Oct 2006 06:16:36 -0000      1.18
@@ -108,7 +108,7 @@
     enum states states;         /* States in which command is allowed. */
     enum flags flags;           /* Other command requirements. */
     const char *name;          /* Command name. */
-    int (*function) (void);    /* Function to call. */
+    int (*function) (struct dataset *);        /* Function to call. */
   };
 
 /* Define the command array. */
@@ -131,24 +131,24 @@
 /* Command parser. */
 
 static const struct command *parse_command_name (void);
-static enum cmd_result do_parse_command (enum cmd_state);
+static enum cmd_result do_parse_command (struct dataset *ds, enum cmd_state);
 
 /* Parses an entire command, from command name to terminating
    dot.  On failure, skips to the terminating dot.
    Returns the command's success or failure result. */
 enum cmd_result
-cmd_parse (enum cmd_state state) 
+cmd_parse (struct dataset *ds, enum cmd_state state) 
 {
   int result;
   
   som_new_series ();
 
-  result = do_parse_command (state);
+  result = do_parse_command (ds, state);
   if (cmd_result_is_failure (result)) 
     lex_discard_rest_of_command ();
 
   unset_cmd_algorithm ();
-  dict_clear_aux (dataset_dict (current_dataset));
+  dict_clear_aux (dataset_dict (ds));
 
   return result;
 }
@@ -156,7 +156,7 @@
 /* Parses an entire command, from command name to terminating
    dot. */
 static enum cmd_result
-do_parse_command (enum cmd_state state)
+do_parse_command (struct dataset *ds, enum cmd_state state)
 {
   const struct command *command;
   enum cmd_result result;
@@ -203,7 +203,7 @@
   /* Execute command. */
   msg_set_command_name (command->name);
   tab_set_command_name (command->name);
-  result = command->function ();
+  result = command->function (ds);
   tab_set_command_name (NULL);
   msg_set_command_name (NULL);
     
@@ -649,14 +649,14 @@
 
 /* Parse and execute FINISH command. */
 int
-cmd_finish (void)
+cmd_finish (struct dataset *ds UNUSED)
 {
   return CMD_FINISH;
 }
 
 /* Parses the N command. */
 int
-cmd_n_of_cases (void)
+cmd_n_of_cases (struct dataset *ds)
 {
   /* Value for N. */
   int x;
@@ -666,23 +666,23 @@
   x = lex_integer ();
   lex_get ();
   if (!lex_match_id ("ESTIMATED"))
-    dict_set_case_limit (dataset_dict (current_dataset), x);
+    dict_set_case_limit (dataset_dict (ds), x);
 
   return lex_end_of_command ();
 }
 
 /* Parses, performs the EXECUTE procedure. */
 int
-cmd_execute (void)
+cmd_execute (struct dataset *ds)
 {
-  if (!procedure (current_dataset,NULL, NULL))
+  if (!procedure (ds, NULL, NULL))
     return CMD_CASCADING_FAILURE;
   return lex_end_of_command ();
 }
 
 /* Parses, performs the ERASE command. */
 int
-cmd_erase (void)
+cmd_erase (struct dataset *ds UNUSED)
 {
   if (get_safer_mode ()) 
     { 
@@ -811,7 +811,7 @@
 
 /* Parses, performs the HOST command. */
 int
-cmd_host (void)
+cmd_host (struct dataset *ds UNUSED)
 {
   int code;
 
@@ -848,16 +848,16 @@
 
 /* Parses, performs the NEW FILE command. */
 int
-cmd_new_file (void)
+cmd_new_file (struct dataset *ds)
 {
-  discard_variables (current_dataset);
+  discard_variables (ds);
 
   return lex_end_of_command ();
 }
 
 /* Parses a comment. */
 int
-cmd_comment (void)
+cmd_comment (struct dataset *ds UNUSED)
 {
   lex_skip_comment ();
   return CMD_SUCCESS;

Index: src/language/command.h
===================================================================
RCS file: /sources/pspp/pspp/src/language/command.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- src/language/command.h      28 Jun 2006 05:49:03 -0000      1.5
+++ src/language/command.h      26 Oct 2006 06:16:36 -0000      1.6
@@ -54,13 +54,16 @@
     CMD_STATE_FILE_TYPE         /* Inside FILE TYPE. */
   };
 
-enum cmd_result cmd_parse (enum cmd_state);
+struct dataset;
+enum cmd_result cmd_parse (struct dataset *ds, enum cmd_state);
 
 struct command;
 const char *cmd_complete (const char *, const struct command **);
 
+struct dataset;
+
 /* Prototype all the command functions. */
-#define DEF_CMD(STATES, FLAGS, NAME, FUNCTION) int FUNCTION (void);
+#define DEF_CMD(STATES, FLAGS, NAME, FUNCTION) int FUNCTION (struct dataset *);
 #define UNIMPL_CMD(NAME, DESCRIPTION)
 #include "command.def"
 #undef DEF_CMD

Index: src/language/control/control-stack.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/control/control-stack.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- src/language/control/control-stack.c        22 Oct 2006 11:07:52 -0000      
1.5
+++ src/language/control/control-stack.c        26 Oct 2006 06:16:36 -0000      
1.6
@@ -75,7 +75,7 @@
 }
 
 void
-ctl_stack_pop (void *private UNUSED) 
+ctl_stack_pop (void *private) 
 {
   struct ctl_struct *top = ctl_stack;
   

Index: src/language/control/do-if.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/control/do-if.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- src/language/control/do-if.c        22 Oct 2006 11:07:52 -0000      1.8
+++ src/language/control/do-if.c        26 Oct 2006 06:16:36 -0000      1.9
@@ -75,6 +75,7 @@
 /* DO IF transformation. */
 struct do_if_trns
   {
+    struct dataset *ds;         /* The dataset */
     struct clause *clauses;     /* Clauses. */
     size_t clause_cnt;          /* Number of clauses. */
     int past_END_IF_index;      /* Transformation just past last clause. */
@@ -82,7 +83,7 @@
 
 static const struct ctl_class do_if_class;
 
-static int parse_clause (struct do_if_trns *);
+static int parse_clause (struct do_if_trns *, struct dataset *ds);
 static void add_clause (struct do_if_trns *,
                         struct expression *condition, int target_index);
 static void add_else (struct do_if_trns *);
@@ -97,34 +98,36 @@
 
 /* Parse DO IF. */
 int
-cmd_do_if (void)
+cmd_do_if (struct dataset *ds)
 {
   struct do_if_trns *do_if = xmalloc (sizeof *do_if);
   do_if->clauses = NULL;
   do_if->clause_cnt = 0;
+  do_if->ds = ds;
 
   ctl_stack_push (&do_if_class, do_if);
-  add_transformation_with_finalizer (current_dataset, do_if_finalize_func,
+  add_transformation_with_finalizer (ds, do_if_finalize_func,
                                      do_if_trns_proc, do_if_trns_free, do_if);
 
-  return parse_clause (do_if);
+  return parse_clause (do_if, ds);
 }
 
 /* Parse ELSE IF. */
 int
-cmd_else_if (void)
+cmd_else_if (struct dataset *ds)
 {
   struct do_if_trns *do_if = ctl_stack_top (&do_if_class);
   if (do_if == NULL || !must_not_have_else (do_if))
     return CMD_CASCADING_FAILURE;
-  return parse_clause (do_if);
+  return parse_clause (do_if, ds);
 }
 
 /* Parse ELSE. */
 int
-cmd_else (void)
+cmd_else (struct dataset *ds)
 {
   struct do_if_trns *do_if = ctl_stack_top (&do_if_class);
+  assert (ds == do_if->ds);
   if (do_if == NULL || !must_not_have_else (do_if))
     return CMD_CASCADING_FAILURE;
   add_else (do_if);
@@ -133,9 +136,11 @@
 
 /* Parse END IF. */
 int
-cmd_end_if (void)
+cmd_end_if (struct dataset *ds)
 {
   struct do_if_trns *do_if = ctl_stack_top (&do_if_class);
+  assert (ds == do_if->ds);
+
   if (do_if == NULL)
     return CMD_CASCADING_FAILURE;
 
@@ -153,7 +158,7 @@
   
   if (!has_else (do_if)) 
     add_else (do_if);
-  do_if->past_END_IF_index = next_transformation (current_dataset);
+  do_if->past_END_IF_index = next_transformation (do_if->ds);
 }
 
 /* Adds an ELSE clause to DO_IF pointing to the next
@@ -162,7 +167,7 @@
 add_else (struct do_if_trns *do_if) 
 {
   assert (!has_else (do_if));
-  add_clause (do_if, NULL, next_transformation (current_dataset));
+  add_clause (do_if, NULL, next_transformation (do_if->ds));
 }
 
 /* Returns true if DO_IF does not yet have an ELSE clause.
@@ -192,15 +197,15 @@
    corresponding clause to DO_IF.  Checks for end of command and
    returns a command return code. */
 static int
-parse_clause (struct do_if_trns *do_if)
+parse_clause (struct do_if_trns *do_if, struct dataset *ds)
 {
   struct expression *condition;
 
-  condition = expr_parse (dataset_dict (current_dataset), EXPR_BOOLEAN);
+  condition = expr_parse (ds, EXPR_BOOLEAN);
   if (condition == NULL)
     return CMD_CASCADING_FAILURE;
 
-  add_clause (do_if, condition, next_transformation (current_dataset));
+  add_clause (do_if, condition, next_transformation (ds));
 
   return lex_end_of_command ();
 }
@@ -214,7 +219,7 @@
   struct clause *clause;
 
   if (do_if->clause_cnt > 0)
-    add_transformation (current_dataset, break_trns_proc, NULL, do_if);
+    add_transformation (do_if->ds, break_trns_proc, NULL, do_if);
 
   do_if->clauses = xnrealloc (do_if->clauses,
                               do_if->clause_cnt + 1, sizeof *do_if->clauses);
@@ -238,7 +243,7 @@
    Checks each clause and jumps to the appropriate
    transformation. */
 static int 
-do_if_trns_proc (void *do_if_, struct ccase *c, casenum_t case_num UNUSED)
+do_if_trns_proc (void *do_if_, struct ccase *c, casenumber case_num UNUSED)
 {
   struct do_if_trns *do_if = do_if_;
   struct clause *clause;
@@ -277,7 +282,7 @@
 
 /* Breaks out of a DO IF construct. */
 static int 
-break_trns_proc (void *do_if_, struct ccase *c UNUSED, casenum_t case_num 
UNUSED)
+break_trns_proc (void *do_if_, struct ccase *c UNUSED, casenumber case_num 
UNUSED)
 {
   struct do_if_trns *do_if = do_if_;
 

Index: src/language/control/loop.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/control/loop.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- src/language/control/loop.c 22 Oct 2006 11:07:52 -0000      1.9
+++ src/language/control/loop.c 26 Oct 2006 06:16:36 -0000      1.10
@@ -58,6 +58,7 @@
 struct loop_trns
   {
     struct pool *pool;
+    struct dataset *ds;
 
     /* Iteration limit. */
     int max_pass_count;         /* Maximum number of passes (-1=unlimited). */
@@ -85,7 +86,7 @@
 static trns_proc_func loop_trns_proc, end_loop_trns_proc, break_trns_proc;
 static trns_free_func loop_trns_free;
 
-static struct loop_trns *create_loop_trns (void);
+static struct loop_trns *create_loop_trns (struct dataset *);
 static bool parse_if_clause (struct loop_trns *, struct expression **);
 static bool parse_index_clause (struct loop_trns *, char index_var_name[]);
 static void close_loop (void *);
@@ -94,13 +95,13 @@
 
 /* Parses LOOP. */
 int
-cmd_loop (void)
+cmd_loop (struct dataset *ds)
 {
   struct loop_trns *loop;
   char index_var_name[LONG_NAME_LEN + 1];
   bool ok = true;
 
-  loop = create_loop_trns ();
+  loop = create_loop_trns (ds);
   while (token != '.' && ok) 
     {
       if (lex_match_id ("IF")) 
@@ -112,9 +113,10 @@
   /* Find index variable and create if necessary. */
   if (ok && index_var_name[0] != '\0')
     {
-      loop->index_var = dict_lookup_var (dataset_dict (current_dataset), 
index_var_name);
+      loop->index_var = dict_lookup_var (dataset_dict (ds), index_var_name);
       if (loop->index_var == NULL)
-        loop->index_var = dict_create_var (dataset_dict (current_dataset), 
index_var_name, 0);
+        loop->index_var = dict_create_var (dataset_dict (ds), 
+                                          index_var_name, 0);
     }
   
   if (!ok)
@@ -124,7 +126,7 @@
 
 /* Parses END LOOP. */
 int
-cmd_end_loop (void)
+cmd_end_loop (struct dataset *ds)
 {
   struct loop_trns *loop;
   bool ok = true;
@@ -133,6 +135,8 @@
   if (loop == NULL)
     return CMD_CASCADING_FAILURE;
   
+  assert (loop->ds == ds);
+  
   /* Parse syntax. */
   if (lex_match_id ("IF"))
     ok = parse_if_clause (loop, &loop->end_loop_condition);
@@ -149,13 +153,13 @@
 
 /* Parses BREAK. */
 int
-cmd_break (void)
+cmd_break (struct dataset *ds)
 {
   struct ctl_stmt *loop = ctl_stack_search (&loop_class);
   if (loop == NULL)
     return CMD_CASCADING_FAILURE;
 
-  add_transformation (current_dataset, break_trns_proc, NULL, loop);
+  add_transformation (ds, break_trns_proc, NULL, loop);
 
   return lex_end_of_command ();
 }
@@ -167,8 +171,8 @@
 {
   struct loop_trns *loop = loop_;
   
-  add_transformation (current_dataset, end_loop_trns_proc, NULL, loop);
-  loop->past_END_LOOP_index = next_transformation (current_dataset);
+  add_transformation (loop->ds, end_loop_trns_proc, NULL, loop);
+  loop->past_END_LOOP_index = next_transformation (loop->ds);
 
   /* If there's nothing else limiting the number of loops, use
      MXLOOPS as a limit. */
@@ -185,7 +189,7 @@
 static bool
 parse_if_clause (struct loop_trns *loop, struct expression **condition) 
 {
-  *condition = expr_parse_pool (loop->pool, dataset_dict (current_dataset), 
EXPR_BOOLEAN);
+  *condition = expr_parse_pool (loop->pool, loop->ds, EXPR_BOOLEAN);
   return *condition != NULL;
 }
 
@@ -206,7 +210,7 @@
   if (!lex_force_match ('='))
     return false;
 
-  loop->first_expr = expr_parse_pool (loop->pool, dataset_dict 
(current_dataset), EXPR_NUMBER);
+  loop->first_expr = expr_parse_pool (loop->pool, loop->ds, EXPR_NUMBER);
   if (loop->first_expr == NULL)
     return false;
 
@@ -225,7 +229,7 @@
           lex_sbc_only_once (e == &loop->last_expr ? "TO" : "BY");
           return false;
         }
-      *e = expr_parse_pool (loop->pool, dataset_dict (current_dataset), 
EXPR_NUMBER);
+      *e = expr_parse_pool (loop->pool, loop->ds, EXPR_NUMBER);
       if (*e == NULL)
         return false;
     }
@@ -242,7 +246,7 @@
 
 /* Creates, initializes, and returns a new loop_trns. */
 static struct loop_trns *
-create_loop_trns (void) 
+create_loop_trns (struct dataset *ds) 
 {
   struct loop_trns *loop = pool_create_container (struct loop_trns, pool);
   loop->max_pass_count = -1;
@@ -250,10 +254,11 @@
   loop->index_var = NULL;
   loop->first_expr = loop->by_expr = loop->last_expr = NULL;
   loop->loop_condition = loop->end_loop_condition = NULL;
+  loop->ds = ds;
 
-  add_transformation_with_finalizer (current_dataset, loop_trns_finalize,
+  add_transformation_with_finalizer (ds, loop_trns_finalize,
                                      loop_trns_proc, loop_trns_free, loop);
-  loop->past_LOOP_index = next_transformation (current_dataset);
+  loop->past_LOOP_index = next_transformation (ds);
 
   ctl_stack_push (&loop_class, loop);
 
@@ -273,7 +278,7 @@
 
 /* Sets up LOOP for the first pass. */
 static int
-loop_trns_proc (void *loop_, struct ccase *c, casenum_t case_num)
+loop_trns_proc (void *loop_, struct ccase *c, casenumber case_num)
 {
   struct loop_trns *loop = loop_;
 
@@ -325,7 +330,7 @@
 
 /* Finishes a pass through the loop and starts the next. */
 static int
-end_loop_trns_proc (void *loop_, struct ccase *c, casenum_t case_num UNUSED)
+end_loop_trns_proc (void *loop_, struct ccase *c, casenumber case_num UNUSED)
 {
   struct loop_trns *loop = loop_;
 
@@ -363,7 +368,7 @@
 
 /* Executes BREAK. */
 static int
-break_trns_proc (void *loop_, struct ccase *c UNUSED, casenum_t case_num 
UNUSED)
+break_trns_proc (void *loop_, struct ccase *c UNUSED, casenumber case_num 
UNUSED)
 {
   struct loop_trns *loop = loop_;
 

Index: src/language/control/repeat.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/control/repeat.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- src/language/control/repeat.c       19 Oct 2006 15:04:53 -0000      1.12
+++ src/language/control/repeat.c       26 Oct 2006 06:16:36 -0000      1.13
@@ -74,6 +74,7 @@
 struct repeat_block 
   {
     struct pool *pool;                  /* Pool used for storage. */
+    struct dataset *ds;                 /* The dataset for this block */
     struct line_list *first_line;       /* First line in line buffer. */
     struct line_list *cur_line;         /* Current line in line buffer. */
     int loop_cnt;                       /* Number of loops. */
@@ -86,7 +87,7 @@
 static bool parse_lines (struct repeat_block *);
 static void create_vars (struct repeat_block *);
 
-static int parse_ids (struct repeat_entry *, struct pool *);
+static int parse_ids (const struct dictionary *dict, struct repeat_entry *, 
struct pool *);
 static int parse_numbers (struct repeat_entry *, struct pool *);
 static int parse_strings (struct repeat_entry *, struct pool *);
 
@@ -96,11 +97,12 @@
 static void do_repeat_close (void *block);
 
 int
-cmd_do_repeat (void)
+cmd_do_repeat (struct dataset *ds)
 {
   struct repeat_block *block;
 
   block = pool_create_container (struct repeat_block, pool);
+  block->ds = ds;
 
   if (!parse_specification (block) || !parse_lines (block))
     goto error;
@@ -132,12 +134,13 @@
     {
       struct repeat_entry *e;
       struct repeat_entry *iter;
+      struct dictionary *dict = dataset_dict (block->ds);
       int count;
 
       /* Get a stand-in variable name and make sure it's unique. */
       if (!lex_force_id ())
        return false;
-      if (dict_lookup_var (dataset_dict (current_dataset), tokid))
+      if (dict_lookup_var (dict, tokid))
         msg (SW, _("Dummy variable name \"%s\" hides dictionary "
                    "variable \"%s\"."),
              tokid, tokid);
@@ -162,7 +165,7 @@
 
       /* Get the details of the variable's possible values. */
       if (token == T_ID)
-       count = parse_ids (e, block->pool);
+       count = parse_ids (dict, e, block->pool);
       else if (lex_is_number ())
        count = parse_numbers (e, block->pool);
       else if (token == T_STRING)
@@ -331,18 +334,18 @@
           {
             /* Ignore return value: if the variable already
                exists there is no harm done. */
-            dict_create_var (dataset_dict (current_dataset), 
iter->replacement[i], 0);
+            dict_create_var (dataset_dict (block->ds), iter->replacement[i], 
0);
           }
       }
 }
 
 /* Parses a set of ids for DO REPEAT. */
 static int
-parse_ids (struct repeat_entry *e, struct pool *pool)
+parse_ids (const struct dictionary *dict, struct repeat_entry *e, struct pool 
*pool)
 {
   size_t n = 0;
   e->type = VAR_NAMES;
-  return parse_mixed_vars_pool (pool, &e->replacement, &n, PV_NONE) ? n : 0;
+  return parse_mixed_vars_pool (dict, pool, &e->replacement, &n, PV_NONE) ? n 
: 0;
 }
 
 /* Adds STRING to E's list of replacements, which has *USED
@@ -440,7 +443,7 @@
 }
 
 int
-cmd_end_repeat (void)
+cmd_end_repeat (struct dataset *ds UNUSED)
 {
   msg (SE, _("No matching DO REPEAT."));
   return CMD_CASCADING_FAILURE;

Index: src/language/control/temporary.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/control/temporary.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- src/language/control/temporary.c    19 Oct 2006 15:04:53 -0000      1.5
+++ src/language/control/temporary.c    26 Oct 2006 06:16:36 -0000      1.6
@@ -41,10 +41,10 @@
 
 /* Parses the TEMPORARY command. */
 int
-cmd_temporary (void)
+cmd_temporary (struct dataset *ds)
 {
-  if (!proc_in_temporary_transformations (current_dataset))
-    proc_start_temporary_transformations (current_dataset);
+  if (!proc_in_temporary_transformations (ds))
+    proc_start_temporary_transformations (ds);
   else
     msg (SE, _("This command may only appear once between "
                "procedures and procedure-like commands."));

Index: src/language/data-io/data-list.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/data-io/data-list.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- src/language/data-io/data-list.c    19 Oct 2006 15:04:53 -0000      1.21
+++ src/language/data-io/data-list.c    26 Oct 2006 06:16:36 -0000      1.22
@@ -103,8 +103,10 @@
 
 static const struct case_source_class data_list_source_class;
 
-static bool parse_fixed (struct pool *tmp_pool, struct data_list_pgm *);
-static bool parse_free (struct pool *tmp_pool, struct data_list_pgm *);
+static bool parse_fixed (struct dictionary *dict, 
+                        struct pool *tmp_pool, struct data_list_pgm *);
+static bool parse_free (struct dictionary *dict, 
+                       struct pool *tmp_pool, struct data_list_pgm *);
 static void dump_fixed_table (const struct ll_list *,
                               const struct file_handle *, int record_cnt);
 static void dump_free_table (const struct data_list_pgm *,
@@ -114,8 +116,9 @@
 static trns_proc_func data_list_trns_proc;
 
 int
-cmd_data_list (void)
+cmd_data_list (struct dataset *ds)
 {
+  struct dictionary *dict = dataset_dict (ds);
   struct data_list_pgm *dls;
   int table = -1;                /* Print table if nonzero, -1=undecided. */
   struct file_handle *fh = fh_inline_file ();
@@ -123,7 +126,7 @@
   bool ok;
 
   if (!in_input_program ())
-    discard_variables (current_dataset);
+    discard_variables (ds);
 
   dls = pool_create_container (struct data_list_pgm, pool);
   ll_init (&dls->specs);
@@ -166,9 +169,9 @@
          lex_match ('=');
          if (!lex_force_id ())
            goto error;
-         dls->end = dict_lookup_var (dataset_dict (current_dataset), tokid);
+         dls->end = dict_lookup_var (dataset_dict (ds), tokid);
          if (!dls->end) 
-            dls->end = dict_create_var_assert (dataset_dict (current_dataset), 
tokid, 0);
+            dls->end = dict_create_var_assert (dataset_dict (ds), tokid, 0);
          lex_get ();
        }
       else if (token == T_ID)
@@ -242,7 +245,7 @@
   if (table == -1)
     table = dls->type != DLS_FREE;
 
-  ok = (dls->type == DLS_FIXED ? parse_fixed : parse_free) (tmp_pool, dls);
+  ok = (dls->type == DLS_FIXED ? parse_fixed : parse_free) (dict, tmp_pool, 
dls);
   if (!ok)
     goto error;
 
@@ -262,10 +265,9 @@
     goto error;
 
   if (in_input_program ())
-    add_transformation (current_dataset, data_list_trns_proc, 
data_list_trns_free, dls);
+    add_transformation (ds, data_list_trns_proc, data_list_trns_free, dls);
   else 
-    proc_set_source (current_dataset, 
-                    create_case_source (&data_list_source_class, dls));
+    proc_set_source (ds, create_case_source (&data_list_source_class, dls));
 
   pool_destroy (tmp_pool);
 
@@ -283,7 +285,8 @@
    needed once parsing is complete.  Returns true only if
    successful. */
 static bool
-parse_fixed (struct pool *tmp_pool, struct data_list_pgm *dls)
+parse_fixed (struct dictionary *dict, 
+            struct pool *tmp_pool, struct data_list_pgm *dls)
 {
   int last_nonempty_record;
   int record = 0;
@@ -316,7 +319,7 @@
 
             /* Create variable. */
             width = get_format_var_width (f);
-            v = dict_create_var (dataset_dict (current_dataset), name, width);
+            v = dict_create_var (dict, name, width);
             if (v != NULL)
               {
                 /* Success. */
@@ -338,7 +341,7 @@
                     return false;
                   }
 
-                v = dict_lookup_var_assert (dataset_dict (current_dataset), 
name);
+                v = dict_lookup_var_assert (dict, name);
                 if ((width != 0) != (v->width != 0))
                   {
                     msg (SE, _("There is already a variable %s of a "
@@ -432,7 +435,7 @@
    them to DLS.  Uses TMP_POOL for data that is not needed once
    parsing is complete.  Returns true only if successful. */
 static bool
-parse_free (struct pool *tmp_pool, struct data_list_pgm *dls)
+parse_free (struct dictionary *dict, struct pool *tmp_pool, struct 
data_list_pgm *dls)
 {
   lex_get ();
   while (token != '.')
@@ -465,7 +468,7 @@
           struct dls_var_spec *spec;
          struct variable *v;
 
-         v = dict_create_var (dataset_dict (current_dataset), name[i],
+         v = dict_create_var (dict, name[i],
                                get_format_var_width (&input));
          if (v == NULL)
            {
@@ -772,7 +775,7 @@
 
 /* Handle DATA LIST transformation DLS, parsing data into C. */
 static int
-data_list_trns_proc (void *dls_, struct ccase *c, casenum_t case_num UNUSED)
+data_list_trns_proc (void *dls_, struct ccase *c, casenumber case_num UNUSED)
 {
   struct data_list_pgm *dls = dls_;
   int retval;

Index: src/language/data-io/data-reader.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/data-io/data-reader.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- src/language/data-io/data-reader.c  19 Oct 2006 15:04:53 -0000      1.13
+++ src/language/data-io/data-reader.c  26 Oct 2006 06:16:36 -0000      1.14
@@ -423,7 +423,7 @@
 
 /* Perform BEGIN DATA...END DATA as a procedure in itself. */
 int
-cmd_begin_data (void)
+cmd_begin_data (struct dataset *ds)
 {
   struct dfm_reader *r;
   bool ok;
@@ -441,7 +441,7 @@
 
   /* Input procedure reads from inline file. */
   getl_set_prompt_style (GETL_PROMPT_DATA);
-  ok = procedure (current_dataset,NULL, NULL);
+  ok = procedure (ds, NULL, NULL);
 
   dfm_close_reader (r);
 

Index: src/language/data-io/file-handle.q
===================================================================
RCS file: /sources/pspp/pspp/src/language/data-io/file-handle.q,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- src/language/data-io/file-handle.q  8 Jul 2006 03:05:51 -0000       1.7
+++ src/language/data-io/file-handle.q  26 Oct 2006 06:16:36 -0000      1.8
@@ -51,7 +51,7 @@
 /* (functions) */
 
 int
-cmd_file_handle (void)
+cmd_file_handle (struct dataset *ds)
 {
   char handle_name[LONG_NAME_LEN + 1];
   struct fh_properties properties = *fh_default_properties ();
@@ -76,7 +76,7 @@
   if (!lex_force_match ('/'))
     return CMD_CASCADING_FAILURE;
 
-  if (!parse_file_handle (&cmd, NULL))
+  if (!parse_file_handle (ds, &cmd, NULL))
     return CMD_CASCADING_FAILURE;
 
   if (lex_end_of_command () != CMD_SUCCESS)
@@ -127,7 +127,7 @@
 }
 
 int
-cmd_close_file_handle (void) 
+cmd_close_file_handle (struct dataset *ds UNUSED) 
 {
   struct file_handle *handle;
 

Index: src/language/data-io/get.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/data-io/get.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- src/language/data-io/get.c  19 Oct 2006 15:04:53 -0000      1.18
+++ src/language/data-io/get.c  26 Oct 2006 06:16:36 -0000      1.19
@@ -85,7 +85,7 @@
 
 /* Parses a GET or IMPORT command. */
 static int
-parse_read_command (enum reader_command type)
+parse_read_command (struct dataset *ds, enum reader_command type)
 {
   struct case_reader_pgm *pgm = NULL;
   struct file_handle *fh = NULL;
@@ -127,7 +127,7 @@
       goto error;
     }
               
-  discard_variables (current_dataset);
+  discard_variables (ds);
 
   pgm = xmalloc (sizeof *pgm);
   pgm->reader = any_reader_open (fh, &dict);
@@ -149,10 +149,10 @@
 
   pgm->map = finish_case_map (dict);
   
-  dict_destroy (dataset_dict (current_dataset));
-  dataset_set_dict (current_dataset, dict);
+  dict_destroy (dataset_dict (ds));
+  dataset_set_dict (ds, dict);
 
-  proc_set_source (current_dataset, 
+  proc_set_source (ds, 
                   create_case_source (&case_reader_source_class, pgm));
 
   return CMD_SUCCESS;
@@ -227,16 +227,16 @@
 
 /* GET. */
 int
-cmd_get (void) 
+cmd_get (struct dataset *ds) 
 {
-  return parse_read_command (GET_CMD);
+  return parse_read_command (ds, GET_CMD);
 }
 
 /* IMPORT. */
 int
-cmd_import (void) 
+cmd_import (struct dataset *ds) 
 {
-  return parse_read_command (IMPORT_CMD);
+  return parse_read_command (ds, IMPORT_CMD);
 }
 
 /* Writing system and portable files. */ 
@@ -290,7 +290,8 @@
 
    On failure, returns a null pointer. */
 static struct case_writer *
-parse_write_command (enum writer_type writer_type,
+parse_write_command (struct dataset *ds, 
+                    enum writer_type writer_type,
                      enum command_type command_type,
                      bool *retain_unselected)
 {
@@ -313,7 +314,7 @@
     *retain_unselected = true;
 
   handle = NULL;
-  dict = dict_clone (dataset_dict (current_dataset));
+  dict = dict_clone (dataset_dict (ds));
   aw = xmalloc (sizeof *aw);
   aw->writer = NULL;
   aw->map = NULL;
@@ -469,26 +470,26 @@
 
 /* SAVE and EXPORT. */
 
-static bool output_proc (const struct ccase *, void *);
+static bool output_proc (const struct ccase *, void *, const struct dataset *);
 
 /* Parses and performs the SAVE or EXPORT procedure. */
 static int
-parse_output_proc (enum writer_type writer_type)
+parse_output_proc (struct dataset *ds, enum writer_type writer_type)
 {
   bool retain_unselected;
   struct variable *saved_filter_variable;
   struct case_writer *aw;
   bool ok;
 
-  aw = parse_write_command (writer_type, PROC_CMD, &retain_unselected);
+  aw = parse_write_command (ds, writer_type, PROC_CMD, &retain_unselected);
   if (aw == NULL) 
     return CMD_CASCADING_FAILURE;
 
-  saved_filter_variable = dict_get_filter (dataset_dict (current_dataset));
+  saved_filter_variable = dict_get_filter (dataset_dict (ds));
   if (retain_unselected) 
-    dict_set_filter (dataset_dict (current_dataset), NULL);
-  ok = procedure (current_dataset,output_proc, aw);
-  dict_set_filter (dataset_dict (current_dataset), saved_filter_variable);
+    dict_set_filter (dataset_dict (ds), NULL);
+  ok = procedure (ds, output_proc, aw);
+  dict_set_filter (dataset_dict (ds), saved_filter_variable);
 
   case_writer_destroy (aw);
   return ok ? CMD_SUCCESS : CMD_CASCADING_FAILURE;
@@ -496,22 +497,22 @@
 
 /* Writes case C to file. */
 static bool
-output_proc (const struct ccase *c, void *aw_) 
+output_proc (const struct ccase *c, void *aw_, const struct dataset *ds 
UNUSED) 
 {
   struct case_writer *aw = aw_;
   return case_writer_write_case (aw, c);
 }
 
 int
-cmd_save (void) 
+cmd_save (struct dataset *ds) 
 {
-  return parse_output_proc (SYSFILE_WRITER);
+  return parse_output_proc (ds, SYSFILE_WRITER);
 }
 
 int
-cmd_export (void) 
+cmd_export (struct dataset *ds) 
 {
-  return parse_output_proc (PORFILE_WRITER);
+  return parse_output_proc (ds, PORFILE_WRITER);
 }
 
 /* XSAVE and XEXPORT. */
@@ -527,23 +528,23 @@
 
 /* Parses the XSAVE or XEXPORT transformation command. */
 static int
-parse_output_trns (enum writer_type writer_type) 
+parse_output_trns (struct dataset *ds, enum writer_type writer_type) 
 {
   struct output_trns *t = xmalloc (sizeof *t);
-  t->aw = parse_write_command (writer_type, XFORM_CMD, NULL);
+  t->aw = parse_write_command (ds, writer_type, XFORM_CMD, NULL);
   if (t->aw == NULL) 
     {
       free (t);
       return CMD_CASCADING_FAILURE;
     }
 
-  add_transformation (current_dataset, output_trns_proc, output_trns_free, t);
+  add_transformation (ds, output_trns_proc, output_trns_free, t);
   return CMD_SUCCESS;
 }
 
 /* Writes case C to the system file specified on XSAVE or XEXPORT. */
 static int
-output_trns_proc (void *trns_, struct ccase *c, casenum_t case_num UNUSED)
+output_trns_proc (void *trns_, struct ccase *c, casenumber case_num UNUSED)
 {
   struct output_trns *t = trns_;
   case_writer_write_case (t->aw, c);
@@ -568,16 +569,16 @@
 
 /* XSAVE command. */
 int
-cmd_xsave (void) 
+cmd_xsave (struct dataset *ds) 
 {
-  return parse_output_trns (SYSFILE_WRITER);
+  return parse_output_trns (ds, SYSFILE_WRITER);
 }
 
 /* XEXPORT command. */
 int
-cmd_xexport (void) 
+cmd_xexport (struct dataset *ds) 
 {
-  return parse_output_trns (PORFILE_WRITER);
+  return parse_output_trns (ds, PORFILE_WRITER);
 }
 
 static bool rename_variables (struct dictionary *dict);
@@ -629,7 +630,7 @@
     {
       struct variable *v;
 
-      v = parse_dict_variable (dict);
+      v = parse_variable (dict);
       if (v == NULL)
        return 0;
       if (!lex_force_match ('=')
@@ -799,8 +800,8 @@
 static bool mtf_delete_file_in_place (struct mtf_proc *, struct mtf_file **);
 
 static bool mtf_read_nonactive_records (void *);
-static bool mtf_processing_finish (void *);
-static bool mtf_processing (const struct ccase *, void *);
+static bool mtf_processing_finish (void *, const struct dataset *);
+static bool mtf_processing (const struct ccase *, void *, const struct dataset 
*);
 
 static char *var_type_description (struct variable *);
 
@@ -809,7 +810,7 @@
 
 /* Parse and execute the MATCH FILES command. */
 int
-cmd_match_files (void)
+cmd_match_files (struct dataset *ds)
 {
   struct mtf_proc mtf;
   struct mtf_file *first_table = NULL;
@@ -830,7 +831,7 @@
   case_nullify (&mtf.mtf_case);
   mtf.seq_num = 0;
   mtf.seq_nums = NULL;
-  dict_set_case_limit (mtf.dict, dict_get_case_limit (dataset_dict 
(current_dataset)));
+  dict_set_case_limit (mtf.dict, dict_get_case_limit (dataset_dict (ds)));
 
   lex_match ('/');
   while (token == T_ID
@@ -895,20 +896,20 @@
             }
           used_active_file = true;
 
-          if (!proc_has_source (current_dataset))
+          if (!proc_has_source (ds))
             {
               msg (SE, _("Cannot specify the active file since no active "
                          "file has been defined."));
               goto error;
             }
 
-          if (proc_make_temporary_transformations_permanent (current_dataset))
+          if (proc_make_temporary_transformations_permanent (ds))
             msg (SE,
                  _("MATCH FILES may not be used after TEMPORARY when "
                    "the active file is an input source.  "
                    "Temporary transformations will be made permanent."));
 
-          file->dict = dataset_dict (current_dataset);
+          file->dict = dataset_dict (ds);
         }
       else
         {
@@ -1125,7 +1126,7 @@
      values. */
 
   if (!used_active_file)
-    discard_variables (current_dataset);
+    discard_variables (ds);
 
   dict_compact_values (mtf.dict);
   mtf.output = fastfile_create (dict_get_next_value_idx (mtf.dict));
@@ -1137,20 +1138,22 @@
 
   if (used_active_file) 
     {
-      proc_set_sink (current_dataset, 
+      proc_set_sink (ds, 
                     create_case_sink (&null_sink_class, 
-                                      dataset_dict (current_dataset), NULL));
-      ok = procedure (current_dataset,mtf_processing, &mtf) && 
mtf_processing_finish (&mtf); 
+                                      dataset_dict (ds), NULL));
+      ok = 
+       ( procedure (ds, mtf_processing, &mtf) && 
+         mtf_processing_finish (&mtf, ds) ); 
     }
   else
-    ok = mtf_processing_finish (&mtf);
+    ok = mtf_processing_finish (&mtf, ds);
 
-  discard_variables (current_dataset);
+  discard_variables (ds);
 
-  dict_destroy (dataset_dict (current_dataset));
-  dataset_set_dict (current_dataset, mtf.dict);
+  dict_destroy (dataset_dict (ds));
+  dataset_set_dict (ds, mtf.dict);
   mtf.dict = NULL;
-  proc_set_source (current_dataset, storage_source_create (mtf.output));
+  proc_set_source (ds, storage_source_create (mtf.output));
   mtf.output = NULL;
   
   if (!mtf_free (&mtf))
@@ -1164,7 +1167,7 @@
 
 /* Repeats 2...7 an arbitrary number of times. */
 static bool
-mtf_processing_finish (void *mtf_)
+mtf_processing_finish (void *mtf_, const struct dataset *ds)
 {
   struct mtf_proc *mtf = mtf_;
   struct mtf_file *iter;
@@ -1179,7 +1182,7 @@
       }
   
   while (mtf->head && mtf->head->type == MTF_FILE)
-    if (!mtf_processing (NULL, mtf))
+    if (!mtf_processing (NULL, mtf, ds))
       return false;
 
   return true;
@@ -1323,7 +1326,7 @@
 /* Perform one iteration of steps 3...7 above.
    Returns true if successful, false if an I/O error occurred. */
 static bool
-mtf_processing (const struct ccase *c, void *mtf_)
+mtf_processing (const struct ccase *c, void *mtf_, const struct dataset *ds 
UNUSED)
 {
   struct mtf_proc *mtf = mtf_;
 

Index: src/language/data-io/inpt-pgm.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/data-io/inpt-pgm.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- src/language/data-io/inpt-pgm.c     19 Oct 2006 15:04:53 -0000      1.15
+++ src/language/data-io/inpt-pgm.c     26 Oct 2006 06:16:36 -0000      1.16
@@ -97,19 +97,19 @@
 
 /* Emits an END CASE transformation for INP. */
 static void
-emit_END_CASE (struct input_program_pgm *inp) 
+emit_END_CASE (struct dataset *ds, struct input_program_pgm *inp) 
 {
-  add_transformation (current_dataset, end_case_trns_proc, NULL, inp);
+  add_transformation (ds, end_case_trns_proc, NULL, inp);
 }
 
 int
-cmd_input_program (void)
+cmd_input_program (struct dataset *ds)
 {
   struct input_program_pgm *inp;
   size_t i;
   bool saw_END_CASE = false;
 
-  discard_variables (current_dataset);
+  discard_variables (ds);
   if (token != '.')
     return lex_end_of_command ();
 
@@ -120,12 +120,12 @@
   inside_input_program = true;
   for (;;) 
     {
-      enum cmd_result result = cmd_parse (CMD_STATE_INPUT_PROGRAM);
+      enum cmd_result result = cmd_parse (ds, CMD_STATE_INPUT_PROGRAM);
       if (result == CMD_END_INPUT_PROGRAM)
         break;
       else if (result == CMD_END_CASE) 
         {
-          emit_END_CASE (inp);
+          emit_END_CASE (ds, inp);
           saw_END_CASE = true; 
         }
       else if (cmd_result_is_failure (result) && result != CMD_FAILURE)
@@ -133,34 +133,34 @@
           if (result == CMD_EOF)
             msg (SE, _("Unexpected end-of-file within INPUT PROGRAM."));
           inside_input_program = false;
-          discard_variables (current_dataset);
+          discard_variables (ds);
           destroy_input_program (inp);
           return result;
         }
     }
   if (!saw_END_CASE)
-    emit_END_CASE (inp);
+    emit_END_CASE (ds, inp);
   inside_input_program = false;
 
-  if (dict_get_next_value_idx (dataset_dict (current_dataset)) == 0) 
+  if (dict_get_next_value_idx (dataset_dict (ds)) == 0) 
     {
       msg (SE, _("Input program did not create any variables."));
-      discard_variables (current_dataset);
+      discard_variables (ds);
       destroy_input_program (inp);
       return CMD_FAILURE;
     }
   
-  inp->trns_chain = proc_capture_transformations (current_dataset);
+  inp->trns_chain = proc_capture_transformations (ds);
   trns_chain_finalize (inp->trns_chain);
 
   /* Figure out how to initialize each input case. */
-  inp->init_cnt = dict_get_next_value_idx (dataset_dict (current_dataset));
+  inp->init_cnt = dict_get_next_value_idx (dataset_dict (ds));
   inp->init = xnmalloc (inp->init_cnt, sizeof *inp->init);
   for (i = 0; i < inp->init_cnt; i++)
     inp->init[i] = -1;
-  for (i = 0; i < dict_get_var_cnt (dataset_dict (current_dataset)); i++)
+  for (i = 0; i < dict_get_var_cnt (dataset_dict (ds)); i++)
     {
-      struct variable *var = dict_get_var (dataset_dict (current_dataset), i);
+      struct variable *var = dict_get_var (dataset_dict (ds), i);
       enum value_init_type value_init;
       size_t j;
       
@@ -172,16 +172,16 @@
     }
   for (i = 0; i < inp->init_cnt; i++)
     assert (inp->init[i] != -1);
-  inp->case_size = dict_get_case_size (dataset_dict (current_dataset));
+  inp->case_size = dict_get_case_size (dataset_dict (ds));
 
-  proc_set_source (current_dataset, 
+  proc_set_source (ds, 
                  create_case_source (&input_program_source_class, inp));
 
   return CMD_SUCCESS;
 }
 
 int
-cmd_end_input_program (void)
+cmd_end_input_program (struct dataset *ds UNUSED)
 {
   assert (in_input_program ());
   return CMD_END_INPUT_PROGRAM; 
@@ -288,7 +288,7 @@
   };
 
 int
-cmd_end_case (void)
+cmd_end_case (struct dataset *ds UNUSED)
 {
   assert (in_input_program ());
   if (token == '.')
@@ -298,7 +298,7 @@
 
 /* Sends the current case as the source's output. */
 int
-end_case_trns_proc (void *inp_, struct ccase *c, casenum_t case_nr UNUSED)
+end_case_trns_proc (void *inp_, struct ccase *c, casenumber case_nr UNUSED)
 {
   struct input_program_pgm *inp = inp_;
 
@@ -319,7 +319,7 @@
 
 /* Parses REREAD command. */
 int
-cmd_reread (void)
+cmd_reread (struct dataset *ds)
 {
   struct file_handle *fh;       /* File to be re-read. */
   struct expression *e;         /* Expression for column to set. */
@@ -340,7 +340,7 @@
              return CMD_CASCADING_FAILURE;
            }
          
-         e = expr_parse (dataset_dict (current_dataset), EXPR_NUMBER);
+         e = expr_parse (ds, EXPR_NUMBER);
          if (!e)
            return CMD_CASCADING_FAILURE;
        }
@@ -364,14 +364,14 @@
   t = xmalloc (sizeof *t);
   t->reader = dfm_open_reader (fh);
   t->column = e;
-  add_transformation (current_dataset, reread_trns_proc, reread_trns_free, t);
+  add_transformation (ds, reread_trns_proc, reread_trns_free, t);
 
   return CMD_SUCCESS;
 }
 
 /* Executes a REREAD transformation. */
 static int
-reread_trns_proc (void *t_, struct ccase *c, casenum_t case_num)
+reread_trns_proc (void *t_, struct ccase *c, casenumber case_num)
 {
   struct reread_trns *t = t_;
 
@@ -405,11 +405,11 @@
 
 /* Parses END FILE command. */
 int
-cmd_end_file (void)
+cmd_end_file (struct dataset *ds)
 {
   assert (in_input_program ());
 
-  add_transformation (current_dataset, end_file_trns_proc, NULL, NULL);
+  add_transformation (ds, end_file_trns_proc, NULL, NULL);
 
   return lex_end_of_command ();
 }
@@ -417,7 +417,7 @@
 /* Executes an END FILE transformation. */
 static int
 end_file_trns_proc (void *trns_ UNUSED, struct ccase *c UNUSED,
-                    casenum_t case_num UNUSED)
+                    casenumber case_num UNUSED)
 {
   return TRNS_END_FILE;
 }

Index: src/language/data-io/list.q
===================================================================
RCS file: /sources/pspp/pspp/src/language/data-io/list.q,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- src/language/data-io/list.q 19 Oct 2006 15:04:53 -0000      1.16
+++ src/language/data-io/list.q 26 Oct 2006 06:16:36 -0000      1.17
@@ -83,11 +83,11 @@
 static void write_line (struct outp_driver *d, const char *s);
 
 /* Other functions. */
-static bool list_cases (const struct ccase *, void *);
+static bool list_cases (const struct ccase *, void *, const struct dataset *);
 static void determine_layout (void);
 static void clean_up (void);
 static void write_header (struct outp_driver *);
-static void write_all_headers (const struct ccase *, void *);
+static void write_all_headers (const struct ccase *, void *, const struct 
dataset*);
 
 /* Returns the number of text lines that can fit on the remainder of
    the page. */
@@ -129,12 +129,12 @@
     
 /* Parses and executes the LIST procedure. */
 int
-cmd_list (void)
+cmd_list (struct dataset *ds)
 {
   struct variable casenum_var;
   bool ok;
 
-  if (!parse_list (&cmd, NULL))
+  if (!parse_list (ds, &cmd, NULL))
     return CMD_FAILURE;
   
   /* Fill in defaults. */
@@ -145,7 +145,7 @@
   if (cmd.last == NOT_LONG)
     cmd.last = LONG_MAX;
   if (!cmd.sbc_variables)
-    dict_get_vars (dataset_dict (current_dataset), &cmd.v_variables, 
&cmd.n_variables,
+    dict_get_vars (dataset_dict (ds), &cmd.v_variables, &cmd.n_variables,
                   (1u << DC_SYSTEM) | (1u << DC_SCRATCH));
   if (cmd.n_variables == 0)
     {
@@ -185,12 +185,12 @@
   /* Weighting variable. */
   if (cmd.weight == LST_WEIGHT)
     {
-      if (dict_get_weight (dataset_dict (current_dataset)) != NULL)
+      if (dict_get_weight (dataset_dict (ds)) != NULL)
        {
          size_t i;
 
          for (i = 0; i < cmd.n_variables; i++)
-           if (cmd.v_variables[i] == dict_get_weight (dataset_dict 
(current_dataset)))
+           if (cmd.v_variables[i] == dict_get_weight (dataset_dict (ds)))
              break;
          if (i >= cmd.n_variables)
            {
@@ -199,7 +199,7 @@
              cmd.v_variables = xnrealloc (cmd.v_variables, cmd.n_variables,
                                            sizeof *cmd.v_variables);
              cmd.v_variables[cmd.n_variables - 1]
-                = dict_get_weight (dataset_dict (current_dataset));
+                = dict_get_weight (dataset_dict (ds));
            }
        }
       else
@@ -229,7 +229,7 @@
   determine_layout ();
 
   case_idx = 0;
-  ok = procedure_with_splits (current_dataset, write_all_headers, list_cases, 
NULL, NULL);
+  ok = procedure_with_splits (ds, write_all_headers, list_cases, NULL, NULL);
   ds_destroy(&line_buffer);
 
   clean_up ();
@@ -240,11 +240,11 @@
 /* Writes headers to all devices.  This is done at the beginning of
    each SPLIT FILE group. */
 static void
-write_all_headers (const struct ccase *c, void *aux UNUSED)
+write_all_headers (const struct ccase *c, void *aux UNUSED, const struct 
dataset *ds)
 {
   struct outp_driver *d;
 
-  output_split_file_values (c);
+  output_split_file_values (ds, c);
   for (d = outp_drivers (NULL); d; d = outp_drivers (d))
     {
       if (!d->class->special)
@@ -609,7 +609,7 @@
 
 /* Writes case C to output. */
 static bool
-list_cases (const struct ccase *c, void *aux UNUSED)
+list_cases (const struct ccase *c, void *aux UNUSED, const struct dataset *ds 
UNUSED)
 {
   struct outp_driver *d;
   

Index: src/language/data-io/matrix-data.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/data-io/matrix-data.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- src/language/data-io/matrix-data.c  22 Oct 2006 11:07:52 -0000      1.13
+++ src/language/data-io/matrix-data.c  26 Oct 2006 06:16:36 -0000      1.14
@@ -152,7 +152,7 @@
 
     /* Continuous variables. */
     int n_continuous;           /* Number of continuous variables. */
-    int first_continuous;       /* Index into dataset_dict 
(current_dataset).var of
+    int first_continuous;       /* Index into dictionary of
                                    first continuous variable. */
   };
 
@@ -168,13 +168,13 @@
 
 static int compare_variables_by_mxd_var_type (const void *pa,
                                             const void *pb);
-static bool read_matrices_without_rowtype (struct matrix_data_pgm *);
-static bool read_matrices_with_rowtype (struct matrix_data_pgm *);
+static bool read_matrices_without_rowtype (struct dataset *ds, struct 
matrix_data_pgm *);
+static bool read_matrices_with_rowtype (struct dataset *ds, struct 
matrix_data_pgm *);
 static int string_to_content_type (char *, int *);
 static void attach_mxd_aux (struct variable *, int var_type, int sub_type);
 
 int
-cmd_matrix_data (void)
+cmd_matrix_data (struct dataset *ds)
 {
   struct pool *pool;
   struct matrix_data_pgm *mx;
@@ -183,7 +183,7 @@
     
   unsigned seen = 0;
   
-  discard_variables (current_dataset);
+  discard_variables (ds);
 
   pool = pool_create ();
   mx = pool_alloc (pool, sizeof *mx);
@@ -248,7 +248,7 @@
                
                if (strcasecmp (v[i], "ROWTYPE_"))
                  {
-                   new_var = dict_create_var_assert (dataset_dict 
(current_dataset), v[i], 0);
+                   new_var = dict_create_var_assert (dataset_dict (ds), v[i], 
0);
                     attach_mxd_aux (new_var, MXD_CONTINUOUS, i);
                   }
                else
@@ -258,7 +258,7 @@
            free (v);
          }
          
-          mx->rowtype_ = dict_create_var_assert (dataset_dict 
(current_dataset),
+          mx->rowtype_ = dict_create_var_assert (dataset_dict (ds),
                                                  "ROWTYPE_", 8);
           attach_mxd_aux (mx->rowtype_, MXD_ROWTYPE, 0);
        }
@@ -313,7 +313,7 @@
              goto lossage;
            }
          
-         if (dict_lookup_var (dataset_dict (current_dataset), tokid) == NULL
+         if (dict_lookup_var (dataset_dict (ds), tokid) == NULL
              && (lex_look_ahead () == '.' || lex_look_ahead () == '/'))
            {
              if (!strcasecmp (tokid, "ROWTYPE_")
@@ -324,27 +324,27 @@
                  goto lossage;
                }
 
-             mx->single_split = dict_create_var_assert (dataset_dict 
(current_dataset),
+             mx->single_split = dict_create_var_assert (dataset_dict (ds),
                                                          tokid, 0);
               attach_mxd_aux (mx->single_split, MXD_CONTINUOUS, 0);
              lex_get ();
 
-              dict_set_split_vars (dataset_dict (current_dataset), 
&mx->single_split, 1);
+              dict_set_split_vars (dataset_dict (ds), &mx->single_split, 1);
            }
          else
            {
              struct variable **split;
              size_t n;
 
-             if (!parse_variables (dataset_dict (current_dataset), &split, &n, 
PV_NO_DUPLICATE))
+             if (!parse_variables (dataset_dict (ds), &split, &n, 
PV_NO_DUPLICATE))
                goto lossage;
 
-              dict_set_split_vars (dataset_dict (current_dataset), split, n);
+              dict_set_split_vars (dataset_dict (ds), split, n);
            }
          
          {
-            struct variable *const *split = dict_get_split_vars (dataset_dict 
(current_dataset));
-            size_t split_cnt = dict_get_split_cnt (dataset_dict 
(current_dataset));
+            struct variable *const *split = dict_get_split_vars (dataset_dict 
(ds));
+            size_t split_cnt = dict_get_split_cnt (dataset_dict (ds));
             int i;
 
             for (i = 0; i < split_cnt; i++)
@@ -373,7 +373,7 @@
            }
          seen |= 4;
 
-         if (!parse_variables (dataset_dict (current_dataset), &mx->factors, 
&mx->n_factors,
+         if (!parse_variables (dataset_dict (ds), &mx->factors, &mx->n_factors,
                                 PV_NONE))
            goto lossage;
          
@@ -572,7 +572,7 @@
     }
       
   /* Create VARNAME_. */
-  mx->varname_ = dict_create_var_assert (dataset_dict (current_dataset), 
"VARNAME_", 8);
+  mx->varname_ = dict_create_var_assert (dataset_dict (ds), "VARNAME_", 8);
   attach_mxd_aux (mx->varname_, MXD_VARNAME, 0);
   
   /* Sort the dictionary variables into the desired order for the
@@ -581,9 +581,9 @@
     struct variable **v;
     size_t nv;
 
-    dict_get_vars (dataset_dict (current_dataset), &v, &nv, 0);
+    dict_get_vars (dataset_dict (ds), &v, &nv, 0);
     qsort (v, nv, sizeof *v, compare_variables_by_mxd_var_type);
-    dict_reorder_vars (dataset_dict (current_dataset), v, nv);
+    dict_reorder_vars (dataset_dict (ds), v, nv);
     free (v);
   }
 
@@ -601,9 +601,9 @@
     int i;
 
     mx->first_continuous = -1;
-    for (i = 0; i < dict_get_var_cnt (dataset_dict (current_dataset)); i++)
+    for (i = 0; i < dict_get_var_cnt (dataset_dict (ds)); i++)
       {
-       struct variable *v = dict_get_var (dataset_dict (current_dataset), i);
+       struct variable *v = dict_get_var (dataset_dict (ds), i);
         struct mxd_var *mv = v->aux;
        int type = mv->var_type;
        
@@ -628,9 +628,9 @@
     goto lossage;
 
   if (mx->explicit_rowtype)
-    ok = read_matrices_with_rowtype (mx);
+    ok = read_matrices_with_rowtype (ds, mx);
   else
-    ok = read_matrices_without_rowtype (mx);
+    ok = read_matrices_without_rowtype (ds, mx);
 
   dfm_close_reader (mx->reader);
 
@@ -639,7 +639,7 @@
   return ok ? CMD_SUCCESS : CMD_CASCADING_FAILURE;
 
 lossage:
-  discard_variables (current_dataset);
+  discard_variables (ds);
   free (mx->factors);
   pool_destroy (mx->container);
   return CMD_CASCADING_FAILURE;
@@ -912,6 +912,7 @@
 
 struct nr_aux_data 
   {
+    const struct dictionary *dict; /* The dictionary */
     struct matrix_data_pgm *mx; /* MATRIX DATA program. */
     double ***data;             /* MATRIX DATA data. */
     double *factor_values;      /* Factor values. */
@@ -932,7 +933,7 @@
 /* Read from the data file and write it to the active file.
    Returns true if successful, false if an I/O error occurred. */
 static bool
-read_matrices_without_rowtype (struct matrix_data_pgm *mx)
+read_matrices_without_rowtype (struct dataset *ds, struct matrix_data_pgm *mx)
 {
   struct nr_aux_data nr;
   bool ok;
@@ -941,17 +942,18 @@
     mx->cells = 1;
 
   nr.mx = mx;
+  nr.dict = dataset_dict (ds);
   nr.data = NULL;
   nr.factor_values = xnmalloc (mx->n_factors * mx->cells,
                                sizeof *nr.factor_values);
   nr.max_cell_idx = 0;
-  nr.split_values = xnmalloc (dict_get_split_cnt (dataset_dict 
(current_dataset)),
+  nr.split_values = xnmalloc (dict_get_split_cnt (dataset_dict (ds)),
                               sizeof *nr.split_values);
 
-  proc_set_source (current_dataset, create_case_source (
+  proc_set_source (ds, create_case_source (
                      &matrix_data_without_rowtype_source_class, &nr));
   
-  ok = procedure (current_dataset,NULL, NULL);
+  ok = procedure (ds, NULL, NULL);
 
   free (nr.split_values);
   free (nr.factor_values);
@@ -1089,7 +1091,7 @@
            if (token.type != MNUM)
              {
                msg (SE, _("expecting value for %s %s"),
-                    dict_get_var (dataset_dict (current_dataset), j)->name,
+                    dict_get_var (nr->dict, j)->name,
                      context (mx->reader));
                return 0;
              }
@@ -1206,7 +1208,7 @@
       if (!nr_output_data (nr, c, write_case, wc_data))
         return false;
 
-      if (dict_get_split_cnt (dataset_dict (current_dataset)) == 0
+      if (dict_get_split_cnt (nr->dict) == 0
           || !another_token (mx->reader))
        return true;
     }
@@ -1229,14 +1231,14 @@
       return true;
     }
   
-  if (dict_get_split_vars (dataset_dict (current_dataset)) == NULL)
+  if (dict_get_split_vars (nr->dict) == NULL)
     return true;
 
   if (mx->single_split)
     {
       if (!compare) 
         {
-          struct mxd_var *mv = dict_get_split_vars (dataset_dict 
(current_dataset))[0]->aux;
+          struct mxd_var *mv = dict_get_split_vars (nr->dict)[0]->aux;
           nr->split_values[0] = ++mv->sub_type; 
         }
       return true;
@@ -1245,7 +1247,7 @@
   if (!compare)
     just_read = 1;
 
-  split_cnt = dict_get_split_cnt (dataset_dict (current_dataset));
+  split_cnt = dict_get_split_cnt (nr->dict);
   for (i = 0; i < split_cnt; i++) 
     {
       struct matrix_token token;
@@ -1264,7 +1266,7 @@
         {
           msg (SE, _("Expecting value %g for %s."),
                nr->split_values[i],
-               dict_get_split_vars (dataset_dict (current_dataset))[i]->name);
+               dict_get_split_vars (nr->dict)[i]->name);
           return false;
         }
     }
@@ -1327,7 +1329,8 @@
    CP to the active file.
    Returns true if successful, false if an I/O error occurred. */
 static bool
-dump_cell_content (struct matrix_data_pgm *mx, int content, double *cp,
+dump_cell_content (const struct dictionary *dict, 
+                  struct matrix_data_pgm *mx, int content, double *cp,
                    struct ccase *c,
                    write_case_func *write_case, write_case_data wc_data)
 {
@@ -1351,13 +1354,13 @@
 
        for (j = 0; j < mx->n_continuous; j++)
          {
-            int fv = dict_get_var (dataset_dict (current_dataset), 
mx->first_continuous + j)->fv;
+            int fv = dict_get_var (dict, mx->first_continuous + j)->fv;
             case_data_rw (c, fv)->f = *cp;
            cp++;
          }
        if (type == 1)
          buf_copy_str_rpad (case_data_rw (c, mx->varname_->fv)->s, 8,
-                             dict_get_var (dataset_dict (current_dataset),
+                             dict_get_var (dict,
                                            mx->first_continuous + i)->name);
        if (!write_case (wc_data))
           return false;
@@ -1378,8 +1381,8 @@
     size_t split_cnt;
     size_t i;
 
-    split_cnt = dict_get_split_cnt (dataset_dict (current_dataset));
-    split = dict_get_split_vars (dataset_dict (current_dataset));
+    split_cnt = dict_get_split_cnt (nr->dict);
+    split = dict_get_split_vars (nr->dict);
     for (i = 0; i < split_cnt; i++)
       case_data_rw (c, split[i]->fv)->f = nr->split_values[i];
   }
@@ -1407,7 +1410,8 @@
                  assert (nr->data[content] != NULL
                          && nr->data[content][cell] != NULL);
 
-                 if (!dump_cell_content (mx, content, nr->data[content][cell],
+                 if (!dump_cell_content (nr->dict, mx, 
+                                         content, nr->data[content][cell],
                                           c, write_case, wc_data))
                     return false;
                }
@@ -1428,7 +1432,7 @@
     for (content = 0; content <= PROX; content++)
       if (!mx->is_per_factor[content] && nr->data[content] != NULL) 
         {
-          if (!dump_cell_content (mx, content, nr->data[content][0],
+          if (!dump_cell_content (nr->dict, mx, content, nr->data[content][0],
                                   c, write_case, wc_data))
             return false; 
         }
@@ -1451,6 +1455,7 @@
 /* With ROWTYPE_ auxiliary data. */
 struct wr_aux_data 
   {
+    const struct dictionary *dict;            /* The dictionary */
     struct matrix_data_pgm *mx;         /* MATRIX DATA program. */
     int content;                        /* Type of current row. */
     double *split_values;               /* SPLIT FILE variable values. */
@@ -1475,7 +1480,7 @@
    them to the output file.
    Returns true if successful, false if an I/O error occurred. */
 static bool
-read_matrices_with_rowtype (struct matrix_data_pgm *mx)
+read_matrices_with_rowtype (struct dataset *ds, struct matrix_data_pgm *mx)
 {
   struct wr_aux_data wr;
   bool ok;
@@ -1485,12 +1490,13 @@
   wr.split_values = NULL;
   wr.data = NULL;
   wr.current = NULL;
+  wr.dict = dataset_dict (ds);
   mx->cells = 0;
 
-  proc_set_source (current_dataset, 
+  proc_set_source (ds, 
                   create_case_source (&matrix_data_with_rowtype_source_class,
                                        &wr));
-  ok = procedure (current_dataset,NULL, NULL);
+  ok = procedure (ds, NULL, NULL);
 
   free (wr.split_values);
   return ok;
@@ -1534,7 +1540,7 @@
   bool compare;
   size_t split_cnt;
 
-  split_cnt = dict_get_split_cnt (dataset_dict (current_dataset));
+  split_cnt = dict_get_split_cnt (wr->dict);
   if (split_cnt == 0)
     return true;
 
@@ -1628,8 +1634,8 @@
     size_t split_cnt;
     size_t i;
 
-    split_cnt = dict_get_split_cnt (dataset_dict (current_dataset));
-    split = dict_get_split_vars (dataset_dict (current_dataset));
+    split_cnt = dict_get_split_cnt (wr->dict);
+    split = dict_get_split_vars (wr->dict);
     for (i = 0; i < split_cnt; i++)
       case_data_rw (c, split[i]->fv)->f = wr->split_values[i];
   }
@@ -1697,7 +1703,8 @@
 
              fill_matrix (mx, content, iter->data[content]);
 
-             ok = dump_cell_content (mx, content, iter->data[content],
+             ok = dump_cell_content (wr->dict, mx, content, 
+                                     iter->data[content],
                                       c, write_case, wc_data);
               if (!ok)
                 break;
@@ -1956,7 +1963,7 @@
        if (token.type != MNUM)
          {
            msg (SE, _("Syntax error expecting value for %s %s."),
-                 dict_get_var (dataset_dict (current_dataset), 
mx->first_continuous + j)->name,
+                 dict_get_var (wr->dict, mx->first_continuous + j)->name,
                  context (mx->reader));
            return false;
          }

Index: src/language/data-io/print-space.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/data-io/print-space.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- src/language/data-io/print-space.c  20 Oct 2006 11:32:57 -0000      1.4
+++ src/language/data-io/print-space.c  26 Oct 2006 06:16:36 -0000      1.5
@@ -47,7 +47,7 @@
 static trns_free_func print_space_trns_free;
 
 int
-cmd_print_space (void)
+cmd_print_space (struct dataset *ds)
 {
   struct print_space_trns *trns;
   struct file_handle *handle;
@@ -68,7 +68,7 @@
 
   if (token != '.')
     {
-      expr = expr_parse (dataset_dict (current_dataset), EXPR_NUMBER);
+      expr = expr_parse (ds, EXPR_NUMBER);
       if (token != '.')
        {
          expr_free (expr);
@@ -95,7 +95,7 @@
   trns->writer = writer;
   trns->expr = expr;
 
-  add_transformation (current_dataset, 
+  add_transformation (ds,
                      print_space_trns_proc, print_space_trns_free, trns);
   return CMD_SUCCESS;
 }
@@ -103,7 +103,7 @@
 /* Executes a PRINT SPACE transformation. */
 static int
 print_space_trns_proc (void *t_, struct ccase *c,
-                       casenum_t case_num UNUSED)
+                       casenumber case_num UNUSED)
 {
   struct print_space_trns *trns = t_;
   int n;

Index: src/language/data-io/print.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/data-io/print.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- src/language/data-io/print.c        19 Oct 2006 15:04:53 -0000      1.15
+++ src/language/data-io/print.c        26 Oct 2006 06:16:36 -0000      1.16
@@ -94,39 +94,41 @@
     WRITE
   };
 
-static int internal_cmd_print (enum which_formats, bool eject);
+static int internal_cmd_print (struct dataset *ds, 
+                              enum which_formats, bool eject);
 static trns_proc_func print_trns_proc;
 static trns_free_func print_trns_free;
 static bool parse_specs (struct pool *tmp_pool, struct print_trns *,
-                         enum which_formats);
+                        struct dictionary *dict, enum which_formats);
 static void dump_table (struct print_trns *, const struct file_handle *);
 
 /* Basic parsing. */
 
 /* Parses PRINT command. */
 int
-cmd_print (void)
+cmd_print (struct dataset *ds)
 {
-  return internal_cmd_print (PRINT, false);
+  return internal_cmd_print (ds, PRINT, false);
 }
 
 /* Parses PRINT EJECT command. */
 int
-cmd_print_eject (void)
+cmd_print_eject (struct dataset *ds)
 {
-  return internal_cmd_print (PRINT, true);
+  return internal_cmd_print (ds, PRINT, true);
 }
 
 /* Parses WRITE command. */
 int
-cmd_write (void)
+cmd_write (struct dataset *ds)
 {
-  return internal_cmd_print (WRITE, false);
+  return internal_cmd_print (ds, WRITE, false);
 }
 
 /* Parses the output commands. */
 static int
-internal_cmd_print (enum which_formats which_formats, bool eject)
+internal_cmd_print (struct dataset *ds, 
+                   enum which_formats which_formats, bool eject)
 {
   bool print_table = 0;
   struct print_trns *trns;
@@ -177,7 +179,7 @@
     }
 
   /* Parse variables and strings. */
-  if (!parse_specs (tmp_pool, trns, which_formats))
+  if (!parse_specs (tmp_pool, trns, dataset_dict (ds), which_formats))
     goto error;
 
   if (lex_end_of_command () != CMD_SUCCESS)
@@ -198,7 +200,7 @@
     dump_table (trns, fh);
 
   /* Put the transformation in the queue. */
-  add_transformation (current_dataset, print_trns_proc, print_trns_free, trns);
+  add_transformation (ds, print_trns_proc, print_trns_free, trns);
 
   pool_destroy (tmp_pool);
 
@@ -211,7 +213,8 @@
 
 static bool parse_string_argument (struct print_trns *,
                                    int record, int *column);
-static bool parse_variable_argument (struct print_trns *,
+static bool parse_variable_argument (const struct dictionary *, 
+                                    struct print_trns *,
                                      struct pool *tmp_pool,
                                      int *record, int *column,
                                      enum which_formats);
@@ -221,6 +224,7 @@
    Returns success. */
 static bool
 parse_specs (struct pool *tmp_pool, struct print_trns *trns,
+            struct dictionary *dict, 
              enum which_formats which_formats)
 {
   int record = 0;
@@ -236,7 +240,7 @@
       if (token == T_STRING)
        ok = parse_string_argument (trns, record, &column);
       else
-       ok = parse_variable_argument (trns, tmp_pool, &record, &column,
+       ok = parse_variable_argument (dict, trns, tmp_pool, &record, &column,
                                       which_formats);
       if (!ok)
        return 0;
@@ -288,7 +292,8 @@
    to fixed_parse_compatible() or fixed_parse_fortran() as appropriate.
    Returns success. */
 static bool
-parse_variable_argument (struct print_trns *trns, struct pool *tmp_pool,
+parse_variable_argument (const struct dictionary *dict,
+                        struct print_trns *trns, struct pool *tmp_pool,
                          int *record, int *column,
                          enum which_formats which_formats)
 {
@@ -298,8 +303,7 @@
   size_t format_cnt;
   bool add_space;
   
-  if (!parse_variables_pool (tmp_pool,
-                             dataset_dict (current_dataset), &vars, &var_cnt, 
PV_DUPLICATE))
+  if (!parse_variables_pool (tmp_pool, dict, &vars, &var_cnt, PV_DUPLICATE))
     return false;
 
   if (lex_is_number () || token == '(')
@@ -416,7 +420,7 @@
 
 /* Performs the transformation inside print_trns T on case C. */
 static int
-print_trns_proc (void *trns_, struct ccase *c, casenum_t case_num UNUSED)
+print_trns_proc (void *trns_, struct ccase *c, casenumber case_num UNUSED)
 {
   struct print_trns *trns = trns_;
   struct prt_out_spec *spec;

Index: src/language/dictionary/apply-dictionary.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/dictionary/apply-dictionary.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- src/language/dictionary/apply-dictionary.c  19 Oct 2006 15:04:53 -0000      
1.8
+++ src/language/dictionary/apply-dictionary.c  26 Oct 2006 06:16:36 -0000      
1.9
@@ -39,7 +39,7 @@
 
 /* Parses and executes APPLY DICTIONARY. */
 int
-cmd_apply_dictionary (void)
+cmd_apply_dictionary (struct dataset *ds)
 {
   struct file_handle *handle;
   struct any_reader *reader;
@@ -63,7 +63,7 @@
   for (i = 0; i < dict_get_var_cnt (dict); i++)
     {
       struct variable *s = dict_get_var (dict, i);
-      struct variable *t = dict_lookup_var (dataset_dict (current_dataset), 
s->name);
+      struct variable *t = dict_lookup_var (dataset_dict (ds), s->name);
       if (t == NULL)
        continue;
 
@@ -128,10 +128,10 @@
   if (dict_get_weight (dict) != NULL) 
     {
       struct variable *new_weight
-        = dict_lookup_var (dataset_dict (current_dataset), dict_get_weight 
(dict)->name);
+        = dict_lookup_var (dataset_dict (ds), dict_get_weight (dict)->name);
 
       if (new_weight != NULL)
-        dict_set_weight (dataset_dict (current_dataset), new_weight);
+        dict_set_weight (dataset_dict (ds), new_weight);
     }
   
   any_reader_close (reader);

Index: src/language/dictionary/formats.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/dictionary/formats.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- src/language/dictionary/formats.c   19 Oct 2006 15:04:53 -0000      1.10
+++ src/language/dictionary/formats.c   26 Oct 2006 06:16:36 -0000      1.11
@@ -42,28 +42,28 @@
     FORMATS_WRITE = 002
   };
 
-static int internal_cmd_formats (int);
+static int internal_cmd_formats (struct dataset *ds, int);
 
 int
-cmd_print_formats (void)
+cmd_print_formats (struct dataset *ds)
 {
-  return internal_cmd_formats (FORMATS_PRINT);
+  return internal_cmd_formats (ds, FORMATS_PRINT);
 }
 
 int
-cmd_write_formats (void)
+cmd_write_formats (struct dataset *ds)
 {
-  return internal_cmd_formats (FORMATS_WRITE);
+  return internal_cmd_formats (ds, FORMATS_WRITE);
 }
 
 int
-cmd_formats (void)
+cmd_formats (struct dataset *ds)
 {
-  return internal_cmd_formats (FORMATS_PRINT | FORMATS_WRITE);
+  return internal_cmd_formats (ds, FORMATS_PRINT | FORMATS_WRITE);
 }
 
-int
-internal_cmd_formats (int which)
+static int
+internal_cmd_formats (struct dataset *ds, int which)
 {
   /* Variables. */
   struct variable **v;
@@ -83,7 +83,7 @@
       if (token == '.')
        break;
 
-      if (!parse_variables (dataset_dict (current_dataset), &v, &cv, 
PV_NUMERIC))
+      if (!parse_variables (dataset_dict (ds), &v, &cv, PV_NUMERIC))
        return CMD_FAILURE;
       type = v[0]->type;
 

Index: src/language/dictionary/missing-values.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/dictionary/missing-values.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- src/language/dictionary/missing-values.c    19 Oct 2006 15:04:53 -0000      
1.8
+++ src/language/dictionary/missing-values.c    26 Oct 2006 06:16:36 -0000      
1.9
@@ -37,7 +37,7 @@
 #define _(msgid) gettext (msgid)
 
 int
-cmd_missing_values (void)
+cmd_missing_values (struct dataset *ds)
 {
   struct variable **v;
   size_t nv;
@@ -49,7 +49,7 @@
     {
       size_t i;
 
-      if (!parse_variables (dataset_dict (current_dataset), &v, &nv, PV_NONE)) 
+      if (!parse_variables (dataset_dict (ds), &v, &nv, PV_NONE)) 
         goto done;
 
       if (!lex_match ('('))

Index: src/language/dictionary/modify-variables.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/dictionary/modify-variables.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- src/language/dictionary/modify-variables.c  19 Oct 2006 15:04:53 -0000      
1.9
+++ src/language/dictionary/modify-variables.c  26 Oct 2006 06:16:36 -0000      
1.10
@@ -78,7 +78,7 @@
 
 /* Performs MODIFY VARS command. */
 int
-cmd_modify_vars (void)
+cmd_modify_vars (struct dataset *ds)
 {
   /* Bits indicated whether we've already encountered a subcommand of
      this type. */
@@ -92,7 +92,7 @@
 
   size_t i;
 
-  if (proc_make_temporary_transformations_permanent (current_dataset))
+  if (proc_make_temporary_transformations_permanent (ds))
     msg (SE, _("MODIFY VARS may not be used after TEMPORARY.  "
                "Temporary transformations will be made permanent."));
 
@@ -142,7 +142,7 @@
                           "of variables."));
                      goto done;
                    }
-                 dict_get_vars (dataset_dict (current_dataset), &v, &nv, 1u << 
DC_SYSTEM);
+                 dict_get_vars (dataset_dict (ds), &v, &nv, 1u << DC_SYSTEM);
                }
              else
                {
@@ -152,7 +152,7 @@
                      free (v);
                      goto done;
                    }
-                 if (!parse_variables (dataset_dict (current_dataset), &v, &nv,
+                 if (!parse_variables (dataset_dict (ds), &v, &nv,
                                        PV_APPEND | PV_NO_DUPLICATE))
                    {
                      free (v);
@@ -194,7 +194,7 @@
                  msg (SE, _("`(' expected on RENAME subcommand."));
                  goto done;
                }
-             if (!parse_variables (dataset_dict (current_dataset), 
&vm.rename_vars, &vm.rename_cnt,
+             if (!parse_variables (dataset_dict (ds), &vm.rename_vars, 
&vm.rename_cnt,
                                    PV_APPEND | PV_NO_DUPLICATE))
                goto done;
              if (!lex_match ('='))
@@ -239,7 +239,7 @@
          already_encountered |= 4;
 
          lex_match ('=');
-         if (!parse_variables (dataset_dict (current_dataset), &keep_vars, 
&keep_cnt, PV_NONE))
+         if (!parse_variables (dataset_dict (ds), &keep_vars, &keep_cnt, 
PV_NONE))
            goto done;
 
          /* Transform the list of variables to keep into a list of
@@ -248,7 +248,7 @@
          sort (keep_vars, keep_cnt, sizeof *keep_vars,
                 compare_variables_given_ordering, 
&forward_positional_ordering);
 
-          dict_get_vars (dataset_dict (current_dataset), &all_vars, &all_cnt, 
0);
+          dict_get_vars (dataset_dict (ds), &all_vars, &all_cnt, 0);
           assert (all_cnt >= keep_cnt);
 
           drop_cnt = all_cnt - keep_cnt;
@@ -283,14 +283,14 @@
          already_encountered |= 4;
 
          lex_match ('=');
-         if (!parse_variables (dataset_dict (current_dataset), &drop_vars, 
&drop_cnt, PV_NONE))
+         if (!parse_variables (dataset_dict (ds), &drop_vars, &drop_cnt, 
PV_NONE))
            goto done;
           vm.drop_vars = drop_vars;
           vm.drop_cnt = drop_cnt;
        }
       else if (lex_match_id ("MAP"))
        {
-          struct dictionary *temp = dict_clone (dataset_dict 
(current_dataset));
+          struct dictionary *temp = dict_clone (dataset_dict (ds));
           int success = rearrange_dict (temp, &vm);
           if (success) 
             {
@@ -320,11 +320,11 @@
   if (already_encountered & (1 | 4))
     {
       /* Read the data. */
-      if (!procedure (current_dataset,NULL, NULL)) 
+      if (!procedure (ds,NULL, NULL)) 
         goto done; 
     }
 
-  if (!rearrange_dict (dataset_dict (current_dataset), &vm))
+  if (!rearrange_dict (dataset_dict (ds), &vm))
     goto done; 
 
   ret_code = CMD_SUCCESS;

Index: src/language/dictionary/numeric.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/dictionary/numeric.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- src/language/dictionary/numeric.c   19 Oct 2006 15:04:53 -0000      1.12
+++ src/language/dictionary/numeric.c   26 Oct 2006 06:16:36 -0000      1.13
@@ -37,7 +37,7 @@
 
 /* Parses the NUMERIC command. */
 int
-cmd_numeric (void)
+cmd_numeric (struct dataset *ds)
 {
   size_t i;
 
@@ -78,7 +78,7 @@
       /* Create each variable. */
       for (i = 0; i < nv; i++)
        {
-         struct variable *new_var = dict_create_var (dataset_dict 
(current_dataset), v[i], 0);
+         struct variable *new_var = dict_create_var (dataset_dict (ds), v[i], 
0);
          if (!new_var)
            msg (SE, _("There is already a variable named %s."), v[i]);
          else
@@ -108,7 +108,7 @@
 
 /* Parses the STRING command. */
 int
-cmd_string (void)
+cmd_string (struct dataset *ds)
 {
   size_t i;
 
@@ -157,7 +157,7 @@
       /* Create each variable. */
       for (i = 0; i < nv; i++)
        {
-         struct variable *new_var = dict_create_var (dataset_dict 
(current_dataset), v[i],
+         struct variable *new_var = dict_create_var (dataset_dict (ds), v[i],
                                                       width);
          if (!new_var)
            msg (SE, _("There is already a variable named %s."), v[i]);
@@ -185,14 +185,14 @@
 
 /* Parses the LEAVE command. */
 int
-cmd_leave (void)
+cmd_leave (struct dataset *ds)
 {
   struct variable **v;
   size_t nv;
 
   size_t i;
 
-  if (!parse_variables (dataset_dict (current_dataset), &v, &nv, PV_NONE))
+  if (!parse_variables (dataset_dict (ds), &v, &nv, PV_NONE))
     return CMD_CASCADING_FAILURE;
   for (i = 0; i < nv; i++)
     v[i]->leave = true;

Index: src/language/dictionary/rename-variables.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/dictionary/rename-variables.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- src/language/dictionary/rename-variables.c  19 Oct 2006 15:04:53 -0000      
1.6
+++ src/language/dictionary/rename-variables.c  26 Oct 2006 06:16:36 -0000      
1.7
@@ -38,7 +38,7 @@
 /* The code for this function is very similar to the code for the
    RENAME subcommand of MODIFY VARS. */
 int
-cmd_rename_variables (void)
+cmd_rename_variables (struct dataset *ds)
 {
   struct variable **rename_vars = NULL;
   char **rename_new_names = NULL;
@@ -47,7 +47,7 @@
 
   int status = CMD_CASCADING_FAILURE;
 
-  if (proc_make_temporary_transformations_permanent (current_dataset))
+  if (proc_make_temporary_transformations_permanent (ds))
     msg (SE, _("RENAME VARS may not be used after TEMPORARY.  "
                "Temporary transformations will be made permanent."));
 
@@ -61,7 +61,7 @@
          msg (SE, _("`(' expected."));
          goto lossage;
        }
-      if (!parse_variables (dataset_dict (current_dataset), &rename_vars, 
&rename_cnt,
+      if (!parse_variables (dataset_dict (ds), &rename_vars, &rename_cnt,
                            PV_APPEND | PV_NO_DUPLICATE))
        goto lossage;
       if (!lex_match ('='))
@@ -93,7 +93,7 @@
     }
   while (token != '.');
 
-  if (!dict_rename_vars (dataset_dict (current_dataset),
+  if (!dict_rename_vars (dataset_dict (ds),
                          rename_vars, rename_new_names, rename_cnt,
                          &err_name)) 
     {

Index: src/language/dictionary/split-file.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/dictionary/split-file.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- src/language/dictionary/split-file.c        19 Oct 2006 15:04:53 -0000      
1.8
+++ src/language/dictionary/split-file.c        26 Oct 2006 06:16:36 -0000      
1.9
@@ -41,10 +41,10 @@
 #define _(msgid) gettext (msgid)
 
 int
-cmd_split_file (void)
+cmd_split_file (struct dataset *ds)
 {
   if (lex_match_id ("OFF"))
-    dict_set_split_vars (dataset_dict (current_dataset), NULL, 0);
+    dict_set_split_vars (dataset_dict (ds), NULL, 0);
   else
     {
       struct variable **v;
@@ -54,10 +54,10 @@
       (void) ( lex_match_id ("SEPARATE") || lex_match_id ("LAYERED") );
       
       lex_match (T_BY);
-      if (!parse_variables (dataset_dict (current_dataset), &v, &n, 
PV_NO_DUPLICATE))
+      if (!parse_variables (dataset_dict (ds), &v, &n, PV_NO_DUPLICATE))
        return CMD_CASCADING_FAILURE;
 
-      dict_set_split_vars (dataset_dict (current_dataset), v, n);
+      dict_set_split_vars (dataset_dict (ds), v, n);
       free (v);
     }
 
@@ -66,14 +66,15 @@
 
 /* Dumps out the values of all the split variables for the case C. */
 void
-output_split_file_values (const struct ccase *c)
+output_split_file_values (const struct dataset *ds, const struct ccase *c)
 {
+  const struct dictionary *dict = dataset_dict (ds);
   struct variable *const *split;
   struct tab_table *t;
   size_t split_cnt;
   int i;
 
-  split_cnt = dict_get_split_cnt (dataset_dict (current_dataset));
+  split_cnt = dict_get_split_cnt (dict);
   if (split_cnt == 0)
     return;
 
@@ -84,7 +85,7 @@
   tab_text (t, 0, 0, TAB_NONE, _("Variable"));
   tab_text (t, 1, 0, TAB_LEFT, _("Value"));
   tab_text (t, 2, 0, TAB_LEFT, _("Label"));
-  split = dict_get_split_vars (dataset_dict (current_dataset));
+  split = dict_get_split_vars (dict);
   for (i = 0; i < split_cnt; i++)
     {
       struct variable *v = split[i];

Index: src/language/dictionary/split-file.h
===================================================================
RCS file: /sources/pspp/pspp/src/language/dictionary/split-file.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- src/language/dictionary/split-file.h        6 May 2006 17:46:52 -0000       
1.1
+++ src/language/dictionary/split-file.h        26 Oct 2006 06:16:36 -0000      
1.2
@@ -20,6 +20,6 @@
 #ifndef SPLIT_FILE_H
 #define SPLIT_FILE_H 1
 
-void output_split_file_values (const struct ccase *);
+void output_split_file_values (const struct dataset *ds, const struct ccase *);
 
 #endif /* split-file.h */

Index: src/language/dictionary/sys-file-info.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/dictionary/sys-file-info.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- src/language/dictionary/sys-file-info.c     19 Oct 2006 15:04:53 -0000      
1.10
+++ src/language/dictionary/sys-file-info.c     26 Oct 2006 06:16:36 -0000      
1.11
@@ -78,7 +78,7 @@
 
 /* SYSFILE INFO utility. */
 int
-cmd_sysfile_info (void)
+cmd_sysfile_info (struct dataset *ds UNUSED)
 {
   struct file_handle *h;
   struct dictionary *d;
@@ -176,12 +176,12 @@
 /* DISPLAY utility. */
 
 static void display_macros (void);
-static void display_documents (void);
+static void display_documents (const struct dictionary *dict);
 static void display_variables (struct variable **, size_t, int);
-static void display_vectors (int sorted);
+static void display_vectors (const struct dictionary *dict, int sorted);
 
 int
-cmd_display (void)
+cmd_display (struct dataset *ds)
 {
   /* Whether to sort the list of variables alphabetically. */
   int sorted;
@@ -193,19 +193,19 @@
   if (lex_match_id ("MACROS"))
     display_macros ();
   else if (lex_match_id ("DOCUMENTS"))
-    display_documents ();
+    display_documents (dataset_dict (ds));
   else if (lex_match_id ("FILE"))
     {
       som_blank_line ();
       if (!lex_force_match_id ("LABEL"))
        return CMD_FAILURE;
-      if (dict_get_label (dataset_dict (current_dataset)) == NULL)
+      if (dict_get_label (dataset_dict (ds)) == NULL)
        tab_output_text (TAB_LEFT,
                         _("The active file does not have a file label."));
       else
        {
          tab_output_text (TAB_LEFT | TAT_TITLE, _("File label:"));
-         tab_output_text (TAB_LEFT | TAB_FIX, dict_get_label (dataset_dict 
(current_dataset)));
+         tab_output_text (TAB_LEFT | TAB_FIX, dict_get_label (dataset_dict 
(ds)));
        }
     }
   else
@@ -231,7 +231,7 @@
 
       if (as == AS_VECTOR)
        {
-         display_vectors (sorted);
+         display_vectors (dataset_dict(ds), sorted);
          return CMD_SUCCESS;
        }
 
@@ -241,7 +241,7 @@
 
       if (token != '.')
        {
-         if (!parse_variables (dataset_dict (current_dataset), &vl, &n, 
PV_NONE))
+         if (!parse_variables (dataset_dict (ds), &vl, &n, PV_NONE))
            {
              free (vl);
              return CMD_FAILURE;
@@ -249,7 +249,7 @@
          as = AS_DICTIONARY;
        }
       else
-       dict_get_vars (dataset_dict (current_dataset), &vl, &n, 0);
+       dict_get_vars (dataset_dict (ds), &vl, &n, 0);
 
       if (as == AS_SCRATCH)
        {
@@ -289,9 +289,9 @@
 }
 
 static void
-display_documents (void)
+display_documents (const struct dictionary *dict)
 {
-  const char *documents = dict_get_documents (dataset_dict (current_dataset));
+  const char *documents = dict_get_documents (dict);
 
   som_blank_line ();
   if (documents == NULL)
@@ -567,14 +567,14 @@
 /* Display a list of vectors.  If SORTED is nonzero then they are
    sorted alphabetically. */
 static void
-display_vectors (int sorted)
+display_vectors (const struct dictionary *dict, int sorted)
 {
   const struct vector **vl;
   int i;
   struct tab_table *t;
   size_t nvec;
   
-  nvec = dict_get_vector_cnt (dataset_dict (current_dataset));
+  nvec = dict_get_vector_cnt (dict);
   if (nvec == 0)
     {
       msg (SW, _("No vectors defined."));
@@ -583,7 +583,7 @@
 
   vl = xnmalloc (nvec, sizeof *vl);
   for (i = 0; i < nvec; i++)
-    vl[i] = dict_get_vector (dataset_dict (current_dataset), i);
+    vl[i] = dict_get_vector (dict, i);
   if (sorted)
     qsort (vl, nvec, sizeof *vl, compare_vectors_by_name);
 

Index: src/language/dictionary/value-labels.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/dictionary/value-labels.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- src/language/dictionary/value-labels.c      19 Oct 2006 15:04:53 -0000      
1.8
+++ src/language/dictionary/value-labels.c      26 Oct 2006 06:16:36 -0000      
1.9
@@ -38,7 +38,7 @@
 
 /* Declarations. */
 
-static int do_value_labels (int);
+static int do_value_labels (const struct dictionary *dict, int);
 static int verify_val_labs (struct variable **vars, size_t var_cnt);
 static void erase_labels (struct variable **vars, size_t var_cnt);
 static int get_label (struct variable **vars, size_t var_cnt);
@@ -46,21 +46,21 @@
 /* Stubs. */
 
 int
-cmd_value_labels (void)
+cmd_value_labels (struct dataset *ds)
 {
-  return do_value_labels (1);
+  return do_value_labels (dataset_dict (ds), 1);
 }
 
 int
-cmd_add_value_labels (void)
+cmd_add_value_labels (struct dataset *ds)
 {
-  return do_value_labels (0);
+  return do_value_labels (dataset_dict (ds), 0);
 }
 
 /* Do it. */
 
 static int
-do_value_labels (int erase)
+do_value_labels (const struct dictionary *dict, int erase)
 {
   struct variable **vars; /* Variable list. */
   size_t var_cnt;         /* Number of variables. */
@@ -70,7 +70,7 @@
   
   while (token != '.')
     {
-      parse_err = !parse_variables (dataset_dict (current_dataset), &vars, 
&var_cnt, 
+      parse_err = !parse_variables (dict, &vars, &var_cnt, 
                                    PV_SAME_TYPE) ;
       if (var_cnt < 1)
        {

Index: src/language/dictionary/variable-display.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/dictionary/variable-display.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- src/language/dictionary/variable-display.c  19 Oct 2006 15:04:53 -0000      
1.8
+++ src/language/dictionary/variable-display.c  26 Oct 2006 06:16:36 -0000      
1.9
@@ -36,7 +36,7 @@
    It affects nothing but GUIs
 */
 int
-cmd_variable_alignment (void)
+cmd_variable_alignment (struct dataset *ds)
 {
   do
     {
@@ -46,7 +46,7 @@
       size_t i;
       enum alignment align;
 
-      if (!parse_variables (dataset_dict (current_dataset), &v, &nv, PV_NONE))
+      if (!parse_variables (dataset_dict (ds), &v, &nv, PV_NONE))
         return CMD_FAILURE;
 
       if ( lex_force_match('(') ) 
@@ -89,7 +89,7 @@
    It affects nothing but GUIs
 */
 int
-cmd_variable_width (void)
+cmd_variable_width (struct dataset *ds)
 {
   do
     {
@@ -97,7 +97,7 @@
       size_t nv;
       size_t i;
 
-      if (!parse_variables (dataset_dict (current_dataset), &v, &nv, PV_NONE))
+      if (!parse_variables (dataset_dict (ds), &v, &nv, PV_NONE))
         return CMD_FAILURE;
 
       if ( lex_force_match('(') ) 
@@ -123,7 +123,7 @@
 
 /* Set variables' measurement level */
 int
-cmd_variable_level (void)
+cmd_variable_level (struct dataset *ds)
 {
   do
     {
@@ -132,7 +132,7 @@
       enum measure level;
       size_t i;
 
-      if (!parse_variables (dataset_dict (current_dataset), &v, &nv, PV_NONE))
+      if (!parse_variables (dataset_dict (ds), &v, &nv, PV_NONE))
         return CMD_FAILURE;
 
       if ( lex_force_match('(') ) 

Index: src/language/dictionary/variable-label.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/dictionary/variable-label.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- src/language/dictionary/variable-label.c    19 Oct 2006 15:04:53 -0000      
1.9
+++ src/language/dictionary/variable-label.c    26 Oct 2006 06:16:36 -0000      
1.10
@@ -35,7 +35,7 @@
 #define _(msgid) gettext (msgid)
 
 int
-cmd_variable_labels (void)
+cmd_variable_labels (struct dataset *ds)
 {
   do
     {
@@ -44,7 +44,7 @@
 
       size_t i;
 
-      if (!parse_variables (dataset_dict (current_dataset), &v, &nv, PV_NONE))
+      if (!parse_variables (dataset_dict (ds), &v, &nv, PV_NONE))
         return CMD_FAILURE;
 
       if (token != T_STRING)

Index: src/language/dictionary/vector.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/dictionary/vector.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- src/language/dictionary/vector.c    19 Oct 2006 15:04:53 -0000      1.8
+++ src/language/dictionary/vector.c    26 Oct 2006 06:16:36 -0000      1.9
@@ -37,7 +37,7 @@
 #define _(msgid) gettext (msgid)
 
 int
-cmd_vector (void)
+cmd_vector (struct dataset *ds)
 {
   /* Just to be different, points to a set of null terminated strings
      containing the names of the vectors to be created.  The list
@@ -51,6 +51,8 @@
   /* Maximum allocated position for vecnames, plus one position. */
   char *endp = NULL;
 
+  struct dictionary *dict = dataset_dict (ds);
+
   cp = vecnames = xmalloc (256);
   endp = &vecnames[256];
   do
@@ -75,7 +77,7 @@
                goto fail;
              }
 
-         if (dict_lookup_vector (dataset_dict (current_dataset), tokid))
+         if (dict_lookup_vector (dict, tokid))
            {
              msg (SE, _("There is already a vector with name %s."), tokid);
              goto fail;
@@ -104,11 +106,11 @@
              goto fail;
            }
 
-         if (!parse_variables (dataset_dict (current_dataset), &v, &nv,
+         if (!parse_variables (dict, &v, &nv,
                                 PV_SAME_TYPE | PV_DUPLICATE))
            goto fail;
 
-          dict_create_vector (dataset_dict (current_dataset), vecnames, v, nv);
+          dict_create_vector (dict, vecnames, v, nv);
           free (v);
        }
       else if (lex_match ('('))
@@ -158,7 +160,7 @@
              for (i = 0; i < nv; i++)
                {
                  sprintf (name, "%s%d", cp, i + 1);
-                 if (dict_lookup_var (dataset_dict (current_dataset), name))
+                 if (dict_lookup_var (dict, name))
                    {
                      msg (SE, _("There is already a variable named %s."),
                            name);
@@ -175,9 +177,9 @@
              for (i = 0; i < nv; i++)
                {
                  sprintf (name, "%s%d", cp, i + 1);
-                 v[i] = dict_create_var_assert (dataset_dict 
(current_dataset), name, 0);
+                 v[i] = dict_create_var_assert (dict, name, 0);
                }
-              if (!dict_create_vector (dataset_dict (current_dataset), cp, v, 
nv))
+              if (!dict_create_vector (dict, cp, v, nv))
                 NOT_REACHED ();
              cp += strlen (cp) + 1;
            }

Index: src/language/dictionary/weight.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/dictionary/weight.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- src/language/dictionary/weight.c    19 Oct 2006 15:04:53 -0000      1.6
+++ src/language/dictionary/weight.c    26 Oct 2006 06:16:36 -0000      1.7
@@ -34,16 +34,17 @@
 #define _(msgid) gettext (msgid)
 
 int
-cmd_weight (void)
+cmd_weight (struct dataset *ds)
 {
+  struct dictionary *dict = dataset_dict (ds);
   if (lex_match_id ("OFF"))
-    dict_set_weight (dataset_dict (current_dataset), NULL);
+    dict_set_weight (dataset_dict (ds), NULL);
   else
     {
       struct variable *v;
 
       lex_match (T_BY);
-      v = parse_variable ();
+      v = parse_variable (dict);
       if (!v)
        return CMD_CASCADING_FAILURE;
       if (v->type == ALPHA)
@@ -57,7 +58,7 @@
          return CMD_CASCADING_FAILURE;
        }
 
-      dict_set_weight (dataset_dict (current_dataset), v);
+      dict_set_weight (dict, v);
     }
 
   return lex_end_of_command ();

Index: src/language/expressions/evaluate.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/expressions/evaluate.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- src/language/expressions/evaluate.c 14 Jul 2006 02:28:29 -0000      1.7
+++ src/language/expressions/evaluate.c 26 Oct 2006 06:16:36 -0000      1.8
@@ -32,12 +32,19 @@
 expr_evaluate (struct expression *e, const struct ccase *c, int case_idx,
                void *result)
 {
+  struct dataset *ds = e->ds;
   union operation_data *op = e->ops;
 
   double *ns = e->number_stack;
   struct substring *ss = e->string_stack;
 
-  assert ((c != NULL) == (e->dict != NULL));
+  /* Without a dictionary/dataset, the expression can't refer to variables, 
+     and you don't need to specify a case when you evaluate the
+     expression.  With a dictionary/dataset, the expression can refer
+     to variables, so you must specify a case when you evaluate the
+     expression. */
+  assert ((c != NULL) == (e->ds != NULL));
+
   pool_clear (e->eval_pool);
 
   for (;;)
@@ -102,18 +109,21 @@
 #include <language/command.h>
 
 int
-cmd_debug_evaluate (void)
+cmd_debug_evaluate (struct dataset *dsother UNUSED)
 {
   bool optimize = true;
   int retval = CMD_FAILURE;
   bool dump_postfix = false;
-  struct dictionary *d = NULL;
+
   struct ccase *c = NULL;
 
+  struct dataset *ds = NULL;
+
   struct expression *expr;
 
   for (;;) 
     {
+      struct dictionary *d = NULL;
       if (lex_match_id ("NOOPTIMIZE"))
         optimize = 0;
       else if (lex_match_id ("POSTFIX"))
@@ -149,8 +159,11 @@
               goto done;
             }
 
-          if (d == NULL)
-            d = dict_create ();
+         if  ( ds == NULL ) 
+           {
+             ds = create_dataset ();
+             d = dataset_dict (ds);
+           }
           
           old_value_cnt = dict_get_next_value_idx (d);
           v = dict_create_var (d, name, width);
@@ -186,12 +199,13 @@
       lex_force_match ('/');
       goto done;
     }
-  if (d != NULL)
-    fprintf (stderr, "; ");
+
+  if ( ds != NULL ) 
+    fprintf(stderr, "; ");
   fprintf (stderr, "%s => ", lex_rest_of_line (NULL));
   lex_get ();
 
-  expr = expr_parse_any (d, optimize);
+  expr = expr_parse_any (ds, optimize);
   if (!expr || lex_end_of_command () != CMD_SUCCESS)
     {
       if (expr != NULL)
@@ -242,12 +256,15 @@
   retval = CMD_SUCCESS;
 
  done:
+  if (ds)
+    destroy_dataset (ds);
+
   if (c != NULL) 
     {
       case_destroy (c);
       free (c); 
     }
-  dict_destroy (d);
+
   return retval;
 }
 

Index: src/language/expressions/generate.pl
===================================================================
RCS file: /sources/pspp/pspp/src/language/expressions/generate.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- src/language/expressions/generate.pl        9 Jun 2006 22:51:24 -0000       
1.3
+++ src/language/expressions/generate.pl        26 Oct 2006 06:16:36 -0000      
1.4
@@ -111,6 +111,8 @@
               FIXED_VALUE => 'c');
     init_type ('case_idx', 'fixed', C_TYPE => 'size_t',
               FIXED_VALUE => 'case_idx');
+    init_type ('dataset', 'fixed', C_TYPE => 'struct dataset *',
+              FIXED_VALUE => 'ds');
 
     # One of these is emitted at the end of each expression as a sentinel
     # that tells expr_evaluate() to return the value on the stack.

Index: src/language/expressions/operations.def
===================================================================
RCS file: /sources/pspp/pspp/src/language/expressions/operations.def,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- src/language/expressions/operations.def     19 Oct 2006 15:04:53 -0000      
1.5
+++ src/language/expressions/operations.def     26 Oct 2006 06:16:36 -0000      
1.6
@@ -957,8 +957,9 @@
 }
 
 no_opt perm_only function LAG (num_var v, pos_int n_before)
+    dataset ds;
 {
-  struct ccase *c = lagged_case (current_dataset, n_before);
+  struct ccase *c = lagged_case (ds, n_before);
   if (c != NULL)
     {
       double x = case_num (c, v->fv);
@@ -969,8 +970,9 @@
 }
 
 no_opt perm_only function LAG (num_var v)
+    dataset ds;
 {
-  struct ccase *c = lagged_case (current_dataset, 1);
+  struct ccase *c = lagged_case (ds, 1);
   if (c != NULL)
     {
       double x = case_num (c, v->fv);
@@ -982,8 +984,9 @@
 
 no_opt perm_only string function LAG (str_var v, pos_int n_before)
      expression e;
+     dataset ds;
 {
-  struct ccase *c = lagged_case (current_dataset, n_before);
+  struct ccase *c = lagged_case (ds, n_before);
   if (c != NULL)
     return copy_string (e, case_str (c, v->fv), v->width);
   else
@@ -992,8 +995,9 @@
 
 no_opt perm_only string function LAG (str_var v)
      expression e;
+     dataset ds;
 {
-  struct ccase *c = lagged_case (current_dataset, 1);
+  struct ccase *c = lagged_case (ds, 1);
   if (c != NULL)
     return copy_string (e, case_str (c, v->fv), v->width);
   else

Index: src/language/expressions/parse.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/expressions/parse.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- src/language/expressions/parse.c    20 Oct 2006 11:32:57 -0000      1.15
+++ src/language/expressions/parse.c    26 Oct 2006 06:16:36 -0000      1.16
@@ -50,7 +50,7 @@
 static parse_recursively_func parse_vector_element, parse_function;
 
 /* Utility functions. */
-static struct expression *expr_create (struct dictionary *);
+static struct expression *expr_create (struct dataset *ds);
 atom_type expr_node_returns (const union any_node *);
 
 static const char *atom_type_name (atom_type);
@@ -70,14 +70,14 @@
    Returns the new expression if successful or a null pointer
    otherwise. */
 struct expression *
-expr_parse (struct dictionary *dict, enum expr_type type) 
+expr_parse (struct dataset *ds, enum expr_type type) 
 {
   union any_node *n;
   struct expression *e;
 
   assert (type == EXPR_NUMBER || type == EXPR_STRING || type == EXPR_BOOLEAN);
 
-  e = expr_create (dict);
+  e = expr_create (ds);
   n = parse_or (e);
   if (n != NULL && type_check (e, &n, type))
     return finish_expression (expr_optimize (n, e), e);
@@ -93,9 +93,10 @@
    the expression as well. */
 struct expression *
 expr_parse_pool (struct pool *pool,
-                 struct dictionary *dict, enum expr_type type) 
+                struct dataset *ds, 
+                 enum expr_type type) 
 {
-  struct expression *e = expr_parse (dict, type);
+  struct expression *e = expr_parse (ds, type);
   if (e != NULL)
     pool_add_subpool (pool, e->expr_pool);
   return e;
@@ -110,12 +111,12 @@
 }
 
 struct expression *
-expr_parse_any (struct dictionary *dict, bool optimize)
+expr_parse_any (struct dataset *ds, bool optimize)
 {
   union any_node *n;
   struct expression *e;
 
-  e = expr_create (dict);
+  e = expr_create (ds);
   n = parse_or (e);
   if (n == NULL)
     {
@@ -733,7 +734,7 @@
           "JUL", "AUG", "SEP", "OCT", "NOV", "DEC",
         };
 
-      time_t last_proc_time = time_of_last_procedure (current_dataset);
+      time_t last_proc_time = time_of_last_procedure (e->ds);
       struct tm *time;
       char temp_buf[10];
 
@@ -751,7 +752,7 @@
     return expr_allocate_number (e, SYSMIS);
   else if (lex_match_id ("$JDATE"))
     {
-      time_t time = time_of_last_procedure (current_dataset);
+      time_t time = time_of_last_procedure (e->ds);
       struct tm *tm = localtime (&time);
       return expr_allocate_number (e, expr_ymd_to_ofs (tm->tm_year + 1900,
                                                        tm->tm_mon + 1,
@@ -759,7 +760,7 @@
     }
   else if (lex_match_id ("$TIME"))
     {
-      time_t time = time_of_last_procedure (current_dataset);
+      time_t time = time_of_last_procedure (e->ds);
       struct tm *tm = localtime (&time);
       return expr_allocate_number (e,
                                    expr_ymd_to_date (tm->tm_year + 1900,
@@ -792,7 +793,7 @@
           /* An identifier followed by a left parenthesis may be
              a vector element reference.  If not, it's a function
              call. */
-          if (e->dict != NULL && dict_lookup_vector (e->dict, tokid) != NULL) 
+          if (e->ds != NULL && dict_lookup_vector (dataset_dict (e->ds), 
tokid) != NULL) 
             return parse_vector_element (e);
           else
             return parse_function (e);
@@ -802,12 +803,12 @@
           /* $ at the beginning indicates a system variable. */
           return parse_sysvar (e);
         }
-      else if (e->dict != NULL && dict_lookup_var (e->dict, tokid))
+      else if (e->ds != NULL && dict_lookup_var (dataset_dict (e->ds), tokid))
         {
           /* It looks like a user variable.
              (It could be a format specifier, but we'll assume
              it's a variable unless proven otherwise. */
-          return allocate_unary_variable (e, parse_dict_variable (e->dict));
+          return allocate_unary_variable (e, parse_variable (dataset_dict 
(e->ds)));
         }
       else 
         {
@@ -872,7 +873,7 @@
   /* Find vector, skip token.
      The caller must already have verified that the current token
      is the name of a vector. */
-  vector = dict_lookup_vector (dataset_dict (current_dataset), tokid);
+  vector = dict_lookup_vector (dataset_dict (e->ds), tokid);
   assert (vector != NULL);
   lex_get ();
 
@@ -1185,7 +1186,7 @@
             size_t var_cnt;
             size_t i;
 
-            if (!parse_variables (dataset_dict (current_dataset), &vars, 
&var_cnt, PV_SINGLE))
+            if (!parse_variables (dataset_dict (e->ds), &vars, &var_cnt, 
PV_SINGLE))
               goto fail;
             for (i = 0; i < var_cnt; i++)
               add_arg (&args, &arg_cnt, &arg_cap,
@@ -1231,7 +1232,7 @@
       goto fail;
     }
   if ((f->flags & OPF_PERM_ONLY) && 
-      proc_in_temporary_transformations (current_dataset)) 
+      proc_in_temporary_transformations (e->ds)) 
     {
       msg (SE, _("%s may not appear after TEMPORARY."), f->prototype);
       goto fail;
@@ -1242,8 +1243,8 @@
 
   if (n->type == OP_LAG_Vn || n->type == OP_LAG_Vs) 
     {
-      if (dataset_n_lag (current_dataset) < 1)
-        dataset_set_n_lag (current_dataset, 1);
+      if (dataset_n_lag (e->ds) < 1)
+        dataset_set_n_lag (e->ds, 1);
     }
   else if (n->type == OP_LAG_Vnn || n->type == OP_LAG_Vsn)
     {
@@ -1251,8 +1252,8 @@
       assert (n->composite.arg_cnt == 2);
       assert (n->composite.args[1]->type == OP_pos_int);
       n_before = n->composite.args[1]->integer.i;
-      if ( dataset_n_lag (current_dataset) < n_before)
-        dataset_set_n_lag (current_dataset, n_before);
+      if ( dataset_n_lag (e->ds) < n_before)
+        dataset_set_n_lag (e->ds, n_before);
     }
   
   free (args);
@@ -1268,12 +1269,12 @@
 /* Utility functions. */
 
 static struct expression *
-expr_create (struct dictionary *dict)
+expr_create (struct dataset *ds)
 {
   struct pool *pool = pool_create ();
   struct expression *e = pool_alloc (pool, sizeof *e);
   e->expr_pool = pool;
-  e->dict = dict;
+  e->ds = ds;
   e->eval_pool = pool_create_subpool (e->expr_pool);
   e->ops = NULL;
   e->op_types = NULL;

Index: src/language/expressions/private.h
===================================================================
RCS file: /sources/pspp/pspp/src/language/expressions/private.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- src/language/expressions/private.h  20 Oct 2006 11:32:57 -0000      1.5
+++ src/language/expressions/private.h  26 Oct 2006 06:16:36 -0000      1.6
@@ -156,7 +156,7 @@
 struct expression
   {
     struct pool *expr_pool;     /* Pool for expression static data. */
-    struct dictionary *dict;    /* Dictionary for variables, vectors. */
+    struct dataset *ds ;        /* The dataset */
     atom_type type;             /* Type of expression result. */
 
     union operation_data *ops;  /* Expression data. */
@@ -168,7 +168,7 @@
     struct pool *eval_pool;     /* Pool for evaluation temporaries. */
   };
 
-struct expression *expr_parse_any (struct dictionary *, bool optimize);
+struct expression *expr_parse_any (struct dataset *,  bool optimize);
 void expr_debug_print_postfix (const struct expression *);
 
 union any_node *expr_optimize (union any_node *, struct expression *);

Index: src/language/expressions/public.h
===================================================================
RCS file: /sources/pspp/pspp/src/language/expressions/public.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- src/language/expressions/public.h   4 Mar 2006 01:11:57 -0000       1.1
+++ src/language/expressions/public.h   26 Oct 2006 06:16:36 -0000      1.2
@@ -35,12 +35,15 @@
 struct ccase;
 struct pool;
 union value;
+struct dataset ;
 
-struct expression *expr_parse (struct dictionary *, enum expr_type);
+struct expression *expr_parse (struct dataset *, enum expr_type);
 struct expression *expr_parse_pool (struct pool *,
-                                    struct dictionary *, enum expr_type);
+                                   struct dataset *,
+                                    enum expr_type);
 void expr_free (struct expression *);
 
+struct dataset;
 double expr_evaluate_num (struct expression *, const struct ccase *,
                           int case_idx);
 void expr_evaluate_str (struct expression *, const struct ccase *,

Index: src/language/lexer/q2c.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/lexer/q2c.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- src/language/lexer/q2c.c    19 Oct 2006 15:04:53 -0000      1.16
+++ src/language/lexer/q2c.c    26 Oct 2006 06:16:36 -0000      1.17
@@ -1177,7 +1177,7 @@
              dump (0, "/* Prototype for custom subcommands of %s. */",
                    cmdname);
            }
-         dump (0, "static int %scustom_%s (struct cmd_%s *, void *);",
+         dump (0, "static int %scustom_%s (struct dataset *, struct cmd_%s *, 
void *);",
                st_lower (prefix), st_lower (sbc->name),
                make_identifier (cmdname));
        }
@@ -1189,7 +1189,7 @@
   /* Prototypes for parsing and freeing functions. */
   {
     dump (0, "/* Command parsing functions. */");
-    dump (0, "static int parse_%s (struct cmd_%s *, void *);",
+    dump (0, "static int parse_%s (struct dataset *, struct cmd_%s *, void 
*);",
          make_identifier (cmdname), make_identifier (cmdname));
     dump (0, "static void free_%s (struct cmd_%s *);",
          make_identifier (cmdname), make_identifier (cmdname));
@@ -1584,7 +1584,7 @@
     }
   else if (sbc->type == SBC_VARLIST)
     {
-      dump (1, "if (!parse_variables (dataset_dict (current_dataset), 
&p->%sv_%s, &p->%sn_%s, "
+      dump (1, "if (!parse_variables (dataset_dict (ds), &p->%sv_%s, 
&p->%sn_%s, "
            "PV_APPEND%s%s))",
            st_lower (sbc->prefix), st_lower (sbc->name),
            st_lower (sbc->prefix), st_lower (sbc->name),
@@ -1595,7 +1595,7 @@
     }
   else if (sbc->type == SBC_VAR)
     {
-      dump (0, "p->%sv_%s = parse_variable ();",
+      dump (0, "p->%sv_%s = parse_variable (dataset_dict (ds));",
            st_lower (sbc->prefix), st_lower (sbc->name));
       dump (1, "if (!p->%sv_%s)",
            st_lower (sbc->prefix), st_lower (sbc->name));
@@ -1696,7 +1696,7 @@
     }
   else if (sbc->type == SBC_CUSTOM)
     {
-      dump (1, "switch (%scustom_%s (p, aux))",
+      dump (1, "switch (%scustom_%s (ds, p, aux))",
            st_lower (prefix), st_lower (sbc->name));
       dump (0, "{");
       dump (1, "case 0:");
@@ -1725,8 +1725,9 @@
   indent = 0;
 
   dump (0, "static int");
-  dump (0, "parse_%s (struct cmd_%s *p, void *aux UNUSED)",
+  dump (0, "parse_%s (struct dataset *ds%s, struct cmd_%s *p, void *aux 
UNUSED)",
         make_identifier (cmdname),
+       (def && ( def->type == SBC_VARLIST && def->type == SBC_CUSTOM))?"":" 
UNUSED",
        make_identifier (cmdname));
   dump (1, "{");
 
@@ -1740,18 +1741,18 @@
     {
       if (def->type == SBC_VARLIST)
        dump (1, "if (token == T_ID "
-              "&& dict_lookup_var (dataset_dict (current_dataset), tokid) != 
NULL "
+              "&& dict_lookup_var (dataset_dict (ds), tokid) != NULL "
              "&& lex_look_ahead () != '=')");
       else
        {
          dump (0, "if ((token == T_ID "
-                "&& dict_lookup_var (dataset_dict (current_dataset), tokid) "
+                "&& dict_lookup_var (dataset_dict (ds), tokid) "
                "&& lex_look_ahead () != '=')");
          dump (1, "     || token == T_ALL)");
        }
       dump (1, "{");
       dump (0, "p->sbc_%s++;", st_lower (def->name));
-      dump (1, "if (!parse_variables (dataset_dict (current_dataset), 
&p->%sv_%s, &p->%sn_%s, "
+      dump (1, "if (!parse_variables (dataset_dict (ds), &p->%sv_%s, 
&p->%sn_%s, "
            "PV_APPEND))",
            st_lower (def->prefix), st_lower (def->name),
            st_lower (def->prefix), st_lower (def->name));
@@ -1762,7 +1763,7 @@
     }
   else if (def && def->type == SBC_CUSTOM)
     {
-      dump (1, "switch (%scustom_%s (p, aux))",
+      dump (1, "switch (%scustom_%s (ds, p, aux))",
            st_lower (prefix), st_lower (def->name));
       dump (0, "{");
       dump (1, "case 0:");
@@ -2063,7 +2064,5 @@
       dump (0, "#line %d \"%s\"", ln + 1, ifn);
     }
 
-
-
   return EXIT_SUCCESS;
 }

Index: src/language/lexer/variable-parser.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/lexer/variable-parser.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- src/language/lexer/variable-parser.c        19 Oct 2006 15:04:53 -0000      
1.9
+++ src/language/lexer/variable-parser.c        26 Oct 2006 06:16:36 -0000      
1.10
@@ -79,7 +79,7 @@
    variable if successful.  On failure emits an error message and
    returns a null pointer. */
 struct variable *
-parse_dict_variable (const struct dictionary *d) 
+parse_variable (const struct dictionary *d) 
 {
   struct var_set *vs = var_set_create_from_dict (d);
   struct variable *var = parse_vs_variable (vs);
@@ -87,16 +87,6 @@
   return var;
 }
 
-/* Parses a variable name in dataset_dict (current_dataset) and returns the
-   variable if successful.  On failure emits an error message and
-   returns a null pointer. */
-struct variable *
-parse_variable (void)
-{
-  return parse_dict_variable (dataset_dict (current_dataset));
-}
-
-
 /* Parses a set of variables from dictionary D given options
    OPTS.  Resulting list of variables stored in *VAR and the
    number of variables into *CNT.  Returns true only if
@@ -533,7 +523,8 @@
    existing and the rest are to be created.  Same args as
    parse_DATA_LIST_vars(). */
 bool
-parse_mixed_vars (char ***names, size_t *nnames, int pv_opts)
+parse_mixed_vars (const struct dictionary *dict, 
+                 char ***names, size_t *nnames, int pv_opts)
 {
   size_t i;
 
@@ -548,12 +539,12 @@
     }
   while (token == T_ID || token == T_ALL)
     {
-      if (token == T_ALL || dict_lookup_var (dataset_dict (current_dataset), 
tokid) != NULL)
+      if (token == T_ALL || dict_lookup_var (dict, tokid) != NULL)
        {
          struct variable **v;
          size_t nv;
 
-         if (!parse_variables (dataset_dict (current_dataset), &v, &nv, 
PV_NONE))
+         if (!parse_variables (dict, &v, &nv, PV_NONE))
            goto fail;
          *names = xnrealloc (*names, *nnames + nv, sizeof **names);
          for (i = 0; i < nv; i++)
@@ -580,7 +571,7 @@
    parse_mixed_vars(), except that all allocations are taken
    from the given POOL. */
 bool
-parse_mixed_vars_pool (struct pool *pool,
+parse_mixed_vars_pool (const struct dictionary *dict, struct pool *pool,
                        char ***names, size_t *nnames, int pv_opts)
 {
   int retval;
@@ -591,7 +582,7 @@
      re-free it later. */
   assert (!(pv_opts & PV_APPEND));
 
-  retval = parse_mixed_vars (names, nnames, pv_opts);
+  retval = parse_mixed_vars (dict, names, nnames, pv_opts);
   if (retval)
     register_vars_pool (pool, *names, *nnames);
   return retval;

Index: src/language/lexer/variable-parser.h
===================================================================
RCS file: /sources/pspp/pspp/src/language/lexer/variable-parser.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- src/language/lexer/variable-parser.h        14 Oct 2006 00:25:20 -0000      
1.3
+++ src/language/lexer/variable-parser.h        26 Oct 2006 06:16:36 -0000      
1.4
@@ -55,8 +55,7 @@
     PV_NO_SCRATCH = 00200      /* Disallow scratch variables. */
   };
 
-struct variable *parse_variable (void);
-struct variable *parse_dict_variable (const struct dictionary *);
+struct variable *parse_variable (const struct dictionary *);
 bool parse_variables (const struct dictionary *, struct variable ***, size_t *,
                      int opts);
 bool parse_variables_pool (struct pool *, const struct dictionary *,
@@ -66,8 +65,10 @@
 bool parse_DATA_LIST_vars (char ***names, size_t *cnt, int opts);
 bool parse_DATA_LIST_vars_pool (struct pool *,
                                char ***names, size_t *cnt, int opts);
-bool parse_mixed_vars (char ***names, size_t *cnt, int opts);
-bool parse_mixed_vars_pool (struct pool *,
+bool parse_mixed_vars (const struct dictionary *dict, 
+                      char ***names, size_t *cnt, int opts);
+bool parse_mixed_vars_pool (const struct dictionary *dict, 
+                           struct pool *,
                            char ***names, size_t *cnt, int opts);
 
 #endif /* variable-parser.h */

Index: src/language/stats/aggregate.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/aggregate.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- src/language/stats/aggregate.c      19 Oct 2006 15:04:53 -0000      1.16
+++ src/language/stats/aggregate.c      26 Oct 2006 06:16:36 -0000      1.17
@@ -146,6 +146,7 @@
     enum missing_treatment missing;     /* How to treat missing values. */
     struct agr_var *agr_vars;           /* First aggregate variable. */
     struct dictionary *dict;            /* Aggregate dictionary. */
+    const struct dictionary *src_dict;  /* Dict of the source */
     int case_cnt;                       /* Counts aggregated cases. */
     struct ccase agr_case;              /* Aggregate case for output. */
   };
@@ -154,7 +155,8 @@
                                        const struct ccase *);
 
 /* Prototypes. */
-static bool parse_aggregate_functions (struct agr_proc *);
+static bool parse_aggregate_functions (const struct dictionary *,
+                                      struct agr_proc *);
 static void agr_destroy (struct agr_proc *);
 static bool aggregate_single_case (struct agr_proc *agr,
                                   const struct ccase *input,
@@ -162,17 +164,18 @@
 static void dump_aggregate_info (struct agr_proc *agr, struct ccase *output);
 
 /* Aggregating to the active file. */
-static bool agr_to_active_file (const struct ccase *, void *aux);
+static bool agr_to_active_file (const struct ccase *, void *aux, const struct 
dataset *);
 
 /* Aggregating to a system file. */
-static bool presorted_agr_to_sysfile (const struct ccase *, void *aux);
+static bool presorted_agr_to_sysfile (const struct ccase *, void *aux, const 
struct dataset *);
 
 /* Parsing. */
 
 /* Parses and executes the AGGREGATE procedure. */
 int
-cmd_aggregate (void)
+cmd_aggregate (struct dataset *ds)
 {
+  struct dictionary *dict = dataset_dict (ds);
   struct agr_proc agr;
   struct file_handle *out_file = NULL;
 
@@ -185,8 +188,9 @@
   case_nullify (&agr.break_case);
   
   agr.dict = dict_create ();
-  dict_set_label (agr.dict, dict_get_label (dataset_dict (current_dataset)));
-  dict_set_documents (agr.dict, dict_get_documents (dataset_dict 
(current_dataset)));
+  agr.src_dict = dict;
+  dict_set_label (agr.dict, dict_get_label (dict));
+  dict_set_documents (agr.dict, dict_get_documents (dict));
 
   /* OUTFILE subcommand must be first. */
   if (!lex_force_match_id ("OUTFILE"))
@@ -223,7 +227,7 @@
           int i;
 
          lex_match ('=');
-          agr.sort = sort_parse_criteria (dataset_dict (current_dataset),
+          agr.sort = sort_parse_criteria (dict,
                                           &agr.break_vars, &agr.break_var_cnt,
                                           &saw_direction, NULL);
           if (agr.sort == NULL)
@@ -249,7 +253,7 @@
       
   /* Read in the aggregate functions. */
   lex_match ('/');
-  if (!parse_aggregate_functions (&agr))
+  if (!parse_aggregate_functions (dict, &agr))
     goto error;
 
   /* Delete documents. */
@@ -268,21 +272,21 @@
     {
       /* The active file will be replaced by the aggregated data,
          so TEMPORARY is moot. */
-      proc_cancel_temporary_transformations (current_dataset);
+      proc_cancel_temporary_transformations (ds);
 
       if (agr.sort != NULL && !presorted) 
         {
-          if (!sort_active_file_in_place (agr.sort))
+          if (!sort_active_file_in_place (ds, agr.sort))
             goto error;
         }
 
       agr.sink = create_case_sink (&storage_sink_class, agr.dict, NULL);
       if (agr.sink->class->open != NULL)
         agr.sink->class->open (agr.sink);
-      proc_set_sink (current_dataset, 
+      proc_set_sink (ds, 
                     create_case_sink (&null_sink_class, 
-                                      dataset_dict (current_dataset), NULL));
-      if (!procedure (current_dataset,agr_to_active_file, &agr))
+                                      dict, NULL));
+      if (!procedure (ds, agr_to_active_file, &agr))
         goto error;
       if (agr.case_cnt > 0) 
         {
@@ -290,11 +294,11 @@
           if (!agr.sink->class->write (agr.sink, &agr.agr_case))
             goto error;
         }
-      discard_variables (current_dataset);
-      dict_destroy (dataset_dict (current_dataset));
-      dataset_set_dict (current_dataset, agr.dict);
+      discard_variables (ds);
+      dict_destroy (dict);
+      dataset_set_dict (ds, agr.dict);
       agr.dict = NULL;
-      proc_set_source (current_dataset, 
+      proc_set_source (ds, 
                       agr.sink->class->make_source (agr.sink));
       free_case_sink (agr.sink);
     }
@@ -312,7 +316,7 @@
           struct ccase c;
           bool ok = true;
           
-          dst = sort_active_file_to_casefile (agr.sort);
+          dst = sort_active_file_to_casefile (ds, agr.sort);
           if (dst == NULL)
             goto error;
           reader = casefile_get_destructive_reader (dst);
@@ -332,7 +336,7 @@
       else 
         {
           /* Active file is already sorted. */
-          if (!procedure (current_dataset,presorted_agr_to_sysfile, &agr))
+          if (!procedure (ds, presorted_agr_to_sysfile, &agr))
             goto error;
         }
       
@@ -355,7 +359,7 @@
 
 /* Parse all the aggregate functions. */
 static bool
-parse_aggregate_functions (struct agr_proc *agr)
+parse_aggregate_functions (const struct dictionary *dict, struct agr_proc *agr)
 {
   struct agr_var *tail; /* Tail of linked list starting at agr->vars. */
 
@@ -462,7 +466,7 @@
            else if (function->n_args)
              pv_opts |= PV_SAME_TYPE;
 
-           if (!parse_variables (dataset_dict (current_dataset), &src, &n_src, 
pv_opts))
+           if (!parse_variables (dict, &src, &n_src, pv_opts))
              goto error;
          }
 
@@ -580,7 +584,7 @@
                     if (destvar != NULL) 
                       {
                         if ((func_index == N || func_index == NMISS)
-                            && dict_get_weight (dataset_dict 
(current_dataset)) != NULL)
+                            && dict_get_weight (dict) != NULL)
                           destvar->print = destvar->write = f8_2; 
                         else
                           destvar->print = destvar->write = function->format;
@@ -590,7 +594,7 @@
                v->src = NULL;
                destvar = dict_create_var (agr->dict, dest[i], 0);
                 if (func_index == N_NO_VARS
-                    && dict_get_weight (dataset_dict (current_dataset)) != 
NULL)
+                    && dict_get_weight (dict) != NULL)
                   destvar->print = destvar->write = f8_2; 
                 else
                   destvar->print = destvar->write = function->format;
@@ -748,7 +752,7 @@
   double weight;
   bool bad_warn = true;
 
-  weight = dict_get_case_weight (dataset_dict (current_dataset), input, 
&bad_warn);
+  weight = dict_get_case_weight (agr->src_dict, input, &bad_warn);
 
   for (iter = agr->agr_vars; iter; iter = iter->next)
     if (iter->src)
@@ -1086,7 +1090,7 @@
    are dropped.
    Returns true if successful, false if an I/O error occurred. */
 static bool
-agr_to_active_file (const struct ccase *c, void *agr_)
+agr_to_active_file (const struct ccase *c, void *agr_, const struct dataset 
*ds UNUSED)
 {
   struct agr_proc *agr = agr_;
 
@@ -1099,7 +1103,7 @@
 /* Aggregate the current case and output it if we passed a
    breakpoint. */
 static bool
-presorted_agr_to_sysfile (const struct ccase *c, void *agr_) 
+presorted_agr_to_sysfile (const struct ccase *c, void *agr_, const struct 
dataset *ds UNUSED) 
 {
   struct agr_proc *agr = agr_;
 

Index: src/language/stats/autorecode.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/autorecode.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- src/language/stats/autorecode.c     19 Oct 2006 15:04:53 -0000      1.11
+++ src/language/stats/autorecode.c     26 Oct 2006 06:16:36 -0000      1.12
@@ -93,16 +93,16 @@
 
 static trns_proc_func autorecode_trns_proc;
 static trns_free_func autorecode_trns_free;
-static bool autorecode_proc_func (const struct ccase *, void *);
+static bool autorecode_proc_func (const struct ccase *, void *, const struct 
dataset *);
 static hsh_compare_func compare_alpha_value, compare_numeric_value;
 static hsh_hash_func hash_alpha_value, hash_numeric_value;
 
-static void recode (const struct autorecode_pgm *);
+static void recode (struct dataset *, const struct autorecode_pgm *);
 static void arc_free (struct autorecode_pgm *);
 
 /* Performs the AUTORECODE procedure. */
 int
-cmd_autorecode (void)
+cmd_autorecode (struct dataset *ds)
 {
   struct autorecode_pgm arc;
   size_t dst_cnt;
@@ -121,7 +121,7 @@
 
   lex_match_id ("VARIABLES");
   lex_match ('=');
-  if (!parse_variables (dataset_dict (current_dataset), &arc.src_vars, 
&arc.var_cnt,
+  if (!parse_variables (dataset_dict (ds), &arc.src_vars, &arc.var_cnt,
                         PV_NO_DUPLICATE))
     goto lossage;
   if (!lex_force_match_id ("INTO"))
@@ -159,7 +159,7 @@
     {
       int j;
 
-      if (dict_lookup_var (dataset_dict (current_dataset), arc.dst_names[i]) 
!= NULL)
+      if (dict_lookup_var (dataset_dict (ds), arc.dst_names[i]) != NULL)
        {
          msg (SE, _("Target variable %s duplicates existing variable %s."),
               arc.dst_names[i], arc.dst_names[i]);
@@ -185,13 +185,13 @@
       arc.src_values[i] = hsh_create (10, compare_numeric_value,
                                       hash_numeric_value, NULL, NULL);
 
-  ok = procedure (current_dataset,autorecode_proc_func, &arc);
+  ok = procedure (ds, autorecode_proc_func, &arc);
 
   for (i = 0; i < arc.var_cnt; i++)
-    arc.dst_vars[i] = dict_create_var_assert (dataset_dict (current_dataset),
+    arc.dst_vars[i] = dict_create_var_assert (dataset_dict (ds),
                                               arc.dst_names[i], 0);
 
-  recode (&arc);
+  recode (ds, &arc);
   arc_free (&arc);
   return ok ? CMD_SUCCESS : CMD_CASCADING_FAILURE;
 
@@ -228,7 +228,7 @@
 /* AUTORECODE transformation. */
 
 static void
-recode (const struct autorecode_pgm *arc)
+recode (struct dataset *ds, const struct autorecode_pgm *arc)
 {
   struct autorecode_trns *trns;
   size_t i;
@@ -267,13 +267,13 @@
          hsh_force_insert (spec->items, item);
        }
     }
-  add_transformation (current_dataset, 
+  add_transformation (ds, 
                      autorecode_trns_proc, autorecode_trns_free, trns);
 }
 
 /* Executes an AUTORECODE transformation. */
 static int
-autorecode_trns_proc (void *trns_, struct ccase *c, casenum_t case_idx UNUSED)
+autorecode_trns_proc (void *trns_, struct ccase *c, casenumber case_idx UNUSED)
 {
   struct autorecode_trns *trns = trns_;
   size_t i;
@@ -347,7 +347,7 @@
 }
 
 static bool
-autorecode_proc_func (const struct ccase *c, void *arc_)
+autorecode_proc_func (const struct ccase *c, void *arc_, const struct dataset 
*ds UNUSED)
 {
   struct autorecode_pgm *arc = arc_;
   size_t i;

Index: src/language/stats/correlations.q
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/correlations.q,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- src/language/stats/correlations.q   22 Oct 2006 11:07:52 -0000      1.12
+++ src/language/stats/correlations.q   26 Oct 2006 06:16:36 -0000      1.13
@@ -46,12 +46,12 @@
 static struct file_handle *matrix_file;
 
 static void free_correlations_state (void);
-static int internal_cmd_correlations (void);
+static int internal_cmd_correlations (struct dataset *ds);
 
 int
-cmd_correlations (void)
+cmd_correlations (struct dataset *ds)
 {
-  int result = internal_cmd_correlations ();
+  int result = internal_cmd_correlations (ds);
   free_correlations_state ();
   return result;
 }
@@ -71,22 +71,23 @@
 /* (functions) */
 
 int
-internal_cmd_correlations (void)
+internal_cmd_correlations (struct dataset *ds)
 {
   struct cmd_correlations cmd;
 
   cor_list = cor_last = NULL;
   matrix_file = NULL;
 
-  if (!parse_correlations (&cmd, NULL))
+  if (!parse_correlations (ds, &cmd, NULL))
     return CMD_FAILURE;
+
   free_correlations (&cmd);
 
   return CMD_SUCCESS;
 }
 
 static int
-cor_custom_variables (struct cmd_correlations *cmd UNUSED, void *aux UNUSED)
+cor_custom_variables (struct dataset *ds, struct cmd_correlations *cmd UNUSED, 
void *aux UNUSED)
 {
   struct variable **v1, **v2;
   size_t nv1, nv2;
@@ -94,18 +95,18 @@
 
   /* Ensure that this is a VARIABLES subcommand. */
   if (!lex_match_id ("VARIABLES")
-      && (token != T_ID || dict_lookup_var (dataset_dict (current_dataset), 
tokid) != NULL)
+      && (token != T_ID || dict_lookup_var (dataset_dict (ds), tokid) != NULL)
       && token != T_ALL)
     return 2;
   lex_match ('=');
 
-  if (!parse_variables (dataset_dict (current_dataset), &v1, &nv1,
+  if (!parse_variables (dataset_dict (ds), &v1, &nv1,
                        PV_NO_DUPLICATE | PV_NUMERIC))
     return 0;
   
   if (lex_match (T_WITH))
     {
-      if (!parse_variables (dataset_dict (current_dataset), &v2, &nv2,
+      if (!parse_variables (dataset_dict (ds), &v2, &nv2,
                            PV_NO_DUPLICATE | PV_NUMERIC))
        {
          free (v1);
@@ -133,7 +134,7 @@
 }
 
 static int
-cor_custom_matrix (struct cmd_correlations *cmd UNUSED, void *aux UNUSED)
+cor_custom_matrix (struct dataset *ds UNUSED, struct cmd_correlations *cmd 
UNUSED, void *aux UNUSED)
 {
   if (!lex_force_match ('('))
     return 0;

Index: src/language/stats/crosstabs.q
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/crosstabs.q,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- src/language/stats/crosstabs.q      22 Oct 2006 11:07:52 -0000      1.17
+++ src/language/stats/crosstabs.q      26 Oct 2006 06:16:36 -0000      1.18
@@ -175,11 +175,11 @@
 static struct pool *pl_tc;     /* For table cells. */
 static struct pool *pl_col;    /* For column data. */
 
-static int internal_cmd_crosstabs (void);
-static void precalc (const struct ccase *, void *);
-static bool calc_general (const struct ccase *, void *);
-static bool calc_integer (const struct ccase *, void *);
-static void postcalc (void *);
+static int internal_cmd_crosstabs (struct dataset *ds);
+static void precalc (const struct ccase *, void *, const struct dataset *);
+static bool calc_general (const struct ccase *, void *, const struct dataset 
*);
+static bool calc_integer (const struct ccase *, void *, const struct dataset 
*);
+static bool postcalc (void *, const struct dataset *);
 static void submit (struct tab_table *);
 
 static void format_short (char *s, const struct fmt_spec *fp,
@@ -187,9 +187,9 @@
 
 /* Parse and execute CROSSTABS, then clean up. */
 int
-cmd_crosstabs (void)
+cmd_crosstabs (struct dataset *ds)
 {
-  int result = internal_cmd_crosstabs ();
+  int result = internal_cmd_crosstabs (ds);
 
   free (variables);
   pool_destroy (pl_tc);
@@ -200,7 +200,7 @@
 
 /* Parses and executes the CROSSTABS procedure. */
 static int
-internal_cmd_crosstabs (void)
+internal_cmd_crosstabs (struct dataset *ds)
 {
   int i;
   bool ok;
@@ -212,7 +212,7 @@
   pl_tc = pool_create ();
   pl_col = pool_create ();
 
-  if (!parse_crosstabs (&cmd, NULL))
+  if (!parse_crosstabs (ds, &cmd, NULL))
     return CMD_FAILURE;
 
   mode = variables ? INTEGER : GENERAL;
@@ -293,7 +293,7 @@
   else
     write = CRS_WR_NONE;
 
-  ok = procedure_with_splits (current_dataset, precalc,
+  ok = procedure_with_splits (ds, precalc,
                               mode == GENERAL ? calc_general : calc_integer,
                               postcalc, NULL);
 
@@ -302,7 +302,7 @@
 
 /* Parses the TABLES subcommand. */
 static int
-crs_custom_tables (struct cmd_crosstabs *cmd UNUSED, void *aux UNUSED)
+crs_custom_tables (struct dataset *ds, struct cmd_crosstabs *cmd UNUSED, void 
*aux UNUSED)
 {
   struct var_set *var_set;
   int n_by;
@@ -313,7 +313,7 @@
 
   /* Ensure that this is a TABLES subcommand. */
   if (!lex_match_id ("TABLES")
-      && (token != T_ID || dict_lookup_var (dataset_dict (current_dataset), 
tokid) == NULL)
+      && (token != T_ID || dict_lookup_var (dataset_dict (ds), tokid) == NULL)
       && token != T_ALL)
     return 2;
   lex_match ('=');
@@ -321,7 +321,7 @@
   if (variables != NULL)
     var_set = var_set_create_from_array (variables, variables_cnt);
   else
-    var_set = var_set_create_from_dict (dataset_dict (current_dataset));
+    var_set = var_set_create_from_dict (dataset_dict (ds));
   assert (var_set != NULL);
   
   for (n_by = 0; ;)
@@ -406,7 +406,7 @@
 
 /* Parses the VARIABLES subcommand. */
 static int
-crs_custom_variables (struct cmd_crosstabs *cmd UNUSED, void *aux UNUSED)
+crs_custom_variables (struct dataset *ds, struct cmd_crosstabs *cmd UNUSED, 
void *aux UNUSED)
 {
   if (nxtab)
     {
@@ -423,7 +423,7 @@
 
       long min, max;
       
-      if (!parse_variables (dataset_dict (current_dataset), &variables, 
&variables_cnt,
+      if (!parse_variables (dataset_dict (ds), &variables, &variables_cnt,
                            (PV_APPEND | PV_NUMERIC
                             | PV_NO_DUPLICATE | PV_NO_SCRATCH)))
        return 0;
@@ -488,9 +488,9 @@
 
 /* Set up the crosstabulation tables for processing. */
 static  void
-precalc (const struct ccase *first, void *aux UNUSED)
+precalc (const struct ccase *first, void *aux UNUSED, const struct dataset *ds)
 {
-  output_split_file_values (first);
+  output_split_file_values (ds, first);
   if (mode == GENERAL)
     {
       gen_tab = hsh_create (512, compare_table_entry, hash_table_entry,
@@ -563,12 +563,12 @@
 
 /* Form crosstabulations for general mode. */
 static bool
-calc_general (const struct ccase *c, void *aux UNUSED)
+calc_general (const struct ccase *c, void *aux UNUSED, const struct dataset 
*ds)
 {
   bool bad_warn = true;
 
   /* Case weight. */
-  double weight = dict_get_case_weight (dataset_dict (current_dataset), c, 
&bad_warn);
+  double weight = dict_get_case_weight (dataset_dict (ds), c, &bad_warn);
 
   /* Flattened current table index. */
   int t;
@@ -637,12 +637,12 @@
 }
 
 static bool
-calc_integer (const struct ccase *c, void *aux UNUSED)
+calc_integer (const struct ccase *c, void *aux UNUSED, const struct dataset 
*ds)
 {
   bool bad_warn = true;
 
   /* Case weight. */
-  double weight = dict_get_case_weight (dataset_dict (current_dataset), c, 
&bad_warn);
+  double weight = dict_get_case_weight (dataset_dict (ds), c, &bad_warn);
   
   /* Flattened current table index. */
   int t;
@@ -762,8 +762,8 @@
                                int *, int *, int *);
 static void make_summary_table (void);
 
-static void
-postcalc (void *aux UNUSED)
+static bool
+postcalc (void *aux UNUSED, const struct dataset *ds UNUSED)
 {
   if (mode == GENERAL)
     {
@@ -799,6 +799,8 @@
   }
   
   hsh_destroy (gen_tab);
+
+  return true;
 }
 
 static void insert_summary (struct tab_table *, int tab_index, double valid);

Index: src/language/stats/descriptives.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/descriptives.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- src/language/stats/descriptives.c   19 Oct 2006 15:04:53 -0000      1.13
+++ src/language/stats/descriptives.c   26 Oct 2006 06:16:36 -0000      1.14
@@ -173,23 +173,27 @@
 static void free_dsc_proc (struct dsc_proc *);
 
 /* Z-score functions. */
-static bool try_name (struct dsc_proc *dsc, char *name);
-static bool generate_z_varname (struct dsc_proc *dsc, char *z_name,
+static bool try_name (const struct dictionary *dict, 
+                     struct dsc_proc *dsc, char *name);
+static bool generate_z_varname (const struct dictionary *dict, 
+                               struct dsc_proc *dsc, char *z_name,
                                const char *name, size_t *z_cnt);
 static void dump_z_table (struct dsc_proc *);
-static void setup_z_trns (struct dsc_proc *);
+static void setup_z_trns (struct dsc_proc *, struct dataset *);
 
 /* Procedure execution functions. */
 static bool calc_descriptives (const struct ccase *first,
-                               const struct casefile *, void *dsc_);
+                               const struct casefile *, void *dsc_, 
+                              const struct dataset *);
 static void display (struct dsc_proc *dsc);
 
 /* Parser and outline. */
 
 /* Handles DESCRIPTIVES. */
 int
-cmd_descriptives (void)
+cmd_descriptives (struct dataset *ds)
 {
+  struct dictionary *dict = dataset_dict (ds);
   struct dsc_proc *dsc;
   struct variable **vars = NULL;
   size_t var_cnt = 0;
@@ -314,7 +318,7 @@
             {
               int i;
               
-              if (!parse_variables (dataset_dict (current_dataset), &vars, 
&var_cnt,
+              if (!parse_variables (dataset_dict (ds), &vars, &var_cnt,
                                     PV_APPEND | PV_NO_DUPLICATE | PV_NUMERIC))
                goto error;
 
@@ -335,7 +339,7 @@
                       lex_error (NULL);
                       goto error;
                     }
-                  if (try_name (dsc, tokid)) 
+                  if (try_name (dict, dsc, tokid)) 
                     {
                       strcpy (dsc->vars[dsc->var_cnt - 1].z_name, tokid);
                       z_cnt++;
@@ -373,7 +377,7 @@
           for (i = 0; i < dsc->var_cnt; i++)
             if (dsc->vars[i].z_name[0] == 0) 
               {
-                if (!generate_z_varname (dsc, dsc->vars[i].z_name,
+                if (!generate_z_varname (dict, dsc, dsc->vars[i].z_name,
                                          dsc->vars[i].v->name, &gen_cnt))
                   goto error;
                 z_cnt++;
@@ -410,11 +414,11 @@
       dsc->vars[i].moments = moments_create (dsc->max_moment);
 
   /* Data pass. */
-  ok = multipass_procedure_with_splits (current_dataset, calc_descriptives, 
dsc);
+  ok = multipass_procedure_with_splits (ds, calc_descriptives, dsc);
 
   /* Z-scoring! */
   if (ok && z_cnt)
-    setup_z_trns (dsc);
+    setup_z_trns (dsc, ds);
 
   /* Done. */
   free (vars);
@@ -469,11 +473,11 @@
 /* Returns false if NAME is a duplicate of any existing variable name or
    of any previously-declared z-var name; otherwise returns true. */
 static bool
-try_name (struct dsc_proc *dsc, char *name)
+try_name (const struct dictionary *dict, struct dsc_proc *dsc, char *name)
 {
   size_t i;
 
-  if (dict_lookup_var (dataset_dict (current_dataset), name) != NULL)
+  if (dict_lookup_var (dict, name) != NULL)
     return false;
   for (i = 0; i < dsc->var_cnt; i++)
     if (!strcasecmp (dsc->vars[i].z_name, name))
@@ -486,7 +490,7 @@
    known to already exist.  If successful, returns true and
    copies the new name into Z_NAME.  On failure, returns false. */
 static bool
-generate_z_varname (struct dsc_proc *dsc, char *z_name,
+generate_z_varname (const struct dictionary *dict, struct dsc_proc *dsc, char 
*z_name,
                     const char *var_name, size_t *z_cnt)
 {
   char name[LONG_NAME_LEN + 1];
@@ -494,7 +498,7 @@
   /* Try a name based on the original variable name. */
   name[0] = 'Z';
   str_copy_trunc (name + 1, sizeof name - 1, var_name);
-  if (try_name (dsc, name))
+  if (try_name (dict, dsc, name))
     {
       strcpy (z_name, name);
       return true;
@@ -521,7 +525,7 @@
          return false;
        }
       
-      if (try_name (dsc, name))
+      if (try_name (dict, dsc, name))
        {
          strcpy (z_name, name);
          return true;
@@ -578,7 +582,7 @@
 */
 static int
 descriptives_trns_proc (void *trns_, struct ccase * c,
-                        casenum_t case_idx UNUSED)
+                        casenumber case_idx UNUSED)
 {
   struct dsc_trns *t = trns_;
   struct dsc_z_score *z;
@@ -631,7 +635,7 @@
 
 /* Sets up a transformation to calculate Z scores. */
 static void
-setup_z_trns (struct dsc_proc *dsc)
+setup_z_trns (struct dsc_proc *dsc, struct dataset *ds)
 {
   struct dsc_trns *t;
   size_t cnt, i;
@@ -667,7 +671,7 @@
          char *cp;
          struct variable *dst_var;
 
-         dst_var = dict_create_var_assert (dataset_dict (current_dataset), 
dv->z_name, 0);
+         dst_var = dict_create_var_assert (dataset_dict (ds), dv->z_name, 0);
          if (dv->v->label)
            {
              dst_var->label = xmalloc (strlen (dv->v->label) + 12);
@@ -690,7 +694,7 @@
        }
     }
 
-  add_transformation (current_dataset, 
+  add_transformation (ds,
                      descriptives_trns_proc, descriptives_trns_free, t);
 }
 
@@ -702,14 +706,15 @@
    in CF. */
 static bool
 calc_descriptives (const struct ccase *first,
-                   const struct casefile *cf, void *dsc_) 
+                   const struct casefile *cf, void *dsc_, 
+                  const struct dataset *ds) 
 {
   struct dsc_proc *dsc = dsc_;
   struct casereader *reader;
   struct ccase c;
   size_t i;
 
-  output_split_file_values (first);
+  output_split_file_values (ds, first);
 
   for (i = 0; i < dsc->var_cnt; i++)
     {
@@ -729,7 +734,7 @@
        casereader_read (reader, &c);
        case_destroy (&c))
     {
-      double weight = dict_get_case_weight (dataset_dict (current_dataset), 
&c, &dsc->bad_warn);
+      double weight = dict_get_case_weight (dataset_dict (ds), &c, 
&dsc->bad_warn);
       if (weight <= 0.0) 
         continue;
        
@@ -774,7 +779,7 @@
            casereader_read (reader, &c);
            case_destroy (&c))
         {
-          double weight = dict_get_case_weight (dataset_dict 
(current_dataset), &c, 
+          double weight = dict_get_case_weight (dataset_dict (ds), &c, 
                                                &dsc->bad_warn);
           if (weight <= 0.0)
             continue;

Index: src/language/stats/examine.q
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/examine.q,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- src/language/stats/examine.q        19 Oct 2006 15:04:53 -0000      1.11
+++ src/language/stats/examine.q        26 Oct 2006 06:16:36 -0000      1.12
@@ -110,7 +110,7 @@
 static struct metrics *totals=0;
 
 /* Parse the clause specifying the factors */
-static int examine_parse_independent_vars(struct cmd_examine *cmd);
+static int examine_parse_independent_vars (const struct dictionary *dict, 
struct cmd_examine *cmd);
 
 
 
@@ -151,8 +151,8 @@
 
 
 /* Per Split function */
-static bool run_examine(const struct ccase *,
-                        const struct casefile *cf, void *cmd_);
+static bool run_examine (const struct ccase *,
+                        const struct casefile *cf, void *cmd_, const struct 
dataset *);
 
 static void output_examine(void);
 
@@ -191,14 +191,14 @@
 
 
 int
-cmd_examine(void)
+cmd_examine (struct dataset *ds)
 {
   bool ok;
 
   subc_list_double_create(&percentile_list);
   percentile_algorithm = PC_HAVERAGE;
 
-  if ( !parse_examine(&cmd, NULL) )
+  if ( !parse_examine (ds, &cmd, NULL) )
     return CMD_FAILURE;
 
   /* If /MISSING=INCLUDE is set, then user missing values are ignored */
@@ -222,7 +222,7 @@
       subc_list_double_push(&percentile_list, 75);
     }
 
-  ok = multipass_procedure_with_splits (current_dataset, run_examine, &cmd);
+  ok = multipass_procedure_with_splits (ds, run_examine, &cmd);
 
   if ( totals ) 
     {
@@ -423,7 +423,8 @@
 
 /* Parse the PERCENTILES subcommand */
 static int
-xmn_custom_percentiles(struct cmd_examine *p UNUSED, void *aux UNUSED)
+xmn_custom_percentiles(struct dataset *ds UNUSED, 
+                      struct cmd_examine *p UNUSED, void *aux UNUSED)
 {
   sbc_percentile = 1;
 
@@ -433,7 +434,7 @@
 
   while ( lex_is_number() ) 
     {
-      subc_list_double_push(&percentile_list,lex_number());
+      subc_list_double_push (&percentile_list, lex_number());
 
       lex_get();
 
@@ -464,13 +465,13 @@
 
   if ( 0 == subc_list_double_count(&percentile_list))
     {
-      subc_list_double_push(&percentile_list, 5);
-      subc_list_double_push(&percentile_list, 10);
-      subc_list_double_push(&percentile_list, 25);
-      subc_list_double_push(&percentile_list, 50);
-      subc_list_double_push(&percentile_list, 75);
-      subc_list_double_push(&percentile_list, 90);
-      subc_list_double_push(&percentile_list, 95);
+      subc_list_double_push (&percentile_list, 5);
+      subc_list_double_push (&percentile_list, 10);
+      subc_list_double_push (&percentile_list, 25);
+      subc_list_double_push (&percentile_list, 50);
+      subc_list_double_push (&percentile_list, 75);
+      subc_list_double_push (&percentile_list, 90);
+      subc_list_double_push (&percentile_list, 95);
     }
 
   return 1;
@@ -478,7 +479,7 @@
 
 /* TOTAL and NOTOTAL are simple, mutually exclusive flags */
 static int
-xmn_custom_total(struct cmd_examine *p, void *aux UNUSED)
+xmn_custom_total (struct dataset *ds UNUSED, struct cmd_examine *p, void *aux 
UNUSED)
 {
   if ( p->sbc_nototal ) 
     {
@@ -490,7 +491,8 @@
 }
 
 static int
-xmn_custom_nototal(struct cmd_examine *p, void *aux UNUSED)
+xmn_custom_nototal (struct dataset *ds UNUSED, 
+                   struct cmd_examine *p, void *aux UNUSED)
 {
   if ( p->sbc_total ) 
     {
@@ -506,17 +508,18 @@
 /* Parser for the variables sub command  
    Returns 1 on success */
 static int
-xmn_custom_variables(struct cmd_examine *cmd, void *aux UNUSED)
+xmn_custom_variables(struct dataset *ds, struct cmd_examine *cmd, void *aux 
UNUSED)
 {
+  const struct dictionary *dict = dataset_dict (ds);
   lex_match('=');
 
-  if ((token != T_ID || dict_lookup_var (dataset_dict (current_dataset), 
tokid) == NULL)
+  if ((token != T_ID || dict_lookup_var (dict, tokid) == NULL)
       && token != T_ALL)
     {
       return 2;
     }
   
-  if (!parse_variables (dataset_dict (current_dataset), &dependent_vars, 
&n_dependent_vars,
+  if (!parse_variables (dict, &dependent_vars, &n_dependent_vars,
                        PV_NO_DUPLICATE | PV_NUMERIC | PV_NO_SCRATCH) )
     {
       free (dependent_vars);
@@ -530,7 +533,7 @@
   if ( lex_match(T_BY))
     {
       int success ; 
-      success =  examine_parse_independent_vars(cmd);
+      success =  examine_parse_independent_vars (dict, cmd);
       if ( success != 1 ) {
         free (dependent_vars);
        free (totals) ; 
@@ -545,12 +548,12 @@
 
 /* Parse the clause specifying the factors */
 static int
-examine_parse_independent_vars(struct cmd_examine *cmd)
+examine_parse_independent_vars (const struct dictionary *dict, struct 
cmd_examine *cmd)
 {
   int success;
   struct factor *sf = xmalloc (sizeof *sf);
 
-  if ((token != T_ID || dict_lookup_var (dataset_dict (current_dataset), 
tokid) == NULL)
+  if ((token != T_ID || dict_lookup_var (dict, tokid) == NULL)
       && token != T_ALL)
     {
       free ( sf ) ;
@@ -558,7 +561,7 @@
     }
 
 
-  sf->indep_var[0] = parse_variable();
+  sf->indep_var[0] = parse_variable (dict);
   sf->indep_var[1] = 0;
 
   if ( token == T_BY ) 
@@ -566,14 +569,14 @@
 
       lex_match(T_BY);
 
-      if ((token != T_ID || dict_lookup_var (dataset_dict (current_dataset), 
tokid) == NULL)
+      if ((token != T_ID || dict_lookup_var (dict, tokid) == NULL)
          && token != T_ALL)
        {
          free ( sf ) ;
          return 2;
        }
 
-      sf->indep_var[1] = parse_variable();
+      sf->indep_var[1] = parse_variable (dict);
 
     }
 
@@ -592,7 +595,7 @@
   if ( token == '.' || token == '/' ) 
     return 1;
 
-  success =  examine_parse_independent_vars(cmd);
+  success =  examine_parse_independent_vars (dict, cmd);
   
   if ( success != 1 ) 
     free ( sf ) ; 
@@ -678,8 +681,10 @@
 }
 
 static bool 
-run_examine(const struct ccase *first, const struct casefile *cf, void *cmd_ )
+run_examine(const struct ccase *first, const struct casefile *cf, 
+           void *cmd_, const struct dataset *ds)
 {
+  struct dictionary *dict = dataset_dict (ds);
   struct casereader *r;
   struct ccase c;
   int v;
@@ -688,7 +693,7 @@
 
   struct factor *fctr;
 
-  output_split_file_values (first);
+  output_split_file_values (ds, first);
 
   /* Make sure we haven't got rubbish left over from a 
      previous split */
@@ -704,8 +709,6 @@
       fctr = next;
     }
 
-
-
   for ( v = 0 ; v < n_dependent_vars ; ++v ) 
     metrics_precalc(&totals[v]);
 
@@ -717,7 +720,7 @@
       const int case_no = casereader_cnum(r);
 
       const double weight = 
-       dict_get_case_weight(dataset_dict (current_dataset), &c, 
&bad_weight_warn);
+       dict_get_case_weight(dict, &c, &bad_weight_warn);
 
       if ( cmd->miss == XMN_LISTWISE ) 
        {

Index: src/language/stats/flip.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/flip.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- src/language/stats/flip.c   19 Oct 2006 15:04:53 -0000      1.12
+++ src/language/stats/flip.c   26 Oct 2006 06:16:36 -0000      1.13
@@ -80,29 +80,30 @@
   };
 
 static void destroy_flip_pgm (struct flip_pgm *);
-static struct case_sink *flip_sink_create (struct flip_pgm *);
+static struct case_sink *flip_sink_create (struct dictionary *d, struct 
flip_pgm *);
 static struct case_source *flip_source_create (struct flip_pgm *);
 static bool flip_file (struct flip_pgm *);
-static int build_dictionary (struct flip_pgm *);
+static int build_dictionary (struct dictionary *, struct flip_pgm *);
 
 static const struct case_source_class flip_source_class;
 static const struct case_sink_class flip_sink_class;
 
 /* Parses and executes FLIP. */
 int
-cmd_flip (void)
+cmd_flip (struct dataset *ds)
 {
   struct flip_pgm *flip;
   struct case_sink *sink;
+  struct dictionary *dict = dataset_dict (ds);
   bool ok;
 
-  if (proc_make_temporary_transformations_permanent (current_dataset))
+  if (proc_make_temporary_transformations_permanent (ds))
     msg (SW, _("FLIP ignores TEMPORARY.  "
                "Temporary transformations will be made permanent."));
 
   flip = pool_create_container (struct flip_pgm, pool);
   flip->var = NULL;
-  flip->idx_to_fv = dict_get_compacted_idx_to_fv (dataset_dict 
(current_dataset));
+  flip->idx_to_fv = dict_get_compacted_idx_to_fv (dict);
   pool_register (flip->pool, free, flip->idx_to_fv);
   flip->var_cnt = 0;
   flip->case_cnt = 0;
@@ -115,25 +116,25 @@
   if (lex_match_id ("VARIABLES"))
     {
       lex_match ('=');
-      if (!parse_variables (dataset_dict (current_dataset), &flip->var, 
&flip->var_cnt,
+      if (!parse_variables (dict, &flip->var, &flip->var_cnt,
                             PV_NO_DUPLICATE))
        goto error;
       lex_match ('/');
     }
   else
-    dict_get_vars (dataset_dict (current_dataset), &flip->var, &flip->var_cnt, 
1u << DC_SYSTEM);
+    dict_get_vars (dict, &flip->var, &flip->var_cnt, 1u << DC_SYSTEM);
   pool_register (flip->pool, free, flip->var);
 
   lex_match ('/');
   if (lex_match_id ("NEWNAMES"))
     {
       lex_match ('=');
-      flip->new_names = parse_variable ();
+      flip->new_names = parse_variable (dict);
       if (!flip->new_names)
         goto error;
     }
   else
-    flip->new_names = dict_lookup_var (dataset_dict (current_dataset), 
"CASE_LBL");
+    flip->new_names = dict_lookup_var (dict, "CASE_LBL");
 
   if (flip->new_names)
     {
@@ -150,32 +151,32 @@
 
   /* Read the active file into a flip_sink. */
   flip->case_cnt = 0;
-  proc_make_temporary_transformations_permanent (current_dataset);
-  sink = flip_sink_create (flip);
+  proc_make_temporary_transformations_permanent (ds);
+  sink = flip_sink_create (dict, flip);
   if (sink == NULL)
     goto error;
-  proc_set_sink (current_dataset, sink);
+  proc_set_sink (ds, sink);
   flip->new_names_tail = NULL;
-  ok = procedure (current_dataset,NULL, NULL);
+  ok = procedure (ds,NULL, NULL);
 
   /* Flip the data we read. */
   if (!flip_file (flip)) 
     {
-      discard_variables (current_dataset);
+      discard_variables (ds);
       goto error;
     }
 
   /* Flip the dictionary. */
-  dict_clear (dataset_dict (current_dataset));
-  if (!build_dictionary (flip))
+  dict_clear (dict);
+  if (!build_dictionary (dict, flip))
     {
-      discard_variables (current_dataset);
+      discard_variables (ds);
       goto error;
     }
-  flip->case_size = dict_get_case_size (dataset_dict (current_dataset));
+  flip->case_size = dict_get_case_size (dict);
 
   /* Set up flipped data for reading. */
-  proc_set_source (current_dataset, flip_source_create (flip));
+  proc_set_source (ds, flip_source_create (flip));
 
   return ok ? lex_end_of_command () : CMD_CASCADING_FAILURE;
 
@@ -195,7 +196,7 @@
 /* Make a new variable with base name NAME, which is bowdlerized and
    mangled until acceptable, and returns success. */
 static int
-make_new_var (char name[])
+make_new_var (struct dictionary *dict, char name[])
 {
   char *cp;
 
@@ -219,7 +220,7 @@
   *cp = '\0';
   str_uppercase (name);
   
-  if (dict_create_var (dataset_dict (current_dataset), name, 0))
+  if (dict_create_var (dict, name, 0))
     return 1;
 
   /* Add numeric extensions until acceptable. */
@@ -234,7 +235,7 @@
        memcpy (n, name, ofs);
        sprintf (&n[ofs], "%d", i);
 
-       if (dict_create_var (dataset_dict (current_dataset), n, 0))
+       if (dict_create_var (dict, n, 0))
          return 1;
       }
   }
@@ -245,9 +246,9 @@
 
 /* Make a new dictionary for all the new variable names. */
 static int
-build_dictionary (struct flip_pgm *flip)
+build_dictionary (struct dictionary *dict, struct flip_pgm *flip)
 {
-  dict_create_var_assert (dataset_dict (current_dataset), "CASE_LBL", 8);
+  dict_create_var_assert (dict, "CASE_LBL", 8);
 
   if (flip->new_names_head == NULL)
     {
@@ -265,7 +266,7 @@
          char s[SHORT_NAME_LEN + 1];
 
          sprintf (s, "VAR%03d", i);
-         v = dict_create_var_assert (dataset_dict (current_dataset), s, 0);
+         v = dict_create_var_assert (dict, s, 0);
        }
     }
   else
@@ -273,7 +274,7 @@
       struct varname *v;
 
       for (v = flip->new_names_head; v; v = v->next)
-        if (!make_new_var (v->name))
+        if (!make_new_var (dict, v->name))
           return 0;
     }
   
@@ -282,7 +283,7 @@
      
 /* Creates a flip sink based on FLIP. */
 static struct case_sink *
-flip_sink_create (struct flip_pgm *flip) 
+flip_sink_create (struct dictionary *dict, struct flip_pgm *flip) 
 {
   size_t i;
 
@@ -309,7 +310,7 @@
 
   flip->case_cnt = 1;
 
-  return create_case_sink (&flip_sink_class, dataset_dict (current_dataset), 
flip);
+  return create_case_sink (&flip_sink_class, dict, flip);
 }
 
 /* Writes case C to the FLIP sink.

Index: src/language/stats/frequencies.q
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/frequencies.q,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- src/language/stats/frequencies.q    22 Oct 2006 11:07:52 -0000      1.18
+++ src/language/stats/frequencies.q    26 Oct 2006 06:16:36 -0000      1.19
@@ -278,9 +278,9 @@
 
 static void calc_stats (struct variable *v, double d[frq_n_stats]);
 
-static void precalc (const struct ccase *, void *);
-static bool calc (const struct ccase *, void *);
-static void postcalc (void *);
+static void precalc (const struct ccase *, void *, const struct dataset *);
+static bool calc (const struct ccase *, void *, const struct dataset *);
+static bool postcalc (void *, const struct dataset *);
 
 static void postprocess_freq_tab (struct variable *);
 static void dump_full (struct variable *);
@@ -305,15 +305,15 @@
 
 /* Parser and outline. */
 
-static int internal_cmd_frequencies (void);
+static int internal_cmd_frequencies (struct dataset *ds);
 
 int
-cmd_frequencies (void)
+cmd_frequencies (struct dataset *ds)
 {
   int result;
 
   int_pool = pool_create ();
-  result = internal_cmd_frequencies ();
+  result = internal_cmd_frequencies (ds);
   pool_destroy (int_pool);
   int_pool=0;
   pool_destroy (gen_pool);
@@ -324,7 +324,7 @@
 }
 
 static int
-internal_cmd_frequencies (void)
+internal_cmd_frequencies (struct dataset *ds)
 {
   int i;
   bool ok;
@@ -335,7 +335,7 @@
   n_variables = 0;
   v_variables = NULL;
 
-  if (!parse_frequencies (&cmd, NULL))
+  if (!parse_frequencies (ds, &cmd, NULL))
     return CMD_FAILURE;
 
   if (cmd.onepage_limit == NOT_LONG)
@@ -391,7 +391,7 @@
   
 
   /* Do it! */
-  ok = procedure_with_splits (current_dataset, precalc, calc, postcalc, NULL);
+  ok = procedure_with_splits (ds, precalc, calc, postcalc, NULL);
 
   free_frequencies(&cmd);
 
@@ -505,13 +505,13 @@
 
 /* Add data from case C to the frequency table. */
 static bool
-calc (const struct ccase *c, void *aux UNUSED)
+calc (const struct ccase *c, void *aux UNUSED, const struct dataset *ds)
 {
   double weight;
   size_t i;
   bool bad_warn = true;
 
-  weight = dict_get_case_weight (dataset_dict (current_dataset), c, &bad_warn);
+  weight = dict_get_case_weight (dataset_dict (ds), c, &bad_warn);
 
   for (i = 0; i < n_variables; i++)
     {
@@ -566,11 +566,11 @@
 /* Prepares each variable that is the target of FREQUENCIES by setting
    up its hash table. */
 static void
-precalc (const struct ccase *first, void *aux UNUSED)
+precalc (const struct ccase *first, void *aux UNUSED, const struct dataset *ds)
 {
   size_t i;
 
-  output_split_file_values (first);
+  output_split_file_values (ds, first);
 
   pool_destroy (gen_pool);
   gen_pool = pool_create ();
@@ -611,8 +611,8 @@
 
 /* Finishes up with the variables after frequencies have been
    calculated.  Displays statistics, percentiles, ... */
-static void
-postcalc (void *aux UNUSED)
+static bool
+postcalc (void *aux UNUSED, const struct dataset *ds  UNUSED)
 {
   size_t i;
 
@@ -687,6 +687,8 @@
       cleanup_freq_tab (v);
 
     }
+
+  return true;
 }
 
 /* Returns the comparison function that should be used for
@@ -791,7 +793,7 @@
 /* Parses the VARIABLES subcommand, adding to
    {n_variables,v_variables}. */
 static int
-frq_custom_variables (struct cmd_frequencies *cmd UNUSED, void *aux UNUSED)
+frq_custom_variables (struct dataset *ds, struct cmd_frequencies *cmd UNUSED, 
void *aux UNUSED)
 {
   int mode;
   int min = 0, max = 0;
@@ -801,10 +803,10 @@
 
   lex_match ('=');
   if (token != T_ALL && (token != T_ID
-                         || dict_lookup_var (dataset_dict (current_dataset), 
tokid) == NULL))
+                         || dict_lookup_var (dataset_dict (ds), tokid) == 
NULL))
     return 2;
 
-  if (!parse_variables (dataset_dict (current_dataset), &v_variables, 
&n_variables,
+  if (!parse_variables (dataset_dict (ds), &v_variables, &n_variables,
                        PV_APPEND | PV_NO_SCRATCH))
     return 0;
 
@@ -879,10 +881,10 @@
 /* Parses the GROUPED subcommand, setting the n_grouped, grouped
    fields of specified variables. */
 static int
-frq_custom_grouped (struct cmd_frequencies *cmd UNUSED, void *aux UNUSED)
+frq_custom_grouped (struct dataset *ds, struct cmd_frequencies *cmd UNUSED, 
void *aux UNUSED)
 {
   lex_match ('=');
-  if ((token == T_ID && dict_lookup_var (dataset_dict (current_dataset), 
tokid) != NULL)
+  if ((token == T_ID && dict_lookup_var (dataset_dict (ds), tokid) != NULL)
       || token == T_ID)
     for (;;)
       {
@@ -896,7 +898,7 @@
        size_t n;
        struct variable **v;
 
-       if (!parse_variables (dataset_dict (current_dataset), &v, &n,
+       if (!parse_variables (dataset_dict (ds), &v, &n,
                               PV_NO_DUPLICATE | PV_NUMERIC))
          return 0;
        if (lex_match ('('))
@@ -949,7 +951,7 @@
        free (v);
        if (!lex_match ('/'))
          break;
-       if ((token != T_ID || dict_lookup_var (dataset_dict (current_dataset), 
tokid) != NULL)
+       if ((token != T_ID || dict_lookup_var (dataset_dict (ds), tokid) != 
NULL)
             && token != T_ALL)
          {
            lex_put_back ('/');

Index: src/language/stats/means.q
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/means.q,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- src/language/stats/means.q  20 Oct 2006 11:32:57 -0000      1.9
+++ src/language/stats/means.q  26 Oct 2006 06:16:36 -0000      1.10
@@ -61,7 +61,7 @@
 
 /* Parses and executes the T-TEST procedure. */
 int
-cmd_means (void)
+cmd_means (struct dataset *ds)
 {
   struct cmd_means cmd;
   int success = CMD_FAILURE;
@@ -71,7 +71,7 @@
   v_dim = NULL;
   v_var = NULL;
 
-  if (!parse_means (&cmd, NULL))
+  if (!parse_means (ds, &cmd, NULL))
     goto free;
 
   if (cmd.sbc_cells)
@@ -122,12 +122,12 @@
 
 /* Parses the TABLES subcommand. */
 static int
-mns_custom_tables (struct cmd_means *cmd, void *aux UNUSED)
+mns_custom_tables (struct dataset *ds, struct cmd_means *cmd, void *aux UNUSED)
 {
   struct var_set *var_set;
   
   if (!lex_match_id ("TABLES")
-      && (token != T_ID || dict_lookup_var (dataset_dict (current_dataset), 
tokid) == NULL)
+      && (token != T_ID || dict_lookup_var (dataset_dict (ds), tokid) == NULL)
       && token != T_ALL)
     return 2;
   lex_match ('=');
@@ -139,7 +139,7 @@
       return 0;
     }
 
-  var_set = var_set_create_from_dict (dataset_dict (current_dataset));
+  var_set = var_set_create_from_dict (dataset_dict (ds));
   assert (var_set != NULL);
 
   do

Index: src/language/stats/oneway.q
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/oneway.q,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- src/language/stats/oneway.q 22 Oct 2006 11:07:52 -0000      1.12
+++ src/language/stats/oneway.q 26 Oct 2006 06:16:36 -0000      1.13
@@ -96,7 +96,7 @@
 
 
 static bool run_oneway(const struct ccase *first,
-                       const struct casefile *cf, void *_mode);
+                       const struct casefile *cf, void *_mode, const struct 
dataset *);
 
 
 /* Routines to show the output tables */
@@ -116,12 +116,12 @@
 
 
 int
-cmd_oneway(void)
+cmd_oneway (struct dataset *ds)
 {
   int i;
   bool ok;
 
-  if ( !parse_oneway(&cmd, NULL) )
+  if ( !parse_oneway (ds, &cmd, NULL) )
     return CMD_FAILURE;
 
   /* If /MISSING=INCLUDE is set, then user missing values are ignored */
@@ -149,7 +149,7 @@
        }
     }
 
-  ok = multipass_procedure_with_splits (current_dataset, run_oneway, &cmd);
+  ok = multipass_procedure_with_splits (ds, run_oneway, &cmd);
 
   free (vars);
   free_oneway (&cmd);
@@ -223,17 +223,17 @@
 
 /* Parser for the variables sub command */
 static int
-oneway_custom_variables(struct cmd_oneway *cmd UNUSED, void *aux UNUSED)
+oneway_custom_variables(struct dataset *ds, struct cmd_oneway *cmd UNUSED, 
void *aux UNUSED)
 {
+  struct dictionary *dict = dataset_dict (ds);
 
   lex_match('=');
 
-  if ((token != T_ID || dict_lookup_var (dataset_dict (current_dataset), 
tokid) == NULL)
+  if ((token != T_ID || dict_lookup_var (dict, tokid) == NULL)
       && token != T_ALL)
     return 2;
   
-
-  if (!parse_variables (dataset_dict (current_dataset), &vars, &n_vars,
+  if (!parse_variables (dict, &vars, &n_vars,
                        PV_DUPLICATE 
                        | PV_NUMERIC | PV_NO_SCRATCH) )
     {
@@ -246,8 +246,7 @@
   if ( ! lex_match(T_BY))
     return 2;
 
-
-  indep_var = parse_variable();
+  indep_var = parse_variable (dict);
 
   if ( !indep_var ) 
     {
@@ -255,7 +254,6 @@
       return 0;
     }
 
-
   return 1;
 }
 
@@ -894,14 +892,14 @@
 
 
 static bool
-run_oneway(const struct ccase *first, const struct casefile *cf, void *cmd_)
+run_oneway(const struct ccase *first, const struct casefile *cf, void *cmd_, 
const struct dataset *ds)
 {
   struct casereader *r;
   struct ccase c;
 
   struct cmd_oneway *cmd = (struct cmd_oneway *) cmd_;
 
-  output_split_file_values (first);
+  output_split_file_values (ds, first);
 
   global_group_hash = hsh_create(4, 
                                 (hsh_compare_func *) compare_values,
@@ -917,7 +915,7 @@
       size_t i;
 
       const double weight = 
-       dict_get_case_weight (dataset_dict (current_dataset), &c, 
&bad_weight_warn);
+       dict_get_case_weight (dataset_dict (ds), &c, &bad_weight_warn);
       
       const union value *indep_val = case_data (&c, indep_var->fv);
 
@@ -1006,7 +1004,7 @@
 
   
   if ( stat_tables & STAT_HOMO ) 
-    levene(cf, indep_var, n_vars, vars, 
+    levene (dataset_dict (ds), cf, indep_var, n_vars, vars, 
           (cmd->miss == ONEWAY_LISTWISE) ? LEV_LISTWISE : LEV_ANALYSIS ,
           value_is_missing);
 

Index: src/language/stats/rank.q
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/rank.q,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- src/language/stats/rank.q   22 Oct 2006 11:07:52 -0000      1.15
+++ src/language/stats/rank.q   26 Oct 2006 06:16:36 -0000      1.16
@@ -168,6 +168,7 @@
 
 static struct casefile *rank_sorted_casefile (struct casefile *cf, 
                                              const struct sort_criteria *, 
+                                             const struct dictionary *,
                                              const struct rank_spec *rs, 
                                              int n_rank_specs,
                                              int idx,
@@ -232,19 +233,19 @@
 
 
 static bool 
-rank_cmd (const struct sort_criteria *sc, 
+rank_cmd (struct dataset *ds, const struct sort_criteria *sc, 
       const struct rank_spec *rank_specs, int n_rank_specs)
 {
   struct sort_criteria criteria;
   bool result = true;
   int i;
-  const int n_splits = dict_get_split_cnt (dataset_dict (current_dataset));
+  const int n_splits = dict_get_split_cnt (dataset_dict (ds));
 
   criteria.crit_cnt = n_splits + n_group_vars + 1;
   criteria.crits = xnmalloc (criteria.crit_cnt, sizeof *criteria.crits);
   for (i = 0; i < n_splits ; i++) 
     {
-      struct variable *v = dict_get_split_vars (dataset_dict 
(current_dataset))[i];
+      struct variable *v = dict_get_split_vars (dataset_dict (ds))[i];
       criteria.crits[i].fv = v->fv;
       criteria.crits[i].width = v->width;
       criteria.crits[i].dir = SRT_ASCEND;
@@ -263,10 +264,10 @@
       struct casefile *sorted_cf ;
 
       /* Obtain active file in CF. */
-      if (!procedure (current_dataset, NULL, NULL))
+      if (!procedure (ds, NULL, NULL))
        goto error;
 
-      cf = proc_capture_output (current_dataset);
+      cf = proc_capture_output (ds);
 
       /* Sort CF into SORTED_CF. */
       reader = casefile_get_destructive_reader (cf) ;
@@ -276,6 +277,7 @@
       casefile_destroy (cf);
 
       out = rank_sorted_casefile (sorted_cf, &criteria,
+                                 dataset_dict (ds),
                                   rank_specs, n_rank_specs, 
                                  i, &src_vars[i]->miss)  ;
       if ( NULL == out ) 
@@ -284,7 +286,7 @@
          continue ;
        }
       
-      proc_set_source (current_dataset, storage_source_create (out));
+      proc_set_source (ds, storage_source_create (out));
     }
 
   free (criteria.crits);
@@ -487,6 +489,7 @@
 static void
 rank_cases (struct casereader *cr,
            unsigned long end,
+           const struct dictionary *dict,
            const struct sort_criterion *criterion,
            const struct missing_values *mv,
            double w,
@@ -516,7 +519,7 @@
         break;
       
       this_value = case_data (&this_case, fv);
-      c = dict_get_case_weight (dataset_dict (current_dataset), &this_case, 
&warn);
+      c = dict_get_case_weight (dict, &this_case, &warn);
               
       lookahead = casereader_clone (cr);
       n = 0;
@@ -535,7 +538,7 @@
               break; 
             }
 
-          c += dict_get_case_weight (dataset_dict (current_dataset), 
&lookahead_case, &warn);
+          c += dict_get_case_weight (dict, &lookahead_case, &warn);
           case_destroy (&lookahead_case);
           n++;
         }
@@ -589,6 +592,7 @@
 static struct casefile *
 rank_sorted_casefile (struct casefile *cf, 
                      const struct sort_criteria *crit, 
+                     const struct dictionary *dict,
                      const struct rank_spec *rs, 
                      int n_rank_specs, 
                      int dest_idx, 
@@ -610,16 +614,17 @@
       this_value = case_data( &group_case, ultimate_crit->fv);
 
       if ( !value_is_missing(mv, this_value) )
-       w = dict_get_case_weight (dataset_dict (current_dataset), &group_case, 
&warn);
+       w = dict_get_case_weight (dict, &group_case, &warn);
 
       while (casereader_read (lookahead, &this_case)) 
         {
          const union value *this_value = 
            case_data(&this_case, ultimate_crit->fv);
-          double c = dict_get_case_weight (dataset_dict (current_dataset), 
&this_case, &warn);
+          double c = dict_get_case_weight (dict, &this_case, &warn);
           if (!same_group (&group_case, &this_case, crit)) 
             {
               rank_cases (pos, casereader_cnum (lookahead) - 1,
+                         dict,
                          ultimate_crit, 
                          mv, w, 
                          rs, n_rank_specs, 
@@ -634,7 +639,7 @@
           case_destroy (&this_case);
         }
       case_destroy (&group_case);
-      rank_cases (pos, ULONG_MAX, ultimate_crit, mv, w,
+      rank_cases (pos, ULONG_MAX, dict, ultimate_crit, mv, w,
                  rs, n_rank_specs, dest_idx, dest);
     }
 
@@ -667,7 +672,7 @@
    If VNAME is NULL, then a name will be automatically chosen.
  */
 static struct variable *
-create_rank_variable (enum RANK_FUNC f, 
+create_rank_variable (struct dictionary *dict, enum RANK_FUNC f, 
                      const struct variable *src_var, 
                      const char *vname)
 {
@@ -676,14 +681,14 @@
   char name[SHORT_NAME_LEN + 1];
 
   if ( vname ) 
-    var = dict_create_var(dataset_dict (current_dataset), vname, 0);
+    var = dict_create_var(dict, vname, 0);
 
   if ( NULL == var )
     {
       snprintf(name, SHORT_NAME_LEN + 1, "%c%s", 
               function_name[f][0], src_var->name);
   
-      var = dict_create_var(dataset_dict (current_dataset), name, 0);
+      var = dict_create_var(dict, name, 0);
     }
 
   i = 1;
@@ -694,7 +699,7 @@
       snprintf(name, SHORT_NAME_LEN + 1, "%s%03d", func_abb, 
               i);
 
-      var = dict_create_var(dataset_dict (current_dataset), name, 0);
+      var = dict_create_var(dict, name, 0);
       if (i++ >= 999) 
        break;
     }
@@ -708,7 +713,7 @@
       snprintf(name, SHORT_NAME_LEN + 1, 
               "RNK%s%02d", func_abb, i);
 
-      var = dict_create_var(dataset_dict (current_dataset), name, 0);
+      var = dict_create_var(dict, name, 0);
       if ( i++ >= 99 ) 
        break;
     }
@@ -724,7 +729,7 @@
   return var;
 }
 
-int cmd_rank(void);
+int cmd_rank(struct dataset *ds);
 
 static void
 rank_cleanup(void)
@@ -753,14 +758,14 @@
 }
 
 int
-cmd_rank(void)
+cmd_rank (struct dataset *ds)
 {
   bool result;
   struct variable *order;
   size_t i;
   n_rank_specs = 0;
 
-  if ( !parse_rank(&cmd, NULL) )
+  if ( !parse_rank (ds, &cmd, NULL) )
     {
       rank_cleanup ();
     return CMD_FAILURE;
@@ -802,7 +807,7 @@
          if ( rank_specs[i].destvars[v] == NULL ) 
            {
              rank_specs[i].destvars[v] = 
-               create_rank_variable (rank_specs[i].rfunc, src_vars[v], NULL);
+               create_rank_variable (dataset_dict(ds), rank_specs[i].rfunc, 
src_vars[v], NULL);
            }
       
          create_var_label ( rank_specs[i].destvars[v],
@@ -891,12 +896,12 @@
 
   /* Add a variable which we can sort by to get back the original
      order */
-  order = dict_create_var_assert (dataset_dict (current_dataset), "$ORDER_", 
0);
+  order = dict_create_var_assert (dataset_dict (ds), "$ORDER_", 0);
 
-  add_transformation (current_dataset, create_resort_key, 0, order);
+  add_transformation (ds, create_resort_key, 0, order);
 
   /* Do the ranking */
-  result = rank_cmd (sc, rank_specs, n_rank_specs);
+  result = rank_cmd (ds, sc, rank_specs, n_rank_specs);
 
   /* Put the active file back in its original order */
   {
@@ -909,11 +914,11 @@
     criteria.crits = &restore_criterion;
     criteria.crit_cnt = 1;
     
-    sort_active_file_in_place (&criteria);
+    sort_active_file_in_place (ds, &criteria);
 }
 
   /* ... and we don't need our sort key anymore. So delete it */
-  dict_delete_var (dataset_dict (current_dataset), order);
+  dict_delete_var (dataset_dict (ds), order);
 
   rank_cleanup();
 
@@ -924,27 +929,27 @@
 /* Parser for the variables sub command  
    Returns 1 on success */
 static int
-rank_custom_variables(struct cmd_rank *cmd UNUSED, void *aux UNUSED)
+rank_custom_variables (struct dataset *ds, struct cmd_rank *cmd UNUSED, void 
*aux UNUSED)
 {
   static const int terminators[2] = {T_BY, 0};
 
   lex_match('=');
 
-  if ((token != T_ID || dict_lookup_var (dataset_dict (current_dataset), 
tokid) == NULL)
+  if ((token != T_ID || dict_lookup_var (dataset_dict (ds), tokid) == NULL)
       && token != T_ALL)
       return 2;
 
-  sc = sort_parse_criteria (dataset_dict (current_dataset), 
+  sc = sort_parse_criteria (dataset_dict (ds), 
                            &src_vars, &n_src_vars, 0, terminators);
 
   if ( lex_match(T_BY)  )
     {
-      if ((token != T_ID || dict_lookup_var (dataset_dict (current_dataset), 
tokid) == NULL))
+      if ((token != T_ID || dict_lookup_var (dataset_dict (ds), tokid) == 
NULL))
        {
          return 2;
        }
 
-      if (!parse_variables (dataset_dict (current_dataset), &group_vars, 
&n_group_vars,
+      if (!parse_variables (dataset_dict (ds), &group_vars, &n_group_vars,
                            PV_NO_DUPLICATE | PV_NUMERIC | PV_NO_SCRATCH) )
        {
          free (group_vars);
@@ -958,7 +963,7 @@
 
 /* Parse the [/rank INTO var1 var2 ... varN ] clause */
 static int
-parse_rank_function(struct cmd_rank *cmd UNUSED, enum RANK_FUNC f)
+parse_rank_function(struct dictionary *dict, struct cmd_rank *cmd UNUSED, enum 
RANK_FUNC f)
 {
   int var_count = 0;
   
@@ -977,7 +982,7 @@
       while( token == T_ID ) 
        {
 
-         if ( dict_lookup_var (dataset_dict (current_dataset), tokid) != NULL )
+         if ( dict_lookup_var (dict, tokid) != NULL )
            {
              msg(SE, _("Variable %s already exists."), tokid);
              return 0;
@@ -988,7 +993,7 @@
              return 0;
            }
 
-         destvar = create_rank_variable (f, src_vars[var_count], tokid);
+         destvar = create_rank_variable (dict, f, src_vars[var_count], tokid);
          rank_specs[n_rank_specs - 1].destvars[var_count] = destvar ;
 
          lex_get();
@@ -1001,51 +1006,67 @@
 
 
 static int
-rank_custom_rank(struct cmd_rank *cmd, void *aux UNUSED )
+rank_custom_rank(struct dataset *ds, struct cmd_rank *cmd, void *aux UNUSED )
 {
-  return parse_rank_function(cmd, RANK);
+  struct dictionary *dict = dataset_dict (ds);
+
+  return parse_rank_function (dict, cmd, RANK);
 }
 
 static int
-rank_custom_normal(struct cmd_rank *cmd, void *aux UNUSED )
+rank_custom_normal(struct dataset *ds, struct cmd_rank *cmd, void *aux UNUSED )
 {
-  return parse_rank_function(cmd, NORMAL);
+  struct  dictionary *dict = dataset_dict (ds);
+
+  return parse_rank_function (dict, cmd, NORMAL);
 }
 
 static int
-rank_custom_percent(struct cmd_rank *cmd, void *aux UNUSED )
+rank_custom_percent(struct dataset *ds, struct cmd_rank *cmd, void *aux UNUSED 
)
 {
-  return parse_rank_function (cmd, PERCENT);
+  struct dictionary *dict = dataset_dict (ds);
+
+  return parse_rank_function (dict, cmd, PERCENT);
 }
 
 static int
-rank_custom_rfraction(struct cmd_rank *cmd, void *aux UNUSED )
+rank_custom_rfraction(struct dataset *ds, struct cmd_rank *cmd, void *aux 
UNUSED )
 {
-  return parse_rank_function(cmd, RFRACTION);
+  struct dictionary *dict = dataset_dict (ds);
+
+  return parse_rank_function (dict, cmd, RFRACTION);
 }
 
 static int
-rank_custom_proportion(struct cmd_rank *cmd, void *aux UNUSED )
+rank_custom_proportion(struct dataset *ds, struct cmd_rank *cmd, void *aux 
UNUSED )
 {
-  return parse_rank_function(cmd, PROPORTION);
+  struct dictionary *dict = dataset_dict (ds);
+
+  return parse_rank_function (dict, cmd, PROPORTION);
 }
 
 static int
-rank_custom_n(struct cmd_rank *cmd, void *aux UNUSED )
+rank_custom_n (struct dataset *ds, struct cmd_rank *cmd, void *aux UNUSED )
 {
-  return parse_rank_function(cmd, N);
+  struct dictionary *dict = dataset_dict (ds);
+
+  return parse_rank_function (dict, cmd, N);
 }
 
 static int
-rank_custom_savage(struct cmd_rank *cmd, void *aux UNUSED )
+rank_custom_savage(struct dataset *ds, struct cmd_rank *cmd, void *aux UNUSED )
 {
-  return parse_rank_function(cmd, SAVAGE);
+  struct dictionary *dict = dataset_dict (ds);
+
+  return parse_rank_function (dict, cmd, SAVAGE);
 }
 
 
 static int
-rank_custom_ntiles(struct cmd_rank *cmd, void *aux UNUSED )
+rank_custom_ntiles (struct dataset *ds, struct cmd_rank *cmd, void *aux UNUSED 
)
 {
+  struct dictionary *dict = dataset_dict (ds);
+
   if ( lex_force_match('(') ) 
     {
       if ( lex_force_int() ) 
@@ -1060,5 +1081,5 @@
   else
     return 0;
 
-  return parse_rank_function(cmd, NTILES);
+  return parse_rank_function(dict, cmd, NTILES);
 }

Index: src/language/stats/regression.q
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/regression.q,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- src/language/stats/regression.q     20 Oct 2006 19:33:52 -0000      1.34
+++ src/language/stats/regression.q     26 Oct 2006 06:16:36 -0000      1.35
@@ -118,7 +118,8 @@
 static int pspp_reg_rc = CMD_SUCCESS;
 
 static bool run_regression (const struct ccase *,
-                           const struct casefile *, void *);
+                           const struct casefile *, void *, 
+                           const struct dataset *);
 
 /* 
    STATISTICS subcommand output functions.
@@ -621,32 +622,35 @@
 }
 
 /* 
-   Returns 0 if NAME is a duplicate of any existing variable name.
+   Returns false if NAME is a duplicate of any existing variable name.
 */
-static int
-try_name (char *name)
+static bool
+try_name (const struct dictionary *dict, const char *name)
 {
-  if (dict_lookup_var (dataset_dict (current_dataset), name) != NULL)
-    return 0;
+  if (dict_lookup_var (dict, name) != NULL)
+    return false;
 
-  return 1;
+  return true;
 }
+
 static void
-reg_get_name (char name[LONG_NAME_LEN], const char prefix[LONG_NAME_LEN])
+reg_get_name (const struct dictionary *dict, char name[LONG_NAME_LEN], const 
char prefix[LONG_NAME_LEN])
 {
   int i = 1;
 
   snprintf (name, LONG_NAME_LEN, "%s%d", prefix, i);
-  while (!try_name (name))
+  while (!try_name (dict, name))
     {
       i++;
       snprintf (name, LONG_NAME_LEN, "%s%d", prefix, i);
     }
 }
+
 static void
-reg_save_var (const char *prefix, trns_proc_func * f,
+reg_save_var (struct dataset *ds, const char *prefix, trns_proc_func * f,
              pspp_linreg_cache * c, struct variable **v, int n_trns)
 {
+  struct dictionary *dict = dataset_dict (ds);
   static int trns_index = 1;
   char name[LONG_NAME_LEN];
   struct variable *new_var;
@@ -656,15 +660,16 @@
   t->trns_id = trns_index;
   t->n_trns = n_trns;
   t->c = c;
-  reg_get_name (name, prefix);
-  new_var = dict_create_var (dataset_dict (current_dataset), name, 0);
+  reg_get_name (dict, name, prefix);
+  new_var = dict_create_var (dict, name, 0);
   assert (new_var != NULL);
   *v = new_var;
-  add_transformation (current_dataset, f, regression_trns_free, t);
+  add_transformation (ds, f, regression_trns_free, t);
   trns_index++;
 }
+
 static void
-subcommand_save (int save, pspp_linreg_cache ** models)
+subcommand_save (struct dataset *ds, int save, pspp_linreg_cache ** models)
 {
   pspp_linreg_cache **lc;
   int n_trns = 0;
@@ -690,12 +695,12 @@
          assert ((*lc)->depvar != NULL);
          if (cmd.a_save[REGRESSION_SV_RESID])
            {
-             reg_save_var ("RES", regression_trns_resid_proc, *lc,
+             reg_save_var (ds, "RES", regression_trns_resid_proc, *lc,
                            &(*lc)->resid, n_trns);
            }
          if (cmd.a_save[REGRESSION_SV_PRED])
            {
-             reg_save_var ("PRED", regression_trns_pred_proc, *lc,
+             reg_save_var (ds, "PRED", regression_trns_pred_proc, *lc,
                            &(*lc)->pred, n_trns);
            }
        }
@@ -709,6 +714,7 @@
        }
     }
 }
+
 static int
 reg_inserted (const struct variable *v, struct variable **varlist, int n_vars)
 {
@@ -723,6 +729,7 @@
     }
   return 0;
 }
+
 static void
 reg_print_categorical_encoding (FILE * fp, pspp_linreg_cache * c)
 {
@@ -907,8 +914,9 @@
       fclose (fp);
     }
 }
+
 static int
-regression_custom_export (struct cmd_regression *cmd UNUSED, void *aux UNUSED)
+regression_custom_export (struct dataset *ds UNUSED, struct cmd_regression 
*cmd UNUSED, void *aux UNUSED)
 {
   /* 0 on failure, 1 on success, 2 on failure that should result in syntax 
error */
   if (!lex_force_match ('('))
@@ -930,15 +938,15 @@
 }
 
 int
-cmd_regression (void)
+cmd_regression (struct dataset *ds)
 {
-  if (!parse_regression (&cmd, NULL))
+  if (!parse_regression (ds, &cmd, NULL))
     return CMD_FAILURE;
 
   models = xnmalloc (cmd.n_dependent, sizeof *models);
-  if (!multipass_procedure_with_splits (current_dataset, run_regression, &cmd))
+  if (!multipass_procedure_with_splits (ds, run_regression, &cmd))
     return CMD_CASCADING_FAILURE;
-  subcommand_save (cmd.sbc_save, models);
+  subcommand_save (ds, cmd.sbc_save, models);
   free (v_variables);
   free (models);
   return pspp_reg_rc;
@@ -996,18 +1004,20 @@
 
 /* Parser for the variables sub command */
 static int
-regression_custom_variables (struct cmd_regression *cmd UNUSED,
+regression_custom_variables (struct dataset *ds, 
+                            struct cmd_regression *cmd UNUSED,
                             void *aux UNUSED)
 {
+  const struct dictionary *dict = dataset_dict (ds);
 
   lex_match ('=');
 
-  if ((token != T_ID || dict_lookup_var (dataset_dict (current_dataset), 
tokid) == NULL)
+  if ((token != T_ID || dict_lookup_var (dict, tokid) == NULL)
       && token != T_ALL)
     return 2;
 
 
-  if (!parse_variables (dataset_dict (current_dataset), &v_variables, 
&n_variables, PV_NONE))
+  if (!parse_variables (dict, &v_variables, &n_variables, PV_NONE))
     {
       free (v_variables);
       return 0;
@@ -1089,7 +1099,7 @@
 
 static bool
 run_regression (const struct ccase *first,
-               const struct casefile *cf, void *cmd_ UNUSED)
+               const struct casefile *cf, void *cmd_ UNUSED, const struct 
dataset *ds)
 {
   size_t i;
   size_t n_data = 0;           /* Number of valide cases. */
@@ -1113,11 +1123,11 @@
 
   assert (models != NULL);
 
-  output_split_file_values (first);
+  output_split_file_values (ds, first);
 
   if (!v_variables)
     {
-      dict_get_vars (dataset_dict (current_dataset), &v_variables, 
&n_variables,
+      dict_get_vars (dataset_dict (ds), &v_variables, &n_variables,
                     1u << DC_SYSTEM);
     }
 

Index: src/language/stats/sort-cases.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/sort-cases.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- src/language/stats/sort-cases.c     19 Oct 2006 15:04:53 -0000      1.5
+++ src/language/stats/sort-cases.c     26 Oct 2006 06:16:36 -0000      1.6
@@ -40,14 +40,14 @@
 
 /* Performs the SORT CASES procedures. */
 int
-cmd_sort_cases (void)
+cmd_sort_cases (struct dataset *ds)
 {
   struct sort_criteria *criteria;
   bool success = false;
 
   lex_match (T_BY);
 
-  criteria = sort_parse_criteria (dataset_dict (current_dataset), NULL, NULL, 
NULL, NULL);
+  criteria = sort_parse_criteria (dataset_dict (ds), NULL, NULL, NULL, NULL);
   if (criteria == NULL)
     return CMD_CASCADING_FAILURE;
 
@@ -68,7 +68,7 @@
       lex_get ();
     }
 
-  success = sort_active_file_in_place (criteria);
+  success = sort_active_file_in_place (ds, criteria);
 
  done:
   min_buffers = 64;

Index: src/language/stats/t-test.q
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/t-test.q,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- src/language/stats/t-test.q 19 Oct 2006 15:04:53 -0000      1.12
+++ src/language/stats/t-test.q 26 Oct 2006 06:16:36 -0000      1.13
@@ -218,25 +218,27 @@
 };
 
 
-static int common_calc (const struct ccase *, void *);
+static int common_calc (const struct dictionary *dict, 
+                       const struct ccase *, void *);
 static void common_precalc (struct cmd_t_test *);
 static void common_postcalc (struct cmd_t_test *);
 
-static int one_sample_calc (const struct ccase *, void *);
+static int one_sample_calc (const struct dictionary *dict, const struct ccase 
*, void *);
 static void one_sample_precalc (struct cmd_t_test *);
 static void one_sample_postcalc (struct cmd_t_test *);
 
-static int  paired_calc (const struct ccase *, void *);
+static int  paired_calc (const struct dictionary *dict, const struct ccase *, 
void *);
 static void paired_precalc (struct cmd_t_test *);
 static void paired_postcalc (struct cmd_t_test *);
 
 static void group_precalc (struct cmd_t_test *);
-static int  group_calc (const struct ccase *, struct cmd_t_test *);
+static int  group_calc (const struct dictionary *dict, const struct ccase *, 
struct cmd_t_test *);
 static void group_postcalc (struct cmd_t_test *);
 
 
 static bool calculate(const struct ccase *first,
-                      const struct casefile *cf, void *_mode);
+                      const struct casefile *cf, void *_mode, 
+                     const struct dataset *ds);
 
 static  int mode;
 
@@ -256,11 +258,11 @@
 
 
 int
-cmd_t_test(void)
+cmd_t_test (struct dataset *ds)
 {
   bool ok;
   
-  if ( !parse_t_test(&cmd, NULL) )
+  if ( !parse_t_test (ds, &cmd, NULL) )
     return CMD_FAILURE;
 
   if (! cmd.sbc_criteria)
@@ -345,7 +347,7 @@
 
   bad_weight_warn = true;
 
-  ok = multipass_procedure_with_splits (current_dataset, calculate, &cmd);
+  ok = multipass_procedure_with_splits (ds, calculate, &cmd);
 
   n_pairs=0;
   free(pairs);
@@ -367,13 +369,13 @@
 }
 
 static int
-tts_custom_groups (struct cmd_t_test *cmd UNUSED, void *aux UNUSED)
+tts_custom_groups (struct dataset *ds, struct cmd_t_test *cmd UNUSED, void 
*aux UNUSED)
 {
   int n_group_values=0;
 
   lex_match('=');
 
-  indep_var = parse_variable ();
+  indep_var = parse_variable (dataset_dict (ds));
   if (!indep_var)
     {
       lex_error ("expecting variable name in GROUPS subcommand");
@@ -446,7 +448,7 @@
 
 
 static int
-tts_custom_pairs (struct cmd_t_test *cmd UNUSED, void *aux UNUSED)
+tts_custom_pairs (struct dataset *ds, struct cmd_t_test *cmd UNUSED, void *aux 
UNUSED)
 {
   struct variable **vars;
   size_t n_vars;
@@ -459,7 +461,7 @@
   lex_match('=');
 
   n_vars=0;
-  if (!parse_variables (dataset_dict (current_dataset), &vars, &n_vars,
+  if (!parse_variables (dataset_dict (ds), &vars, &n_vars,
                        PV_DUPLICATE | PV_NUMERIC | PV_NO_SCRATCH))
     {
       free (vars);
@@ -471,7 +473,7 @@
   if (lex_match (T_WITH))
     {
       n_before_WITH = n_vars;
-      if (!parse_variables (dataset_dict (current_dataset), &vars, &n_vars,
+      if (!parse_variables (dataset_dict (ds), &vars, &n_vars,
                            PV_DUPLICATE | PV_APPEND
                            | PV_NUMERIC | PV_NO_SCRATCH))
        {
@@ -1411,12 +1413,12 @@
 
 /* Per case calculations common to all variants of the T test */
 static int 
-common_calc (const struct ccase *c, void *_cmd)
+common_calc (const struct dictionary *dict, const struct ccase *c, void *_cmd)
 {
   int i;
   struct cmd_t_test *cmd = (struct cmd_t_test *)_cmd;  
 
-  double weight = dict_get_case_weight (dataset_dict (current_dataset), c, 
&bad_weight_warn);
+  double weight = dict_get_case_weight (dict, c, &bad_weight_warn);
 
 
   /* Skip the entire case if /MISSING=LISTWISE is set */
@@ -1510,13 +1512,14 @@
 
 /* Per case calculations for one sample t test  */
 static int 
-one_sample_calc (const struct ccase *c, void *cmd_)
+one_sample_calc (const struct dictionary *dict, 
+                const struct ccase *c, void *cmd_)
 {
   int i;
   struct cmd_t_test *cmd = (struct cmd_t_test *)cmd_;
 
 
-  double weight = dict_get_case_weight (dataset_dict (current_dataset), c, 
&bad_weight_warn);
+  double weight = dict_get_case_weight (dict, c, &bad_weight_warn);
 
   /* Skip the entire case if /MISSING=LISTWISE is set */
   if ( cmd->miss == TTS_LISTWISE ) 
@@ -1600,13 +1603,13 @@
 
 
 static int  
-paired_calc (const struct ccase *c, void *cmd_)
+paired_calc (const struct dictionary *dict, const struct ccase *c, void *cmd_)
 {
   int i;
 
   struct cmd_t_test *cmd  = (struct cmd_t_test *) cmd_;
 
-  double weight = dict_get_case_weight (dataset_dict (current_dataset), c, 
&bad_weight_warn);
+  double weight = dict_get_case_weight (dict, c, &bad_weight_warn);
 
   /* Skip the entire case if /MISSING=LISTWISE is set , 
    AND one member of a pair is missing */
@@ -1745,14 +1748,15 @@
 }
 
 static int  
-group_calc (const struct ccase *c, struct cmd_t_test *cmd)
+group_calc (const struct dictionary *dict, 
+           const struct ccase *c, struct cmd_t_test *cmd)
 {
   int i;
 
   const union value *gv = case_data (c, indep_var->fv);
 
   const double weight = 
-    dict_get_case_weight (dataset_dict (current_dataset), c, &bad_weight_warn);
+    dict_get_case_weight (dict, c, &bad_weight_warn);
 
   if ( value_is_missing(&indep_var->miss, gv) )
     {
@@ -1839,8 +1843,10 @@
 
 
 static bool
-calculate(const struct ccase *first, const struct casefile *cf, void *cmd_)
+calculate(const struct ccase *first, const struct casefile *cf, 
+         void *cmd_, const struct dataset *ds)
 {
+  const struct dictionary *dict = dataset_dict (ds);
   struct ssbox stat_summary_box;
   struct trbox test_results_box;
 
@@ -1849,13 +1855,13 @@
 
   struct cmd_t_test *cmd = (struct cmd_t_test *) cmd_;
 
-  output_split_file_values (first);
+  output_split_file_values (ds, first);
   common_precalc(cmd);
   for(r = casefile_get_reader (cf);
       casereader_read (r, &c) ;
       case_destroy (&c)) 
     {
-      common_calc(&c,cmd);
+      common_calc(dict, &c,cmd);
     }
   casereader_destroy (r);
   common_postcalc(cmd);
@@ -1868,7 +1874,7 @@
          casereader_read (r, &c) ;
           case_destroy (&c)) 
        {
-         one_sample_calc(&c,cmd);
+         one_sample_calc (dict, &c,cmd);
        }
       casereader_destroy (r);
       one_sample_postcalc(cmd);
@@ -1880,10 +1886,10 @@
          casereader_read (r, &c) ;
           case_destroy (&c)) 
        {
-         paired_calc(&c,cmd);
+         paired_calc (dict, &c,cmd);
        }
       casereader_destroy (r);
-      paired_postcalc(cmd);
+      paired_postcalc (cmd);
 
       break;
     case T_IND_SAMPLES:
@@ -1893,12 +1899,12 @@
          casereader_read (r, &c) ;
           case_destroy (&c)) 
        {
-         group_calc(&c,cmd);
+         group_calc (dict, &c, cmd);
        }
       casereader_destroy (r);
       group_postcalc(cmd);
 
-      levene(cf, indep_var, cmd->n_variables, cmd->v_variables,
+      levene (dict, cf, indep_var, cmd->n_variables, cmd->v_variables,
             (cmd->miss == TTS_LISTWISE)?LEV_LISTWISE:LEV_ANALYSIS ,
             value_is_missing);
       break;

Index: src/language/tests/casefile-test.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/tests/casefile-test.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- src/language/tests/casefile-test.c  14 Oct 2006 23:23:17 -0000      1.6
+++ src/language/tests/casefile-test.c  26 Oct 2006 06:16:36 -0000      1.7
@@ -45,7 +45,7 @@
 static void fail_test (const char *message, ...);
 
 int
-cmd_debug_casefile (void) 
+cmd_debug_casefile (struct dataset *ds UNUSED) 
 {
   static const size_t sizes[] =
     {

Index: src/language/tests/moments-test.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/tests/moments-test.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- src/language/tests/moments-test.c   14 Oct 2006 00:25:21 -0000      1.5
+++ src/language/tests/moments-test.c   26 Oct 2006 06:16:36 -0000      1.6
@@ -26,6 +26,7 @@
 #include <math.h>
 #include <stdlib.h>
 #include "xalloc.h"
+#include <libpspp/compiler.h>
 
 #define _(msgid) gettext (msgid)
 
@@ -69,7 +70,7 @@
 }
 
 int
-cmd_debug_moments (void) 
+cmd_debug_moments (struct dataset *ds UNUSED) 
 {
   int retval = CMD_FAILURE;
   double *values = NULL;

Index: src/language/tests/pool-test.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/tests/pool-test.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- src/language/tests/pool-test.c      15 Mar 2006 03:29:11 -0000      1.2
+++ src/language/tests/pool-test.c      26 Oct 2006 06:16:36 -0000      1.3
@@ -32,7 +32,7 @@
 /* Self-test routine.
    This is not exhaustive, but it can be useful. */
 int
-cmd_debug_pool (void)
+cmd_debug_pool (struct dataset *ds UNUSED)
 {
   int seed = time (0) * 257 % 32768;
 

Index: src/language/utilities/date.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/utilities/date.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- src/language/utilities/date.c       15 Mar 2006 03:29:11 -0000      1.2
+++ src/language/utilities/date.c       26 Oct 2006 06:16:36 -0000      1.3
@@ -27,7 +27,7 @@
 
 /* Stub for USE command. */
 int
-cmd_use (void) 
+cmd_use (struct dataset *ds UNUSED) 
 {
   if (lex_match (T_ALL))
     return lex_end_of_command ();

Index: src/language/utilities/echo.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/utilities/echo.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- src/language/utilities/echo.c       9 Jun 2006 22:51:24 -0000       1.3
+++ src/language/utilities/echo.c       26 Oct 2006 06:16:36 -0000      1.4
@@ -29,7 +29,7 @@
 
 /* Echos a string to the output stream */
 int
-cmd_echo(void)
+cmd_echo (struct dataset *ds UNUSED)
 {
   struct tab_table *tab;
 

Index: src/language/utilities/include.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/utilities/include.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- src/language/utilities/include.c    9 Jun 2006 22:51:24 -0000       1.4
+++ src/language/utilities/include.c    26 Oct 2006 06:16:36 -0000      1.5
@@ -31,7 +31,7 @@
 #define _(msgid) gettext (msgid)
 
 int
-cmd_include (void)
+cmd_include (struct dataset *ds UNUSED)
 {
   /* Skip optional FILE=. */
   if (lex_match_id ("FILE"))

Index: src/language/utilities/permissions.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/utilities/permissions.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- src/language/utilities/permissions.c        9 Jun 2006 22:51:24 -0000       
1.5
+++ src/language/utilities/permissions.c        26 Oct 2006 06:16:36 -0000      
1.6
@@ -42,7 +42,7 @@
 
 /* Parses the PERMISSIONS command. */
 int
-cmd_permissions (void)
+cmd_permissions (struct dataset *ds UNUSED)
 {
   char  *fn = 0;
 

Index: src/language/utilities/set.q
===================================================================
RCS file: /sources/pspp/pspp/src/language/utilities/set.q,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- src/language/utilities/set.q        25 Oct 2006 22:28:13 -0000      1.13
+++ src/language/utilities/set.q        26 Oct 2006 06:16:36 -0000      1.14
@@ -120,12 +120,12 @@
 static bool do_cc (const char *cc_string, int idx);
 
 int
-cmd_set (void)
+cmd_set (struct dataset *ds)
 {
   struct cmd_set cmd;
   bool ok = true;
 
-  if (!parse_set (&cmd, NULL))
+  if (!parse_set (ds, &cmd, NULL))
     return CMD_FAILURE;
 
   if (cmd.sbc_cca)
@@ -289,7 +289,7 @@
    completely blank fields in numeric data imply.  X, Wnd: Syntax is
    SYSMIS or a numeric value. */
 static int
-stc_custom_blanks (struct cmd_set *cmd UNUSED, void *aux UNUSED)
+stc_custom_blanks (struct dataset *ds UNUSED, struct cmd_set *cmd UNUSED, void 
*aux UNUSED)
 {
   lex_match ('=');
   if ((token == T_ID && lex_id_match ("SYSMIS", tokid)))
@@ -310,7 +310,7 @@
 /* Parses the EPOCH subcommand, which controls the epoch used for
    parsing 2-digit years. */
 static int
-stc_custom_epoch (struct cmd_set *cmd UNUSED, void *aux UNUSED) 
+stc_custom_epoch (struct dataset *ds UNUSED, struct cmd_set *cmd UNUSED, void 
*aux UNUSED) 
 {
   lex_match ('=');
   if (lex_match_id ("AUTOMATIC"))
@@ -336,7 +336,7 @@
 }
 
 static int
-stc_custom_length (struct cmd_set *cmd UNUSED, void *aux UNUSED)
+stc_custom_length (struct dataset *ds UNUSED, struct cmd_set *cmd UNUSED, void 
*aux UNUSED)
 {
   int page_length;
 
@@ -363,7 +363,7 @@
 }
 
 static int
-stc_custom_seed (struct cmd_set *cmd UNUSED, void *aux UNUSED)
+stc_custom_seed (struct dataset *ds UNUSED, struct cmd_set *cmd UNUSED, void 
*aux UNUSED)
 {
   lex_match ('=');
   if (lex_match_id ("RANDOM"))
@@ -380,7 +380,7 @@
 }
 
 static int
-stc_custom_width (struct cmd_set *cmd UNUSED, void *aux UNUSED)
+stc_custom_width (struct dataset *ds UNUSED, struct cmd_set *cmd UNUSED, void 
*aux UNUSED)
 {
   lex_match ('=');
   if (lex_match_id ("NARROW"))
@@ -406,7 +406,7 @@
 /* Parses FORMAT subcommand, which consists of a numeric format
    specifier. */
 static int
-stc_custom_format (struct cmd_set *cmd UNUSED, void *aux UNUSED)
+stc_custom_format (struct dataset *ds UNUSED, struct cmd_set *cmd UNUSED, void 
*aux UNUSED)
 {
   struct fmt_spec fmt;
 
@@ -426,7 +426,7 @@
 }
 
 static int
-stc_custom_journal (struct cmd_set *cmd UNUSED, void *aux UNUSED)
+stc_custom_journal (struct dataset *ds UNUSED, struct cmd_set *cmd UNUSED, 
void *aux UNUSED)
 {
   lex_match ('=');
   if (!lex_match_id ("ON") && !lex_match_id ("OFF")) 
@@ -443,7 +443,7 @@
 }
 
 static int
-stc_custom_listing (struct cmd_set *cmd UNUSED, void *aux UNUSED)
+stc_custom_listing (struct dataset *ds UNUSED, struct cmd_set *cmd UNUSED, 
void *aux UNUSED)
 {
   bool listing;
 
@@ -463,13 +463,13 @@
 }
 
 static int
-stc_custom_disk (struct cmd_set *cmd UNUSED, void *aux)
+stc_custom_disk (struct dataset *ds, struct cmd_set *cmd UNUSED, void *aux)
 {
-  return stc_custom_listing (cmd, aux);
+  return stc_custom_listing (ds, cmd, aux);
 }
 
 static void
-show_blanks (void) 
+show_blanks (const struct dataset *ds UNUSED) 
 {
   if (get_blanks () == SYSMIS)
     msg (SN, _("BLANKS is SYSMIS."));
@@ -511,79 +511,79 @@
 
 
 static void
-show_cca (void) 
+show_cca (const struct dataset *ds UNUSED) 
 {
   show_cc (0);
 }
 
 static void
-show_ccb (void) 
+show_ccb (const struct dataset *ds UNUSED) 
 {
   show_cc (1);
 }
 
 static void
-show_ccc (void) 
+show_ccc (const struct dataset *ds UNUSED) 
 {
   show_cc (2);
 }
 
 static void
-show_ccd (void) 
+show_ccd (const struct dataset *ds UNUSED) 
 {
   show_cc (3);
 }
 
 static void
-show_cce (void) 
+show_cce (const struct dataset *ds UNUSED) 
 {
   show_cc (4);
 }
 
 static void
-show_decimals (void) 
+show_decimals (const struct dataset *ds UNUSED) 
 {
   msg (SN, _("DECIMAL is \"%c\"."), get_decimal ());
 }
 
 static void
-show_endcmd (void) 
+show_endcmd (const struct dataset *ds UNUSED) 
 {
   msg (SN, _("ENDCMD is \"%c\"."), get_endcmd ());
 }
 
 static void
-show_format (void) 
+show_format (const struct dataset *ds UNUSED) 
 {
   msg (SN, _("FORMAT is %s."), fmt_to_string (get_format ()));
 }
 
 static void
-show_length (void) 
+show_length (const struct dataset *ds UNUSED) 
 {
   msg (SN, _("LENGTH is %d."), get_viewlength ());
 }
 
 static void
-show_mxerrs (void) 
+show_mxerrs (const struct dataset *ds UNUSED) 
 {
   msg (SN, _("MXERRS is %d."), get_mxerrs ());
 }
 
 static void
-show_mxloops (void) 
+show_mxloops (const struct dataset *ds UNUSED) 
 {
   msg (SN, _("MXLOOPS is %d."), get_mxloops ());
 }
 
 static void
-show_mxwarns (void) 
+show_mxwarns (const struct dataset *ds UNUSED) 
 {
   msg (SN, _("MXWARNS is %d."), get_mxwarns ());
 }
 
 static void
-show_scompression (void) 
+show_scompression (const struct dataset *ds UNUSED) 
 {
   if (get_scompression ())
     msg (SN, _("SCOMPRESSION is ON."));
@@ -592,7 +592,7 @@
 }
 
 static void
-show_undefined (void) 
+show_undefined (const struct dataset *ds UNUSED) 
 {
   if (get_undefined ())
     msg (SN, _("UNDEFINED is WARN."));
@@ -601,9 +601,9 @@
 }
 
 static void
-show_weight (void) 
+show_weight (const struct dataset *ds) 
 {
-  struct variable *var = dict_get_weight (dataset_dict (current_dataset));
+  struct variable *var = dict_get_weight (dataset_dict (ds));
   if (var == NULL)
     msg (SN, _("WEIGHT is off."));
   else
@@ -611,7 +611,7 @@
 }
 
 static void
-show_width (void) 
+show_width (const struct dataset *ds UNUSED) 
 {
   msg (SN, _("WIDTH is %d."), get_viewwidth ());
 }
@@ -619,7 +619,7 @@
 struct show_sbc 
   {
     const char *name;
-    void (*function) (void);
+    void (*function) (const struct dataset *);
   };
 
 const struct show_sbc show_table[] = 
@@ -644,12 +644,12 @@
   };
 
 static void
-show_all (void) 
+show_all (const struct dataset *ds) 
 {
   size_t i;
   
   for (i = 0; i < sizeof show_table / sizeof *show_table; i++)
-    show_table[i].function ();
+    show_table[i].function (ds);
 }
 
 static void
@@ -662,36 +662,36 @@
 }
 
 static void
-show_warranty (void) 
+show_warranty (const struct dataset *ds UNUSED) 
 {
   msg (MN, lack_of_warranty);
 }
 
 static void
-show_copying (void) 
+show_copying (const struct dataset *ds UNUSED) 
 {
   msg (MN, copyleft);
 }
 
 int
-cmd_show (void) 
+cmd_show (struct dataset *ds) 
 {
   if (token == '.') 
     {
-      show_all ();
+      show_all (ds);
       return CMD_SUCCESS;
     }
 
   do 
     {
       if (lex_match (T_ALL))
-        show_all ();
+        show_all (ds);
       else if (lex_match_id ("CC")) 
         show_all_cc ();
       else if (lex_match_id ("WARRANTY"))
-        show_warranty ();
+        show_warranty (ds);
       else if (lex_match_id ("COPYING"))
-        show_copying ();
+        show_copying (ds);
       else if (token == T_ID)
         {
           int i;
@@ -699,7 +699,7 @@
           for (i = 0; i < sizeof show_table / sizeof *show_table; i++)
             if (lex_match_id (show_table[i].name)) 
               {
-                show_table[i].function ();
+                show_table[i].function (ds);
                 goto found;
               }
           lex_error (NULL);

Index: src/language/utilities/title.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/utilities/title.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- src/language/utilities/title.c      19 Oct 2006 15:04:53 -0000      1.6
+++ src/language/utilities/title.c      26 Oct 2006 06:16:36 -0000      1.7
@@ -39,13 +39,13 @@
 static int get_title (const char *cmd, char **title);
 
 int
-cmd_title (void)
+cmd_title (struct dataset *ds UNUSED)
 {
   return get_title ("TITLE", &outp_title);
 }
 
 int
-cmd_subtitle (void)
+cmd_subtitle (struct dataset *ds UNUSED)
 {
   return get_title ("SUBTITLE", &outp_subtitle);
 }
@@ -88,7 +88,7 @@
 
 /* Performs the FILE LABEL command. */
 int
-cmd_file_label (void)
+cmd_file_label (struct dataset *ds)
 {
   const char *label;
 
@@ -97,22 +97,22 @@
   while (isspace ((unsigned char) *label))
     label++;
 
-  dict_set_label (dataset_dict (current_dataset), label);
+  dict_set_label (dataset_dict (ds), label);
   token = '.';
 
   return CMD_SUCCESS;
 }
 
-/* Add LINE as a line of document information to dataset_dict 
(current_dataset),
+/* Add LINE as a line of document information to dictionary
    indented by INDENT spaces. */
 static void
-add_document_line (const char *line, int indent)
+add_document_line (struct dictionary *dict, const char *line, int indent)
 {
   const char *old_documents;
   size_t old_len;
   char *new_documents;
 
-  old_documents = dict_get_documents (dataset_dict (current_dataset));
+  old_documents = dict_get_documents (dict);
   old_len = old_documents != NULL ? strlen (old_documents) : 0;
   new_documents = xmalloc (old_len + 81);
 
@@ -121,24 +121,25 @@
   buf_copy_str_rpad (new_documents + old_len + indent, 80 - indent, line);
   new_documents[old_len + 80] = '\0';
 
-  dict_set_documents (dataset_dict (current_dataset), new_documents);
+  dict_set_documents (dict, new_documents);
 
   free (new_documents);
 }
 
 /* Performs the DOCUMENT command. */
 int
-cmd_document (void)
+cmd_document (struct dataset *ds)
 {
+  struct dictionary *dict = dataset_dict (ds);
   /* Add a few header lines for reference. */
   {
     char buf[256];
 
-    if (dict_get_documents (dataset_dict (current_dataset)) != NULL)
-      add_document_line ("", 0);
+    if (dict && dict_get_documents (dict))
+      add_document_line (dict, "", 0);
 
     sprintf (buf, _("Document entered %s by %s:"), get_start_date (), version);
-    add_document_line (buf, 1);
+    add_document_line (dict, buf, 1);
   }
 
   for (;;)
@@ -157,7 +158,7 @@
       if (had_dot)
         strcat (copy_line, ".");
 
-      add_document_line (copy_line, 3);
+      add_document_line (dict, copy_line, 3);
       free (copy_line);
 
       lex_get_line ();
@@ -171,9 +172,9 @@
 
 /* Performs the DROP DOCUMENTS command. */
 int
-cmd_drop_documents (void)
+cmd_drop_documents (struct dataset *ds)
 {
-  dict_set_documents (dataset_dict (current_dataset), NULL);
+  dict_set_documents (dataset_dict (ds), NULL);
 
   return lex_end_of_command ();
 }

Index: src/language/xforms/compute.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/xforms/compute.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- src/language/xforms/compute.c       19 Oct 2006 15:04:53 -0000      1.8
+++ src/language/xforms/compute.c       26 Oct 2006 06:16:36 -0000      1.9
@@ -43,11 +43,11 @@
 
 /* Target of a COMPUTE or IF assignment, either a variable or a
    vector element. */
-static struct lvalue *lvalue_parse (void);
-static int lvalue_get_type (const struct lvalue *);
+static struct lvalue *lvalue_parse (struct dataset *);
+static int lvalue_get_type (const struct lvalue *, const struct dictionary *);
 static bool lvalue_is_vector (const struct lvalue *);
 static void lvalue_finalize (struct lvalue *,
-                             struct compute_trns *);
+                             struct compute_trns *, struct dictionary *);
 static void lvalue_destroy (struct lvalue *);
 
 /* COMPUTE and IF transformation. */
@@ -69,35 +69,36 @@
     struct expression *rvalue;  /* Rvalue expression. */
   };
 
-static struct expression *parse_rvalue (const struct lvalue *);
+static struct expression *parse_rvalue (const struct lvalue *, struct dataset 
*);
 static struct compute_trns *compute_trns_create (void);
-static trns_proc_func *get_proc_func (const struct lvalue *);
+static trns_proc_func *get_proc_func (const struct lvalue *, const struct 
dictionary *);
 static trns_free_func compute_trns_free;
 
 /* COMPUTE. */
 
 int
-cmd_compute (void)
+cmd_compute (struct dataset *ds)
 {
+  struct dictionary *dict = dataset_dict (ds);
   struct lvalue *lvalue = NULL;
   struct compute_trns *compute = NULL;
 
   compute = compute_trns_create ();
 
-  lvalue = lvalue_parse ();
+  lvalue = lvalue_parse (ds);
   if (lvalue == NULL)
     goto fail;
 
   if (!lex_force_match ('='))
     goto fail;
-  compute->rvalue = parse_rvalue (lvalue);
+  compute->rvalue = parse_rvalue (lvalue, ds);
   if (compute->rvalue == NULL)
     goto fail;
 
-  add_transformation (current_dataset, 
-                     get_proc_func (lvalue), compute_trns_free, compute);
+  add_transformation (ds, get_proc_func (lvalue, dict), 
+                     compute_trns_free, compute);
 
-  lvalue_finalize (lvalue, compute);
+  lvalue_finalize (lvalue, compute, dict);
 
   return lex_end_of_command ();
 
@@ -111,7 +112,7 @@
 
 /* Handle COMPUTE or IF with numeric target variable. */
 static int
-compute_num (void *compute_, struct ccase *c, casenum_t case_num)
+compute_num (void *compute_, struct ccase *c, casenumber case_num)
 {
   struct compute_trns *compute = compute_;
 
@@ -126,7 +127,7 @@
 /* Handle COMPUTE or IF with numeric vector element target
    variable. */
 static int
-compute_num_vec (void *compute_, struct ccase *c, casenum_t case_num)
+compute_num_vec (void *compute_, struct ccase *c, casenumber case_num)
 {
   struct compute_trns *compute = compute_;
 
@@ -158,7 +159,7 @@
 
 /* Handle COMPUTE or IF with string target variable. */
 static int
-compute_str (void *compute_, struct ccase *c, casenum_t case_num)
+compute_str (void *compute_, struct ccase *c, casenumber case_num)
 {
   struct compute_trns *compute = compute_;
 
@@ -173,7 +174,7 @@
 /* Handle COMPUTE or IF with string vector element target
    variable. */
 static int
-compute_str_vec (void *compute_, struct ccase *c, casenum_t case_num)
+compute_str_vec (void *compute_, struct ccase *c, casenumber case_num)
 {
   struct compute_trns *compute = compute_;
 
@@ -212,34 +213,35 @@
 /* IF. */
 
 int
-cmd_if (void)
+cmd_if (struct dataset *ds)
 {
+  struct dictionary *dict = dataset_dict (ds);
   struct compute_trns *compute = NULL;
   struct lvalue *lvalue = NULL;
 
   compute = compute_trns_create ();
 
   /* Test expression. */
-  compute->test = expr_parse (dataset_dict (current_dataset), EXPR_BOOLEAN);
+  compute->test = expr_parse (ds, EXPR_BOOLEAN);
   if (compute->test == NULL)
     goto fail;
 
   /* Lvalue variable. */
-  lvalue = lvalue_parse ();
+  lvalue = lvalue_parse (ds);
   if (lvalue == NULL)
     goto fail;
 
   /* Rvalue expression. */
   if (!lex_force_match ('='))
     goto fail;
-  compute->rvalue = parse_rvalue (lvalue);
+  compute->rvalue = parse_rvalue (lvalue, ds);
   if (compute->rvalue == NULL)
     goto fail;
 
-  add_transformation (current_dataset, 
-                     get_proc_func (lvalue), compute_trns_free, compute);
+  add_transformation (ds, get_proc_func (lvalue, dict), 
+                     compute_trns_free, compute);
 
-  lvalue_finalize (lvalue, compute);
+  lvalue_finalize (lvalue, compute, dict);
 
   return lex_end_of_command ();
 
@@ -252,9 +254,9 @@
 /* Code common to COMPUTE and IF. */
 
 static trns_proc_func *
-get_proc_func (const struct lvalue *lvalue) 
+get_proc_func (const struct lvalue *lvalue, const struct dictionary *dict) 
 {
-  bool is_numeric = lvalue_get_type (lvalue) == NUMERIC;
+  bool is_numeric = lvalue_get_type (lvalue, dict) == NUMERIC;
   bool is_vector = lvalue_is_vector (lvalue);
 
   return (is_numeric
@@ -265,11 +267,12 @@
 /* Parses and returns an rvalue expression of the same type as
    LVALUE, or a null pointer on failure. */
 static struct expression *
-parse_rvalue (const struct lvalue *lvalue)
+parse_rvalue (const struct lvalue *lvalue, struct dataset *ds)
 {
-  bool is_numeric = lvalue_get_type (lvalue) == NUMERIC;
+  const struct dictionary *dict = dataset_dict (ds);
+  bool is_numeric = lvalue_get_type (lvalue, dict) == NUMERIC;
 
-  return expr_parse (dataset_dict (current_dataset), is_numeric ? EXPR_NUMBER 
: EXPR_STRING);
+  return expr_parse (ds, is_numeric ? EXPR_NUMBER : EXPR_STRING);
 }
 
 /* Returns a new struct compute_trns after initializing its fields. */
@@ -312,7 +315,7 @@
 /* Parses the target variable or vector element into a new
    `struct lvalue', which is returned. */
 static struct lvalue *
-lvalue_parse (void) 
+lvalue_parse (struct dataset *ds) 
 {
   struct lvalue *lvalue;
 
@@ -327,7 +330,7 @@
   if (lex_look_ahead () == '(')
     {
       /* Vector. */
-      lvalue->vector = dict_lookup_vector (dataset_dict (current_dataset), 
tokid);
+      lvalue->vector = dict_lookup_vector (dataset_dict (ds), tokid);
       if (lvalue->vector == NULL)
        {
          msg (SE, _("There is no vector named %s."), tokid);
@@ -338,7 +341,7 @@
       lex_get ();
       if (!lex_force_match ('('))
        goto lossage;
-      lvalue->element = expr_parse (dataset_dict (current_dataset), 
EXPR_NUMBER);
+      lvalue->element = expr_parse (ds, EXPR_NUMBER);
       if (lvalue->element == NULL)
         goto lossage;
       if (!lex_force_match (')'))
@@ -360,11 +363,11 @@
 /* Returns the type (NUMERIC or ALPHA) of the target variable or
    vector in LVALUE. */
 static int
-lvalue_get_type (const struct lvalue *lvalue) 
+lvalue_get_type (const struct lvalue *lvalue, const struct dictionary *dict) 
 {
   if (lvalue->vector == NULL) 
     {
-      struct variable *var = dict_lookup_var (dataset_dict (current_dataset), 
lvalue->var_name);
+      struct variable *var = dict_lookup_var (dict, lvalue->var_name);
       if (var == NULL)
         return NUMERIC;
       else
@@ -384,14 +387,15 @@
 /* Finalizes making LVALUE the target of COMPUTE, by creating the
    target variable if necessary and setting fields in COMPUTE. */
 static void
-lvalue_finalize (struct lvalue *lvalue, struct compute_trns *compute) 
+lvalue_finalize (struct lvalue *lvalue, 
+                struct compute_trns *compute, 
+                struct dictionary *dict) 
 {
   if (lvalue->vector == NULL)
     {
-      compute->variable = dict_lookup_var (dataset_dict (current_dataset), 
lvalue->var_name);
+      compute->variable = dict_lookup_var (dict, lvalue->var_name);
       if (compute->variable == NULL)
-         compute->variable = dict_create_var_assert (dataset_dict 
(current_dataset),
-                                                     lvalue->var_name, 0);
+         compute->variable = dict_create_var_assert (dict, lvalue->var_name, 
0);
 
       compute->fv = compute->variable->fv;
       compute->width = compute->variable->width;

Index: src/language/xforms/count.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/xforms/count.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- src/language/xforms/count.c 19 Oct 2006 15:04:53 -0000      1.9
+++ src/language/xforms/count.c 26 Oct 2006 06:16:36 -0000      1.10
@@ -97,7 +97,7 @@
 static bool parse_string_criteria (struct pool *, struct criteria *);
 
 int
-cmd_count (void)
+cmd_count (struct dataset *ds)
 {
   struct dst_var *dv;           /* Destination var being parsed. */
   struct count_trns *trns;      /* Transformation. */
@@ -117,7 +117,7 @@
       /* Get destination variable, or at least its name. */
       if (!lex_force_id ())
        goto fail;
-      dv->var = dict_lookup_var (dataset_dict (current_dataset), tokid);
+      dv->var = dict_lookup_var (dataset_dict (ds), tokid);
       if (dv->var != NULL)
         {
           if (dv->var->type == ALPHA)
@@ -140,7 +140,7 @@
           
          crit->next = NULL;
          crit->vars = NULL;
-         if (!parse_variables (dataset_dict (current_dataset), &crit->vars, 
&crit->var_cnt,
+         if (!parse_variables (dataset_dict (ds), &crit->vars, &crit->var_cnt,
                                 PV_DUPLICATE | PV_SAME_TYPE))
            goto fail;
           pool_register (trns->pool, free, crit->vars);
@@ -176,13 +176,13 @@
       {
        /* It's valid, though motivationally questionable, to count to
           the same dest var more than once. */
-       dv->var = dict_lookup_var (dataset_dict (current_dataset), dv->name);
+       dv->var = dict_lookup_var (dataset_dict (ds), dv->name);
 
        if (dv->var == NULL) 
-          dv->var = dict_create_var_assert (dataset_dict (current_dataset), 
dv->name, 0);
+          dv->var = dict_create_var_assert (dataset_dict (ds), dv->name, 0);
       }
 
-  add_transformation (current_dataset, count_trns_proc, count_trns_free, trns);
+  add_transformation (ds, count_trns_proc, count_trns_free, trns);
   return CMD_SUCCESS;
 
 fail:
@@ -325,7 +325,7 @@
 /* Performs the COUNT transformation T on case C. */
 static int
 count_trns_proc (void *trns_, struct ccase *c,
-                 casenum_t case_num UNUSED)
+                 casenumber case_num UNUSED)
 {
   struct count_trns *trns = trns_;
   struct dst_var *dv;

Index: src/language/xforms/fail.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/xforms/fail.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- src/language/xforms/fail.c  19 Oct 2006 15:04:53 -0000      1.2
+++ src/language/xforms/fail.c  26 Oct 2006 06:16:36 -0000      1.3
@@ -27,7 +27,7 @@
 #include <language/command.h>
 #include <language/lexer/lexer.h>
 
-static int trns_fail (void *x, struct ccase *c, casenum_t n);
+static int trns_fail (void *x, struct ccase *c, casenumber n);
 
 
 
@@ -35,17 +35,17 @@
 
 static int 
 trns_fail (void *x UNUSED, struct ccase *c UNUSED, 
-          casenum_t n UNUSED)
+          casenumber n UNUSED)
 {
   return TRNS_ERROR;
 }
 
 
 int
-cmd_debug_xform_fail (void)
+cmd_debug_xform_fail (struct dataset *ds)
 {
 
-  add_transformation (current_dataset, trns_fail, NULL, NULL);
+  add_transformation (ds, trns_fail, NULL, NULL);
 
   return lex_end_of_command ();
 }

Index: src/language/xforms/recode.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/xforms/recode.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- src/language/xforms/recode.c        19 Oct 2006 15:04:53 -0000      1.11
+++ src/language/xforms/recode.c        26 Oct 2006 06:16:36 -0000      1.12
@@ -108,9 +108,9 @@
     size_t map_cnt;             /* Number of mappings. */
   };
 
-static bool parse_src_vars (struct recode_trns *);
+static bool parse_src_vars (struct recode_trns *, const struct dictionary 
*dict);
 static bool parse_mappings (struct recode_trns *);
-static bool parse_dst_vars (struct recode_trns *);
+static bool parse_dst_vars (struct recode_trns *, const struct dictionary 
*dict);
 
 static void add_mapping (struct recode_trns *,
                          size_t *map_allocated, const struct map_in *);
@@ -128,7 +128,7 @@
                              const struct string *);
 
 static void enlarge_dst_widths (struct recode_trns *);
-static void create_dst_vars (struct recode_trns *);
+static void create_dst_vars (struct recode_trns *, struct dictionary *);
 
 static trns_proc_func recode_trns_proc;
 static trns_free_func recode_trns_free;
@@ -137,7 +137,7 @@
 
 /* Parses the RECODE transformation. */
 int
-cmd_recode (void)
+cmd_recode (struct dataset *ds)
 {
   do
     {
@@ -147,9 +147,9 @@
       /* Parse source variable names,
          then input to output mappings,
          then destintation variable names. */
-      if (!parse_src_vars (trns)
+      if (!parse_src_vars (trns, dataset_dict (ds) )
           || !parse_mappings (trns)
-          || !parse_dst_vars (trns))
+          || !parse_dst_vars (trns, dataset_dict (ds)))
         {
           recode_trns_free (trns);
           return CMD_FAILURE;
@@ -164,10 +164,10 @@
          This must be the final step; otherwise we'd have to
          delete destination variables on failure. */
       if (trns->src_vars != trns->dst_vars)
-        create_dst_vars (trns);
+        create_dst_vars (trns, dataset_dict (ds));
 
       /* Done. */
-      add_transformation (current_dataset, 
+      add_transformation (ds, 
                          recode_trns_proc, recode_trns_free, trns);
     }
   while (lex_match ('/'));
@@ -179,9 +179,9 @@
    TRNS->var_cnt.  Sets TRNS->src_type.  Returns true if
    successful, false on parse error. */
 static bool
-parse_src_vars (struct recode_trns *trns) 
+parse_src_vars (struct recode_trns *trns, const struct dictionary *dict) 
 {
-  if (!parse_variables (dataset_dict (current_dataset), &trns->src_vars, 
&trns->var_cnt,
+  if (!parse_variables (dict, &trns->src_vars, &trns->var_cnt,
                         PV_SAME_TYPE))
     return false;
   pool_register (trns->pool, free, trns->src_vars);
@@ -415,7 +415,7 @@
 /* Parses a set of target variables into TRNS->dst_vars and
    TRNS->dst_names. */
 static bool
-parse_dst_vars (struct recode_trns *trns) 
+parse_dst_vars (struct recode_trns *trns, const struct dictionary *dict) 
 {
   size_t i;
   
@@ -424,7 +424,8 @@
       size_t name_cnt;
       size_t i;
 
-      if (!parse_mixed_vars_pool (trns->pool, &trns->dst_names, &name_cnt,
+      if (!parse_mixed_vars_pool (dict, trns->pool, 
+                                 &trns->dst_names, &name_cnt,
                                   PV_NONE))
         return false;
 
@@ -442,8 +443,7 @@
       for (i = 0; i < trns->var_cnt; i++)
         {
           struct variable *v;
-          v = trns->dst_vars[i] = dict_lookup_var (dataset_dict 
(current_dataset),
-                                                  trns->dst_names[i]);
+          v = trns->dst_vars[i] = dict_lookup_var (dict, trns->dst_names[i]);
           if (v == NULL && trns->dst_type == ALPHA) 
             {
               msg (SE, _("There is no variable named "
@@ -516,7 +516,7 @@
 
 /* Creates destination variables that don't already exist. */
 static void
-create_dst_vars (struct recode_trns *trns)
+create_dst_vars (struct recode_trns *trns, struct dictionary *dict)
 {
   size_t i;
 
@@ -525,9 +525,9 @@
       struct variable **var = &trns->dst_vars[i];
       const char *name = trns->dst_names[i];
           
-      *var = dict_lookup_var (dataset_dict (current_dataset), name);
+      *var = dict_lookup_var (dict, name);
       if (*var == NULL)
-        *var = dict_create_var_assert (dataset_dict (current_dataset), name, 
0);
+        *var = dict_create_var_assert (dict, name, 0);
       assert ((*var)->type == trns->dst_type);
     }
 }
@@ -623,7 +623,7 @@
 
 /* Performs RECODE transformation. */
 static int
-recode_trns_proc (void *trns_, struct ccase *c, casenum_t case_idx UNUSED)
+recode_trns_proc (void *trns_, struct ccase *c, casenumber case_idx UNUSED)
 {
   struct recode_trns *trns = trns_;
   size_t i;

Index: src/language/xforms/sample.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/xforms/sample.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- src/language/xforms/sample.c        19 Oct 2006 15:04:53 -0000      1.8
+++ src/language/xforms/sample.c        26 Oct 2006 06:16:36 -0000      1.9
@@ -57,7 +57,7 @@
 static trns_free_func sample_trns_free;
 
 int
-cmd_sample (void)
+cmd_sample (struct dataset *ds)
 {
   struct sample_trns *trns;
 
@@ -111,7 +111,7 @@
   trns->N = b;
   trns->m = trns->t = 0;
   trns->frac = frac;
-  add_transformation (current_dataset, sample_trns_proc, sample_trns_free, 
trns);
+  add_transformation (ds, sample_trns_proc, sample_trns_free, trns);
 
   return lex_end_of_command ();
 }
@@ -119,7 +119,7 @@
 /* Executes a SAMPLE transformation. */
 static int
 sample_trns_proc (void *t_, struct ccase *c UNUSED,
-                  casenum_t case_num UNUSED)
+                  casenumber case_num UNUSED)
 {
   struct sample_trns *t = t_;
   double U;

Index: src/language/xforms/select-if.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/xforms/select-if.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- src/language/xforms/select-if.c     19 Oct 2006 15:04:53 -0000      1.10
+++ src/language/xforms/select-if.c     26 Oct 2006 06:16:36 -0000      1.11
@@ -47,12 +47,12 @@
 
 /* Parses the SELECT IF transformation. */
 int
-cmd_select_if (void)
+cmd_select_if (struct dataset *ds)
 {
   struct expression *e;
   struct select_if_trns *t;
 
-  e = expr_parse (dataset_dict (current_dataset), EXPR_BOOLEAN);
+  e = expr_parse (ds, EXPR_BOOLEAN);
   if (!e)
     return CMD_CASCADING_FAILURE;
 
@@ -65,7 +65,7 @@
 
   t = xmalloc (sizeof *t);
   t->e = e;
-  add_transformation (current_dataset, select_if_proc, select_if_free, t);
+  add_transformation (ds, select_if_proc, select_if_free, t);
 
   return CMD_SUCCESS;
 }
@@ -73,7 +73,7 @@
 /* Performs the SELECT IF transformation T on case C. */
 static int
 select_if_proc (void *t_, struct ccase *c,
-                casenum_t case_num)
+                casenumber case_num)
 {
   struct select_if_trns *t = t_;
   return (expr_evaluate_num (t->e, c, case_num) == 1.0
@@ -92,22 +92,23 @@
 
 /* Parses the FILTER command. */
 int
-cmd_filter (void)
+cmd_filter (struct dataset *ds)
 {
+  struct dictionary *dict = dataset_dict (ds);
   if (lex_match_id ("OFF"))
-    dict_set_filter (dataset_dict (current_dataset), NULL);
+    dict_set_filter (dataset_dict (ds), NULL);
   else if (token == '.') 
     {
       msg (SW, _("Syntax error expecting OFF or BY.  "
                  "Turning off case filtering."));
-      dict_set_filter (dataset_dict (current_dataset), NULL);
+      dict_set_filter (dataset_dict (ds), NULL);
     }
   else
     {
       struct variable *v;
 
       lex_match (T_BY);
-      v = parse_variable ();
+      v = parse_variable (dict);
       if (!v)
        return CMD_FAILURE;
 
@@ -123,7 +124,7 @@
          return CMD_FAILURE;
        }
 
-      dict_set_filter (dataset_dict (current_dataset), v);
+      dict_set_filter (dict, v);
     }
 
   return lex_end_of_command ();

Index: src/math/levene.c
===================================================================
RCS file: /sources/pspp/pspp/src/math/levene.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- src/math/levene.c   19 Oct 2006 15:04:53 -0000      1.5
+++ src/math/levene.c   26 Oct 2006 06:16:36 -0000      1.6
@@ -82,18 +82,19 @@
 
 /* First pass */
 static void  levene_precalc (const struct levene_info *l);
-static int levene_calc (const struct ccase *, void *);
+static int levene_calc (const struct dictionary *dict, const struct ccase *, 
void *);
 static void levene_postcalc (void *);
 
 
 /* Second pass */
 static void levene2_precalc (void *);
-static int levene2_calc (const struct ccase *, void *);
+static int levene2_calc (const struct dictionary *,const struct ccase *, void 
*);
 static void levene2_postcalc (void *);
 
 
 void  
-levene(const struct casefile *cf,
+levene(const struct dictionary *dict, 
+       const struct casefile *cf,
        struct variable *v_indep, size_t n_dep, struct variable **v_dep,
             enum lev_missing missing,   is_missing_func value_is_missing)
 {
@@ -114,7 +115,7 @@
       casereader_read (r, &c) ;
       case_destroy (&c)) 
     {
-      levene_calc(&c,&l);
+      levene_calc (dict, &c,&l);
     }
   casereader_destroy (r);
   levene_postcalc(&l);
@@ -124,7 +125,7 @@
       casereader_read (r, &c) ;
       case_destroy (&c)) 
     {
-      levene2_calc(&c,&l);
+      levene2_calc (dict, &c,&l);
     }
   casereader_destroy (r);
   levene2_postcalc(&l);
@@ -184,14 +185,14 @@
 }
 
 static int 
-levene_calc (const struct ccase *c, void *_l)
+levene_calc (const struct dictionary *dict, const struct ccase *c, void *_l)
 {
   size_t i;
   bool warn = false;
   struct levene_info *l = (struct levene_info *) _l;
   const union value *gv = case_data (c, l->v_indep->fv);
   struct group_statistics key;
-  double weight = dict_get_case_weight (dataset_dict (current_dataset), c, 
&warn); 
+  double weight = dict_get_case_weight (dict, c, &warn); 
 
   /* Skip the entire case if /MISSING=LISTWISE is set */
   if ( l->missing == LEV_LISTWISE ) 
@@ -208,7 +209,6 @@
        }
     }
 
-  
   key.id = *gv;
 
   for (i = 0; i < l->n_dep; ++i) 
@@ -288,14 +288,14 @@
 }
 
 static int 
-levene2_calc (const struct ccase *c, void *_l)
+levene2_calc (const struct dictionary *dict, const struct ccase *c, void *_l)
 {
   size_t i;
   bool warn = false;
 
   struct levene_info *l = (struct levene_info *) _l;
 
-  double weight = dict_get_case_weight (dataset_dict (current_dataset), c, 
&warn); 
+  double weight = dict_get_case_weight (dict, c, &warn); 
 
   const union value *gv = case_data (c, l->v_indep->fv);
   struct group_statistics key;

Index: src/math/levene.h
===================================================================
RCS file: /sources/pspp/pspp/src/math/levene.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- src/math/levene.h   15 Mar 2006 03:29:11 -0000      1.2
+++ src/math/levene.h   26 Oct 2006 06:16:36 -0000      1.3
@@ -40,7 +40,9 @@
 */
 
 
-void  levene(const struct casefile *cf, 
+struct dictionary ;
+
+void  levene(const struct dictionary *dict, const struct casefile *cf, 
             struct variable *v_indep, size_t n_dep, struct variable **v_dep,
             enum lev_missing,   is_missing_func);
 

Index: src/math/sort.c
===================================================================
RCS file: /sources/pspp/pspp/src/math/sort.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- src/math/sort.c     19 Oct 2006 15:04:53 -0000      1.14
+++ src/math/sort.c     26 Oct 2006 06:16:36 -0000      1.15
@@ -59,30 +59,25 @@
 static struct casefile *do_external_sort (struct casereader *,
                                           const struct sort_criteria *);
 
-/* Get ready to sort the active file. */
-static void
-prepare_to_sort_active_file (void) 
-{
-  proc_cancel_temporary_transformations (current_dataset); 
-}
 
 /* Sorts the active file in-place according to CRITERIA.
    Returns true if successful. */
 bool
-sort_active_file_in_place (const struct sort_criteria *criteria) 
+sort_active_file_in_place (struct dataset *ds, 
+                          const struct sort_criteria *criteria) 
 {
   struct casefile *in, *out;
 
-  prepare_to_sort_active_file ();
-  if (!procedure (current_dataset,NULL, NULL))
+  proc_cancel_temporary_transformations (ds);
+  if (!procedure (ds, NULL, NULL))
     return false;
   
-  in = proc_capture_output (current_dataset);
+  in = proc_capture_output (ds);
   out = sort_execute (casefile_get_destructive_reader (in), criteria);
   if (out == NULL) 
     return false;
 
-  proc_set_source (current_dataset, storage_source_create (out));
+  proc_set_source (ds, storage_source_create (out));
   return true;
 }
 
@@ -106,15 +101,16 @@
    returns the sorted casefile.  Returns a null pointer on
    failure. */
 struct casefile *
-sort_active_file_to_casefile (const struct sort_criteria *criteria) 
+sort_active_file_to_casefile (struct dataset *ds, 
+                             const struct sort_criteria *criteria) 
 {
   struct sort_to_casefile_cb_data cb_data;
   
-  prepare_to_sort_active_file ();
+  proc_cancel_temporary_transformations (ds);
 
   cb_data.criteria = criteria;
   cb_data.output = NULL;
-  if (!multipass_procedure (current_dataset,sort_to_casefile_callback, 
&cb_data)) 
+  if (!multipass_procedure (ds, sort_to_casefile_callback, &cb_data)) 
     {
       casefile_destroy (cb_data.output);
       return NULL;

Index: src/math/sort.h
===================================================================
RCS file: /sources/pspp/pspp/src/math/sort.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- src/math/sort.h     23 Sep 2006 00:15:58 -0000      1.2
+++ src/math/sort.h     26 Oct 2006 06:16:36 -0000      1.3
@@ -60,8 +60,11 @@
 struct casefile *sort_execute (struct casereader *,
                                const struct sort_criteria *);
 
-bool sort_active_file_in_place (const struct sort_criteria *);
+struct dataset ;
+bool sort_active_file_in_place (struct dataset *ds, 
+                               const struct sort_criteria *);
 
-struct casefile *sort_active_file_to_casefile (const struct sort_criteria *);
+struct casefile *sort_active_file_to_casefile (struct dataset *ds, 
+                                              const struct sort_criteria *);
 
 #endif /* !sort_h */

Index: src/ui/terminal/main.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/terminal/main.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- src/ui/terminal/main.c      19 Oct 2006 15:04:53 -0000      1.15
+++ src/ui/terminal/main.c      26 Oct 2006 06:16:36 -0000      1.16
@@ -69,6 +69,8 @@
 
 /* Handle quit/term/int signals */
 void interrupt_handler(int sig);
+static struct dataset * the_dataset = NULL;
+
 
 
 /* Program entry point. */
@@ -93,7 +95,7 @@
   readln_initialize ();
   settings_init ();
   random_init ();
-  current_dataset = create_dataset ();
+  the_dataset = create_dataset ();
 
   if (parse_command_line (argc, argv)) 
     {
@@ -102,7 +104,8 @@
 
       for (;;)
         {
-          int result = cmd_parse (proc_has_source (current_dataset)
+          int result = cmd_parse (the_dataset, 
+                                 proc_has_source (the_dataset)
                                   ? CMD_STATE_DATA : CMD_STATE_INITIAL);
           if (result == CMD_EOF || result == CMD_FINISH)
             break;
@@ -178,7 +181,7 @@
     {
       terminating = true;
 
-      destroy_dataset (current_dataset);
+      destroy_dataset (the_dataset);
 
       random_done ();
       settings_done ();

Index: tests/bugs/lag_crash.sh
===================================================================
RCS file: /sources/pspp/pspp/tests/bugs/lag_crash.sh,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- tests/bugs/lag_crash.sh     11 Mar 2006 07:16:40 -0000      1.5
+++ tests/bugs/lag_crash.sh     26 Oct 2006 06:16:36 -0000      1.6
@@ -70,7 +70,7 @@
 
 
 activity="run_program"
-$SUPERVISOR $PSPP $TESTFILE > /dev/null
+$SUPERVISOR $PSPP $TESTFILE 
 if [ $? -ne 0 ] ; then fail ; fi
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]