[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA: Getting pins from components . . . .



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