Add WARN_UNUSED_RESULT to procedure function prototypes
[pspp-builds.git] / src / data / procedure.h
1 /* PSPP - computes sample statistics.
2    Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
3    Written by Ben Pfaff <blp@gnu.org>.
4
5    This program is free software; you can redistribute it and/or
6    modify it under the terms of the GNU General Public License as
7    published by the Free Software Foundation; either version 2 of the
8    License, or (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software
17    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18    02110-1301, USA. */
19
20 #ifndef PROCEDURE_H
21 #define PROCEDURE_H 1
22
23 #include <time.h>
24 #include <stdbool.h>
25
26 #include <data/transformations.h>
27 #include <libpspp/compiler.h>
28
29 struct ccase;
30 struct casefile;
31 struct case_sink;
32 struct case_source;
33
34 /* Dictionary produced by permanent and temporary transformations
35    on data from the source. */
36 extern struct dictionary *default_dict;
37 \f
38 /* Transformations. */
39
40 void add_transformation (trns_proc_func *, trns_free_func *, void *);
41 void add_transformation_with_finalizer (trns_finalize_func *,
42                                         trns_proc_func *,
43                                         trns_free_func *, void *);
44 size_t next_transformation (void);
45
46 void discard_variables (void);
47
48 bool proc_cancel_all_transformations (void);
49 struct trns_chain *proc_capture_transformations (void);
50
51 void proc_start_temporary_transformations (void);
52 bool proc_in_temporary_transformations (void);
53 bool proc_make_temporary_transformations_permanent (void);
54 bool proc_cancel_temporary_transformations (void);
55 \f
56 /* Procedures. */
57
58 void proc_init (void);
59 void proc_done (void);
60
61 void proc_set_source (struct case_source *);
62 bool proc_has_source (void);
63
64 void proc_set_sink (struct case_sink *);
65 struct casefile *proc_capture_output (void);
66
67 bool procedure (bool (*proc_func) (const struct ccase *, void *),
68                 void *aux)
69      WARN_UNUSED_RESULT;
70 bool procedure_with_splits (void (*begin_func) (const struct ccase *, void *),
71                             bool (*proc_func) (const struct ccase *, void *),
72                             void (*end_func) (void *),
73                             void *aux)
74      WARN_UNUSED_RESULT;
75 bool multipass_procedure (bool (*proc_func) (const struct casefile *, void *),
76                           void *aux)
77      WARN_UNUSED_RESULT;
78 bool multipass_procedure_with_splits (bool (*) (const struct ccase *,
79                                                 const struct casefile *,
80                                                 void *),
81                                       void *aux)
82      WARN_UNUSED_RESULT;
83 time_t time_of_last_procedure (void);
84 \f
85 /* Number of cases to lag. */
86 extern int n_lag;
87
88 struct ccase *lagged_case (int n_before);
89
90 #endif /* procedure.h */