Re: gtype introspection



On Sun, 2002-10-20 at 01:30, Tim Janik wrote:
> 
> it is. as for why the code does this, a check like "does iface foo conform
> to GtkObject" on an iface foo having GtkWidget as prerequisite couldn't be
> implemented as binary search if all supers of GtkWidget are not added to the
> prerequisite list.
> the deduping should however be implemented in gtype.c. you need something
> like this to fill the returned type array with prerequisite types:
> 
> TypeNode *inode = NULL;
> guint i, n = 0;
> for (i = 0; i < n_prerequisites; i++)
>   {
>     TypeNode *node = lookup_type_node_I (prerequisites[i]);
>     if (node->is_instantiatable &&
>         (!inode || type_node_is_a_L (node, inode)))
>       inode = node;
>     else
>       types[n++] = NODE_TYPE (node);
>   }
> if (inode)
>   types[n++] = NODE_TYPE (inode);
> 
> n is the amount of returned types and <= n_prerequisites and a read
> lock must be held around the code.
> 

Thanks, that code works nicely. I've committed it to gobject HEAD now.

Matthias




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