cvs: php4 /ext/qtdom qtdom.c

From: Date: Thu, 04 Jan 2001 12:27:39 +0000
Subject: cvs: php4 /ext/qtdom qtdom.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-3362@lists.php.net to get a copy of this message
amos Thu Jan 4 04:27:39 2001 EDT Modified files: /php4/ext/qtdom qtdom.c Log: 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. Index: php4/ext/qtdom/qtdom.c diff -u php4/ext/qtdom/qtdom.c:1.2 php4/ext/qtdom/qtdom.c:1.3 --- php4/ext/qtdom/qtdom.c:1.2 Wed Nov 15 11:09:43 2000 +++ php4/ext/qtdom/qtdom.c Thu Jan 4 04:27:38 2001 @@ -46,6 +46,7 @@ */ 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 @@ 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 @@ /* Remove comments if you have entries in php.ini UNREGISTER_INI_ENTRIES(); */ + qdom_shutdown(); + return SUCCESS; } @@ -222,7 +227,7 @@ 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 @@ 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 @@ } 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 ); } /* }}} */

« previous php.cvs (#3362) next »