Re: Structures thought question



I'm going to comment from the Perl point of view, and I can't say anything about the clutter functions since I haven't dealt with them yet.

Owen Taylor wrote:

void gdk_region_union (GdkRegion       *source1,
                       const GdkRegion *source2);

As it stands, this is a GdkRegion method that modifies the invocant, so source1 wouldn't appear in the argument list and thus doesn't need any annotation; source2 would be 'in'.

  $source1->union ($source2); # modifies $source1

void gdk_region_get_clipbox (const GdkRegion *region,
                             GdkRectangle    *rectangle);

GdkRegion method with invocant region; rectangle would be 'out'.

  my $rectangle = $region->get_clipbox ();

void gtk_text_buffer_insert (GtkTextBuffer *buffer,
                             GtkTextIter   *iter,
                             const gchar   *text,
                             gint           len);

GtkTextBuffer method with invocant buffer; iter is 'in', text is 'in'. We would avoid wrapping the len parameter and simply deduce it from the passed in Perl string (which knows how long it is). Can we express this kind of relation in the typelib, i.e. can we express that a string argument is actually represented by two arguments: the pointer and a length?

  $buffer->insert ($iter, $text);

gboolean gdk_colormap_alloc_color (GdkColormap *colormap,
                                   GdkColor    *color,
                                   gboolean     writeable,
                                   gboolean     best_match);

GdkColormap with invocant colormap. color, which is modified by gdk_colormap_alloc_color, is wrapped as a simple 'in' argument in the current Perl bindings. This is possible because we wrap GdkColors as opaque references; so changes to the underlying struct propagate directly to changes of the Perl variable. If we wrapped GdkColors by converting them to and from normal Perl structures like a hash or an array, color would have to be 'inout'.

  $colormap->alloc_color ($color, $writeable, $best_match);


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