pspp-cvs
[Top][All Lists]
Advanced

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

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


From: John Darrington
Subject: [Pspp-cvs] pspp/src data/ChangeLog data/dictionary.c data/...
Date: Wed, 10 Jan 2007 09:22:42 +0000

CVSROOT:        /sources/pspp
Module name:    pspp
Changes by:     John Darrington <jmd>   07/01/10 09:22:42

Modified files:
        src/data       : ChangeLog dictionary.c procedure.c 
        src/language/stats: rank.q 
        src/ui/gui     : ChangeLog psppire-case-file.c 
                         psppire-data-store.c psppire.c 
                         syntax-editor-source.c syntax-editor.c 

Log message:
        Patch #5672

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/ChangeLog?cvsroot=pspp&r1=1.97&r2=1.98
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/dictionary.c?cvsroot=pspp&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/procedure.c?cvsroot=pspp&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/rank.q?cvsroot=pspp&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/ChangeLog?cvsroot=pspp&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/psppire-case-file.c?cvsroot=pspp&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/psppire-data-store.c?cvsroot=pspp&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/psppire.c?cvsroot=pspp&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/syntax-editor-source.c?cvsroot=pspp&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/syntax-editor.c?cvsroot=pspp&r1=1.12&r2=1.13

Patches:
Index: data/ChangeLog
===================================================================
RCS file: /sources/pspp/pspp/src/data/ChangeLog,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -b -r1.97 -r1.98
--- data/ChangeLog      7 Jan 2007 04:04:00 -0000       1.97
+++ data/ChangeLog      10 Jan 2007 09:22:42 -0000      1.98
@@ -1,3 +1,9 @@
+Tue Jan  9 07:20:05 WST 2007 John Darrington <address@hidden>
+
+       * dictionary.c procedure.c: More changes to ensure that callbacks occur
+       whenever appropriate, but only when the dataset/dictionary is in a 
+       consistent state.
+
 Sun Jan  7 08:33:04 WST 2007 John Darrington <address@hidden>
 
        * dictionary.c dictionary.h : Added callbacks for change of filter and 

Index: data/dictionary.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/dictionary.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- data/dictionary.c   7 Jan 2007 04:04:00 -0000       1.29
+++ data/dictionary.c   10 Jan 2007 09:22:42 -0000      1.30
@@ -155,17 +155,17 @@
 {
   /* FIXME?  Should we really clear case_limit, label, documents?
      Others are necessarily cleared by deleting all the variables.*/
-  int i;
-
   assert (d != NULL);
 
-  for (i = 0; i < d->var_cnt; i++)
+  while (d->var_cnt > 0 )
     {
-      if (d->callbacks &&  d->callbacks->var_deleted )
-       d->callbacks->var_deleted (d, i, d->cb_data);
+      var_clear_vardict (d->var[d->var_cnt - 1]);
+      var_destroy (d->var[d->var_cnt -1]);
 
-      var_clear_vardict (d->var[i]);
-      var_destroy (d->var[i]);
+      d->var_cnt--;
+
+      if (d->callbacks &&  d->callbacks->var_deleted )
+       d->callbacks->var_deleted (d, d->var_cnt, d->cb_data);
     }
   free (d->var);
   d->var = NULL;
@@ -291,7 +291,7 @@
   hsh_force_insert (d->name_tab, v);
 
   if ( d->callbacks &&  d->callbacks->var_added )
-    d->callbacks->var_added (d, d->next_value_idx, d->cb_data);
+    d->callbacks->var_added (d, var_get_dict_index (v), d->cb_data);
 
   d->next_value_idx += var_get_value_cnt (v);
 

Index: data/procedure.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/procedure.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- data/procedure.c    7 Jan 2007 04:04:00 -0000       1.23
+++ data/procedure.c    10 Jan 2007 09:22:42 -0000      1.24
@@ -233,8 +233,6 @@
 
   if ( proc_close (ds) && ok )
     {
-      if ( ds->replace_source )
-       ds->replace_source (ds->proc_source);
 
       return true;
     }
@@ -347,7 +345,7 @@
         break;
     }
   ds->ok = free_case_source (ds->proc_source) && ds->ok;
-  ds->proc_source = NULL;
+  proc_set_source (ds, NULL);
 
   case_destroy (&ds->sink_case);
   case_destroy (&ds->trns_case);
@@ -492,7 +490,7 @@
 
   /* Old data sink becomes new data source. */
   if (ds->proc_sink->class->make_source != NULL)
-    ds->proc_source = ds->proc_sink->class->make_source (ds->proc_sink);
+    proc_set_source (ds, ds->proc_sink->class->make_source (ds->proc_sink) );
   free_case_sink (ds->proc_sink);
   ds->proc_sink = NULL;
 
@@ -727,10 +725,7 @@
   ds->n_lag = 0;
 
   free_case_source (ds->proc_source);
-  ds->proc_source = NULL;
-  if ( ds->replace_source )
-    ds->replace_source (ds->proc_source);
-
+  proc_set_source (ds, NULL);
 
   proc_cancel_all_transformations (ds);
 }
