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