cvs: pecl /html_parse html_parse.xml
| From: | Hartmut Holzgraefe | Date: | Mon, 20 Feb 2006 18:32:33 +0000 |
| Subject: | cvs: pecl /html_parse html_parse.xml | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-5221@lists.php.net to get a copy of this message | ||
hholzgra Mon Feb 20 18:32:33 2006 UTC
Modified files:
/pecl/html_parse html_parse.xml
Log:
spec file update
http://cvs.php.net/viewcvs.cgi/pecl/html_parse/html_parse.xml?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/html_parse.xml diff -u pecl/html_parse/html_parse.xml:1.1 pecl/html_parse/html_parse.xml:1.2 --- pecl/html_parse/html_parse.xml:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/html_parse.xml Mon Feb 20 18:32:33 2006 @@ -9,87 +9,80 @@ directory ... --> -<extension> - <name>html_parse</name> +<extension name="html_parse" version="1.0.0"> <summary>HTML parser extenion</summary> <description> HTML parser extension based on the ekhtml library (http://ekhtml.sourceforge.net/) </description> - + <maintainers> - <maintainer> - <user>hholzgra</user> - <name>Hartmut Holzgraefe</name> - <email>hartmut@php.net</email> - <role>lead</role> - </maintainer> + <maintainer> + <user>hholzgra</user> + <name>Hartmut Holzgraefe</name> + <email>hartmut@php.net</email> + <role>lead</role> + </maintainer> </maintainers> - + <release> - <version>0.1</version> - <date>2002-02-28</date> - <state>alpha</state> + <version>0.9</version> + <date>2006-02-20</date> + <state>beta</state> <license>php</license> <notes> - - first experimental draft + - preparing for 1.0.0 release </notes> </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 language="c"> - <with defaults='/usr:/usr/local' testfile='include/ekhtml.h'>foobar install</with> + <deps language="c"> + <with name="ekhtml" defaults='/usr:/usr/local' testfile='include/ekhtml.h'>foobar install</with> <lib name='ekhtml' function='ekhtml_parser_new'></lib> </deps> - <constants> - </constants> + <code role='header'> +<![CDATA[ +#include <ekhtml.h> - <globals> - </globals> +/* resource payload for html_parse resources */ +typedef struct { + /* HTML parser */ + ekhtml_parser_t *parser; - <resources> - <resource name="html_parser" payload="php_html_parser" alloc="yes"> - <description> - HTML parser resource - </description> - <destruct> -<![CDATA[ - /* destroy HTML parser */ - if(resource->parser) { - ekhtml_parser_destroy(resource->parser); - } + /* callback functions */ + zval *startElementHandler; + zval *endElementHandler; + zval *characterDataHandler; + zval *commentHandler; +} php_html_parser; - /* destruct any set callback handlers */ - if (resource->startElementHandler) { - zval_ptr_dtor(&resource->startElementHandler); - } - if (resource->endElementHandler) { - zval_ptr_dtor(&resource->endElementHandler); - } - if (resource->characterDataHandler) { - zval_ptr_dtor(&resource->characterDataHandler); - } - if (resource->commentHandler) { - zval_ptr_dtor(&resource->commentHandler); - } +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); ]]> - </destruct> - </resource> - </resources> - - <functions> - <function role='private' name='_start_cb'> - <code> + </code> + + <code position="top"> <![CDATA[ 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(); + zval *cb_retval, *cb_tag, *cb_array; + zval **cb_args[2]; + TSRMLS_FETCH(); if (parser->startElementHandler) { /* create zval string parameter for tag name */ @@ -122,95 +115,104 @@ 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); + 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); + zval_ptr_dtor(&cb_tag); + zval_ptr_dtor(&cb_array); } } -]]> - </code> - </function> - <function role='private' name='_end_cb'> - <code> -<![CDATA[ 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(); + 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); + 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); + zval_ptr_dtor(&cb_tag); } } -]]> - </code> - </function> - <function role='private' name='_comment_cb'> - <code> -<![CDATA[ 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(); + 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); + 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); + zval_ptr_dtor(&cb_comment); } } -]]> - </code> - </function> - - <function role='private' name='_data_cb'> - <code> -<![CDATA[ + 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(); + 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); + 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); + zval_ptr_dtor(&cb_data); } } -]]> - </code> - </function> - - <function role='public' name='html_parser_create'> - <summary>create an HTML parser</summary> - <proto>resource html_parser html_parser_create(void)</proto> - <description> +]]> + </code> + + <resource name="html_parser" payload="php_html_parser" alloc="yes"> + <description> + HTML parser resource + </description> + <destruct> +<![CDATA[ + /* destroy HTML parser */ + if(resource->parser) { + ekhtml_parser_destroy(resource->parser); + } + + /* destruct any set callback handlers */ + if (resource->startElementHandler) { + zval_ptr_dtor(&resource->startElementHandler); + } + if (resource->endElementHandler) { + zval_ptr_dtor(&resource->endElementHandler); + } + if (resource->characterDataHandler) { + zval_ptr_dtor(&resource->characterDataHandler); + } + if (resource->commentHandler) { + zval_ptr_dtor(&resource->commentHandler); + } +]]> + </destruct> + </resource> + + <function role='public' name='html_parser_create'> + <summary>create an HTML parser</summary> + <proto>resource html_parser html_parser_create(void)</proto> + <description> foobar - </description> - <code> + </description> + <code> <![CDATA[ return_res->parser = ekhtml_parser_new(return_res); if(! return_res->parser) RETURN_FALSE; @@ -230,27 +232,27 @@ ZEND_REGISTER_RESOURCE(return_value, return_res, le_html_parser); ]]> - </code> - </function> - - <function role='public' name='html_parser_free'> - <summary>free an HTML parser</summary> - <proto>bool html_parser_free(resource html_parser parser)</proto> - <description> - </description> - <code> + </code> + </function> + + <function role='public' name='html_parser_free'> + <summary>free an HTML parser</summary> + <proto>bool html_parser_free(resource html_parser parser)</proto> + <description> + </description> + <code> <![CDATA[ - zval_dtor(parser); + FREE_RESOURCE(parser_res); ]]> - </code> - </function> + </code> + </function> - <function role='public' name='html_parser_starttag_handler'> - <summary>set callback function for start tags</summary> - <proto>bool html_parser_starttag_handler(resource html_parser parser, callback handler)</proto> - <description> - </description> - <code> + <function role='public' name='html_parser_starttag_handler'> + <summary>set callback function for start tags</summary> + <proto>bool html_parser_starttag_handler(resource html_parser parser, callback handler)</proto> + <description> + </description> + <code> <![CDATA[ /* parameter check */ if (!zend_is_callable(handler, 0, NULL)) { @@ -259,90 +261,90 @@ } /* have previous? -> dispose */ - if(res_parser->startElementHandler) { - zval_ptr_dtor(&res_parser->startElementHandler); + if(parser->startElementHandler) { + zval_ptr_dtor(&parser->startElementHandler); } /* assign new callback handler */ - ALLOC_ZVAL(res_parser->startElementHandler); - *res_parser->startElementHandler = *handler; - zval_copy_ctor(res_parser->startElementHandler); + ALLOC_ZVAL(parser->startElementHandler); + *parser->startElementHandler = *handler; + zval_copy_ctor(parser->startElementHandler); RETURN_TRUE; ]]> - </code> - </function> + </code> + </function> - <function role='public' name='html_parser_endtag_handler'> - <summary>set callback function for end tags</summary> - <proto>bool html_parser_endtag_handler(resource html_parser parser, callback handler)</proto> - <description> - </description> - <code> + <function role='public' name='html_parser_endtag_handler'> + <summary>set callback function for end tags</summary> + <proto>bool html_parser_endtag_handler(resource html_parser parser, callback handler)</proto> + <description> + </description> + <code> <![CDATA[ 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); + if(parser->endElementHandler) { + zval_ptr_dtor(&parser->endElementHandler); } - ALLOC_ZVAL(res_parser->endElementHandler); - *res_parser->endElementHandler = *handler; - zval_copy_ctor(res_parser->endElementHandler); + ALLOC_ZVAL(parser->endElementHandler); + *parser->endElementHandler = *handler; + zval_copy_ctor(parser->endElementHandler); RETURN_TRUE; ]]> - </code> - </function> + </code> + </function> - <function role='public' name='html_parser_data_handler'> - <summary>set callback function for character data</summary> - <proto>bool html_parser_data_handler(resource html_parser parser, callback handler)</proto> - <description> - </description> - <code> + <function role='public' name='html_parser_data_handler'> + <summary>set callback function for character data</summary> + <proto>bool html_parser_data_handler(resource html_parser parser, callback handler)</proto> + <description> + </description> + <code> <![CDATA[ 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); + if(parser->characterDataHandler) { + zval_ptr_dtor(&parser->characterDataHandler); } - ALLOC_ZVAL(res_parser->characterDataHandler); - *res_parser->characterDataHandler = *handler; - zval_copy_ctor(res_parser->characterDataHandler); + ALLOC_ZVAL(parser->characterDataHandler); + *parser->characterDataHandler = *handler; + zval_copy_ctor(parser->characterDataHandler); RETURN_TRUE; ]]> - </code> - </function> + </code> + </function> - <function role='public' name='html_parser_comment_handler'> - <summary>set callback function for HTML comments</summary> - <proto>bool html_parser_comment_handler(resource html_parser parser, callback handler)</proto> - <description> - </description> - <code> + <function role='public' name='html_parser_comment_handler'> + <summary>set callback function for HTML comments</summary> + <proto>bool html_parser_comment_handler(resource html_parser parser, callback handler)</proto> + <description> + </description> + <code> <![CDATA[ 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); + if(parser->commentHandler) { + zval_ptr_dtor(&parser->commentHandler); } - ALLOC_ZVAL(res_parser->commentHandler); - *res_parser->commentHandler = *handler; - zval_copy_ctor(res_parser->commentHandler); + ALLOC_ZVAL(parser->commentHandler); + *parser->commentHandler = *handler; + zval_copy_ctor(parser->commentHandler); RETURN_TRUE; ]]> - </code> - </function> + </code> + </function> - <function role='public' name='html_parser_parse'> - <summary>feed input into parser</summary> - <proto>bool html_parser_parse(resource html_parser parser, string data [, bool finish])</proto> - <code> + <function role='public' name='html_parser_parse'> + <summary>feed input into parser</summary> + <proto>bool html_parser_parse(resource html_parser parser, string data [, bool finish])</proto> + <code> <![CDATA[ { /* prepare input data as needed by ekhtml_parser_feed */ @@ -351,33 +353,13 @@ str.len = data_len; /* feed data */ - ekhtml_parser_feed(res_parser->parser, &str); + ekhtml_parser_feed(parser->parser, &str); /* request parsing of feeded data */ - ekhtml_parser_flush(res_parser->parser, finish); + ekhtml_parser_flush(parser->parser, finish); } ]]> - </code> - </function> - - </functions> + </code> + </function> - <code role='header'> -<![CDATA[ -#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; -]]> - </code> - -</extension> \ No newline at end of file +</extension>
http://cvs.php.net/viewcvs.cgi/pecl/html_parse/html_parse.xml?r1=1.1&r2=1.2&diff_format=u Index: pecl/html_parse/html_parse.xml diff -u pecl/html_parse/html_parse.xml:1.1 pecl/html_parse/html_parse.xml:1.2 --- pecl/html_parse/html_parse.xml:1.1 Tue Jun 24 16:40:56 2003 +++ pecl/html_parse/html_parse.xml Mon Feb 20 18:32:33 2006 @@ -9,87 +9,80 @@ directory ... --> -<extension> - <name>html_parse</name> +<extension name="html_parse" version="1.0.0"> <summary>HTML parser extenion</summary> <description> HTML parser extension based on the ekhtml library (http://ekhtml.sourceforge.net/) </description> - + <maintainers> - <maintainer> - <user>hholzgra</user> - <name>Hartmut Holzgraefe</name> - <email>hartmut@php.net</email> - <role>lead</role> - </maintainer> + <maintainer> + <user>hholzgra</user> + <name>Hartmut Holzgraefe</name> + <email>hartmut@php.net</email> + <role>lead</role> + </maintainer> </maintainers> - + <release> - <version>0.1</version> - <date>2002-02-28</date> - <state>alpha</state> + <version>0.9</version> + <date>2006-02-20</date> + <state>beta</state> <license>php</license> <notes> - - first experimental draft + - preparing for 1.0.0 release </notes> </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 language="c"> - <with defaults='/usr:/usr/local' testfile='include/ekhtml.h'>foobar install</with> + <deps language="c"> + <with name="ekhtml" defaults='/usr:/usr/local' testfile='include/ekhtml.h'>foobar install</with> <lib name='ekhtml' function='ekhtml_parser_new'></lib> </deps> - <constants> - </constants> + <code role='header'> +<![CDATA[ +#include <ekhtml.h> - <globals> - </globals> +/* resource payload for html_parse resources */ +typedef struct { + /* HTML parser */ + ekhtml_parser_t *parser; - <resources> - <resource name="html_parser" payload="php_html_parser" alloc="yes"> - <description> - HTML parser resource - </description> - <destruct> -<![CDATA[ - /* destroy HTML parser */ - if(resource->parser) { - ekhtml_parser_destroy(resource->parser); - } + /* callback functions */ + zval *startElementHandler; + zval *endElementHandler; + zval *characterDataHandler; + zval *commentHandler; +} php_html_parser; - /* destruct any set callback handlers */ - if (resource->startElementHandler) { - zval_ptr_dtor(&resource->startElementHandler); - } - if (resource->endElementHandler) { - zval_ptr_dtor(&resource->endElementHandler); - } - if (resource->characterDataHandler) { - zval_ptr_dtor(&resource->characterDataHandler); - } - if (resource->commentHandler) { - zval_ptr_dtor(&resource->commentHandler); - } +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); ]]> - </destruct> - </resource> - </resources> - - <functions> - <function role='private' name='_start_cb'> - <code> + </code> + + <code position="top"> <![CDATA[ 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(); + zval *cb_retval, *cb_tag, *cb_array; + zval **cb_args[2]; + TSRMLS_FETCH(); if (parser->startElementHandler) { /* create zval string parameter for tag name */ @@ -122,95 +115,104 @@ 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); + 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); + zval_ptr_dtor(&cb_tag); + zval_ptr_dtor(&cb_array); } } -]]> - </code> - </function> - <function role='private' name='_end_cb'> - <code> -<![CDATA[ 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(); + 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); + 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); + zval_ptr_dtor(&cb_tag); } } -]]> - </code> - </function> - <function role='private' name='_comment_cb'> - <code> -<![CDATA[ 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(); + 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); + 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); + zval_ptr_dtor(&cb_comment); } } -]]> - </code> - </function> - - <function role='private' name='_data_cb'> - <code> -<![CDATA[ + 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(); + 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); + 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); + zval_ptr_dtor(&cb_data); } } -]]> - </code> - </function> - - <function role='public' name='html_parser_create'> - <summary>create an HTML parser</summary> - <proto>resource html_parser html_parser_create(void)</proto> - <description> +]]> + </code> + + <resource name="html_parser" payload="php_html_parser" alloc="yes"> + <description> + HTML parser resource + </description> + <destruct> +<![CDATA[ + /* destroy HTML parser */ + if(resource->parser) { + ekhtml_parser_destroy(resource->parser); + } + + /* destruct any set callback handlers */ + if (resource->startElementHandler) { + zval_ptr_dtor(&resource->startElementHandler); + } + if (resource->endElementHandler) { + zval_ptr_dtor(&resource->endElementHandler); + } + if (resource->characterDataHandler) { + zval_ptr_dtor(&resource->characterDataHandler); + } + if (resource->commentHandler) { + zval_ptr_dtor(&resource->commentHandler); + } +]]> + </destruct> + </resource> + + <function role='public' name='html_parser_create'> + <summary>create an HTML parser</summary> + <proto>resource html_parser html_parser_create(void)</proto> + <description> foobar - </description> - <code> + </description> + <code> <![CDATA[ return_res->parser = ekhtml_parser_new(return_res); if(! return_res->parser) RETURN_FALSE; @@ -230,27 +232,27 @@ ZEND_REGISTER_RESOURCE(return_value, return_res, le_html_parser); ]]> - </code> - </function> - - <function role='public' name='html_parser_free'> - <summary>free an HTML parser</summary> - <proto>bool html_parser_free(resource html_parser parser)</proto> - <description> - </description> - <code> + </code> + </function> + + <function role='public' name='html_parser_free'> + <summary>free an HTML parser</summary> + <proto>bool html_parser_free(resource html_parser parser)</proto> + <description> + </description> + <code> <![CDATA[ - zval_dtor(parser); + FREE_RESOURCE(parser_res); ]]> - </code> - </function> + </code> + </function> - <function role='public' name='html_parser_starttag_handler'> - <summary>set callback function for start tags</summary> - <proto>bool html_parser_starttag_handler(resource html_parser parser, callback handler)</proto> - <description> - </description> - <code> + <function role='public' name='html_parser_starttag_handler'> + <summary>set callback function for start tags</summary> + <proto>bool html_parser_starttag_handler(resource html_parser parser, callback handler)</proto> + <description> + </description> + <code> <![CDATA[ /* parameter check */ if (!zend_is_callable(handler, 0, NULL)) { @@ -259,90 +261,90 @@ } /* have previous? -> dispose */ - if(res_parser->startElementHandler) { - zval_ptr_dtor(&res_parser->startElementHandler); + if(parser->startElementHandler) { + zval_ptr_dtor(&parser->startElementHandler); } /* assign new callback handler */ - ALLOC_ZVAL(res_parser->startElementHandler); - *res_parser->startElementHandler = *handler; - zval_copy_ctor(res_parser->startElementHandler); + ALLOC_ZVAL(parser->startElementHandler); + *parser->startElementHandler = *handler; + zval_copy_ctor(parser->startElementHandler); RETURN_TRUE; ]]> - </code> - </function> + </code> + </function> - <function role='public' name='html_parser_endtag_handler'> - <summary>set callback function for end tags</summary> - <proto>bool html_parser_endtag_handler(resource html_parser parser, callback handler)</proto> - <description> - </description> - <code> + <function role='public' name='html_parser_endtag_handler'> + <summary>set callback function for end tags</summary> + <proto>bool html_parser_endtag_handler(resource html_parser parser, callback handler)</proto> + <description> + </description> + <code> <![CDATA[ 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); + if(parser->endElementHandler) { + zval_ptr_dtor(&parser->endElementHandler); } - ALLOC_ZVAL(res_parser->endElementHandler); - *res_parser->endElementHandler = *handler; - zval_copy_ctor(res_parser->endElementHandler); + ALLOC_ZVAL(parser->endElementHandler); + *parser->endElementHandler = *handler; + zval_copy_ctor(parser->endElementHandler); RETURN_TRUE; ]]> - </code> - </function> + </code> + </function> - <function role='public' name='html_parser_data_handler'> - <summary>set callback function for character data</summary> - <proto>bool html_parser_data_handler(resource html_parser parser, callback handler)</proto> - <description> - </description> - <code> + <function role='public' name='html_parser_data_handler'> + <summary>set callback function for character data</summary> + <proto>bool html_parser_data_handler(resource html_parser parser, callback handler)</proto> + <description> + </description> + <code> <![CDATA[ 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); + if(parser->characterDataHandler) { + zval_ptr_dtor(&parser->characterDataHandler); } - ALLOC_ZVAL(res_parser->characterDataHandler); - *res_parser->characterDataHandler = *handler; - zval_copy_ctor(res_parser->characterDataHandler); + ALLOC_ZVAL(parser->characterDataHandler); + *parser->characterDataHandler = *handler; + zval_copy_ctor(parser->characterDataHandler); RETURN_TRUE; ]]> - </code> - </function> + </code> + </function> - <function role='public' name='html_parser_comment_handler'> - <summary>set callback function for HTML comments</summary> - <proto>bool html_parser_comment_handler(resource html_parser parser, callback handler)</proto> - <description> - </description> - <code> + <function role='public' name='html_parser_comment_handler'> + <summary>set callback function for HTML comments</summary> + <proto>bool html_parser_comment_handler(resource html_parser parser, callback handler)</proto> + <description> + </description> + <code> <![CDATA[ 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); + if(parser->commentHandler) { + zval_ptr_dtor(&parser->commentHandler); } - ALLOC_ZVAL(res_parser->commentHandler); - *res_parser->commentHandler = *handler; - zval_copy_ctor(res_parser->commentHandler); + ALLOC_ZVAL(parser->commentHandler); + *parser->commentHandler = *handler; + zval_copy_ctor(parser->commentHandler); RETURN_TRUE; ]]> - </code> - </function> + </code> + </function> - <function role='public' name='html_parser_parse'> - <summary>feed input into parser</summary> - <proto>bool html_parser_parse(resource html_parser parser, string data [, bool finish])</proto> - <code> + <function role='public' name='html_parser_parse'> + <summary>feed input into parser</summary> + <proto>bool html_parser_parse(resource html_parser parser, string data [, bool finish])</proto> + <code> <![CDATA[ { /* prepare input data as needed by ekhtml_parser_feed */ @@ -351,33 +353,13 @@ str.len = data_len; /* feed data */ - ekhtml_parser_feed(res_parser->parser, &str); + ekhtml_parser_feed(parser->parser, &str); /* request parsing of feeded data */ - ekhtml_parser_flush(res_parser->parser, finish); + ekhtml_parser_flush(parser->parser, finish); } ]]> - </code> - </function> - - </functions> + </code> + </function> - <code role='header'> -<![CDATA[ -#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; -]]> - </code> - -</extension> \ No newline at end of file +</extension>