Re: using resources... for GtkHTMLStream

From: Date: Mon, 08 Oct 2001 01:56:58 +0000
Subject: Re: using resources... for GtkHTMLStream
References: 1  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-86@lists.php.net to get a copy of this message
I wonder if andrei or markus could recommend a good communication channel to get answers about the zend API... - php-dev is very hit or miss.. - is there a IRC channel - or another mailing list.......... I have started attacking this using an object rather than a resource now - so there is a bit more example code on how to do it.. regards alan Steph wrote:
OK, I'm over the sulks, it doesn't take long. I don't have unix for about another 2 weeks, can't build anything on Windows and am new to it all anyway. Having said all that ... "typedef" only comes up in php_gtk+_types relating to enumerated flags, "struct" (if you look where Andrei put gtkallocation and gtkrequisition) only turns up in gtk.defs; I'd assume that Andrei has a great deal of familiarity with the Zend API one way or another, so wouldn't it make sense to follow a similar pattern there? - see generator/generator.php to view the schema - I may be talking out of my backside as usual, of course.... ----- Original Message ----- From: "Steph" <Steph.Fox@btinternet.com> To: <alan_k@hklc.com> Sent: Saturday, October 06, 2001 10:03 PM Subject: Re: [PHP-GTK-DEV] using resources... for GtkHTMLStream OK, you're busy too. But a reply would've been nice. ----- Original Message ----- From: "Alan Knowles" <alan_k@hklc.com> To: <php-gtk-dev@lists.php.net> Sent: Saturday, October 06, 2001 6:15 PM Subject: [PHP-GTK-DEV] using resources... for GtkHTMLStream 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 (#86) next »