Re: [gtk-list] Re: Gtk and the scripting languages of the world



Kenneth Albanowski <kjahds@kjahds.com> writes:
> 
> On 23 Aug 1997, Marius Vollmer wrote:
> 
> > Then we can't use them.  But the gtk_object_set_data/get_data
> > mechanism can work with types, I think.
> 
> Oh yes. Here's a sample from Gtk. (Which _still_ isn't on CPAN. I think
> Andreas is at perlcon in SJ, at the moment, or coming back from it.)
>
> [...]

I was thinking about adding two new functions to the gtk_object_*
family:

    gtk_object_set_typed_data (GtkObject*, gchar *key, const GtkArg *data);
    gtk_object_get_typed_data (GtkObject*, gchar *key, GtkArg *data);

The GtkArg structure contains the type id and some value in its "d"
union, as usual.  I have already unified the GTK_ARG_* types with the
GtkObject* types and added support for enums, bit masks and reference
counted structures, so that -- with some more additions -- every type
the interpreter cares about can be expressed.

Data that has been set with gtk_object_set_data and is then retrieved
with gtk_object_get_typed_data comes back with a GTK_ARG_POINTER type,
which is probably of no use to the interpreter.  When there are
important cases for the interpreter, where it needs to access untyped
data, it has to special-case them.

Data set with gtk_object_set_typed_data cannot be retrieved with
gtk_object_get_data, because the type information will be lost.



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