X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com Date: Sun, 6 Sep 2015 05:38:48 +0200 (CEST) X-X-Sender: igor2 AT igor2priv To: "Vladimir Zhbanov (vzhbanov AT gmail DOT com) [via geda-user AT delorie DOT com]" X-Debug: to=geda-user AT delorie DOT com from="gedau AT igor2 DOT repo DOT hu" From: gedau AT igor2 DOT repo DOT hu Subject: Re: [geda-user] gschem question about internals In-Reply-To: <20150905202843.GB7185@localhost.localdomain> Message-ID: References: <20150905202843 DOT GB7185 AT localhost DOT localdomain> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Reply-To: geda-user AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: geda-user AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Hello Vladimir, On Sat, 5 Sep 2015, Vladimir Zhbanov (vzhbanov AT gmail DOT com) [via geda-user AT delorie DOT com] wrote: > > Hi, Igor. > > All objects have the same type OBJECT (struct st_object) defined in > libgeda/include/libgeda/struct.h. It has pointers to "substructures". > The substructure for components is COMPLEX, for pins it is LINE in > essence. The struct COMPLEX (st_complex) has a member named prim_objs > which is a list of component primitives. Text objects are attributes if > their text is in the form 'name=value'. If an object is an attribute, > the st_object member attached_to shows the object where the attribute is > attached (if it is attached). The lowlevel logic of working with > attributes is in libgeda/src/o_attrib.c. > Great, thank you. This is the answer to the question I was going to post this morning. Now this is fast, I get the answer before I even post the question :) About the original question from yesterday: I was more interested in whether there is a hash of refdes -> OBJECT, or anything like that, being constantly maintained by gschem. Or whenever gshcem is looking for something, does it do linear searches on the lists of pages and objects? Yesterday my impression was that the latter happens. It'd make my algo O(n*m) - n is the number of object, m is the number of patch requests on the back annotation list. So I probably build a temporary hash before the action and discard it after the action. This'd cost c*n+m (c is the overhead of creating/discarding string->pointer hash entries). Regards, Igor2