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

gEDA-cvs: gaf.git: branch: master updated (1.5.0-20080706-361-g4c6af30)



The branch, master has been updated
       via  4c6af30bf52cfe9c25057eaca2cf3f2edd7e76c3 (commit)
       via  955a025379dae2a1c39b31a4653e7daa335013ad (commit)
      from  0b87dfd3c9a4188d4112015bbc7f6f0a38e8fb34 (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_priv.h |    3 +-
 libgeda/src/a_basic.c            |   26 +++++++---
 libgeda/src/o_attrib.c           |   93 --------------------------------------
 libgeda/src/o_complex_basic.c    |    6 +-
 4 files changed, 22 insertions(+), 106 deletions(-)


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

commit 4c6af30bf52cfe9c25057eaca2cf3f2edd7e76c3
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Dec 11 13:25:25 2008 +0000

    libgeda: Tweak o_save_objects() so it can be used to save attributes
    
    This allows us to use o_save_objects() recursively for saving attributes,
    and remove o_save_attribs() which was otherwise almost identical.

:100644 100644 9b46975... 9dd3bf7... M	libgeda/include/prototype_priv.h
:100644 100644 ef372bd... 003b76f... M	libgeda/src/a_basic.c
:100644 100644 e612ac4... f783386... M	libgeda/src/o_attrib.c

commit 955a025379dae2a1c39b31a4653e7daa335013ad
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Dec 11 13:25:15 2008 +0000

    libgeda: Fixup doxygen comments for o_complex_get_toplevel_attribs()

:100644 100644 d6a2518... dddf3cd... M	libgeda/src/o_complex_basic.c

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

commit 4c6af30bf52cfe9c25057eaca2cf3f2edd7e76c3
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Dec 11 13:25:25 2008 +0000

    libgeda: Tweak o_save_objects() so it can be used to save attributes
    
    This allows us to use o_save_objects() recursively for saving attributes,
    and remove o_save_attribs() which was otherwise almost identical.

diff --git a/libgeda/include/prototype_priv.h b/libgeda/include/prototype_priv.h
index 9b46975..9dd3bf7 100644
--- a/libgeda/include/prototype_priv.h
+++ b/libgeda/include/prototype_priv.h
@@ -1,5 +1,5 @@
 /* a_basic.c */
-gchar *o_save_objects(GList *object_list);
+gchar *o_save_objects(GList *object_list, gboolean save_attribs);
 
 /* f_print.c */
 void f_print_set_line_width(FILE *fp, int width);
@@ -95,7 +95,6 @@ GList *o_read_attribs(TOPLEVEL *toplevel,
                       TextBuffer *tb,
                       unsigned int release_ver,
                       unsigned int fileformat_ver);
-gchar *o_save_attribs(GList *attribs);
 
 /* o_basic.c */
 void o_bounds_invalidate(TOPLEVEL *toplevel, OBJECT *object);
diff --git a/libgeda/src/a_basic.c b/libgeda/src/a_basic.c
index ef372bd..003b76f 100644
--- a/libgeda/src/a_basic.c
+++ b/libgeda/src/a_basic.c
@@ -74,7 +74,7 @@ gchar *o_save_buffer (TOPLEVEL *toplevel)
 
   acc = g_string_new (o_file_format_header());
 
-  buffer = o_save_objects (toplevel->page_current->object_list);
+  buffer = o_save_objects (toplevel->page_current->object_list, FALSE);
   g_string_append (acc, buffer);
   g_free (buffer);
 
@@ -87,10 +87,16 @@ gchar *o_save_buffer (TOPLEVEL *toplevel)
  *  libgeda format.  User code should not normally call this function;
  *  they should call o_save_buffer() instead.
  *
- *  \param [in] object_list  Head of list of objects to save.
+ *  With save_attribs passed as FALSE, attribute objects are skipped over,
+ *  and saved separately - after the objects they are attached to. When
+ *  we recurse for saving out those attributes, the function must be called
+ *  with save_attribs passed as TRUE.
+ *
+ *  \param [in] object_list   Head of list of objects to save.
+ *  \param [in] save_attribs  Should attribute objects encounterd be saved?
  *  \returns a buffer containing schematic data or NULL on failure.
  */
-gchar *o_save_objects (GList *object_list)
+gchar *o_save_objects (GList *object_list, gboolean save_attribs)
 {
   OBJECT *o_current;
   GList *iter;
@@ -106,7 +112,7 @@ gchar *o_save_objects (GList *object_list)
     o_current = (OBJECT *)iter->data;
 
     if (o_current->type != OBJ_HEAD &&
-        o_current->attached_to == NULL) {
+        (save_attribs || o_current->attached_to == NULL)) {
 
       switch (o_current->type) {
 
@@ -139,7 +145,7 @@ gchar *o_save_objects (GList *object_list)
           if (o_complex_is_embedded(o_current)) {
             g_string_append(acc, "[\n");
 
-            out = o_save_objects(o_current->complex->prim_objs);
+            out = o_save_objects(o_current->complex->prim_objs, FALSE);
             g_string_append (acc, out);
             g_free(out);
 
@@ -193,9 +199,13 @@ gchar *o_save_objects (GList *object_list)
 
       /* save any attributes */
       if (o_current->attribs != NULL) {
-        out = o_save_attribs(o_current->attribs);
-        g_string_append(acc, out);
-        g_free (out);
+        g_string_append (acc, "{\n");
+
+        out = o_save_objects (o_current->attribs, TRUE);
+        g_string_append (acc, out);
+        g_free(out);
+
+        g_string_append (acc, "}\n");
       }
     }
 
diff --git a/libgeda/src/o_attrib.c b/libgeda/src/o_attrib.c
index e612ac4..f783386 100644
--- a/libgeda/src/o_attrib.c
+++ b/libgeda/src/o_attrib.c
@@ -407,99 +407,6 @@ GList *o_read_attribs (TOPLEVEL *toplevel,
   return(object_list);
 }
 
-/*! \brief Save attributes into a string buffer.
- *  \par Function Description
- *  Saves a list of attributes int a buffer in libgeda, including the
- *  attribute list start and end markers.
- *
- *  \param [in] attribs  attributes to write.
- *  \todo
- *  this should be trimmed down to only save attributes which are text items
- */
-gchar *o_save_attribs(GList *attribs)
-{
-  OBJECT *a_current=NULL;
-  GList *a_iter;
-  GString *acc;
-  gchar *out;
-
-  a_iter = attribs;
-
-  acc = g_string_new("{\n");
-
-  while ( a_iter != NULL ) {
-    a_current = a_iter->data;
-
-    if (a_current->type != OBJ_HEAD) {
-
-#if DEBUG
-      printf("type: %d %c  ref: %d %c\n", a_current->type, a_current->type,
-             OBJ_PIN, OBJ_PIN);
-#endif
-      
-      switch (a_current->type) {
-
-        case(OBJ_LINE):
-          out = (char *) o_line_save(a_current);
-          break;
-
-        case(OBJ_NET):
-          out = (char *) o_net_save(a_current);
-          break;
-
-        case(OBJ_BUS):
-          out = (char *) o_bus_save(a_current);
-          break;
-
-        case(OBJ_BOX):
-          out = (char *) o_box_save(a_current);
-          break;
-		
-        case(OBJ_CIRCLE):
-          out = (char *) o_circle_save(a_current);
-          break;
-
-        case(OBJ_COMPLEX):
-        case(OBJ_PLACEHOLDER):  /* new type -- SDB 1.20.2005 */
-          out = (char *) o_complex_save(a_current);
-          break;
-
-        case(OBJ_TEXT):
-          out = (char *) o_text_save(a_current);
-          break;
-
-        case(OBJ_PATH):
-          out = (char *) o_path_save(a_current);
-          break;
-
-        case(OBJ_PIN):
-          out = (char *) o_pin_save(a_current);
-          break;
-
-        case(OBJ_ARC):
-          out = (char *) o_arc_save(a_current);
-          break;
-
-  	case(OBJ_PICTURE):
-	  out = (char *) o_picture_save(a_current);
-	  break;
-
-        default:
-          fprintf(stderr, "Error type!\n");
-          exit(-1);
-          break;
-      }
-
-      g_string_append_printf(acc, "%s\n", out);
-      g_free(out);
-    }
-    a_iter = g_list_next (a_iter);
-  } 
-
-  g_string_append(acc, "}\n");
-
-  return g_string_free(acc, FALSE);
-}
 
 /*! \brief Get name and value from an attribute 'name=value' string.
  *  \par Function Description

commit 955a025379dae2a1c39b31a4653e7daa335013ad
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Thu Dec 11 13:25:15 2008 +0000

    libgeda: Fixup doxygen comments for o_complex_get_toplevel_attribs()

diff --git a/libgeda/src/o_complex_basic.c b/libgeda/src/o_complex_basic.c
index d6a2518..dddf3cd 100644
--- a/libgeda/src/o_complex_basic.c
+++ b/libgeda/src/o_complex_basic.c
@@ -242,9 +242,9 @@ int o_complex_is_embedded(OBJECT *o_current)
  *  \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
+ *  \param [in]  toplevel  The toplevel environment.
+ *  \param [in]  obj_list  The object list to search for attributes
+ *  \returns               A GList of attribute OBJECTs
  */
 GList *o_complex_get_toplevel_attribs (TOPLEVEL *toplevel, GList *obj_list)
 {




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