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

gEDA-cvs: CVS update: s_misc.c



  User: sdb     
  Date: 06/08/13 08:31:56

  Modified:    .        s_misc.c s_sheet_data.c s_table.c s_toplevel.c
  Log:
  Applied patch from Jeff Mallatt which implements ability to handle
  
  attrib strings with multiple = signs. 
  
  
  
  
  Revision  Changes    Path
  1.3       +36 -0     eda/geda/gaf/gattrib/src/s_misc.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: s_misc.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/s_misc.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- s_misc.c	5 Feb 2005 16:03:53 -0000	1.2
  +++ s_misc.c	13 Aug 2006 12:31:56 -0000	1.3
  @@ -73,3 +73,39 @@
   {
       char_index = 0;
   }
  +
  +
  +/*------------------------------------------------------------------
  + * Gattrib specific utilities
  + *------------------------------------------------------------------*/
  +
  +char *s_misc_remaining_string(char *string, char delimiter, int count)
  +{
  +  int i;
  +  char *remaining;
  +  char *return_value;
  +
  +  /* find count'th delimiter */
  +  remaining = string;
  +  for (i = 0; i < count; i++) {
  +    remaining = strchr(remaining, delimiter);
  +    if (!remaining) {
  +      return (NULL);
  +    }
  +    remaining++;
  +  }
  +
  +  /* skip whitespace */
  +  while (*remaining == ' ') {
  +    remaining++;
  +  }
  +  if (!(*remaining)) {
  +    return (NULL);
  +  }
  +
  +  /* copy remainder into allocated return string */
  +  return_value = strdup(remaining);
  +
  +  /* return string */
  +  return (return_value);
  +}
  
  
  
  1.11      +1 -1      eda/geda/gaf/gattrib/src/s_sheet_data.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: s_sheet_data.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/s_sheet_data.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -b -r1.10 -r1.11
  --- s_sheet_data.c	17 Jul 2006 01:50:10 -0000	1.10
  +++ s_sheet_data.c	13 Aug 2006 12:31:56 -0000	1.11
  @@ -385,7 +385,7 @@
   		    && pin_attrib->object->text != NULL) {  /* found an attribute */
   		  attrib_text = g_strdup(pin_attrib->object->text->string);
   		  attrib_name = u_basic_breakup_string(attrib_text, '=', 0);
  -		  attrib_value = u_basic_breakup_string(attrib_text, '=', 1);
  +		  attrib_value = s_misc_remaining_string(attrib_text, '=', 1);
   		  if ( (strcmp(attrib_name, "pinnumber") != 0) 
   		       && (attrib_value != NULL) ) {  
   		    /* Don't include "pinnumber" because it is already in other master list.
  
  
  
  1.12      +3 -3      eda/geda/gaf/gattrib/src/s_table.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: s_table.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/s_table.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -b -r1.11 -r1.12
  --- s_table.c	17 Jul 2006 01:50:10 -0000	1.11
  +++ s_table.c	13 Aug 2006 12:31:56 -0000	1.12
  @@ -279,7 +279,7 @@
               /* may need to check more thoroughly here. . . . */
               attrib_text = g_strdup(a_current->object->text->string);
               attrib_name = u_basic_breakup_string(attrib_text, '=', 0);
  -            attrib_value = u_basic_breakup_string(attrib_text, '=', 1);
  +            attrib_value = s_misc_remaining_string(attrib_text, '=', 1);
   	    old_visibility = a_current->object->visibility;
   	    old_show_name_value = a_current->object->show_name_value;
   
  @@ -359,7 +359,7 @@
             /* may need to check more thoroughly here. . . . */
             attrib_text = g_strdup(a_current->object->text->string);
             attrib_name = u_basic_breakup_string(attrib_text, '=', 0);
  -          attrib_value = u_basic_breakup_string(attrib_text, '=', 1);
  +          attrib_value = s_misc_remaining_string(attrib_text, '=', 1);
             if (strcmp(attrib_name, "netname") != 0) {
               /* Don't include "netname" */
                
  @@ -468,7 +468,7 @@
   		  && pin_attrib->object->text != NULL) {  /* found an attribute */
   		attrib_text = g_strdup(pin_attrib->object->text->string);
   		attrib_name = u_basic_breakup_string(attrib_text, '=', 0);
  -		attrib_value = u_basic_breakup_string(attrib_text, '=', 1);
  +		attrib_value = s_misc_remaining_string(attrib_text, '=', 1);
    
   		if ( (strcmp(attrib_name, "pinnumber") != 0) 
   		     && (attrib_value != 0) ) {
  
  
  
  1.18      +4 -4      eda/geda/gaf/gattrib/src/s_toplevel.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: s_toplevel.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/s_toplevel.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -b -r1.17 -r1.18
  --- s_toplevel.c	6 Aug 2006 16:45:28 -0000	1.17
  +++ s_toplevel.c	13 Aug 2006 12:31:56 -0000	1.18
  @@ -1,4 +1,4 @@
  -/* $Id: s_toplevel.c,v 1.17 2006/08/06 16:45:28 ahvezda Exp $ */
  +/* $Id: s_toplevel.c,v 1.18 2006/08/13 12:31:56 sdb Exp $ */
   
   /* gEDA - GPL Electronic Design Automation
    * gattrib -- gEDA component and net attribute manipulation using spreadsheet.
  @@ -780,7 +780,7 @@
     /*  Next try to get this attrib from new_comp_attrib_list  */
     new_attrib_name = u_basic_breakup_string(local_list->data, '=', 0);      
     if (s_string_list_in_list(new_comp_attrib_list, local_list->data)) {
  -    new_attrib_value = u_basic_breakup_string(local_list->data, '=', 1);      
  +    new_attrib_value = s_misc_remaining_string(local_list->data, '=', 1);      
     } else {
       new_attrib_value = NULL;
     }
  @@ -1015,10 +1015,10 @@
     printf("        In s_toplevel_update_pin_attribs_in_toplevel, handling entry in master list %s .\n", new_name_value_pair);
   #endif
       new_attrib_name = u_basic_breakup_string(new_name_value_pair, '=', 0);
  -    new_attrib_value = u_basic_breakup_string(new_name_value_pair, '=', 1);
  +    new_attrib_value = s_misc_remaining_string(new_name_value_pair, '=', 1);
       if (strlen(new_attrib_value) == 0) {
         g_free(new_attrib_value);   /* I wonder if I should check for non-NULL first?  */
  -      new_attrib_value = NULL;  /* u_basic_breakup_string doesn't return NULL for empty substring. */
  +      new_attrib_value = NULL;  /* s_misc_remaining_string doesn't return NULL for empty substring. */
       }
       old_attrib_value = o_attrib_search_name_single_count(o_pin, new_attrib_name, 0);
                                                                                                          
  
  
  


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