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

gEDA-cvs: gaf.git: branch: master updated (1.5.0-20080706-237-g4043c63)



The branch, master has been updated
       via  4043c6326d7d56e01cd878a81d1e86c0fcb774b8 (commit)
       via  a4144872c28b3d4f8d192aa31f10e77eed811542 (commit)
      from  2e83bf2b37e093578088eef616e15ee361e85199 (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/i_vars_priv.h |    2 +-
 libgeda/include/struct.h      |    2 +-
 libgeda/lib/system-gafrc      |    6 +++-
 libgeda/src/g_rc.c            |   42 ++++++++++++++++++++++++++++++++++------
 libgeda/src/i_vars.c          |   20 ++++++++++++++----
 libgeda/src/o_complex_basic.c |   12 +++-------
 6 files changed, 60 insertions(+), 24 deletions(-)


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

commit 4043c6326d7d56e01cd878a81d1e86c0fcb774b8
Author: Werner Hoch <werner.ho@xxxxxx>
Date:   Fri Oct 10 10:33:02 2008 +0200

    libgeda: apply GList usage of always-promote-attributes [#2072230]
    
    Changed all variables from char* to GList*.
    Changed initialisation of that variable.
    Use the GList in o_complex.c to check the list.

:100644 100644 537f664... b10047f... M	libgeda/include/i_vars_priv.h
:100644 100644 529cd2d... 849b605... M	libgeda/include/struct.h
:100644 100644 502ef2e... f7d5a50... M	libgeda/lib/system-gafrc
:100644 100644 4cbd3c2... 1292d39... M	libgeda/src/g_rc.c
:100644 100644 2a4274c... 8b7f090... M	libgeda/src/i_vars.c
:100644 100644 5aee666... 40ef318... M	libgeda/src/o_complex_basic.c

commit a4144872c28b3d4f8d192aa31f10e77eed811542
Author: Werner Hoch <werner.ho@xxxxxx>
Date:   Fri Oct 10 08:59:42 2008 +0200

    libgeda: always-promote-attributes: accept list and string [#2072230]
    
    The function g_rc_always_promote_attributes accepts list and strings
    now. The space separated attributes in a string are marked as
    deprecated. The user should use a scm list in future.

:100644 100644 44b76be... 502ef2e... M	libgeda/lib/system-gafrc
:100644 100644 87c87f1... 4cbd3c2... M	libgeda/src/g_rc.c

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

commit 4043c6326d7d56e01cd878a81d1e86c0fcb774b8
Author: Werner Hoch <werner.ho@xxxxxx>
Date:   Fri Oct 10 10:33:02 2008 +0200

    libgeda: apply GList usage of always-promote-attributes [#2072230]
    
    Changed all variables from char* to GList*.
    Changed initialisation of that variable.
    Use the GList in o_complex.c to check the list.

diff --git a/libgeda/include/i_vars_priv.h b/libgeda/include/i_vars_priv.h
index 537f664..b10047f 100644
--- a/libgeda/include/i_vars_priv.h
+++ b/libgeda/include/i_vars_priv.h
@@ -9,7 +9,7 @@ extern char *default_bitmap_directory;
 extern char *default_bus_ripper_symname;
 extern char *default_postscript_prolog;
 
-extern char *default_always_promote_attributes;
+extern GList *default_always_promote_attributes;
 
 extern int default_attribute_promotion;
 extern int default_promote_invisible;
diff --git a/libgeda/include/struct.h b/libgeda/include/struct.h
index 529cd2d..849b605 100644
--- a/libgeda/include/struct.h
+++ b/libgeda/include/struct.h
@@ -546,7 +546,7 @@ struct st_toplevel {
   int print_vector_threshold;
 
   /* List of attributes to always promote */
-  char *always_promote_attributes;
+  GList *always_promote_attributes;
 
   /* gnetlist specific */
   int net_naming_priority;
diff --git a/libgeda/lib/system-gafrc b/libgeda/lib/system-gafrc
index 502ef2e..f7d5a50 100644
--- a/libgeda/lib/system-gafrc
+++ b/libgeda/lib/system-gafrc
@@ -88,9 +88,10 @@
 ; always-promote-attributes
 ;
 ; Set the list of attributes that are always promoted regardless of
-; their visibility.
+; their visibility. The list should be a scm list of strings. The
+; space separated attribute names are deprecated.
 ;
-(always-promote-attributes "footprint device value model-name")
+;(always-promote-attributes "footprint device value model-name")
 (always-promote-attributes '("footprint" "device" "value" "model-name"))
 
 ;
diff --git a/libgeda/src/g_rc.c b/libgeda/src/g_rc.c
index 4cbd3c2..1292d39 100644
--- a/libgeda/src/g_rc.c
+++ b/libgeda/src/g_rc.c
@@ -1021,16 +1021,24 @@ SCM g_rc_always_promote_attributes(SCM attrlist)
   GList *list=NULL;
   int length, i;
   gchar *attr;
+  gchar **attr2;
+
+  g_list_foreach(default_always_promote_attributes, (GFunc)g_free, NULL);
+  g_list_free(default_always_promote_attributes);
 
   if (scm_is_string (attrlist)) {
-    printf("xxx\n");
-    g_free(default_always_promote_attributes);
-    default_always_promote_attributes = 
-      g_strdup_printf(" %s ", SCM_STRING_CHARS (attrlist));
     s_log_message(_("WARNING: using a string for 'always-promote-attributes'"
-		    " is deprecated\n"));
+		    " is deprecated. Use a list of strings instead\n"));
+
+    /* convert the space separated strings into a GList */
+    attr2 = g_strsplit(SCM_STRING_CHARS (attrlist)," ", 0);
+    for (i=0; attr2[i] != NULL; i++) {
+      if (strlen(attr2[i]) > 0) {
+	list = g_list_prepend(list, g_strdup(attr2[i]));
+      }
+    }
+    g_strfreev(attr2);
   } else {
-    printf("yyy\n");
     SCM_ASSERT(scm_list_p(attrlist), attrlist, SCM_ARG1, "always-promote-attributes");
     length = scm_ilength(attrlist);
     /* convert the scm list into a GList */
@@ -1040,10 +1048,10 @@ SCM g_rc_always_promote_attributes(SCM attrlist)
 		 "always-promote-attribute: list element is not a string");
       attr = g_strdup(SCM_STRING_CHARS(scm_list_ref(attrlist, scm_from_int(i))));
       list = g_list_prepend(list, attr);
-      printf("g_rc_always_promote_attributes: %s\n", attr);
     }
-    
   }
 
+  default_always_promote_attributes = g_list_reverse(list);
+
   return SCM_BOOL_T;
 }
diff --git a/libgeda/src/i_vars.c b/libgeda/src/i_vars.c
index 2a4274c..8b7f090 100644
--- a/libgeda/src/i_vars.c
+++ b/libgeda/src/i_vars.c
@@ -43,7 +43,6 @@
 #define DEFAULT_BITMAP_DIRECTORY "../lib/bitmaps"
 #define DEFAULT_BUS_RIPPER_SYMNAME "busripper-1.sym"
 #define DEFAULT_POSTSCRIPT_PROLOG  "prolog.ps"
-#define DEFAULT_ALWAYS_PROMOTE_ATTRIBUTES ""
 
 int   default_init_right = WIDTH_C;
 int   default_init_bottom = HEIGHT_C;
@@ -53,7 +52,7 @@ char *default_scheme_directory = NULL;
 char *default_bitmap_directory = NULL;
 char *default_bus_ripper_symname = NULL;
 char *default_postscript_prolog = NULL;
-char *default_always_promote_attributes = NULL;
+GList *default_always_promote_attributes = NULL;
 
 int   default_attribute_promotion = TRUE;
 int   default_promote_invisible = FALSE;
@@ -68,6 +67,8 @@ int   default_keep_invisible = TRUE;
  */
 void i_vars_libgeda_set(TOPLEVEL *toplevel)
 {
+  GList *iter;
+
   toplevel->init_right   = default_init_right;
   toplevel->init_bottom  = default_init_bottom;
 
@@ -75,6 +76,14 @@ void i_vars_libgeda_set(TOPLEVEL *toplevel)
   toplevel->promote_invisible = default_promote_invisible;
   toplevel->keep_invisible = default_keep_invisible;
 
+  /* copy the always_promote_attributes list from the default */
+  g_list_foreach(toplevel->always_promote_attributes, (GFunc) g_free, NULL);
+  g_list_free(toplevel->always_promote_attributes);
+  toplevel->always_promote_attributes = g_list_copy(default_always_promote_attributes);
+  for (iter = toplevel->always_promote_attributes; iter != NULL;
+       iter = g_list_next(iter))
+    iter->data = g_strdup(iter->data);
+
   /* you cannot free the default* strings here since new windows */
   /* need them */
   INIT_STR(toplevel, untitled_name   , DEFAULT_UNTITLED_NAME   );
@@ -83,8 +92,6 @@ void i_vars_libgeda_set(TOPLEVEL *toplevel)
   INIT_STR(toplevel, bitmap_directory, DEFAULT_BITMAP_DIRECTORY);
   INIT_STR(toplevel, bus_ripper_symname, DEFAULT_BUS_RIPPER_SYMNAME);
   INIT_STR(toplevel, postscript_prolog,  DEFAULT_POSTSCRIPT_PROLOG);
-  INIT_STR(toplevel, always_promote_attributes, DEFAULT_ALWAYS_PROMOTE_ATTRIBUTES);
-
 }
 
 
@@ -101,5 +108,8 @@ void i_vars_libgeda_freenames()
   g_free(default_bitmap_directory);
   g_free(default_bus_ripper_symname);
   g_free(default_postscript_prolog);
-  g_free(default_always_promote_attributes);
+
+  g_list_foreach(default_always_promote_attributes, (GFunc) g_free, NULL);
+  g_list_free(default_always_promote_attributes);
+  default_always_promote_attributes = NULL;
 }
