{
struct casereader *reader = (struct casereader *) reader_;
struct casereader *clone;
+ if ( reader == NULL )
+ return NULL;
if (reader->class->clone == NULL)
insert_shim (reader);
return ds->dict;
}
+const struct casereader *
+dataset_source (const struct dataset *ds)
+{
+ return ds->source;
+}
+
void
dataset_need_lag (struct dataset *ds, int n_before)
{
bool dataset_end_of_command (struct dataset *);
\f
struct dictionary *dataset_dict (const struct dataset *ds);
+const struct casereader *dataset_source (const struct dataset *ds);
+
struct ccase *lagged_case (const struct dataset *ds, int n_before);
void dataset_need_lag (struct dataset *ds, int n_before);
gboolean
execute_syntax (struct getl_interface *sss)
{
+ gboolean status;
struct lexer *lexer;
+ struct casereader *reader = psppire_data_store_get_reader (the_data_store);
+
+ proc_set_active_file_data (the_dataset, reader);
+
g_return_val_if_fail (proc_has_active_file (the_dataset), FALSE);
lexer = lex_create (the_source_stream);
lex_destroy (lexer);
/* GUI syntax needs this implicit EXECUTE command at the end of
- every script. Otherwise commands like GET could leave the GUI without
- a casefile. */
- return proc_execute (the_dataset);
+ every script. Otherwise commands like GET could leave the GUI
+ without a datasheet. */
+ status = proc_execute (the_dataset);
+
+ psppire_dict_replace_dictionary (the_data_store->dict,
+ dataset_dict (the_dataset));
+
+ {
+ PsppireCaseFile *pcf = psppire_case_file_new (dataset_source (the_dataset));
+
+ psppire_data_store_set_case_file (the_data_store, pcf);
+ }
+
+ return status;
}
#include <data/case.h>
#include <data/data-in.h>
#include <data/datasheet.h>
+#include <data/casereader.h>
#include <math/sort.h>
#include <libpspp/misc.h>
object_class->finalize = psppire_case_file_finalize;
signals [CASE_CHANGED] =
- g_signal_new ("case_changed",
+ g_signal_new ("case-changed",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_FIRST,
0,
signals [CASE_INSERTED] =
- g_signal_new ("case_inserted",
+ g_signal_new ("case-inserted",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_FIRST,
0,
signals [CASES_DELETED] =
- g_signal_new ("cases_deleted",
+ g_signal_new ("cases-deleted",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_FIRST,
0,
* Creates a new #PsppireCaseFile.
*/
PsppireCaseFile*
-psppire_case_file_new (struct casereader *reader)
+psppire_case_file_new (const struct casereader *reader)
{
PsppireCaseFile *cf = g_object_new (G_TYPE_PSPPIRE_CASE_FILE, NULL);
- cf->datasheet = datasheet_create (reader);
+ cf->datasheet = datasheet_create (casereader_clone (reader));
cf->accessible = TRUE;
return cf;
if (ok)
g_signal_emit (cf, signals [CASE_CHANGED], 0, casenum);
- freesa (value);
+ freea (value);
return TRUE;
}
/* -- PsppireCaseFile --- */
GType psppire_case_file_get_type (void);
-PsppireCaseFile *psppire_case_file_new (struct casereader *);
+PsppireCaseFile *psppire_case_file_new (const struct casereader *);
gboolean psppire_case_file_insert_case (PsppireCaseFile *cf, struct ccase *c, gint row);
gboolean psppire_case_file_get_case (const PsppireCaseFile *cf, gint casenum,
struct ccase *c);
+
+struct casereader * psppire_case_file_make_reader (PsppireCaseFile *cf);
+
+
G_END_DECLS
#endif /* __PSPPIRE_CASE_FILE_H__ */
+/* Return a casereader made from this datastore */
+struct casereader *
+psppire_data_store_get_reader (PsppireDataStore *ds)
+{
+ struct casereader *reader ;
+
+ reader = psppire_case_file_make_reader (ds->case_file);
+
+ return reader;
+}
+
+
/* Column related funcs */
iface->get_button_label = geometry_get_row_button_label;
}
+
+
gboolean psppire_data_store_insert_new_case (PsppireDataStore *ds, gint posn);
+struct casereader * psppire_data_store_get_reader (PsppireDataStore *ds);
+
+
#ifdef __cplusplus
}
filter_changed_callback (d, var ? var_get_dict_index (var) : -1, dict);
split_changed_callback (d, dict);
+
+ dict_set_callbacks (dict->dict, &gui_callbacks, dict);
}
struct source_stream *the_source_stream ;
struct dataset * the_dataset = NULL;
-static void
-replace_dictionary (struct dictionary *d)
-{
- psppire_dict_replace_dictionary (the_data_store->dict, d);
-}
-
static void
replace_casereader (struct casereader *s)
fn_getenv_default ("STAT_INCLUDE_PATH", include_path)
);
- the_dataset = create_dataset (replace_casereader,
- replace_dictionary);
-
+ the_dataset = create_dataset (NULL, NULL);
message_dialog_init (the_source_stream);