X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fdata-io%2Fcombine-files.c;h=e09b36ecad9dde80b16e521ef21cfe22c9bbc01a;hb=e87acf42e694cfae68040f62342becc7be3909a7;hp=c290692e98a98ab95562608eb476b9d4bdea55c3;hpb=9e24f9a5c52650da0700066e8d9e72261c6492ad;p=pspp-builds.git diff --git a/src/language/data-io/combine-files.c b/src/language/data-io/combine-files.c index c290692e..e09b36ec 100644 --- a/src/language/data-io/combine-files.c +++ b/src/language/data-io/combine-files.c @@ -35,6 +35,7 @@ #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" @@ -160,7 +161,7 @@ combine_files (enum comb_command_type command, 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); @@ -208,21 +209,21 @@ combine_files (enum comb_command_type command, { 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; @@ -303,7 +304,8 @@ combine_files (enum comb_command_type command, 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; } } @@ -495,7 +497,6 @@ merge_dictionary (struct dictionary *const m, struct comb_file *f) 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)); @@ -509,17 +510,9 @@ merge_dictionary (struct dictionary *const m, struct comb_file *f) 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) { @@ -589,7 +582,7 @@ merge_dictionary (struct dictionary *const m, struct comb_file *f) 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);