Is gs really a newly allocated resource so you have to register it? Or is it arleady an existing one? If it does already exist (what I assume) you should fetch it from the resource lirst (quick look , could be wrong).
Btw, it would help telling what exactly does not work. And, with the extra arguments, ... you really want to 'merge' this? I think it should be added to the args, no? On Thu, Oct 18, 2001 at 04:17:31PM -0000, Alan Knowles wrote : > Can someone help me out with this one, - I'm sure that I've not acheived what I was >aiming at - adding the Resource, myresource to the array prior to calling the >callback function.... > > the code below is from the url_request callback wrapper for gtkhtml - if this works >- you can build a working web browser/editor in php.. > > regards > > alan > > > static void php_gtk_html_url_request_callback (GtkHTML *html, const char *url, >GtkHTMLStream *gs, zval* callback_data) > { > > > > zval *myresource = NULL; > zval *retval = NULL; > zval **callback = NULL, **extra = NULL; > zval **callback_filename = NULL, **callback_lineno = NULL; > zval ***args, *params; > char *callback_name; > TSRMLS_FETCH(); > > zend_hash_index_find(Z_ARRVAL_P(callback_data), 0, (void **)&callback); > zend_hash_index_find(Z_ARRVAL_P(callback_data), 1, (void **)&extra); > zend_hash_index_find(Z_ARRVAL_P(callback_data), 2, (void >**)&callback_filename); > zend_hash_index_find(Z_ARRVAL_P(callback_data), 3, (void **)&callback_lineno); > > if (!php_gtk_is_callable(*callback, 0, &callback_name)) { > php_error(E_WARNING, "Unable to call ctree callback '%s' specified in >%s on line %d", callback_name, Z_STRVAL_PP(callback_filename), >Z_LVAL_PP(callback_lineno)); > efree(callback_name); > return; > } > > params = php_gtk_build_value("(s)", url); > ZEND_REGISTER_RESOURCE(myresource, gs, le_gtkhtmlstream); > zend_hash_next_index_insert(Z_ARRVAL_P(params), (zval *) &myresource, >sizeof(zval *), NULL); > > if (extra) > php_array_merge(Z_ARRVAL_P(params), Z_ARRVAL_PP(extra), 0); > > args = php_gtk_hash_as_array(params); > > call_user_function_ex(EG(function_table), NULL, *callback, &retval, >zend_hash_num_elements(Z_ARRVAL_P(params)), args, 0, NULL TSRMLS_CC); > if (retval) > zval_ptr_dtor(&retval); > efree(args); > zval_ptr_dtor(¶ms); > > } > > -- > PHP-GTK Development Mailing List (http://gtk.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Markus Fischer, http://guru.josefine.at/~mfischer/ EMail: [EMAIL PROTECTED] PGP Public Key: http://guru.josefine.at/~mfischer/C2272BD0.asc PGP Fingerprint: D3B0 DD4F E12B F911 3CE1 C2B5 D674 B445 C227 2BD0 -All your scripts are belong to Zend- -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]