[LDTP-Dev] [PATCH] New searching algorithm implementation

A Nagappan anagappan at novell.com
Fri Sep 23 03:11:25 PDT 2005


Hi Prem,

Few comments:
1. In get_class_id function (gui.c), you can use Role instead of
RoleName
2. In filter_appmap_data function (remap.c), use Role instead of
RoleName
3. In add_appmap_data function (remap.c), strip ':' for label_by

Let us call for volunteers to test this new code !!! Can somebody try
this in Solaris, FreeBSD and confirm that the new change does not break
anything ?

Thanks
Nagappan

Hi All,

I have completed implementation of the new searching algorithm which I
have proposed few weeks back. This new algorithm works based on the
child index of the GUI object with respect to its immediate parent. I
have also implemented the remap() component function using which we
can
handle GUI objects generated at run time. More clear details about the
remap component function and its usage will be available in the API
reference page in our web site after the patch is accepted by the
maintainer and checked into CVS.

Thanks 
Premkumar J


Index: appmap.c
===================================================================
RCS file: /cvs/pyldtp/appmap.c,v
retrieving revision 1.11
diff - u - p - r1.11 appmap.c
---  appmap.c	5 Sep 2005 12:17:55 - 0000	1.11
+++ appmap.c	23 Sep 2005 16:26:06 - 0000
@@ - 4,6 +4,7 @@
  * Author:
  *    Nagappan A <anagappan at novell.com>
  *    S Thanikachalam <sthanikachalam at novell.com>
+ *    Premkumar J <jpremkumar at novell.com>
  *
  * Copyright 2004, 2005 Novell, Inc.
  *
@@ - 57,6 +58,55 @@ char *read_line (int fd)
   return NULL;
 }
 
