Continue reforming procedure execution. In this phase, get rid of
[pspp-builds.git] / src / data / transformations.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 TRANSFORMATIONS_H
21 #define TRANSFORMATIONS_H 1
22
23 #include <stdbool.h>
24 #include <stddef.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_NEXT_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 *, int);
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 (struct trns_chain *, struct ccase *,
53                                      const size_t *case_nr);
54
55 void trns_chain_splice (struct trns_chain *, struct trns_chain *);
56
57 #endif /* transformations.h */