[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: gaf.git: branch: master updated (1.5.0-20080706-217-g9c79c07)



The branch, master has been updated
       via  9c79c0782ad64813a6a302f185299403853d1386 (commit)
       via  d8c1f320b40451a1a83b7c442c8dc376d3d0f4e1 (commit)
      from  bd149a6b4797272b362ecf48a7044f0bfbf0f4bf (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 libgeda/include/prototype.h   |    1 +
 libgeda/src/o_complex_basic.c |   56 ++++++++++++++++++++++++++++++----------
 2 files changed, 43 insertions(+), 14 deletions(-)


=================
 Commit Messages
=================

commit 9c79c0782ad64813a6a302f185299403853d1386
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Wed Oct 8 22:05:13 2008 +0100

    Clean up o_complex_get_promotable and o_complex_is_eligible_attribute
    
    Use a helper function to get the list of toplevel attributes, then filter
    down.

:100644 100644 97c08a1... 47c4164... M	libgeda/src/o_complex_basic.c

commit d8c1f320b40451a1a83b7c442c8dc376d3d0f4e1
Author: Werner Hoch <werner.ho@xxxxxx>
Date:   Wed Oct 8 22:01:10 2008 +0100

    libgeda: function to get all unattached attributes
    
    New function o_complex_get_toplevel_attribs() that returns
    a GList of all text objects that are not attached to other objects
    like pins, nets.
    
    It will be use to get all attributes from a symbol.
    
    (Slightly modified due to merge conflict by Peter Clifton)

:100644 100644 fb52941... e314d07... M	libgeda/include/prototype.h
:100644 100644 26e4f8b... 97c08a1... M	libgeda/src/o_complex_basic.c

=========
 Changes
=========

commit 9c79c0782ad64813a6a302f185299403853d1386
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Wed Oct 8 22:05:13 2008 +0100

    Clean up o_complex_get_promotable and o_complex_is_eligible_attribute
    
    Use a helper function to get the list of toplevel attributes, then filter
    down.

diff --git a/libgeda/src/o_complex_basic.c b/libgeda/src/o_complex_basic.c
index 97c08a1..47c4164 100644
--- a/libgeda/src/o_complex_basic.c
+++ b/libgeda/src/o_complex_basic.c
@@ -234,15 +234,6 @@ static int o_complex_is_eligible_attribute (TOPLEVEL *toplevel, OBJECT *object)
   char *padded_name = NULL;
   int promotableAttribute = FALSE;
 
-  g_return_val_if_fail(object != NULL, FALSE);
-
-  if (object->type != OBJ_TEXT || object->attached_to)
-    return FALSE; /* not a text item or is already attached */
-
-  /* Make sure text item is an attribute */
-  if (!o_attrib_get_name_value (object->text->string, NULL, NULL))
-    return FALSE;  /* not an attribute */
-
   /* always promote symversion= attribute, even if it is invisible */
   if (strncmp(object->text->string, "symversion=", 11) == 0)
     return TRUE;
@@ -346,20 +337,25 @@ GList *o_complex_get_toplevel_attribs (TOPLEVEL *toplevel, OBJECT *o_head)
 GList *o_complex_get_promotable (TOPLEVEL *toplevel, OBJECT *object, int detach)
 {
   GList *promoted = NULL;
-  OBJECT *tmp, *next;
+  GList *attribs;
+  GList *iter;
+  OBJECT *tmp;
 
   if (!toplevel->attribute_promotion) /* controlled through rc file */
     return NULL;
 
-  for (tmp = object->complex->prim_objs->next; tmp != NULL; tmp = next) {
-    next = tmp->next;
+  attribs = o_complex_get_toplevel_attribs (toplevel,
+                                            object->complex->prim_objs);
+
+  for (iter = attribs; iter != NULL; iter = g_list_next (iter)) {
+    tmp = iter->data;
 
-    /* valid floating attrib? */
+    /* Is it an attribute we want to promote? */
     if (!o_complex_is_eligible_attribute(toplevel, tmp))
       continue;
 
     if (detach) {
-      /* Remove and isolate tmp from the complex list */
+      /* Remove and isolate it from the complex list */
       if (tmp->next)
         tmp->next->prev = tmp->prev;
       if (tmp->prev)

commit d8c1f320b40451a1a83b7c442c8dc376d3d0f4e1
Author: Werner Hoch <werner.ho@xxxxxx>
Date:   Wed Oct 8 22:01:10 2008 +0100

    libgeda: function to get all unattached attributes
    
    New function o_complex_get_toplevel_attribs() that returns
    a GList of all text objects that are not attached to other objects
    like pins, nets.
    
    It will be use to get all attributes from a symbol.
    
    (Slightly modified due to merge conflict by Peter Clifton)

diff --git a/libgeda/include/prototype.h b/libgeda/include/prototype.h
index fb52941..e314d07 100644
--- a/libgeda/include/prototype.h
+++ b/libgeda/include/prototype.h
@@ -180,6 +180,7 @@ int world_get_object_glist_bounds(TOPLEVEL *toplevel, GList *o_list,
 			     int *right, int *bottom);
 OBJECT *new_head(void);
 int o_complex_is_embedded(OBJECT *o_current);
+GList *o_complex_get_toplevel_attribs (TOPLEVEL *toplevel, OBJECT *o_head);
 GList *o_complex_get_promotable (TOPLEVEL *toplevel, OBJECT *object, int detach);
 void o_complex_promote_attribs (TOPLEVEL *toplevel, OBJECT *object);
 void o_complex_remove_promotable_attribs (TOPLEVEL *toplevel, OBJECT *object);
diff --git a/libgeda/src/o_complex_basic.c b/libgeda/src/o_complex_basic.c
index 26e4f8b..97c08a1 100644
--- a/libgeda/src/o_complex_basic.c
+++ b/libgeda/src/o_complex_basic.c
@@ -293,6 +293,38 @@ int o_complex_is_embedded(OBJECT *o_current)
 }
 
 
+/*! \brief Get a list of all toplevel attributes of and object list
+ *
+ *  \par Function Description
+ *  Returns a GList of all attribute OBJECTs
+ *
+ *  \param [in]  toplevel The toplevel environment.
+ *  \param [in]  o_head   The head of the object list
+ *  \returns              A GList of attribute OBJECTs
+ */
+GList *o_complex_get_toplevel_attribs (TOPLEVEL *toplevel, OBJECT *o_head)
+{
+  OBJECT *o_current;
+  GList *o_list = NULL;
+
+  for (o_current = o_head;
+       o_current != NULL;
+       o_current = o_current->next) {
+
+    if (o_current->type == OBJ_TEXT &&
+        o_current->attached_to == NULL &&
+        o_attrib_get_name_value (o_current->text->string, NULL, NULL)) {
+
+      o_list = g_list_prepend (o_list, o_current);
+    }
+  }
+
+  o_list = g_list_reverse (o_list);
+
+  return o_list;
+}
+
+
 /*! \brief Get attributes eligible for promotion from inside a complex
  *
  *  \par Function Description




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs