Applied patch #5653, which adds callbacks to dataset whenever its dictionary or
[pspp-builds.git] / src / data / procedure.h
index 60e1e77f4f14fae73e74f5649ffea55bfc4253e8..f4d473b9aeaa6ee3ac321deea1f19766f0ac5618 100644 (file)
@@ -1,6 +1,5 @@
 /* PSPP - computes sample statistics.
    Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
-   Written by Ben Pfaff <blp@gnu.org>.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -24,6 +23,7 @@
 #include <stdbool.h>
 
 #include <data/transformations.h>
+#include <data/casefile-factory.h>
 #include <libpspp/compiler.h>
 
 struct ccase;
@@ -58,48 +58,61 @@ bool proc_cancel_temporary_transformations (struct dataset *ds);
 \f
 /* Procedures. */
 
+struct dictionary ;
+typedef void  replace_source_callback (struct case_source *);
+typedef void  replace_dictionary_callback (struct dictionary *);
+
+
+struct dataset * create_dataset (struct casefile_factory *fact,
+                                replace_source_callback *,
+                                replace_dictionary_callback *
+                                );
 
-struct dataset *create_dataset (void);
 void destroy_dataset (struct dataset *);
 
+struct casefile_factory *dataset_get_casefile_factory (const struct dataset *);
+
 void proc_set_source (struct dataset *ds, struct case_source *);
 bool proc_has_source (const struct dataset *ds);
 
 void proc_set_sink (struct dataset *ds, struct case_sink *);
 struct casefile *proc_capture_output (struct dataset *ds);
 
-typedef bool (*casefile_func_t) (const struct casefile *, void *);
-typedef bool (*case_func_t) (const struct ccase *, void *);
-typedef void (*begin_func_t) (const struct ccase *, void *);
+typedef bool casefile_func (const struct casefile *, void *);
+typedef bool case_func (const struct ccase *, void *, const struct dataset *);
+typedef void begin_func (const struct ccase *, void *, const struct dataset*);
+
+typedef bool end_func (void *, const struct dataset *);
+
+typedef bool split_func (const struct ccase *, const struct casefile *,
+                             void *, const struct dataset *);
 
 
 
-bool procedure (struct dataset *ds, case_func_t, void *aux)  WARN_UNUSED_RESULT;
+bool procedure (struct dataset *ds, case_func *, void *aux)  WARN_UNUSED_RESULT;
 
 bool procedure_with_splits (struct dataset *ds, 
-                           begin_func_t begin_func,
-                            case_func_t proc_func,
-                            void (*end_func) (void *),
+                           begin_func *,
+                            case_func *,
+                           end_func *,
                             void *aux)
      WARN_UNUSED_RESULT;
-bool multipass_procedure (struct dataset *ds, casefile_func_t, void  *aux)
+bool multipass_procedure (struct dataset *ds, casefile_func *, void  *aux)
      WARN_UNUSED_RESULT;
 bool multipass_procedure_with_splits (struct dataset *ds,
-                                          bool (*) (const struct ccase *,
-                                                    const struct casefile *,
-                                                    void *),
+                                          split_func *,
                                           void *aux)
      WARN_UNUSED_RESULT;
 
-
-
 time_t time_of_last_procedure (struct dataset *ds);
+
+void proc_open (struct dataset *);
+bool proc_read (struct dataset *, struct ccase **);
+bool proc_close (struct dataset *);
 \f
 
 struct ccase *lagged_case (const struct dataset *ds, int n_before);
 
-extern struct dataset *current_dataset;
-
 inline struct dictionary *dataset_dict (const struct dataset *ds);
 inline void dataset_set_dict ( struct dataset *ds, struct dictionary *dict);