diff --git a/libgeda/src/o_complex_basic.c b/libgeda/src/o_complex_basic.c
index 5aee666..40ef318 100644
--- a/libgeda/src/o_complex_basic.c
+++ b/libgeda/src/o_complex_basic.c
@@ -231,25 +231,21 @@ OBJECT *new_head ()
 static int o_complex_is_eligible_attribute (TOPLEVEL *toplevel, OBJECT *object)
 {
   char *name = NULL;
-  char *padded_name = NULL;
   int promotableAttribute = FALSE;
 
   /* always promote symversion= attribute, even if it is invisible */
   if (strncmp(object->text->string, "symversion=", 11) == 0)
     return TRUE;
-
+  
   /* check list against attributes which can be promoted */
-  if (toplevel->always_promote_attributes &&
-      (strlen(toplevel->always_promote_attributes) != 0)) {
-
+  if (toplevel->always_promote_attributes != NULL) {
     if (o_attrib_get_name_value(object->text->string, &name, NULL)) {
-      padded_name = g_strdup_printf(" %s ", name);
-      if (strstr(toplevel->always_promote_attributes, padded_name)) {
+      if (g_list_find_custom(toplevel->always_promote_attributes,
+			     name, (GCompareFunc) strcmp) != NULL) {
         /* Name of the attribute was in the always promote attributes list */
         promotableAttribute = TRUE;
       }
 
-      g_free(padded_name);
       g_free(name);
       if (promotableAttribute)
         return TRUE;

commit a4144872c28b3d4f8d192aa31f10e77eed811542
Author: Werner Hoch <werner.ho@xxxxxx>
Date:   Fri Oct 10 08:59:42 2008 +0200

    libgeda: always-promote-attributes: accept list and string [#2072230]
    
    The function g_rc_always_promote_attributes accepts list and strings
    now. The space separated attributes in a string are marked as
    deprecated. The user should use a scm list in future.

diff --git a/libgeda/lib/system-gafrc b/libgeda/lib/system-gafrc
index 44b76be..502ef2e 100644
--- a/libgeda/lib/system-gafrc
+++ b/libgeda/lib/system-gafrc
@@ -91,6 +91,7 @@
 ; their visibility.
 ;
 (always-promote-attributes "footprint device value model-name")
+(always-promote-attributes '("footprint" "device" "value" "model-name"))
 
 ;
 ; End of attribute promotion keywords
diff --git a/libgeda/src/g_rc.c b/libgeda/src/g_rc.c
index 87c87f1..4cbd3c2 100644
--- a/libgeda/src/g_rc.c
+++ b/libgeda/src/g_rc.c
@@ -1013,17 +1013,37 @@ SCM g_rc_keep_invisible(SCM mode)
  *  \brief
  *  \par Function Description
  *
- *  \param [in] scmsymname  
+ *  \param [in] attrlist
  *  \return SCM_BOOL_T always.
  */
-SCM g_rc_always_promote_attributes(SCM scmsymname)
+SCM g_rc_always_promote_attributes(SCM attrlist)
 {
-  SCM_ASSERT (scm_is_string (scmsymname), scmsymname,
-              SCM_ARG1, "always-promote-attributes");
-
-  g_free(default_always_promote_attributes);
-  default_always_promote_attributes = 
-    g_strdup_printf(" %s ", SCM_STRING_CHARS (scmsymname));
+  GList *list=NULL;
+  int length, i;
+  gchar *attr;
+
+  if (scm_is_string (attrlist)) {
+    printf("xxx\n");
+    g_free(default_always_promote_attributes);
+    default_always_promote_attributes = 
+      g_strdup_printf(" %s ", SCM_STRING_CHARS (attrlist));
+    s_log_message(_("WARNING: using a string for 'always-promote-attributes'"
+		    " is deprecated\n"));
+  } else {
+    printf("yyy\n");
+    SCM_ASSERT(scm_list_p(attrlist), attrlist, SCM_ARG1, "always-promote-attributes");
+    length = scm_ilength(attrlist);
+    /* convert the scm list into a GList */
+    for (i=0; i < length; i++) {
+      SCM_ASSERT(scm_is_string(scm_list_ref(attrlist, scm_from_int(i))), 
+		 scm_list_ref(attrlist, scm_from_int(i)), SCM_ARG1, 
+		 "always-promote-attribute: list element is not a string");
+      attr = g_strdup(SCM_STRING_CHARS(scm_list_ref(attrlist, scm_from_int(i))));
+      list = g_list_prepend(list, attr);
+      printf("g_rc_always_promote_attributes: %s\n", attr);
+    }
+    
+  }
 
   return SCM_BOOL_T;
 }




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