pspp-cvs
[Top][All Lists]
Advanced

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

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


From: Ben Pfaff
Subject: [Pspp-cvs] pspp/src ChangeLog procedure.c procedure.h data...
Date: Thu, 27 Apr 2006 02:42:01 +0000

CVSROOT:        /cvsroot/pspp
Module name:    pspp
Branch:         
Changes by:     Ben Pfaff <address@hidden>      06/04/27 02:42:01

Modified files:
        src            : ChangeLog procedure.c procedure.h 
        src/data       : ChangeLog automake.mk 
        src/language/data-io: data-list.h file-type.c get.c 
                              matrix-data.c 
        src/language/expressions: parse.c 
        src/language/stats: aggregate.c flip.c 
        src/math       : sort.c 
Added files:
        src/data       : case-sink.c case-sink.h case-source.c 
                         case-source.h storage-stream.c storage-stream.h 

Log message:
        Continue reforming procedure execution.  In this phase, break
        procedure.c into multiple files.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ChangeLog.diff?tr1=1.280&tr2=1.281&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/procedure.c.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/procedure.h.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/data/ChangeLog.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/data/automake.mk.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/data/case-sink.c?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/data/case-sink.h?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/data/case-source.c?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/data/case-source.h?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/data/storage-stream.c?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/data/storage-stream.h?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/language/data-io/data-list.h.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/language/data-io/file-type.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/language/data-io/get.c.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/language/data-io/matrix-data.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/language/expressions/parse.c.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/language/stats/aggregate.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/language/stats/flip.c.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/math/sort.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text

Patches:
Index: pspp/src/ChangeLog
diff -u pspp/src/ChangeLog:1.280 pspp/src/ChangeLog:1.281
--- pspp/src/ChangeLog:1.280    Thu Apr 27 01:31:59 2006
+++ pspp/src/ChangeLog  Thu Apr 27 02:42:01 2006
@@ -1,3 +1,35 @@
+Wed Apr 26 19:33:52 2006  Ben Pfaff  <address@hidden>
+
+       Continue reforming procedure execution.  In this phase, break
+       procedure.c into multiple files.
+       
+       * procedure.c (vfm_last_invocation): Rename
+       time_of_last_procedure().  Update all references.
+       (struct storage_stream_info) Move to data/storage-stream.c.
+       (storage_sink_open) Ditto.
+       (destroy_storage_stream_info) Ditto.
+       (storage_sink_write) Ditto.
+       (storage_sink_destroy) Ditto.
+       (storage_sink_make_source) Ditto.
+       (var storage_sink_class) Ditto.
+       (storage_source_count) Ditto.
+       (storage_source_read) Ditto.
+       (storage_source_destroy) Ditto.
+       (storage_source_class) Ditto.
+       (storage_source_get_casefile) Ditto.
+       (storage_source_create) Ditto.
+       (null_sink_class) Move to data/case-sink.c.
+       (create_case_source) Move to data/case-source.c.
+       (free_case_source) Ditto.
+       (case_source_is_class) Ditto.
+       (create_case_sink) Move to data/case-sink.c.
+       (free_case_sink) Ditto.
+
+       * procedure.h: (struct case_source) Move to data/case-source.h.
+       (struct case_source_class) Ditto.
+       (struct case_sink) Move to data/case-sink.h.
+       (struct case_sink_class) Ditto.
+
 Thu Apr 27 09:28:25 WST 2006 John Darrington <address@hidden>
        
        * automake.mk: Removed explicit dependencies for message.o, since
