checkin of 0.3.0
[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 /* A case stream: either a source or a sink, depending on context. */
39 struct case_stream
40   {
41     /* Initializes sink. */
42     void (*init) (void);
43     
44     /* Reads all the cases and passes them to WRITE_CASE. */
45     void (*read) (void);
46
47     /* Writes a single case, temp_case. */
48     void (*write) (void);
49
50     /* Switches mode from sink to source. */
51     void (*mode) (void);
52     
53     /* Discards source's internal data. */
54     void (*destroy_source) (void);
55
56     /* Discards sink's internal data. */
57     void (*destroy_sink) (void);
58
59     /* Identifying name for the stream. */
60     const char *name;
61   };
62
63 /* This is used to read from the active file. */
64 extern struct case_stream *vfm_source;
65
66 /* This is used to write to the replacement active file. */
67 extern struct case_stream *vfm_sink;
68
69 /* General data streams. */
70 extern struct case_stream vfm_memory_stream;
71 extern struct case_stream vfm_disk_stream;
72 extern struct case_stream sort_stream;
73 extern struct case_stream flip_stream;
74
75 /* Streams that are only sources. */
76 extern struct case_stream data_list_source;
77 extern struct case_stream input_program_source;
78 extern struct case_stream file_type_source;
79 extern struct case_stream get_source;
80 extern struct case_stream import_source;
81 extern struct case_stream matrix_data_source;
82
83 /* Number of cases to lag. */
84 extern int n_lag;
85
86 extern int (*write_case) (void);
87
88 void procedure (void (*beginfunc) (void),
89                 int (*procfunc) (struct ccase *curcase),
90                 void (*endfunc) (void));
91 struct ccase *lagged_case (int n_before);
92 void compact_case (struct ccase *dest, const struct ccase *src);
93 void page_to_disk (void);
94
95 void process_active_file (void (*beginfunc) (void),
96                           int (*casefunc) (struct ccase *curcase),
97                           void (*endfunc) (void));
98 void process_active_file_output_case (void);
99
100 #endif /* !vfm_h */