cvs: pecl /html_parse .cvsignore CREDITS README config.m4 config.w32 html_parse.c html_parse.dsp package.xml package2.xml php_html_parse.h
/html_parse/manual/html-parse configure.xml reference.xml /html_parse/manual/html-parse/functions html-parser-comment-handler.xml
html-parser-create.xml html-parser-data-handler.xml html-parser-endtag-handler.xml html-parser-free.xml html-parser-parse.xml
html-parser-starttag-handler.xml /html_parse/tests html_parser_comment_handler.phpt html_parser_create.phpt html_parser_data_handler.phpt
html_parser_endtag_handler.phpt html_parser_free.phpt html_parser_parse.phpt html_parser_starttag_handler.phpt
| From: | Hartmut Holzgraefe | Date: | Mon, 20 Feb 2006 18:33:16 +0000 |
| Subject: | cvs: pecl /html_parse .cvsignore CREDITS README config.m4 config.w32 html_parse.c html_parse.dsp package.xml package2.xml php_html_parse.h /html_parse/manual/html-parse configure.xml reference.xml /html_parse/manual/html-parse/functions html-parser-comment-handler.xml html-parser-create.xml html-parser-data-handler.xml html-parser-endtag-handler.xml html-parser-free.xml html-parser-parse.xml html-parser-starttag-handler.xml /html_parse/tests html_parser_comment_handler.phpt html_parser_create.phpt html_parser_data_handler.phpt html_parser_endtag_handler.phpt html_parser_free.phpt html_parser_parse.phpt html_parser_starttag_handler.phpt |
||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-5222@lists.php.net to get a copy of this message | ||
hholzgra Mon Feb 20 18:33:16 2006 UTC
Added files:
/pecl/html_parse .cvsignore README config.w32 package2.xml
Modified files:
/pecl/html_parse CREDITS config.m4 html_parse.c html_parse.dsp
package.xml php_html_parse.h
/pecl/html_parse/manual/html-parse configure.xml reference.xml
/pecl/html_parse/manual/html-parse/functions
html-parser-comment-handler.xml
html-parser-create.xml
html-parser-data-handler.xml
html-parser-endtag-handler.xml
html-parser-free.xml
html-parser-parse.xml
html-parser-starttag-handler.xml
/pecl/html_parse/tests html_parser_comment_handler.phpt
html_parser_create.phpt
html_parser_data_handler.phpt
html_parser_endtag_handler.phpt
html_parser_free.phpt html_parser_parse.phpt
html_parser_starttag_handler.phpt
Log:
project regenerated from specfile html_parse.xml
using CodeGen_PECL 1.0.1dev
http://cvs.php.net/viewcvs.cgi/pecl/html_parse/CREDITS?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/CREDITS diff -u pecl/html_parse/CREDITS:1.1 pecl/html_parse/CREDITS:1.2 --- pecl/html_parse/CREDITS:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/CREDITS Mon Feb 20 18:33:16 2006 @@ -1 +1,2 @@ html_parse +Hartmut Holzgraefe http://cvs.php.net/viewcvs.cgi/pecl/html_parse/config.m4?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/config.m4 diff -u pecl/html_parse/config.m4:1.1 pecl/html_parse/config.m4:1.2 --- pecl/html_parse/config.m4:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/config.m4 Mon Feb 20 18:33:16 2006 @@ -1,34 +1,55 @@ dnl dnl $ Id: $ dnl - -PHP_ARG_WITH(html_parse, whether to enable html_parse functions, -[ --with-html_parse[=DIR] With html_parse support], yes) + +PHP_ARG_ENABLE(html_parse, whether to enable html_parse functions, +[ --enable-html_parse Enable html_parse support]) if test "$PHP_HTML_PARSE" != "no"; then - if test -r "$PHP_HTML_PARSE/include/ekhtml.h"; then - PHP_HTML_PARSE_DIR="$PHP_HTML_PARSE" - else - AC_MSG_CHECKING(for html_parse in default path) - for i in /usr /usr/local; do - if test -r "$i/include/ekhtml.h"; then - PHP_HTML_PARSE_DIR=$i - AC_MSG_RESULT(found in $i) - fi - done - fi -fi + +PHP_ARG_WITH(ekhtml, foobar install, +[ --with-ekhtml[=DIR] With ekhtml support]) -PHP_ADD_INCLUDE($PHP_HTML_PARSE_DIR/include) -PHP_SUBST(HTML_PARSE_SHARED_LIBADD) + if test -r "$PHP_EKHTML/include/ekhtml.h"; then + PHP_EKHTML_DIR="$PHP_EKHTML" + else + AC_MSG_CHECKING(for ekhtml in default path) + for i in /usr /usr/local; do + if test -r "$i/include/ekhtml.h"; then + PHP_EKHTML_DIR=$i + AC_MSG_RESULT(found in $i) + break + fi + done + if test "x" = "x$PHP_EKHTML_DIR"; then + AC_MSG_ERROR(not found) + fi + fi -PHP_ADD_LIBRARY_WITH_PATH(ekhtml, $PHP_HTML_PARSE_DIR/lib, HTML_PARSE_SHARED_LIBADD) -AC_CHECK_LIB(ekhtml, ekhtml_parser_new, [AC_DEFINE(HAVE_EKHTML,1,[ ])], [AC_MSG_ERROR(ekhtml library not found or wrong version)],) + export OLD_CPPFLAGS="$CPPFLAGS" + export CPPFLAGS="$CPPFLAGS $INCLUDES -DHAVE_EKHTML" + export CPPFLAGS="$OLD_CPPFLAGS" + export OLD_CPPFLAGS="$CPPFLAGS" + export CPPFLAGS="$CPPFLAGS $INCLUDES -DHAVE_HTML_PARSE" + AC_CHECK_TYPE(php_html_parser *, [], [AC_MSG_ERROR(required payload type for resource html_parser not found)], [#include "$srcdir/php_html_parse.h"]) + export CPPFLAGS="$OLD_CPPFLAGS" + PHP_SUBST(HTML_PARSE_SHARED_LIBADD) + + + PHP_CHECK_LIBRARY(ekhtml, ekhtml_parser_new, + [ + PHP_ADD_LIBRARY_WITH_PATH(ekhtml, $PHP_HTML_PARSE_DIR/lib, HTML_PARSE_SHARED_LIBADD) + ],[ + AC_MSG_ERROR([wrong ekhtml lib version or lib not found]) + ],[ + -L$PHP_HTML_PARSE_DIR/lib + ]) -if test "$PHP_HTML_PARSE" != "no"; then + PHP_SUBST(HTML_PARSE_SHARED_LIBADD) AC_DEFINE(HAVE_HTML_PARSE, 1, [ ]) PHP_NEW_EXTENSION(html_parse, html_parse.c , $ext_shared) + fi http://cvs.php.net/viewcvs.cgi/pecl/html_parse/html_parse.c?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/html_parse.c diff -u pecl/html_parse/html_parse.c:1.1 pecl/html_parse/html_parse.c:1.2 --- pecl/html_parse/html_parse.c:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/html_parse.c Mon Feb 20 18:33:16 2006 @@ -2,13 +2,13 @@ +----------------------------------------------------------------------+ | This source file is subject to version 3.0 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_0.txt. | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Hartmut Holzgraefe <hartmut@php.net> | + | Authors: Hartmut Holzgraefe <hartmut@php.net> | +----------------------------------------------------------------------+ */ @@ -16,122 +16,117 @@ #include "php_html_parse.h" +#if HAVE_HTML_PARSE - /* {{{ _start_cb() */ - static void _start_cb(void *data, ekhtml_string_t *tag, ekhtml_attr_t *attrs) { - php_html_parser *parser = (php_html_parser *)data; - zval *cb_retval, *cb_tag, *cb_array; - zval **cb_args[2]; - TSRMLS_FETCH(); - if (parser->startElementHandler) { - /* create zval string parameter for tag name */ - MAKE_STD_ZVAL(cb_tag); - ZVAL_STRINGL(cb_tag, (char *)tag->str, tag->len, 1); - cb_args[0] = &cb_tag; - /* create zval array parameter for tag attributes */ - MAKE_STD_ZVAL(cb_array); - array_init(cb_array); - while(attrs) { - /* hash key argument needs to be zero-terminated, - so we have to create a copy */ - char *name = emalloc(attrs->name.len +1); - strlcpy(name, attrs->name.str, attrs->name.len +1); - /* in HTML attributes may be just set without a value */ - if(attrs->isBoolean) { - add_assoc_bool(cb_array, name, 1); - } else { - add_assoc_stringl(cb_array, name, (char *)attrs->val.str, attrs->val.len, 1); - } - /* free hash key name copy */ - efree(name); - /* get next attribute */ - attrs = attrs->next; - } - cb_args[1] = &cb_array; - /* now call the handler function with the prepared parameters */ - if (call_user_function_ex(EG(function_table), NULL, parser->startElementHandler, &cb_retval, 2, cb_args, 0, NULL TSRMLS_CC) == SUCCESS && cb_retval) { - zval_ptr_dtor(&cb_retval); - } - /* cleanup */ - zval_ptr_dtor(&cb_tag); - zval_ptr_dtor(&cb_array); - } - } - - /* }}} */ - - - /* {{{ _end_cb() */ - static void _end_cb(void *data, ekhtml_string_t *tag) { - php_html_parser *parser = (php_html_parser *)data; - zval *cb_retval, *cb_tag; - zval **cb_args[1]; - TSRMLS_FETCH(); - if (parser->endElementHandler) { - MAKE_STD_ZVAL(cb_tag); - ZVAL_STRINGL(cb_tag, (char *)tag->str, tag->len, 1); - cb_args[0] = &cb_tag; - if (call_user_function_ex(EG(function_table), NULL, parser->endElementHandler, &cb_retval, 1, cb_args, 0, NULL TSRMLS_CC) == SUCCESS && cb_retval) { - zval_ptr_dtor(&cb_retval); - } - zval_ptr_dtor(&cb_tag); - } - } - - /* }}} */ - - - /* {{{ _comment_cb() */ - static void _comment_cb(void *data, ekhtml_string_t *comment) { - php_html_parser *parser = (php_html_parser *)data; - zval *cb_retval, *cb_comment; - zval **cb_args[1]; - TSRMLS_FETCH(); - if (parser->commentHandler) { - MAKE_STD_ZVAL(cb_comment); - ZVAL_STRINGL(cb_comment, (char *)comment->str, comment->len, 1); - cb_args[0] = &cb_comment; - if (call_user_function_ex(EG(function_table), NULL, parser->commentHandler, &cb_retval, 1, cb_args, 0, NULL TSRMLS_CC) == SUCCESS && cb_retval) { - zval_ptr_dtor(&cb_retval); - } - zval_ptr_dtor(&cb_comment); - } - } - - /* }}} */ - - - /* {{{ _data_cb() */ - static void _data_cb(void *data, ekhtml_string_t *characterData) { - php_html_parser *parser = (php_html_parser *)data; - zval *cb_retval, *cb_data; - zval **cb_args[1]; - TSRMLS_FETCH(); - if (parser->characterDataHandler) { - MAKE_STD_ZVAL(cb_data); - ZVAL_STRINGL(cb_data, (char *)characterData->str, characterData->len, 1); - cb_args[0] = &cb_data; - if (call_user_function_ex(EG(function_table), NULL, parser->characterDataHandler, &cb_retval, 1, cb_args, 0, NULL TSRMLS_CC) == SUCCESS && cb_retval) { - zval_ptr_dtor(&cb_retval); - } - zval_ptr_dtor(&cb_data); - } - } - - /* }}} */ +static void _start_cb(void *data, ekhtml_string_t *tag, ekhtml_attr_t *attrs) { + php_html_parser *parser = (php_html_parser *)data; + zval *cb_retval, *cb_tag, *cb_array; + zval **cb_args[2]; + TSRMLS_FETCH(); + + if (parser->startElementHandler) { + /* create zval string parameter for tag name */ + MAKE_STD_ZVAL(cb_tag); + ZVAL_STRINGL(cb_tag, (char *)tag->str, tag->len, 1); + cb_args[0] = &cb_tag; + + /* create zval array parameter for tag attributes */ + MAKE_STD_ZVAL(cb_array); + array_init(cb_array); + while(attrs) { + /* hash key argument needs to be zero-terminated, + so we have to create a copy */ + char *name = emalloc(attrs->name.len +1); + strlcpy(name, attrs->name.str, attrs->name.len +1); + + /* in HTML attributes may be just set without a value */ + if(attrs->isBoolean) { + add_assoc_bool(cb_array, name, 1); + } else { + add_assoc_stringl(cb_array, name, (char *)attrs->val.str, attrs->val.len, 1); + } + /* free hash key name copy */ + efree(name); + /* get next attribute */ + attrs = attrs->next; + } + cb_args[1] = &cb_array; + + /* now call the handler function with the prepared parameters */ + if (call_user_function_ex(EG(function_table), NULL, parser->startElementHandler, &cb_retval, 2, cb_args, 0, NULL TSRMLS_CC) == SUCCESS && cb_retval) { + zval_ptr_dtor(&cb_retval); + } + + /* cleanup */ + zval_ptr_dtor(&cb_tag); + zval_ptr_dtor(&cb_array); + } +} + +static void _end_cb(void *data, ekhtml_string_t *tag) { + php_html_parser *parser = (php_html_parser *)data; + zval *cb_retval, *cb_tag; + zval **cb_args[1]; + TSRMLS_FETCH(); + + if (parser->endElementHandler) { + MAKE_STD_ZVAL(cb_tag); + ZVAL_STRINGL(cb_tag, (char *)tag->str, tag->len, 1); + cb_args[0] = &cb_tag; + if (call_user_function_ex(EG(function_table), NULL, parser->endElementHandler, &cb_retval, 1, cb_args, 0, NULL TSRMLS_CC) == SUCCESS && cb_retval) { + zval_ptr_dtor(&cb_retval); + } + zval_ptr_dtor(&cb_tag); + } +} + +static void _comment_cb(void *data, ekhtml_string_t *comment) { + php_html_parser *parser = (php_html_parser *)data; + zval *cb_retval, *cb_comment; + zval **cb_args[1]; + TSRMLS_FETCH(); + + if (parser->commentHandler) { + MAKE_STD_ZVAL(cb_comment); + ZVAL_STRINGL(cb_comment, (char *)comment->str, comment->len, 1); + cb_args[0] = &cb_comment; + if (call_user_function_ex(EG(function_table), NULL, parser->commentHandler, &cb_retval, 1, cb_args, 0, NULL TSRMLS_CC) == SUCCESS && cb_retval) { + zval_ptr_dtor(&cb_retval); + } + zval_ptr_dtor(&cb_comment); + } +} + +static void _data_cb(void *data, ekhtml_string_t *characterData) { + php_html_parser *parser = (php_html_parser *)data; + zval *cb_retval, *cb_data; + zval **cb_args[1]; + TSRMLS_FETCH(); + + if (parser->characterDataHandler) { + MAKE_STD_ZVAL(cb_data); + ZVAL_STRINGL(cb_data, (char *)characterData->str, characterData->len, 1); + cb_args[0] = &cb_data; + if (call_user_function_ex(EG(function_table), NULL, parser->characterDataHandler, &cb_retval, 1, cb_args, 0, NULL TSRMLS_CC) == SUCCESS && cb_retval) { + zval_ptr_dtor(&cb_retval); + } + zval_ptr_dtor(&cb_data); + } +} +/* {{{ Resource destructors */ int le_html_parser; - void html_parser_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { - php_html_parser * resource = (php_html_parser *)(rsrc->ptr); + php_html_parser * resource = (php_html_parser *)(rsrc->ptr); - /* destroy HTML parser */ - if(resource->parser) { - ekhtml_parser_destroy(resource->parser); - } - /* destruct any set callback handlers */ + /* destroy HTML parser */ + if(resource->parser) { + ekhtml_parser_destroy(resource->parser); + } + + /* destruct any set callback handlers */ if (resource->startElementHandler) { zval_ptr_dtor(&resource->startElementHandler); } @@ -142,11 +137,14 @@ zval_ptr_dtor(&resource->characterDataHandler); } if (resource->commentHandler) { - zval_ptr_dtor(&resource->commentHandler); + zval_ptr_dtor(&resource->commentHandler); } - efree(resource); + efree(resource); } + +/* }}} * + /* {{{ html_parse_functions[] */ function_entry html_parse_functions[] = { PHP_FE(html_parser_create , NULL) @@ -169,10 +167,10 @@ html_parse_functions, PHP_MINIT(html_parse), /* Replace with NULL if there is nothing to do at php startup */ PHP_MSHUTDOWN(html_parse), /* Replace with NULL if there is nothing to do at php shutdown */ - PHP_RINIT(html_parse), /* Replace with NULL if there is nothing to do at request start */ - PHP_RSHUTDOWN(html_parse), /* Replace with NULL if there is nothing to do at request end */ + PHP_RINIT(html_parse), /* Replace with NULL if there is nothing to do at request start */ + PHP_RSHUTDOWN(html_parse), /* Replace with NULL if there is nothing to do at request end */ PHP_MINFO(html_parse), - "0.1", + "0.9", STANDARD_MODULE_PROPERTIES }; /* }}} */ @@ -182,23 +180,15 @@ #endif -/* {{{ globals and ini entries */ -/* }}} */ - - /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(html_parse) { - -le_html_parser = zend_register_list_destructors_ex(html_parser_dtor, - NULL, - "html_parser", - module_number); - + le_html_parser = zend_register_list_destructors_ex(html_parser_dtor, + NULL, "html_parser", module_number); /* add your stuff here */ - return SUCCESS; + return SUCCESS; } /* }}} */ @@ -209,7 +199,7 @@ /* add your stuff here */ - return SUCCESS; + return SUCCESS; } /* }}} */ @@ -217,7 +207,7 @@ /* {{{ PHP_RINIT_FUNCTION */ PHP_RINIT_FUNCTION(html_parse) { - /* add your stuff here */ + /* add your stuff here */ return SUCCESS; } @@ -227,7 +217,7 @@ /* {{{ PHP_RSHUTDOWN_FUNCTION */ PHP_RSHUTDOWN_FUNCTION(html_parse) { - /* add your stuff here */ + /* add your stuff here */ return SUCCESS; } @@ -238,10 +228,10 @@ PHP_MINFO_FUNCTION(html_parse) { php_info_print_box_start(0); - php_printf("<p>HTML parser extenion</p>\n"); - php_printf("<p>Version 0.1alpha (2003-05-20)</p>\n"); - php_printf("<p><b>Authors:</b></p>\n"); - php_printf("<p>Hartmut Holzgraefe <hartmut@php.net> (lead)</p>\n"); + php_printf("<p>HTML parser extenion</p>\n"); + php_printf("<p>Version 0.9beta (2006-02-20)</p>\n"); + php_printf("<p><b>Authors:</b></p>\n"); + php_printf("<p>Hartmut Holzgraefe <hartmut@php.net> (lead)</p>\n"); php_info_print_box_end(); /* add your stuff here */ @@ -249,222 +239,248 @@ /* }}} */ -/* {{{ proto resource html_parser html_parser_create(void ) +/* {{{ proto resource html_parser html_parser_create(void) create an HTML parser */ PHP_FUNCTION(html_parser_create) { - php_html_parser * return_res = (php_html_parser *)emalloc(sizeof(php_html_parser)); - if (ZEND_NUM_ARGS()>0) { WRONG_PARAM_COUNT; } - - { - return_res->parser = ekhtml_parser_new(return_res); - if(! return_res->parser) RETURN_FALSE; - /* initially no PHP callbacks are set */ - return_res->startElementHandler = NULL; - return_res->endElementHandler = NULL; - return_res->characterDataHandler = NULL; - return_res->commentHandler = NULL; - /* all C callbacks are set right away, whether a PHP callback - is set is tested within the C callback */ - ekhtml_parser_startcb_add(return_res->parser, NULL, _start_cb); - ekhtml_parser_endcb_add(return_res->parser, NULL, _end_cb); - ekhtml_parser_commentcb_set(return_res->parser, _comment_cb); - ekhtml_parser_datacb_set(return_res->parser, _data_cb); - ZEND_REGISTER_RESOURCE(return_value, return_res, le_html_parser); - } + php_html_parser * return_res = (php_html_parser *)ecalloc(1, sizeof(php_html_parser)); + if (ZEND_NUM_ARGS()>0) { + WRONG_PARAM_COUNT; + } + + do { +#line 216 "html_parse.xml" + return_res->parser = ekhtml_parser_new(return_res); + if(! return_res->parser) RETURN_FALSE; + + /* initially no PHP callbacks are set */ + return_res->startElementHandler = NULL; + return_res->endElementHandler = NULL; + return_res->characterDataHandler = NULL; + return_res->commentHandler = NULL; + + /* all C callbacks are set right away, whether a PHP callback + is set is tested within the C callback */ + ekhtml_parser_startcb_add(return_res->parser, NULL, _start_cb); + ekhtml_parser_endcb_add(return_res->parser, NULL, _end_cb); + ekhtml_parser_commentcb_set(return_res->parser, _comment_cb); + ekhtml_parser_datacb_set(return_res->parser, _data_cb); + + ZEND_REGISTER_RESOURCE(return_value, return_res, le_html_parser); + } while(0); + ZEND_REGISTER_RESOURCE(return_value, return_res, le_html_parser); } -/* }}} */ +/* }}} html_parser_create */ /* {{{ proto bool html_parser_free(resource html_parser parser) free an HTML parser */ PHP_FUNCTION(html_parser_free) { - zval * parser = NULL; - int parser_id = -1; - php_html_parser * res_parser; - int argc = ZEND_NUM_ARGS(); - - if (zend_parse_parameters(argc TSRMLS_CC, "r", &parser) == FAILURE) return; - - if (parser) { - ZEND_FETCH_RESOURCE(res_parser, php_html_parser *, &parser, parser_id, "html_parser", le_html_parser); - } - - { - zval_dtor(parser); - } + zval * parser_res = NULL; + int parser_resid = -1; + php_html_parser * parser; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r/", &parser_res) == FAILURE) { + return; + } + ZEND_FETCH_RESOURCE(parser, php_html_parser *, &parser_res, parser_resid, "html_parser", le_html_parser); + + + do { +#line 244 "html_parse.xml" + FREE_RESOURCE(parser_res); + } while(0); } -/* }}} */ +/* }}} html_parser_free */ /* {{{ proto bool html_parser_starttag_handler(resource html_parser parser, callback handler) set callback function for start tags */ PHP_FUNCTION(html_parser_starttag_handler) { - zval * parser = NULL; - int parser_id = -1; - php_html_parser * res_parser; - zval * handler = NULL; - int argc = ZEND_NUM_ARGS(); - - if (zend_parse_parameters(argc TSRMLS_CC, "rz", &parser, &handler) == FAILURE) return; - - if (parser) { - ZEND_FETCH_RESOURCE(res_parser, php_html_parser *, &parser, parser_id, "html_parser", le_html_parser); - } + zval * parser_res = NULL; + int parser_resid = -1; + php_html_parser * parser; + zval * handler = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r/z/", &parser_res, &handler) == FAILURE) { + return; + } + ZEND_FETCH_RESOURCE(parser, php_html_parser *, &parser_res, parser_resid, "html_parser", le_html_parser); + if (!zend_is_callable(handler, 0, NULL)) { + php_error(E_WARNING, "Invalid comparison function."); + return; } + + + do { +#line 256 "html_parse.xml" + /* parameter check */ + if (!zend_is_callable(handler, 0, NULL)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "2nd argument is not a valid callback"); + RETURN_FALSE; + } + + /* have previous? -> dispose */ + if(parser->startElementHandler) { + zval_ptr_dtor(&parser->startElementHandler); + } + + /* assign new callback handler */ + ALLOC_ZVAL(parser->startElementHandler); + *parser->startElementHandler = *handler; + zval_copy_ctor(parser->startElementHandler); - { - /* parameter check */ - if (!zend_is_callable(handler, 0, NULL)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "2nd argument is not a valid callback"); - RETURN_FALSE; - } - /* have previous? -> dispose */ - if(res_parser->startElementHandler) { - zval_ptr_dtor(&res_parser->startElementHandler); - } - /* assign new callback handler */ - ALLOC_ZVAL(res_parser->startElementHandler); - *res_parser->startElementHandler = *handler; - zval_copy_ctor(res_parser->startElementHandler); - RETURN_TRUE; - } + RETURN_TRUE; + } while(0); } -/* }}} */ +/* }}} html_parser_starttag_handler */ /* {{{ proto bool html_parser_endtag_handler(resource html_parser parser, callback handler) set callback function for end tags */ PHP_FUNCTION(html_parser_endtag_handler) { - zval * parser = NULL; - int parser_id = -1; - php_html_parser * res_parser; - zval * handler = NULL; - int argc = ZEND_NUM_ARGS(); - - if (zend_parse_parameters(argc TSRMLS_CC, "rz", &parser, &handler) == FAILURE) return; - - if (parser) { - ZEND_FETCH_RESOURCE(res_parser, php_html_parser *, &parser, parser_id, "html_parser", le_html_parser); - } - - { - if (!zend_is_callable(handler, 0, NULL)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "2nd argument is not a valid callback"); - RETURN_FALSE; - } - if(res_parser->endElementHandler) { - zval_ptr_dtor(&res_parser->endElementHandler); - } - ALLOC_ZVAL(res_parser->endElementHandler); - *res_parser->endElementHandler = *handler; - zval_copy_ctor(res_parser->endElementHandler); - RETURN_TRUE; - } + zval * parser_res = NULL; + int parser_resid = -1; + php_html_parser * parser; + zval * handler = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r/z/", &parser_res, &handler) == FAILURE) { + return; + } + ZEND_FETCH_RESOURCE(parser, php_html_parser *, &parser_res, parser_resid, "html_parser", le_html_parser); + if (!zend_is_callable(handler, 0, NULL)) { + php_error(E_WARNING, "Invalid comparison function."); + return; } + + + do { +#line 284 "html_parse.xml" + if (!zend_is_callable(handler, 0, NULL)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "2nd argument is not a valid callback"); + RETURN_FALSE; + } + if(parser->endElementHandler) { + zval_ptr_dtor(&parser->endElementHandler); + } + ALLOC_ZVAL(parser->endElementHandler); + *parser->endElementHandler = *handler; + zval_copy_ctor(parser->endElementHandler); + RETURN_TRUE; + } while(0); } -/* }}} */ +/* }}} html_parser_endtag_handler */ /* {{{ proto bool html_parser_data_handler(resource html_parser parser, callback handler) set callback function for character data */ PHP_FUNCTION(html_parser_data_handler) { - zval * parser = NULL; - int parser_id = -1; - php_html_parser * res_parser; - zval * handler = NULL; - int argc = ZEND_NUM_ARGS(); - - if (zend_parse_parameters(argc TSRMLS_CC, "rz", &parser, &handler) == FAILURE) return; - - if (parser) { - ZEND_FETCH_RESOURCE(res_parser, php_html_parser *, &parser, parser_id, "html_parser", le_html_parser); - } - - { - if (!zend_is_callable(handler, 0, NULL)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "2nd argument is not a valid callback"); - RETURN_FALSE; - } - if(res_parser->characterDataHandler) { - zval_ptr_dtor(&res_parser->characterDataHandler); - } - ALLOC_ZVAL(res_parser->characterDataHandler); - *res_parser->characterDataHandler = *handler; - zval_copy_ctor(res_parser->characterDataHandler); - RETURN_TRUE; - } + zval * parser_res = NULL; + int parser_resid = -1; + php_html_parser * parser; + zval * handler = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r/z/", &parser_res, &handler) == FAILURE) { + return; + } + ZEND_FETCH_RESOURCE(parser, php_html_parser *, &parser_res, parser_resid, "html_parser", le_html_parser); + if (!zend_is_callable(handler, 0, NULL)) { + php_error(E_WARNING, "Invalid comparison function."); + return; } + + + do { +#line 306 "html_parse.xml" + if (!zend_is_callable(handler, 0, NULL)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "2nd argument is not a valid callback"); + RETURN_FALSE; + } + if(parser->characterDataHandler) { + zval_ptr_dtor(&parser->characterDataHandler); + } + ALLOC_ZVAL(parser->characterDataHandler); + *parser->characterDataHandler = *handler; + zval_copy_ctor(parser->characterDataHandler); + RETURN_TRUE; + } while(0); } -/* }}} */ +/* }}} html_parser_data_handler */ /* {{{ proto bool html_parser_comment_handler(resource html_parser parser, callback handler) set callback function for HTML comments */ PHP_FUNCTION(html_parser_comment_handler) { - zval * parser = NULL; - int parser_id = -1; - php_html_parser * res_parser; - zval * handler = NULL; - int argc = ZEND_NUM_ARGS(); - - if (zend_parse_parameters(argc TSRMLS_CC, "rz", &parser, &handler) == FAILURE) return; - - if (parser) { - ZEND_FETCH_RESOURCE(res_parser, php_html_parser *, &parser, parser_id, "html_parser", le_html_parser); - } - - { - if (!zend_is_callable(handler, 0, NULL)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "2nd argument is not a valid callback"); - RETURN_FALSE; - } - if(res_parser->commentHandler) { - zval_ptr_dtor(&res_parser->commentHandler); - } - ALLOC_ZVAL(res_parser->commentHandler); - *res_parser->commentHandler = *handler; - zval_copy_ctor(res_parser->commentHandler); - RETURN_TRUE; - } + zval * parser_res = NULL; + int parser_resid = -1; + php_html_parser * parser; + zval * handler = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r/z/", &parser_res, &handler) == FAILURE) { + return; + } + ZEND_FETCH_RESOURCE(parser, php_html_parser *, &parser_res, parser_resid, "html_parser", le_html_parser); + if (!zend_is_callable(handler, 0, NULL)) { + php_error(E_WARNING, "Invalid comparison function."); + return; } + + + do { +#line 328 "html_parse.xml" + if (!zend_is_callable(handler, 0, NULL)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "2nd argument is not a valid callback"); + RETURN_FALSE; + } + if(parser->commentHandler) { + zval_ptr_dtor(&parser->commentHandler); + } + ALLOC_ZVAL(parser->commentHandler); + *parser->commentHandler = *handler; + zval_copy_ctor(parser->commentHandler); + RETURN_TRUE; + } while(0); } -/* }}} */ +/* }}} html_parser_comment_handler */ -/* {{{ proto bool html_parser_parse(resource html_parser parser, string &data [, bool finish]) +/* {{{ proto bool html_parser_parse(resource html_parser parser, string data [, bool finish]) feed input into parser */ PHP_FUNCTION(html_parser_parse) { - zval * parser = NULL; - int parser_id = -1; - php_html_parser * res_parser; - char * data = NULL; - int data_len = 0; - zend_bool finish = 0; - int argc = ZEND_NUM_ARGS(); - - if (zend_parse_parameters(argc TSRMLS_CC, "rs|b", &parser, &data, &data_len, &finish) == FAILURE) return; - - if (parser) { - ZEND_FETCH_RESOURCE(res_parser, php_html_parser *, &parser, parser_id, "html_parser", le_html_parser); - } - - { -{ - /* prepare input data as needed by ekhtml_parser_feed */ - ekhtml_string_t str; - str.str = data; - str.len = data_len; - /* feed data */ - ekhtml_parser_feed(res_parser->parser, &str); - /* request parsing of feeded data */ - ekhtml_parser_flush(res_parser->parser, finish); + zval * parser_res = NULL; + int parser_resid = -1; + php_html_parser * parser; + const char * data = NULL; + int data_len = 0; + zend_bool finish = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r/s/|b/", &parser_res, &data, &data_len, &finish) == FAILURE) { + return; + } + ZEND_FETCH_RESOURCE(parser, php_html_parser *, &parser_res, parser_resid, "html_parser", le_html_parser); + + + do { +#line 348 "html_parse.xml" + { + /* prepare input data as needed by ekhtml_parser_feed */ + ekhtml_string_t str; + str.str = data; + str.len = data_len; + + /* feed data */ + ekhtml_parser_feed(parser->parser, &str); + + /* request parsing of feeded data */ + ekhtml_parser_flush(parser->parser, finish); + } + } while(0); } - } -} -/* }}} */ +/* }}} html_parser_parse */ + +#endif /* HAVE_HTML_PARSE */ /* http://cvs.php.net/viewcvs.cgi/pecl/html_parse/html_parse.dsp?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/html_parse.dsp diff -u pecl/html_parse/html_parse.dsp:1.1 pecl/html_parse/html_parse.dsp:1.2 --- pecl/html_parse/html_parse.dsp:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/html_parse.dsp Mon Feb 20 18:33:16 2006 @@ -1,112 +1,112 @@ -# Microsoft Developer Studio Project File - Name="html_parse" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=html_parse - Win32 Debug_TS -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "html_parse.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "html_parse.mak" CFG="html_parse - Win32 Debug_TS" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "html_parse - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "html_parse - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "html_parse - Win32 Release_TS" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release_TS" -# PROP BASE Intermediate_Dir "Release_TS" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release_TS" -# PROP Intermediate_Dir "Release_TS" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HTML_PARSE_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_HTML_PARSE" /D ZTS=1 /D HAVE_HTML_PARSE=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x407 /d "NDEBUG" -# ADD RSC /l 0x407 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ekhtml.lib /nologo /dll /machine:I386 -# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ekhtml.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS\php_html_parse.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" - -!ELSEIF "$(CFG)" == "html_parse - Win32 Debug_TS" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug_TS" -# PROP BASE Intermediate_Dir "Debug_TS" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug_TS" -# PROP Intermediate_Dir "Debug_TS" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HTML_PARSE_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_HTML_PARSE" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_HTML_PARSE=1 /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x407 /d "_DEBUG" -# ADD RSC /l 0x407 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ekhtml.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ekhtml.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS\php_html_parse.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" - -!ENDIF - -# Begin Target - -# Name "html_parse - Win32 Release_TS" -# Name "html_parse - Win32 Debug_TS" - -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" - -# Begin Source File - -SOURCE=.\html_parse.c -# End Source File - -# End Group - -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" - -# Begin Source File - -SOURCE=.\php_html_parse.h -# End Source File -# End Group -# End Target -# End Project +# Microsoft Developer Studio Project File - Name="html_parse" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=html_parse - Win32 Debug_TS +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "html_parse.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "html_parse.mak" CFG="html_parse - Win32 Debug_TS" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "html_parse - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "html_parse - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "html_parse - Win32 Release_TS" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release_TS" +# PROP BASE Intermediate_Dir "Release_TS" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release_TS" +# PROP Intermediate_Dir "Release_TS" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HTML_PARSE_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_HTML_PARSE" /D ZTS=1 /D HAVE_HTML_PARSE=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x407 /d "NDEBUG" +# ADD RSC /l 0x407 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ekhtml.lib /nologo /dll /machine:I386 +# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ekhtml.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS\php_html_parse.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" + +!ELSEIF "$(CFG)" == "html_parse - Win32 Debug_TS" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug_TS" +# PROP BASE Intermediate_Dir "Debug_TS" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug_TS" +# PROP Intermediate_Dir "Debug_TS" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HTML_PARSE_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_HTML_PARSE" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_HTML_PARSE=1 /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x407 /d "_DEBUG" +# ADD RSC /l 0x407 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ekhtml.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ekhtml.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS\php_html_parse.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" + +!ENDIF + +# Begin Target + +# Name "html_parse - Win32 Release_TS" +# Name "html_parse - Win32 Debug_TS" + +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" + +# Begin Source File + +SOURCE=./html_parse.c +# End Source File + +# End Group + +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" + +# Begin Source File + +SOURCE=.\php_html_parse.h +# End Source File +# End Group +# End Target +# End Project http://cvs.php.net/viewcvs.cgi/pecl/html_parse/package.xml?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/package.xml diff -u pecl/html_parse/package.xml:1.1 pecl/html_parse/package.xml:1.2 --- pecl/html_parse/package.xml:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/package.xml Mon Feb 20 18:33:16 2006 @@ -1,6 +1,7 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE package SYSTEM "../../package.dtd"> +<?xml version="1.0"?> +<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> <package> + <name>html_parse</name> <summary>HTML parser extenion</summary> <description> @@ -8,10 +9,10 @@ (http://ekhtml.sourceforge.net/) </description> - <license>PHP License</license> + <license>PHP</license> <configureoptions> - <configureoption name="with-html_parse" default="shared" prompt="ekhtml installation directory?"/> + <configureoption name="with-ekhtml" default="autodetect" prompt="ekhtml installation directory?" /> </configureoptions> <maintainers> @@ -24,22 +25,46 @@ </maintainers> <release> - <version>0.1</version> - <date>2003-05-20</date> - <state>alpha</state> - <notes>- first experimental draft</notes> + <version>0.9</version> + <state>beta</state> + <notes> - preparing for 1.0.0 release +</notes> + <date>2006-02-20</date> </release> + <changelog> + <release> + <version>0.1</version> + <date>2002-02-28</date> + <state>alpha</state> + <license>php</license> + <notes> + - first experimental draft + </notes> + </release> + + </changelog> + <deps> + <dep type="php" rel="ge" version="4.0.0"/> + </deps> <filelist> - <dir role="doc" name="/"> - <file role="doc">LICENSE</file> - <file role="doc">EXPERIMENTAL</file> - <file role="doc">CREDITS</file> - <file role="src">config.m4</file> - <file role="src">html_parse.dsp</file> - <file role="src">html_parse.c</file> - <file role="src">php_html_parse.h</file> + <dir name="/"> + <file role='doc' name='EXPERIMENTAL'/> + <file role='doc' name='CREDITS'/> + <file role='src' name='config.m4'/> + <file role='src' name='html_parse.dsp'/> + <file role='src' name='config.w32'/> + <file role='src' name='html_parse.c'/> + <file role='src' name='php_html_parse.h'/> + <dir name="tests"> + <file role='test' name='html_parser_create.phpt'/> + <file role='test' name='html_parser_free.phpt'/> + <file role='test' name='html_parser_starttag_handler.phpt'/> + <file role='test' name='html_parser_endtag_handler.phpt'/> + <file role='test' name='html_parser_data_handler.phpt'/> + <file role='test' name='html_parser_comment_handler.phpt'/> + <file role='test' name='html_parser_parse.phpt'/> + </dir> </dir> </filelist> - </package> http://cvs.php.net/viewcvs.cgi/pecl/html_parse/php_html_parse.h?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/php_html_parse.h diff -u pecl/html_parse/php_html_parse.h:1.1 pecl/html_parse/php_html_parse.h:1.2 --- pecl/html_parse/php_html_parse.h:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/php_html_parse.h Mon Feb 20 18:33:16 2006 @@ -2,13 +2,13 @@ +----------------------------------------------------------------------+ | This source file is subject to version 3.0 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_0.txt. | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Hartmut Holzgraefe <hartmut@php.net> | + | Authors: Hartmut Holzgraefe <hartmut@php.net> | +----------------------------------------------------------------------+ */ @@ -17,29 +17,28 @@ #ifndef PHP_HTML_PARSE_H #define PHP_HTML_PARSE_H +#ifdef __cplusplus +extern "C" { +#endif #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include <php.h> + #ifdef HAVE_HTML_PARSE -#include <php.h> #include <php_ini.h> #include <SAPI.h> #include <ext/standard/info.h> - -#include <ekhtml.h> -/* resource payload for html_parse resources */ -typedef struct { - /* HTML parser */ - ekhtml_parser_t *parser; - /* callback functions */ - zval *startElementHandler; - zval *endElementHandler; - zval *characterDataHandler; - zval *commentHandler; -} php_html_parser; +#include <Zend/zend_extensions.h> +#ifdef __cplusplus +} // extern "C" +#endif +#ifdef __cplusplus +extern "C" { +#endif extern zend_module_entry html_parse_module_entry; #define phpext_html_parse_ptr &html_parse_module_entry @@ -60,14 +59,66 @@ #include "TSRM.h" #endif +#define FREE_RESOURCE(resource) zend_list_delete(Z_LVAL_P(resource)) + +#define PROP_GET_LONG(name) Z_LVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_SET_LONG(name, l) zend_update_property_long(_this_ce, _this_zval, #name, strlen(#name), l TSRMLS_CC) + +#define PROP_GET_DOUBLE(name) Z_DVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_SET_DOUBLE(name, d) zend_update_property_double(_this_ce, _this_zval, #name, strlen(#name), d TSRMLS_CC) + +#define PROP_GET_STRING(name) Z_STRVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_GET_STRLEN(name) Z_STRLEN_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_SET_STRING(name, s) zend_update_property_string(_this_ce, _this_zval, #name, strlen(#name), s TSRMLS_CC) +#define PROP_SET_STRINGL(name, s, l) zend_update_property_string(_this_ce, _this_zval, #name, strlen(#name), s, l TSRMLS_CC) + PHP_FUNCTION(html_parser_create); PHP_FUNCTION(html_parser_free); PHP_FUNCTION(html_parser_starttag_handler); +ZEND_BEGIN_ARG_INFO(html_parser_starttag_handler_args, 0) + ZEND_ARG_INFO(0, handler) +ZEND_END_ARG_INFO() PHP_FUNCTION(html_parser_endtag_handler); +ZEND_BEGIN_ARG_INFO(html_parser_endtag_handler_args, 0) + ZEND_ARG_INFO(0, handler) +ZEND_END_ARG_INFO() PHP_FUNCTION(html_parser_data_handler); +ZEND_BEGIN_ARG_INFO(html_parser_data_handler_args, 0) + ZEND_ARG_INFO(0, handler) +ZEND_END_ARG_INFO() PHP_FUNCTION(html_parser_comment_handler); +ZEND_BEGIN_ARG_INFO(html_parser_comment_handler_args, 0) + ZEND_ARG_INFO(0, handler) +ZEND_END_ARG_INFO() PHP_FUNCTION(html_parser_parse); +ZEND_BEGIN_ARG_INFO(html_parser_parse_args, 0) + ZEND_ARG_INFO(0, data) + ZEND_ARG_INFO(0, finish) +ZEND_END_ARG_INFO() +#ifdef __cplusplus +} // extern "C" +#endif + +/* 'bottom' header snippets*/ +#include <ekhtml.h> + +/* resource payload for html_parse resources */ +typedef struct { + /* HTML parser */ + ekhtml_parser_t *parser; + + /* callback functions */ + zval *startElementHandler; + zval *endElementHandler; + zval *characterDataHandler; + zval *commentHandler; +} php_html_parser; + +static void _start_cb(void *data, ekhtml_string_t *tag, ekhtml_attr_t *attrs); +static void _end_cb(void *data, ekhtml_string_t *tag); +static void _comment_cb(void *data, ekhtml_string_t *comment); +static void _data_cb(void *data, ekhtml_string_t *characterData); #endif /* PHP_HAVE_HTML_PARSE */ http://cvs.php.net/viewcvs.cgi/pecl/html_parse/manual/html-parse/configure.xml?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/manual/html-parse/configure.xml diff -u pecl/html_parse/manual/html-parse/configure.xml:1.1 pecl/html_parse/manual/html-parse/configure.xml:1.2 --- pecl/html_parse/manual/html-parse/configure.xml:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/manual/html-parse/configure.xml Mon Feb 20 18:33:16 2006 @@ -9,9 +9,6 @@ <section id='html-parse.install'> &reftitle.install; - <para> -foobar install - </para> </section> http://cvs.php.net/viewcvs.cgi/pecl/html_parse/manual/html-parse/reference.xml?r1=1.2&r2=1.3&diff_format=u Index: pecl/html_parse/manual/html-parse/reference.xml diff -u pecl/html_parse/manual/html-parse/reference.xml:1.2 pecl/html_parse/manual/html-parse/reference.xml:1.3 --- pecl/html_parse/manual/html-parse/reference.xml:1.2 Wed Apr 6 06:30:03 2005 +++ pecl/html_parse/manual/html-parse/reference.xml Mon Feb 20 18:33:16 2006 @@ -1,5 +1,5 @@ <?xml version='1.0' encoding='iso-8859-1'?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <reference id='ref.html-parse'> <title>HTML parser extenion</title> <titleabbrev>html-parse</titleabbrev> @@ -19,10 +19,10 @@ <section id='html-parse.resources'> &reftitle.resources; - <section id='html_parse.resources.html_parser'> + <section id='html-parse.resources.html_parser'> <title><literal>html_parser</literal></title> <para> - HTML parser resource + HTML parser resource </para> </section> http://cvs.php.net/viewcvs.cgi/pecl/html_parse/manual/html-parse/functions/html-parser-comment-handler.xml?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/manual/html-parse/functions/html-parser-comment-handler.xml diff -u pecl/html_parse/manual/html-parse/functions/html-parser-comment-handler.xml:1.1 pecl/html_parse/manual/html-parse/functions/html-parser-comment-handler.xml:1.2 --- pecl/html_parse/manual/html-parse/functions/html-parser-comment-handler.xml:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/manual/html-parse/functions/html-parser-comment-handler.xml Mon Feb 20 18:33:16 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.html-parser-comment-handler"> <refnamediv> <refname>html_parser_comment_handler</refname> @@ -13,7 +13,7 @@ <methodparam><type>callback</type><parameter>handler</parameter></methodparam> </methodsynopsis> <para> - </para> + </para> </refsect1> </refentry> http://cvs.php.net/viewcvs.cgi/pecl/html_parse/manual/html-parse/functions/html-parser-create.xml?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/manual/html-parse/functions/html-parser-create.xml diff -u pecl/html_parse/manual/html-parse/functions/html-parser-create.xml:1.1 pecl/html_parse/manual/html-parse/functions/html-parser-create.xml:1.2 --- pecl/html_parse/manual/html-parse/functions/html-parser-create.xml:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/manual/html-parse/functions/html-parser-create.xml Mon Feb 20 18:33:16 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.html-parser-create"> <refnamediv> <refname>html_parser_create</refname> http://cvs.php.net/viewcvs.cgi/pecl/html_parse/manual/html-parse/functions/html-parser-data-handler.xml?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/manual/html-parse/functions/html-parser-data-handler.xml diff -u pecl/html_parse/manual/html-parse/functions/html-parser-data-handler.xml:1.1 pecl/html_parse/manual/html-parse/functions/html-parser-data-handler.xml:1.2 --- pecl/html_parse/manual/html-parse/functions/html-parser-data-handler.xml:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/manual/html-parse/functions/html-parser-data-handler.xml Mon Feb 20 18:33:16 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.html-parser-data-handler"> <refnamediv> <refname>html_parser_data_handler</refname> @@ -13,7 +13,7 @@ <methodparam><type>callback</type><parameter>handler</parameter></methodparam> </methodsynopsis> <para> - </para> + </para> </refsect1> </refentry> http://cvs.php.net/viewcvs.cgi/pecl/html_parse/manual/html-parse/functions/html-parser-endtag-handler.xml?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/manual/html-parse/functions/html-parser-endtag-handler.xml diff -u pecl/html_parse/manual/html-parse/functions/html-parser-endtag-handler.xml:1.1 pecl/html_parse/manual/html-parse/functions/html-parser-endtag-handler.xml:1.2 --- pecl/html_parse/manual/html-parse/functions/html-parser-endtag-handler.xml:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/manual/html-parse/functions/html-parser-endtag-handler.xml Mon Feb 20 18:33:16 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.html-parser-endtag-handler"> <refnamediv> <refname>html_parser_endtag_handler</refname> @@ -13,7 +13,7 @@ <methodparam><type>callback</type><parameter>handler</parameter></methodparam> </methodsynopsis> <para> - </para> + </para> </refsect1> </refentry> http://cvs.php.net/viewcvs.cgi/pecl/html_parse/manual/html-parse/functions/html-parser-free.xml?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/manual/html-parse/functions/html-parser-free.xml diff -u pecl/html_parse/manual/html-parse/functions/html-parser-free.xml:1.1 pecl/html_parse/manual/html-parse/functions/html-parser-free.xml:1.2 --- pecl/html_parse/manual/html-parse/functions/html-parser-free.xml:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/manual/html-parse/functions/html-parser-free.xml Mon Feb 20 18:33:16 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.html-parser-free"> <refnamediv> <refname>html_parser_free</refname> @@ -12,7 +12,7 @@ <methodparam><type>resource</type><parameter>parser</parameter></methodparam> </methodsynopsis> <para> - </para> + </para> </refsect1> </refentry> http://cvs.php.net/viewcvs.cgi/pecl/html_parse/manual/html-parse/functions/html-parser-parse.xml?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/manual/html-parse/functions/html-parser-parse.xml diff -u pecl/html_parse/manual/html-parse/functions/html-parser-parse.xml:1.1 pecl/html_parse/manual/html-parse/functions/html-parser-parse.xml:1.2 --- pecl/html_parse/manual/html-parse/functions/html-parser-parse.xml:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/manual/html-parse/functions/html-parser-parse.xml Mon Feb 20 18:33:16 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.html-parser-parse"> <refnamediv> <refname>html_parser_parse</refname> @@ -10,11 +10,11 @@ <methodsynopsis> <type>bool</type><methodname>html_parser_parse</methodname> <methodparam><type>resource</type><parameter>parser</parameter></methodparam> - <methodparam><type>string</type><parameter>&data</parameter></methodparam> + <methodparam><type>string</type><parameter>data</parameter></methodparam> <methodparam choice='opt'><type>bool</type><parameter>finish</parameter></methodparam> </methodsynopsis> <para> -&warn.undocumented.func; </para> + </para> </refsect1> </refentry> http://cvs.php.net/viewcvs.cgi/pecl/html_parse/manual/html-parse/functions/html-parser-starttag-handler.xml?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/manual/html-parse/functions/html-parser-starttag-handler.xml diff -u pecl/html_parse/manual/html-parse/functions/html-parser-starttag-handler.xml:1.1 pecl/html_parse/manual/html-parse/functions/html-parser-starttag-handler.xml:1.2 --- pecl/html_parse/manual/html-parse/functions/html-parser-starttag-handler.xml:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/manual/html-parse/functions/html-parser-starttag-handler.xml Mon Feb 20 18:33:16 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.html-parser-starttag-handler"> <refnamediv> <refname>html_parser_starttag_handler</refname> @@ -13,7 +13,7 @@ <methodparam><type>callback</type><parameter>handler</parameter></methodparam> </methodsynopsis> <para> - </para> + </para> </refsect1> </refentry> http://cvs.php.net/viewcvs.cgi/pecl/html_parse/tests/html_parser_comment_handler.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/tests/html_parser_comment_handler.phpt diff -u pecl/html_parse/tests/html_parser_comment_handler.phpt:1.1 pecl/html_parse/tests/html_parser_comment_handler.phpt:1.2 --- pecl/html_parse/tests/html_parser_comment_handler.phpt:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/tests/html_parser_comment_handler.phpt Mon Feb 20 18:33:16 2006 @@ -1,12 +1,14 @@ --TEST-- html_parser_comment_handler() function --SKIPIF-- -<?php if (!extension_loaded('html_parse')) print 'skip'; ?> ---POST-- ---GET-- ---FILE-- <?php - echo 'no test case for html_parser_comment_handler() yet'; + +if(!extension_loaded('html_parse')) die('skip'); + + ?> +--FILE-- +<?php +echo 'OK'; // no test case for this function yet ?> --EXPECT-- -no test case for html_parser_comment_handler() yet \ No newline at end of file +OK \ No newline at end of file http://cvs.php.net/viewcvs.cgi/pecl/html_parse/tests/html_parser_create.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/tests/html_parser_create.phpt diff -u pecl/html_parse/tests/html_parser_create.phpt:1.1 pecl/html_parse/tests/html_parser_create.phpt:1.2 --- pecl/html_parse/tests/html_parser_create.phpt:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/tests/html_parser_create.phpt Mon Feb 20 18:33:16 2006 @@ -1,12 +1,14 @@ --TEST-- html_parser_create() function --SKIPIF-- -<?php if (!extension_loaded('html_parse')) print 'skip'; ?> ---POST-- ---GET-- ---FILE-- <?php - echo 'no test case for html_parser_create() yet'; + +if(!extension_loaded('html_parse')) die('skip'); + + ?> +--FILE-- +<?php +echo 'OK'; // no test case for this function yet ?> --EXPECT-- -no test case for html_parser_create() yet \ No newline at end of file +OK \ No newline at end of file http://cvs.php.net/viewcvs.cgi/pecl/html_parse/tests/html_parser_data_handler.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/tests/html_parser_data_handler.phpt diff -u pecl/html_parse/tests/html_parser_data_handler.phpt:1.1 pecl/html_parse/tests/html_parser_data_handler.phpt:1.2 --- pecl/html_parse/tests/html_parser_data_handler.phpt:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/tests/html_parser_data_handler.phpt Mon Feb 20 18:33:16 2006 @@ -1,12 +1,14 @@ --TEST-- html_parser_data_handler() function --SKIPIF-- -<?php if (!extension_loaded('html_parse')) print 'skip'; ?> ---POST-- ---GET-- ---FILE-- <?php - echo 'no test case for html_parser_data_handler() yet'; + +if(!extension_loaded('html_parse')) die('skip'); + + ?> +--FILE-- +<?php +echo 'OK'; // no test case for this function yet ?> --EXPECT-- -no test case for html_parser_data_handler() yet \ No newline at end of file +OK \ No newline at end of file http://cvs.php.net/viewcvs.cgi/pecl/html_parse/tests/html_parser_endtag_handler.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/tests/html_parser_endtag_handler.phpt diff -u pecl/html_parse/tests/html_parser_endtag_handler.phpt:1.1 pecl/html_parse/tests/html_parser_endtag_handler.phpt:1.2 --- pecl/html_parse/tests/html_parser_endtag_handler.phpt:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/tests/html_parser_endtag_handler.phpt Mon Feb 20 18:33:16 2006 @@ -1,12 +1,14 @@ --TEST-- html_parser_endtag_handler() function --SKIPIF-- -<?php if (!extension_loaded('html_parse')) print 'skip'; ?> ---POST-- ---GET-- ---FILE-- <?php - echo 'no test case for html_parser_endtag_handler() yet'; + +if(!extension_loaded('html_parse')) die('skip'); + + ?> +--FILE-- +<?php +echo 'OK'; // no test case for this function yet ?> --EXPECT-- -no test case for html_parser_endtag_handler() yet \ No newline at end of file +OK \ No newline at end of file http://cvs.php.net/viewcvs.cgi/pecl/html_parse/tests/html_parser_free.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/tests/html_parser_free.phpt diff -u pecl/html_parse/tests/html_parser_free.phpt:1.1 pecl/html_parse/tests/html_parser_free.phpt:1.2 --- pecl/html_parse/tests/html_parser_free.phpt:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/tests/html_parser_free.phpt Mon Feb 20 18:33:16 2006 @@ -1,12 +1,14 @@ --TEST-- html_parser_free() function --SKIPIF-- -<?php if (!extension_loaded('html_parse')) print 'skip'; ?> ---POST-- ---GET-- ---FILE-- <?php - echo 'no test case for html_parser_free() yet'; + +if(!extension_loaded('html_parse')) die('skip'); + + ?> +--FILE-- +<?php +echo 'OK'; // no test case for this function yet ?> --EXPECT-- -no test case for html_parser_free() yet \ No newline at end of file +OK \ No newline at end of file http://cvs.php.net/viewcvs.cgi/pecl/html_parse/tests/html_parser_parse.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/tests/html_parser_parse.phpt diff -u pecl/html_parse/tests/html_parser_parse.phpt:1.1 pecl/html_parse/tests/html_parser_parse.phpt:1.2 --- pecl/html_parse/tests/html_parser_parse.phpt:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/tests/html_parser_parse.phpt Mon Feb 20 18:33:16 2006 @@ -1,12 +1,14 @@ --TEST-- html_parser_parse() function --SKIPIF-- -<?php if (!extension_loaded('html_parse')) print 'skip'; ?> ---POST-- ---GET-- ---FILE-- <?php - echo 'no test case for html_parser_parse() yet'; + +if(!extension_loaded('html_parse')) die('skip'); + + ?> +--FILE-- +<?php +echo 'OK'; // no test case for this function yet ?> --EXPECT-- -no test case for html_parser_parse() yet \ No newline at end of file +OK \ No newline at end of file http://cvs.php.net/viewcvs.cgi/pecl/html_parse/tests/html_parser_starttag_handler.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/tests/html_parser_starttag_handler.phpt diff -u pecl/html_parse/tests/html_parser_starttag_handler.phpt:1.1 pecl/html_parse/tests/html_parser_starttag_handler.phpt:1.2 --- pecl/html_parse/tests/html_parser_starttag_handler.phpt:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/tests/html_parser_starttag_handler.phpt Mon Feb 20 18:33:16 2006 @@ -1,12 +1,14 @@ --TEST-- html_parser_starttag_handler() function --SKIPIF-- -<?php if (!extension_loaded('html_parse')) print 'skip'; ?> ---POST-- ---GET-- ---FILE-- <?php - echo 'no test case for html_parser_starttag_handler() yet'; + +if(!extension_loaded('html_parse')) die('skip'); + + ?> +--FILE-- +<?php +echo 'OK'; // no test case for this function yet ?> --EXPECT-- -no test case for html_parser_starttag_handler() yet \ No newline at end of file +OK \ No newline at end of file http://cvs.php.net/viewcvs.cgi/pecl/html_parse/.cvsignore?view=markup&rev=1.1 Index: pecl/html_parse/.cvsignore +++ pecl/html_parse/.cvsignore *.lo *.la..deps..libs Makefile Makefile.fragments Makefile.global Makefile.objects acinclude.m4 aclocal.m4 autom4te.cache build config.cache config.guess config.h config.h.in config.log config.nice config.status config.sub configure configure.in conftest conftest.c include install-sh libtool ltmain.sh missing mkinstalldirs modules scan_makefile_in.awk *.dsw *.plg *.opt *.ncb Release Release_inline Debug Release_TS Release_TSDbg Release_TS_inline Debug_TS html_parse*.tgz http://cvs.php.net/viewcvs.cgi/pecl/html_parse/config.w32?view=markup&rev=1.1 Index: pecl/html_parse/config.w32 +++ pecl/html_parse/config.w32 // $ Id: $ // vim:ft=javascript ARG_ENABLE('html_parse' , 'HTML parser extenion', 'no'); if (PHP_HTML_PARSE == "yes") { if (!CHECK_LIB("ekhtml.lib", "html_parse", PHP_HTML_PARSE)) { ERROR("html_parse: library 'ekhtml' not found"); } EXTENSION("html_parse", "html_parse.c"); AC_DEFINE("HAVE_HTML_PARSE", 1, "html_parse support"); } http://cvs.php.net/viewcvs.cgi/pecl/html_parse/package2.xml?view=markup&rev=1.1 Index: pecl/html_parse/package2.xml +++ pecl/html_parse/package2.xml <?xml version="1.0"?> <package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> <name>html_parse</name> <channel>pecl.php.net</channel> <summary>HTML parser extenion</summary> <description> HTML parser extension based on the ekhtml library (http://ekhtml.sourceforge.net/) </description> <lead> <name>Hartmut Holzgraefe</name> <user>hholzgra</user> <email>hartmut@php.net</email> <active>yes</active> </lead> <date>2006-02-20</date> <version> <release>0.9</release> <api>0.9</api> </version> <stability> <release>beta</release> <api>beta</api> </stability> <license uri="http://php.net/license" filesource="LICENSE">PHP</license> <notes> - preparing for 1.0.0 release </notes> <contents> <dir name="/"> <file role='doc' name='EXPERIMENTAL'/> <file role='doc' name='CREDITS'/> <file role='src' name='config.m4'/> <file role='src' name='html_parse.dsp'/> <file role='src' name='config.w32'/> <file role='src' name='html_parse.c'/> <file role='src' name='php_html_parse.h'/> <dir name="tests"> <file role='test' name='html_parser_create.phpt'/> <file role='test' name='html_parser_free.phpt'/> <file role='test' name='html_parser_starttag_handler.phpt'/> <file role='test' name='html_parser_endtag_handler.phpt'/> <file role='test' name='html_parser_data_handler.phpt'/> <file role='test' name='html_parser_comment_handler.phpt'/> <file role='test' name='html_parser_parse.phpt'/> </dir> </dir> </contents> <dependencies> <required> <php> <min>4.0.0</min> </php> <pearinstaller> <min>1.4.0a1</min> </pearinstaller> </required> </dependencies> <providesextension>html_parse</providesextension> <extsrcrelease> <configureoption name="with-ekhtml" default="autodetect" prompt="ekhtml installation directory?" /> </extsrcrelease> </package>
http://cvs.php.net/viewcvs.cgi/pecl/html_parse/CREDITS?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/CREDITS diff -u pecl/html_parse/CREDITS:1.1 pecl/html_parse/CREDITS:1.2 --- pecl/html_parse/CREDITS:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/CREDITS Mon Feb 20 18:33:16 2006 @@ -1 +1,2 @@ html_parse +Hartmut Holzgraefe http://cvs.php.net/viewcvs.cgi/pecl/html_parse/config.m4?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/config.m4 diff -u pecl/html_parse/config.m4:1.1 pecl/html_parse/config.m4:1.2 --- pecl/html_parse/config.m4:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/config.m4 Mon Feb 20 18:33:16 2006 @@ -1,34 +1,55 @@ dnl dnl $ Id: $ dnl - -PHP_ARG_WITH(html_parse, whether to enable html_parse functions, -[ --with-html_parse[=DIR] With html_parse support], yes) + +PHP_ARG_ENABLE(html_parse, whether to enable html_parse functions, +[ --enable-html_parse Enable html_parse support]) if test "$PHP_HTML_PARSE" != "no"; then - if test -r "$PHP_HTML_PARSE/include/ekhtml.h"; then - PHP_HTML_PARSE_DIR="$PHP_HTML_PARSE" - else - AC_MSG_CHECKING(for html_parse in default path) - for i in /usr /usr/local; do - if test -r "$i/include/ekhtml.h"; then - PHP_HTML_PARSE_DIR=$i - AC_MSG_RESULT(found in $i) - fi - done - fi -fi + +PHP_ARG_WITH(ekhtml, foobar install, +[ --with-ekhtml[=DIR] With ekhtml support]) -PHP_ADD_INCLUDE($PHP_HTML_PARSE_DIR/include) -PHP_SUBST(HTML_PARSE_SHARED_LIBADD) + if test -r "$PHP_EKHTML/include/ekhtml.h"; then + PHP_EKHTML_DIR="$PHP_EKHTML" + else + AC_MSG_CHECKING(for ekhtml in default path) + for i in /usr /usr/local; do + if test -r "$i/include/ekhtml.h"; then + PHP_EKHTML_DIR=$i + AC_MSG_RESULT(found in $i) + break + fi + done + if test "x" = "x$PHP_EKHTML_DIR"; then + AC_MSG_ERROR(not found) + fi + fi -PHP_ADD_LIBRARY_WITH_PATH(ekhtml, $PHP_HTML_PARSE_DIR/lib, HTML_PARSE_SHARED_LIBADD) -AC_CHECK_LIB(ekhtml, ekhtml_parser_new, [AC_DEFINE(HAVE_EKHTML,1,[ ])], [AC_MSG_ERROR(ekhtml library not found or wrong version)],) + export OLD_CPPFLAGS="$CPPFLAGS" + export CPPFLAGS="$CPPFLAGS $INCLUDES -DHAVE_EKHTML" + export CPPFLAGS="$OLD_CPPFLAGS" + export OLD_CPPFLAGS="$CPPFLAGS" + export CPPFLAGS="$CPPFLAGS $INCLUDES -DHAVE_HTML_PARSE" + AC_CHECK_TYPE(php_html_parser *, [], [AC_MSG_ERROR(required payload type for resource html_parser not found)], [#include "$srcdir/php_html_parse.h"]) + export CPPFLAGS="$OLD_CPPFLAGS" + PHP_SUBST(HTML_PARSE_SHARED_LIBADD) + + + PHP_CHECK_LIBRARY(ekhtml, ekhtml_parser_new, + [ + PHP_ADD_LIBRARY_WITH_PATH(ekhtml, $PHP_HTML_PARSE_DIR/lib, HTML_PARSE_SHARED_LIBADD) + ],[ + AC_MSG_ERROR([wrong ekhtml lib version or lib not found]) + ],[ + -L$PHP_HTML_PARSE_DIR/lib + ]) -if test "$PHP_HTML_PARSE" != "no"; then + PHP_SUBST(HTML_PARSE_SHARED_LIBADD) AC_DEFINE(HAVE_HTML_PARSE, 1, [ ]) PHP_NEW_EXTENSION(html_parse, html_parse.c , $ext_shared) + fi http://cvs.php.net/viewcvs.cgi/pecl/html_parse/html_parse.c?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/html_parse.c diff -u pecl/html_parse/html_parse.c:1.1 pecl/html_parse/html_parse.c:1.2 --- pecl/html_parse/html_parse.c:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/html_parse.c Mon Feb 20 18:33:16 2006 @@ -2,13 +2,13 @@ +----------------------------------------------------------------------+ | This source file is subject to version 3.0 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_0.txt. | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Hartmut Holzgraefe <hartmut@php.net> | + | Authors: Hartmut Holzgraefe <hartmut@php.net> | +----------------------------------------------------------------------+ */ @@ -16,122 +16,117 @@ #include "php_html_parse.h" +#if HAVE_HTML_PARSE - /* {{{ _start_cb() */ - static void _start_cb(void *data, ekhtml_string_t *tag, ekhtml_attr_t *attrs) { - php_html_parser *parser = (php_html_parser *)data; - zval *cb_retval, *cb_tag, *cb_array; - zval **cb_args[2]; - TSRMLS_FETCH(); - if (parser->startElementHandler) { - /* create zval string parameter for tag name */ - MAKE_STD_ZVAL(cb_tag); - ZVAL_STRINGL(cb_tag, (char *)tag->str, tag->len, 1); - cb_args[0] = &cb_tag; - /* create zval array parameter for tag attributes */ - MAKE_STD_ZVAL(cb_array); - array_init(cb_array); - while(attrs) { - /* hash key argument needs to be zero-terminated, - so we have to create a copy */ - char *name = emalloc(attrs->name.len +1); - strlcpy(name, attrs->name.str, attrs->name.len +1); - /* in HTML attributes may be just set without a value */ - if(attrs->isBoolean) { - add_assoc_bool(cb_array, name, 1); - } else { - add_assoc_stringl(cb_array, name, (char *)attrs->val.str, attrs->val.len, 1); - } - /* free hash key name copy */ - efree(name); - /* get next attribute */ - attrs = attrs->next; - } - cb_args[1] = &cb_array; - /* now call the handler function with the prepared parameters */ - if (call_user_function_ex(EG(function_table), NULL, parser->startElementHandler, &cb_retval, 2, cb_args, 0, NULL TSRMLS_CC) == SUCCESS && cb_retval) { - zval_ptr_dtor(&cb_retval); - } - /* cleanup */ - zval_ptr_dtor(&cb_tag); - zval_ptr_dtor(&cb_array); - } - } - - /* }}} */ - - - /* {{{ _end_cb() */ - static void _end_cb(void *data, ekhtml_string_t *tag) { - php_html_parser *parser = (php_html_parser *)data; - zval *cb_retval, *cb_tag; - zval **cb_args[1]; - TSRMLS_FETCH(); - if (parser->endElementHandler) { - MAKE_STD_ZVAL(cb_tag); - ZVAL_STRINGL(cb_tag, (char *)tag->str, tag->len, 1); - cb_args[0] = &cb_tag; - if (call_user_function_ex(EG(function_table), NULL, parser->endElementHandler, &cb_retval, 1, cb_args, 0, NULL TSRMLS_CC) == SUCCESS && cb_retval) { - zval_ptr_dtor(&cb_retval); - } - zval_ptr_dtor(&cb_tag); - } - } - - /* }}} */ - - - /* {{{ _comment_cb() */ - static void _comment_cb(void *data, ekhtml_string_t *comment) { - php_html_parser *parser = (php_html_parser *)data; - zval *cb_retval, *cb_comment; - zval **cb_args[1]; - TSRMLS_FETCH(); - if (parser->commentHandler) { - MAKE_STD_ZVAL(cb_comment); - ZVAL_STRINGL(cb_comment, (char *)comment->str, comment->len, 1); - cb_args[0] = &cb_comment; - if (call_user_function_ex(EG(function_table), NULL, parser->commentHandler, &cb_retval, 1, cb_args, 0, NULL TSRMLS_CC) == SUCCESS && cb_retval) { - zval_ptr_dtor(&cb_retval); - } - zval_ptr_dtor(&cb_comment); - } - } - - /* }}} */ - - - /* {{{ _data_cb() */ - static void _data_cb(void *data, ekhtml_string_t *characterData) { - php_html_parser *parser = (php_html_parser *)data; - zval *cb_retval, *cb_data; - zval **cb_args[1]; - TSRMLS_FETCH(); - if (parser->characterDataHandler) { - MAKE_STD_ZVAL(cb_data); - ZVAL_STRINGL(cb_data, (char *)characterData->str, characterData->len, 1); - cb_args[0] = &cb_data; - if (call_user_function_ex(EG(function_table), NULL, parser->characterDataHandler, &cb_retval, 1, cb_args, 0, NULL TSRMLS_CC) == SUCCESS && cb_retval) { - zval_ptr_dtor(&cb_retval); - } - zval_ptr_dtor(&cb_data); - } - } - - /* }}} */ +static void _start_cb(void *data, ekhtml_string_t *tag, ekhtml_attr_t *attrs) { + php_html_parser *parser = (php_html_parser *)data; + zval *cb_retval, *cb_tag, *cb_array; + zval **cb_args[2]; + TSRMLS_FETCH(); + + if (parser->startElementHandler) { + /* create zval string parameter for tag name */ + MAKE_STD_ZVAL(cb_tag); + ZVAL_STRINGL(cb_tag, (char *)tag->str, tag->len, 1); + cb_args[0] = &cb_tag; + + /* create zval array parameter for tag attributes */ + MAKE_STD_ZVAL(cb_array); + array_init(cb_array); + while(attrs) { + /* hash key argument needs to be zero-terminated, + so we have to create a copy */ + char *name = emalloc(attrs->name.len +1); + strlcpy(name, attrs->name.str, attrs->name.len +1); + + /* in HTML attributes may be just set without a value */ + if(attrs->isBoolean) { + add_assoc_bool(cb_array, name, 1); + } else { + add_assoc_stringl(cb_array, name, (char *)attrs->val.str, attrs->val.len, 1); + } + /* free hash key name copy */ + efree(name); + /* get next attribute */ + attrs = attrs->next; + } + cb_args[1] = &cb_array; + + /* now call the handler function with the prepared parameters */ + if (call_user_function_ex(EG(function_table), NULL, parser->startElementHandler, &cb_retval, 2, cb_args, 0, NULL TSRMLS_CC) == SUCCESS && cb_retval) { + zval_ptr_dtor(&cb_retval); + } + + /* cleanup */ + zval_ptr_dtor(&cb_tag); + zval_ptr_dtor(&cb_array); + } +} + +static void _end_cb(void *data, ekhtml_string_t *tag) { + php_html_parser *parser = (php_html_parser *)data; + zval *cb_retval, *cb_tag; + zval **cb_args[1]; + TSRMLS_FETCH(); + + if (parser->endElementHandler) { + MAKE_STD_ZVAL(cb_tag); + ZVAL_STRINGL(cb_tag, (char *)tag->str, tag->len, 1); + cb_args[0] = &cb_tag; + if (call_user_function_ex(EG(function_table), NULL, parser->endElementHandler, &cb_retval, 1, cb_args, 0, NULL TSRMLS_CC) == SUCCESS && cb_retval) { + zval_ptr_dtor(&cb_retval); + } + zval_ptr_dtor(&cb_tag); + } +} + +static void _comment_cb(void *data, ekhtml_string_t *comment) { + php_html_parser *parser = (php_html_parser *)data; + zval *cb_retval, *cb_comment; + zval **cb_args[1]; + TSRMLS_FETCH(); + + if (parser->commentHandler) { + MAKE_STD_ZVAL(cb_comment); + ZVAL_STRINGL(cb_comment, (char *)comment->str, comment->len, 1); + cb_args[0] = &cb_comment; + if (call_user_function_ex(EG(function_table), NULL, parser->commentHandler, &cb_retval, 1, cb_args, 0, NULL TSRMLS_CC) == SUCCESS && cb_retval) { + zval_ptr_dtor(&cb_retval); + } + zval_ptr_dtor(&cb_comment); + } +} + +static void _data_cb(void *data, ekhtml_string_t *characterData) { + php_html_parser *parser = (php_html_parser *)data; + zval *cb_retval, *cb_data; + zval **cb_args[1]; + TSRMLS_FETCH(); + + if (parser->characterDataHandler) { + MAKE_STD_ZVAL(cb_data); + ZVAL_STRINGL(cb_data, (char *)characterData->str, characterData->len, 1); + cb_args[0] = &cb_data; + if (call_user_function_ex(EG(function_table), NULL, parser->characterDataHandler, &cb_retval, 1, cb_args, 0, NULL TSRMLS_CC) == SUCCESS && cb_retval) { + zval_ptr_dtor(&cb_retval); + } + zval_ptr_dtor(&cb_data); + } +} +/* {{{ Resource destructors */ int le_html_parser; - void html_parser_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { - php_html_parser * resource = (php_html_parser *)(rsrc->ptr); + php_html_parser * resource = (php_html_parser *)(rsrc->ptr); - /* destroy HTML parser */ - if(resource->parser) { - ekhtml_parser_destroy(resource->parser); - } - /* destruct any set callback handlers */ + /* destroy HTML parser */ + if(resource->parser) { + ekhtml_parser_destroy(resource->parser); + } + + /* destruct any set callback handlers */ if (resource->startElementHandler) { zval_ptr_dtor(&resource->startElementHandler); } @@ -142,11 +137,14 @@ zval_ptr_dtor(&resource->characterDataHandler); } if (resource->commentHandler) { - zval_ptr_dtor(&resource->commentHandler); + zval_ptr_dtor(&resource->commentHandler); } - efree(resource); + efree(resource); } + +/* }}} * + /* {{{ html_parse_functions[] */ function_entry html_parse_functions[] = { PHP_FE(html_parser_create , NULL) @@ -169,10 +167,10 @@ html_parse_functions, PHP_MINIT(html_parse), /* Replace with NULL if there is nothing to do at php startup */ PHP_MSHUTDOWN(html_parse), /* Replace with NULL if there is nothing to do at php shutdown */ - PHP_RINIT(html_parse), /* Replace with NULL if there is nothing to do at request start */ - PHP_RSHUTDOWN(html_parse), /* Replace with NULL if there is nothing to do at request end */ + PHP_RINIT(html_parse), /* Replace with NULL if there is nothing to do at request start */ + PHP_RSHUTDOWN(html_parse), /* Replace with NULL if there is nothing to do at request end */ PHP_MINFO(html_parse), - "0.1", + "0.9", STANDARD_MODULE_PROPERTIES }; /* }}} */ @@ -182,23 +180,15 @@ #endif -/* {{{ globals and ini entries */ -/* }}} */ - - /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(html_parse) { - -le_html_parser = zend_register_list_destructors_ex(html_parser_dtor, - NULL, - "html_parser", - module_number); - + le_html_parser = zend_register_list_destructors_ex(html_parser_dtor, + NULL, "html_parser", module_number); /* add your stuff here */ - return SUCCESS; + return SUCCESS; } /* }}} */ @@ -209,7 +199,7 @@ /* add your stuff here */ - return SUCCESS; + return SUCCESS; } /* }}} */ @@ -217,7 +207,7 @@ /* {{{ PHP_RINIT_FUNCTION */ PHP_RINIT_FUNCTION(html_parse) { - /* add your stuff here */ + /* add your stuff here */ return SUCCESS; } @@ -227,7 +217,7 @@ /* {{{ PHP_RSHUTDOWN_FUNCTION */ PHP_RSHUTDOWN_FUNCTION(html_parse) { - /* add your stuff here */ + /* add your stuff here */ return SUCCESS; } @@ -238,10 +228,10 @@ PHP_MINFO_FUNCTION(html_parse) { php_info_print_box_start(0); - php_printf("<p>HTML parser extenion</p>\n"); - php_printf("<p>Version 0.1alpha (2003-05-20)</p>\n"); - php_printf("<p><b>Authors:</b></p>\n"); - php_printf("<p>Hartmut Holzgraefe <hartmut@php.net> (lead)</p>\n"); + php_printf("<p>HTML parser extenion</p>\n"); + php_printf("<p>Version 0.9beta (2006-02-20)</p>\n"); + php_printf("<p><b>Authors:</b></p>\n"); + php_printf("<p>Hartmut Holzgraefe <hartmut@php.net> (lead)</p>\n"); php_info_print_box_end(); /* add your stuff here */ @@ -249,222 +239,248 @@ /* }}} */ -/* {{{ proto resource html_parser html_parser_create(void ) +/* {{{ proto resource html_parser html_parser_create(void) create an HTML parser */ PHP_FUNCTION(html_parser_create) { - php_html_parser * return_res = (php_html_parser *)emalloc(sizeof(php_html_parser)); - if (ZEND_NUM_ARGS()>0) { WRONG_PARAM_COUNT; } - - { - return_res->parser = ekhtml_parser_new(return_res); - if(! return_res->parser) RETURN_FALSE; - /* initially no PHP callbacks are set */ - return_res->startElementHandler = NULL; - return_res->endElementHandler = NULL; - return_res->characterDataHandler = NULL; - return_res->commentHandler = NULL; - /* all C callbacks are set right away, whether a PHP callback - is set is tested within the C callback */ - ekhtml_parser_startcb_add(return_res->parser, NULL, _start_cb); - ekhtml_parser_endcb_add(return_res->parser, NULL, _end_cb); - ekhtml_parser_commentcb_set(return_res->parser, _comment_cb); - ekhtml_parser_datacb_set(return_res->parser, _data_cb); - ZEND_REGISTER_RESOURCE(return_value, return_res, le_html_parser); - } + php_html_parser * return_res = (php_html_parser *)ecalloc(1, sizeof(php_html_parser)); + if (ZEND_NUM_ARGS()>0) { + WRONG_PARAM_COUNT; + } + + do { +#line 216 "html_parse.xml" + return_res->parser = ekhtml_parser_new(return_res); + if(! return_res->parser) RETURN_FALSE; + + /* initially no PHP callbacks are set */ + return_res->startElementHandler = NULL; + return_res->endElementHandler = NULL; + return_res->characterDataHandler = NULL; + return_res->commentHandler = NULL; + + /* all C callbacks are set right away, whether a PHP callback + is set is tested within the C callback */ + ekhtml_parser_startcb_add(return_res->parser, NULL, _start_cb); + ekhtml_parser_endcb_add(return_res->parser, NULL, _end_cb); + ekhtml_parser_commentcb_set(return_res->parser, _comment_cb); + ekhtml_parser_datacb_set(return_res->parser, _data_cb); + + ZEND_REGISTER_RESOURCE(return_value, return_res, le_html_parser); + } while(0); + ZEND_REGISTER_RESOURCE(return_value, return_res, le_html_parser); } -/* }}} */ +/* }}} html_parser_create */ /* {{{ proto bool html_parser_free(resource html_parser parser) free an HTML parser */ PHP_FUNCTION(html_parser_free) { - zval * parser = NULL; - int parser_id = -1; - php_html_parser * res_parser; - int argc = ZEND_NUM_ARGS(); - - if (zend_parse_parameters(argc TSRMLS_CC, "r", &parser) == FAILURE) return; - - if (parser) { - ZEND_FETCH_RESOURCE(res_parser, php_html_parser *, &parser, parser_id, "html_parser", le_html_parser); - } - - { - zval_dtor(parser); - } + zval * parser_res = NULL; + int parser_resid = -1; + php_html_parser * parser; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r/", &parser_res) == FAILURE) { + return; + } + ZEND_FETCH_RESOURCE(parser, php_html_parser *, &parser_res, parser_resid, "html_parser", le_html_parser); + + + do { +#line 244 "html_parse.xml" + FREE_RESOURCE(parser_res); + } while(0); } -/* }}} */ +/* }}} html_parser_free */ /* {{{ proto bool html_parser_starttag_handler(resource html_parser parser, callback handler) set callback function for start tags */ PHP_FUNCTION(html_parser_starttag_handler) { - zval * parser = NULL; - int parser_id = -1; - php_html_parser * res_parser; - zval * handler = NULL; - int argc = ZEND_NUM_ARGS(); - - if (zend_parse_parameters(argc TSRMLS_CC, "rz", &parser, &handler) == FAILURE) return; - - if (parser) { - ZEND_FETCH_RESOURCE(res_parser, php_html_parser *, &parser, parser_id, "html_parser", le_html_parser); - } + zval * parser_res = NULL; + int parser_resid = -1; + php_html_parser * parser; + zval * handler = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r/z/", &parser_res, &handler) == FAILURE) { + return; + } + ZEND_FETCH_RESOURCE(parser, php_html_parser *, &parser_res, parser_resid, "html_parser", le_html_parser); + if (!zend_is_callable(handler, 0, NULL)) { + php_error(E_WARNING, "Invalid comparison function."); + return; } + + + do { +#line 256 "html_parse.xml" + /* parameter check */ + if (!zend_is_callable(handler, 0, NULL)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "2nd argument is not a valid callback"); + RETURN_FALSE; + } + + /* have previous? -> dispose */ + if(parser->startElementHandler) { + zval_ptr_dtor(&parser->startElementHandler); + } + + /* assign new callback handler */ + ALLOC_ZVAL(parser->startElementHandler); + *parser->startElementHandler = *handler; + zval_copy_ctor(parser->startElementHandler); - { - /* parameter check */ - if (!zend_is_callable(handler, 0, NULL)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "2nd argument is not a valid callback"); - RETURN_FALSE; - } - /* have previous? -> dispose */ - if(res_parser->startElementHandler) { - zval_ptr_dtor(&res_parser->startElementHandler); - } - /* assign new callback handler */ - ALLOC_ZVAL(res_parser->startElementHandler); - *res_parser->startElementHandler = *handler; - zval_copy_ctor(res_parser->startElementHandler); - RETURN_TRUE; - } + RETURN_TRUE; + } while(0); } -/* }}} */ +/* }}} html_parser_starttag_handler */ /* {{{ proto bool html_parser_endtag_handler(resource html_parser parser, callback handler) set callback function for end tags */ PHP_FUNCTION(html_parser_endtag_handler) { - zval * parser = NULL; - int parser_id = -1; - php_html_parser * res_parser; - zval * handler = NULL; - int argc = ZEND_NUM_ARGS(); - - if (zend_parse_parameters(argc TSRMLS_CC, "rz", &parser, &handler) == FAILURE) return; - - if (parser) { - ZEND_FETCH_RESOURCE(res_parser, php_html_parser *, &parser, parser_id, "html_parser", le_html_parser); - } - - { - if (!zend_is_callable(handler, 0, NULL)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "2nd argument is not a valid callback"); - RETURN_FALSE; - } - if(res_parser->endElementHandler) { - zval_ptr_dtor(&res_parser->endElementHandler); - } - ALLOC_ZVAL(res_parser->endElementHandler); - *res_parser->endElementHandler = *handler; - zval_copy_ctor(res_parser->endElementHandler); - RETURN_TRUE; - } + zval * parser_res = NULL; + int parser_resid = -1; + php_html_parser * parser; + zval * handler = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r/z/", &parser_res, &handler) == FAILURE) { + return; + } + ZEND_FETCH_RESOURCE(parser, php_html_parser *, &parser_res, parser_resid, "html_parser", le_html_parser); + if (!zend_is_callable(handler, 0, NULL)) { + php_error(E_WARNING, "Invalid comparison function."); + return; } + + + do { +#line 284 "html_parse.xml" + if (!zend_is_callable(handler, 0, NULL)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "2nd argument is not a valid callback"); + RETURN_FALSE; + } + if(parser->endElementHandler) { + zval_ptr_dtor(&parser->endElementHandler); + } + ALLOC_ZVAL(parser->endElementHandler); + *parser->endElementHandler = *handler; + zval_copy_ctor(parser->endElementHandler); + RETURN_TRUE; + } while(0); } -/* }}} */ +/* }}} html_parser_endtag_handler */ /* {{{ proto bool html_parser_data_handler(resource html_parser parser, callback handler) set callback function for character data */ PHP_FUNCTION(html_parser_data_handler) { - zval * parser = NULL; - int parser_id = -1; - php_html_parser * res_parser; - zval * handler = NULL; - int argc = ZEND_NUM_ARGS(); - - if (zend_parse_parameters(argc TSRMLS_CC, "rz", &parser, &handler) == FAILURE) return; - - if (parser) { - ZEND_FETCH_RESOURCE(res_parser, php_html_parser *, &parser, parser_id, "html_parser", le_html_parser); - } - - { - if (!zend_is_callable(handler, 0, NULL)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "2nd argument is not a valid callback"); - RETURN_FALSE; - } - if(res_parser->characterDataHandler) { - zval_ptr_dtor(&res_parser->characterDataHandler); - } - ALLOC_ZVAL(res_parser->characterDataHandler); - *res_parser->characterDataHandler = *handler; - zval_copy_ctor(res_parser->characterDataHandler); - RETURN_TRUE; - } + zval * parser_res = NULL; + int parser_resid = -1; + php_html_parser * parser; + zval * handler = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r/z/", &parser_res, &handler) == FAILURE) { + return; + } + ZEND_FETCH_RESOURCE(parser, php_html_parser *, &parser_res, parser_resid, "html_parser", le_html_parser); + if (!zend_is_callable(handler, 0, NULL)) { + php_error(E_WARNING, "Invalid comparison function."); + return; } + + + do { +#line 306 "html_parse.xml" + if (!zend_is_callable(handler, 0, NULL)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "2nd argument is not a valid callback"); + RETURN_FALSE; + } + if(parser->characterDataHandler) { + zval_ptr_dtor(&parser->characterDataHandler); + } + ALLOC_ZVAL(parser->characterDataHandler); + *parser->characterDataHandler = *handler; + zval_copy_ctor(parser->characterDataHandler); + RETURN_TRUE; + } while(0); } -/* }}} */ +/* }}} html_parser_data_handler */ /* {{{ proto bool html_parser_comment_handler(resource html_parser parser, callback handler) set callback function for HTML comments */ PHP_FUNCTION(html_parser_comment_handler) { - zval * parser = NULL; - int parser_id = -1; - php_html_parser * res_parser; - zval * handler = NULL; - int argc = ZEND_NUM_ARGS(); - - if (zend_parse_parameters(argc TSRMLS_CC, "rz", &parser, &handler) == FAILURE) return; - - if (parser) { - ZEND_FETCH_RESOURCE(res_parser, php_html_parser *, &parser, parser_id, "html_parser", le_html_parser); - } - - { - if (!zend_is_callable(handler, 0, NULL)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "2nd argument is not a valid callback"); - RETURN_FALSE; - } - if(res_parser->commentHandler) { - zval_ptr_dtor(&res_parser->commentHandler); - } - ALLOC_ZVAL(res_parser->commentHandler); - *res_parser->commentHandler = *handler; - zval_copy_ctor(res_parser->commentHandler); - RETURN_TRUE; - } + zval * parser_res = NULL; + int parser_resid = -1; + php_html_parser * parser; + zval * handler = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r/z/", &parser_res, &handler) == FAILURE) { + return; + } + ZEND_FETCH_RESOURCE(parser, php_html_parser *, &parser_res, parser_resid, "html_parser", le_html_parser); + if (!zend_is_callable(handler, 0, NULL)) { + php_error(E_WARNING, "Invalid comparison function."); + return; } + + + do { +#line 328 "html_parse.xml" + if (!zend_is_callable(handler, 0, NULL)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "2nd argument is not a valid callback"); + RETURN_FALSE; + } + if(parser->commentHandler) { + zval_ptr_dtor(&parser->commentHandler); + } + ALLOC_ZVAL(parser->commentHandler); + *parser->commentHandler = *handler; + zval_copy_ctor(parser->commentHandler); + RETURN_TRUE; + } while(0); } -/* }}} */ +/* }}} html_parser_comment_handler */ -/* {{{ proto bool html_parser_parse(resource html_parser parser, string &data [, bool finish]) +/* {{{ proto bool html_parser_parse(resource html_parser parser, string data [, bool finish]) feed input into parser */ PHP_FUNCTION(html_parser_parse) { - zval * parser = NULL; - int parser_id = -1; - php_html_parser * res_parser; - char * data = NULL; - int data_len = 0; - zend_bool finish = 0; - int argc = ZEND_NUM_ARGS(); - - if (zend_parse_parameters(argc TSRMLS_CC, "rs|b", &parser, &data, &data_len, &finish) == FAILURE) return; - - if (parser) { - ZEND_FETCH_RESOURCE(res_parser, php_html_parser *, &parser, parser_id, "html_parser", le_html_parser); - } - - { -{ - /* prepare input data as needed by ekhtml_parser_feed */ - ekhtml_string_t str; - str.str = data; - str.len = data_len; - /* feed data */ - ekhtml_parser_feed(res_parser->parser, &str); - /* request parsing of feeded data */ - ekhtml_parser_flush(res_parser->parser, finish); + zval * parser_res = NULL; + int parser_resid = -1; + php_html_parser * parser; + const char * data = NULL; + int data_len = 0; + zend_bool finish = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r/s/|b/", &parser_res, &data, &data_len, &finish) == FAILURE) { + return; + } + ZEND_FETCH_RESOURCE(parser, php_html_parser *, &parser_res, parser_resid, "html_parser", le_html_parser); + + + do { +#line 348 "html_parse.xml" + { + /* prepare input data as needed by ekhtml_parser_feed */ + ekhtml_string_t str; + str.str = data; + str.len = data_len; + + /* feed data */ + ekhtml_parser_feed(parser->parser, &str); + + /* request parsing of feeded data */ + ekhtml_parser_flush(parser->parser, finish); + } + } while(0); } - } -} -/* }}} */ +/* }}} html_parser_parse */ + +#endif /* HAVE_HTML_PARSE */ /* http://cvs.php.net/viewcvs.cgi/pecl/html_parse/html_parse.dsp?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/html_parse.dsp diff -u pecl/html_parse/html_parse.dsp:1.1 pecl/html_parse/html_parse.dsp:1.2 --- pecl/html_parse/html_parse.dsp:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/html_parse.dsp Mon Feb 20 18:33:16 2006 @@ -1,112 +1,112 @@ -# Microsoft Developer Studio Project File - Name="html_parse" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=html_parse - Win32 Debug_TS -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "html_parse.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "html_parse.mak" CFG="html_parse - Win32 Debug_TS" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "html_parse - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "html_parse - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "html_parse - Win32 Release_TS" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release_TS" -# PROP BASE Intermediate_Dir "Release_TS" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release_TS" -# PROP Intermediate_Dir "Release_TS" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HTML_PARSE_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_HTML_PARSE" /D ZTS=1 /D HAVE_HTML_PARSE=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x407 /d "NDEBUG" -# ADD RSC /l 0x407 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ekhtml.lib /nologo /dll /machine:I386 -# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ekhtml.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS\php_html_parse.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" - -!ELSEIF "$(CFG)" == "html_parse - Win32 Debug_TS" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug_TS" -# PROP BASE Intermediate_Dir "Debug_TS" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug_TS" -# PROP Intermediate_Dir "Debug_TS" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HTML_PARSE_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_HTML_PARSE" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_HTML_PARSE=1 /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x407 /d "_DEBUG" -# ADD RSC /l 0x407 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ekhtml.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ekhtml.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS\php_html_parse.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" - -!ENDIF - -# Begin Target - -# Name "html_parse - Win32 Release_TS" -# Name "html_parse - Win32 Debug_TS" - -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" - -# Begin Source File - -SOURCE=.\html_parse.c -# End Source File - -# End Group - -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" - -# Begin Source File - -SOURCE=.\php_html_parse.h -# End Source File -# End Group -# End Target -# End Project +# Microsoft Developer Studio Project File - Name="html_parse" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=html_parse - Win32 Debug_TS +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "html_parse.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "html_parse.mak" CFG="html_parse - Win32 Debug_TS" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "html_parse - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "html_parse - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "html_parse - Win32 Release_TS" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release_TS" +# PROP BASE Intermediate_Dir "Release_TS" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release_TS" +# PROP Intermediate_Dir "Release_TS" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HTML_PARSE_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_HTML_PARSE" /D ZTS=1 /D HAVE_HTML_PARSE=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x407 /d "NDEBUG" +# ADD RSC /l 0x407 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ekhtml.lib /nologo /dll /machine:I386 +# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ekhtml.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS\php_html_parse.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" + +!ELSEIF "$(CFG)" == "html_parse - Win32 Debug_TS" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug_TS" +# PROP BASE Intermediate_Dir "Debug_TS" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug_TS" +# PROP Intermediate_Dir "Debug_TS" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HTML_PARSE_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_HTML_PARSE" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_HTML_PARSE=1 /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x407 /d "_DEBUG" +# ADD RSC /l 0x407 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ekhtml.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ekhtml.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS\php_html_parse.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" + +!ENDIF + +# Begin Target + +# Name "html_parse - Win32 Release_TS" +# Name "html_parse - Win32 Debug_TS" + +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" + +# Begin Source File + +SOURCE=./html_parse.c +# End Source File + +# End Group + +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" + +# Begin Source File + +SOURCE=.\php_html_parse.h +# End Source File +# End Group +# End Target +# End Project http://cvs.php.net/viewcvs.cgi/pecl/html_parse/package.xml?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/package.xml diff -u pecl/html_parse/package.xml:1.1 pecl/html_parse/package.xml:1.2 --- pecl/html_parse/package.xml:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/package.xml Mon Feb 20 18:33:16 2006 @@ -1,6 +1,7 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE package SYSTEM "../../package.dtd"> +<?xml version="1.0"?> +<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> <package> + <name>html_parse</name> <summary>HTML parser extenion</summary> <description> @@ -8,10 +9,10 @@ (http://ekhtml.sourceforge.net/) </description> - <license>PHP License</license> + <license>PHP</license> <configureoptions> - <configureoption name="with-html_parse" default="shared" prompt="ekhtml installation directory?"/> + <configureoption name="with-ekhtml" default="autodetect" prompt="ekhtml installation directory?" /> </configureoptions> <maintainers> @@ -24,22 +25,46 @@ </maintainers> <release> - <version>0.1</version> - <date>2003-05-20</date> - <state>alpha</state> - <notes>- first experimental draft</notes> + <version>0.9</version> + <state>beta</state> + <notes> - preparing for 1.0.0 release +</notes> + <date>2006-02-20</date> </release> + <changelog> + <release> + <version>0.1</version> + <date>2002-02-28</date> + <state>alpha</state> + <license>php</license> + <notes> + - first experimental draft + </notes> + </release> + + </changelog> + <deps> + <dep type="php" rel="ge" version="4.0.0"/> + </deps> <filelist> - <dir role="doc" name="/"> - <file role="doc">LICENSE</file> - <file role="doc">EXPERIMENTAL</file> - <file role="doc">CREDITS</file> - <file role="src">config.m4</file> - <file role="src">html_parse.dsp</file> - <file role="src">html_parse.c</file> - <file role="src">php_html_parse.h</file> + <dir name="/"> + <file role='doc' name='EXPERIMENTAL'/> + <file role='doc' name='CREDITS'/> + <file role='src' name='config.m4'/> + <file role='src' name='html_parse.dsp'/> + <file role='src' name='config.w32'/> + <file role='src' name='html_parse.c'/> + <file role='src' name='php_html_parse.h'/> + <dir name="tests"> + <file role='test' name='html_parser_create.phpt'/> + <file role='test' name='html_parser_free.phpt'/> + <file role='test' name='html_parser_starttag_handler.phpt'/> + <file role='test' name='html_parser_endtag_handler.phpt'/> + <file role='test' name='html_parser_data_handler.phpt'/> + <file role='test' name='html_parser_comment_handler.phpt'/> + <file role='test' name='html_parser_parse.phpt'/> + </dir> </dir> </filelist> - </package> http://cvs.php.net/viewcvs.cgi/pecl/html_parse/php_html_parse.h?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/php_html_parse.h diff -u pecl/html_parse/php_html_parse.h:1.1 pecl/html_parse/php_html_parse.h:1.2 --- pecl/html_parse/php_html_parse.h:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/php_html_parse.h Mon Feb 20 18:33:16 2006 @@ -2,13 +2,13 @@ +----------------------------------------------------------------------+ | This source file is subject to version 3.0 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_0.txt. | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Hartmut Holzgraefe <hartmut@php.net> | + | Authors: Hartmut Holzgraefe <hartmut@php.net> | +----------------------------------------------------------------------+ */ @@ -17,29 +17,28 @@ #ifndef PHP_HTML_PARSE_H #define PHP_HTML_PARSE_H +#ifdef __cplusplus +extern "C" { +#endif #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include <php.h> + #ifdef HAVE_HTML_PARSE -#include <php.h> #include <php_ini.h> #include <SAPI.h> #include <ext/standard/info.h> - -#include <ekhtml.h> -/* resource payload for html_parse resources */ -typedef struct { - /* HTML parser */ - ekhtml_parser_t *parser; - /* callback functions */ - zval *startElementHandler; - zval *endElementHandler; - zval *characterDataHandler; - zval *commentHandler; -} php_html_parser; +#include <Zend/zend_extensions.h> +#ifdef __cplusplus +} // extern "C" +#endif +#ifdef __cplusplus +extern "C" { +#endif extern zend_module_entry html_parse_module_entry; #define phpext_html_parse_ptr &html_parse_module_entry @@ -60,14 +59,66 @@ #include "TSRM.h" #endif +#define FREE_RESOURCE(resource) zend_list_delete(Z_LVAL_P(resource)) + +#define PROP_GET_LONG(name) Z_LVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_SET_LONG(name, l) zend_update_property_long(_this_ce, _this_zval, #name, strlen(#name), l TSRMLS_CC) + +#define PROP_GET_DOUBLE(name) Z_DVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_SET_DOUBLE(name, d) zend_update_property_double(_this_ce, _this_zval, #name, strlen(#name), d TSRMLS_CC) + +#define PROP_GET_STRING(name) Z_STRVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_GET_STRLEN(name) Z_STRLEN_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_SET_STRING(name, s) zend_update_property_string(_this_ce, _this_zval, #name, strlen(#name), s TSRMLS_CC) +#define PROP_SET_STRINGL(name, s, l) zend_update_property_string(_this_ce, _this_zval, #name, strlen(#name), s, l TSRMLS_CC) + PHP_FUNCTION(html_parser_create); PHP_FUNCTION(html_parser_free); PHP_FUNCTION(html_parser_starttag_handler); +ZEND_BEGIN_ARG_INFO(html_parser_starttag_handler_args, 0) + ZEND_ARG_INFO(0, handler) +ZEND_END_ARG_INFO() PHP_FUNCTION(html_parser_endtag_handler); +ZEND_BEGIN_ARG_INFO(html_parser_endtag_handler_args, 0) + ZEND_ARG_INFO(0, handler) +ZEND_END_ARG_INFO() PHP_FUNCTION(html_parser_data_handler); +ZEND_BEGIN_ARG_INFO(html_parser_data_handler_args, 0) + ZEND_ARG_INFO(0, handler) +ZEND_END_ARG_INFO() PHP_FUNCTION(html_parser_comment_handler); +ZEND_BEGIN_ARG_INFO(html_parser_comment_handler_args, 0) + ZEND_ARG_INFO(0, handler) +ZEND_END_ARG_INFO() PHP_FUNCTION(html_parser_parse); +ZEND_BEGIN_ARG_INFO(html_parser_parse_args, 0) + ZEND_ARG_INFO(0, data) + ZEND_ARG_INFO(0, finish) +ZEND_END_ARG_INFO() +#ifdef __cplusplus +} // extern "C" +#endif + +/* 'bottom' header snippets*/ +#include <ekhtml.h> + +/* resource payload for html_parse resources */ +typedef struct { + /* HTML parser */ + ekhtml_parser_t *parser; + + /* callback functions */ + zval *startElementHandler; + zval *endElementHandler; + zval *characterDataHandler; + zval *commentHandler; +} php_html_parser; + +static void _start_cb(void *data, ekhtml_string_t *tag, ekhtml_attr_t *attrs); +static void _end_cb(void *data, ekhtml_string_t *tag); +static void _comment_cb(void *data, ekhtml_string_t *comment); +static void _data_cb(void *data, ekhtml_string_t *characterData); #endif /* PHP_HAVE_HTML_PARSE */ http://cvs.php.net/viewcvs.cgi/pecl/html_parse/manual/html-parse/configure.xml?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/manual/html-parse/configure.xml diff -u pecl/html_parse/manual/html-parse/configure.xml:1.1 pecl/html_parse/manual/html-parse/configure.xml:1.2 --- pecl/html_parse/manual/html-parse/configure.xml:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/manual/html-parse/configure.xml Mon Feb 20 18:33:16 2006 @@ -9,9 +9,6 @@ <section id='html-parse.install'> &reftitle.install; - <para> -foobar install - </para> </section> http://cvs.php.net/viewcvs.cgi/pecl/html_parse/manual/html-parse/reference.xml?r1=1.2&r2=1.3&diff_format=u Index: pecl/html_parse/manual/html-parse/reference.xml diff -u pecl/html_parse/manual/html-parse/reference.xml:1.2 pecl/html_parse/manual/html-parse/reference.xml:1.3 --- pecl/html_parse/manual/html-parse/reference.xml:1.2 Wed Apr 6 06:30:03 2005 +++ pecl/html_parse/manual/html-parse/reference.xml Mon Feb 20 18:33:16 2006 @@ -1,5 +1,5 @@ <?xml version='1.0' encoding='iso-8859-1'?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <reference id='ref.html-parse'> <title>HTML parser extenion</title> <titleabbrev>html-parse</titleabbrev> @@ -19,10 +19,10 @@ <section id='html-parse.resources'> &reftitle.resources; - <section id='html_parse.resources.html_parser'> + <section id='html-parse.resources.html_parser'> <title><literal>html_parser</literal></title> <para> - HTML parser resource + HTML parser resource </para> </section> http://cvs.php.net/viewcvs.cgi/pecl/html_parse/manual/html-parse/functions/html-parser-comment-handler.xml?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/manual/html-parse/functions/html-parser-comment-handler.xml diff -u pecl/html_parse/manual/html-parse/functions/html-parser-comment-handler.xml:1.1 pecl/html_parse/manual/html-parse/functions/html-parser-comment-handler.xml:1.2 --- pecl/html_parse/manual/html-parse/functions/html-parser-comment-handler.xml:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/manual/html-parse/functions/html-parser-comment-handler.xml Mon Feb 20 18:33:16 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.html-parser-comment-handler"> <refnamediv> <refname>html_parser_comment_handler</refname> @@ -13,7 +13,7 @@ <methodparam><type>callback</type><parameter>handler</parameter></methodparam> </methodsynopsis> <para> - </para> + </para> </refsect1> </refentry> http://cvs.php.net/viewcvs.cgi/pecl/html_parse/manual/html-parse/functions/html-parser-create.xml?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/manual/html-parse/functions/html-parser-create.xml diff -u pecl/html_parse/manual/html-parse/functions/html-parser-create.xml:1.1 pecl/html_parse/manual/html-parse/functions/html-parser-create.xml:1.2 --- pecl/html_parse/manual/html-parse/functions/html-parser-create.xml:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/manual/html-parse/functions/html-parser-create.xml Mon Feb 20 18:33:16 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.html-parser-create"> <refnamediv> <refname>html_parser_create</refname> http://cvs.php.net/viewcvs.cgi/pecl/html_parse/manual/html-parse/functions/html-parser-data-handler.xml?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/manual/html-parse/functions/html-parser-data-handler.xml diff -u pecl/html_parse/manual/html-parse/functions/html-parser-data-handler.xml:1.1 pecl/html_parse/manual/html-parse/functions/html-parser-data-handler.xml:1.2 --- pecl/html_parse/manual/html-parse/functions/html-parser-data-handler.xml:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/manual/html-parse/functions/html-parser-data-handler.xml Mon Feb 20 18:33:16 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.html-parser-data-handler"> <refnamediv> <refname>html_parser_data_handler</refname> @@ -13,7 +13,7 @@ <methodparam><type>callback</type><parameter>handler</parameter></methodparam> </methodsynopsis> <para> - </para> + </para> </refsect1> </refentry> http://cvs.php.net/viewcvs.cgi/pecl/html_parse/manual/html-parse/functions/html-parser-endtag-handler.xml?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/manual/html-parse/functions/html-parser-endtag-handler.xml diff -u pecl/html_parse/manual/html-parse/functions/html-parser-endtag-handler.xml:1.1 pecl/html_parse/manual/html-parse/functions/html-parser-endtag-handler.xml:1.2 --- pecl/html_parse/manual/html-parse/functions/html-parser-endtag-handler.xml:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/manual/html-parse/functions/html-parser-endtag-handler.xml Mon Feb 20 18:33:16 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.html-parser-endtag-handler"> <refnamediv> <refname>html_parser_endtag_handler</refname> @@ -13,7 +13,7 @@ <methodparam><type>callback</type><parameter>handler</parameter></methodparam> </methodsynopsis> <para> - </para> + </para> </refsect1> </refentry> http://cvs.php.net/viewcvs.cgi/pecl/html_parse/manual/html-parse/functions/html-parser-free.xml?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/manual/html-parse/functions/html-parser-free.xml diff -u pecl/html_parse/manual/html-parse/functions/html-parser-free.xml:1.1 pecl/html_parse/manual/html-parse/functions/html-parser-free.xml:1.2 --- pecl/html_parse/manual/html-parse/functions/html-parser-free.xml:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/manual/html-parse/functions/html-parser-free.xml Mon Feb 20 18:33:16 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.html-parser-free"> <refnamediv> <refname>html_parser_free</refname> @@ -12,7 +12,7 @@ <methodparam><type>resource</type><parameter>parser</parameter></methodparam> </methodsynopsis> <para> - </para> + </para> </refsect1> </refentry> http://cvs.php.net/viewcvs.cgi/pecl/html_parse/manual/html-parse/functions/html-parser-parse.xml?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/manual/html-parse/functions/html-parser-parse.xml diff -u pecl/html_parse/manual/html-parse/functions/html-parser-parse.xml:1.1 pecl/html_parse/manual/html-parse/functions/html-parser-parse.xml:1.2 --- pecl/html_parse/manual/html-parse/functions/html-parser-parse.xml:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/manual/html-parse/functions/html-parser-parse.xml Mon Feb 20 18:33:16 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.html-parser-parse"> <refnamediv> <refname>html_parser_parse</refname> @@ -10,11 +10,11 @@ <methodsynopsis> <type>bool</type><methodname>html_parser_parse</methodname> <methodparam><type>resource</type><parameter>parser</parameter></methodparam> - <methodparam><type>string</type><parameter>&data</parameter></methodparam> + <methodparam><type>string</type><parameter>data</parameter></methodparam> <methodparam choice='opt'><type>bool</type><parameter>finish</parameter></methodparam> </methodsynopsis> <para> -&warn.undocumented.func; </para> + </para> </refsect1> </refentry> http://cvs.php.net/viewcvs.cgi/pecl/html_parse/manual/html-parse/functions/html-parser-starttag-handler.xml?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/manual/html-parse/functions/html-parser-starttag-handler.xml diff -u pecl/html_parse/manual/html-parse/functions/html-parser-starttag-handler.xml:1.1 pecl/html_parse/manual/html-parse/functions/html-parser-starttag-handler.xml:1.2 --- pecl/html_parse/manual/html-parse/functions/html-parser-starttag-handler.xml:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/manual/html-parse/functions/html-parser-starttag-handler.xml Mon Feb 20 18:33:16 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.html-parser-starttag-handler"> <refnamediv> <refname>html_parser_starttag_handler</refname> @@ -13,7 +13,7 @@ <methodparam><type>callback</type><parameter>handler</parameter></methodparam> </methodsynopsis> <para> - </para> + </para> </refsect1> </refentry> http://cvs.php.net/viewcvs.cgi/pecl/html_parse/tests/html_parser_comment_handler.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/tests/html_parser_comment_handler.phpt diff -u pecl/html_parse/tests/html_parser_comment_handler.phpt:1.1 pecl/html_parse/tests/html_parser_comment_handler.phpt:1.2 --- pecl/html_parse/tests/html_parser_comment_handler.phpt:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/tests/html_parser_comment_handler.phpt Mon Feb 20 18:33:16 2006 @@ -1,12 +1,14 @@ --TEST-- html_parser_comment_handler() function --SKIPIF-- -<?php if (!extension_loaded('html_parse')) print 'skip'; ?> ---POST-- ---GET-- ---FILE-- <?php - echo 'no test case for html_parser_comment_handler() yet'; + +if(!extension_loaded('html_parse')) die('skip'); + + ?> +--FILE-- +<?php +echo 'OK'; // no test case for this function yet ?> --EXPECT-- -no test case for html_parser_comment_handler() yet \ No newline at end of file +OK \ No newline at end of file http://cvs.php.net/viewcvs.cgi/pecl/html_parse/tests/html_parser_create.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/tests/html_parser_create.phpt diff -u pecl/html_parse/tests/html_parser_create.phpt:1.1 pecl/html_parse/tests/html_parser_create.phpt:1.2 --- pecl/html_parse/tests/html_parser_create.phpt:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/tests/html_parser_create.phpt Mon Feb 20 18:33:16 2006 @@ -1,12 +1,14 @@ --TEST-- html_parser_create() function --SKIPIF-- -<?php if (!extension_loaded('html_parse')) print 'skip'; ?> ---POST-- ---GET-- ---FILE-- <?php - echo 'no test case for html_parser_create() yet'; + +if(!extension_loaded('html_parse')) die('skip'); + + ?> +--FILE-- +<?php +echo 'OK'; // no test case for this function yet ?> --EXPECT-- -no test case for html_parser_create() yet \ No newline at end of file +OK \ No newline at end of file http://cvs.php.net/viewcvs.cgi/pecl/html_parse/tests/html_parser_data_handler.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/tests/html_parser_data_handler.phpt diff -u pecl/html_parse/tests/html_parser_data_handler.phpt:1.1 pecl/html_parse/tests/html_parser_data_handler.phpt:1.2 --- pecl/html_parse/tests/html_parser_data_handler.phpt:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/tests/html_parser_data_handler.phpt Mon Feb 20 18:33:16 2006 @@ -1,12 +1,14 @@ --TEST-- html_parser_data_handler() function --SKIPIF-- -<?php if (!extension_loaded('html_parse')) print 'skip'; ?> ---POST-- ---GET-- ---FILE-- <?php - echo 'no test case for html_parser_data_handler() yet'; + +if(!extension_loaded('html_parse')) die('skip'); + + ?> +--FILE-- +<?php +echo 'OK'; // no test case for this function yet ?> --EXPECT-- -no test case for html_parser_data_handler() yet \ No newline at end of file +OK \ No newline at end of file http://cvs.php.net/viewcvs.cgi/pecl/html_parse/tests/html_parser_endtag_handler.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/tests/html_parser_endtag_handler.phpt diff -u pecl/html_parse/tests/html_parser_endtag_handler.phpt:1.1 pecl/html_parse/tests/html_parser_endtag_handler.phpt:1.2 --- pecl/html_parse/tests/html_parser_endtag_handler.phpt:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/tests/html_parser_endtag_handler.phpt Mon Feb 20 18:33:16 2006 @@ -1,12 +1,14 @@ --TEST-- html_parser_endtag_handler() function --SKIPIF-- -<?php if (!extension_loaded('html_parse')) print 'skip'; ?> ---POST-- ---GET-- ---FILE-- <?php - echo 'no test case for html_parser_endtag_handler() yet'; + +if(!extension_loaded('html_parse')) die('skip'); + + ?> +--FILE-- +<?php +echo 'OK'; // no test case for this function yet ?> --EXPECT-- -no test case for html_parser_endtag_handler() yet \ No newline at end of file +OK \ No newline at end of file http://cvs.php.net/viewcvs.cgi/pecl/html_parse/tests/html_parser_free.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/tests/html_parser_free.phpt diff -u pecl/html_parse/tests/html_parser_free.phpt:1.1 pecl/html_parse/tests/html_parser_free.phpt:1.2 --- pecl/html_parse/tests/html_parser_free.phpt:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/tests/html_parser_free.phpt Mon Feb 20 18:33:16 2006 @@ -1,12 +1,14 @@ --TEST-- html_parser_free() function --SKIPIF-- -<?php if (!extension_loaded('html_parse')) print 'skip'; ?> ---POST-- ---GET-- ---FILE-- <?php - echo 'no test case for html_parser_free() yet'; + +if(!extension_loaded('html_parse')) die('skip'); + + ?> +--FILE-- +<?php +echo 'OK'; // no test case for this function yet ?> --EXPECT-- -no test case for html_parser_free() yet \ No newline at end of file +OK \ No newline at end of file http://cvs.php.net/viewcvs.cgi/pecl/html_parse/tests/html_parser_parse.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/tests/html_parser_parse.phpt diff -u pecl/html_parse/tests/html_parser_parse.phpt:1.1 pecl/html_parse/tests/html_parser_parse.phpt:1.2 --- pecl/html_parse/tests/html_parser_parse.phpt:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/tests/html_parser_parse.phpt Mon Feb 20 18:33:16 2006 @@ -1,12 +1,14 @@ --TEST-- html_parser_parse() function --SKIPIF-- -<?php if (!extension_loaded('html_parse')) print 'skip'; ?> ---POST-- ---GET-- ---FILE-- <?php - echo 'no test case for html_parser_parse() yet'; + +if(!extension_loaded('html_parse')) die('skip'); + + ?> +--FILE-- +<?php +echo 'OK'; // no test case for this function yet ?> --EXPECT-- -no test case for html_parser_parse() yet \ No newline at end of file +OK \ No newline at end of file http://cvs.php.net/viewcvs.cgi/pecl/html_parse/tests/html_parser_starttag_handler.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/tests/html_parser_starttag_handler.phpt diff -u pecl/html_parse/tests/html_parser_starttag_handler.phpt:1.1 pecl/html_parse/tests/html_parser_starttag_handler.phpt:1.2 --- pecl/html_parse/tests/html_parser_starttag_handler.phpt:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/tests/html_parser_starttag_handler.phpt Mon Feb 20 18:33:16 2006 @@ -1,12 +1,14 @@ --TEST-- html_parser_starttag_handler() function --SKIPIF-- -<?php if (!extension_loaded('html_parse')) print 'skip'; ?> ---POST-- ---GET-- ---FILE-- <?php - echo 'no test case for html_parser_starttag_handler() yet'; + +if(!extension_loaded('html_parse')) die('skip'); + + ?> +--FILE-- +<?php +echo 'OK'; // no test case for this function yet ?> --EXPECT-- -no test case for html_parser_starttag_handler() yet \ No newline at end of file +OK \ No newline at end of file http://cvs.php.net/viewcvs.cgi/pecl/html_parse/.cvsignore?view=markup&rev=1.1 Index: pecl/html_parse/.cvsignore +++ pecl/html_parse/.cvsignore *.lo *.la..deps..libs Makefile Makefile.fragments Makefile.global Makefile.objects acinclude.m4 aclocal.m4 autom4te.cache build config.cache config.guess config.h config.h.in config.log config.nice config.status config.sub configure configure.in conftest conftest.c include install-sh libtool ltmain.sh missing mkinstalldirs modules scan_makefile_in.awk *.dsw *.plg *.opt *.ncb Release Release_inline Debug Release_TS Release_TSDbg Release_TS_inline Debug_TS html_parse*.tgz http://cvs.php.net/viewcvs.cgi/pecl/html_parse/config.w32?view=markup&rev=1.1 Index: pecl/html_parse/config.w32 +++ pecl/html_parse/config.w32 // $ Id: $ // vim:ft=javascript ARG_ENABLE('html_parse' , 'HTML parser extenion', 'no'); if (PHP_HTML_PARSE == "yes") { if (!CHECK_LIB("ekhtml.lib", "html_parse", PHP_HTML_PARSE)) { ERROR("html_parse: library 'ekhtml' not found"); } EXTENSION("html_parse", "html_parse.c"); AC_DEFINE("HAVE_HTML_PARSE", 1, "html_parse support"); } http://cvs.php.net/viewcvs.cgi/pecl/html_parse/package2.xml?view=markup&rev=1.1 Index: pecl/html_parse/package2.xml +++ pecl/html_parse/package2.xml <?xml version="1.0"?> <package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> <name>html_parse</name> <channel>pecl.php.net</channel> <summary>HTML parser extenion</summary> <description> HTML parser extension based on the ekhtml library (http://ekhtml.sourceforge.net/) </description> <lead> <name>Hartmut Holzgraefe</name> <user>hholzgra</user> <email>hartmut@php.net</email> <active>yes</active> </lead> <date>2006-02-20</date> <version> <release>0.9</release> <api>0.9</api> </version> <stability> <release>beta</release> <api>beta</api> </stability> <license uri="http://php.net/license" filesource="LICENSE">PHP</license> <notes> - preparing for 1.0.0 release </notes> <contents> <dir name="/"> <file role='doc' name='EXPERIMENTAL'/> <file role='doc' name='CREDITS'/> <file role='src' name='config.m4'/> <file role='src' name='html_parse.dsp'/> <file role='src' name='config.w32'/> <file role='src' name='html_parse.c'/> <file role='src' name='php_html_parse.h'/> <dir name="tests"> <file role='test' name='html_parser_create.phpt'/> <file role='test' name='html_parser_free.phpt'/> <file role='test' name='html_parser_starttag_handler.phpt'/> <file role='test' name='html_parser_endtag_handler.phpt'/> <file role='test' name='html_parser_data_handler.phpt'/> <file role='test' name='html_parser_comment_handler.phpt'/> <file role='test' name='html_parser_parse.phpt'/> </dir> </dir> </contents> <dependencies> <required> <php> <min>4.0.0</min> </php> <pearinstaller> <min>1.4.0a1</min> </pearinstaller> </required> </dependencies> <providesextension>html_parse</providesextension> <extsrcrelease> <configureoption name="with-ekhtml" default="autodetect" prompt="ekhtml installation directory?" /> </extsrcrelease> </package>