gEDA-dev: Broken slotting

Peter Clifton pcjc2 at cam.ac.uk
Tue Sep 11 07:38:01 EDT 2007


On Tue, 2007-09-11 at 13:08 +0200, Gabriel Paubert wrote:
> > ... = g_strdup_printf( "pinseq=%d", numpins*(slot-1)+pin_counter );
> 
> Looks fine, I did not know about that function, but why the "pinseq="
> in the format? It was not in the original one.

A couple of lines down, _another_ block of memory was allocated which
had room enough for the pinseq= and the length of the number which the
original line would print. They are then stuck together in this string.

> > Not a big problem, I just wanted to confirm other developers thought
> > this was the right fix (for now at least).
> 
> Probably, but you know the code much better than me.

When it comes to that attrib handling my knowledge isn't particularly
good. I know the data-structures and such, but the API is a mess.

33+ functions, with a good number sharing VERY similar functionality.
Its on my "TODO" list to re-factor shared functionality, and (if
absolutely necessary) keep the old APIs as wrappers.

For an example of a section of the API list:

ATTRIB *o_attrib_search(GList *list, OBJECT *item);
OBJECT *o_attrib_search_string_list(OBJECT *list, char *string);
OBJECT *o_attrib_search_string_single(OBJECT *object, char *search_for);
OBJECT *o_attrib_search_attrib_value(GList *list, char *value, char *name, int counter);
OBJECT *o_attrib_search_pinseq(OBJECT *list, int pin_number);
char *o_attrib_search_slotdef(OBJECT *object, int slotnumber);
char *o_attrib_search_string_partial(OBJECT *object, char *search_for, int counter);
char *o_attrib_search_name(OBJECT *list, char *name, int counter);
char *o_attrib_search_attrib_name(GList *list, char *name, int counter);
char *o_attrib_search_toplevel(OBJECT *list, char *name, int counter);
char *o_attrib_search_name_single(OBJECT *object, char *name, OBJECT **return_found);
char *o_attrib_search_name_single_count(OBJECT *object, char *name, int counter);
char *o_attrib_search_slot(OBJECT *object, OBJECT **return_found);
char *o_attrib_search_numslots(OBJECT *object, OBJECT **return_found);
char *o_attrib_search_default_slot(OBJECT *object);
char *o_attrib_search_toplevel_all(GedaPageList *page_list, char *name);
char *o_attrib_search_component(OBJECT *object, char *name);
void o_attrib_slot_update(TOPLEVEL *toplevel, OBJECT *object);
void o_attrib_slot_copy(TOPLEVEL *toplevel, OBJECT *original, OBJECT *target);


Regards,

Peter




More information about the geda-dev mailing list