X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fexpressions%2Fparse.c;h=0e5f6abbb6323514c3b349f845a962caaacdbbe3;hb=ef28191d9249de6ba14312b4faabcb11d382cdb1;hp=ed5a07093c712b3b034b82f71d6af1fbdc4db0fd;hpb=fe8dc2171009e90d2335f159d05f7e6660e24780;p=pspp diff --git a/src/language/expressions/parse.c b/src/language/expressions/parse.c index ed5a07093c..0e5f6abbb6 100644 --- a/src/language/expressions/parse.c +++ b/src/language/expressions/parse.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006, 2010, 2011 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2010, 2011, 2012, 2014 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 @@ -39,6 +39,7 @@ #include "libpspp/pool.h" #include "libpspp/str.h" +#include "gl/c-strcase.h" #include "gl/xalloc.h" /* Declarations. */ @@ -262,8 +263,9 @@ type_check (struct expression *e, atom_type_name (actual_type)); return false; } - if (actual_type == OP_number && expected_type == OP_boolean) - *n = expr_allocate_unary (e, OP_NUM_TO_BOOLEAN, *n); + if (actual_type == OP_number && expected_type == EXPR_BOOLEAN) + *n = expr_allocate_binary (e, OP_NUM_TO_BOOLEAN, *n, + expr_allocate_string (e, ss_empty ())); break; case EXPR_STRING: @@ -897,8 +899,8 @@ parse_primary (struct lexer *lexer, struct expression *e) dict_encoding = (e->ds != NULL ? dict_get_encoding (dataset_dict (e->ds)) : "UTF-8"); - s = recode_string (dict_encoding, "UTF-8", lex_tokcstr (lexer), - ss_length (lex_tokss (lexer))); + s = recode_string_pool (dict_encoding, "UTF-8", lex_tokcstr (lexer), + ss_length (lex_tokss (lexer)), e->expr_pool); node = expr_allocate_string (e, ss_cstr (s)); lex_get (lexer); @@ -1005,7 +1007,7 @@ compare_names (const char *test, const char *name, bool abbrev_ok) static int compare_strings (const char *test, const char *name, bool abbrev_ok UNUSED) { - return strcasecmp (test, name); + return c_strcasecmp (test, name); } static bool @@ -1268,8 +1270,7 @@ parse_function (struct lexer *lexer, struct expression *e) break; else if (!lex_match (lexer, T_COMMA)) { - lex_error (lexer, _("expecting `,' or `)' invoking %s function"), - first->name); + lex_error_expecting (lexer, "`,'", "`)'", NULL_SENTINEL); goto fail; } } @@ -1291,13 +1292,14 @@ parse_function (struct lexer *lexer, struct expression *e) msg (SW, _("%s is a PSPP extension."), f->prototype); if (f->flags & OPF_UNIMPLEMENTED) { - msg (SE, _("%s is not yet implemented."), f->prototype); + msg (SE, _("%s is not available in this version of PSPP."), + f->prototype); goto fail; } if ((f->flags & OPF_PERM_ONLY) && proc_in_temporary_transformations (e->ds)) { - msg (SE, _("%s may not appear after TEMPORARY."), f->prototype); + msg (SE, _("%s may not appear after %s."), f->prototype, "TEMPORARY"); goto fail; }