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

gEDA-cvs: gaf.git: branch: master updated (1.5.0-20080706-285-g0b194ee)



The branch, master has been updated
       via  0b194eee257f5818cc0ad9b035f9b81134a87745 (commit)
       via  9bb639685d3d413d245ebf8f58cd55b6734bec2e (commit)
       via  76195280b1f861c8952d4de52195b8b2de0f79d8 (commit)
      from  8628c10167df204222d77b4f18e550f7486aa2a1 (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
=========

 gattrib/src/gattrib.c      |    4 ++
 gattrib/src/s_sheet_data.c |   21 +++++------
 gattrib/src/s_table.c      |   80 ++++++++++++++++++++++++++++----------------
 utils/gschlas/gschlas.c    |    4 ++
 4 files changed, 68 insertions(+), 41 deletions(-)


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

commit 0b194eee257f5818cc0ad9b035f9b81134a87745
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sat Nov 1 22:53:33 2008 +0000

    gattrib: Don't special-case ignore components with "graphical" attribute.
    
    It was noted that special-casing the "graphical" attribute could cause
    gattrib to crash on save (Bug #2214739).
    
    There is no real reason why the user might not want to edit a graphical
    symol's attributes with gattrib, so we should treat it like any other.

:100644 100644 52a8663... ec827f4... M	gattrib/src/s_sheet_data.c
:100644 100644 0e6eee8... 79025a4... M	gattrib/src/s_table.c

commit 9bb639685d3d413d245ebf8f58cd55b6734bec2e
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sat Nov 1 22:53:26 2008 +0000

    gattrib: Don't crash if we can't find data in the sheet. Bug #2214739
    
    Check for a -1 return from s_table_get_index() before
    using to index an array. Print ugly warnings to stderr
    and skip whatever we were doing if this is encountered.

:100644 100644 7be8782... 0e6eee8... M	gattrib/src/s_table.c

commit 76195280b1f861c8952d4de52195b8b2de0f79d8
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sat Nov 1 22:53:17 2008 +0000

    gattrib, gschlas: Restore setting dummy select_func to ensure proper save
    
    The select_func function pointer (now owned and exported by libgeda) is
    assigned to OBJECT->sel_func for non-locked objects. Locking is achieved
    by setting OBJECT->sel_func to NULL, and when writing out objects, the
    locked flag is determined by comparing that that pointer to NULL.
    
    We need to keep providing a dummy function so we can differentiate
    between that and a NULL pointer. This was accidentally lost in
    commit 1aab94354f053887db67aa5702abc595795dfe82 which moved the
    select_func global variable into libgeda.

:100644 100644 ec90b61... 769ba93... M	gattrib/src/gattrib.c
:100644 100644 53d7ae0... 30614c2... M	utils/gschlas/gschlas.c

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

commit 0b194eee257f5818cc0ad9b035f9b81134a87745
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sat Nov 1 22:53:33 2008 +0000

    gattrib: Don't special-case ignore components with "graphical" attribute.
    
    It was noted that special-casing the "graphical" attribute could cause
    gattrib to crash on save (Bug #2214739).
    
    There is no real reason why the user might not want to edit a graphical
    symol's attributes with gattrib, so we should treat it like any other.

diff --git a/gattrib/src/s_sheet_data.c b/gattrib/src/s_sheet_data.c
index 52a8663..ec827f4 100644
--- a/gattrib/src/s_sheet_data.c
+++ b/gattrib/src/s_sheet_data.c
@@ -120,11 +120,10 @@ void s_sheet_data_add_master_comp_list_items(OBJECT *start_obj) {
       printf("In s_sheet_data_add_master_comp_list_items, examining o_current->name = %s\n", o_current->name);
 #endif
 
-      /*-----  only process if this is a non-graphical comp with attributes ----*/
-      if ( (o_current->type == OBJ_COMPLEX) &&
-	    o_current->attribs && 
-	    !o_attrib_search_component(o_current, "graphical") ) {    
-	
+      /*-----  only process if this is a component with attributes ----*/
+      if (o_current->type == OBJ_COMPLEX &&
+          o_current->attribs != NULL) {
+
 #if DEBUG
 	printf("      In s_sheet_data_add_master_comp_list_items; found component on page\n");
 	printf(". . . . complex_basename = %s.\n", o_current->complex_basename);
@@ -186,12 +185,10 @@ void s_sheet_data_add_master_comp_attrib_list_items(OBJECT *start_obj) {
       printf("In s_sheet_data_add_master_comp_attrib_list_items, examining o_current->name = %s\n", o_current->name);
 #endif
 
-      /*-----  only process if this is a non-graphical comp with attributes ----*/
-      if ( (o_current->type == OBJ_COMPLEX) &&
-	    o_current->attribs && 
-	    !o_attrib_search_component(o_current, "graphical") ) {    
+      /*-----  only process if this is a component with attributes ----*/
+      if (o_current->type == OBJ_COMPLEX &&
+          o_current->attribs != NULL) {
 
-	
 	verbose_print(" C");
 	
 	/*------ Iterate through all attribs found on component -----*/
@@ -332,8 +329,8 @@ void s_sheet_data_add_master_pin_list_items(OBJECT *start_obj) {
 	  
 	} else {          /* didn't find refdes.  Report error to log. */
 #ifdef DEBUG
-	  fprintf(stderr, "In s_sheet_data_add_master_pin_list_items, found non-graphical component with no refdes.\n");
-	  fprintf(stderr, ". . . . complex_basename = %s.\n", o_current->complex_basename);
+          fprintf(stderr, "In s_sheet_data_add_master_pin_list_items, found component with no refdes.\n");
+          fprintf(stderr, ". . . . complex_basename = %s.\n", o_current->complex_basename);
 #endif
 	}
 	g_free(temp_uref);
diff --git a/gattrib/src/s_table.c b/gattrib/src/s_table.c
index 0e6eee8..79025a4 100644
--- a/gattrib/src/s_table.c
+++ b/gattrib/src/s_table.c
@@ -269,10 +269,9 @@ void s_table_add_toplevel_comp_items_to_comp_table(OBJECT *start_obj) {
 #endif
 
     /* -----  Now process objects found on page  ----- */
-    if ( (o_current->type == OBJ_COMPLEX) &&
-          o_current->attribs &&
-         !o_attrib_search_component(o_current, "graphical") ) {
-                                                              
+    if (o_current->type == OBJ_COMPLEX &&
+        o_current->attribs != NULL) {
+
       /* ---- Don't process part if it lacks a refdes ----- */
       temp_uref = g_strdup(s_attrib_get_refdes(o_current));
       if (temp_uref) {
@@ -470,10 +469,9 @@ void s_table_add_toplevel_pin_items_to_pin_table(OBJECT *start_obj) {
 #endif
 
     /* -----  Now process objects found on page  ----- */
-    if ( (o_current->type == OBJ_COMPLEX) &&
-          o_current->attribs &&
-         !o_attrib_search_component(o_current, "graphical") ) {
-                                                              
+    if (o_current->type == OBJ_COMPLEX &&
+        o_current->attribs != NULL) {
+
       /* ---- Don't process part if it lacks a refdes ----- */
       temp_uref = s_attrib_get_refdes(o_current);
       if (temp_uref) {

commit 9bb639685d3d413d245ebf8f58cd55b6734bec2e
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sat Nov 1 22:53:26 2008 +0000

    gattrib: Don't crash if we can't find data in the sheet. Bug #2214739
    
    Check for a -1 return from s_table_get_index() before
    using to index an array. Print ugly warnings to stderr
    and skip whatever we were doing if this is encountered.

diff --git a/gattrib/src/s_table.c b/gattrib/src/s_table.c
index 7be8782..0e6eee8 100644
--- a/gattrib/src/s_table.c
+++ b/gattrib/src/s_table.c
@@ -206,6 +206,14 @@ STRING_LIST *s_table_create_attrib_pair(gchar *row_name,
   attrib_pair_list = s_string_list_new();
 
   row = s_table_get_index(row_list, row_name);
+  /* Sanity check */
+  if (row == -1) {
+    /* we didn't find the item in the list */
+    fprintf (stderr,
+             "In s_table_create_attrib_pair, we didn't find the row name in the row list!\n");
+    return attrib_pair_list;
+  }
+
   for (col = 0; col < num_attribs; col++) {
     /* pull attrib from table.  If non-null, add it to attrib_pair_list  */
     if ( (table[row][col]).attrib_value != NULL) {
@@ -299,19 +307,27 @@ void s_table_add_toplevel_comp_items_to_comp_table(OBJECT *start_obj) {
               /* Get row and col where to put this attrib */
               row = s_table_get_index(sheet_head->master_comp_list_head, temp_uref);
               col = s_table_get_index(sheet_head->master_comp_attrib_list_head, attrib_name);
+              /* Sanity check */
+              if (row == -1 || col == -1) {
+                /* we didn't find the item in the table */
+                fprintf (stderr,
+                         "In s_table_add_toplevel_comp_items_to_comp_table, we didn't find either row or col in the lists!\n");
+              } else {
+
 #if DEBUG
-              printf("       In s_table_add_toplevel_comp_items_to_comp_table, about to add row %d, col %d, attrib_value = %s\n",
-                     row, col, attrib_value);
-              printf(" . . . current address of attrib_value cell is [%p]\n", &((sheet_head->component_table)[row][col]).attrib_value);
+                printf("       In s_table_add_toplevel_comp_items_to_comp_table, about to add row %d, col %d, attrib_value = %s\n",
+                       row, col, attrib_value);
+                printf(" . . . current address of attrib_value cell is [%p]\n", &((sheet_head->component_table)[row][col]).attrib_value);
 #endif
-              /* Is there a compelling reason for me to put this into a separate fcn? */
-              ((sheet_head->component_table)[row][col]).row = row;
-              ((sheet_head->component_table)[row][col]).col = col;
-              ((sheet_head->component_table)[row][col]).row_name = g_strdup(temp_uref);
-              ((sheet_head->component_table)[row][col]).col_name = g_strdup(attrib_name);
-              ((sheet_head->component_table)[row][col]).attrib_value = g_strdup(attrib_value);
-              ((sheet_head->component_table)[row][col]).visibility = old_visibility;
-              ((sheet_head->component_table)[row][col]).show_name_value = old_show_name_value;
+                /* Is there a compelling reason for me to put this into a separate fcn? */
+                ((sheet_head->component_table)[row][col]).row = row;
+                ((sheet_head->component_table)[row][col]).col = col;
+                ((sheet_head->component_table)[row][col]).row_name = g_strdup(temp_uref);
+                ((sheet_head->component_table)[row][col]).col_name = g_strdup(attrib_name);
+                ((sheet_head->component_table)[row][col]).attrib_value = g_strdup(attrib_value);
+                ((sheet_head->component_table)[row][col]).visibility = old_visibility;
+                ((sheet_head->component_table)[row][col]).show_name_value = old_show_name_value;
+              }
             }
             g_free(attrib_name);
             g_free(attrib_text);
@@ -493,18 +509,26 @@ void s_table_add_toplevel_pin_items_to_pin_table(OBJECT *start_obj) {
 		  /* Get row and col where to put this attrib */
 		  row = s_table_get_index(sheet_head->master_pin_list_head, row_label);
 		  col = s_table_get_index(sheet_head->master_pin_attrib_list_head, attrib_name);
+                  /* Sanity check */
+                  if (row == -1 || col == -1) {
+                    /* we didn't find the item in the table */
+                    fprintf (stderr,
+                             "In s_table_add_toplevel_pin_items_to_pin_table, we didn't find either row or col in the lists!\n");
+                  } else {
+
 #if DEBUG
-		  printf("       In s_table_add_toplevel_pin_items_to_pin_table, about to add row %d, col %d, attrib_value = %s\n",
-			 row, col, attrib_value);
-		  printf(" . . . current address of attrib_value cell is [%p]\n", &((sheet_head->component_table)[row][col]).attrib_value);
+                    printf("       In s_table_add_toplevel_pin_items_to_pin_table, about to add row %d, col %d, attrib_value = %s\n",
+                           row, col, attrib_value);
+                    printf(" . . . current address of attrib_value cell is [%p]\n", &((sheet_head->component_table)[row][col]).attrib_value);
 #endif
-		  /* Is there a compelling reason for me to put this into a separate fcn? */
-		  ((sheet_head->pin_table)[row][col]).row = row;
-		  ((sheet_head->pin_table)[row][col]).col = col;
-		  ((sheet_head->pin_table)[row][col]).row_name = g_strdup(row_label);
-		  ((sheet_head->pin_table)[row][col]).col_name = g_strdup(attrib_name);
-		  ((sheet_head->pin_table)[row][col]).attrib_value = g_strdup(attrib_value);
-		}
+                    /* Is there a compelling reason for me to put this into a separate fcn? */
+                    ((sheet_head->pin_table)[row][col]).row = row;
+                    ((sheet_head->pin_table)[row][col]).col = col;
+                    ((sheet_head->pin_table)[row][col]).row_name = g_strdup(row_label);
+                    ((sheet_head->pin_table)[row][col]).col_name = g_strdup(attrib_name);
+                    ((sheet_head->pin_table)[row][col]).attrib_value = g_strdup(attrib_value);
+                  }
+                }
 		g_free(attrib_name);
 		g_free(attrib_text);
 		g_free(attrib_value);

commit 76195280b1f861c8952d4de52195b8b2de0f79d8
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sat Nov 1 22:53:17 2008 +0000

    gattrib, gschlas: Restore setting dummy select_func to ensure proper save
    
    The select_func function pointer (now owned and exported by libgeda) is
    assigned to OBJECT->sel_func for non-locked objects. Locking is achieved
    by setting OBJECT->sel_func to NULL, and when writing out objects, the
    locked flag is determined by comparing that that pointer to NULL.
    
    We need to keep providing a dummy function so we can differentiate
    between that and a NULL pointer. This was accidentally lost in
    commit 1aab94354f053887db67aa5702abc595795dfe82 which moved the
    select_func global variable into libgeda.

diff --git a/gattrib/src/gattrib.c b/gattrib/src/gattrib.c
index ec90b61..769ba93 100644
--- a/gattrib/src/gattrib.c
+++ b/gattrib/src/gattrib.c
@@ -132,6 +132,10 @@ void gattrib_main(void *closure, int argc, char *argv[])
   /* Initialize gEDA stuff */
   libgeda_init();
 
+  /* Ensure object->sel_func can be used to correctly determine object
+   * locking when the project is saved out */
+  select_func = s_toplevel_select_object;
+
   /* Note that argv_index holds index to first non-flag command line option 
    * (that is, to the first file name) */
   argv_index = parse_commandline(argc, argv);
diff --git a/utils/gschlas/gschlas.c b/utils/gschlas/gschlas.c
index 53d7ae0..30614c2 100644
--- a/utils/gschlas/gschlas.c
+++ b/utils/gschlas/gschlas.c
@@ -63,6 +63,10 @@ main_prog(void *closure, int argc, char *argv[])
 
   libgeda_init();
 
+  /* Ensure object->sel_func can be used to correctly determine object
+   * locking when the project is saved out */
+  select_func = o_select_dummy;
+
   /* create log file right away */
   /* even if logging is enabled */
   logfile = g_build_filename (cwd, "gschlas.log", NULL);




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