+void add_child_attributes (char *cur_entry, GHashTable
*cur_context_table)
+{
+  char *token = NULL;
+  int offset;
+  char *component = NULL;
+	    
+  token = strtok (strdup (cur_entry), "=");
+  if (token)
+    component = strdup (token);
+	    
+  offset = strlen (component) + 1;
+  if (cur_entry[offset] == '{')
+    {
+      char *end = strstr (cur_entry, "}");
+      if (end)
+	{
+	  char *key, *value;
+	  char *all_attributes;
+	  GHashTable *hash_attributes;
+	  int len = (end -  cur_entry) -  (offset+1);
+	 
+	  all_attributes = (char *) malloc (sizeof (char) * len + 1);
+	  strncpy (all_attributes, (cur_entry + offset + 1), len);
+	  all_attributes[len] = '\0';
+	 
+	  /*
+	    Create new attribute hash table
+	  */
+	  hash_attributes = g_hash_table_new (&g_str_hash,
&g_str_equal);
+	  key = strtok (strdup (all_attributes), "=");
+	  while (key)
+	    {
+	      // Strip any white spaces
+	      key = g_strdup (g_strstrip (key));
+	      value = strtok (NULL, ",");
+	      if (value)
+		// Strip any white spaces
+		value = g_strdup (g_strstrip (value));
+	      g_print ("%s: %s\n", key, value);
+	      if (hash_attributes)
+		g_hash_table_insert (hash_attributes, key, value);
+	      key = strtok (NULL, "=");
+	    }
+	  if (component)
+	    g_hash_table_insert (cur_context_table, component,
hash_attributes);
+	}
+    }
+}
+
 void print_attributes (char *key, char *value, char *userdata)
 {
   g_print ("\t|------- %s = %s\n", key, value);
@@ - 79,12 +129,16 @@ void print_context (char *key, GHashTabl
 */
 Appmap *appmap_init (char *gui_map_filename)
 {
-   int fd;
+  int fd, i;
+  //int quit_flag = 0;
   FILE *fp;
+  char *userdata = NULL;
+  char *cur_entry = NULL;
   GHashTable *appmap;
+  GHashTable *cur_context_table = NULL;
 
   appmap = g_hash_table_new (&g_str_hash, &g_str_equal);
-
+    
   fp = fopen (gui_map_filename, "r");
   if (fp ==NULL)
     {
@@ - 94,98 +148,37 @@ Appmap *appmap_init (char *gui_map_filen
     }
   fd = fileno (fp);
 
-   {
-     char *data;
-     char *context = NULL;
-     char *component = NULL;
-     GHashTable *hash_components = NULL;
-
-     while (1)
-       {
-	data = read_line (fd);
-	if (data == NULL)
-	  { 
-	    if (hash_components)
-	      g_hash_table_insert (appmap, context, hash_components);
-	    break;
-	  }
-	/*
-	  FIXME: Thanika
-	  In appmap.map file [gedit] is defined
-	*/
-	if (data[0] == '[')
-	  {
-	    if (hash_components && context)
-	      {
-		g_hash_table_insert (appmap, context, hash_components);
-	      }
-					
-	    char *end = strstr (data, "]");
-	    if (end)
-	      {	
-		int len = end -  data;
-
-		hash_components = g_hash_table_new (&g_str_hash,
&g_str_equal);
-					
-		context = (char *) malloc (sizeof (char) * len + 1);
-		strncpy (context, (data+1), len- 1);
-		context[len- 1] = '\0';
-	      }
-	    continue;
-	  }
-	if (context)
-	  {
-	    char *token;
-	    int offset;
-
-	    token = strtok (strdup (data), "=");
-	    if (token)
-	      component = strdup (token);
-
-	    offset = strlen (component) + 1;
-	    if (data[offset] == '{')
-	      {
-		char *end = strstr (data, "}");
-		if (end)
-		  {
-		    char *key, *value;
-		    char *all_attributes;
-		    GHashTable *hash_attributes;
-		    int len = (end -  data) -  (offset+1);
-
-		    all_attributes = (char *) malloc (sizeof (char) *
len + 1);
-		    strncpy (all_attributes, (data+offset+1), len);
-		    all_attributes[len] = '\0';
-
-		    /*
-		      Create new attribute hash table
-		    */
-		    hash_attributes = g_hash_table_new (&g_str_hash,
&g_str_equal);
-		    key = strtok (strdup (all_attributes), "=");
-		    while (key)
-		      {
-			// Strip any white spaces
-			key = g_strdup (g_strstrip (key));
-			value = strtok (NULL, ",");
-			if (value)
-			  // Strip any white spaces
-			  value = g_strdup (g_strstrip (value));
-			g_print ("%s: %s\n", key, value);
-			g_hash_table_insert (hash_attributes, key,
value);
-			key = strtok (NULL, "=");
-		      }
-		    if (component)
-		      g_hash_table_insert (hash_components, component,
hash_attributes);
-		  }
-	      }
-	  }
-	free(data);
-       }
-   }
-   /*
-     Print all the data in hash table
-   */
-   g_hash_table_foreach (appmap, (GHFunc)&print_context, NULL);
+  cur_entry = read_line (fd);
+  while(1)
+    {
+      int cur_entry_len;
+      char *context = NULL;
+      if (!cur_entry)
+	break;
+      cur_entry_len = strlen (cur_entry);
+      if (cur_entry [0] == '[' && cur_entry [cur_entry_len -  2] ==
']')
+	{
+	  cur_context_table = g_hash_table_new (&g_str_hash,
&g_str_equal);
+	  context = (char *) malloc (sizeof (char) * (cur_entry_len - 
1));
+	  for (i = 1; i < cur_entry_len -  2; i++)
+	    context [i- 1] = cur_entry [i];
+	  context[i- 1] = '\0';
+	  if (appmap) 
+	    g_hash_table_insert (appmap, g_strdup (context),
cur_context_table);
+	  g_free (context);
+	}
+      else if (cur_entry[0] == '\n') 
+	{
+	  cur_entry = read_line (fd);
+	  continue;
+	}
+      else
+	{
+	  add_child_attributes (cur_entry, cur_context_table);
+	}
+      cur_entry = read_line (fd);
+    }
+  g_hash_table_foreach (appmap, (GHFunc)&print_context, userdata);
   return appmap;
 }
 
@@ - 215,7 +208,7 @@ gboolean remove_appmap_entries (gpointer
 {
   Appmap *context;
   extern Appmap *appmap;
-
+    
   context = g_hash_table_lookup (appmap, (char *)key);
   g_hash_table_foreach_remove (context,
(GHRFunc)&remove_context_entries, context);
   if (key)
@@ - 230,57 +223,11 @@ gboolean remove_appmap_entries (gpointer
 void free_appmap ()
 {
   extern Appmap *appmap;
-
+    
   g_hash_table_foreach_remove (appmap,
(GHRFunc)&remove_appmap_entries,
NULL);
   g_hash_table_destroy (appmap);
 }
 
- /*
-   If only partial component / context name is available in .sdd file
then
-   use the respective string and get the component / context handle
- */
- static gboolean find (gpointer key, gpointer value, gpointer
user_data)
-{
-   char *strkey, *strvalue, *data;
-   strkey = (char *) key;
-   strvalue = (char *) value;
-   data = (char *) user_data;
-   g_print ("Find: -  Key: %s -  Search: %s\n", strkey, data);
-   if (data && strncasecmp (key, data, strlen (data)) == 0)
-     return TRUE;
-   else
-     return FALSE;
-}
-
- /*
-   Get component definition
- */
- GHashTable* get_component_def (Appmap *ht, char *context, char
*component)
-{
-   GHashTable *ht_context, *ht_component = NULL;
-
-   if (context == NULL || component == NULL || ht == NULL)
-     return NULL;
-   /*
-     Search given context in hash table
-   */
-   ht_context = g_hash_table_lookup (ht, context);
-   if (!ht_context)
-     ht_context = g_hash_table_find (ht, (GHRFunc)&find, context);
-   if (ht_context)
-     {
-       /*
-	Search given component in hash table
-       */
-       ht_component = g_hash_table_lookup (ht_context, component);
-       if (!ht_component)
-	ht_component = g_hash_table_find (ht_context, (GHRFunc)&find,
component);
-     }
-   else
-     g_print ("Context definition %s not found\n", context);
-   return ht_component;
-}
-
 char *get_property (GHashTable *ht, char *property)
 {
   char *value = NULL;
Index: appmap.h
===================================================================
RCS file: /cvs/pyldtp/appmap.h,v
retrieving revision 1.4
diff - u - p - r1.4 appmap.h
---  appmap.h	5 Sep 2005 12:17:55 - 0000	1.4
+++ appmap.h	23 Sep 2005 16:26:06 - 0000
@@ - 4,6 +4,7 @@
  * Author:
  *    Nagappan A <anagappan at novell.com>
  *    S Thanikachalam <sthanikachalam at novell.com>
+ *    Premkumar J <jpremkumar at novell.com>
  *
  * Copyright 2004, 2005 Novell, Inc.
  *
@@ - 30,9 +31,8 @@ typedef GHashTable Appmap;
 
 Appmap *appmap_init (char *);
 void   free_appmap (void);
- void   populate_appmap (void);
+void   add_child_attributes (char *, GHashTable *);
 char   *read_line (int);
 char   *get_property (GHashTable *, char *);
- GHashTable *get_component_def (Appmap *, char *, char*);
 
 #endif /*__APPMAP_H__*/
Index: gui.c
===================================================================
RCS file: /cvs/pyldtp/gui.c,v
retrieving revision 1.45
diff - u - p - r1.45 gui.c
---  gui.c	5 Sep 2005 12:17:55 - 0000	1.45
+++ gui.c	23 Sep 2005 16:26:06 - 0000
@@ - 5,6 +5,7 @@
  *    Nagappan A <anagappan at novell.com>
  *    S Thanikachalam <sthanikachalam at novell.com>
  *    Poornima <pnayak at novell.com>
+ *    Premkumar J <jpremkumar at novell.com>
  *
  * Copyright 2004, 2005 Novell, Inc.
  *
@@ - 33,45 +34,82 @@ static char *last_existing_context = NUL
 extern char *ldtp_debug;
 Accessible *accessible_app;
 
- void extract_keys (char *key, char *value, KeyList *key_list)
+int push (struct node *head, int value)
 {
-   if (key != NULL)
+  struct node *new_node;
+
+  new_node = (struct node *) malloc (sizeof (struct node));
+  if (new_node)
     {
-       key_list- >key_count++;
-       if (!key_list- >key)
-	key_list- >key = (char **) malloc (sizeof (char *));
-       else
-	key_list- >key = (char **) realloc (key_list- >key, 
-					   sizeof (char *) * key_list-
>key_count);
-       /*
-	TODO: Check whether key duped while returned 
-       */
-       key_list- >key[key_list- >key_count- 1] = strdup(key);
+      new_node- >child_index = value;
+      new_node- >next = head- >next;
+      head- >next = new_node;
+      return 1;
     }
+  else
+    return 0;
 }
 
- /*
-   FIXME: Thanika, why this function ?
-   A samll description here will be fine...
- */
- KeyList *get_keys (GHashTable *ht)
+int pop (struct node *head)
 {
-   KeyList *key_list;
-
-   key_list = (KeyList *) malloc (sizeof (KeyList));
+  struct node *temp;
+  int index;
+  if (head- >next)
+    {
+      index = head- >next- >child_index;
+      temp = head- >next;
+      head- >next = temp- >next;
+      g_free (temp);
+    }
+  else
+    index = - 1;
+  return index;
+}
 
-   key_list- >key_count = 0;
-   key_list- >key = NULL;
+struct node *init_stack ()
+{
+  struct node *head;
+  head = (struct node *) malloc (sizeof (struct node));
+  if (head)
+    {
+      head- >child_index = - 1;
+      head- >next = NULL;
+      return head;
+    }
+  else
+    return NULL;
+}
 
-   g_hash_table_foreach (ht, (GHFunc)&extract_keys, key_list);
+struct node *trace_path_to_parent (GHashTable *context, char
*context_name, GHashTable *component)
+{
+  struct node *head;
+  char *parent_name;
 
-   return key_list;
+  head = init_stack ();
+  if (!head)
+    {
+      log_msg (LOG_CAUSE, "Problem in initialising stack");
+      return NULL;
+    }
+  else
+    {
+      push (head, atoi (get_property (component, "child_index")));
+      parent_name = get_property (component, "parent");
+      while (g_strcasecmp (context_name, parent_name))
+	{
+	  component = (GHashTable *) get_property (context,
parent_name);
+	  if (component)
+	    {
+	      push (head, atoi (get_property (component,
"child_index")));
+	      parent_name = get_property (component, "parent");
+	    }
+	  else
+	    break;
+	}
+    }
+  return head;
 }
 
- /*
-   FIXME: Thanika, is this description, ok ?
-   Get class index based on the class string defined locally
- */
 int get_class_id (char *class)
 {
   /*
@@ - 82,15 +120,15 @@ int get_class_id (char *class)
   if (class == NULL)
     return class_id;
 
-   if (g_ascii_strcasecmp (class, "check_box") == 0)
+  if (g_ascii_strcasecmp (class, "check box") == 0)
     class_id = CHECK_BOX;
-   else if (g_ascii_strcasecmp (class, "check_menu_item") == 0)
+  else if (g_ascii_strcasecmp (class, "check menu item") == 0)
     class_id = CHECK_MENU_ITEM;
-   else if (g_ascii_strcasecmp (class, "combo_box") == 0)
+  else if (g_ascii_strcasecmp (class, "combo box") == 0)
     class_id = COMBO_BOX;
   else if (g_ascii_strcasecmp (class, "dialog") == 0)
     class_id = DIALOG;
-   else if (g_ascii_strcasecmp (class, "file_chooser") == 0)
+  else if (g_ascii_strcasecmp (class, "file chooser") == 0)
     class_id = FILE_CHOOSER;
   else if (g_ascii_strcasecmp (class, "fontchooser") == 0)
     class_id = FONT_CHOOSER;
@@ - 100,47 +138,47 @@ int get_class_id (char *class)
     class_id = ICON;
   else if (g_ascii_strcasecmp (class, "label") == 0)
     class_id = LABEL;
-   else if (g_ascii_strcasecmp (class, "layered_pane") == 0)
+  else if (g_ascii_strcasecmp (class, "layered pane") == 0)
     class_id = LAYERED_PANE;
   else if (g_ascii_strcasecmp (class, "list") == 0)
     class_id = LIST;
   else if (g_ascii_strcasecmp (class, "menu") == 0)
     class_id = MENU;
-   else if (g_ascii_strcasecmp (class, "menu_bar") == 0)
+  else if (g_ascii_strcasecmp (class, "menu bar") == 0)
     class_id = MENU_BAR;
-   else if (g_ascii_strcasecmp (class, "menu_item") == 0)
+  else if (g_ascii_strcasecmp (class, "menu item") == 0)
     class_id = MENU_ITEM;
-   else if (g_ascii_strcasecmp (class, "page_tab") == 0)
+  else if (g_ascii_strcasecmp (class, "page tab") == 0)
     class_id = PAGE_TAB;
-   else if (g_ascii_strcasecmp (class, "page_tab_list") == 0)
+  else if (g_ascii_strcasecmp (class, "page tab list") == 0)
     class_id = PAGE_TAB_LIST;
   else if (g_ascii_strcasecmp (class, "panel") == 0)
     class_id = PANEL;
-   else if (g_ascii_strcasecmp (class, "password_text") == 0)
+  else if (g_ascii_strcasecmp (class, "password text") == 0)
     class_id = PASSWORD_TEXT;
-   else if (g_ascii_strcasecmp (class, "push_button") == 0)
+  else if (g_ascii_strcasecmp (class, "push button") == 0)
     class_id = PUSH_BUTTON;
-   else if (g_ascii_strcasecmp (class, "radio_button") == 0)
+  else if (g_ascii_strcasecmp (class, "radio button") == 0)
     class_id = RADIO_BUTTON;
-   else if (g_ascii_strcasecmp (class, "radio_menu_item") == 0)
+  else if (g_ascii_strcasecmp (class, "radio menu item") == 0)
     class_id = RADIO_MENU_ITEM;
-   else if (g_ascii_strcasecmp (class, "scroll_bar") == 0)
+  else if (g_ascii_strcasecmp (class, "scroll bar") == 0)
     class_id = SCROLL_BAR;
   else  if (g_ascii_strcasecmp (class, "slider") == 0)
     class_id = SLIDER;
-   else if (g_ascii_strcasecmp (class, "spin_button") == 0)
+  else if (g_ascii_strcasecmp (class, "spin button") == 0)
     class_id = SPIN_BUTTON;
   else if (g_ascii_strcasecmp (class, "table") == 0)
     class_id = TABLE;
-   else if (g_ascii_strcasecmp (class, "table_cell") == 0)
+  else if (g_ascii_strcasecmp (class, "table cell") == 0)
     class_id = TABLE_CELL;
   else if (g_ascii_strcasecmp (class, "text") == 0)
     class_id = TEXT;
-   else if (g_ascii_strcasecmp (class, "toggle_button") == 0)
+  else if (g_ascii_strcasecmp (class, "toggle button") == 0)
     class_id = TOGGLE_BUTTON;
-   else if (g_ascii_strcasecmp (class, "tool_bar") == 0)
+  else if (g_ascii_strcasecmp (class, "tool bar") == 0)
     class_id = TOOL_BAR;
-   else if(g_ascii_strcasecmp (class, "tree_table") == 0)
+  else if(g_ascii_strcasecmp (class, "tree table") == 0)
     class_id = TREE_TABLE;
   else if(g_ascii_strcasecmp (class, "statusbar") == 0)
     class_id = STATUS_BAR;
@@ - 150,439 +188,40 @@ int get_class_id (char *class)
     class_id = CALENDAR;
   else if(g_ascii_strcasecmp (class, "alert") == 0)
     class_id = ALERT;
-   else if(g_ascii_strcasecmp (class, "tool_bar") == 0)
+  else if(g_ascii_strcasecmp (class, "tool bar") == 0)
     class_id = TOOL_BAR;
-   else if(g_ascii_strcasecmp (class, "password_text") == 0)
+  else if(g_ascii_strcasecmp (class, "password text") == 0)
     class_id = PASSWORD_TEXT;	  
   return class_id;
 }
 
- Accessible *is_child_obj_matching (Accessible *accessible,
AccessibleRole role, int index)
-{
-   static int tmp_index = 0;
-   int i, num_child;
-   Accessible *child, *parent = NULL;
-   num_child = Accessible_getChildCount (accessible);
-   /*
-     FIXME: This search algorithm has to be refined
-   */
-   for (i = 0; i < num_child; i++)
-     {
-       char *name;
-       char *role_name;
-       child = Accessible_getChildAtIndex (accessible, i);
-       if (!child)
-	continue;
-       name = Accessible_getName (child);
-       role_name = Accessible_getRoleName (child);
-       if (ldtp_debug && strcmp (ldtp_debug, "2") == 0)
-	g_print ("Child object Name: %s -  Role: %s -  %d -  %d -  %d - 
%d\n",
-		 name, role_name, Accessible_getRole (child), role,
index,
tmp_index);
-       SPI_freeString (role_name);
-       SPI_freeString (name);
-
-       if (Accessible_getRole (child) == role)
-	{
-	  if (index == tmp_index)
-	    {
-	      tmp_index = 0;
-	      return child;
-	    }
-	  else
-	    tmp_index++;
-	  Accessible_unref (child);
-	}
-       else
-	{
-	  parent = child;
-	  /*
-	    Call this function recursively, until we reach the end of
-	    depth first search in all the given object handle
-	  */
-	  child = is_child_obj_matching (parent, role, index);
-	  Accessible_unref (parent);
-	  if (child != NULL)
-	    {
-	      return child;
-	    }
-	}
-     }
-   return NULL;
-}
-
- int is_matching (Accessible *child, GHashTable *ht, char *context);
-
- Accessible *get_childs_parent (Accessible *child, GHashTable
*parent_info, char *context)
-{
-   int status;
-   Accessible *tmp;
-   Accessible *parent;
-
-   tmp = child;
-   do
-     {
-       char *name, *role_name;
-       parent = Accessible_getParent (tmp);
-       name = Accessible_getName (parent);
-       role_name = Accessible_getRoleName (parent);
-       g_print ("Parent object -  Name: %s -  Role: %s\n", name,
role_name);
-       SPI_freeString (name);
-       SPI_freeString (role_name);
-       status = is_matching (parent, parent_info, context);
-       if (tmp != child)
-	Accessible_unref (tmp);
-       tmp = parent;
-       if (status == 1)
-	{
-	  return parent;
-	}
-     } while (status == 0);
-   if (tmp != child)
-     Accessible_unref (tmp);
-   return NULL;
-}
-
- /*
-   Verify accessible object name with appmap definition
- */
- int is_matching (Accessible *child, GHashTable *ht, char *context)
+int object_state_contains (Accessible *object, int control_type)
 {
-   int flag = 0;
-   int class_id = 0;
-
+  int i;
+  int count;
+  gchar *msg;
   char *name = NULL;
-   char *label = NULL;
-   char *class = NULL;
-
-   AccessibleRole role;
-
-   /*
-     FIXME: Check return value
-   */
-   role = Accessible_getRole (child);
-   class = get_property (ht, "class");
-   label = get_property (ht, "label");
+  SPIBoolean object_state;
+  AccessibleStateSet *state;
 
-   if (class)
-     {
-       class_id = get_class_id (class);
-       if (ldtp_debug && strcmp (ldtp_debug, "2") == 0)
-	g_print ("Class: %s -  %d -  %d Label: %s\n", class, role,
class_id,
label);
-     }
-   else
-     g_print ("Class id is not defined\n");
-   if (role == class_id || role == EXTENDED)
+  name = Accessible_getRoleName (object);
+  state = Accessible_getStateSet (object);
+  count = state_list[control_type].states_count;
+  for (i = 0; i < count; i++)
     {
-       int i, n_keys;
-       KeyList *key_list;
-
-       /*
-	Get the size of hash table
-       */
-       n_keys = g_hash_table_size (ht);
-       key_list = get_keys (ht);
-
-       if (ldtp_debug && strcmp (ldtp_debug, "2") == 0)
-	g_print ("Key count: %d\n", key_list- >key_count);
-       /*
-	Find the object which matches with all the attributes
-	defined in guimap
-       */
-       for (i = 0; i < key_list- >key_count; i++)
-	{
-	  char *prop; // Property
-
-	  prop = key_list- >key[i];
-	  if (ldtp_debug && strcmp (ldtp_debug, "2") == 0)
-	    g_print ("Class type: %s\n", prop);
-	  if (strcasecmp (prop, "label") == 0)
-	    {
-	      name = Accessible_getName (child);
-	      if (ldtp_debug && strcmp (ldtp_debug, "2") == 0)
-		{
-		  g_print ("Object name: %s\n", name);
-		  g_print ("Object label: %s\n", label);
-		}
-	      if (name == NULL || label == NULL)
-		return 0;
-               if (strchr (name, ' ') != NULL)
-                 g_strstrip (name);
-	      if (last_existing_context && last_new_context)
-		{
-		  gchar *tmp_name = NULL;
-		  gchar *tmp_label = NULL;
-		  gchar *tmp_last_new_context = NULL;
-		  gchar *tmp_last_existing_context = NULL;
-
-		  g_print ("%s -  %s -  %s -  %s\n",
last_existing_context,
last_new_context, label, name);
-		  tmp_name = g_ascii_strup (name, strlen (name));
-		  tmp_label = g_ascii_strup (label, strlen (label));
-		  tmp_last_new_context = g_ascii_strup
(last_new_context,
-							strlen
(last_new_context));
-		  tmp_last_existing_context = g_ascii_strup
(last_existing_context,
-							     strlen
(last_existing_context));
-
-		  if ((strcasecmp (label, last_existing_context) == 0
||
-		       strncasecmp (label, last_existing_context,
-				    strlen (last_existing_context)) == 0
||
-		       strstr (tmp_label, tmp_last_existing_context) !=
NULL) &&
-		      (strcasecmp (name, last_new_context) == 0 ||
-		       strncasecmp (name, last_new_context, strlen
(last_new_context)) == 0 ||
-		       strstr (tmp_name, tmp_last_new_context) !=
NULL))
-		    {
-		      g_print ("%s -  %s -  %s -  %s\n",
last_existing_context,
last_new_context, label, name);
-		      /*
-			FIXME: regular expr should be implemented
-		      */
-		      SPI_freeString (name);
-		      flag++;
-		    }
-		  else if (strcasecmp (name, label) == 0)
-		    {
-		      g_print ("%s -  %s -  %s -  %s\n",
last_existing_context,
last_new_context, label, name);
-		      /*
-			FIXME: regular expr should be implemented
-		      */
-		      SPI_freeString (name);
-		      flag++;
-		    }
-		  else
-		    {
-		      SPI_freeString (name);
-		    }
-		  g_free (tmp_name);
-		  g_free (tmp_label);
-		  g_free (tmp_last_new_context);
-		  g_free (tmp_last_existing_context);
-		}
-	      else if (g_ascii_strcasecmp (name, label) == 0)
-		{
-		  SPI_freeString (name);
-		  flag++;
-		}
-               else
-		{
-		  SPI_freeString (name);
-		  /*
-		    FIXME: Add comments
-		    Why we return here ?
-		  */
-		  return 0;
-	        }
-             }
-	  else if (strcasecmp (prop, "label_by") == 0)
-	    {
-	      int i;
-	      int max_accessible = 0;
-	      char *label_by = NULL;
-	      AccessibleRelation **relation;
-
-	      relation = Accessible_getRelationSet (child);
-	      max_accessible = AccessibleRelation_getNTargets
(*relation);
-	      label_by = get_property (ht, "label_by");
-
-	      if (max_accessible > 0)
-		{
-		  for (i = 0; i < AccessibleRelation_getNTargets
(relation[i]); i++)
-		    {
-		      AccessibleRelationType r



Nagappan A <anagappan at novell.com>
Linux Desktop Testing Project - http://gnomebangalore.org/ldtp
http://nagappanal.blogspot.com



More information about the Ldtp-dev mailing list