Index: pspp/src/data/ChangeLog
diff -u pspp/src/data/ChangeLog:1.21 pspp/src/data/ChangeLog:1.22
--- pspp/src/data/ChangeLog:1.21        Wed Apr 26 22:00:29 2006
+++ pspp/src/data/ChangeLog     Thu Apr 27 02:42:01 2006
@@ -1,3 +1,22 @@
+Wed Apr 26 19:39:28 2006  Ben Pfaff  <address@hidden>
+
+       Continue reforming procedure execution.  In this phase, break
+       procedure.c into multiple files.
+       
+       * automake.mk: (src_data_libdata_a_SOURCES) Add all the new files.
+
+       * case-sink.c: New file.
+
+       * case-sink.h: New file.
+       
+       * case-source.c: New file.
+
+       * case-source.h: New file.
+       
+       * storage-stream.c: New file.
+
+       * storage-stream.h: New file.
+
 Wed Apr 26 14:55:19 2006  Ben Pfaff  <address@hidden>
 
        * variable.h: (struct variable) Remove `init' member and all
Index: pspp/src/data/automake.mk
diff -u pspp/src/data/automake.mk:1.3 pspp/src/data/automake.mk:1.4
--- pspp/src/data/automake.mk:1.3       Mon Apr 17 01:30:21 2006
+++ pspp/src/data/automake.mk   Thu Apr 27 02:42:01 2006
@@ -9,6 +9,10 @@
        src/data/any-writer.h \
        src/data/calendar.c \
        src/data/calendar.h \
+       src/data/case-sink.c \
+       src/data/case-sink.h \
+       src/data/case-source.c \
+       src/data/case-source.h \
        src/data/case.c \
        src/data/casefile.c \
        src/data/casefile.h \
@@ -47,6 +51,8 @@
        src/data/settings.c \
        src/data/settings.h \
        src/data/sfm-private.h \
+       src/data/storage-stream.c \
+       src/data/storage-stream.h \
        src/data/sys-file-reader.c \
        src/data/sys-file-reader.h \
        src/data/sys-file-writer.c \
Index: pspp/src/language/data-io/data-list.h
diff -u pspp/src/language/data-io/data-list.h:1.2 
pspp/src/language/data-io/data-list.h:1.3
--- pspp/src/language/data-io/data-list.h:1.2   Wed Mar 15 03:29:10 2006
+++ pspp/src/language/data-io/data-list.h       Thu Apr 27 02:42:01 2006
@@ -23,6 +23,7 @@
 /* FIXME: This header is a kluge and should go away when we come
    up with a less-klugy solution. */
 
+#include <data/case-source.h>
 #include <data/variable.h>
 #include <procedure.h>
 
Index: pspp/src/language/data-io/file-type.c
diff -u pspp/src/language/data-io/file-type.c:1.4 
pspp/src/language/data-io/file-type.c:1.5
--- pspp/src/language/data-io/file-type.c:1.4   Wed Apr 26 20:54:08 2006
+++ pspp/src/language/data-io/file-type.c       Thu Apr 27 02:42:01 2006
@@ -23,6 +23,7 @@
 
 #include <stdlib.h>
 
+#include <data/case-source.h>
 #include <data/case.h>
 #include <data/data-in.h>
 #include <data/dictionary.h>
Index: pspp/src/language/data-io/get.c
diff -u pspp/src/language/data-io/get.c:1.5 pspp/src/language/data-io/get.c:1.6
--- pspp/src/language/data-io/get.c:1.5 Wed Apr 26 20:54:08 2006
+++ pspp/src/language/data-io/get.c     Thu Apr 27 02:42:01 2006
@@ -18,26 +18,31 @@
    02110-1301, USA. */
 
 #include <config.h>
-#include <libpspp/message.h>
+
 #include <stdlib.h>
-#include <libpspp/alloc.h>
+
 #include <data/any-reader.h>
 #include <data/any-writer.h>
+#include <data/case-sink.h>
+#include <data/case-source.h>
 #include <data/case.h>
-#include <language/command.h>
-#include <libpspp/compiler.h>
 #include <data/dictionary.h>
-#include <libpspp/message.h>
-#include <language/data-io/file-handle.h>
-#include <libpspp/hash.h>
-#include <language/lexer/lexer.h>
-#include <libpspp/misc.h>
 #include <data/por-file-writer.h>
 #include <data/settings.h>
+#include <data/storage-stream.h>
 #include <data/sys-file-writer.h>
-#include <libpspp/str.h>
 #include <data/value-labels.h>
 #include <data/variable.h>
+#include <language/command.h>
+#include <language/data-io/file-handle.h>
+#include <language/lexer/lexer.h>
+#include <libpspp/alloc.h>
+#include <libpspp/compiler.h>
+#include <libpspp/hash.h>
+#include <libpspp/message.h>
+#include <libpspp/message.h>
+#include <libpspp/misc.h>
+#include <libpspp/str.h>
 #include <procedure.h>
 
 #include "gettext.h"
Index: pspp/src/language/data-io/matrix-data.c
diff -u pspp/src/language/data-io/matrix-data.c:1.4 
pspp/src/language/data-io/matrix-data.c:1.5
--- pspp/src/language/data-io/matrix-data.c:1.4 Sun Apr 16 04:46:41 2006
+++ pspp/src/language/data-io/matrix-data.c     Thu Apr 27 02:42:01 2006
@@ -18,25 +18,28 @@
    02110-1301, USA. */
 
 #include <config.h>
-#include <libpspp/message.h>
+
 #include <stdlib.h>
 #include <ctype.h>
 #include <float.h>
-#include <libpspp/array.h>
-#include <libpspp/alloc.h>
+
+#include <data/case-source.h>
 #include <data/case.h>
-#include <language/command.h>
-#include <libpspp/compiler.h>
 #include <data/data-in.h>
-#include <language/data-io/data-reader.h>
 #include <data/dictionary.h>
-#include <libpspp/message.h>
+#include <data/variable.h>
+#include <language/command.h>
+#include <language/data-io/data-reader.h>
 #include <language/data-io/file-handle.h>
 #include <language/lexer/lexer.h>
+#include <libpspp/alloc.h>
+#include <libpspp/array.h>
+#include <libpspp/compiler.h>
+#include <libpspp/message.h>
+#include <libpspp/message.h>
 #include <libpspp/misc.h>
 #include <libpspp/pool.h>
 #include <libpspp/str.h>
-#include <data/variable.h>
 #include <procedure.h>
 
 #include "gettext.h"
Index: pspp/src/language/expressions/parse.c
diff -u pspp/src/language/expressions/parse.c:1.2 
pspp/src/language/expressions/parse.c:1.3
--- pspp/src/language/expressions/parse.c:1.2   Wed Mar 15 03:29:10 2006
+++ pspp/src/language/expressions/parse.c       Thu Apr 27 02:42:01 2006
@@ -731,11 +731,11 @@
           "JUL", "AUG", "SEP", "OCT", "NOV", "DEC",
         };
 
-      time_t last_vfm_invocation = vfm_last_invocation ();
+      time_t last_proc_time = time_of_last_procedure ();
       struct tm *time;
       char temp_buf[10];
 
-      time = localtime (&last_vfm_invocation);
+      time = localtime (&last_proc_time);
       sprintf (temp_buf, "%02d %s %02d", abs (time->tm_mday) % 100,
                months[abs (time->tm_mon) % 12], abs (time->tm_year) % 100);
 
@@ -749,7 +749,7 @@
     return expr_allocate_number (e, SYSMIS);
   else if (lex_match_id ("$JDATE"))
     {
-      time_t time = vfm_last_invocation ();
+      time_t time = time_of_last_procedure ();
       struct tm *tm = localtime (&time);
       return expr_allocate_number (e, expr_ymd_to_ofs (tm->tm_year + 1900,
                                                        tm->tm_mon + 1,
@@ -757,7 +757,7 @@
     }
   else if (lex_match_id ("$TIME"))
     {
-      time_t time = vfm_last_invocation ();
+      time_t time = time_of_last_procedure ();
       struct tm *tm = localtime (&time);
       return expr_allocate_number (e,
                                    expr_ymd_to_date (tm->tm_year + 1900,
Index: pspp/src/language/stats/aggregate.c
diff -u pspp/src/language/stats/aggregate.c:1.4 
pspp/src/language/stats/aggregate.c:1.5
--- pspp/src/language/stats/aggregate.c:1.4     Wed Apr 26 22:00:29 2006
+++ pspp/src/language/stats/aggregate.c Thu Apr 27 02:42:01 2006
@@ -18,27 +18,31 @@
    02110-1301, USA. */
 
 #include <config.h>
-#include <libpspp/message.h>
+
 #include <stdlib.h>
-#include <libpspp/alloc.h>
+
 #include <data/any-writer.h>
+#include <data/case-sink.h>
 #include <data/case.h>
 #include <data/casefile.h>
-#include <language/command.h>
 #include <data/dictionary.h>
-#include <libpspp/message.h>
 #include <data/file-handle-def.h>
+#include <data/settings.h>
+#include <data/storage-stream.h>
+#include <data/sys-file-writer.h>
+#include <data/variable.h>
+#include <language/command.h>
 #include <language/data-io/file-handle.h>
 #include <language/lexer/lexer.h>
 #include <language/stats/sort-criteria.h>
+#include <libpspp/alloc.h>
+#include <libpspp/message.h>
+#include <libpspp/message.h>
 #include <libpspp/misc.h>
-#include <math/moments.h>
 #include <libpspp/pool.h>
-#include <data/settings.h>
-#include <data/sys-file-writer.h>
-#include <math/sort.h>
 #include <libpspp/str.h>
-#include <data/variable.h>
+#include <math/moments.h>
+#include <math/sort.h>
 #include <procedure.h>
 
 #include "gettext.h"
Index: pspp/src/language/stats/flip.c
diff -u pspp/src/language/stats/flip.c:1.5 pspp/src/language/stats/flip.c:1.6
--- pspp/src/language/stats/flip.c:1.5  Tue Apr 25 20:17:13 2006
+++ pspp/src/language/stats/flip.c      Thu Apr 27 02:42:01 2006
@@ -18,31 +18,35 @@
    02110-1301, USA. */
 
 #include "config.h"
-#include <libpspp/message.h>
+
 #include <ctype.h>
 #include <errno.h>
 #include <float.h>
 #include <limits.h>
 #include <stdlib.h>
-#include <libpspp/array.h>
-#include <libpspp/alloc.h>
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#include <data/case-sink.h>
+#include <data/case-source.h>
 #include <data/case.h>
-#include <language/command.h>
 #include <data/dictionary.h>
-#include <libpspp/message.h>
-#include "intprops.h"
+#include <data/settings.h>
+#include <data/value.h>
+#include <data/variable.h>
+#include <language/command.h>
 #include <language/lexer/lexer.h>
+#include <libpspp/alloc.h>
+#include <libpspp/array.h>
+#include <libpspp/message.h>
+#include <libpspp/message.h>
 #include <libpspp/misc.h>
 #include <libpspp/pool.h>
-#include <data/settings.h>
 #include <libpspp/str.h>
-#include <data/value.h>
-#include <data/variable.h>
 #include <procedure.h>
 
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
+#include "intprops.h"
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
Index: pspp/src/math/sort.c
diff -u pspp/src/math/sort.c:1.4 pspp/src/math/sort.c:1.5
--- pspp/src/math/sort.c:1.4    Sun Apr 16 04:46:41 2006
+++ pspp/src/math/sort.c        Thu Apr 27 02:42:01 2006
@@ -18,24 +18,28 @@
    02110-1301, USA. */
 
 #include <config.h>
+
 #include "sort.h"
-#include <libpspp/message.h>
-#include <libpspp/alloc.h>
+
+#include <errno.h>
 #include <limits.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <errno.h>
-#include <libpspp/array.h>
-#include <stdbool.h>
+
+#include <data/case-source.h>
 #include <data/case.h>
 #include <data/casefile.h>
-#include <libpspp/message.h>
+#include <data/settings.h>
+#include <data/variable.h>
+#include <data/storage-stream.h>
 #include <language/expressions/public.h>
-
+#include <libpspp/alloc.h>
+#include <libpspp/array.h>
+#include <libpspp/message.h>
+#include <libpspp/message.h>
 #include <libpspp/misc.h>
-#include <data/settings.h>
 #include <libpspp/str.h>
-#include <data/variable.h>
 #include <procedure.h>
 
 #include "gettext.h"
Index: pspp/src/procedure.c
diff -u pspp/src/procedure.c:1.6 pspp/src/procedure.c:1.7
--- pspp/src/procedure.c:1.6    Wed Apr 26 22:00:29 2006
+++ pspp/src/procedure.c        Thu Apr 27 02:42:01 2006
@@ -18,28 +18,33 @@
    02110-1301, USA. */
 
 #include <config.h>
+
 #include <procedure.h>
-#include <libpspp/message.h>
+#include <data/case-source.h>
+#include <data/case-sink.h>
+#include <data/storage-stream.h>
+
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <libpspp/alloc.h>
+
+#include "expressions/public.h"
 #include <data/case.h>
 #include <data/casefile.h>
-#include <language/command.h>
 #include <data/dictionary.h>
+#include <data/file-handle-def.h>
+#include <data/settings.h>
+#include <data/value-labels.h>
+#include <data/variable.h>
 #include <language/control/control-stack.h>
+#include <libpspp/alloc.h>
+#include <libpspp/message.h>
 #include <libpspp/message.h>
-#include "expressions/public.h"
-#include <data/file-handle-def.h>
 #include <libpspp/misc.h>
-#include <data/settings.h>
+#include <libpspp/str.h>
 #include <output/manager.h>
 #include <output/table.h>
-#include <libpspp/str.h>
-#include <data/variable.h>
-#include <data/value-labels.h>
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
@@ -109,7 +114,7 @@
 
 /* Returns the last time the data was read. */
 time_t
-vfm_last_invocation (void) 
+time_of_last_procedure (void) 
 {
   if (last_vfm_invocation == 0)
     update_last_vfm_invocation ();
@@ -376,7 +381,7 @@
 }
 
 /* Returns nonzero if case C with case number CASE_NUM should be
-   exclude as specified on FILTER or PROCESS IF, otherwise
+   excluded as specified on FILTER or PROCESS IF, otherwise
    zero. */
 static int
 filter_case (const struct ccase *c, int case_idx)
@@ -481,160 +486,6 @@
   return cancel_transformations ();
 }
 
-/* Storage case stream. */
-
-/* Information about storage sink or source. */
-struct storage_stream_info 
-  {
-    struct casefile *casefile;  /* Storage. */
-  };
-
-/* Initializes a storage sink. */
-static void
-storage_sink_open (struct case_sink *sink)
-{
-  struct storage_stream_info *info;
-
-  sink->aux = info = xmalloc (sizeof *info);
-  info->casefile = casefile_create (sink->value_cnt);
-}
-
-/* Destroys storage stream represented by INFO. */
-static void
-destroy_storage_stream_info (struct storage_stream_info *info) 
-{
-  if (info != NULL) 
-    {
-      casefile_destroy (info->casefile);
-      free (info); 
-    }
-}
-
-/* Writes case C to the storage sink SINK.
-   Returns true if successful, false if an I/O error occurred. */
-static bool
-storage_sink_write (struct case_sink *sink, const struct ccase *c)
-{
-  struct storage_stream_info *info = sink->aux;
-
-  return casefile_append (info->casefile, c);
-}
-
-/* Destroys internal data in SINK. */
-static void
-storage_sink_destroy (struct case_sink *sink)
-{
-  destroy_storage_stream_info (sink->aux);
-}
-
-/* Closes the sink and returns a storage source to read back the
-   written data. */
-static struct case_source *
-storage_sink_make_source (struct case_sink *sink) 
-{
-  struct case_source *source
-    = create_case_source (&storage_source_class, sink->aux);
-  sink->aux = NULL;
-  return source;
-}
-
-/* Storage sink. */
-const struct case_sink_class storage_sink_class = 
-  {
-    "storage",
-    storage_sink_open,
-    storage_sink_write,
-    storage_sink_destroy,
-    storage_sink_make_source,
-  };
-
-/* Storage source. */
-
-/* Returns the number of cases that will be read by
-   storage_source_read(). */
-static int
-storage_source_count (const struct case_source *source) 
-{
-  struct storage_stream_info *info = source->aux;
-
-  return casefile_get_case_cnt (info->casefile);
-}
-
-/* Reads all cases from the storage source and passes them one by one to
-   write_case(). */
-static bool
-storage_source_read (struct case_source *source,
-                     struct ccase *output_case,
-                     write_case_func *write_case, write_case_data wc_data)
-{
-  struct storage_stream_info *info = source->aux;
-  struct ccase casefile_case;
-  struct casereader *reader;
-  bool ok = true;
-
-  for (reader = casefile_get_reader (info->casefile);
-       ok && casereader_read (reader, &casefile_case);
-       case_destroy (&casefile_case))
-    {
-      case_copy (output_case, 0,
-                 &casefile_case, 0,
-                 casefile_get_value_cnt (info->casefile));
-      ok = write_case (wc_data);
-    }
-  casereader_destroy (reader);
-
-  return ok;
-}
-
-/* Destroys the source's internal data. */
-static void
-storage_source_destroy (struct case_source *source)
-{
-  destroy_storage_stream_info (source->aux);
-}
-
-/* Storage source. */
-const struct case_source_class storage_source_class = 
-  {
-    "storage",
-    storage_source_count,
-    storage_source_read,
-    storage_source_destroy,
-  };
-
-struct casefile *
-storage_source_get_casefile (struct case_source *source) 
-{
-  struct storage_stream_info *info = source->aux;
-
-  assert (source->class == &storage_source_class);
-  return info->casefile;
-}
-
-struct case_source *
-storage_source_create (struct casefile *cf)
-{
-  struct storage_stream_info *info;
-
-  info = xmalloc (sizeof *info);
-  info->casefile = cf;
-
-  return create_case_source (&storage_source_class, info);
-}
-
-/* Null sink.  Used by a few procedures that keep track of output
-   themselves and would throw away anything that the sink
-   contained anyway. */
-
-const struct case_sink_class null_sink_class = 
-  {
-    "null",
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-  };
-
 /* Returns a pointer to the lagged case from N_BEFORE cases before the
    current one, or NULL if there haven't been that many cases yet. */
 struct ccase *
@@ -701,65 +552,6 @@
   return ok;
 }
 
-/* Creates a case source with class CLASS and auxiliary data AUX
-   and based on dictionary DICT. */
-struct case_source *
-create_case_source (const struct case_source_class *class,
-                    void *aux) 
-{
-  struct case_source *source = xmalloc (sizeof *source);
-  source->class = class;
-  source->aux = aux;
-  return source;
-}
-
-/* Destroys case source SOURCE.  It is the caller's responsible to
-   call the source's destroy function, if any. */
-void
-free_case_source (struct case_source *source) 
-{
-  if (source != NULL) 
-    {
-      if (source->class->destroy != NULL)
-        source->class->destroy (source);
-      free (source);
-    }
-}
-
-/* Returns nonzero if CLASS is the class of SOURCE. */
-int
-case_source_is_class (const struct case_source *source,
-                      const struct case_source_class *class) 
-{
-  return source != NULL && source->class == class;
-}
-
-/* Creates a case sink to accept cases from the given DICT with
-   class CLASS and auxiliary data AUX. */
-struct case_sink *
-create_case_sink (const struct case_sink_class *class,
-                  const struct dictionary *dict,
-                  void *aux) 
-{
-  struct case_sink *sink = xmalloc (sizeof *sink);
-  sink->class = class;
-  sink->value_cnt = dict_get_compacted_value_cnt (dict);
-  sink->aux = aux;
-  return sink;
-}
-
-/* Destroys case sink SINK.  */
-void
-free_case_sink (struct case_sink *sink) 
-{
-  if (sink != NULL) 
-    {
-      if (sink->class->destroy != NULL)
-        sink->class->destroy (sink);
-      free (sink); 
-    }
-}
-
 /* Represents auxiliary data for handling SPLIT FILE. */
 struct split_aux_data 
   {
Index: pspp/src/procedure.h
diff -u pspp/src/procedure.h:1.3 pspp/src/procedure.h:1.4
--- pspp/src/procedure.h:1.3    Wed Apr 26 22:32:12 2006
+++ pspp/src/procedure.h        Thu Apr 27 02:42:01 2006
@@ -1,5 +1,5 @@
 /* PSPP - computes sample statistics.
-   Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
    Written by Ben Pfaff <address@hidden>.
 
    This program is free software; you can redistribute it and/or
@@ -17,113 +17,34 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA. */
 
-#if !vfm_h
-#define vfm_h 1
+#ifndef PROCEDURE_H
+#define PROCEDURE_H 1
 
 #include <time.h>
 #include <stdbool.h>
 
 struct ccase;
-typedef struct write_case_data *write_case_data;
-typedef bool write_case_func (write_case_data);
-
+struct casefile;
+
 /* The current active file, from which cases are read. */
 extern struct case_source *vfm_source;
 
-/* A case source. */
-struct case_source 
-  {
-    const struct case_source_class *class;      /* Class. */
-    void *aux;          /* Auxiliary data. */
-  };
-
-/* A case source class. */
-struct case_source_class
-  {
-    const char *name;                   /* Identifying name. */
-    
-    /* Returns the exact number of cases that READ will pass to
-       WRITE_CASE, if known, or -1 otherwise. */
-    int (*count) (const struct case_source *);
-
-    /* Reads the cases one by one into C and for each one calls
-       WRITE_CASE passing the given AUX data.
-       Returns true if successful, false if an I/O error occurred. */
-    bool (*read) (struct case_source *,
-                  struct ccase *c,
-                  write_case_func *write_case, write_case_data aux);
-
-    /* Destroys the source. */
-    void (*destroy) (struct case_source *);
-  };
-
-extern const struct case_source_class storage_source_class;
-
-struct dictionary;
-struct case_source *create_case_source (const struct case_source_class *,
-                                        void *);
-void free_case_source (struct case_source *);
-
-int case_source_is_class (const struct case_source *,
-                          const struct case_source_class *);
-
-struct casefile *storage_source_get_casefile (struct case_source *);
-struct case_source *storage_source_create (struct casefile *);
-
 /* The replacement active file, to which cases are written. */
 extern struct case_sink *vfm_sink;
 
-/* A case sink. */
-struct case_sink 
-  {
-    const struct case_sink_class *class;        /* Class. */
-    void *aux;          /* Auxiliary data. */
-    size_t value_cnt;   /* Number of `union value's in case. */
-  };
-
-/* A case sink class. */
-struct case_sink_class
-  {
-    const char *name;                   /* Identifying name. */
-    
-    /* Opens the sink for writing. */
-    void (*open) (struct case_sink *);
-                  
-    /* Writes a case to the sink. */
-    bool (*write) (struct case_sink *, const struct ccase *);
-    
-    /* Closes and destroys the sink. */
-    void (*destroy) (struct case_sink *);
-
-    /* Closes the sink and returns a source that can read back
-       the cases that were written, perhaps transformed in some
-       way.  The sink must still be separately destroyed by
-       calling destroy(). */
-    struct case_source *(*make_source) (struct case_sink *);
-  };
-
-extern const struct case_sink_class storage_sink_class;
-extern const struct case_sink_class null_sink_class;
-
-struct case_sink *create_case_sink (const struct case_sink_class *,
-                                    const struct dictionary *,
-                                    void *);
-void free_case_sink (struct case_sink *);
-
-/* Number of cases to lag. */
-extern int n_lag;
-
 bool procedure (bool (*proc_func) (struct ccase *, void *aux), void *aux);
 bool procedure_with_splits (void (*begin_func) (void *aux),
                             bool (*proc_func) (struct ccase *, void *aux),
                             void (*end_func) (void *aux),
                             void *aux);
-struct ccase *lagged_case (int n_before);
-
 bool multipass_procedure_with_splits (bool (*) (const struct casefile *,
                                                 void *),
                                       void *aux);
-
-time_t vfm_last_invocation (void);
+time_t time_of_last_procedure (void);
+
+/* Number of cases to lag. */
+extern int n_lag;
+
+struct ccase *lagged_case (int n_before);
 
-#endif /* !vfm_h */
+#endif /* procedure.h */




reply via email to

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