Implement DATASET commands.
[pspp-builds.git] / src / data / dataset.h
index 7aa8b5816aa358d6098b811a90fb8daa475cbe3f..8445094713cdc38bb1eb9e9f72bf4309bf3e0013 100644 (file)
 #include <stdbool.h>
 
 #include "data/transformations.h"
-#include "libpspp/compiler.h"
 
 struct casereader;
 struct dataset;
 struct dictionary;
+struct session;
 \f
-struct dataset *dataset_create (void);
+struct dataset *dataset_create (struct session *, const char *);
+struct dataset *dataset_clone (struct dataset *, const char *);
 void dataset_destroy (struct dataset *);
 
 void dataset_clear (struct dataset *);
 
+const char *dataset_name (const struct dataset *);
+void dataset_set_name (struct dataset *, const char *);
+
+struct session *dataset_session (const struct dataset *);
+void dataset_set_session (struct dataset *, struct session *);
+
 struct dictionary *dataset_dict (const struct dataset *);
 void dataset_set_dict (struct dataset *, struct dictionary *);
 
@@ -40,10 +47,34 @@ bool dataset_has_source (const struct dataset *ds);
 bool dataset_set_source (struct dataset *, struct casereader *);
 struct casereader *dataset_steal_source (struct dataset *);
 
-void dataset_set_callback (struct dataset *, void (*cb) (void *), void *);
-
-void dataset_set_default_syntax_encoding (struct dataset *, const char *);
-const char *dataset_get_default_syntax_encoding (const struct dataset *);
+unsigned int dataset_seqno (const struct dataset *);
+
+struct dataset_callbacks
+  {
+    /* Called whenever a procedure completes execution or whenever the
+       dictionary within the dataset is modified (though not when it is
+       replaced by a new dictionary). */
+    void (*changed) (void *aux);
+
+    /* Called whenever a transformation is added or removed.  NON_EMPTY is true
+       if after the change there is at least one transformation, false if there
+       are no transformations. */
+    void (*transformations_changed) (bool non_empty, void *aux);
+  };
+
+void dataset_set_callbacks (struct dataset *, const struct dataset_callbacks *,
+                            void *aux);
+
+/* Dataset GUI window display status. */
+enum dataset_display
+  {
+    DATASET_ASIS,               /* Current state unchanged. */
+    DATASET_FRONT,              /* Display and raise to top. */
+    DATASET_MINIMIZED,          /* Display as icon. */
+    DATASET_HIDDEN              /* Do not display. */
+  };
+enum dataset_display dataset_get_display (const struct dataset *);
+void dataset_set_display (struct dataset *, enum dataset_display);
 \f
 /* Transformations. */
 
@@ -65,12 +96,6 @@ bool proc_cancel_temporary_transformations (struct dataset *ds);
 \f
 /* Procedures. */
 
-typedef void transformation_change_callback_func (bool non_empty, void *aux);
-
-
-void dataset_add_transform_change_callback (struct dataset *,
-                                           transformation_change_callback_func *, void *);
-
 void proc_discard_output (struct dataset *ds);
 
 bool proc_execute (struct dataset *ds);
@@ -85,5 +110,9 @@ bool dataset_end_of_command (struct dataset *);
 \f
 const struct ccase *lagged_case (const struct dataset *ds, int n_before);
 void dataset_need_lag (struct dataset *ds, int n_before);
+\f
+/* Private interface for use by session code. */
+
+void dataset_set_session__(struct dataset *, struct session *);
 
 #endif /* dataset.h */