data-parser: Use data-file error types for data-file errors.
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 24 Nov 2012 23:51:33 +0000 (15:51 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 24 Nov 2012 23:51:33 +0000 (15:51 -0800)
The SW error type that these calls to msg() used before this command
include the name of the executing command in the error message.  This can
be confusing because the executing command may not have any connection to
the command that said to read the data file.  This commit changes these
error types to DW, which is intended for errors in a data file (and omits
the command name).

Bug #26517.

src/language/data-io/data-parser.c
tests/language/data-io/data-list.at
tests/language/stats/crosstabs.at
tests/language/stats/rank.at

index 3485f7af1bab7598865cae630aaa8356bd887ae4..958326e48d4653cfbde6883f6b6f2a266dcded9a 100644 (file)
@@ -455,7 +455,7 @@ cut_field (const struct data_parser *parser, struct dfm_reader *reader,
       /* Quoted field. */
       int quote = ss_get_byte (&p);
       if (!ss_get_until (&p, quote, field))
-        msg (SW, _("Quoted string extends beyond end of line."));
+        msg (DW, _("Quoted string extends beyond end of line."));
       if (parser->quote_escape && ss_first (p) == quote)
         {
           ds_assign_substring (tmp, *field);
@@ -464,7 +464,7 @@ cut_field (const struct data_parser *parser, struct dfm_reader *reader,
               struct substring ss;
               ds_put_byte (tmp, quote);
               if (!ss_get_until (&p, quote, &ss))
-                msg (SW, _("Quoted string extends beyond end of line."));
+                msg (DW, _("Quoted string extends beyond end of line."));
               ds_put_substring (tmp, ss);
             }
           *field = ds_ss (tmp);
@@ -483,7 +483,7 @@ cut_field (const struct data_parser *parser, struct dfm_reader *reader,
               n_seps++;
             }
           if (!n_seps)
-            msg (SW, _("Missing delimiter following quoted string."));
+            msg (DW, _("Missing delimiter following quoted string."));
         }
     }
   else
@@ -550,7 +550,7 @@ parse_fixed (const struct data_parser *parser, struct dfm_reader *reader,
 
       if (dfm_eof (reader))
         {
-          msg (SW, _("Partial case of %d of %d records discarded."),
+          msg (DW, _("Partial case of %d of %d records discarded."),
                row - 1, parser->records_per_case);
           return false;
         }
@@ -607,7 +607,7 @@ parse_delimited_span (const struct data_parser *parser,
          if (dfm_eof (reader))
            {
              if (f > parser->fields)
-               msg (SW, _("Partial case discarded.  The first variable "
+               msg (DW, _("Partial case discarded.  The first variable "
                            "missing was %s."), f->name);
               ds_destroy (&tmp);
              return false;
@@ -649,7 +649,7 @@ parse_delimited_no_span (const struct data_parser *parser,
       if (!cut_field (parser, reader, &first_column, &last_column, &tmp, &s))
        {
          if (f < end - 1 && settings_get_undefined ())
-           msg (SW, _("Missing value(s) for all variables from %s onward.  "
+           msg (DW, _("Missing value(s) for all variables from %s onward.  "
                        "These will be filled with the system-missing value "
                        "or blanks, as appropriate."),
                 f->name);
@@ -669,7 +669,7 @@ parse_delimited_no_span (const struct data_parser *parser,
   s = dfm_get_record (reader);
   ss_ltrim (&s, parser->soft_seps);
   if (!ss_is_empty (s))
-    msg (SW, _("Record ends in data not part of any field."));
+    msg (DW, _("Record ends in data not part of any field."));
 
 exit:
   dfm_forward_record (reader);
index 05c1eb61a302fe69a90bcedfca78032a7b662b36..ade227274cd0ace507260f2d47a9bf7bed307ed7 100644 (file)
@@ -266,7 +266,7 @@ BEGIN DATA.
 END DATA.
 ])
 AT_CHECK([pspp -O format=csv data-list.sps], [0], [dnl
-data-list.sps:4: warning: LIST: Missing delimiter following quoted string.
+data-list.sps:4: warning: Missing delimiter following quoted string.
 
 Table: Data List
 s
index 67571dd93e876d97044ab09e4ed55d4dd916cb7c..4492e9a25002be3cbc73a4a0a96bfa5fdb9b501e 100644 (file)
@@ -59,9 +59,9 @@ Variable,Format
 x,F8.0
 y,A18
 
-"crosstabs.sps:4: warning: BEGIN DATA: Missing value(s) for all variables from x onward.  These will be filled with the system-missing value or blanks, as appropriate."
+"crosstabs.sps:4: warning: Missing value(s) for all variables from x onward.  These will be filled with the system-missing value or blanks, as appropriate."
 
-"crosstabs.sps:6: warning: BEGIN DATA: Missing value(s) for all variables from x onward.  These will be filled with the system-missing value or blanks, as appropriate."
+"crosstabs.sps:6: warning: Missing value(s) for all variables from x onward.  These will be filled with the system-missing value or blanks, as appropriate."
 
 Table: Summary.
 ,Cases,,,,,
index 6cb366849b88da1e6c7664593ee3c2043cb0a93e..04d5accce741d4501b89273a79d65365dc7e7635 100644 (file)
@@ -481,19 +481,19 @@ DELETE VAR ran001 TO ran999.
 LIST.
 ])
 AT_CHECK([pspp -O format=csv rank.sps], [0], [dnl
-"rank.sps:3: warning: BEGIN DATA: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
+"rank.sps:3: warning: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
 
-"rank.sps:4: warning: BEGIN DATA: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
+"rank.sps:4: warning: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
 
-"rank.sps:5: warning: BEGIN DATA: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
+"rank.sps:5: warning: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
 
-"rank.sps:6: warning: BEGIN DATA: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
+"rank.sps:6: warning: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
 
-"rank.sps:7: warning: BEGIN DATA: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
+"rank.sps:7: warning: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
 
-"rank.sps:8: warning: BEGIN DATA: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
+"rank.sps:8: warning: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
 
-"rank.sps:9: warning: BEGIN DATA: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
+"rank.sps:9: warning: Missing value(s) for all variables from rx onward.  These will be filled with the system-missing value or blanks, as appropriate."
 
 Variables Created By RANK