ba91e3774d5e249c1c9b23ff4fbb5246398bc982
[pspp-builds.git] / src / data / procedure.h
1 /* PSPP - computes sample statistics.
2    Copyright (C) 1997-9, 2000, 2006, 2007 Free Software Foundation, Inc.
3
4    This program is free software; you can redistribute it and/or
5    modify it under the terms of the GNU General Public License as
6    published by the Free Software Foundation; either version 2 of the
7    License, or (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful, but
10    WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program; if not, write to the Free Software
16    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17    02110-1301, USA. */
18
19 #ifndef PROCEDURE_H
20 #define PROCEDURE_H 1
21
22 #include <time.h>
23 #include <stdbool.h>
24
25 #include <data/transformations.h>
26 #include <libpspp/compiler.h>
27
28 struct casereader;
29 struct dataset;
30 struct dictionary;
31 \f
32 /* Transformations. */
33
34 void add_transformation (struct dataset *ds,
35                          trns_proc_func *, trns_free_func *, void *);
36 void add_transformation_with_finalizer (struct dataset *ds,
37                                         trns_finalize_func *,
38                                         trns_proc_func *,
39                                         trns_free_func *, void *);
40 size_t next_transformation (const struct dataset *ds);
41
42 bool proc_cancel_all_transformations (struct dataset *ds);
43 struct trns_chain *proc_capture_transformations (struct dataset *ds);
44
45 void proc_start_temporary_transformations (struct dataset *ds);
46 bool proc_in_temporary_transformations (const struct dataset *ds);
47 bool proc_make_temporary_transformations_permanent (struct dataset *ds);
48 bool proc_cancel_temporary_transformations (struct dataset *ds);
49 \f
50 /* Procedures. */
51
52 struct dictionary ;
53 typedef void  replace_source_callback (struct casereader *);
54 typedef void  replace_dictionary_callback (struct dictionary *);
55
56
57 struct dataset * create_dataset (replace_source_callback *,
58                                  replace_dictionary_callback *);
59
60 void destroy_dataset (struct dataset *);
61
62 void proc_discard_active_file (struct dataset *);
63 void proc_set_active_file (struct dataset *,
64                            struct casereader *, struct dictionary *);
65 bool proc_set_active_file_data (struct dataset *, struct casereader *);
66 bool proc_has_active_file (const struct dataset *ds);
67
68 void proc_discard_output (struct dataset *ds);
69
70 bool proc_execute (struct dataset *ds);
71 time_t time_of_last_procedure (struct dataset *ds);
72
73 struct casereader *proc_open (struct dataset *);
74 bool proc_is_open (const struct dataset *);
75 bool proc_commit (struct dataset *);
76
77 bool dataset_end_of_command (struct dataset *);
78 \f
79 struct dictionary *dataset_dict (const struct dataset *ds);
80 const struct casereader *dataset_source (const struct dataset *ds);
81
82
83 struct ccase *lagged_case (const struct dataset *ds, int n_before);
84 void dataset_need_lag (struct dataset *ds, int n_before);
85
86 #endif /* procedure.h */