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

gEDA-cvs: gaf.git: branch: master updated (1.5.0-20080706-371-g7f4ec05)



The branch, master has been updated
       via  7f4ec05b6812bf412ad23da67b82c9378c57aa0c (commit)
      from  136efaf13287e97165bf511f146714ec94796d9a (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
=========

 gschem/src/o_complex.c        |    8 +--
 gschem/src/o_grips.c          |    6 +-
 gschem/src/o_misc.c           |   16 ++--
 gschem/src/o_move.c           |    6 +-
 gschem/src/o_net.c            |    2 +-
 gschem/src/o_place.c          |    2 +-
 libgeda/include/prototype.h   |    4 +-
 libgeda/src/o_complex_basic.c |    9 +-
 libgeda/src/o_net_basic.c     |    2 +-
 libgeda/src/s_basic.c         |    2 +-
 libgeda/src/s_conn.c          |  172 +++++++++++++++++++----------------------
 11 files changed, 107 insertions(+), 122 deletions(-)


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

commit 7f4ec05b6812bf412ad23da67b82c9378c57aa0c
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Fri Dec 12 15:28:07 2008 +0000

    Replace calls to s_conn_..._complex with a non-specialised version
    
    Renamed s_conn_remove() to s_conn_remove_object()
    s_conn_..._object() can then call s_conn_..._complex() as needed.

:100644 100644 5681692... 54199b3... M	gschem/src/o_complex.c
:100644 100644 3a1545d... 6714598... M	gschem/src/o_grips.c
:100644 100644 6008835... 8e3180e... M	gschem/src/o_misc.c
:100644 100644 405b581... 756ef30... M	gschem/src/o_move.c
:100644 100644 baf75bb... e5824c1... M	gschem/src/o_net.c
:100644 100644 c2af7f2... 09a1048... M	gschem/src/o_place.c
:100644 100644 be2c005... f3cc094... M	libgeda/include/prototype.h
:100644 100644 75ed692... 09e6bc1... M	libgeda/src/o_complex_basic.c
:100644 100644 17e1825... 0055467... M	libgeda/src/o_net_basic.c
:100644 100644 140fad6... 86d2679... M	libgeda/src/s_basic.c
:100644 100644 34d861e... a8b3321... M	libgeda/src/s_conn.c

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

commit 7f4ec05b6812bf412ad23da67b82c9378c57aa0c
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Fri Dec 12 15:28:07 2008 +0000

    Replace calls to s_conn_..._complex with a non-specialised version
    
    Renamed s_conn_remove() to s_conn_remove_object()
    s_conn_..._object() can then call s_conn_..._complex() as needed.

diff --git a/gschem/src/o_complex.c b/gschem/src/o_complex.c
index 5681692..54199b3 100644
--- a/gschem/src/o_complex.c
+++ b/gschem/src/o_complex.c
@@ -254,11 +254,7 @@ void o_complex_translate_all(GSCHEM_TOPLEVEL *w_current, int offset)
   iter = toplevel->page_current->object_list;
   while (iter != NULL) {
     o_current = iter->data;
-    if (o_current->type != OBJ_COMPLEX && o_current->type != OBJ_PLACEHOLDER) {
-      s_conn_remove (toplevel, o_current);
-    } else {
-      s_conn_remove_complex (toplevel, o_current);
-    }
+    s_conn_remove_object (toplevel, o_current);
     iter = g_list_next (iter);
   }
         
@@ -279,7 +275,7 @@ void o_complex_translate_all(GSCHEM_TOPLEVEL *w_current, int offset)
     if (o_current->type != OBJ_COMPLEX && o_current->type != OBJ_PLACEHOLDER) {
       s_conn_update_object (toplevel, o_current);
     } else {
-      s_conn_update_complex (toplevel, o_current->complex->prim_objs);
+      s_conn_update_object (toplevel, o_current);
     }
     iter = g_list_next (iter);
   }
