On Wed, 2008-10-08 at 23:06 +0200, Werner Hoch wrote: > On Mittwoch, 8. Oktober 2008, Peter Clifton wrote: > > On Wed, 2008-10-08 at 21:23 +0200, Werner Hoch wrote: > > > In the current two functions o_complex_get_promotable and > > > o_complex_is_eligible_attribute things are mixed together a little > > > bit. > > > > Like this: > > > > http://repo.or.cz/w/geda-gaf/pcjc2.git?a=commitdiff;h=333917a672084c2 > >3e77b7a2f62616e6c516f2df8 > > > > It isn't much simpler, and in fact introduces a second iteration over > > the list. (One iteration over all OBJECTs to build the list, then > > iterate over that list to filter it). > > It isn't yet much simpler, but now you can cut down the > o_complex_is_eligible_attribute function and integrate it into the > o_complex_get_promotable function.
I just pushed out my changes so far. That function did get a bit smaller once you moved out the test for a valid attributes into o_complex_get_toplevel_attribs(). I guess you could take the remaining functionality and stuff it into o_complex_get_promotable(), but I'd prefer not to do that. Separation keeps the "promotable?" test quite succinct, and doesn't mix it with the list iteration code. I like that. You might also find that testing attributes with "o_complex_is_eligible_atttribute()" could be useful in the new attribute pane of the component selector. > Thus the o_complex_get_promotable acts as a filter around > o_complex_get_toplevel_attribs. I made that change already, but keep o_complex_is_eligible_attribute() to do the testing. (Hence pushing out a cherry-pick of your patch to add that function). I also went on a tidy spree, and removed OBJECT->attribute before I did this, as it is redundant to OBJECT->attached_to, and was commented as possibly unneeded elsewhere. That change touched o_complex_get_toplevel_attribs(), so I fixed up the conflict (and tabs - sorry!) and pushed it with my code. I also shuffled the position of the code, so it comes before o_complex_get_promotable() in o_complex_basic.c. (IE. the filtered version comes later in the file, and calls o_complex_get_toplevel_attribs() which is immediately above it). -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) _______________________________________________ geda-dev mailing list [email protected] http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev
