using resources... for GtkHTMLStream

From: Date: Sat, 06 Oct 2001 17:15:33 +0000
Subject: using resources... for GtkHTMLStream
Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-85@lists.php.net to get a copy of this message
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(); }

« previous php.gtk.dev (#85) next »