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

Re: gEDA-user: rm=5mm in gattrib



Ales, Karel, et al,

Thanks, Ales, for the information.  I am glad that I am wrong, and
that the bug is a gattrib bug and not a libgeda bug.  I  will fix
gattrib so it does the right thing.  Perhaps this bug-fix can be a
side-show during our upcoming Free Dog get-together this coming
Thursday? 

Oh, dear, me!  I need to make the Free Dog announcement!

Stuart





> 
> Hi Stuart and Karel,
> 
> 
> [snip]
> >Libgeda handles attributes in the following way.  An attribute is a
> >text string of form "foo=bar", stored as a single entity in the linked
> >list of graphical objects which represent your schematic.   In this
> 
> 	I tried entering "package=ceramic 50V, rm=5mm" and it worked
> fine in gschem.
> 
> 
> >case, "foo" is the attribute name, and "bar" is the attribute value.
> >An attribute is not different from ordinary annotation text, except
> >that it has the "=" sign separating the attribute name from the
> >attribute value.  The "=" sign is what distinguishes an attribute from
> >normal text. 
> 
> 	Mostly agree with the above, except that it only applies to
> the first = in a text string.  After the first =, the value of the
> attribute can be literally anything, including an infinite number of ='s.
> Unfortunately the current file format document does not spell this
> out explicitly.  The master attribute doc does say something a little
> bit more:
> 
> http://geda.seul.org/wiki/geda:master_attributes_list#what_are_attributes
> 
> 	Attributes in the gEDA/gaf system are nothing more than text
> 	items which take on the form: name=value. Name can be anything
> 	just as long as it doesnt contain a equals sign. Value can also
> 	be anything just as long as it is something (vs nothing). name=
> 	(without a value part) is not a valid attribute. Also, there
> 	cannot be any spaces immediately before or after the equals sign.
> 
> I will update these documents to explicitly cover the case where you have
> name=blah   where blah can be value, name2=value2  and so on.  
> 
> [snip]
> >it finds an attribute (or a string) with an unexpected number of "="
> >signs in it.  In your case, it found the second "=" sign, and dropped
> >it and everything after it when it stored the result.
> >
> 
> 	I think this is a bug in gattrib unfortunately. :-(
> 
> Instead of using:
> 
> 	 u_basic_breakup_string(string, '=', 0)
> or 
> 	 u_basic_breakup_string(string, '=', 1)
> 
> to break up name=value attributes, gattrib should be using:
> 
> 	char *name = NULL;
>   	char *value = NULL;
> 	int status;
> 
> 
> 	status = o_attrib_get_name_value(string, &name, &value);
> 	if (status == 0)
> 	{
> 		/* ... do useful work with name and value ... */
> 	}
> 	else
> 	{
> 		/* invalid attribute */
> 	}
> 	if (name) free (name);
> 	if (value) free (value);
> 
> to break up attributes into name/value pairs.  Obviously this is not 
> easy to find in libgeda (that's my fault and my responsibility), but it
> is the official way of doing the parsing.
> 
> Do you want me to file a bug on this Stuart?  All questions to me.
> Thanks.
> 
> 				-Ales
> 
>