LTTV 0.8.3 : permit spaces in filter names
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 6 Jan 2006 19:30:03 +0000 (19:30 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 6 Jan 2006 19:30:03 +0000 (19:30 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1455 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/configure.in
ltt/branches/poly/lttv/lttv/filter.c

index 47313f28eb837e5d7db262c95a4cd8ae47483e6f..0ec75c9ff8b04b5a721d613a408afb53039a6d77 100644 (file)
@@ -23,7 +23,7 @@
 AC_PREREQ(2.57)
 AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
 #AC_WITH_LTDL  # not needed ?
-AM_INIT_AUTOMAKE(LinuxTraceToolkitViewer,0.8.2-06012006)
+AM_INIT_AUTOMAKE(LinuxTraceToolkitViewer,0.8.3-06012006)
 AM_CONFIG_HEADER(config.h)
 AM_PROG_LIBTOOL
 
index 4d02187291cf5d513973b535e4e18e787806eed8..dfbcaba8a7bb27b5736b0bce3163736628b07b70 100644 (file)
@@ -1255,6 +1255,7 @@ lttv_filter_update(LttvFilter* filter) {
   
   /* temporary values */
   GString *a_field_component = g_string_new(""); 
+  GString *a_string_spaces = g_string_new(""); 
   GPtrArray *a_field_path = g_ptr_array_new(); 
   
   /* simple expression buffer */
@@ -1334,6 +1335,8 @@ lttv_filter_update(LttvFilter* filter) {
         } else {  /* append a simple expression */
           lttv_simple_expression_assign_value(a_simple_expression,g_string_free(a_field_component,FALSE)); 
           a_field_component = g_string_new("");
+                                       g_string_free(a_string_spaces, TRUE);
+                                       a_string_spaces = g_string_new("");
           t2->left = LTTV_TREE_LEAF;
           t2->l_child.leaf = a_simple_expression;
           a_simple_expression = lttv_simple_expression_new(); 
@@ -1366,6 +1369,8 @@ lttv_filter_update(LttvFilter* filter) {
        } else {    /* append a simple expression */
           lttv_simple_expression_assign_value(a_simple_expression,g_string_free(a_field_component,FALSE)); 
           a_field_component = g_string_new("");
+                                       g_string_free(a_string_spaces, TRUE);
+                                       a_string_spaces = g_string_new("");
           t2->left = LTTV_TREE_LEAF;
           t2->l_child.leaf = a_simple_expression;
           a_simple_expression = lttv_simple_expression_new();
@@ -1398,6 +1403,8 @@ lttv_filter_update(LttvFilter* filter) {
         } else {    /* append a simple expression */
           lttv_simple_expression_assign_value(a_simple_expression,g_string_free(a_field_component,FALSE)); 
           a_field_component = g_string_new("");
+                                       g_string_free(a_string_spaces, TRUE);
+                                       a_string_spaces = g_string_new("");
           t2->left = LTTV_TREE_LEAF;
           t2->l_child.leaf = a_simple_expression;
           a_simple_expression = lttv_simple_expression_new(); 
@@ -1410,6 +1417,8 @@ lttv_filter_update(LttvFilter* filter) {
           g_ptr_array_add( a_field_path,(gpointer) a_field_component );
           lttv_simple_expression_assign_field(a_field_path,a_simple_expression);
           a_field_component = g_string_new("");         
+                                       g_string_free(a_string_spaces, TRUE);
+                                       a_string_spaces = g_string_new("");
           lttv_simple_expression_assign_operator(a_simple_expression,LTTV_FIELD_NE);
           i++;
         } else {  /* ! */
@@ -1468,6 +1477,8 @@ lttv_filter_update(LttvFilter* filter) {
         } else {    /* assign subtree as current tree */
           lttv_simple_expression_assign_value(a_simple_expression,g_string_free(a_field_component,FALSE)); 
           a_field_component = g_string_new("");
+                                       g_string_free(a_string_spaces, TRUE);
+                                       a_string_spaces = g_string_new("");
           t1->right = LTTV_TREE_LEAF;
           t1->r_child.leaf = a_simple_expression;
           a_simple_expression = lttv_simple_expression_new(); 
@@ -1483,6 +1494,8 @@ lttv_filter_update(LttvFilter* filter) {
         g_ptr_array_add( a_field_path,(gpointer) a_field_component );
         lttv_simple_expression_assign_field(a_field_path,a_simple_expression);
         a_field_component = g_string_new("");         
+                               g_string_free(a_string_spaces, TRUE);
+                               a_string_spaces = g_string_new("");
         if(filter->expression[i+1] == '=') { /* <= */
           i++;
           lttv_simple_expression_assign_operator(a_simple_expression,LTTV_FIELD_LE);
@@ -1494,6 +1507,8 @@ lttv_filter_update(LttvFilter* filter) {
         g_ptr_array_add( a_field_path,(gpointer) a_field_component );   
         lttv_simple_expression_assign_field(a_field_path,a_simple_expression);
         a_field_component = g_string_new("");         
+                               g_string_free(a_string_spaces, TRUE);
+                               a_string_spaces = g_string_new("");
         if(filter->expression[i+1] == '=') {  /* >= */
           i++;
           lttv_simple_expression_assign_operator(a_simple_expression,LTTV_FIELD_GE);
@@ -1505,6 +1520,8 @@ lttv_filter_update(LttvFilter* filter) {
         g_ptr_array_add( a_field_path,(gpointer) a_field_component );
         lttv_simple_expression_assign_field(a_field_path,a_simple_expression);
         a_field_component = g_string_new("");         
+                               g_string_free(a_string_spaces, TRUE);
+                               a_string_spaces = g_string_new("");
         lttv_simple_expression_assign_operator(a_simple_expression,LTTV_FIELD_EQ);
         break;
         
@@ -1522,13 +1539,25 @@ lttv_filter_update(LttvFilter* filter) {
         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("");
+                                       g_string_free(a_string_spaces, TRUE);
+                                       a_string_spaces = g_string_new("");
         }
         break;
-      case ' ':   /* ignore */
+      case ' ':   /* keep spaces that are within a field component */
+                               if(a_field_component->len == 0) break; /* ignore */
+                               else 
+               a_string_spaces = g_string_append_c(a_string_spaces,
+                                                                                                                                                                                       filter->expression[i]);
+
       case '\n':  /* ignore */
         break;
       default:    /* concatening current string */
-        g_string_append_c(a_field_component,filter->expression[i]);
+                               if(a_string_spaces->len != 0) {
+               g_string_append(a_field_component, a_string_spaces->str);
+                                       a_string_spaces = g_string_set_size(a_string_spaces, 0);
+                               }
+        a_field_component = g_string_append_c(a_field_component,
+                                                                                                                                                                                       filter->expression[i]);
     }
   }
 
@@ -1568,6 +1597,8 @@ lttv_filter_update(LttvFilter* filter) {
   } else {  /* add a leaf */
     lttv_simple_expression_assign_value(a_simple_expression,g_string_free(a_field_component,FALSE)); 
     a_field_component = NULL;
+               g_string_free(a_string_spaces, TRUE);
+               a_string_spaces = NULL;
     t1->right = LTTV_TREE_LEAF;
     t1->r_child.leaf = a_simple_expression;
     a_simple_expression = NULL;
@@ -1584,7 +1615,8 @@ lttv_filter_update(LttvFilter* filter) {
   
   /* free the field buffer if allocated */
   if(a_field_component != NULL) g_string_free(a_field_component,TRUE); 
+       if(a_string_spaces != NULL) g_string_free(a_string_spaces, TRUE);
+
   /* free the simple expression buffer if allocated */
   if(a_simple_expression != NULL) lttv_simple_expression_destroy(a_simple_expression);
   
This page took 0.027482 seconds and 4 git commands to generate.