summaryrefslogtreecommitdiff
path: root/ext/qtdom/qtdom.c
diff options
context:
space:
mode:
authorJan Borsodi <amos@php.net>2001-01-04 12:27:39 +0000
committerJan Borsodi <amos@php.net>2001-01-04 12:27:39 +0000
commit0798a81739460b3d17791e23bee9b6ea1efe7e48 (patch)
tree9aed9fee451d17052b16782387eb01fa9dee847d /ext/qtdom/qtdom.c
parentc178c3b5e4e7edc7ae9113c3419c10e8a0477e1c (diff)
downloadphp-git-0798a81739460b3d17791e23bee9b6ea1efe7e48.tar.gz
New function qdom_error which returns the error text from the last qdom operation, or FALSE if none occured.
Fixed the documentation for the qdom_tree function. Added init and shutdown code for some global variables. Added code for starting and stopping the Qt Message Handler in qdom_tree.
Diffstat (limited to 'ext/qtdom/qtdom.c')
-rw-r--r--ext/qtdom/qtdom.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/ext/qtdom/qtdom.c b/ext/qtdom/qtdom.c
index 6f9b96452e..bdddae6418 100644
--- a/ext/qtdom/qtdom.c
+++ b/ext/qtdom/qtdom.c
@@ -46,6 +46,7 @@ static int le_qtdom;
*/
function_entry qtdom_functions[] = {
PHP_FE(qdom_tree, NULL)
+ PHP_FE(qdom_error, NULL)
{NULL, NULL, NULL} /* Must be the last line in qtdom_functions[] */
};
@@ -83,6 +84,8 @@ PHP_MINIT_FUNCTION(qtdom)
qdomdoc_class_entry_ptr = zend_register_internal_class(&qdomdoc_class_entry);
qdomnode_class_entry_ptr = zend_register_internal_class(&qdomnode_class_entry);
+ qdom_init();
+
return SUCCESS;
}
@@ -91,6 +94,8 @@ PHP_MSHUTDOWN_FUNCTION(qtdom)
/* Remove comments if you have entries in php.ini
UNREGISTER_INI_ENTRIES();
*/
+ qdom_shutdown();
+
return SUCCESS;
}
@@ -222,7 +227,7 @@ int qdom_find_children( zval **children, struct qdom_node *orig_node )
return count;
}
-/* {{{ proto string qdom_tree( string )
+/* {{{ proto object qdom_tree( string )
creates a tree of an xml string */
PHP_FUNCTION(qdom_tree)
{
@@ -234,11 +239,14 @@ PHP_FUNCTION(qdom_tree)
struct qdom_node *node;
zval *children;
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg) == FAILURE) {
+ if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg) == FAILURE)
+ {
WRONG_PARAM_COUNT;
}
convert_to_string(arg);
+ qdom_do_install_message_handler();
+
qdom_do_version( &qt_ver );
object_init_ex(return_value, qdomdoc_class_entry_ptr);
@@ -259,6 +267,18 @@ PHP_FUNCTION(qdom_tree)
}
qdom_do_free( doc );
+ qdom_do_free_message_handler();
+}
+/* }}} */
+
+/* {{{ proto string qdom_error()
+ Returns the error string from the last QDOM operation or FALSE if no errors occured.*/
+PHP_FUNCTION(qdom_error)
+{
+ char *error = qdom_error_log();
+ if ( error == 0 )
+ RETURN_FALSE;
+ RETURN_STRING( error, 1 );
}
/* }}} */