Re: using resources... for GtkHTMLStream
| From: | Andrei Zmievski | Date: | Mon, 08 Oct 2001 14:16:42 +0000 |
| Subject: | Re: using resources... for GtkHTMLStream | ||
| References: | 1 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-88@lists.php.net to get a copy of this message | ||
Where are you registering le_gtkhtmlstream?
On Sat, 06 Oct 2001, Alan Knowles wrote:
> I am looking at adding stream support in for the gtkhtml module - this should enable
> realization of an actuall browser (as the callbacks for images etc. ask for streams - i think)..
>
> anyway, my ZEND API experience is a bit limited (usually to fixing segfaults in midgard) so
> This the stuff below is mostly guesswork from the api docs at zend.com
>
> The two functions below illustrate the issue -
> gtk_html_begin returns a struct, GtkHTMLStream
> gtk_html_write uses this as one of it's inputs to determine where to send the data..
>
> I have attempted to wrap the return value into a PHP Resource and defined a simple struct to
> wrap the real one..
>
> however I dont seem to be able to get the address back out of the struct.. (or am even sure
> that I am setting it correctly)...
>
> suggestions, other good (simple) examples of code doing something similar would be helpfull..
>
> regards
>
> alan
>
> typedef struct {
> GtkHTMLStream *htmlstream;
> long id;
> } php_gtkhtmlstream;
>
> static int le_gtkhtmlstream;
>
> PHP_FUNCTION(gtk_html_begin)
> {
> zval **res_value;
> php_gtkhtmlstream *gs;
>
> NOT_STATIC_METHOD();
>
> if (!php_gtk_parse_args(ZEND_NUM_ARGS(), ""))
> return;
> gs = (php_gtkhtmlstream *)emalloc(sizeof(php_gtkhtmlstream));
> gs->htmlstream = gtk_html_begin(GTK_HTML(PHP_GTK_GET(this_ptr)));
> gs->id=1;
> res_value = zend_list_insert(gs, le_gtkhtmlstream);
>
> RETURN_RESOURCE(res_value);
>
>
> }
>
>
>
> PHP_FUNCTION(gtk_html_write)
> {
> php_gtkhtmlstream *gs;
> char *buffer;
> long size;
>
> NOT_STATIC_METHOD();
>
> if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "rsi", &gs, &buffer, &size))
> return;
> gtk_html_write(GTK_HTML(PHP_GTK_GET(this_ptr)),
> (GtkHTMLStream *)gs->htmlstream, buffer, (size_t) size);
>
> RETURN_NULL();
> }
>
>
>
>
>
>
>
>
>
>
> --
> 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
* If Bill Gates had a nickel for every time Windows crashed.. Oh, wait.. *