+
+/* Insert a blank case before POSN */
+gboolean
+psppire_data_store_insert_new_case(PsppireDataStore *ds, gint posn)
+{
+ gboolean result;
+ gint val_cnt, v;
+ struct ccase cc;
+ g_return_val_if_fail (ds, FALSE);
+
+
+ /* Opportunity for optimisation exists here when creating a blank case */
+ val_cnt = casefile_get_value_cnt(ds->case_file->flexifile) ;
+
+ case_create (&cc, val_cnt);
+
+ memset ( case_data_rw (&cc, 0), 0, val_cnt * MAX_SHORT_STRING);
+
+ for (v = 0 ; v < psppire_dict_get_var_cnt (ds->dict) ; ++v)
+ {
+ const struct PsppireVariable *pv = psppire_dict_get_variable(ds->dict, v);
+ if (ALPHA == psppire_variable_get_type(pv) )
+ continue;
+
+ case_data_rw (&cc, psppire_variable_get_fv (pv))->f = SYSMIS;
+ }
+
+ result = psppire_case_file_insert_case (ds->case_file, &cc, posn);
+
+ case_destroy (&cc);
+
+ return result;
+}
+
+