Re: Modifying code generator to support pass by reference values
| From: | Andrei Zmievski | Date: | Wed, 12 Dec 2001 16:56:58 +0000 |
| Subject: | Re: Modifying code generator to support pass by reference values | ||
| References: | 1 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-264@lists.php.net to get a copy of this message | ||
Generally, I don't like to add any non-standard stuff to .defs files.
I've emailed language-bindings list to see whether in/out tag can be
added to parameter definitions for next defs version. Then we could
easily do this.
For now, I'd still say hand-code those, or modify generator temporarily,
generate code, and then copy-paste it into .overrides.
On Wed, 12 Dec 2001, Markus Fischer wrote:
> We have gtk function
>
> gtk_foo_bar_get(GtkSomeObject *obj, gdouble *x, gdouble *y);
>
> While working on gtkextra I found quite a lot of them. They
> just return the values to x and y, e.g in gtk_foo_bar_get():
>
> void gtk_foo_bar_get(GtkSomeObject *obj, gdouble *x, gdouble *y)
> {
> *x = obj->blabla.x;
> *y = obj->blabla.y;
> }
>
> First I wanted to create an extra Retval_Arg handler. Alan
> suggested using another flag to the parameters 'return-value'
>
> (method get_position
> (of-object Plot (Gtk))
> (c-name gtk_plot_get_position)
> (return-type none)
> (parameter (type-and-name gdouble* x) (return-value))
> (parameter (type-and-name gdouble* y) (return-value))
> )
>
> Assuming the the function has NO return value the,
> the return code would look like:
>
> gtk_foo_bar_get(GTK_FOO_BAR(PHP_GTK_GET(this_ptr)), &x, &y);
>
> array_init(return_value);
> add_next_index_double(x);
> add_next_index_double(y);
>
> I've played around and it works fine. But before I put
> more energy into this I wanted to know if everyone agrees
> witht his solution. It requires changes to the code generator
> in several places.
>
> Alan, Andrei, anyone?
>
> - Markus
>
> --
> Please always Cc to me when replying to me on the lists.
>
> --
> PHP-GTK Development Mailing List (http://gtk.php.net/)
> To unsubscribe, e-mail: php-gtk-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: php-gtk-dev-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
-Andrei
Documentation is worth it just to be able
to answer all your mail with 'RTFM'. -- Alan Cox