From 8ff6243c8bafa3a9c7bddbea54b8e9884c0707ca Mon Sep 17 00:00:00 2001 From: siboud Date: Fri, 1 Apr 2005 21:23:37 +0000 Subject: [PATCH] filter core: - added fix for double expression (xxxx.xxxx) in tree switch - added fix for space and return caracter in expression git-svn-id: http://ltt.polymtl.ca/svn@912 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/lttv/lttv/filter.c | 20 ++++++++++--------- .../poly/lttv/modules/text/textDump.c | 4 +++- .../poly/lttv/modules/text/textFilter.c | 4 ++-- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/ltt/branches/poly/lttv/lttv/filter.c b/ltt/branches/poly/lttv/lttv/filter.c index f7d2c613..7f31c53d 100644 --- a/ltt/branches/poly/lttv/lttv/filter.c +++ b/ltt/branches/poly/lttv/lttv/filter.c @@ -572,6 +572,7 @@ gboolean lttv_apply_op_eq_double(gpointer v1, LttvFieldValue v2) { */ gboolean lttv_apply_op_eq_string(gpointer v1, LttvFieldValue v2) { char* r = (char*) v1; + g_print("v1:%s = v2:%s\n",r,v2.v_string); return (!g_strcasecmp(r,v2.v_string)); } @@ -1243,14 +1244,14 @@ lttv_filter_update(LttvFilter* filter) { * in a_field_path array. */ /* FIXME: check for double values */ -// if(a_simple_expression->op == NULL) { + if(a_simple_expression->field == LTTV_FILTER_UNDEFINED) { g_ptr_array_add( a_field_path,(gpointer) a_field_component ); a_field_component = g_string_new(""); -// } + } + break; + case ' ': + case '\n': break; -// case ' ': -// case '\n': -// ignore default: /* concatening current string */ g_string_append_c(a_field_component,filter->expression[i]); } @@ -1336,7 +1337,7 @@ lttv_filter_destroy(LttvFilter* filter) { } /** - * LttvFilterTree* lttv_filter_tree_new() + * @fn LttvFilterTree* lttv_filter_tree_new() * * Assign a new tree for the current expression * or sub expression @@ -1419,7 +1420,7 @@ lttv_filter_tree_destroy(LttvFilterTree* tree) { } /** - * gboolean lttv_filter_tree_parse(LttvFilterTree*,LttEvent,LttTracefile,LttTrace,LttvProcessState) + * @fn gboolean lttv_filter_tree_parse(LttvFilterTree*,LttEvent,LttTracefile,LttTrace,LttvProcessState) * * Global parsing function for the current * LttvFilterTree @@ -1718,6 +1719,7 @@ lttv_filter_tree_parse( case LTTV_LOGICAL_AND: return (lresult & rresult); case LTTV_LOGICAL_NOT: return (!rresult); case LTTV_LOGICAL_XOR: return (lresult ^ rresult); + case 0: return (rresult); default: /* * This case should never be @@ -1756,7 +1758,7 @@ lttv_print_tree(LttvFilterTree* t) { } /** - * gboolean lttv_filter_tracefile(LttvFilter*, LttTracefile*) + * @fn gboolean lttv_filter_tracefile(LttvFilter*, LttTracefile*) * * Apply the filter to a specific trace * @param filter the current filter applied @@ -1806,7 +1808,7 @@ static void module_init() } /** - * Destroys the filter module and specific values + * @fn Destroys the filter module and specific values */ static void module_destroy() { diff --git a/ltt/branches/poly/lttv/modules/text/textDump.c b/ltt/branches/poly/lttv/modules/text/textDump.c index 1b4a1a4c..8e9b6873 100644 --- a/ltt/branches/poly/lttv/modules/text/textDump.c +++ b/ltt/branches/poly/lttv/modules/text/textDump.c @@ -340,7 +340,9 @@ static int write_event_content(void *hook_data, void *call_data) /* * call to the filter if available */ - lttv_filter_tree_parse(a_lttv_filter->head,e,NULL,NULL,NULL); + if(!lttv_filter_tree_parse(a_lttv_filter->head,e,NULL,NULL,NULL)) { + return FALSE; + } lttv_event_to_string(e, a_string, TRUE, a_field_names, tfs); g_string_append_printf(a_string,"\n"); diff --git a/ltt/branches/poly/lttv/modules/text/textFilter.c b/ltt/branches/poly/lttv/modules/text/textFilter.c index db0f3484..f8a2ea45 100644 --- a/ltt/branches/poly/lttv/modules/text/textFilter.c +++ b/ltt/branches/poly/lttv/modules/text/textFilter.c @@ -136,8 +136,8 @@ void filter_analyze_string(void *hook_data) { if(((GString*)*(value.v_pointer))->len != 0) g_string_append_c((GString*)*(value.v_pointer),'&'); g_string_append((GString*)*(value.v_pointer),a_string); - LttvFilter* filter = lttv_filter_new(); - lttv_filter_append_expression(filter,a_string); +// LttvFilter* filter = lttv_filter_new(); +// lttv_filter_append_expression(filter,a_string); } /** -- 2.34.1