[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gEDA-dev: Broken slotting



If anyone cares, I would like to propose an API for attributes.

Thanks,

Steve Meier

ATTRIB *s_attrib_new( );

void s_attrib_init(ATTRIB *this_attrib, char *name, char *value, BOOL
show_name, BOOL show_value,
           POINT location, int rotation);

void s_attrib_free(ATTRIB* this_attrib);

//----------------------------------------------------------------
// duplicate an attribute.
// caller is responsible for destroying ruterned attribute
ATTRIB *s_attrib_duplicate(ATTRIB *this_attrib);

//-------------------------------------------------------------------
// write an attribute to the open file pointer

void s_attrib_write(ATTRIB *this_attrib, FILE *fp);

//----------------------------------------------------------------
// print an attribute report.
void s_attrib_print (ATTRIB *this_attrib);

//----------------------------------------------------------------
// compare two attribs to see if the have equivellent values
BOOL s_attrib_compare(ATTRIB *first_attrib, ATTRIB *second_attrib);

//----------------------------------------------------------------
// search the attributes of an object for one named by name
// return the value of the attribute of the first one found
// be sure caller free's return value
char *s_attrib_search_name(GList *list, char *name, int counter);

//----------------------------------------------------------------
// for a complex object, find the value of the slot attribute
// be sure caller frees string
char *s_attrib_search_slot(OBJECT *object);

//----------------------------------------------------------------
// for a complex object, find the number of slots the object has
int s_attrib_search_numslots(OBJECT *object);

//----------------------------------------------------------------
// for a complex object, find which slot is the default slot
int s_attrib_search_default_slot(OBJECT *object);

//----------------------------------------------------------------
// return the pin type object that matches the sequence pin_number
// the list is a list of pins
// caller should not destroy the returned object
OBJECT *s_attrib_search_pinseq(GList *list, int pin_number);

//----------------------------------------------------------------
// from a list of attributes find the slot deffinition string
// that coresponds to the slot number be sure caller frees string
char *s_attrib_search_slotdef(GList *attrib_list, int slotnumber);

//-----------------------------------------------------------------
// for an attribute GString determine its name and value
// if the name and value are non-null strings
// return TRUE else return false
// set the returned name and value function call perameters as well
BOOL s_attrib_get_name_value(GString *string, char **name, char **value);

//----------------------------------------------------------------
// search the attributes of an object for oned named by name
// return the value of the attribute of the first one found
// be sure caller free's return value
char *s_attrib_search_name_single(OBJECT *object, char *name);

//----------------------------------------------------------------
// find the text object that matches the string
// the caller should NOT destroy the returned OBJECT
OBJECT *s_attrib_search_string_list(GList *list, char *string);

//----------------------------------------------------------------
// find the pin number for a pin from a complex object with respect to a
slot number
// be sure caller free's return value
char *s_attrib_pin_sequence_slot_pinnumber(OBJECT *object, OBJECT
*pin_object, int slot);


//-----------------------------------------------------------------------------------------
// find the nth occurence starting from zero of the search_for string in
the list of attribs
// it is the responsibility of the caller to free the returned string
// returned string is the found value

gchar *s_attrib_search_string_partial(GList *attribs, gchar *name, gchar
*partial, int nth);

//-------------------------------------------------------------------
// Search for the nth occurance of the attribute, starts from ZERO!
// zero being the first occurance
// caller is responsible for freeing returned string

gchar * s_attrib_search_outside(GList *attribs, gchar *name, int
nth_occurance_value);

//-------------------------------------------------------------------
// test to see if a specific pin exists in a net attrib

BOOL s_attrib_net_attrib_contains_pin(ATTRIB *net_attrib, gchar *pinnumber);

//-------------------------------------------------------------------
// use the viewer application graphic routines to draw the attribute in
the desired graphics context

void s_attrib_draw(ATTRIB *this_attrib, BOOL color_mode, hidGC gc);

//-------------------------------------------------------------------
// Create a box that contains the complex object

BOX *s_attrib_get_bounds(ATTRIB *this_attrib);

//-------------------------------------------------------------------
// move an attrib in world coordinants

void s_attrib_translate(ATTRIB *this_attrib, POINT vector);



Peter Clifton wrote:
> On Tue, 2007-09-11 at 07:58 -0400, Stuart Brorson wrote:
>   
>> Peter --
>>
>> As the author of the offending code, let me say "thank you" for
>> cleaning it up.
>>
>> My memory is faulty, but IIRC, the code was crafted to fix a bug
>> having to do with spice-sdb's (actually gnetlist's) handling of
>> slotted parts.  The problem was that gnetlist originally couldn't deal
>> with generating pinseqs for slotted parts because it only iterated
>> over the first slot.  Or something like that.  The issue is that
>> spice-sdb uses the pinseq attribute to know which pin to emit while
>> generating SPICE netlists.
>>
>> Therefore, when you're done hacking, please rerun the test suite
>> located under gnetlist/tests/spice-sdb.  There are some regression
>> tests specifically in there which verify that spice-sdb emits the
>> correct pins for a slotted part.
>>
>> If you want me to do anything more -- like clean up any mess I made --
>> please let me know!
>>     
>
> I should be able to write a fix over the next day or so.
>
> Thanks for confirming the desired behaviour. I was (and still am) a
> little concerned about not having any "contractual" guarantee that every
> symbol will have pinseq attributes start at "1" and end at the number of
> pins on the device. Perhaps this is implied though, by the nature of the
> slotdef attribute.
>
> I'll fix the malloc and alter the code which finds a pin with a
> particular "pinseq=..." to wrap around at the number of pins on the
> device. I will have to check before hand that won't mess up any other
> users of the existing API - which might rely on finding the exact pinseq
> attribute.
>
> Peter
>
>
>
>
> _______________________________________________
> geda-dev mailing list
> geda-dev@moria.seul.org
> http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev
>
>   



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