/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "data/case.h"
#include "data/casereader.h"
#include "data/casewriter.h"
+#include "data/dataset.h"
#include "data/dictionary.h"
#include "data/format.h"
-#include "data/procedure.h"
#include "data/subcase.h"
#include "data/variable.h"
#include "language/command.h"
#include "language/lexer/variable-parser.h"
#include "language/stats/sort-criteria.h"
#include "libpspp/assertion.h"
+#include "libpspp/i18n.h"
#include "libpspp/message.h"
#include "libpspp/string-array.h"
#include "libpspp/taint.h"
proc.files = NULL;
proc.n_files = 0;
- proc.dict = dict_create ();
+ proc.dict = dict_create (get_default_encoding ());
proc.output = NULL;
proc.matcher = NULL;
subcase_init_empty (&proc.by_vars);
if (lex_match (lexer, T_ASTERISK))
{
- if (!proc_has_active_file (ds))
+ if (!dataset_has_source (ds))
{
- msg (SE, _("Cannot specify the active file since no active "
- "file has been defined."));
+ msg (SE, _("Cannot specify the active dataset since none "
+ "has been defined."));
goto error;
}
if (proc_make_temporary_transformations_permanent (ds))
msg (SE, _("This command may not be used after TEMPORARY when "
- "the active file is an input source. "
+ "the active dataset is an input source. "
"Temporary transformations will be made permanent."));
file->dict = dict_clone (dataset_dict (ds));
}
else
{
- file->handle = fh_parse (lexer, FH_REF_FILE | FH_REF_SCRATCH);
+ file->handle = fh_parse (lexer, FH_REF_FILE, dataset_session (ds));
if (file->handle == NULL)
goto error;
- file->reader = any_reader_open (file->handle, &file->dict);
+ file->reader = any_reader_open (file->handle, NULL, &file->dict);
if (file->reader == NULL)
goto error;
}
msg (SE, _("File %s lacks BY variable %s."),
fh_get_name (file->handle), name);
else
- msg (SE, _("Active file lacks BY variable %s."), name);
+ msg (SE, _("Active dataset lacks BY variable %s."),
+ name);
ok = false;
}
}
{
if (command == COMB_UPDATE)
{
- msg (SE, _("The BY subcommand is required."));
+ lex_sbc_missing ("BY");
goto error;
}
if (n_tables)
if (active_file != NULL)
proc_commit (ds);
- proc_set_active_file (ds, casewriter_make_reader (proc.output), proc.dict);
+ dataset_set_dict (ds, proc.dict);
+ dataset_set_source (ds, casewriter_make_reader (proc.output));
proc.dict = NULL;
proc.output = NULL;
struct dictionary *d = f->dict;
const struct string_array *d_docs, *m_docs;
int i;
- const char *file_encoding;
if (dict_get_label (m) == NULL)
dict_set_label (m, dict_get_label (d));
The correct thing to do would be to convert to an encoding
which can cope with all the input files (eg UTF-8).
*/
- file_encoding = dict_get_encoding (f->dict);
- if ( file_encoding != NULL)
- {
- if ( dict_get_encoding (m) == NULL)
- dict_set_encoding (m, file_encoding);
- else if ( 0 != strcmp (file_encoding, dict_get_encoding (m)))
- {
- msg (MW,
- _("Combining files with incompatible encodings. String data may not be represented correctly."));
- }
- }
+ if ( 0 != strcmp (dict_get_encoding (f->dict), dict_get_encoding (m)))
+ msg (MW, _("Combining files with incompatible encodings. String data may "
+ "not be represented correctly."));
if (d_docs != NULL)
{
if (var_has_missing_values (dv) && !var_has_missing_values (mv))
var_set_missing_values (mv, var_get_missing_values (dv));
if (var_get_label (dv) && !var_get_label (mv))
- var_set_label (mv, var_get_label (dv), file_encoding, false);
+ var_set_label (mv, var_get_label (dv), false);
}
else
mv = dict_clone_var_assert (m, dv);