@@ -902,8 +897,10 @@
 void
 proc_set_source (struct dataset *ds, struct case_source *source)
 {
-  assert (ds->proc_source == NULL);
   ds->proc_source = source;
+
+  if ( ds->replace_source )
+    ds->replace_source (ds->proc_source);
 }
 
 /* Returns true if a source for the next procedure has been
@@ -931,7 +928,7 @@
   assert (!proc_in_temporary_transformations (ds));
 
   casefile = storage_source_decapsulate (ds->proc_source);
-  ds->proc_source = NULL;
+  proc_set_source (ds, NULL);
 
   return casefile;
 }

Index: language/stats/rank.q
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/rank.q,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- language/stats/rank.q       23 Dec 2006 06:11:33 -0000      1.25
+++ language/stats/rank.q       10 Jan 2007 09:22:42 -0000      1.26
@@ -1,7 +1,5 @@
 /* PSPP - RANK. -*-c-*-
-
-Copyright (C) 2005, 2006 Free Software Foundation, Inc.
-        Ben Pfaff <address@hidden>.
+Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as
@@ -742,9 +740,7 @@
   n_group_vars = 0;
   
   for (i = 0 ; i <  n_rank_specs ; ++i )
-    {
       free (rank_specs[i].destvars);
-    }
       
   free (rank_specs);
   rank_specs = NULL;
@@ -912,13 +908,14 @@
     criteria.crit_cnt = 1;
     
     sort_active_file_in_place (ds, &criteria);
-}
+  }
 
   /* ... and we don't need our sort key anymore. So delete it */
   dict_delete_var (dataset_dict (ds), order);
 
   rank_cleanup();
 
+
   return (result ? CMD_SUCCESS : CMD_CASCADING_FAILURE);
 }
 

Index: ui/gui/ChangeLog
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/ChangeLog,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- ui/gui/ChangeLog    7 Jan 2007 04:04:00 -0000       1.35
+++ ui/gui/ChangeLog    10 Jan 2007 09:22:42 -0000      1.36
@@ -1,3 +1,14 @@
+Wed Jan 10 07:20:39 WST 2007 John Darrington <address@hidden>
+
+       * psppire-case-file.c : Make sure there is always a valid flexifile
+
+       * psppire-data-store.c : assertions.
+
+       * psppire.c: Ignore replace source callbacks if the new source is 
+         not of storiage_source_class
+
+       * syntax-editor.c: Close/Abort source after parsing is complete.
+
 Sun Jan  7 08:38:29 WST 2007 John Darrington <address@hidden>
 
        * psppire-dict.c: Add FILTER_CHANGED and SPLIT_CHANGED signals 

Index: ui/gui/psppire-case-file.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-case-file.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- ui/gui/psppire-case-file.c  1 Jan 2007 01:44:33 -0000       1.14
+++ ui/gui/psppire-case-file.c  10 Jan 2007 09:22:42 -0000      1.15
@@ -157,6 +157,8 @@
 {
   PsppireCaseFile *cf = g_object_new (G_TYPE_PSPPIRE_CASE_FILE, NULL);
 
+  cf->flexifile = flexifile_create (0);
+
   return cf;
 }
 

Index: ui/gui/psppire-data-store.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-data-store.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- ui/gui/psppire-data-store.c 1 Jan 2007 01:44:33 -0000       1.31
+++ ui/gui/psppire-data-store.c 10 Jan 2007 09:22:42 -0000      1.32
@@ -317,8 +317,10 @@
 
   if ( var_num > 0 )
     {
-      struct variable *variable;
-      variable = psppire_dict_get_variable (store->dict, var_num);
+      struct variable *variable =
+       psppire_dict_get_variable (store->dict, var_num);
+
+      g_assert (variable != NULL);
 
       posn = var_get_case_index (variable);
     }
@@ -367,7 +369,6 @@
 
   psppire_data_store_set_dictionary (retval, dict);
 
-
   return retval;
 }
 
@@ -394,6 +395,8 @@
 
   data_store->case_file = psppire_case_file_new ();
 
+
+
   g_signal_connect (data_store->case_file, "cases-deleted",
                   G_CALLBACK (delete_cases_callback),
                   data_store);
@@ -496,8 +499,12 @@
 
   pv = psppire_dict_get_variable (store->dict, column);
 
+  g_assert (pv);
+
   idx = var_get_case_index (pv);
 
+  g_assert (idx >= 0);
+
   v = psppire_case_file_get_value (store->case_file, row, idx);
 
   g_return_val_if_fail (v, NULL);

Index: ui/gui/psppire.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- ui/gui/psppire.c    1 Jan 2007 01:44:33 -0000       1.33
+++ ui/gui/psppire.c    10 Jan 2007 09:22:42 -0000      1.34
@@ -29,6 +29,7 @@
 #include <data/file-handle-def.h>
 #include <data/format.h>
 #include <data/storage-stream.h>
+#include <data/case-source.h>
 #include <data/settings.h>
 #include <data/file-name.h>
 #include <data/procedure.h>
@@ -78,9 +79,14 @@
     psppire_case_file_replace_flexifile (the_data_store->case_file,
                                         (struct flexifile *) flexifile_create 
(0));
   else
+    {
+      if ( ! case_source_is_class (s, &storage_source_class))
+       return ;
+
     psppire_case_file_replace_flexifile (the_data_store->case_file,
                                         (struct flexifile *)
                                         storage_source_get_casefile (s));
+    }
 }
 
 

Index: ui/gui/syntax-editor-source.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/syntax-editor-source.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4

Index: ui/gui/syntax-editor.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/syntax-editor.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- ui/gui/syntax-editor.c      1 Jan 2007 01:44:33 -0000       1.12
+++ ui/gui/syntax-editor.c      10 Jan 2007 09:22:42 -0000      1.13
@@ -228,6 +228,8 @@
       if (result == CMD_EOF || result == CMD_FINISH)
        break;
     }
+
+  getl_abort_noninteractive (the_source_stream);
 }
 
 /* Parse and execute all the text in the buffer */




reply via email to

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