compilation of work done on tuesday on the filter core/text module.
authorsiboud <siboud@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 16 Feb 2005 18:55:26 +0000 (18:55 +0000)
committersiboud <siboud@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 16 Feb 2005 18:55:26 +0000 (18:55 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@873 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/lttv/filter.c
ltt/branches/poly/lttv/lttv/filter.h
ltt/branches/poly/lttv/modules/text/textFilter.c

index d2f62d81c178e67b108f5af709b7bba1fd09ca64..aa29b2c5c521b70d77c23752e62908a1994789bd 100644 (file)
@@ -25,7 +25,6 @@
 
 /*
  *  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 
@@ -67,21 +73,21 @@ parse_field_path(GList* fp) {
   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;
@@ -120,12 +126,7 @@ lttv_filter_new(char *expression, LttvTraceState *tcs) {
     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 */
@@ -177,7 +178,7 @@ lttv_filter_new(char *expression, LttvTraceState *tcs) {
           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 */
@@ -213,7 +214,7 @@ lttv_filter_new(char *expression, LttvTraceState *tcs) {
         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]);                            
     }
   }
 
@@ -263,6 +264,9 @@ lttv_filter_tracefile(lttv_filter *filter, LttTracefile *tracefile) {
  */
 }
 
+gboolean
+lttv_filter_tracestate(lttv_filter *filter, LttvTraceState *tracestate) {}
+
 /**
  *     Apply the filter to a specific event
  *     @param filter the current filter applied
@@ -273,3 +277,25 @@ gboolean
 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)
+
+
+
index 99f3c403a2422f7f9e44b780d3610f89e494a2e5..d405a09ade8378f9ae9c8ef22e3b865df9812e3b 100644 (file)
@@ -52,7 +52,7 @@
 
 */
 
-static GQuark
+extern GQuark
   LTTV_FILTER_TRACE,
   LTTV_FILTER_TRACESET,
   LTTV_FILTER_TRACEFILE,
@@ -85,22 +85,31 @@ typedef struct _lttv_simple_expression
   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;
@@ -134,6 +143,8 @@ lttv_filter *lttv_filter_new(char *expression, LttvTraceState *tfs);
 
 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
index c0e56ee14781a0f6219a3fd85c9ea955b598324b..bcca87515df5a354fecc11034026756941918a0e 100644 (file)
@@ -125,7 +125,8 @@ static void init() {
       "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", 
@@ -169,5 +170,5 @@ static void destroy() {
 
 LTTV_MODULE("textFilter", "Filters traces", \
            "Filter the trace following commands issued by user input", \
-           init, destroy, "batchAnalysis", "option")
+           init, destroy, "option")
 
This page took 0.027504 seconds and 4 git commands to generate.