Add auxiliary argument to procedure() interface. Associated small
[pspp-builds.git] / src / vfm.h
1 /* PSPP - computes sample statistics.
2    Copyright (C) 1997-9, 2000 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., 59 Temple Place - Suite 330, Boston, MA
18    02111-1307, USA. */
19
20 #if !vfm_h
21 #define vfm_h 1
22
23 #include "cases.h"
24 #include <time.h>
25
26 /* This is the time at which vfm was last invoked. */
27 extern time_t last_vfm_invocation;
28
29 /* This is the case that is to be filled in by input programs. */
30 extern struct ccase *temp_case;
31
32 /* `value' indexes to initialize to particular values for certain cases. */
33 extern struct long_vec reinit_sysmis;   /* SYSMIS for every case. */
34 extern struct long_vec reinit_blanks;   /* Blanks for every case. */
35 extern struct long_vec init_zero;       /* Zero for first case only. */
36 extern struct long_vec init_blanks;     /* Blanks for first case only. */
37
38 typedef struct write_case_data *write_case_data;
39 typedef int write_case_func (write_case_data);
40
41 /* A case stream: either a source or a sink, depending on context. */
42 struct case_stream
43   {
44     /* Initializes sink. */
45     void (*init) (void);
46     
47     /* Reads all the cases and calls WRITE_CASE passing the given
48        AUX data for each one. */
49     void (*read) (write_case_func *, write_case_data);
50
51     /* Writes a single case, temp_case. */
52     void (*write) (void);
53
54     /* Switches mode from sink to source. */
55     void (*mode) (void);
56     
57     /* Discards source's internal data. */
58     void (*destroy_source) (void);
59
60     /* Discards sink's internal data. */
61     void (*destroy_sink) (void);
62
63     /* Identifying name for the stream. */
64     const char *name;
65   };
66
67 /* This is used to read from the active file. */
68 extern struct case_stream *vfm_source;
69
70 /* This is used to write to the replacement active file. */
71 extern struct case_stream *vfm_sink;
72
73 /* General data streams. */
74 extern struct case_stream vfm_memory_stream;
75 extern struct case_stream vfm_disk_stream;
76 extern struct case_stream sort_stream;
77 extern struct case_stream flip_stream;
78
79 /* Streams that are only sources. */
80 extern struct case_stream data_list_source;
81 extern struct case_stream input_program_source;
82 extern struct case_stream file_type_source;
83 extern struct case_stream get_source;
84 extern struct case_stream import_source;
85 extern struct case_stream matrix_data_source;
86
87 /* Number of cases to lag. */
88 extern int n_lag;
89
90 void procedure (void (*beginfunc) (void *aux),
91                 int (*procfunc) (struct ccase *curcase, void *aux),
92                 void (*endfunc) (void *aux),
93                 void *aux);
94 struct ccase *lagged_case (int n_before);
95 void compact_case (struct ccase *dest, const struct ccase *src);
96 void page_to_disk (void);
97
98 void process_active_file (void (*beginfunc) (void *),
99                           int (*casefunc) (struct ccase *curcase, void *),
100                           void (*endfunc) (void *),
101                           void *aux);
102 void process_active_file_output_case (void);
103
104 #endif /* !vfm_h */