diff --git a/gschem/src/o_grips.c b/gschem/src/o_grips.c
index 3a1545d..6714598 100644
--- a/gschem/src/o_grips.c
+++ b/gschem/src/o_grips.c
@@ -1509,7 +1509,7 @@ void o_grips_end_net(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int whichone
 
   other_objects = s_conn_return_others(other_objects, o_current);
 
-  s_conn_remove (toplevel, o_current);
+  s_conn_remove_object (toplevel, o_current);
   o_net_modify (toplevel, o_current, w_current->second_wx,
                 w_current->second_wy, w_current->which_grip);
   s_conn_update_object (toplevel, o_current);
@@ -1591,7 +1591,7 @@ void o_grips_end_pin(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int whichone
 
   other_objects = s_conn_return_others(other_objects, o_current);
 
-  s_conn_remove (toplevel, o_current);
+  s_conn_remove_object (toplevel, o_current);
   o_pin_modify (toplevel, o_current, w_current->second_wx,
                 w_current->second_wy, w_current->which_grip);
   s_conn_update_object (toplevel, o_current);
@@ -1656,7 +1656,7 @@ void o_grips_end_bus(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int whichone
   o_erase_single(w_current, o_current);
 
   other_objects = s_conn_return_others(other_objects, o_current);
-  s_conn_remove (toplevel, o_current);
+  s_conn_remove_object (toplevel, o_current);
 
   o_bus_modify (toplevel, o_current, w_current->second_wx,
                 w_current->second_wy, w_current->which_grip);
diff --git a/gschem/src/o_misc.c b/gschem/src/o_misc.c
index 6008835..8e3180e 100644
--- a/gschem/src/o_misc.c
+++ b/gschem/src/o_misc.c
@@ -218,13 +218,13 @@ void o_rotate_world_update(GSCHEM_TOPLEVEL *w_current,
       case OBJ_PLACEHOLDER:
         other_objects =
           s_conn_return_complex_others(other_objects, o_current);
-        s_conn_remove_complex (toplevel, o_current);
+        s_conn_remove_object (toplevel, o_current);
         break;
       case OBJ_NET:
       case OBJ_PIN:
       case OBJ_BUS:
         other_objects = s_conn_return_others(other_objects, o_current);
-        s_conn_remove (toplevel, o_current);
+        s_conn_remove_object (toplevel, o_current);
         break;
     }
     o_iter = g_list_next (o_iter);
@@ -242,7 +242,7 @@ void o_rotate_world_update(GSCHEM_TOPLEVEL *w_current,
     switch (o_current->type) {
       case OBJ_COMPLEX:
       case OBJ_PLACEHOLDER:
-        s_conn_update_complex (toplevel, o_current->complex->prim_objs);
+        s_conn_update_object (toplevel, o_current);
         connected_objects =
           s_conn_return_complex_others(connected_objects, o_current);
         break;
@@ -348,13 +348,13 @@ void o_mirror_world_update(GSCHEM_TOPLEVEL *w_current, int centerx, int centery,
       case OBJ_PLACEHOLDER:
         other_objects =
           s_conn_return_complex_others(other_objects, o_current);
-        s_conn_remove_complex (toplevel, o_current);
+        s_conn_remove_object (toplevel, o_current);
         break;
       case OBJ_NET:
       case OBJ_PIN:
       case OBJ_BUS:
         other_objects = s_conn_return_others(other_objects, o_current);
-        s_conn_remove (toplevel, o_current);
+        s_conn_remove_object (toplevel, o_current);
         break;
     }
     o_iter = g_list_next (o_iter);
@@ -372,7 +372,7 @@ void o_mirror_world_update(GSCHEM_TOPLEVEL *w_current, int centerx, int centery,
     switch (o_current->type) {
       case OBJ_COMPLEX:
       case OBJ_PLACEHOLDER:
-        s_conn_update_complex (toplevel, o_current->complex->prim_objs);
+        s_conn_update_object (toplevel, o_current);
         connected_objects =
           s_conn_return_complex_others(connected_objects, o_current);
         break;
@@ -759,7 +759,7 @@ void o_update_component(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
   /* erase the complex object */
   o_erase_single (w_current, o_current);
   /* delete its connections */
-  s_conn_remove_complex (toplevel, o_current);
+  s_conn_remove_object (toplevel, o_current);
   /* and unselect it */
   o_selection_remove( toplevel->page_current->selection_list, o_current);
 
@@ -841,7 +841,7 @@ void o_update_component(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
   o_recalc_single_object(toplevel, o_current);
 
   /* reconnect, re-select and redraw */
-  s_conn_update_complex (toplevel, o_current->complex->prim_objs);
+  s_conn_update_object (toplevel, o_current);
   o_selection_add( toplevel->page_current->selection_list, o_current );
   o_redraw_single (w_current, o_current);
 
diff --git a/gschem/src/o_move.c b/gschem/src/o_move.c
index 405b581..756ef30 100644
--- a/gschem/src/o_move.c
+++ b/gschem/src/o_move.c
@@ -114,7 +114,7 @@ void o_move_end_lowlevel (GSCHEM_TOPLEVEL *w_current,
     case (OBJ_PIN):
       /* save the other objects and remove object's connections */
       *other_objects = s_conn_return_others (*other_objects, object);
-      s_conn_remove (toplevel, object);
+      s_conn_remove_object (toplevel, object);
 
       /* do the actual translation */
       o_translate_world (toplevel, diff_x, diff_y, object);
@@ -520,7 +520,7 @@ void o_move_end_rubberband(GSCHEM_TOPLEVEL *w_current, int world_diff_x,
           /* save the other objects and remove object's connections */
           *other_objects =
             s_conn_return_others(*other_objects, object);
-          s_conn_remove (toplevel, object);
+          s_conn_remove_object (toplevel, object);
 
           x = object->line->x[whichone];
           y = object->line->y[whichone];
@@ -565,7 +565,7 @@ void o_move_end_rubberband(GSCHEM_TOPLEVEL *w_current, int world_diff_x,
           /* save the other objects and remove object's connections */
           *other_objects =
             s_conn_return_others(*other_objects, object);
-          s_conn_remove (toplevel, object);
+          s_conn_remove_object (toplevel, object);
 
           x = object->line->x[whichone];
           y = object->line->y[whichone];
diff --git a/gschem/src/o_net.c b/gschem/src/o_net.c
index baf75bb..e5824c1 100644
--- a/gschem/src/o_net.c
+++ b/gschem/src/o_net.c
@@ -1354,7 +1354,7 @@ int o_net_add_busrippers(GSCHEM_TOPLEVEL *w_current, OBJECT *net_obj,
   }
  
   if (made_changes) {
-    s_conn_remove (toplevel, net_obj);
+    s_conn_remove_object (toplevel, net_obj);
 
     if (w_current->bus_ripper_type == COMP_BUS_RIPPER) {
       GList *symlist = 
diff --git a/gschem/src/o_place.c b/gschem/src/o_place.c
index c2af7f2..09a1048 100644
--- a/gschem/src/o_place.c
+++ b/gschem/src/o_place.c
@@ -103,7 +103,7 @@ void o_place_end (GSCHEM_TOPLEVEL *w_current,
 
     /* Update object connectivity */
     if (o_current->type == OBJ_COMPLEX || o_current->type == OBJ_PLACEHOLDER) {
-      s_conn_update_complex (toplevel, o_current->complex->prim_objs);
+      s_conn_update_object (toplevel, o_current);
       connected_objects =
         s_conn_return_complex_others (connected_objects, o_current);
     } else {
diff --git a/libgeda/include/prototype.h b/libgeda/include/prototype.h
index be2c005..f3cc094 100644
--- a/libgeda/include/prototype.h
+++ b/libgeda/include/prototype.h
@@ -359,11 +359,9 @@ void s_color_destroy_all(void);
 CONN *s_conn_return_new(OBJECT *other_object, int type, int x, int y, int whichone, int other_whichone);
 int s_conn_uniq(GList *conn_list, CONN *input_conn);
 int s_conn_remove_other(TOPLEVEL *toplevel, OBJECT *other_object, OBJECT *to_remove);
-void s_conn_remove(TOPLEVEL *toplevel, OBJECT *to_remove);
-void s_conn_remove_complex(TOPLEVEL *toplevel, OBJECT *to_remove);
+void s_conn_remove_object(TOPLEVEL *toplevel, OBJECT *to_remove);
 OBJECT *s_conn_check_midpoint(OBJECT *o_current, int x, int y);
 void s_conn_update_object(TOPLEVEL *toplevel, OBJECT *object);
-void s_conn_update_complex(TOPLEVEL *toplevel, GList *list);
 void s_conn_print(GList *conn_list);
 int s_conn_net_search(OBJECT* new_net, int whichone, GList * conn_list);
 GList *s_conn_return_others(GList *input_list, OBJECT *object);
diff --git a/libgeda/src/o_complex_basic.c b/libgeda/src/o_complex_basic.c
index 75ed692..09e6bc1 100644
--- a/libgeda/src/o_complex_basic.c
+++ b/libgeda/src/o_complex_basic.c
@@ -547,10 +547,6 @@ OBJECT *o_complex_new(TOPLEVEL *toplevel,
 
     o_glist_rotate_world (toplevel, 0, 0, angle, prim_objs);
     o_glist_translate_world (toplevel, x, y, prim_objs);
-
-    if (!toplevel->ADDING_SEL) {
-     s_conn_update_complex (toplevel, prim_objs);
-    }
   }
 
   new_node->complex->prim_objs = prim_objs;
@@ -563,6 +559,11 @@ OBJECT *o_complex_new(TOPLEVEL *toplevel,
 
   o_complex_recalc(toplevel, new_node);
 
+  if (!toplevel->ADDING_SEL) {
+    s_tile_add_object (toplevel, new_node);
+    s_conn_update_object (toplevel, new_node);
+  }
+
   return new_node;
 }
 
diff --git a/libgeda/src/o_net_basic.c b/libgeda/src/o_net_basic.c
index 17e1825..0055467 100644
--- a/libgeda/src/o_net_basic.c
+++ b/libgeda/src/o_net_basic.c
@@ -580,7 +580,7 @@ int o_net_consolidate_segments(TOPLEVEL *toplevel, OBJECT *object)
             o_selection_add( toplevel->page_current->selection_list, object );
           }
 
-          s_conn_remove (toplevel, other_object);
+          s_conn_remove_object (toplevel, other_object);
           s_page_remove (toplevel->page_current, other_object);
           s_delete_object (toplevel, other_object);
           o_net_recalc(toplevel, object);
diff --git a/libgeda/src/s_basic.c b/libgeda/src/s_basic.c
index 140fad6..86d2679 100644
--- a/libgeda/src/s_basic.c
+++ b/libgeda/src/s_basic.c
@@ -226,7 +226,7 @@ void
 s_delete_object(TOPLEVEL *toplevel, OBJECT *o_current)
 {
   if (o_current != NULL) {
-    s_conn_remove (toplevel, o_current);
+    s_conn_remove_object (toplevel, o_current);
 
     if (o_current->attached_to != NULL) {
       /* do the actual remove */
diff --git a/libgeda/src/s_conn.c b/libgeda/src/s_conn.c
index 34d861e..a8b3321 100644
--- a/libgeda/src/s_conn.c
+++ b/libgeda/src/s_conn.c
@@ -158,91 +158,63 @@ int s_conn_remove_other (TOPLEVEL *toplevel, OBJECT *other_object,
     return (FALSE);
 }
 
-/*! \brief remove an OBJECT from the connection system
+/*! \brief removes a GList of OBJECTs from the connection system
+ *
  *  \par Function Description
- *  This function removes all connections from and to the OBJECT
- *  <b>to_remove</b>.
- *  \param toplevel (currently not used)
- *  \param to_remove OBJECT to unconnected from all other objects
+ *  This function removes all connections from and to the OBJECTS
+ *  of the given GList.
+ *
+ *  \param toplevel  (currently not used)
+ *  \param obj_list  GList of OBJECTs to unconnected from all other objects
  */
-void s_conn_remove (TOPLEVEL *toplevel, OBJECT *to_remove)
+static void s_conn_remove_glist (TOPLEVEL *toplevel, GList *obj_list)
 {
-  GList *c_current;
-  CONN *conn;
-
-  if (to_remove->type != OBJ_PIN && to_remove->type != OBJ_NET &&
-      to_remove->type != OBJ_BUS) {
-    return;
-  }
-
-  c_current = to_remove->conn_list;
-  while (c_current != NULL) {
-    conn = (CONN *) c_current->data;
-
-#if DEBUG
-    printf("Removing: %s\n", conn->other_object->name);
-#endif
-
-    /* keep calling this till it returns false (all refs removed) */
-    /* there is NO body to this while loop */
-    while (s_conn_remove_other
-           (toplevel, conn->other_object, to_remove));
-
-#if DEBUG
-    printf("returned from remove_other\n");
-    printf("Freeing: %s %d %d\n", conn->other_object->name, conn->x,
-           conn->y);
-#endif
-    c_current->data = NULL;
-    g_free(conn);
-    c_current = g_list_next(c_current);
-  }
-
-#if DEBUG
-  printf("length: %d\n", g_list_length(to_remove->conn_list));
-#endif
-
-  g_list_free(to_remove->conn_list);
-  to_remove->conn_list = NULL; /*! \todo Memory leak? TODO hack */
+  OBJECT *o_current;
+  GList *iter;
 
-#if 0 /* this does not work right either */
-  if (to_remove->type == OBJ_BUS)
-  {
-    to_remove->bus_ripper_direction = 0;
+  for (iter = obj_list; iter != NULL; iter = g_list_next (iter)) {
+    o_current = iter->data;
+    s_conn_remove_object (toplevel, o_current);
   }
-#endif
 }
 
-/*! \brief remove a complex OBJECT from the connection system
+/*! \brief remove an OBJECT from the connection system
  *  \par Function Description
- *  This function removes all connections from and to the underlying 
- *  OBJECTS of the given complex OBJECT
+ *  This function removes all connections from and to the OBJECT
  *  <b>to_remove</b>.
  *  \param toplevel (currently not used)
  *  \param to_remove OBJECT to unconnected from all other objects
- *
  */
-void s_conn_remove_complex (TOPLEVEL *toplevel, OBJECT *to_remove)
+void s_conn_remove_object (TOPLEVEL *toplevel, OBJECT *to_remove)
 {
-  OBJECT *o_current;
-  GList *iter;
+  GList *c_iter;
+  CONN *conn;
 
-  if (to_remove->type != OBJ_COMPLEX && to_remove->type != OBJ_PLACEHOLDER) {
-    return;
-  }
+  switch (to_remove->type) {
+    case OBJ_PIN:
+    case OBJ_NET:
+    case OBJ_BUS:
+      for (c_iter = to_remove->conn_list;
+           c_iter != NULL;
+           c_iter = g_list_next (c_iter)) {
+        conn = c_iter->data;
+
+        /* keep calling this till it returns false (all refs removed) */
+        /* there is NO body to this while loop */
+        while (s_conn_remove_other (toplevel, conn->other_object, to_remove));
+
+        c_iter->data = NULL;
+        g_free (conn);
+      }
 
-  iter = to_remove->complex->prim_objs;
-  while (iter != NULL) {
-    o_current = (OBJECT *)iter->data;
-    switch (o_current->type) {
-      case (OBJ_NET):
-      case (OBJ_PIN):
-      case (OBJ_BUS):
-        s_conn_remove (toplevel, o_current);
-        break;
+      g_list_free (to_remove->conn_list);
+      to_remove->conn_list = NULL;
+      break;
 
-    }
-    iter = g_list_next (iter);
+    case OBJ_COMPLEX:
+    case OBJ_PLACEHOLDER:
+      s_conn_remove_glist (toplevel, to_remove->complex->prim_objs);
+      break;
   }
 }
 
@@ -300,7 +272,27 @@ OBJECT *s_conn_check_midpoint(OBJECT *o_current, int x, int y)
   return(NULL);
 }
 
-/*! \brief add an OBJECT to the connection system
+/*! \brief adds a GList of OBJECTs to the connection system
+ *
+ *  \par Function Description
+ *  This function adds all connections from and to the OBJECTS
+ *  of the given GList.
+ *
+ *  \param toplevel  (currently not used)
+ *  \param obj_list  GList of OBJECTs to add into the connection system
+ */
+void s_conn_update_glist (TOPLEVEL *toplevel, GList *obj_list)
+{
+  OBJECT *o_current;
+  GList *iter;
+
+  for (iter = obj_list; iter != NULL; iter = g_list_next (iter)) {
+    o_current = iter->data;
+    s_conn_update_object (toplevel, o_current);
+  }
+}
+
+/*! \brief add a line OBJECT to the connection system
  *  \par Function Description
  *  This function searches for all geometrical conections of the OBJECT
  *  <b>object</b> to all other connectable objects. It adds connections
@@ -309,7 +301,7 @@ OBJECT *s_conn_check_midpoint(OBJECT *o_current, int x, int y)
  *  \param toplevel (currently not used)
  *  \param object OBJECT to add into the connection system
  */
-void s_conn_update_object (TOPLEVEL *toplevel, OBJECT *object)
+static void s_conn_update_line_object (TOPLEVEL *toplevel, OBJECT *object)
 {
   TILE *t_current;
   GList *tl_current;
@@ -709,32 +701,30 @@ void s_conn_update_object (TOPLEVEL *toplevel, OBJECT *object)
 #endif
 }
 
-/*! \brief add an complex OBJECT to the connection system
+/*! \brief add an OBJECT to the connection system
+ *
  *  \par Function Description
- *  This function adds all underlying OBJECTs of a complex OBJECT
- *  <b>complex</b> into the connection system.
+ *  This function searches for all geometrical conections of the OBJECT
+ *  <b>object</b> to all other connectable objects. It adds connections
+ *  to the object and from all other objects to this one.
+ *
  *  \param toplevel (currently not used)
- *  \param complex complex OBJECT to add into the connection system
+ *  \param object OBJECT to add into the connection system
  */
-void s_conn_update_complex (TOPLEVEL *toplevel, GList *list)
+void s_conn_update_object (TOPLEVEL *toplevel, OBJECT *object)
 {
-  OBJECT *o_current;
-  GList *iter;
-
-  iter = list;
-  while (iter != NULL) {
-    o_current = (OBJECT *)iter->data;
-    switch (o_current->type) {
-      case (OBJ_PIN):
-      case (OBJ_NET):
-      case (OBJ_BUS):
-        s_conn_update_object (toplevel, o_current);
-        break;
+  switch (object->type) {
+    case OBJ_PIN:
+    case OBJ_NET:
+    case OBJ_BUS:
+      s_conn_update_line_object (toplevel, object);
+      break;
 
-    }
-    iter = g_list_next (iter);
+    case OBJ_COMPLEX:
+    case OBJ_PLACEHOLDER:
+      s_conn_update_glist (toplevel, object->complex->prim_objs);
+      break;
   }
-
 }
 
 /*! \brief print all connections of a connection list




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