[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: gEDA: Getting pins from components . . . .
- To: geda-dev@seul.org
- Subject: Re: gEDA: Getting pins from components . . . .
- From: sdb@cloud9.net (Stuart Brorson)
- Date: Sun, 1 Aug 2004 19:11:24 -0400 (EDT)
- Delivered-to: archiver@seul.org
- Delivered-to: geda-dev-outgoing@seul.org
- Delivered-to: geda-dev@seul.org
- Delivery-date: Sun, 01 Aug 2004 19:11:36 -0400
- In-reply-to: <20040729032105.A029833CAC@moria.seul.org> from "Ales Hvezda" at Jul 28, 2004 11:21:05 PM
- Reply-to: geda-dev@seul.org
- Sender: owner-geda-dev@seul.org
Hi Ales --
I have been thinking about finding pins attached to an object, and
have a question about your suggestion.
> Now for traverse_component...
>
> void
> traverse_component(TOPLEVEL* pr_current, OBJECT* component)
> {
> OBJECT* o_current = component->complex->prim_objs;
>
> while (o_current != NULL)
> {
> if (o_current->type == OBJ_PIN)
> {
> /* Ah... now I have found a pin... */
> /* do something with it */
> }
> o_current = o_current->next;
> }
> }
OK, using this method to find the *first* pin works. HOwever, when do
I know to terminate the loop? That is, o_current is just a long,
unstructured list of graphical objects on the schematic, right?
Therefore, if I just loop to o_current->next, I am just at another
graphical object on the schematic. Eventually I will find another
OBJ_PIN, but there is no garuantee that this OBJ_PIN is attached to my
component, right?
How do I know when to terminate the loop while looking for pins? Is
there a libgeda fcn which returns a list of pins attached to a complex?
Maybe I should implement your second suggestion. . . . .
Stuart