X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fdictionary%2Fnumeric.c;h=18728014f331f5ba68eabbafafe23467b6f069f1;hb=4fea709b5f138c4087954b57664d5f171e02a399;hp=e306d6b9d28c8ebe4cf4a46493df02e2adcf6a7c;hpb=8f20801a82fe1382da0033996c08160a9f93a3da;p=pspp diff --git a/src/language/dictionary/numeric.c b/src/language/dictionary/numeric.c index e306d6b9d2..18728014f3 100644 --- a/src/language/dictionary/numeric.c +++ b/src/language/dictionary/numeric.c @@ -58,14 +58,20 @@ cmd_numeric (struct lexer *lexer, struct dataset *ds) if (!parse_format_specifier (lexer, &f)) goto fail; - if ( ! fmt_check_output (&f)) - goto fail; + char *error = fmt_check_output__ (&f); + if (error) + { + lex_next_error (lexer, -1, -1, "%s", error); + free (error); + goto fail; + } if (fmt_is_string (f.type)) { char str[FMT_STRING_LEN_MAX + 1]; - msg (SE, _("Format type %s may not be used with a numeric " - "variable."), fmt_to_string (&f, str)); + lex_next_error (lexer, -1, -1, + _("Format type %s may not be used with a numeric " + "variable."), fmt_to_string (&f, str)); goto fail; } @@ -129,17 +135,20 @@ cmd_string (struct lexer *lexer, struct dataset *ds) return CMD_FAILURE; if (!lex_force_match (lexer, T_LPAREN) - || !parse_format_specifier (lexer, &f) - || !lex_force_match (lexer, T_RPAREN)) + || !parse_format_specifier (lexer, &f)) goto fail; - if (!fmt_is_string (f.type)) - { - char str[FMT_STRING_LEN_MAX + 1]; - msg (SE, _("Format type %s may not be used with a string " - "variable."), fmt_to_string (&f, str)); - goto fail; - } - if (!fmt_check_output (&f)) + + char *error = fmt_check_type_compat__ (&f, NULL, VAL_STRING); + if (!error) + error = fmt_check_output__ (&f); + if (error) + { + lex_next_error (lexer, -2, -2, "%s", error); + free (error); + goto fail; + } + + if (!lex_force_match (lexer, T_RPAREN)) goto fail; width = fmt_var_width (&f);