da2cbf5d4a93a860311d6632d6d1648aaa5e2d44
[pspp-builds.git] / src / data / transformations.h
1 /* PSPP - computes sample statistics.
2    Copyright (C) 1997-9, 2000, 2006 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 TRANSFORMATIONS_H
20 #define TRANSFORMATIONS_H 1
21
22 #include <stdbool.h>
23 #include <stddef.h>
24 #include <data/case.h>
25
26 /* trns_proc_func return values. */
27 enum trns_result
28   {
29     TRNS_CONTINUE = -1,         /* Continue to next transformation. */
30     TRNS_DROP_CASE = -2,        /* Drop this case. */
31     TRNS_ERROR = -3,            /* A serious error, so stop the procedure. */
32     TRNS_END_CASE = -4,         /* Skip to next case.  INPUT PROGRAM only. */
33     TRNS_END_FILE = -5          /* End of input.  INPUT PROGRAM only. */
34   };
35
36 struct ccase;
37 typedef void trns_finalize_func (void *);
38 typedef int trns_proc_func (void *, struct ccase *, casenumber);
39 typedef bool trns_free_func (void *);
40 \f
41 /* Transformation chains. */
42
43 struct trns_chain *trns_chain_create (void);
44 void trns_chain_finalize (struct trns_chain *);
45 bool trns_chain_destroy (struct trns_chain *);
46
47 bool trns_chain_is_empty (const struct trns_chain *);
48
49 void trns_chain_append (struct trns_chain *, trns_finalize_func *,
50                         trns_proc_func *, trns_free_func *, void *);
51 size_t trns_chain_next (struct trns_chain *);
52 enum trns_result trns_chain_execute (const struct trns_chain *, enum trns_result,
53                                      struct ccase *, casenumber case_nr);
54
55 void trns_chain_splice (struct trns_chain *, struct trns_chain *);
56
57 #endif /* transformations.h */