/*
* YET TO BE ANSWERED
- * - should the filter be implemented as a module
* - should all the structures and field types be associated with GQuarks
*/
path(component...) -> field
*/
+GQuark
+ LTTV_FILTER_TRACE,
+ LTTV_FILTER_TRACESET,
+ LTTV_FILTER_TRACEFILE,
+ LTTV_FILTER_STATE,
+ LTTV_FILTER_EVENT;
+
/**
* Parse through filtering field hierarchy as specified
* by user. This function compares each value to
GString* f = g_list_first(fp)->data;
switch(g_quark_try_string(f->str)) {
-// case LTTV_FILTER_TRACE:
+ case LTTV_FILTER_TRACE:
-// break;
-// case LTTV_FILTER_TRACEFILE:
+ break;
+ case LTTV_FILTER_TRACEFILE:
-// break;
-// case LTTV_FILTER_TRACESET:
+ break;
+ case LTTV_FILTER_TRACESET:
-// break;
-// case LTTV_FILTER_STATE:
+ break;
+ case LTTV_FILTER_STATE:
-// break;
-// case LTTV_FILTER_EVENT:
+ break;
+ case LTTV_FILTER_EVENT:
-// break;
+ break;
default: /* Quark value unrecognized or equal to 0 */
g_warning("Unrecognized field in filter string");
return FALSE;
p=0, /* parenthesis nesting value */
b=0; /* current breakpoint in expression string */
- LTTV_FILTER_EVENT = g_quark_from_string("event");
- LTTV_FILTER_TRACE = g_quark_from_string("trace");
- LTTV_FILTER_TRACESET = g_quark_from_string("traceset");
- LTTV_FILTER_STATE = g_quark_from_string("state");
- LTTV_FILTER_TRACEFILE = g_quark_from_string("tracefile");
-
+
gpointer tree = NULL;
/* temporary values */
i++;
} else { /* ! */
g_print("%s\n",a_field_component);
- current_option = g_string_new("");
+ a_field_component = g_string_new("");
}
break;
case '(': /* start of parenthesis */
a_field_component = g_string_new("");
break;
default: /* concatening current string */
- g_string_append_c(current_option,expression[i]);
+ g_string_append_c(a_field_component,expression[i]);
}
}
*/
}
+gboolean
+lttv_filter_tracestate(lttv_filter *filter, LttvTraceState *tracestate) {}
+
/**
* Apply the filter to a specific event
* @param filter the current filter applied
lttv_filter_event(lttv_filter *filter, LttEvent *event) {
}
+
+static void module_init()
+{
+ LTTV_FILTER_EVENT = g_quark_from_string("event");
+ LTTV_FILTER_TRACE = g_quark_from_string("trace");
+ LTTV_FILTER_TRACESET = g_quark_from_string("traceset");
+ LTTV_FILTER_STATE = g_quark_from_string("state");
+ LTTV_FILTER_TRACEFILE = g_quark_from_string("tracefile");
+
+}
+
+static void module_destroy()
+{
+}
+
+
+LTTV_MODULE("filter", "Filter state & event", \
+ "Filters the current tracestate and events from user expression", \
+ module_init, module_destroy)
+
+
+
*/
-static GQuark
+extern GQuark
LTTV_FILTER_TRACE,
LTTV_FILTER_TRACESET,
LTTV_FILTER_TRACEFILE,
char *value;
} lttv_simple_expression;
-
-//typedef union _tmp {
-// struct lttv_expression *e;
-// lttv_field_relation *se;
-//} tmp;
+typedef enum _lttv_logical_op {
+ OR = 1,
+ AND = 1<<1,
+ NOT = 1<<2,
+ XOR = 1<<3
+} lttv_logical_op;
+
/*
+ * Ah .. that's my tree
+ */
typedef struct _lttv_expression
{
- gboolean or;
- gboolean not;
- gboolean and;
- gboolean xor;
- gboolean simple_expression;
-// tmp e;
+// gboolean or;
+// gboolean not;
+// gboolean and;
+// gboolean xor;
+// gboolean simple_expression;
+ lttv_logical_op op;
+ lttv_expression_type type;
+ union {
+ struct lttv_expression *e;
+ lttv_field_relation *se; /* --> simple expression */
+ } e;
} lttv_expression;
-*/
+
typedef union _lttv_expression {
lttv_simple_expression se;
gboolean lttv_filter_tracefile(lttv_filter *filter, LttTracefile *tracefile);
+gboolean lttv_filter_tracestate(lttv_filter *filter, LttvTraceState *tracestate);
+
gboolean lttv_filter_event(lttv_filter *filter, LttEvent *event);
#endif // FILTER_H
"filters a string issued by the user on the command line",
"string",
LTTV_OPT_STRING, &a_filter_string, NULL, NULL);
-
+ // add function to call for option
+
a_file_name = NULL;
lttv_option_add("filename", 'f',
"browse the filter options contained in specified file",
LTTV_MODULE("textFilter", "Filters traces", \
"Filter the trace following commands issued by user input", \
- init, destroy, "batchAnalysis", "option")
+ init, destroy, "option")