? callbacks.patch
? diffs
? file.sps
? grob.sav
? doc/.dirstamp
? gl/.deps
? gl/Makefile
? gl/Makefile.am
? gl/Makefile.in
? gl/alloca.c
? gl/alloca.h
? gl/alloca_.h
? gl/asnprintf.c
? gl/asprintf.c
? gl/byteswap_.h
? gl/c-ctype.c
? gl/c-ctype.h
? gl/c-strtod.c
? gl/c-strtod.h
? gl/charset.alias
? gl/config.charset
? gl/configmake.h
? gl/error.c
? gl/error.h
? gl/exit.h
? gl/exitfail.c
? gl/exitfail.h
? gl/full-read.c
? gl/full-read.h
? gl/full-write.c
? gl/full-write.h
? gl/getdelim.c
? gl/getdelim.h
? gl/gethostname.c
? gl/getline.c
? gl/getline.h
? gl/getlogin_r.c
? gl/getlogin_r.h
? gl/getopt.c
? gl/getopt1.c
? gl/getopt_.h
? gl/getopt_int.h
? gl/gettext.h
? gl/imaxtostr.c
? gl/intprops.h
? gl/inttostr.c
? gl/inttostr.h
? gl/lbrkprop.h
? gl/linebreak.c
? gl/linebreak.h
? gl/localcharset.c
? gl/localcharset.h
? gl/mbchar.c
? gl/mbchar.h
? gl/mbuiter.h
? gl/memcasecmp.c
? gl/memcasecmp.h
? gl/memchr.c
? gl/memcmp.c
? gl/memmem.c
? gl/memmem.h
? gl/memmove.c
? gl/mempcpy.c
? gl/mempcpy.h
? gl/memset.c
? gl/minmax.h
? gl/offtostr.c
? gl/printf-args.c
? gl/printf-args.h
? gl/printf-parse.c
? gl/printf-parse.h
? gl/progname.c
? gl/progname.h
? gl/readlink.c
? gl/ref-add.sed
? gl/ref-add.sin
? gl/ref-del.sed
? gl/ref-del.sin
? gl/safe-read.c
? gl/safe-read.h
? gl/safe-write.c
? gl/safe-write.h
? gl/size_max.h
? gl/snprintf.c
? gl/snprintf.h
? gl/stat-macros.h
? gl/stdbool_.h
? gl/stdint.h
? gl/stdint_.h
? gl/stpcpy.c
? gl/stpcpy.h
? gl/strcase.h
? gl/strcasecmp.c
? gl/strcspn.c
? gl/strerror.c
? gl/strftime.c
? gl/strftime.h
? gl/strncasecmp.c
? gl/strndup.c
? gl/strndup.h
? gl/strnlen.c
? gl/strnlen.h
? gl/strnlen1.c
? gl/strnlen1.h
? gl/strpbrk.c
? gl/strpbrk.h
? gl/strsep.c
? gl/strsep.h
? gl/strstr.c
? gl/strstr.h
? gl/strtod.c
? gl/strtok_r.c
? gl/strtok_r.h
? gl/strtol.c
? gl/strtoul.c
? gl/time_r.c
? gl/time_r.h
? gl/uinttostr.c
? gl/umaxtostr.c
? gl/unlocked-io.h
? gl/utf16-ucs4.h
? gl/utf8-ucs4.h
? gl/vasnprintf.c
? gl/vasnprintf.h
? gl/vasprintf.c
? gl/vasprintf.h
? gl/vsnprintf.c
? gl/vsnprintf.h
? gl/wcwidth.h
? gl/xalloc-die.c
? gl/xalloc.h
? gl/xasprintf.c
? gl/xmalloc.c
? gl/xreadlink.c
? gl/xreadlink.h
? gl/xsize.h
? gl/xstrndup.c
? gl/xstrndup.h
? gl/xvasprintf.c
? gl/xvasprintf.h
? gl/m4/absolute-header.m4
? gl/m4/alloca.m4
? gl/m4/assert.m4
? gl/m4/byteswap.m4
? gl/m4/c-strtod.m4
? gl/m4/codeset.m4
? gl/m4/eoverflow.m4
? gl/m4/error.m4
? gl/m4/exitfail.m4
? gl/m4/extensions.m4
? gl/m4/getdelim.m4
? gl/m4/gethostname.m4
? gl/m4/getline.m4
? gl/m4/getlogin_r.m4
? gl/m4/getopt.m4
? gl/m4/gettext.m4
? gl/m4/glibc2.m4
? gl/m4/glibc21.m4
? gl/m4/gnulib-cache.m4
? gl/m4/gnulib-comp.m4
? gl/m4/gnulib-tool.m4
? gl/m4/iconv.m4
? gl/m4/inline.m4
? gl/m4/intdiv0.m4
? gl/m4/intl.m4
? gl/m4/intldir.m4
? gl/m4/intmax.m4
? gl/m4/intmax_t.m4
? gl/m4/inttostr.m4
? gl/m4/inttypes-pri.m4
? gl/m4/inttypes_h.m4
? gl/m4/lcmessage.m4
? gl/m4/lib-ld.m4
? gl/m4/lib-link.m4
? gl/m4/lib-prefix.m4
? gl/m4/linebreak.m4
? gl/m4/localcharset.m4
? gl/m4/lock.m4
? gl/m4/longdouble.m4
? gl/m4/longlong.m4
? gl/m4/mbchar.m4
? gl/m4/mbiter.m4
? gl/m4/mbrtowc.m4
? gl/m4/mbstate_t.m4
? gl/m4/memcasecmp.m4
? gl/m4/memchr.m4
? gl/m4/memcmp.m4
? gl/m4/memmem.m4
? gl/m4/memmove.m4
? gl/m4/mempcpy.m4
? gl/m4/memset.m4
? gl/m4/minmax.m4
? gl/m4/nls.m4
? gl/m4/onceonly_2_57.m4
? gl/m4/po.m4
? gl/m4/printf-posix.m4
? gl/m4/progtest.m4
? gl/m4/readlink.m4
? gl/m4/safe-read.m4
? gl/m4/safe-write.m4
? gl/m4/size_max.m4
? gl/m4/snprintf.m4
? gl/m4/ssize_t.m4
? gl/m4/stdarg.m4
? gl/m4/stdbool.m4
? gl/m4/stdint.m4
? gl/m4/stdint_h.m4
? gl/m4/stpcpy.m4
? gl/m4/strcase.m4
? gl/m4/strcspn.m4
? gl/m4/strerror.m4
? gl/m4/strftime.m4
? gl/m4/strndup.m4
? gl/m4/strnlen.m4
? gl/m4/strpbrk.m4
? gl/m4/strsep.m4
? gl/m4/strstr.m4
? gl/m4/strtod.m4
? gl/m4/strtok_r.m4
? gl/m4/strtol.m4
? gl/m4/strtoul.m4
? gl/m4/time_r.m4
? gl/m4/tm_gmtoff.m4
? gl/m4/uintmax_t.m4
? gl/m4/ulonglong.m4
? gl/m4/unistd_h.m4
? gl/m4/unlocked-io.m4
? gl/m4/utf-ucs4.m4
? gl/m4/vasnprintf.m4
? gl/m4/vasprintf.m4
? gl/m4/visibility.m4
? gl/m4/vsnprintf.m4
? gl/m4/wchar_t.m4
? gl/m4/wcwidth.m4
? gl/m4/wint_t.m4
? gl/m4/xalloc.m4
? gl/m4/xreadlink.m4
? gl/m4/xsize.m4
? gl/m4/xstrndup.m4
? gl/m4/xvasprintf.m4
? intl/ChangeLog
? intl/Makefile
? intl/Makefile.in
? intl/VERSION
? intl/bindtextdom.c
? intl/config.charset
? intl/dcgettext.c
? intl/dcigettext.c
? intl/dcngettext.c
? intl/dgettext.c
? intl/dngettext.c
? intl/eval-plural.h
? intl/explodename.c
? intl/finddomain.c
? intl/gettext.c
? intl/gettextP.h
? intl/gmo.h
? intl/hash-string.h
? intl/intl-compat.c
? intl/l10nflist.c
? intl/langprefs.c
? intl/libgnuintl.h.in
? intl/loadinfo.h
? intl/loadmsgcat.c
? intl/localcharset.c
? intl/localcharset.h
? intl/locale.alias
? intl/localealias.c
? intl/localename.c
? intl/log.c
? intl/ngettext.c
? intl/os2compat.c
? intl/os2compat.h
? intl/osdep.c
? intl/plural-exp.c
? intl/plural-exp.h
? intl/plural.c
? intl/plural.y
? intl/printf-args.c
? intl/printf-args.h
? intl/printf-parse.c
? intl/printf-parse.h
? intl/printf.c
? intl/ref-add.sin
? intl/ref-del.sin
? intl/relocatable.c
? intl/relocatable.h
? intl/textdomain.c
? intl/vasnprintf.c
? intl/vasnprintf.h
? intl/vasnwprintf.h
? intl/wprintf-parse.h
? intl/xsize.h
? lib/gsl-extras/.deps
? lib/gsl-extras/.dirstamp
? lib/gtksheet/.deps
? lib/gtksheet/.dirstamp
? lib/linreg/.deps
? lib/linreg/.dirstamp
? m4/Makefile.am
? m4/codeset.m4
? m4/gettext.m4
? m4/glibc2.m4
? m4/glibc21.m4
? m4/iconv.m4
? m4/intdiv0.m4
? m4/intmax.m4
? m4/inttypes-pri.m4
? m4/inttypes.m4
? m4/inttypes_h.m4
? m4/isc-posix.m4
? m4/lcmessage.m4
? m4/lib-ld.m4
? m4/lib-link.m4
? m4/lib-prefix.m4
? m4/longdouble.m4
? m4/longlong.m4
? m4/nls.m4
? m4/po.m4
? m4/printf-posix.m4
? m4/progtest.m4
? m4/signed.m4
? m4/size_max.m4
? m4/stdint_h.m4
? m4/uintmax_t.m4
? m4/ulonglong.m4
? m4/wchar_t.m4
? m4/wint_t.m4
? m4/xsize.m4
? src/data/.deps
? src/data/.dirstamp
? src/language/.deps
? src/language/.dirstamp
? src/language/control/.deps
? src/language/control/.dirstamp
? src/language/data-io/.deps
? src/language/data-io/.dirstamp
? src/language/data-io/file-handle.c
? src/language/data-io/list.c
? src/language/dictionary/.deps
? src/language/dictionary/.dirstamp
? src/language/expressions/.deps
? src/language/expressions/.dirstamp
? src/language/lexer/.deps
? src/language/lexer/.dirstamp
? src/language/lexer/q2c
? src/language/stats/.deps
? src/language/stats/.dirstamp
? src/language/stats/correlations.c
? src/language/stats/crosstabs.c
? src/language/stats/examine.c
? src/language/stats/frequencies.c
? src/language/stats/means.c
? src/language/stats/oneway.c
? src/language/stats/rank.c
? src/language/stats/regression.c
? src/language/stats/t-test.c
? src/language/tests/.deps
? src/language/tests/.dirstamp
? src/language/utilities/.deps
? src/language/utilities/.dirstamp
? src/language/utilities/set.c
? src/language/xforms/.deps
? src/language/xforms/.dirstamp
? src/libpspp/.deps
? src/libpspp/.dirstamp
? src/libpspp/version.c
? src/math/.deps
? src/math/.dirstamp
? src/math/linreg/.deps
? src/math/linreg/.dirstamp
? src/math/ts/.deps
? src/math/ts/.dirstamp
? src/output/.deps
? src/output/.dirstamp
? src/output/charts/.deps
? src/output/charts/.dirstamp
? src/ui/.deps
? src/ui/.dirstamp
? src/ui/gui/.deps
? src/ui/gui/.dirstamp
? src/ui/gui/.nfs00c9404a00000055
? src/ui/gui/.nfs00c9404b0000005f
? src/ui/gui/psppire
? src/ui/terminal/.deps
? src/ui/terminal/.dirstamp
? src/ui/terminal/pspp
? tests/formats/.deps
? tests/formats/.dirstamp
? tests/formats/inexactify
? tests/libpspp/.deps
? tests/libpspp/.dirstamp
? tests/libpspp/ll-test
? tests/libpspp/llx-test
Index: src/data/dictionary.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/dictionary.c,v
retrieving revision 1.22
diff -U3 -r1.22 dictionary.c
--- src/data/dictionary.c	11 Dec 2006 15:39:23 -0000	1.22
+++ src/data/dictionary.c	13 Dec 2006 04:34:19 -0000
@@ -62,14 +62,16 @@
     char *documents;		/* Documents, as a string. */
     struct vector **vector;     /* Vectors of variables. */
     size_t vector_cnt;          /* Number of vectors. */
