1 /* PSPP - computes sample statistics.
2 Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
3 Written by Ben Pfaff <blp@gnu.org>.
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.
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.
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
25 /* This is the time at which vfm was last invoked. */
26 extern time_t last_vfm_invocation;
28 /* This is the case that is to be filled in by input programs. */
29 extern struct ccase *temp_case;
31 typedef struct write_case_data *write_case_data;
32 typedef int write_case_func (write_case_data);
34 /* The current active file, from which cases are read. */
35 extern struct case_source *vfm_source;
40 const struct case_source_class *class; /* Class. */
41 void *aux; /* Auxiliary data. */
44 /* A case source class. */
45 struct case_source_class
47 const char *name; /* Identifying name. */
49 /* Reads all the cases and calls WRITE_CASE passing the given
50 AUX data for each one. */
51 void (*read) (struct case_source *, write_case_func *, write_case_data);
53 /* Destroys the source. */
54 void (*destroy) (struct case_source *);
57 extern const struct case_source_class memory_source_class;
58 extern const struct case_source_class disk_source_class;
59 extern const struct case_source_class data_list_source_class;
60 extern const struct case_source_class file_type_source_class;
61 extern const struct case_source_class input_program_source_class;
62 extern const struct case_source_class get_source_class;
63 extern const struct case_source_class import_source_class;
64 extern const struct case_source_class sort_source_class;
66 struct case_source *create_case_source (const struct case_source_class *,
68 int case_source_is_complex (const struct case_source *);
69 int case_source_is_class (const struct case_source *,
70 const struct case_source_class *);
71 struct case_list *memory_source_get_cases (const struct case_source *);
72 void memory_source_set_cases (const struct case_source *,
75 /* The replacement active file, to which cases are written. */
76 extern struct case_sink *vfm_sink;
81 const struct case_sink_class *class; /* Class. */
82 void *aux; /* Auxiliary data. */
85 /* A case sink class. */
86 struct case_sink_class
88 const char *name; /* Identifying name. */
90 /* Creates the sink and opens it for writing. */
91 void (*open) (struct case_sink *);
93 /* Writes a case to the sink. */
94 void (*write) (struct case_sink *, struct ccase *);
96 /* Closes and destroys the sink. */
97 void (*destroy) (struct case_sink *);
99 /* Closes and destroys the sink and returns a source that can
100 read back the cases that were written, perhaps transformed
102 struct case_source *(*make_source) (struct case_sink *);
105 extern const struct case_sink_class memory_sink_class;
106 extern const struct case_sink_class disk_sink_class;
107 extern const struct case_sink_class sort_sink_class;
109 struct case_sink *create_case_sink (const struct case_sink_class *, void *);
111 /* Number of cases to lag. */
114 void procedure (void (*beginfunc) (void *aux),
115 int (*procfunc) (struct ccase *curcase, void *aux),
116 void (*endfunc) (void *aux),
118 struct ccase *lagged_case (int n_before);
119 void compact_case (struct ccase *dest, const struct ccase *src);
120 void write_active_file_to_disk (void);
122 void process_active_file (void (*beginfunc) (void *),
123 int (*casefunc) (struct ccase *curcase, void *),
124 void (*endfunc) (void *),
126 void process_active_file_output_case (void);