Re: Help - Merging Resource into a call_function array

From: Date: Thu, 18 Oct 2001 16:08:54 +0000
Subject: Re: Help - Merging Resource into a call_function array
References: 1  Groups: php.dev php.gtk.dev 
Request: Send a blank email to php-dev+get-68254@lists.php.net to get a copy of this message
I don't understand the problem, can you rephrase? On Thu, 18 Oct 2001, 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(&params); > > } > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > -Andrei Give a man a fish; you have fed him for today. Teach a man to use the Net and he won't bother you for weeks. -Author unknown

« previous php.dev (#68254) next »