#include "data/casegrouper.h"
#include "data/casereader.h"
+#include "data/casewriter.h"
#include "data/data-out.h"
#include "data/dataset.h"
#include "data/dictionary.h"
#include "data/format.h"
#include "data/variable.h"
#include "language/command.h"
+#include "language/lexer/lexer.h"
#include "libpspp/i18n.h"
#include "libpspp/message.h"
#include "libpspp/str.h"
const struct variable *var = dict_lookup_var (dict, name);
if (var == NULL)
{
- msg (ME, _("Matrix dataset lacks a variable called %s."), name);
+ msg (SE, _("Matrix dataset lacks a variable called %s."), name);
return NULL;
}
if (!var_is_alpha (var))
{
- msg (ME, _("Matrix dataset variable %s should be of string type."), name);
+ msg (SE, _("Matrix dataset variable %s should be of string type."), name);
return NULL;
}
return var;
size_t rowtype_idx = var_get_dict_index (rowtype);
if (varname_idx < rowtype_idx)
{
- msg (ME, _("Variable %s must precede %s in matrix file dictionary."),
+ msg (SE, _("Variable %s must precede %s in matrix file dictionary."),
"ROWTYPE_", "VARNAME_");
return NULL;
}
const struct variable *v = dict_get_var (dict, i);
if (!var_is_numeric (v) && v != rowtype && v != varname)
{
- msg (ME, _("Matrix dataset variable %s should be numeric."),
+ msg (SE, _("Matrix dataset variable %s should be numeric."),
var_get_name (v));
return NULL;
}
size_t n_cvars = n_vars - varname_idx - 1;
if (!n_cvars)
{
- msg (ME, _("Matrix dataset does not have any continuous variables."));
+ msg (SE, _("Matrix dataset does not have any continuous variables."));
free (vars);
return NULL;
}
}
int
-cmd_debug_matrix_read (struct lexer *lexer UNUSED, struct dataset *ds)
+cmd_debug_matrix_read (struct lexer *lexer, struct dataset *ds)
{
+ if (lex_match_id (lexer, "NODATA"))
+ {
+ struct casereader *cr = casewriter_make_reader (
+ mem_writer_create (dict_get_proto (dataset_dict (ds))));
+ struct matrix_reader *mr = matrix_reader_create (dataset_dict (ds), cr);
+ if (!mr)
+ return CMD_FAILURE;
+ matrix_reader_destroy (mr);
+ return CMD_SUCCESS;
+ }
+
struct matrix_reader *mr = matrix_reader_create (dataset_dict (ds),
proc_open (ds));
if (!mr)