X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=utilities%2Fpspp-convert.c;h=0f77998044a06f185a30d2f11357a27d22e389df;hb=559e5e5035fd98393beac3ddfd70d08dc2134c23;hp=1bd2e0a78da94d18fabdf4ae0a78232408edd4cc;hpb=96994a54e60e9c95b8bba54c2281acf7059b1203;p=pspp diff --git a/utilities/pspp-convert.c b/utilities/pspp-convert.c index 1bd2e0a78d..0f77998044 100644 --- a/utilities/pspp-convert.c +++ b/utilities/pspp-convert.c @@ -23,6 +23,7 @@ #include #include "data/any-reader.h" +#include "data/case-map.h" #include "data/casereader.h" #include "data/casewriter.h" #include "data/csv-file-writer.h" @@ -80,7 +81,7 @@ parse_variables_option (const char *arg, struct dictionary *dict, bool ok = parse_variables (lexer, dict, vars, n_vars, 0); if (ok && (lex_token (lexer) != T_STOP && lex_token (lexer) != T_ENDCMD)) { - lex_error (lexer, _("expecting variable name")); + lex_error (lexer, _("Syntax error expecting variable name.")); ok = false; } @@ -294,6 +295,7 @@ main (int argc, char *argv[]) if (reader == NULL) goto error; + struct case_map_stage *stage = case_map_stage_create (dict); if (keep) { struct variable **keep_vars; @@ -302,7 +304,7 @@ main (int argc, char *argv[]) goto error; dict_reorder_vars (dict, keep_vars, n_keep_vars); dict_delete_consecutive_vars (dict, n_keep_vars, - dict_get_var_cnt (dict) - n_keep_vars); + dict_get_n_vars (dict) - n_keep_vars); free (keep_vars); } @@ -316,6 +318,9 @@ main (int argc, char *argv[]) free (drop_vars); } + reader = case_map_create_input_translator ( + case_map_stage_to_case_map (stage), reader); + if (!strcmp (output_format, "csv") || !strcmp (output_format, "txt")) { if (!csv_opts.delimiter)