From e578a22f4c25d628b4c134ddc4f70349aab3925b Mon Sep 17 00:00:00 2001 From: Gilbert Ramirez Date: Thu, 8 Jul 1999 03:35:30 +0000 Subject: Put the XOR logic in place, where previously I had left an inclusive-OR place-holder. Also removed the printf() telling the world that the parser found some punctuation. svn path=/trunk/; revision=347 --- dfilter.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'dfilter.c') diff --git a/dfilter.c b/dfilter.c index 3d0af0af75..cf5a88e5d7 100644 --- a/dfilter.c +++ b/dfilter.c @@ -1,7 +1,7 @@ /* dfilter.c * Routines for display filters * - * $Id: dfilter.c,v 1.2 1999/07/07 23:54:13 guy Exp $ + * $Id: dfilter.c,v 1.3 1999/07/08 03:35:30 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -280,9 +280,7 @@ yylex(void) token = T_VAL_ID; yylval.id = g_strdup(scanner->value.v_identifier); } - else { - printf("(unknown) token = %d\n", token); - } + /* else it's punctuation */ return token; } @@ -364,15 +362,19 @@ dfilter_apply_node(GNode *gnode, proto_tree *ptree, const guint8* pd) static gboolean check_logical(gint operand, GNode *a, GNode *b, proto_tree *ptree, const guint8 *pd) { + gboolean val_a = dfilter_apply_node(a, ptree, pd); + gboolean val_b; + switch(operand) { case TOK_AND: - return (dfilter_apply_node(a, ptree, pd) && dfilter_apply_node(b, ptree, pd)); + return (val_a && dfilter_apply_node(b, ptree, pd)); case TOK_OR: - return (dfilter_apply_node(a, ptree, pd) || dfilter_apply_node(b, ptree, pd)); + return (val_a || dfilter_apply_node(b, ptree, pd)); case TOK_XOR: - return (dfilter_apply_node(a, ptree, pd) || dfilter_apply_node(b, ptree, pd)); + val_b = dfilter_apply_node(b, ptree, pd); + return ( ( val_a || val_b ) && ! ( val_a && val_b ) ); case TOK_NOT: - return (!dfilter_apply_node(a, ptree, pd)); + return (!val_a); default: g_assert_not_reached(); } -- cgit v1.2.3