X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fsel-if.c;h=c703e2f460fcc898140bffc37448a35661d76f54;hb=d7b5d9144738a5a8989d45a01f4e458a78b68c0b;hp=f686a9ddf57ed9180f815a1965daa17ead0c909b;hpb=77cbf2d7d1e5712d4ef952f265ed5c2917fc3f68;p=pspp diff --git a/src/sel-if.c b/src/sel-if.c index f686a9ddf5..c703e2f460 100644 --- a/src/sel-if.c +++ b/src/sel-if.c @@ -14,18 +14,22 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #include #include "alloc.h" #include "command.h" +#include "dictionary.h" #include "error.h" -#include "expr.h" +#include "expressions/public.h" #include "lexer.h" #include "str.h" #include "var.h" +#include "gettext.h" +#define _(msgid) gettext (msgid) + /* SELECT IF transformation. */ struct select_if_trns { @@ -43,10 +47,7 @@ cmd_select_if (void) struct expression *e; struct select_if_trns *t; - lex_match_id ("SELECT"); - lex_match_id ("IF"); - - e = expr_parse (PXP_BOOLEAN); + e = expr_parse (default_dict, EXPR_BOOLEAN); if (!e) return CMD_FAILURE; @@ -68,11 +69,11 @@ cmd_select_if (void) /* Performs the SELECT IF transformation T on case C. */ static int -select_if_proc (struct trns_header * t, struct ccase * c, +select_if_proc (struct trns_header *t_, struct ccase *c, int case_num) { - return (expr_evaluate (((struct select_if_trns *) t)->e, c, - case_num, NULL) == 1.0) - 2; + struct select_if_trns *t = (struct select_if_trns *) t_; + return expr_evaluate_num (t->e, c, case_num) == 1.0 ? -1 : -2; } /* Frees SELECT IF transformation T. */ @@ -86,8 +87,6 @@ select_if_free (struct trns_header * t) int cmd_filter (void) { - lex_match_id ("FILTER"); - if (lex_match_id ("OFF")) dict_set_filter (default_dict, NULL); else @@ -125,10 +124,7 @@ cmd_process_if (void) { struct expression *e; - lex_match_id ("PROCESS"); - lex_match_id ("IF"); - - e = expr_parse (PXP_BOOLEAN); + e = expr_parse (default_dict, EXPR_BOOLEAN); if (!e) return CMD_FAILURE;