+    struct dict_callbacks callbacks; /* Callbacks on dictionary modification */
+    void *cb_data ;                  /* Data passed to callbacks */
   };
 
 /* Creates and returns a new dictionary. */
 struct dictionary *
-dict_create (void) 
+dict_create (const struct dict_callbacks *callbacks, void *callback_data)
 {
-  struct dictionary *d = xmalloc (sizeof *d);
-  
+  struct dictionary *d = xzalloc (sizeof *d);
+
   d->var = NULL;
   d->var_cnt = d->var_cap = 0;
   d->name_tab = hsh_create (8, compare_vars_by_name, hash_var_by_name,
@@ -84,6 +86,9 @@
   d->documents = NULL;
   d->vector = NULL;
   d->vector_cnt = 0;
+  if ( callbacks )
+    d->callbacks = *callbacks;
+  d->cb_data = callback_data;
 
   return d;
 }
@@ -91,16 +96,16 @@
 /* Creates and returns a (deep) copy of an existing
    dictionary. */
 struct dictionary *
-dict_clone (const struct dictionary *s) 
+dict_clone (const struct dictionary *s)
 {
   struct dictionary *d;
   size_t i;
 
   assert (s != NULL);
 
-  d = dict_create ();
+  d = dict_create (NULL, NULL);
 
-  for (i = 0; i < s->var_cnt; i++) 
+  for (i = 0; i < s->var_cnt; i++)
     {
       struct variable *sv = s->var[i];
       struct variable *dv = dict_clone_var_assert (d, sv, var_get_name (sv));
@@ -110,17 +115,17 @@
   d->next_value_idx = s->next_value_idx;
 
   d->split_cnt = s->split_cnt;
-  if (d->split_cnt > 0) 
+  if (d->split_cnt > 0)
     {
       d->split = xnmalloc (d->split_cnt, sizeof *d->split);
-      for (i = 0; i < d->split_cnt; i++) 
+      for (i = 0; i < d->split_cnt; i++)
         d->split[i] = dict_lookup_var_assert (d, var_get_name (s->split[i]));
     }
 
-  if (s->weight != NULL) 
+  if (s->weight != NULL)
     d->weight = dict_lookup_var_assert (d, var_get_name (s->weight));
 
-  if (s->filter != NULL) 
+  if (s->filter != NULL)
     d->filter = dict_lookup_var_assert (d, var_get_name (s->filter));
 
   d->case_limit = s->case_limit;
@@ -138,7 +143,7 @@
 /* Clears the contents from a dictionary without destroying the
    dictionary itself. */
 void
-dict_clear (struct dictionary *d) 
+dict_clear (struct dictionary *d)
 {
   /* FIXME?  Should we really clear case_limit, label, documents?
      Others are necessarily cleared by deleting all the variables.*/
@@ -149,7 +154,7 @@
   for (i = 0; i < d->var_cnt; i++)
     {
       var_clear_vardict (d->var[i]);
-      var_destroy (d->var[i]); 
+      var_destroy (d->var[i]);
     }
   free (d->var);
   d->var = NULL;
@@ -172,12 +177,12 @@
 /* Destroys the aux data for every variable in D, by calling
    var_clear_aux() for each variable. */
 void
-dict_clear_aux (struct dictionary *d) 
+dict_clear_aux (struct dictionary *d)
 {
   int i;
-  
+
   assert (d != NULL);
-  
+
   for (i = 0; i < d->var_cnt; i++)
     var_clear_aux (d->var[i]);
 }
@@ -186,7 +191,7 @@
 void
 dict_destroy (struct dictionary *d)
 {
-  if (d != NULL) 
+  if (d != NULL)
     {
       dict_clear (d);
       hsh_destroy (d->name_tab);
@@ -196,7 +201,7 @@
 
 /* Returns the number of variables in D. */
 size_t
-dict_get_var_cnt (const struct dictionary *d) 
+dict_get_var_cnt (const struct dictionary *d)
 {
   assert (d != NULL);
 
@@ -207,7 +212,7 @@
    must be between 0 and the count returned by
    dict_get_var_cnt(), exclusive. */
 struct variable *
-dict_get_var (const struct dictionary *d, size_t idx) 
+dict_get_var (const struct dictionary *d, size_t idx)
 {
   assert (d != NULL);
   assert (idx < d->var_cnt);
@@ -226,14 +231,14 @@
 {
   size_t count;
   size_t i;
-  
+
   assert (d != NULL);
   assert (vars != NULL);
   assert (cnt != NULL);
   assert ((exclude_classes & ~((1u << DC_ORDINARY)
                                | (1u << DC_SYSTEM)
                                | (1u << DC_SCRATCH))) == 0);
-  
+
   count = 0;
   for (i = 0; i < d->var_cnt; i++)
     {
@@ -241,36 +246,40 @@
       if (!(exclude_classes & (1u << class)))
         count++;
     }
-  
+
   *vars = xnmalloc (count, sizeof **vars);
   *cnt = 0;
-  for (i = 0; i < d->var_cnt; i++) 
+  for (i = 0; i < d->var_cnt; i++)
     {
       enum dict_class class = dict_class_from_id (var_get_name (d->var[i]));
       if (!(exclude_classes & (1u << class)))
-        (*vars)[(*cnt)++] = d->var[i]; 
+        (*vars)[(*cnt)++] = d->var[i];
     }
   assert (*cnt == count);
 }
 
 static struct variable *
-add_var (struct dictionary *d, struct variable *v) 
+add_var (struct dictionary *d, struct variable *v)
 {
   /* Add dictionary info to variable. */
   struct vardict_info vdi;
   vdi.case_index = d->next_value_idx;
   vdi.dict_index = d->var_cnt;
+  vdi.dict = d;
   var_set_vardict (v, &vdi);
 
   /* Update dictionary. */
-  if (d->var_cnt >= d->var_cap) 
+  if (d->var_cnt >= d->var_cap)
     {
-      d->var_cap = 8 + 2 * d->var_cap; 
+      d->var_cap = 8 + 2 * d->var_cap;
       d->var = xnrealloc (d->var, d->var_cap, sizeof *d->var);
     }
   d->var[d->var_cnt++] = v;
   hsh_force_insert (d->name_tab, v);
 
+  if ( d->callbacks.var_added )
+    d->callbacks.var_added (d, d->next_value_idx, d->cb_data);
+
   d->next_value_idx += var_get_value_cnt (v);
 
   return v;
@@ -351,12 +360,12 @@
 bool
 dict_contains_var (const struct dictionary *d, const struct variable *v)
 {
-  if (var_has_vardict (v)) 
+  if (var_has_vardict (v))
     {
       const struct vardict_info *vdi = var_get_vardict (v);
       return (vdi->dict_index >= 0
               && vdi->dict_index < d->var_cnt
-              && d->var[vdi->dict_index] == v); 
+              && d->var[vdi->dict_index] == v);
     }
   else
     return false;
@@ -379,7 +388,7 @@
 {
   struct vardict_info vdi = *var_get_vardict (v);
   vdi.dict_index = dict_index;
-  var_set_vardict (v, &vdi); 
+  var_set_vardict (v, &vdi);
 }
 
 /* Sets the case_index in V's vardict to DICT_INDEX. */
@@ -388,16 +397,16 @@
 {
   struct vardict_info vdi = *var_get_vardict (v);
   vdi.case_index = case_index;
-  var_set_vardict (v, &vdi); 
+  var_set_vardict (v, &vdi);
 }
 
 /* Re-sets the dict_index in the dictionary variables with
    indexes from FROM to TO (exclusive). */
 static void
-reindex_vars (struct dictionary *d, size_t from, size_t to) 
+reindex_vars (struct dictionary *d, size_t from, size_t to)
 {
   size_t i;
-  
+
   for (i = from; i < to; i++)
     set_var_dict_index (d->var[i], i);
 }
@@ -443,9 +452,13 @@
   /* Update name hash. */
   hsh_force_delete (d->name_tab, v);
 
+
   /* Free memory. */
   var_clear_vardict (v);
   var_destroy (v);
+
+  if (d->callbacks.var_deleted )
+    d->callbacks.var_deleted (d, dict_index, d->cb_data);
 }
 
 /* Deletes the COUNT variables listed in VARS from D.  This is
@@ -1238,3 +1251,21 @@
   /* Get rid of hash table. */
   hsh_destroy (short_names);
 }
+
+
+/* Called from variable.c to notify the dictionary that some property of 
+   the variable has changed */
+void
+dict_var_changed (const struct variable *v)
+{
+  if ( var_has_vardict (v))
+    {
+      const struct vardict_info *vdi = var_get_vardict (v);
+      struct dictionary *d;
+
+      d = vdi->dict;
+
+      if ( d->callbacks.var_changed )
+	d->callbacks.var_changed (d, var_get_dict_index (v), d->cb_data);
+    }
+}
Index: src/data/dictionary.h
===================================================================
RCS file: /sources/pspp/pspp/src/data/dictionary.h,v
retrieving revision 1.6
diff -U3 -r1.6 dictionary.h
--- src/data/dictionary.h	11 Dec 2006 15:39:23 -0000	1.6
+++ src/data/dictionary.h	13 Dec 2006 04:34:19 -0000
@@ -23,10 +23,20 @@
 #include <stdbool.h>
 #include <stddef.h>
 
-/* Dictionary. */ 
+/* Dictionary. */
 
 struct variable;
-struct dictionary *dict_create (void);
+struct dictionary;
+
+struct dict_callbacks
+ {
+  void (*var_added) (struct dictionary *, int, void *);
+  void (*var_deleted) (struct dictionary *, int, void *);
+  void (*var_changed) (struct dictionary *, int, void *);
+ };
+
+
+struct dictionary *dict_create (const struct dict_callbacks *, void *);
 struct dictionary *dict_clone (const struct dictionary *);
 void dict_clear (struct dictionary *);
 void dict_clear_aux (struct dictionary *);
@@ -116,4 +126,8 @@
 
 void dict_assign_short_names (struct dictionary *);
 
+/* Called only from variable.c */
+void dict_var_changed (const struct variable *v);
+
+
 #endif /* dictionary.h */
Index: src/data/missing-values.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/missing-values.c,v
retrieving revision 1.6
diff -U3 -r1.6 missing-values.c
--- src/data/missing-values.c	10 Dec 2006 03:42:50 -0000	1.6
+++ src/data/missing-values.c	13 Dec 2006 04:34:19 -0000
@@ -305,15 +305,18 @@
 bool
 mv_is_resizable (const struct missing_values *mv, int width) 
 {
-  assert ((width == 0) == (mv->width == 0));
+  if  ((width == 0) !=  (mv->width == 0))
+    return false;
+
   if (width > MAX_SHORT_STRING && mv->type != MV_NONE)
     return false;
-  else if (width >= mv->width)
+
+  if (width >= mv->width)
     return true;
-  else 
+  else
     {
       int i;
-      
+
       for (i = 0; i < 3; i++)
         if (using_element (mv->type, i)
             && !can_resize_string (mv->values[i].s, mv->width, width))
Index: src/data/por-file-reader.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/por-file-reader.c,v
retrieving revision 1.14
diff -U3 -r1.14 por-file-reader.c
--- src/data/por-file-reader.c	10 Dec 2006 03:42:50 -0000	1.14
+++ src/data/por-file-reader.c	13 Dec 2006 04:34:19 -0000
@@ -164,7 +164,7 @@
   struct pool *volatile pool = NULL;
   struct pfm_reader *volatile r = NULL;
 
-  *dict = dict_create ();
+  *dict = dict_create (NULL, NULL);
   if (!fh_open (fh, FH_REF_FILE, "portable file", "rs"))
     goto error;
 
Index: src/data/procedure.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/procedure.c,v
retrieving revision 1.17
diff -U3 -r1.17 procedure.c
--- src/data/procedure.c	10 Dec 2006 03:42:50 -0000	1.17
+++ src/data/procedure.c	13 Dec 2006 04:34:19 -0000
@@ -805,10 +805,10 @@
 
 /* Initializes procedure handling. */
 struct dataset *
-create_dataset (void)
+create_dataset (const struct dict_callbacks *cbs, void *cbdata)
 {
   struct dataset *ds = xzalloc (sizeof(*ds));
-  ds->dict = dict_create ();
+  ds->dict = dict_create (cbs, cbdata);
   proc_cancel_all_transformations (ds);
   return ds;
 }
Index: src/data/procedure.h
===================================================================
RCS file: /sources/pspp/pspp/src/data/procedure.h,v
retrieving revision 1.6
diff -U3 -r1.6 procedure.h
--- src/data/procedure.h	26 Oct 2006 06:16:36 -0000	1.6
+++ src/data/procedure.h	13 Dec 2006 04:34:19 -0000
@@ -58,8 +58,8 @@
 
 /* Procedures. */
 
-
-struct dataset *create_dataset (void);
+struct dict_callbacks ;
+struct dataset * create_dataset (const struct dict_callbacks *, void *cbdata);
 void destroy_dataset (struct dataset *);
 
 void proc_set_source (struct dataset *ds, struct case_source *);
Index: src/data/sys-file-reader.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/sys-file-reader.c,v
retrieving revision 1.29
diff -U3 -r1.29 sys-file-reader.c
--- src/data/sys-file-reader.c	11 Dec 2006 15:39:23 -0000	1.29
+++ src/data/sys-file-reader.c	13 Dec 2006 04:34:20 -0000
@@ -184,7 +184,7 @@
   if (!fh_open (fh, FH_REF_FILE, "system file", "rs"))
     return NULL;
 
-  *dict = dict_create ();
+  *dict = dict_create (NULL, NULL);
 
   /* Create and initialize reader. */
   r = pool_create_container (struct sfm_reader, pool);
Index: src/data/value-labels.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/value-labels.c,v
retrieving revision 1.13
diff -U3 -r1.13 value-labels.c
--- src/data/value-labels.c	11 Dec 2006 15:56:13 -0000	1.13
+++ src/data/value-labels.c	13 Dec 2006 04:34:20 -0000
@@ -91,7 +91,8 @@
 bool
 val_labs_can_set_width (const struct val_labs *vls, int new_width) 
 {
-  assert ((vls->width == 0) == (new_width == 0));
+  if  ((vls->width == 0) != (new_width == 0) )
+    return false;
 
   if (vls->width == 0)
     return new_width == 0;
Index: src/data/vardict.h
===================================================================
RCS file: /sources/pspp/pspp/src/data/vardict.h,v
retrieving revision 1.1
diff -U3 -r1.1 vardict.h
--- src/data/vardict.h	10 Dec 2006 03:42:50 -0000	1.1
+++ src/data/vardict.h	13 Dec 2006 04:34:20 -0000
@@ -24,11 +24,14 @@
    This header file should only be included by variable.c and
    dictionary.c. */
 
+struct dictionary ;
+
 /* Dictionary data stored in variable. */
 struct vardict_info 
   {
     int dict_index;     /* Dictionary index containing the variable. */
     int case_index;     /* Index into case of variable data. */
+    struct dictionary *dict;  /* The dictionary containing the variable */
   };
 
 const struct vardict_info *var_get_vardict (const struct variable *);
Index: src/data/variable.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/variable.c,v
retrieving revision 1.16
diff -U3 -r1.16 variable.c
--- src/data/variable.c	10 Dec 2006 03:42:50 -0000	1.16
+++ src/data/variable.c	13 Dec 2006 04:34:20 -0000
@@ -23,13 +23,11 @@
 #include <stdlib.h>
 
 #include "cat-routines.h"
-#include "category.h"
 #include "data-out.h"
-#include "dictionary.h"
 #include "format.h"
+#include "dictionary.h"
 #include "identifier.h"
 #include "missing-values.h"
-#include "value.h"
 #include "value-labels.h"
 #include "vardict.h"
 
@@ -38,11 +36,8 @@
 #include <libpspp/compiler.h>
 #include <libpspp/hash.h>
 #include <libpspp/message.h>
-#include <libpspp/misc.h>
 #include <libpspp/str.h>
 
-#include "minmax.h"
-
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
 
@@ -208,6 +203,7 @@
   assert (var_is_plausible_name (name, false));
 
   str_copy_trunc (v->name, sizeof v->name, name);
+  dict_var_changed (v);
 }
 
 /* Returns true if NAME is an acceptable name for a variable,
@@ -352,29 +348,49 @@
   return v->width;
 }
 
+/* Sets the number of decimal places of V to DECIMALS. */
+void
+var_set_decimals (struct variable *v, int decimals)
+{
+  assert (var_is_numeric (v));
+  assert (fmt_takes_decimals (v->write.type));
+  assert (fmt_takes_decimals (v->print.type));
+
+  assert (fmt_min_output_width (v->write.type) <= decimals);
+  assert (fmt_max_output_width (v->write.type) >= decimals);
+
+
+  assert (fmt_min_output_width (v->print.type) <= decimals);
+  assert (fmt_max_output_width (v->print.type) >= decimals);
+
+  v->print.d = decimals;
+  v->write.d = decimals;
+  dict_var_changed (v);
+}
+
 /* Sets the width of V to WIDTH. */
 void
-var_set_width (struct variable *v, int new_width) 
+var_set_width (struct variable *v, int new_width)
 {
   enum var_type new_type = var_type_from_width (new_width);
-  
+
   if (mv_is_resizable (&v->miss, new_width))
     mv_resize (&v->miss, new_width);
   else
     mv_init (&v->miss, new_width);
 
-  if (v->val_labs != NULL) 
+  if (v->val_labs != NULL)
     {
       if (val_labs_can_set_width (v->val_labs, new_width))
         val_labs_set_width (v->val_labs, new_width);
-      else 
+      else
         {
           val_labs_destroy (v->val_labs);
-          v->val_labs = NULL;
+          v->val_labs = val_labs_create (new_width);
         }
     }
-  
-  if (var_get_type (v) != new_type) 
+
+  if (var_get_type (v) != new_type)
     {
       v->print = (new_type == VAR_NUMERIC
                   ? fmt_for_output (FMT_F, 8, 2)
@@ -388,6 +404,8 @@
     }
 
   v->width = new_width;
+
+  dict_var_changed (v);
 }
 
 /* Returns true if variable V is numeric, false otherwise. */
@@ -451,6 +469,8 @@
     }
   else
     mv_init (&v->miss, v->width);
+
+  dict_var_changed (v);
 }
 
 /* Sets variable V to have no user-missing values. */
@@ -558,6 +578,7 @@
       assert (val_labs_can_set_width (vls, v->width));
       v->val_labs = val_labs_copy (vls);
       val_labs_set_width (v->val_labs, v->width);
+      dict_var_changed (v);
     }
 }
 
@@ -643,6 +664,7 @@
 {
   assert (fmt_check_width_compat (print, v->width));
   v->print = *print;
+  dict_var_changed (v);
 }
 
 /* Returns V's write format specification. */
@@ -660,6 +682,7 @@
 {
   assert (fmt_check_width_compat (write, v->width));
   v->write = *write;
+  dict_var_changed (v);
 }
 
 /* Sets V's print and write format specifications to FORMAT,
@@ -706,6 +729,7 @@
       ss_truncate (&s, 255);
       if (!ss_is_empty (s)) 
         v->label = ss_xstrdup (s);
+      dict_var_changed (v);
     }
 }
 
@@ -745,6 +769,7 @@
 {
   assert (measure_is_valid (measure));
   v->measure = measure;
+  dict_var_changed (v);
 }
 
 /* Returns V's display width, which applies only to GUIs. */
@@ -754,11 +779,15 @@
   return v->display_width;
 }
 
+
+
+
 /* Sets V's display width to DISPLAY_WIDTH. */
 void
 var_set_display_width (struct variable *v, int display_width) 
 {
   v->display_width = display_width;
+  dict_var_changed (v);
 }
 
 /* Returns true if A is a valid alignment,
@@ -782,6 +811,7 @@
 {
   assert (alignment_is_valid (alignment));
   v->alignment = alignment;
+  dict_var_changed (v);
 }
 
 /* Whether variables' values should be preserved from case to
@@ -801,6 +831,7 @@
 {
   assert (leave || !var_must_leave (v));
   v->leave = leave;
+  dict_var_changed (v);
 }
 
 /* Returns true if V must be left from case to case,
@@ -842,6 +873,7 @@
     }
   else
     v->short_name[0] = '\0';
+  dict_var_changed (v);
 }
 
 /* Clears V's short name. */
Index: src/data/variable.h
===================================================================
RCS file: /sources/pspp/pspp/src/data/variable.h,v
retrieving revision 1.16
diff -U3 -r1.16 variable.h
--- src/data/variable.h	10 Dec 2006 03:42:51 -0000	1.16
+++ src/data/variable.h	13 Dec 2006 04:34:20 -0000
@@ -62,6 +62,8 @@
 enum var_type var_get_type (const struct variable *);
 int var_get_width (const struct variable *);
 void var_set_width (struct variable *, int width);
+void var_set_decimals (struct variable *v, int decimals);
+
 bool var_is_numeric (const struct variable *);
 bool var_is_alpha (const struct variable *);
 bool var_is_short_string (const struct variable *);
Index: src/language/data-io/get.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/data-io/get.c,v
retrieving revision 1.25
diff -U3 -r1.25 get.c
--- src/language/data-io/get.c	10 Dec 2006 03:42:51 -0000	1.25
+++ src/language/data-io/get.c	13 Dec 2006 04:34:20 -0000
@@ -828,7 +828,7 @@
   mtf.by_cnt = 0;
   mtf.first[0] = '\0';
   mtf.last[0] = '\0';
-  mtf.dict = dict_create ();
+  mtf.dict = dict_create (NULL, NULL);
   mtf.output = NULL;
   case_nullify (&mtf.mtf_case);
   mtf.seq_num = 0;
Index: src/language/expressions/evaluate.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/expressions/evaluate.c,v
retrieving revision 1.13
diff -U3 -r1.13 evaluate.c
--- src/language/expressions/evaluate.c	10 Dec 2006 03:42:51 -0000	1.13
+++ src/language/expressions/evaluate.c	13 Dec 2006 04:34:20 -0000
@@ -159,7 +159,7 @@
 	  
 	  if  ( ds == NULL ) 
 	    {
-	      ds = create_dataset ();
+	      ds = create_dataset (NULL, NULL);
 	      d = dataset_dict (ds);
 	    }
           
Index: src/language/stats/aggregate.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/aggregate.c,v
retrieving revision 1.22
diff -U3 -r1.22 aggregate.c
--- src/language/stats/aggregate.c	10 Dec 2006 03:42:51 -0000	1.22
+++ src/language/stats/aggregate.c	13 Dec 2006 04:34:20 -0000
@@ -190,7 +190,7 @@
   agr.missing = ITEMWISE;
   case_nullify (&agr.break_case);
   
-  agr.dict = dict_create ();
+  agr.dict = dict_create (NULL, NULL);
   agr.src_dict = dict;
   dict_set_label (agr.dict, dict_get_label (dict));
   dict_set_documents (agr.dict, dict_get_documents (dict));
Index: src/ui/gui/automake.mk
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/automake.mk,v
retrieving revision 1.15
diff -U3 -r1.15 automake.mk
--- src/ui/gui/automake.mk	7 Dec 2006 11:10:23 -0000	1.15
+++ src/ui/gui/automake.mk	13 Dec 2006 04:34:21 -0000
@@ -55,8 +55,6 @@
 	src/ui/gui/psppire-dict.h \
 	src/ui/gui/psppire-object.c \
 	src/ui/gui/psppire-object.h \
-	src/ui/gui/psppire-variable.c \
-	src/ui/gui/psppire-variable.h \
 	src/ui/gui/psppire-var-store.c \
 	src/ui/gui/psppire-var-store.h \
 	src/ui/gui/sort-cases-dialog.c \
Index: src/ui/gui/data-sheet.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/data-sheet.c,v
retrieving revision 1.10
diff -U3 -r1.10 data-sheet.c
--- src/ui/gui/data-sheet.c	30 Jul 2006 12:27:59 -0000	1.10
+++ src/ui/gui/data-sheet.c	13 Dec 2006 04:34:21 -0000
@@ -29,7 +29,6 @@
 #include <gtksheet/gsheet-uniform-row.h>
 
 #include "psppire-dict.h"
-#include "psppire-variable.h"
 #include "psppire-data-store.h"
 #include "helper.h"
 
@@ -103,7 +102,7 @@
   PsppireDataStore *data_store = PSPPIRE_DATA_STORE(gtk_sheet_get_model(sheet));
   if (data_store)
     {
-      const struct PsppireVariable *pv = 
+      const struct variable *pv = 
 	psppire_dict_get_variable(data_store->dict, col);
 
       gchar *text ;
@@ -113,7 +112,7 @@
 	return FALSE;
 
       text = g_strdup_printf("%d: %s", row, 
-			     pv ? psppire_variable_get_name(pv) : "");
+			     pv ? var_get_name (pv) : "");
   
       cell_ref_entry = GTK_ENTRY(get_widget_assert(xml, "cell_ref_entry"));
 
Index: src/ui/gui/menu-actions.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/menu-actions.c,v
retrieving revision 1.17
diff -U3 -r1.17 menu-actions.c
--- src/ui/gui/menu-actions.c	7 Dec 2006 11:10:23 -0000	1.17
+++ src/ui/gui/menu-actions.c	13 Dec 2006 04:34:21 -0000
@@ -30,6 +30,7 @@
 #include <data/file-handle-def.h>
 #include <data/sys-file-reader.h>
 #include <data/case.h>
+#include <data/variable.h>
 
 #include <glade/glade.h>
 #include <gtk/gtk.h>
@@ -39,7 +40,7 @@
 #include <gtksheet/gtksheet.h>
 #include "helper.h"
 #include "menu-actions.h"
-#include "psppire-variable.h"
+
 #include "psppire-dict.h"
 
 #include "var-sheet.h"
@@ -398,24 +399,24 @@
 	  case GTK_SHEET_COLUMN_SELECTED:
 	    {
 	      gint fv;
-	      struct PsppireVariable *pv =
-		psppire_dict_get_variable(the_dictionary,
-					  data_sheet->range.col0);
-	      fv = psppire_variable_get_fv(pv);
-
-
-	      psppire_dict_delete_variables(the_dictionary,
-					    data_sheet->range.col0,
-					    1);
+	      struct variable *pv =
+		psppire_dict_get_variable (the_dictionary,
+					   data_sheet->range.col0);
+
+	      fv = var_get_case_index (pv);
+
+	      psppire_dict_delete_variables (the_dictionary,
+					     data_sheet->range.col0,
+					     1);
 
-	      psppire_case_file_insert_values(data_store->case_file,
-					      -1, fv);
+	      psppire_case_file_insert_values (data_store->case_file,
+					       -1, fv);
 	    }
 	    break;
 	  default:
-	    gtk_sheet_cell_clear(data_sheet,
-				 data_sheet->active_cell.row,
-				 data_sheet->active_cell.col);
+	    gtk_sheet_cell_clear (data_sheet,
+				  data_sheet->active_cell.row,
+				  data_sheet->active_cell.col);
 	    break;
 	  }
 
Index: src/ui/gui/missing-val-dialog.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/missing-val-dialog.c,v
retrieving revision 1.5
diff -U3 -r1.5 missing-val-dialog.c
--- src/ui/gui/missing-val-dialog.c	10 Dec 2006 03:42:52 -0000	1.5
+++ src/ui/gui/missing-val-dialog.c	13 Dec 2006 04:34:21 -0000
@@ -32,7 +32,7 @@
 #include <data/missing-values.h>
 #include <data/variable.h>
 #include <data/data-in.h>
-#include "psppire-variable.h"
+
 
 #include <gtk/gtk.h>
 #include <glade/glade.h>
@@ -84,7 +84,7 @@
 {
   struct missing_val_dialog *dialog = data;
 
-  const struct fmt_spec *write_spec = psppire_variable_get_write_spec(dialog->pv);
+  const struct fmt_spec *write_spec = var_get_write_format (dialog->pv);
   
   if ( gtk_toggle_button_get_active(dialog->button_discrete))
     {
@@ -174,9 +174,9 @@
   if (gtk_toggle_button_get_active(dialog->button_none))
     mv_set_type(&dialog->mvl, MV_NONE);
 
-  psppire_variable_set_missing(dialog->pv, &dialog->mvl);
+  var_set_missing_values (dialog->pv, &dialog->mvl);
 
-  gtk_widget_hide(dialog->window);
+  gtk_widget_hide (dialog->window);
 }
 
 
@@ -266,9 +266,9 @@
   g_return_if_fail(dialog);
   g_return_if_fail(dialog->pv);
 
-  mv_copy (&dialog->mvl, psppire_variable_get_missing(dialog->pv));
+  mv_copy (&dialog->mvl, var_get_missing_values (dialog->pv));
 
-  write_spec = psppire_variable_get_write_spec(dialog->pv);
+  write_spec = var_get_write_format (dialog->pv);
 
   /* Blank all entry boxes and make them insensitive */
   gtk_entry_set_text(GTK_ENTRY(dialog->low), "");
@@ -279,7 +279,7 @@
   gtk_widget_set_sensitive(dialog->discrete, FALSE);   
 
   gtk_widget_set_sensitive(GTK_WIDGET(dialog->button_range), 
-			   psppire_variable_get_type(dialog->pv) == VAR_NUMERIC);
+			   var_get_type(dialog->pv) == VAR_NUMERIC);
 
   for(i = 0 ; i < 3 ; ++i ) 
     {
Index: src/ui/gui/missing-val-dialog.h
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/missing-val-dialog.h,v
retrieving revision 1.2
diff -U3 -r1.2 missing-val-dialog.h
--- src/ui/gui/missing-val-dialog.h	15 Mar 2006 03:29:11 -0000	1.2
+++ src/ui/gui/missing-val-dialog.h	13 Dec 2006 04:34:21 -0000
@@ -35,8 +35,8 @@
   GtkWidget *window;
 
   /* The variable whose missing values are to be updated */
-  struct PsppireVariable *pv;
-  
+  struct variable *pv;
+
   /* local copy */
   struct missing_values mvl;
 
Index: src/ui/gui/psppire-data-store.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-data-store.c,v
retrieving revision 1.22
diff -U3 -r1.22 psppire-data-store.c
--- src/ui/gui/psppire-data-store.c	12 Dec 2006 06:44:49 -0000	1.22
+++ src/ui/gui/psppire-data-store.c	13 Dec 2006 04:34:21 -0000
@@ -29,6 +29,7 @@
 #include <data/casefile.h>
 #include <data/case.h>
 #include <data/data-out.h>
+#include <data/variable.h>
 
 #include <gtksheet/gtksheet.h>
 #include <gtksheet/gsheetmodel.h>
@@ -36,7 +37,6 @@
 
 #include <pango/pango-context.h>
 
-#include "psppire-variable.h"
 #include "psppire-data-store.h"
 #include "psppire-case-file.h"
 #include "helper.h"
@@ -299,10 +299,10 @@
   
   if ( var_num > 0 ) 
     {
-      struct PsppireVariable *variable;
+      struct variable *variable;
       variable = psppire_dict_get_variable(store->dict, var_num);
 
-      posn = psppire_variable_get_fv(variable);
+      posn = var_get_case_index (variable);
     }
   else
     {
@@ -441,11 +441,11 @@
 
   for (v = 0 ; v < psppire_dict_get_var_cnt (ds->dict) ; ++v) 
     {
-      const struct PsppireVariable *pv = psppire_dict_get_variable(ds->dict, v);
-      if (VAR_STRING ==  psppire_variable_get_type(pv) ) 
+      const struct variable *pv = psppire_dict_get_variable (ds->dict, v);
+      if (VAR_STRING ==  var_get_type (pv) ) 
 	continue;
 
-      case_data_rw_idx (&cc, psppire_variable_get_fv (pv))->f = SYSMIS;
+      case_data_rw (&cc, pv)->f = SYSMIS;
     }
 
   result = psppire_case_file_insert_case (ds->case_file, &cc, posn);
@@ -462,7 +462,7 @@
   gint idx;
   char *text;
   const struct fmt_spec *fp ;
-  const struct PsppireVariable *pv ;
+  const struct variable *pv ;
   const union value *v ;
   GString *s;
   PsppireDataStore *store = PSPPIRE_DATA_STORE(model);
@@ -478,7 +478,7 @@
 
   pv = psppire_dict_get_variable (store->dict, column);
 
-  idx = psppire_variable_get_fv (pv);
+  idx = var_get_case_index (pv);
 
   v = psppire_case_file_get_value (store->case_file, row, idx);
 
@@ -486,7 +486,7 @@
 
   if ( store->show_labels) 
     {
-      const struct val_labs * vl = psppire_variable_get_value_labels (pv);
+      const struct val_labs * vl = var_get_value_labels (pv);
 
       const gchar *label;
       if ( (label = val_labs_find(vl, *v)) )
@@ -495,7 +495,7 @@
 	}
     }
 
-  fp = psppire_variable_get_write_spec (pv);
+  fp = var_get_write_format (pv);
 
   s = g_string_sized_new (fp->w + 1);
   g_string_set_size (s, fp->w);
@@ -526,17 +526,18 @@
   PsppireDataStore *store = PSPPIRE_DATA_STORE(model);
 
   union value v;
-  const struct PsppireVariable *pv = psppire_dict_get_variable(store->dict, col);
+  const struct variable *pv = psppire_dict_get_variable (store->dict, col);
 
-  const gint index = psppire_variable_get_fv(pv) ;
+  const gint index = var_get_case_index (pv) ;
 
-  if ( psppire_variable_get_type(pv) == VAR_NUMERIC) 
+  if ( var_is_numeric (pv))
     v.f = SYSMIS;
   else
     memcpy(v.s, "", MAX_SHORT_STRING);
 
   psppire_case_file_set_value(store->case_file, row, index, &v, 
-			      psppire_variable_get_width(pv));
+			      var_get_width (pv));
+
   return TRUE;
 }
 
@@ -551,7 +552,7 @@
 {
   PsppireDataStore *store = PSPPIRE_DATA_STORE(model);
 
-  const struct PsppireVariable *pv = psppire_dict_get_variable(store->dict, col);
+  const struct variable *pv = psppire_dict_get_variable(store->dict, col);
   g_return_val_if_fail(pv, FALSE);
 
 #if 0
@@ -570,8 +571,8 @@
 #endif
 
   psppire_case_file_data_in (store->case_file, row,
-                             psppire_variable_get_fv (pv), ss_cstr (text),
-                             psppire_variable_get_write_spec (pv));
+                             var_get_case_index (pv), ss_cstr (text),
+                             var_get_write_format (pv));
   
   return TRUE;
 }
@@ -677,18 +678,18 @@
 static gint
 geometry_get_width(const GSheetColumn *geom, gint unit)
 {
-  const struct PsppireVariable *pv ;
+  const struct variable *pv ;
   PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
 
   if ( unit >= psppire_dict_get_var_cnt(ds->dict) )
     return ds->width_of_m * 8 ;
 
-  pv = psppire_dict_get_variable(ds->dict, unit);
+  pv = psppire_dict_get_variable (ds->dict, unit);
 
   if ( pv == NULL ) 
     return ds->width_of_m * 8 ;
 
-  return ds->width_of_m * psppire_variable_get_columns(pv);
+  return ds->width_of_m * var_get_display_width (pv);
 }
 
 static void
@@ -696,9 +697,9 @@
 {
   PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
 
-  struct PsppireVariable *pv = psppire_dict_get_variable(ds->dict, unit);
+  struct variable *pv = psppire_dict_get_variable (ds->dict, unit);
 
-  psppire_variable_set_columns(pv, width / ds->width_of_m );
+  var_set_display_width (pv, width / ds->width_of_m );
 }
 
 
@@ -707,7 +708,7 @@
 geometry_get_justification(const GSheetColumn *geom, gint unit)
 {
   PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
-  const struct PsppireVariable *pv ;
+  const struct variable *pv ;
 
 
   if ( unit >= psppire_dict_get_var_cnt(ds->dict) )
@@ -717,7 +718,7 @@
 
   /* Kludge: Happily GtkJustification is defined similarly
      to enum alignment from pspp/variable.h */
-  return psppire_variable_get_alignment(pv);
+  return var_get_alignment(pv);
 }
 
 
@@ -727,15 +728,15 @@
 geometry_get_column_button_label(const GSheetColumn *geom, gint unit)
 {
   gchar *text;
-  struct PsppireVariable *pv ;
+  struct variable *pv ;
   PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
 
   if ( unit >= psppire_dict_get_var_cnt(ds->dict) )
     return g_locale_to_utf8(null_var_name, -1, 0, 0, 0);
 
-  pv = psppire_dict_get_variable(ds->dict, unit);
+  pv = psppire_dict_get_variable (ds->dict, unit);
 
-  text =  pspp_locale_to_utf8(psppire_variable_get_name(pv), -1, 0);
+  text =  pspp_locale_to_utf8 (var_get_name (pv), -1, 0);
 
   return text;
 }
Index: src/ui/gui/psppire-dict.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-dict.c,v
retrieving revision 1.10
diff -U3 -r1.10 psppire-dict.c
--- src/ui/gui/psppire-dict.c	5 Dec 2006 15:10:22 -0000	1.10
+++ src/ui/gui/psppire-dict.c	13 Dec 2006 04:34:21 -0000
@@ -31,10 +31,9 @@
 #include <data/dictionary.h>
 #include <data/missing-values.h>
 #include <data/value-labels.h>
-
+#include <data/variable.h>
 
 #include "message-dialog.h"
-#include "psppire-variable.h"
 
 /* --- prototypes --- */
 static void psppire_dict_class_init	(PsppireDictClass	*class);
@@ -165,27 +164,44 @@
 static void
 psppire_dict_finalize (GObject *object)
 {
-  gint v;
   PsppireDict *d = PSPPIRE_DICT (object);
-  
-  for (v = 0 ; v < psppire_dict_get_var_cnt(d) ; ++v ) 
-    g_free(d->variables[v]);
-
-  g_free(d->variables);
-  d->cache_size = 0;
 
   dict_destroy(d->dict);
 
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
+/* Pass on callbacks from src/data/dictionary, as
+   signals in the Gtk library */
 static void
-psppire_dict_init (PsppireDict *psppire_dict)
+addcb (struct dictionary *d, int idx, void *pd)
+{
+  g_signal_emit(pd, signal[VARIABLE_INSERTED], 0, idx);
+}
+
+static void
+delcb (struct dictionary *d, int idx, void *pd)
+{
+  g_signal_emit(pd, signal[VARIABLES_DELETED], 0, idx, 1);
+}
+
+static void
+mutcb (struct dictionary *d, int idx, void *pd)
 {
-  psppire_dict->dict = dict_create();
+  g_signal_emit(pd, signal[VARIABLE_CHANGED], 0, idx);
+}
 
-  psppire_dict->variables = 0; 
-  psppire_dict->cache_size = 0;
+static const struct dict_callbacks gui_callbacks =
+  {
+    addcb,
+    delcb,
+    mutcb
+  };
+
+static void
+psppire_dict_init (PsppireDict *psppire_dict)
+{
+  psppire_dict->dict = dict_create (&gui_callbacks, psppire_dict);
 
   psppire_dict->stamp = g_random_int();
 }
@@ -214,10 +230,6 @@
 {
   PsppireDict *new_dict = g_object_new (G_TYPE_PSPPIRE_DICT, NULL);
   new_dict->dict = d;
-  new_dict->cache_size = dict_get_var_cnt(d);
-  new_dict->variables = g_malloc0(sizeof(struct PsppireVariable *) * 
-				  new_dict->cache_size);
-
 
   return new_dict;
 }
@@ -226,12 +238,11 @@
 /* Returns a valid name for a new variable in DICT.
    The return value is statically allocated */
 static gchar * 
-auto_generate_var_name(PsppireDict *dict)
+auto_generate_var_name (PsppireDict *dict)
 {
   gint d = 0;
   static gchar name[10];
 
-
   while (g_snprintf(name, 10, "VAR%05d",d++),
 	 psppire_dict_lookup_var(dict, name))
     ;
@@ -246,32 +257,10 @@
 psppire_dict_insert_variable(PsppireDict *d, gint idx, const gchar *name)
 {
   struct variable *var ;
-  gint i;
   g_return_if_fail(d);
   g_return_if_fail(G_IS_PSPPIRE_DICT(d));
 
 
-  /* Invalidate the cache from IDX onwards */
-  for ( i = idx ; i < d->cache_size ; ++i ) 
-    {
-      g_free(d->variables[i]);
-      d->variables[i] = 0;
-    }
-
-  /* Ensure that the cache is large enough */
-  if ( dict_get_var_cnt(d->dict) >= d->cache_size ) 
-    {
-      d->variables = g_realloc(d->variables, sizeof(struct PsppireVariable*) * 
-			       (d->cache_size + CACHE_CHUNK));
-      d->cache_size += CACHE_CHUNK;
-    }
-
-  /* Zero the new pointers */
-  for ( ; i < d->cache_size ; ++i ) 
-    {
-      d->variables[i] = 0;
-    }
-
   if ( ! name ) 
     name = auto_generate_var_name(d);
   
@@ -279,10 +268,6 @@
 
   dict_reorder_var(d->dict, var, idx);
 
-  d->variables[idx] = g_malloc(sizeof (struct PsppireVariable));
-  d->variables[idx]->v = var;
-  d->variables[idx]->dict = d;
-
   g_signal_emit(d, signal[VARIABLE_INSERTED], 0, idx );  
 }
 
@@ -295,13 +280,6 @@
   g_return_if_fail(d->dict);
   g_return_if_fail(G_IS_PSPPIRE_DICT(d));
 
-  /* Invalidate all pvs from FIRST onwards */
-  for ( idx = first ; idx < d->cache_size ; ++idx ) 
-    {
-      g_free(d->variables[idx]);
-      d->variables[idx] = 0;
-    }
-
   for (idx = 0 ; idx < n ; ++idx ) 
     {
       struct variable *var;
@@ -345,42 +323,27 @@
 
 
 /* Return the IDXth variable */
-struct PsppireVariable *
+struct variable *
 psppire_dict_get_variable(PsppireDict *d, gint idx)
 {
-  struct PsppireVariable *var ;
   g_return_val_if_fail(d, NULL);
   g_return_val_if_fail(d->dict, NULL);
 
-  if ( ! d->variables) 
-    return NULL;
-  
-  if (idx < 0 || idx >= psppire_dict_get_var_cnt(d))
+  if ( dict_get_var_cnt (d->dict) <= idx )
     return NULL;
 
-  var = d->variables[idx] ; 
-
-  if (! var ) 
-    {
-      var = g_malloc(sizeof (*var));
-      var->dict = d;
-      var->v = dict_get_var(d->dict, idx);
-      d->variables[idx] = var;
-    }
-    
-  return var;
+  return dict_get_var (d->dict, idx);
 }
 
 
 /* Return the number of variables in the dictionary */
-gint 
-psppire_dict_get_var_cnt(const PsppireDict *d)
+gint
+psppire_dict_get_var_cnt (const PsppireDict *d)
 {
-  g_return_val_if_fail(d, -1);
-  g_return_val_if_fail(d->dict, -1);
-  
+  g_return_val_if_fail (d, -1);
+  g_return_val_if_fail (d->dict, -1);
 
-  return dict_get_var_cnt(d->dict);
+  return dict_get_var_cnt (d->dict);
 }
 
 
@@ -390,15 +353,15 @@
 struct variable *
 psppire_dict_lookup_var (const PsppireDict *d, const gchar *name)
 {
-  g_return_val_if_fail(d, NULL);
-  g_return_val_if_fail(d->dict, NULL);
+  g_return_val_if_fail (d, NULL);
+  g_return_val_if_fail (d->dict, NULL);
 
-  return dict_lookup_var(d->dict, name);
+  return dict_lookup_var (d->dict, name);
 }
 
 
 void
-psppire_dict_var_changed(PsppireDict *d, gint idx)
+psppire_dict_var_changed (PsppireDict *d, gint idx)
 {
   g_return_if_fail(d);
 
@@ -407,7 +370,7 @@
 
 
 /* Clears the contents of D */
-void 
+void
 psppire_dict_clear(PsppireDict *d)
 {
   g_return_if_fail(d);
@@ -415,29 +378,21 @@
 
   {
     const gint n_vars = dict_get_var_cnt(d->dict);
-    gint i;
-  
-    dict_clear(d->dict);
 
-    /* Invalidate the entire cache */
-    for ( i = 0 ; i < d->cache_size ; ++i ) 
-      {
-	g_free(d->variables[i]);
-	d->variables[i] = 0;
-      }
+    dict_clear(d->dict);
 
-    g_signal_emit(d, signal[VARIABLES_DELETED], 0, 0, n_vars );  
+    g_signal_emit(d, signal[VARIABLES_DELETED], 0, 0, n_vars );
   }
 }
 
 
 
-/* Return true is NAME would be a valid name of a variable to add to the 
-   dictionary.  False otherwise. 
+/* Return true is NAME would be a valid name of a variable to add to the
+   dictionary.  False otherwise.
    If REPORT is true, then invalid names will be reported as such as errors
 */
 gboolean
-psppire_dict_check_name(const PsppireDict *dict, 
+psppire_dict_check_name(const PsppireDict *dict,
 		     const gchar *name, gboolean report)
 {
   if ( ! var_is_valid_name(name, report ) )
@@ -445,7 +400,7 @@
 
   if (psppire_dict_lookup_var(dict, name))
     {
-      if ( report ) 
+      if ( report )
 	msg(ME,"Duplicate variable name.");
       return FALSE;
     }
@@ -454,62 +409,59 @@
 }
 
 
-inline gint 
+inline gint
 psppire_dict_get_next_value_idx (const PsppireDict *dict)
 {
   return dict_get_next_value_idx(dict->dict);
 }
 
 
-void 
-psppire_dict_resize_variable(PsppireDict *d, const struct PsppireVariable *pv,
-			     gint old_size, gint new_size)
+void
+psppire_dict_resize_variable (PsppireDict *d, const struct variable *pv,
+			      gint old_size, gint new_size)
 {
   gint fv;
   g_return_if_fail (d);
   g_return_if_fail (d->dict);
-  
-  if ( old_size == new_size ) 
+
+  if ( old_size == new_size )
     return ;
 
-  dict_compact_values(d->dict);
+  dict_compact_values (d->dict);
 
-  fv = psppire_variable_get_fv(pv);
+  fv = var_get_case_index (pv);
 
-  g_signal_emit(d, signal[VARIABLE_RESIZED], 0, 
-		fv + old_size, 
-		new_size - old_size );  
+  g_signal_emit(d, signal[VARIABLE_RESIZED], 0,
+		fv + old_size,
+		new_size - old_size );
 }
 
 
-
-
-
 /* Tree Model Stuff */
 
-static GtkTreeModelFlags tree_model_get_flags(GtkTreeModel *model);
+static GtkTreeModelFlags tree_model_get_flags (GtkTreeModel *model);
 
-static gint tree_model_n_columns(GtkTreeModel *model);
+static gint tree_model_n_columns (GtkTreeModel *model);
 
-static GType tree_model_column_type(GtkTreeModel *model, gint index);
+static GType tree_model_column_type (GtkTreeModel *model, gint index);
 
-static gboolean tree_model_get_iter(GtkTreeModel *model, GtkTreeIter *iter, 
-				    GtkTreePath *path);
+static gboolean tree_model_get_iter (GtkTreeModel *model, GtkTreeIter *iter, 
+				     GtkTreePath *path);
 
-static gboolean tree_model_iter_next(GtkTreeModel *model, GtkTreeIter *iter);
+static gboolean tree_model_iter_next (GtkTreeModel *model, GtkTreeIter *iter);
 
-static GtkTreePath * tree_model_get_path(GtkTreeModel *model, 
-					 GtkTreeIter *iter);
+static GtkTreePath * tree_model_get_path (GtkTreeModel *model, 
+					  GtkTreeIter *iter);
 
-static void tree_model_get_value(GtkTreeModel *model, GtkTreeIter *iter,
-				 gint column, GValue *value);
+static void tree_model_get_value (GtkTreeModel *model, GtkTreeIter *iter,
+				  gint column, GValue *value);
 
-static gboolean tree_model_nth_child(GtkTreeModel *model, GtkTreeIter *iter, 
-				     GtkTreeIter *parent, gint n);
+static gboolean tree_model_nth_child (GtkTreeModel *model, GtkTreeIter *iter, 
+				      GtkTreeIter *parent, gint n);
 
 
 static void
-dictionary_tree_model_init(GtkTreeModelIface *iface)
+dictionary_tree_model_init (GtkTreeModelIface *iface)
 {
   iface->get_flags = tree_model_get_flags;
   iface->get_n_columns = tree_model_n_columns;
@@ -527,40 +479,40 @@
 }
 
 static GtkTreeModelFlags
-tree_model_get_flags(GtkTreeModel *model)
+tree_model_get_flags (GtkTreeModel *model)
 {
-  g_return_val_if_fail(G_IS_PSPPIRE_DICT(model), (GtkTreeModelFlags) 0);
+  g_return_val_if_fail (G_IS_PSPPIRE_DICT(model), (GtkTreeModelFlags) 0);
 
   return GTK_TREE_MODEL_LIST_ONLY;
 }
 
 
 static gint
-tree_model_n_columns(GtkTreeModel *model)
+tree_model_n_columns (GtkTreeModel *model)
 {
   return n_DICT_COLS;
 }
 
 static GType
-tree_model_column_type(GtkTreeModel *model, gint index)
+tree_model_column_type (GtkTreeModel *model, gint index)
 {
- g_return_val_if_fail(G_IS_PSPPIRE_DICT(model), (GType) 0);
+  g_return_val_if_fail (G_IS_PSPPIRE_DICT(model), (GType) 0);
 
- switch(index) 
-   {
-   case DICT_TVM_COL_NAME:
-     return G_TYPE_STRING;
-     break;
-   case DICT_TVM_COL_VAR:
-     return G_TYPE_POINTER;
-     break;
-   default:
-     g_return_val_if_reached((GType)0);
-     break;
-   }
+  switch(index) 
+    {
+    case DICT_TVM_COL_NAME:
+      return G_TYPE_STRING;
+      break;
+    case DICT_TVM_COL_VAR:
+      return G_TYPE_POINTER;
+      break;
+    default:
+      g_return_val_if_reached((GType)0);
+      break;
+    }
 
- g_assert_not_reached();
- return ((GType)0);
+  g_assert_not_reached();
+  return ((GType)0);
 }
 
 static gboolean
@@ -568,28 +520,28 @@
 {
   gint *indices, depth;
   gint n;
-  struct PsppireVariable *variable;
+  struct variable *variable;
 
   PsppireDict *dict = PSPPIRE_DICT (model);
 
-  g_return_val_if_fail(path, FALSE);
+  g_return_val_if_fail (path, FALSE);
 
-  indices = gtk_tree_path_get_indices(path);
-  depth = gtk_tree_path_get_depth(path);
+  indices = gtk_tree_path_get_indices (path);
+  depth = gtk_tree_path_get_depth (path);
 
   g_return_val_if_fail(depth == 1, FALSE);
 
   n = indices[0];
 
-  if ( n < 0 || n >= psppire_dict_get_var_cnt(dict)) 
+  if ( n < 0 || n >= psppire_dict_get_var_cnt (dict)) 
     return FALSE;
 
-  variable = psppire_dict_get_variable(dict, n);
+  variable = dict_get_var (dict->dict, n);
 
-  g_assert(psppire_variable_get_index(variable) == n);
+  g_assert (var_get_dict_index (variable) == n);
 
   iter->stamp = dict->stamp;
-  iter->user_data = variable; 
+  iter->user_data = variable;
 
   return TRUE;
 }
@@ -599,7 +551,7 @@
 tree_model_iter_next(GtkTreeModel *model, GtkTreeIter *iter)
 {
   PsppireDict *dict = PSPPIRE_DICT (model);
-  struct PsppireVariable *variable;
+  struct variable *variable;
   gint idx;
 
   g_return_val_if_fail(iter->stamp == dict->stamp, FALSE);
@@ -607,17 +559,17 @@
   if ( iter == NULL || iter->user_data == NULL)
     return FALSE;
 
-  variable = (struct PsppireVariable *) iter->user_data;
+  variable = (struct variable *) iter->user_data;
+
+  idx = var_get_dict_index (variable);
 
-  idx = psppire_variable_get_index(variable);
-  
   if ( idx + 1 >= psppire_dict_get_var_cnt(dict))
     return FALSE;
 
-  variable = psppire_dict_get_variable(dict, idx + 1);
+  variable = psppire_dict_get_variable (dict, idx + 1);
+
+  g_assert (var_get_dict_index (variable) == idx + 1);
 
-  g_assert(psppire_variable_get_index(variable) == idx + 1);
-  
   iter->user_data = variable;
 
   return TRUE;
@@ -627,15 +579,15 @@
 tree_model_get_path(GtkTreeModel *model, GtkTreeIter *iter)
 {
   GtkTreePath *path;
-  struct PsppireVariable *variable;
+  struct variable *variable;
   PsppireDict *dict = PSPPIRE_DICT (model);
 
   g_return_val_if_fail(iter->stamp == dict->stamp, FALSE);
 
-  variable = (struct PsppireVariable *) iter->user_data;
+  variable = (struct variable *) iter->user_data;
 
   path = gtk_tree_path_new();
-  gtk_tree_path_append_index(path, psppire_variable_get_index(variable));
+  gtk_tree_path_append_index(path, var_get_dict_index (variable));
 
   return path;
 }
@@ -645,18 +597,18 @@
 tree_model_get_value(GtkTreeModel *model, GtkTreeIter *iter,
 		     gint column, GValue *value)
 {
-  struct PsppireVariable *variable;
+  struct variable *variable;
   PsppireDict *dict = PSPPIRE_DICT (model);
 
   g_return_if_fail(iter->stamp == dict->stamp);
 
-  variable = (struct PsppireVariable *) iter->user_data;
+  variable = (struct variable *) iter->user_data;
 
   switch(column)
     {
     case DICT_TVM_COL_NAME:
       g_value_init(value, G_TYPE_STRING);
-      g_value_set_string(value, psppire_variable_get_name(variable));
+      g_value_set_string(value, var_get_name(variable));
       break;
     case DICT_TVM_COL_VAR:
       g_value_init(value, G_TYPE_POINTER);
@@ -670,7 +622,7 @@
 
 
 static gboolean
-tree_model_nth_child(GtkTreeModel *model, GtkTreeIter *iter, 
+tree_model_nth_child(GtkTreeModel *model, GtkTreeIter *iter,
 		     GtkTreeIter *parent, gint n)
 {
   PsppireDict *dict;
@@ -678,18 +630,18 @@
 
   dict = PSPPIRE_DICT(model);
 
-  if ( parent ) 
+  if ( parent )
     return FALSE;
 
-  if ( n >= psppire_dict_get_var_cnt(dict) ) 
+  if ( n >= psppire_dict_get_var_cnt(dict) )
     return FALSE;
 
   iter->stamp = dict->stamp;
   iter->user_data = psppire_dict_get_variable(dict, n);
 
-  if ( !iter->user_data) 
+  if ( !iter->user_data)
     return FALSE;
-  
-  
+
+
   return TRUE;
 }
Index: src/ui/gui/psppire-dict.h
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-dict.h,v
retrieving revision 1.6
diff -U3 -r1.6 psppire-dict.h
--- src/ui/gui/psppire-dict.h	17 Jul 2006 10:45:43 -0000	1.6
+++ src/ui/gui/psppire-dict.h	13 Dec 2006 04:34:21 -0000
@@ -54,11 +54,6 @@
   GObject             parent;
   struct dictionary *dict;
 
-  /* Cache of variables */
-  struct PsppireVariable **variables;
-
-  gint cache_size;
-
   /* For GtkTreeModelIface */
   gint stamp;
 };
@@ -94,7 +89,7 @@
 
 /* Return the IDXth variable */
 
-struct PsppireVariable * psppire_dict_get_variable(PsppireDict *d, gint idx);
+struct variable * psppire_dict_get_variable (PsppireDict *d, gint idx);
 
 /* Delete N variables beginning at FIRST */
 void psppire_dict_delete_variables(PsppireDict *d, gint first, gint n);
@@ -102,9 +97,9 @@
 /* Insert a new variable at posn IDX */
 void psppire_dict_insert_variable(PsppireDict *d, gint idx, const gchar *name);
 
-void psppire_dict_resize_variable(PsppireDict *d, 
-				  const struct PsppireVariable *pv,
-				  gint old_size, gint new_size);
+void psppire_dict_resize_variable(PsppireDict *, 
+				  const struct variable *,
+				  gint, gint );
 
 gboolean psppire_dict_check_name(const PsppireDict *dict, 
 			      const gchar *name, gboolean report);
Index: src/ui/gui/psppire-var-store.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-var-store.c,v
retrieving revision 1.14
diff -U3 -r1.14 psppire-var-store.c
--- src/ui/gui/psppire-var-store.c	10 Dec 2006 03:42:52 -0000	1.14
+++ src/ui/gui/psppire-var-store.c	13 Dec 2006 04:34:21 -0000
@@ -32,7 +32,6 @@
 
 #include <gtksheet/gsheetmodel.h>
 
-#include "psppire-variable.h"
 #include "psppire-var-store.h"
 #include "var-sheet.h"
 #include "helper.h"
@@ -63,7 +62,7 @@
 
 static gint psppire_var_store_get_row_count(const GSheetModel * model);
 
-static gchar *text_for_column(const struct PsppireVariable *pv, gint c, GError **err);
+static gchar *text_for_column(const struct variable *pv, gint c, GError **err);
 
 
 static void psppire_var_store_sheet_row_init (GSheetRowIface *iface);
@@ -151,15 +150,15 @@
 {
   const struct fmt_spec *write_spec ;
 
-  struct PsppireVariable *pv = psppire_var_store_get_variable(var_store, row);
+  struct variable *pv = psppire_var_store_get_var (var_store, row);
 
   if ( !pv ) 
     return TRUE;
 
-  if ( VAR_STRING == psppire_variable_get_type(pv) && column == COL_DECIMALS ) 
+  if ( VAR_STRING == var_get_type (pv) && column == COL_DECIMALS ) 
     return FALSE;
 
-  write_spec = psppire_variable_get_write_spec(pv);
+  write_spec =var_get_write_format (pv);
 
   switch ( write_spec->type ) 
     {
@@ -186,6 +185,13 @@
   return TRUE;
 }
 
+
+struct variable * 
+psppire_var_store_get_var (PsppireVarStore *store, gint row)
+{
+  return psppire_dict_get_variable (store->dict, row);
+}
+
 static gboolean
 psppire_var_store_is_editable(const GSheetModel *model, gint row, gint column)
 {
@@ -324,29 +330,17 @@
 {
   PsppireVarStore *store = PSPPIRE_VAR_STORE(model);
 
-  struct PsppireVariable *pv;
+  struct variable *pv;
 
   if ( row >= psppire_dict_get_var_cnt(store->dict))
     return 0;
   
   pv = psppire_dict_get_variable (store->dict, row);
   
-  return text_for_column(pv, column, 0);
+  return text_for_column (pv, column, 0);
 }
 
 
-struct PsppireVariable *
-psppire_var_store_get_variable(PsppireVarStore *store, gint row)
-{
-  g_return_val_if_fail(store, NULL);
-  g_return_val_if_fail(store->dict, NULL);
-
-  if ( row >= psppire_dict_get_var_cnt(store->dict))
-    return 0;
-
-  return psppire_dict_get_variable (store->dict, row);
-}
-
 /* Clears that part of the variable store, if possible, which corresponds 
    to ROW, COL.
    Returns true if anything was updated, false otherwise.
@@ -354,14 +348,14 @@
 static gboolean 
 psppire_var_store_clear(GSheetModel *model,  gint row, gint col)
 {
-  struct PsppireVariable *pv ;
+  struct variable *pv ;
 
   PsppireVarStore *var_store = PSPPIRE_VAR_STORE(model);
 
-  if ( row >= psppire_dict_get_var_cnt(var_store->dict))
+  if ( row >= psppire_dict_get_var_cnt (var_store->dict))
       return FALSE;
 
-  pv = psppire_var_store_get_variable(var_store, row);
+  pv = psppire_var_store_get_var (var_store, row);
 
   if ( !pv ) 
     return FALSE;
@@ -369,7 +363,7 @@
   switch (col)
     {
     case COL_LABEL:
-      psppire_variable_set_label(pv, 0);
+      var_set_label (pv, 0);
       return TRUE;
       break;
     }
@@ -385,36 +379,41 @@
 psppire_var_store_set_string(GSheetModel *model, 
 			  const gchar *text, gint row, gint col)
 {
-  struct PsppireVariable *pv ;
+  struct variable *pv ;
 
   PsppireVarStore *var_store = PSPPIRE_VAR_STORE(model);
 
   if ( row >= psppire_dict_get_var_cnt(var_store->dict))
       return FALSE;
 
-  pv = psppire_var_store_get_variable(var_store, row);
+  pv = psppire_var_store_get_var (var_store, row);
+
   if ( !pv ) 
     return FALSE;
 
   switch (col)
     {
     case COL_NAME:
-      return psppire_variable_set_name(pv, text);
+      var_set_name (pv, text);
+      return TRUE;
       break;
     case COL_COLUMNS:
       if ( ! text) return FALSE;
-      return psppire_variable_set_columns(pv, atoi(text));
+      var_set_display_width (pv, atoi(text));
+      return TRUE;
       break;
     case COL_WIDTH:
       if ( ! text) return FALSE;
-      return psppire_variable_set_width(pv, atoi(text));
+      var_set_width (pv, atoi(text));
+      return TRUE;
       break;
     case COL_DECIMALS:
       if ( ! text) return FALSE;
-      return psppire_variable_set_decimals(pv, atoi(text));
+      var_set_decimals (pv, atoi(text));
+      return TRUE;
       break;
     case COL_LABEL:
-      psppire_variable_set_label(pv, text);
+      var_set_label(pv, text);
       return TRUE;
       break;
     case COL_TYPE:
@@ -435,7 +434,7 @@
 
 
 static  gchar *
-text_for_column(const struct PsppireVariable *pv, gint c, GError **err)
+text_for_column(const struct variable *pv, gint c, GError **err)
 {
   static gchar none[] = N_("None");
 
@@ -453,12 +452,12 @@
   enum {VT_NUMERIC, VT_COMMA, VT_DOT, VT_SCIENTIFIC, VT_DATE, VT_DOLLAR, 
 	VT_CUSTOM, VT_STRING};
 
-  const struct fmt_spec *write_spec = psppire_variable_get_write_spec(pv);
+  const struct fmt_spec *write_spec = var_get_write_format (pv);
 
   switch (c)
     {
     case COL_NAME:
-      return pspp_locale_to_utf8(psppire_variable_get_name(pv), -1, err);
+      return pspp_locale_to_utf8 ( var_get_name (pv), -1, err);
       break;
     case COL_TYPE:
       {
@@ -538,20 +537,20 @@
       {
 	gchar *s;
 	GString *gstr = g_string_sized_new(10);
-	g_string_printf(gstr, _("%d"), psppire_variable_get_columns(pv));
+	g_string_printf(gstr, _("%d"), var_get_display_width (pv));
 	s = g_locale_to_utf8(gstr->str, gstr->len, 0, 0, err);
 	g_string_free(gstr, TRUE);
 	return s;
       }
       break;
     case COL_LABEL:
-      return pspp_locale_to_utf8(psppire_variable_get_label(pv), -1, err);
+      return pspp_locale_to_utf8 (var_get_label (pv), -1, err);
       break;
 
     case COL_MISSING:
       {
 	gchar *s;
-	const struct missing_values *miss = psppire_variable_get_missing(pv);
+	const struct missing_values *miss = var_get_missing_values (pv);
 	if ( mv_is_empty(miss)) 
 	  return g_locale_to_utf8(gettext(none), -1, 0, 0, err);
 	else
@@ -611,47 +610,48 @@
       break;
     case COL_VALUES:
       {
-	const struct val_labs *vls = psppire_variable_get_value_labels(pv);
-	if ( ! vls || 0 == val_labs_count(vls) ) 
-	  return g_locale_to_utf8(gettext(none), -1, 0, 0, err);
+	const struct val_labs *vls = var_get_value_labels (pv);
+	if ( ! vls || 0 == val_labs_count (vls) ) 
+	  return g_locale_to_utf8 (gettext (none), -1, 0, 0, err);
 	else
 	  {
 	    gchar *ss;
-	    GString *gstr = g_string_sized_new(10);
+	    GString *gstr = g_string_sized_new (10);
 	    struct val_labs_iterator *ip = 0;
 	    struct val_lab *vl = val_labs_first_sorted (vls, &ip);
 
-	    g_assert(vl);
+	    g_assert (vl);
 
 	    {
-	      gchar *const vstr = value_to_text(vl->value, *write_spec);
+	      gchar *const vstr = value_to_text (vl->value, *write_spec);
 
-	      g_string_printf(gstr, "{%s,\"%s\"}_", vstr, vl->label);
-	      g_free(vstr);
+	      g_string_printf (gstr, "{%s,\"%s\"}_", vstr, vl->label);
+	      g_free (vstr);
 	    }
 
-	    val_labs_done(&ip);
-	    
-	    ss = pspp_locale_to_utf8(gstr->str, gstr->len, err);
-	    g_string_free(gstr, TRUE);
+	    val_labs_done (&ip);
+
+	    ss = pspp_locale_to_utf8 (gstr->str, gstr->len, err);
+	    g_string_free (gstr, TRUE);
 	    return ss;
 	  }
       }
       break;
     case COL_ALIGN:
       {
-	const gint align = psppire_variable_get_alignment(pv);
+	const gint align = var_get_alignment(pv);
 
-	g_assert(align < n_ALIGNMENTS);
+	g_assert (align < n_ALIGNMENTS);
 	return g_locale_to_utf8(gettext(alignments[align]), -1, 0, 0, err);
       }
       break;
     case COL_MEASURE:
       {
-	const gint measure = psppire_variable_get_measure(pv);
+	const gint measure = var_get_measure (pv);
 
-	g_assert(measure < n_MEASURES);
-	return g_locale_to_utf8(gettext(measures[measure]), -1, 0, 0, err);
+	g_assert (measure - 1 < n_MEASURES);
+	return g_locale_to_utf8 (gettext (measures[measure - 1]),
+				 -1, 0, 0, err);
       }
       break;
     }
Index: src/ui/gui/psppire-var-store.h
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-var-store.h,v
retrieving revision 1.3
diff -U3 -r1.3 psppire-var-store.h
--- src/ui/gui/psppire-var-store.h	30 May 2006 12:01:33 -0000	1.3
+++ src/ui/gui/psppire-var-store.h	13 Dec 2006 04:34:21 -0000
@@ -77,14 +77,12 @@
 GType         psppire_var_store_get_type         (void) G_GNUC_CONST;
 PsppireVarStore *psppire_var_store_new              (PsppireDict *dict);
 struct variable * psppire_var_store_get_var (PsppireVarStore *store, gint row);
-struct PsppireVariable * psppire_var_store_get_variable(PsppireVarStore *store, 
-						  gint row);
 
-void psppire_var_store_set_dictionary(PsppireVarStore *var_store, PsppireDict *dict);
+void psppire_var_store_set_dictionary (PsppireVarStore *var_store, PsppireDict *dict);
 
 
 /* Return the number of variables */
-gint psppire_var_store_get_var_cnt(PsppireVarStore      *var_store);
+gint psppire_var_store_get_var_cnt (PsppireVarStore      *var_store);
 
 void psppire_var_store_set_font(PsppireVarStore *store, const PangoFontDescription *fd);
 
Index: src/ui/gui/sort-cases-dialog.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/sort-cases-dialog.c,v
retrieving revision 1.1
diff -U3 -r1.1 sort-cases-dialog.c
--- src/ui/gui/sort-cases-dialog.c	24 Jun 2006 09:08:50 -0000	1.1
+++ src/ui/gui/sort-cases-dialog.c	13 Dec 2006 04:34:21 -0000
@@ -46,7 +46,6 @@
    8. The dialog box structure itself ought to be a GtkWindow and
       abstracted better.
 */
-   
 
 
 #include <config.h>
@@ -54,7 +53,6 @@
 #include "sort-cases-dialog.h"
 #include "psppire-dict.h"
 #include <math/sort.h>
-#include "psppire-variable.h"
 
 #include <gettext.h>
 #define _(msgid) gettext (msgid)
@@ -155,7 +153,7 @@
   GtkTreeIter new_iter;
   gint index;
   gint dir;
-  struct PsppireVariable *variable;
+  struct variable *variable;
   struct sort_cases_dialog *dialog = (struct sort_cases_dialog*) data;
 
   /* Get the variable from the dictionary */
@@ -163,7 +161,7 @@
 		      DICT_TVM_COL_VAR, &variable,
 		      -1);
 	
-  index = psppire_variable_get_index(variable);
+  index = var_get_dict_index (variable);
 
   dir = gtk_toggle_button_get_active (dialog->ascending_button) ? 
     SRT_ASCEND:SRT_DESCEND;
@@ -263,7 +261,7 @@
 		     gpointer data)
 {
   gint var_index;
-  struct PsppireVariable *variable ;
+  struct variable *variable ;
   gint direction;
   gchar *buf;
   gchar *varname;
@@ -275,7 +273,7 @@
 
   variable = psppire_dict_get_variable(dict, var_index);
 
-  varname = pspp_locale_to_utf8(psppire_variable_get_name(variable),
+  varname = pspp_locale_to_utf8 (var_get_name(variable),
 				-1, 0);
 
   if ( direction == SRT_ASCEND) 
@@ -464,7 +462,7 @@
       valid;
       valid = gtk_tree_model_iter_next(model, &iter))
     {
-      struct PsppireVariable *variable;
+      struct variable *variable;
       gint index;
       struct sort_criterion *scn = &criteria->crits[n];
       g_assert ( n < criteria->crit_cnt);
@@ -477,8 +475,8 @@
 
       variable = psppire_dict_get_variable(dict, index);
 
-      scn->fv    = psppire_variable_get_fv(variable);
-      scn->width = psppire_variable_get_width(variable);
+      scn->fv    = var_get_case_index (variable);
+      scn->width = var_get_width(variable);
     }
 }
 
Index: src/ui/gui/val-labs-dialog.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/val-labs-dialog.c,v
retrieving revision 1.6
diff -U3 -r1.6 val-labs-dialog.c
--- src/ui/gui/val-labs-dialog.c	12 Dec 2006 06:44:49 -0000	1.6
+++ src/ui/gui/val-labs-dialog.c	13 Dec 2006 04:34:21 -0000
@@ -29,7 +29,6 @@
 #include "helper.h"
 #include "val-labs-dialog.h"
 #include <data/value-labels.h>
-#include "psppire-variable.h"
 
 /* This callback occurs when the text in the label entry box
    is changed */
@@ -44,7 +43,7 @@
   text = gtk_entry_get_text(GTK_ENTRY(dialog->value_entry));
 
   text_to_value(text, &v,
-		*psppire_variable_get_write_spec(dialog->pv));
+		*var_get_write_format (dialog->pv));
 
 
   if ( val_labs_find (dialog->labs, v) )
@@ -114,7 +113,7 @@
 
   union value v;
   text_to_value(text, &v,
-		*psppire_variable_get_write_spec(dialog->pv));
+		*var_get_write_format (dialog->pv));
 
 
   g_signal_handler_block(GTK_ENTRY(dialog->label_entry),
@@ -148,9 +147,10 @@
 {
   struct val_labs_dialog *dialog = data;
 
-  psppire_variable_set_value_labels(dialog->pv, dialog->labs);
+  var_set_value_labels (dialog->pv, dialog->labs);
 
   val_labs_destroy (dialog->labs);
+
   dialog->labs = 0;
 
   return FALSE;
@@ -210,12 +210,12 @@
   union value v;
 
   text_to_value(val_text, &v,
-		*psppire_variable_get_write_spec(dialog->pv));
+		*var_get_write_format (dialog->pv));
 
   val_labs_replace (dialog->labs, v,
-		    gtk_entry_get_text(GTK_ENTRY(dialog->label_entry)));
+		    gtk_entry_get_text (GTK_ENTRY(dialog->label_entry)));
 
-  gtk_widget_set_sensitive(dialog->change_button, FALSE);
+  gtk_widget_set_sensitive (dialog->change_button, FALSE);
 
   repopulate_dialog(dialog);
 
@@ -233,14 +233,14 @@
   const gchar *text = gtk_entry_get_text(GTK_ENTRY(dialog->value_entry));
 
   text_to_value(text, &v,
-		*psppire_variable_get_write_spec(dialog->pv));
+		*var_get_write_format (dialog->pv));
 
 
   if ( ! val_labs_add (dialog->labs, v,
-		       gtk_entry_get_text(GTK_ENTRY(dialog->label_entry)) ) )
+		       gtk_entry_get_text
+		       ( GTK_ENTRY (dialog->label_entry)) ) )
     return FALSE;
 
-
   gtk_widget_set_sensitive(dialog->add_button, FALSE);
 
   repopulate_dialog(dialog);
@@ -279,7 +279,7 @@
   struct val_lab * vl  = get_selected_tuple(dialog);
 
   gchar *const text = value_to_text(vl->value,
-				    *psppire_variable_get_write_spec(dialog->pv));
+				    *var_get_write_format (dialog->pv));
 
   g_signal_handler_block(GTK_ENTRY(dialog->value_entry),
 			 dialog->value_handler_id);
@@ -420,7 +420,7 @@
 
       gchar *const vstr  =
 	value_to_text(vl->value,
-		      *psppire_variable_get_write_spec(dialog->pv));
+		      *var_get_write_format (dialog->pv));
 
       gchar *labeltext =
 	pspp_locale_to_utf8(vl->label, -1, 0);
@@ -455,13 +455,13 @@
 
   g_assert(!dialog->labs);
 
-  value_labels = psppire_variable_get_value_labels (dialog->pv);
+  value_labels = var_get_value_labels (dialog->pv);
 
   if (value_labels)
     dialog->labs = val_labs_copy ( value_labels );
   else
-    dialog->labs = val_labs_create ( psppire_variable_get_width (dialog->pv));
-
+    dialog->labs = val_labs_create ( var_get_width (dialog->pv));
+  
   gtk_widget_set_sensitive(dialog->remove_button, FALSE);
   gtk_widget_set_sensitive(dialog->change_button, FALSE);
   gtk_widget_set_sensitive(dialog->add_button, FALSE);
Index: src/ui/gui/val-labs-dialog.h
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/val-labs-dialog.h,v
retrieving revision 1.1
diff -U3 -r1.1 val-labs-dialog.h
--- src/ui/gui/val-labs-dialog.h	4 Mar 2006 01:11:58 -0000	1.1
+++ src/ui/gui/val-labs-dialog.h	13 Dec 2006 04:34:21 -0000
@@ -40,7 +40,7 @@
 
 
   /* The variable to be updated */
-  struct PsppireVariable *pv;
+  struct variable *pv;
 
   /* Local copy of labels */
   struct val_labs *labs;
Index: src/ui/gui/var-sheet.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/var-sheet.c,v
retrieving revision 1.9
diff -U3 -r1.9 var-sheet.c
--- src/ui/gui/var-sheet.c	10 Dec 2006 03:42:52 -0000	1.9
+++ src/ui/gui/var-sheet.c	13 Dec 2006 04:34:21 -0000
@@ -46,7 +46,6 @@
 #include "helper.h"
 #include "menu-actions.h"
 #include "psppire-dict.h"
-#include "psppire-variable.h"
 #include "var-type-dialog.h"
 #include "var-sheet.h"
 #include "customentry.h"
@@ -141,28 +140,28 @@
 change_alignment(GtkComboBox *cb,
     gpointer user_data)
 {
-  struct PsppireVariable *pv = user_data;
+  struct variable *pv = user_data;
   gint active_item = gtk_combo_box_get_active(cb);
 
   if ( active_item < 0 ) return ;
 
-  psppire_variable_set_alignment(pv, active_item);
+  var_set_alignment (pv, active_item);
 }
 
 
 
 /* Callback for when the measure combo box 
    item is selected */
-static void        
+static void
 change_measure(GtkComboBox *cb,
     gpointer user_data)
 {
-  struct PsppireVariable *pv = user_data;
+  struct variable *pv = user_data;
   gint active_item = gtk_combo_box_get_active(cb);
 
   if ( active_item < 0 ) return ;
 
-  psppire_variable_set_measure(pv, active_item);
+  var_set_measure (pv, active_item + 1);
 }
 
 
@@ -215,7 +214,7 @@
 {
   GtkSheetCellAttr attributes;
   PsppireVarStore *var_store ;
-  struct PsppireVariable *pv ;
+  struct variable *pv ;
 
   g_return_val_if_fail(sheet != NULL, FALSE);
 
@@ -233,7 +232,7 @@
 
   gtk_sheet_get_attributes(sheet, row, column, &attributes);
 
-  pv = psppire_var_store_get_variable(var_store, row);
+  pv = psppire_var_store_get_var (var_store, row);
 
   switch (column)
     {
@@ -267,15 +266,15 @@
 	  GTK_COMBO_BOX_ENTRY(gtk_sheet_get_entry(sheet)->parent);
 
 
-	if ( ! list_store) list_store = create_label_list(measures);
+	if ( ! list_store) list_store = create_label_list (measures);
 
 	gtk_combo_box_set_model(GTK_COMBO_BOX(cbe), 
 				GTK_TREE_MODEL(list_store));
 
 	gtk_combo_box_entry_set_text_column (cbe, 0);
 
-	g_signal_connect(G_OBJECT(cbe),"changed", 
-			 G_CALLBACK(change_measure), pv);
+	g_signal_connect (G_OBJECT(cbe),"changed",
+			  G_CALLBACK (change_measure), pv);
       }
       break;
 
@@ -315,7 +314,7 @@
 	if (!missing_val_dialog ) 
 	    missing_val_dialog = missing_val_dialog_create(xml);
 
-	missing_val_dialog->pv = psppire_var_store_get_variable(var_store, row);
+	missing_val_dialog->pv = psppire_var_store_get_var (var_store, row);
 
 	g_signal_connect_swapped(GTK_OBJECT(customEntry),
 				 "clicked",
@@ -367,12 +366,12 @@
 	      const gint current_value  = atoi(s);
 	      GtkObject *adj ;
 
-	      const struct fmt_spec *fmt = psppire_variable_get_write_spec(pv);
+	      const struct fmt_spec *fmt = var_get_write_format (pv);
 	      switch (column) 
 		{
 		case COL_WIDTH:
 		  r_min = fmt->d + 1;
-		  r_max = (psppire_variable_get_type(pv) == VAR_STRING) ? MAX_STRING : 40;
+		  r_max = (var_get_type (pv) == VAR_STRING) ? MAX_STRING : 40;
 		  break;
 		case COL_DECIMALS:
 		  r_min = 0 ; 
Index: src/ui/gui/var-type-dialog.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/var-type-dialog.c,v
retrieving revision 1.8
diff -U3 -r1.8 var-type-dialog.c
--- src/ui/gui/var-type-dialog.c	10 Dec 2006 04:03:34 -0000	1.8
+++ src/ui/gui/var-type-dialog.c	13 Dec 2006 04:34:21 -0000
@@ -32,7 +32,6 @@
 
 #include "var-type-dialog.h"
 
-#include "psppire-variable.h"
 #include "helper.h"
 
 #include <data/variable.h>
@@ -130,7 +129,7 @@
 static void
 set_local_width_decimals(struct var_type_dialog *dialog)
 {
-  dialog->fmt_l = * psppire_variable_get_write_spec(dialog->pv);
+  dialog->fmt_l = * var_get_write_format (dialog->pv);
 
   switch (dialog->active_button) 
     {
@@ -665,7 +664,7 @@
   g_assert(dialog->pv);
 
   /* Populate width and decimals */
-  write_spec = psppire_variable_get_write_spec(dialog->pv);
+  write_spec = var_get_write_format (dialog->pv);
 
   g_string_printf(str, "%d", write_spec->d);
 
@@ -820,12 +819,11 @@
 	break;
       }
 
-    if ( result == true ) 
+    if ( result == true )
       {
-	psppire_variable_set_type(dialog->pv, new_type);
-	psppire_variable_set_width(dialog->pv, new_width);
-	psppire_variable_set_write_spec(dialog->pv, spec);
-	psppire_variable_set_print_spec(dialog->pv, spec);
+	var_set_width (dialog->pv, new_width);
+	var_set_write_format (dialog->pv, &spec);
+	var_set_print_format (dialog->pv, &spec);
       }
 
   }
Index: src/ui/gui/var-type-dialog.h
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/var-type-dialog.h,v
retrieving revision 1.2
diff -U3 -r1.2 var-type-dialog.h
--- src/ui/gui/var-type-dialog.h	15 Mar 2006 03:29:11 -0000	1.2
+++ src/ui/gui/var-type-dialog.h	13 Dec 2006 04:34:21 -0000
@@ -50,7 +50,7 @@
   GtkWidget *window;
 
   /* Variable to be updated */
-  struct PsppireVariable *pv;
+  struct variable *pv;
 #if 0
   struct variable *var;
 
Index: src/ui/terminal/main.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/terminal/main.c,v
retrieving revision 1.25
diff -U3 -r1.25 main.c
--- src/ui/terminal/main.c	7 Dec 2006 11:34:17 -0000	1.25
+++ src/ui/terminal/main.c	13 Dec 2006 04:34:21 -0000
@@ -105,7 +105,7 @@
   readln_initialize ();
   settings_init ();
   random_init ();
-  the_dataset = create_dataset ();
+  the_dataset = create_dataset (NULL, NULL);
 
   if (parse_command_line (argc, argv, the_source_stream))
     {
@@ -131,7 +131,7 @@
             check_msg_count (the_source_stream);
         }
     }
-  
+
   terminate (!any_errors ());
 }
 
