Actually implement the new procedure code and adapt all of its clients
[pspp] / src / data / procedure.h
index 76ca6dc88fc3ea9a2125b28c4251765b41bd4a53..7803e0e75f089aa507a5534e54963191cb7a3f1e 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>.
+   Copyright (C) 1997-9, 2000, 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
 
 #include <time.h>
 #include <stdbool.h>
-#include <data/transformations.h>
 
-struct ccase;
-struct casefile;
-struct case_sink;
-struct case_source;
+#include <data/transformations.h>
+#include <libpspp/compiler.h>
 
-/* Dictionary produced by permanent and temporary transformations
-   on data from the source. */
-extern struct dictionary *default_dict;
+struct casereader;
+struct dataset;
+struct dictionary;
 \f
 /* Transformations. */
 
-void add_transformation (trns_proc_func *, trns_free_func *, void *);
-void add_transformation_with_finalizer (trns_finalize_func *,
+void add_transformation (struct dataset *ds, 
+                        trns_proc_func *, trns_free_func *, void *);
+void add_transformation_with_finalizer (struct dataset *ds, 
+                                       trns_finalize_func *,
                                         trns_proc_func *,
                                         trns_free_func *, void *);
-size_t next_transformation (void);
-
-void discard_variables (void);
+size_t next_transformation (const struct dataset *ds);
 
-bool proc_cancel_all_transformations (void);
-struct trns_chain *proc_capture_transformations (void);
+bool proc_cancel_all_transformations (struct dataset *ds);
+struct trns_chain *proc_capture_transformations (struct dataset *ds);
 
-void proc_start_temporary_transformations (void);
-bool proc_in_temporary_transformations (void);
-bool proc_make_temporary_transformations_permanent (void);
-bool proc_cancel_temporary_transformations (void);
+void proc_start_temporary_transformations (struct dataset *ds);
+bool proc_in_temporary_transformations (const struct dataset *ds);
+bool proc_make_temporary_transformations_permanent (struct dataset *ds);
+bool proc_cancel_temporary_transformations (struct dataset *ds);
 \f
 /* Procedures. */
 
-void proc_init (void);
-void proc_done (void);
-
-void proc_set_source (struct case_source *);
-bool proc_has_source (void);
-
-void proc_set_sink (struct case_sink *);
-struct casefile *proc_capture_output (void);
-
-bool procedure (bool (*proc_func) (struct ccase *, void *),
-                void *aux);
-bool procedure_with_splits (void (*begin_func) (const struct ccase *, void *),
-                            bool (*proc_func) (const struct ccase *, void *),
-                            void (*end_func) (void *),
-                            void *aux);
-bool multipass_procedure (bool (*proc_func) (const struct casefile *, void *),
-                          void *aux);
-bool multipass_procedure_with_splits (bool (*) (const struct ccase *,
-                                                const struct casefile *,
-                                                void *),
-                                      void *aux);
-time_t time_of_last_procedure (void);
+struct dictionary ;
+typedef void  replace_source_callback (struct casereader *);
+typedef void  replace_dictionary_callback (struct dictionary *);
+
+
+struct dataset * create_dataset (replace_source_callback *,
+                                replace_dictionary_callback *);
+
+void destroy_dataset (struct dataset *);
+
+void proc_discard_active_file (struct dataset *);
+void proc_set_active_file (struct dataset *,
+                           struct casereader *, struct dictionary *);
+bool proc_set_active_file_data (struct dataset *, struct casereader *);
+bool proc_has_active_file (const struct dataset *ds);
+
+void proc_discard_output (struct dataset *ds);
+
+bool proc_execute (struct dataset *ds);
+time_t time_of_last_procedure (struct dataset *ds);
+
+struct casereader *proc_open (struct dataset *);
+bool proc_is_open (const struct dataset *);
+bool proc_commit (struct dataset *);
+
+bool dataset_end_of_command (struct dataset *);
 \f
-/* Number of cases to lag. */
-extern int n_lag;
+struct dictionary *dataset_dict (const struct dataset *ds);
 
-struct ccase *lagged_case (int n_before);
+struct ccase *lagged_case (const struct dataset *ds, int n_before);
+void dataset_need_lag (struct dataset *ds, int n_before);
 
 #endif /* procedure.h */