diff options
author | nagappan <nagappan> | 2005-10-05 14:16:22 +0000 |
---|---|---|
committer | nagappan <nagappan> | 2005-10-05 14:16:22 +0000 |
commit | eb3ac4a4081b0858193ac385acb35471e6072177 (patch) | |
tree | 5df957af26c0dcab53883f4a7a40abebc71f663e | |
parent | cc429a477e4ea3f65336532e374e3b7f5436d498 (diff) |
2005-10-04 Nagappan A <anagappan@novell.com>
* Commented a line in configure.in to work with Debian / Ubuntu distro
2005-10-04 Premkumar J <jpremkumar@novell.com>
* Updated with fix for bug #317594
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | appmap-gen.c | 379 | ||||
-rw-r--r-- | configure.in | 2 |
3 files changed, 201 insertions, 184 deletions
@@ -1,3 +1,7 @@ +2005-10-04 Nagappan A <anagappan@novell.com> + * Commented a line in configure.in to work with Debian / Ubuntu distro +2005-10-04 Premkumar J <jpremkumar@novell.com> + * Updated with fix for bug #317594 2005-09-28 Veerapuram Varadhan <vvaradhan@novell.com> * autogen.sh has been modified to take available automake and aclocal 2005-09-23 Premkumar J <jpremkumar@novell.com> diff --git a/appmap-gen.c b/appmap-gen.c index 4acae4f..6b41ccd 100644 --- a/appmap-gen.c +++ b/appmap-gen.c @@ -100,9 +100,9 @@ void reset_count() */ void free_element (gpointer data) { - char *val; - val = (char *) data; - g_free (val); + char *val; + val = (char *) data; + g_free (val); } /* @@ -194,54 +194,54 @@ int filter_appmap_data (Accessible *accessible, OBJECT_INFO *obj_info, char *lab { if (g_ascii_strcasecmp (obj_info->object_type, "separator" ) == 0 || g_ascii_strcasecmp (obj_info->object_type, "table_cell" ) == 0) - return 0; - if (g_ascii_strcasecmp (label, "ukngrip" ) == 0) - return 0; - if (g_ascii_strcasecmp (obj_info->object_type, "menu_item" ) == 0) - { - Accessible *parent; - Accessible *grand_parent; - int parent_type; - parent = Accessible_getParent (accessible); - grand_parent = Accessible_getParent (parent); - parent_type = Accessible_getRole (grand_parent); - if (parent_type == SPI_ROLE_COMBO_BOX) + return 0; + if (g_ascii_strcasecmp (label, "ukngrip" ) == 0) + return 0; + if (g_ascii_strcasecmp (obj_info->object_type, "menu_item" ) == 0) + { + Accessible *parent; + Accessible *grand_parent; + int parent_type; + parent = Accessible_getParent (accessible); + grand_parent = Accessible_getParent (parent); + parent_type = Accessible_getRole (grand_parent); + if (parent_type == SPI_ROLE_COMBO_BOX) { - Accessible_unref (parent); - Accessible_unref (grand_parent); - return 0; + Accessible_unref (parent); + Accessible_unref (grand_parent); + return 0; } - else + else { - Accessible_unref (parent); - Accessible_unref (grand_parent); - return 1; + Accessible_unref (parent); + Accessible_unref (grand_parent); + return 1; } } - if (g_ascii_strcasecmp (obj_info->object_type, "list_item") == 0) - return 0; + if (g_ascii_strcasecmp (obj_info->object_type, "list_item") == 0) + return 0; - if (g_ascii_strcasecmp (obj_info->object_type, "unknown" ) == 0) + if (g_ascii_strcasecmp (obj_info->object_type, "unknown" ) == 0) { - Accessible *parent; - int parent_type; - parent = Accessible_getParent (accessible); - parent_type = Accessible_getRole (parent); - if (parent_type == SPI_ROLE_TABLE || - parent_type == SPI_ROLE_TREE_TABLE ) + Accessible *parent; + int parent_type; + parent = Accessible_getParent (accessible); + parent_type = Accessible_getRole (parent); + if (parent_type == SPI_ROLE_TABLE || + parent_type == SPI_ROLE_TREE_TABLE ) { - Accessible_unref (parent); - return 0; + Accessible_unref (parent); + return 0; } - else + else { - Accessible_unref (parent); - return 1; + Accessible_unref (parent); + return 1; } } - return 1; + return 1; } char *get_relation_name (Accessible *object) @@ -298,85 +298,87 @@ char *get_relation_name (Accessible *object) */ char *add_appmap_data (FILE *fp, Accessible *accessible, char *parent_name, int child_index, GHashTable *current_context) { - char *name; - char *label_by = NULL; - char *label = NULL; - char *object_record; - char *key; - char *value; - int size; - char *accessible_name; - OBJECT_INFO *cur_obj_info = NULL; + char *name; + char *label_by = NULL; + char *label = NULL; + char *object_record; + char *key; + char *value; + int size; + char *accessible_name; + OBJECT_INFO *cur_obj_info = NULL; - cur_obj_info = get_object_info (accessible); - accessible_name = Accessible_getName (accessible); - label_by = get_relation_name (accessible); - if (label_by) - { - if (g_ascii_strcasecmp (label_by, "") == 0) - label = g_strdup (accessible_name); - else - label = g_strdup (label_by); - } - else - label = g_strdup (accessible_name); - - if (strcmp (label, "") != 0) - { - char *stripped_data = NULL; - char *value = NULL; - if (strchr (label, ' ')) - stripped_data = strip_white_space (label); - else - stripped_data = g_strdup (label); - if (strstr (stripped_data, ".")) + cur_obj_info = get_object_info (accessible); + accessible_name = Accessible_getName (accessible); + label_by = get_relation_name (accessible); + if (label_by) + { + if (g_ascii_strcasecmp (label_by, "") == 0) + label = g_strdup (accessible_name); + else + label = g_strdup (label_by); + } + else + label = g_strdup (accessible_name); + + if (strcmp (label, "") != 0) + { + char *stripped_data = NULL; + char *value = NULL; + if (strchr (label, ' ')) + stripped_data = strip_white_space (label); + else + stripped_data = g_strdup (label); + if (strstr (stripped_data, ".")) { - value = strip_delim (stripped_data, '.'); - g_free (stripped_data); - stripped_data = g_strdup (value); - g_free (value); - value = NULL; + value = strip_delim (stripped_data, '.'); + g_free (stripped_data); + stripped_data = g_strdup (value); + g_free (value); + value = NULL; } - if (strstr (stripped_data, ":")) + if (strstr (stripped_data, ":")) { - value = strip_delim (stripped_data, ':'); - g_free (stripped_data); - stripped_data = g_strdup (value); - g_free (value); - value = NULL; + value = strip_delim (stripped_data, ':'); + g_free (stripped_data); + stripped_data = g_strdup (value); + g_free (value); + value = NULL; } - name = g_strdup_printf ("%s%s", cur_obj_info->prefix, stripped_data); + name = g_strdup_printf ("%s%s", cur_obj_info->prefix, stripped_data); - value = g_hash_table_lookup (current_context, name); - if (value) + value = g_hash_table_lookup (current_context, name); + if (value) { - if (name) - g_free (name); - name = g_strdup_printf ("%s%s%d", cur_obj_info->prefix, stripped_data, cur_obj_info->instance_index); + if (name) + g_free (name); + name = g_strdup_printf ("%s%s%d", cur_obj_info->prefix, stripped_data, cur_obj_info->instance_index); } - g_free (stripped_data); + g_free (stripped_data); } - else - name = g_strdup_printf ("%s%d", cur_obj_info->prefix, cur_obj_info->instance_index); + else + name = g_strdup_printf ("%s%d", cur_obj_info->prefix, cur_obj_info->instance_index); - g_free (label); - label = g_strdup (accessible_name); - SPI_freeString (accessible_name); - if (strstr (label, " ")) - { - char *stripped_data = NULL; - stripped_data = strip_white_space (label); - if (g_ascii_strcasecmp (stripped_data, "") == 0) - { - g_free (label); - label = g_strdup (stripped_data); - g_free (stripped_data); - } - else - g_free (stripped_data); - } + g_free (label); + label = g_strdup (accessible_name); + SPI_freeString (accessible_name); + /* + * Following code is for limiting appmap from generating + * label with value as string made of only space character + */ + if (strchr (label, ' ')) + { + char *stripped_data = NULL; + stripped_data = strip_white_space (label); + if (g_ascii_strcasecmp (stripped_data, "") == 0) + { + g_free (label); + label = g_strdup (stripped_data); + } + g_free (stripped_data); + } - if (filter_appmap_data (accessible, cur_obj_info, name)) + if (filter_appmap_data (accessible, cur_obj_info, name)) { if (g_ascii_strcasecmp (label, "") == 0) { @@ -385,15 +387,6 @@ char *add_appmap_data (FILE *fp, Accessible *accessible, char *parent_name, int cur_obj_info->object_type, parent_name, child_index); else { - char *tmp; - if (strstr (label_by, ":")) - { - tmp = strip_delim (label_by, ':'); - g_free (label_by); - label_by = g_strdup (tmp); - g_free (tmp); - value = NULL; - } object_record = g_strdup_printf ("%s={class=%s,parent=%s,child_index=%d,label_by=%s}\n", name, cur_obj_info->object_type, parent_name, child_index, label_by); g_free (label_by); @@ -425,15 +418,15 @@ char *add_appmap_data (FILE *fp, Accessible *accessible, char *parent_name, int g_free (cur_obj_info); return name; } - else + else { - g_free (name); - g_free (label); - g_free (label_by); - g_free (cur_obj_info->object_type); - g_free (cur_obj_info->prefix); - g_free (cur_obj_info); - return NULL; + g_free (name); + g_free (label); + g_free (label_by); + g_free (cur_obj_info->object_type); + g_free (cur_obj_info->prefix); + g_free (cur_obj_info); + return NULL; } } @@ -728,70 +721,82 @@ OBJECT_INFO *get_object_info (Accessible *accessible) void insert_context_header (FILE *fp, Accessible *accessible) { - char *name; - char *label; - char *object_record; - int size; - char *accessible_name; - OBJECT_INFO *cur_obj_info = NULL; + char *name; + char *label; + char *object_record; + int size; + char *accessible_name; + OBJECT_INFO *cur_obj_info = NULL; - cur_obj_info = get_object_info (accessible); - accessible_name = Accessible_getName (accessible); - label = g_strdup (accessible_name); - SPI_freeString (accessible_name); - if (strcmp (label, "") != 0) - { - char *stripped_data = NULL; - if (strchr (label, ' ')) - stripped_data = strip_white_space (label); - else - stripped_data = g_strdup (label); - name = g_strdup_printf ("%s%s", cur_obj_info->prefix, stripped_data); - g_free (stripped_data); + cur_obj_info = get_object_info (accessible); + accessible_name = Accessible_getName (accessible); + label = g_strdup (accessible_name); + SPI_freeString (accessible_name); + if (strcmp (label, "") != 0) + { + char *stripped_data = NULL; + if (strchr (label, ' ')) + stripped_data = strip_white_space (label); + else + stripped_data = g_strdup (label); + name = g_strdup_printf ("%s%s", cur_obj_info->prefix, stripped_data); + g_free (stripped_data); + } + else + { + /* + * TODO: Handle the case of window label being NULL + */ + g_print ("Found window with label value as NULL!!"); + g_free (label); + g_free (object_record); + g_free (cur_obj_info->object_type); + g_free (cur_obj_info->prefix); + g_free (cur_obj_info); } - object_record = g_strdup_printf ("[%s]\n", name); - size = strlen (object_record); - fwrite (object_record, sizeof (char), size, fp); + object_record = g_strdup_printf ("[%s]\n", name); + size = strlen (object_record); + fwrite (object_record, sizeof (char), size, fp); - g_free (label); - g_free (name); - g_free (object_record); - g_free (cur_obj_info->object_type); - g_free (cur_obj_info->prefix); - g_free (cur_obj_info); + g_free (label); + g_free (name); + g_free (object_record); + g_free (cur_obj_info->object_type); + g_free (cur_obj_info->prefix); + g_free (cur_obj_info); } void create_appmap (FILE *fp, Accessible *accessible, char *application_name) { - int i, num_child; - char *name; - char *label; - Accessible *child; - GHashTable *current_context = NULL; + int i, num_child; + char *name; + char *label; + Accessible *child; + GHashTable *current_context = NULL; - label = Accessible_getName (accessible); - if (strchr (label, ' ')) - name = g_strdup_printf ("[%s]\n", strip_white_space (label)); - else - name = g_strdup_printf ("[%s]\n", label); - - num_child = Accessible_getChildCount (accessible); - for (i = 0; i < num_child; i++) - { - reset_count (); - current_context = g_hash_table_new_full (&g_str_hash, &g_str_equal, &free_element, &free_element); - child = Accessible_getChildAtIndex (accessible, i); - insert_context_header (fp, child); - if (!child) - continue; - accessible_object_handle (fp, child, application_name, i, current_context); - fwrite ("\n", sizeof (char), 1, fp); - g_hash_table_destroy (current_context); - current_context = NULL; - } - g_free (name); - SPI_freeString (label); - Accessible_unref (accessible); + label = Accessible_getName (accessible); + if (strchr (label, ' ')) + name = g_strdup_printf ("[%s]\n", strip_white_space (label)); + else + name = g_strdup_printf ("[%s]\n", label); + + num_child = Accessible_getChildCount (accessible); + for (i = 0; i < num_child; i++) + { + reset_count (); + current_context = g_hash_table_new_full (&g_str_hash, &g_str_equal, &free_element, &free_element); + child = Accessible_getChildAtIndex (accessible, i); + insert_context_header (fp, child); + if (!child) + continue; + accessible_object_handle (fp, child, application_name, i, current_context); + fwrite ("\n", sizeof (char), 1, fp); + g_hash_table_destroy (current_context); + current_context = NULL; + } + g_free (name); + SPI_freeString (label); + Accessible_unref (accessible); } /* @@ -808,22 +813,30 @@ void accessible_object_handle (FILE *fp, Accessible *accessible, char* parent_na num_child = Accessible_getChildCount (accessible); temp_parent = add_appmap_data (fp, accessible, parent_name, child_index, current_context); if (temp_parent) - { + { current_parent = g_strdup_printf ("%s", temp_parent); g_free (temp_parent); for (i = 0; i < num_child; i++) - { + { child = Accessible_getChildAtIndex (accessible, i); if (!child) - continue; + continue; + /* + * To eliminate unnecessary processing of table cells + */ + if (Accessible_getRole (child) == SPI_ROLE_TABLE_CELL) + { + Accessible_unref (child); + break; + } /* Call this function recursively, until we reach the end of depth first search in all the given object handle */ accessible_object_handle (fp, child, current_parent, i, current_context); - } + } g_free (current_parent); - } + } Accessible_unref (accessible); } diff --git a/configure.in b/configure.in index 36e96dc..a4a890b 100644 --- a/configure.in +++ b/configure.in @@ -14,7 +14,7 @@ AC_PROG_INSTALL AC_ISC_POSIX dnl Initialize libtool -AM_DISABLE_STATIC +dnl AM_DISABLE_STATIC dnl AM_PROG_LIBTOOL dnl internationalization support |