diff options
| author | Máté Kocsis <kocsismate@woohoolabs.com> | 2020-04-19 20:05:16 +0200 |
|---|---|---|
| committer | Máté Kocsis <kocsismate@woohoolabs.com> | 2020-04-20 10:38:41 +0200 |
| commit | 4815be44db6b7a73cabfa872dc17d7e1574e1930 (patch) | |
| tree | 1acf5fda7957d12814f73654ef1e3b149ba39bc2 /ext/simplexml | |
| parent | 8e9bc90004f09a0d67fdac393a8f3fca904be397 (diff) | |
| download | php-git-4815be44db6b7a73cabfa872dc17d7e1574e1930.tar.gz | |
Generate function entries from stubs
Converts ext/pcntl, ext/simplexml, ext/snmp, ext/soap, ext/sqlite3.
Closes GH-5421
Diffstat (limited to 'ext/simplexml')
| -rw-r--r-- | ext/simplexml/simplexml.c | 35 | ||||
| -rw-r--r-- | ext/simplexml/simplexml.stub.php | 7 | ||||
| -rw-r--r-- | ext/simplexml/simplexml_arginfo.h | 45 | ||||
| -rw-r--r-- | ext/simplexml/sxe.c | 28 | ||||
| -rw-r--r-- | ext/simplexml/sxe.stub.php | 2 | ||||
| -rw-r--r-- | ext/simplexml/sxe_arginfo.h | 21 |
6 files changed, 85 insertions, 53 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index f44c268286..5f23c48026 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -44,7 +44,7 @@ PHP_SXE_API zend_class_entry *sxe_get_element_class_entry() /* {{{ */ #define SXE_ME(func, arg_info, flags) PHP_ME(simplexml_element, func, arg_info, flags) #define SXE_MALIAS(func, alias, arg_info, flags) PHP_MALIAS(simplexml_element, func, alias, arg_info, flags) -#define SXE_METHOD(func) PHP_METHOD(simplexml_element, func) +#define SXE_METHOD(func) PHP_METHOD(SimpleXMLElement, func) static php_sxe_object* php_sxe_object_new(zend_class_entry *ce, zend_function *fptr_count); static xmlNodePtr php_sxe_reset_iterator(php_sxe_object *sxe, int use_data); @@ -2576,14 +2576,6 @@ PHP_FUNCTION(simplexml_import_dom) } /* }}} */ -static const zend_function_entry simplexml_functions[] = { /* {{{ */ - PHP_FE(simplexml_load_file, arginfo_simplexml_load_file) - PHP_FE(simplexml_load_string, arginfo_simplexml_load_string) - PHP_FE(simplexml_import_dom, arginfo_simplexml_import_dom) - PHP_FE_END -}; -/* }}} */ - static const zend_module_dep simplexml_deps[] = { /* {{{ */ ZEND_MOD_REQUIRED("libxml") ZEND_MOD_REQUIRED("spl") @@ -2595,7 +2587,7 @@ zend_module_entry simplexml_module_entry = { /* {{{ */ STANDARD_MODULE_HEADER_EX, NULL, simplexml_deps, "SimpleXML", - simplexml_functions, + ext_functions, PHP_MINIT(simplexml), PHP_MSHUTDOWN(simplexml), NULL, @@ -2610,34 +2602,13 @@ zend_module_entry simplexml_module_entry = { /* {{{ */ ZEND_GET_MODULE(simplexml) #endif -/* the method table */ -/* each method can have its own parameters and visibility */ -static const zend_function_entry sxe_functions[] = { /* {{{ */ - SXE_ME(__construct, arginfo_class_SimpleXMLElement___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) /* must be called */ - SXE_ME(asXML, arginfo_class_SimpleXMLElement_asXML, ZEND_ACC_PUBLIC) - SXE_MALIAS(saveXML, asXML, arginfo_class_SimpleXMLElement_saveXML, ZEND_ACC_PUBLIC) - SXE_ME(xpath, arginfo_class_SimpleXMLElement_xpath, ZEND_ACC_PUBLIC) - SXE_ME(registerXPathNamespace, arginfo_class_SimpleXMLElement_registerXPathNamespace, ZEND_ACC_PUBLIC) - SXE_ME(attributes, arginfo_class_SimpleXMLElement_attributes, ZEND_ACC_PUBLIC) - SXE_ME(children, arginfo_class_SimpleXMLElement_children, ZEND_ACC_PUBLIC) - SXE_ME(getNamespaces, arginfo_class_SimpleXMLElement_getNamespaces, ZEND_ACC_PUBLIC) - SXE_ME(getDocNamespaces, arginfo_class_SimpleXMLElement_getDocNamespaces, ZEND_ACC_PUBLIC) - SXE_ME(getName, arginfo_class_SimpleXMLElement_getName, ZEND_ACC_PUBLIC) - SXE_ME(addChild, arginfo_class_SimpleXMLElement_addChild, ZEND_ACC_PUBLIC) - SXE_ME(addAttribute, arginfo_class_SimpleXMLElement_addAttribute, ZEND_ACC_PUBLIC) - SXE_ME(__toString, arginfo_class_SimpleXMLElement___toString, ZEND_ACC_PUBLIC) - SXE_ME(count, arginfo_class_SimpleXMLElement_count, ZEND_ACC_PUBLIC) - PHP_FE_END -}; -/* }}} */ - /* {{{ PHP_MINIT_FUNCTION(simplexml) */ PHP_MINIT_FUNCTION(simplexml) { zend_class_entry sxe; - INIT_CLASS_ENTRY(sxe, "SimpleXMLElement", sxe_functions); + INIT_CLASS_ENTRY(sxe, "SimpleXMLElement", class_SimpleXMLElement_methods); sxe.create_object = sxe_object_new; sxe_class_entry = zend_register_internal_class(&sxe); sxe_class_entry->get_iterator = php_sxe_get_iterator; diff --git a/ext/simplexml/simplexml.stub.php b/ext/simplexml/simplexml.stub.php index f78694c139..68eaf2be6e 100644 --- a/ext/simplexml/simplexml.stub.php +++ b/ext/simplexml/simplexml.stub.php @@ -1,5 +1,7 @@ <?php +/** @generate-function-entries */ + function simplexml_load_file(string $filename, ?string $class_name = SimpleXMLElement::class, int $options = 0, string $ns = '', bool $is_prefix = false): SimpleXMLElement|false {} function simplexml_load_string(string $data, ?string $class_name = SimpleXMLElement::class, int $options = 0, string $ns = '', bool $is_prefix = false): SimpleXMLElement|false {} @@ -17,7 +19,10 @@ class SimpleXMLElement implements Stringable /** @return string|bool */ public function asXML(string $filename = UNKNOWN) {} - /** @return string|bool */ + /** + * @return string|bool + * @alias SimpleXMLElement::asXML + */ public function saveXML(string $filename = UNKNOWN) {} /** @return array */ diff --git a/ext/simplexml/simplexml_arginfo.h b/ext/simplexml/simplexml_arginfo.h index c77878c927..1a38450764 100644 --- a/ext/simplexml/simplexml_arginfo.h +++ b/ext/simplexml/simplexml_arginfo.h @@ -75,3 +75,48 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_SimpleXMLElement___toStrin ZEND_END_ARG_INFO() #define arginfo_class_SimpleXMLElement_count arginfo_class_SimpleXMLElement_getName + + +ZEND_FUNCTION(simplexml_load_file); +ZEND_FUNCTION(simplexml_load_string); +ZEND_FUNCTION(simplexml_import_dom); +ZEND_METHOD(SimpleXMLElement, xpath); +ZEND_METHOD(SimpleXMLElement, registerXPathNamespace); +ZEND_METHOD(SimpleXMLElement, asXML); +ZEND_METHOD(SimpleXMLElement, getNamespaces); +ZEND_METHOD(SimpleXMLElement, getDocNamespaces); +ZEND_METHOD(SimpleXMLElement, children); +ZEND_METHOD(SimpleXMLElement, attributes); +ZEND_METHOD(SimpleXMLElement, __construct); +ZEND_METHOD(SimpleXMLElement, addChild); +ZEND_METHOD(SimpleXMLElement, addAttribute); +ZEND_METHOD(SimpleXMLElement, getName); +ZEND_METHOD(SimpleXMLElement, __toString); +ZEND_METHOD(SimpleXMLElement, count); + + +static const zend_function_entry ext_functions[] = { + ZEND_FE(simplexml_load_file, arginfo_simplexml_load_file) + ZEND_FE(simplexml_load_string, arginfo_simplexml_load_string) + ZEND_FE(simplexml_import_dom, arginfo_simplexml_import_dom) + ZEND_FE_END +}; + + +static const zend_function_entry class_SimpleXMLElement_methods[] = { + ZEND_ME(SimpleXMLElement, xpath, arginfo_class_SimpleXMLElement_xpath, ZEND_ACC_PUBLIC) + ZEND_ME(SimpleXMLElement, registerXPathNamespace, arginfo_class_SimpleXMLElement_registerXPathNamespace, ZEND_ACC_PUBLIC) + ZEND_ME(SimpleXMLElement, asXML, arginfo_class_SimpleXMLElement_asXML, ZEND_ACC_PUBLIC) + ZEND_MALIAS(SimpleXMLElement, saveXML, asXML, arginfo_class_SimpleXMLElement_saveXML, ZEND_ACC_PUBLIC) + ZEND_ME(SimpleXMLElement, getNamespaces, arginfo_class_SimpleXMLElement_getNamespaces, ZEND_ACC_PUBLIC) + ZEND_ME(SimpleXMLElement, getDocNamespaces, arginfo_class_SimpleXMLElement_getDocNamespaces, ZEND_ACC_PUBLIC) + ZEND_ME(SimpleXMLElement, children, arginfo_class_SimpleXMLElement_children, ZEND_ACC_PUBLIC) + ZEND_ME(SimpleXMLElement, attributes, arginfo_class_SimpleXMLElement_attributes, ZEND_ACC_PUBLIC) + ZEND_ME(SimpleXMLElement, __construct, arginfo_class_SimpleXMLElement___construct, ZEND_ACC_PUBLIC) + ZEND_ME(SimpleXMLElement, addChild, arginfo_class_SimpleXMLElement_addChild, ZEND_ACC_PUBLIC) + ZEND_ME(SimpleXMLElement, addAttribute, arginfo_class_SimpleXMLElement_addAttribute, ZEND_ACC_PUBLIC) + ZEND_ME(SimpleXMLElement, getName, arginfo_class_SimpleXMLElement_getName, ZEND_ACC_PUBLIC) + ZEND_ME(SimpleXMLElement, __toString, arginfo_class_SimpleXMLElement___toString, ZEND_ACC_PUBLIC) + ZEND_ME(SimpleXMLElement, count, arginfo_class_SimpleXMLElement_count, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; diff --git a/ext/simplexml/sxe.c b/ext/simplexml/sxe.c index 8c9d050dcb..66ff567249 100644 --- a/ext/simplexml/sxe.c +++ b/ext/simplexml/sxe.c @@ -36,7 +36,7 @@ PHP_SXE_API zend_class_entry *ce_SimpleXMLElement; /* {{{ proto void SimpleXMLIterator::rewind() Rewind to first element */ -PHP_METHOD(ce_SimpleXMLIterator, rewind) +PHP_METHOD(SimpleXMLIterator, rewind) { if (zend_parse_parameters_none() == FAILURE) { RETURN_THROWS(); @@ -48,7 +48,7 @@ PHP_METHOD(ce_SimpleXMLIterator, rewind) /* {{{ proto bool SimpleXMLIterator::valid() Check whether iteration is valid */ -PHP_METHOD(ce_SimpleXMLIterator, valid) +PHP_METHOD(SimpleXMLIterator, valid) { php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS); @@ -62,7 +62,7 @@ PHP_METHOD(ce_SimpleXMLIterator, valid) /* {{{ proto SimpleXMLIterator SimpleXMLIterator::current() Get current element */ -PHP_METHOD(ce_SimpleXMLIterator, current) +PHP_METHOD(SimpleXMLIterator, current) { php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS); zval *data; @@ -82,7 +82,7 @@ PHP_METHOD(ce_SimpleXMLIterator, current) /* {{{ proto string SimpleXMLIterator::key() Get name of current child element */ -PHP_METHOD(ce_SimpleXMLIterator, key) +PHP_METHOD(SimpleXMLIterator, key) { xmlNodePtr curnode; php_sxe_object *intern; @@ -108,7 +108,7 @@ PHP_METHOD(ce_SimpleXMLIterator, key) /* {{{ proto void SimpleXMLIterator::next() Move to next element */ -PHP_METHOD(ce_SimpleXMLIterator, next) +PHP_METHOD(SimpleXMLIterator, next) { if (zend_parse_parameters_none() == FAILURE) { RETURN_THROWS(); @@ -120,7 +120,7 @@ PHP_METHOD(ce_SimpleXMLIterator, next) /* {{{ proto bool SimpleXMLIterator::hasChildren() Check whether element has children (elements) */ -PHP_METHOD(ce_SimpleXMLIterator, hasChildren) +PHP_METHOD(SimpleXMLIterator, hasChildren) { php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS); php_sxe_object *child; @@ -148,7 +148,7 @@ PHP_METHOD(ce_SimpleXMLIterator, hasChildren) /* {{{ proto SimpleXMLIterator SimpleXMLIterator::getChildren() Get child element iterator */ -PHP_METHOD(ce_SimpleXMLIterator, getChildren) +PHP_METHOD(SimpleXMLIterator, getChildren) { php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS); zval *data; @@ -165,18 +165,6 @@ PHP_METHOD(ce_SimpleXMLIterator, getChildren) ZVAL_COPY_DEREF(return_value, data); } -static const zend_function_entry funcs_SimpleXMLIterator[] = { - PHP_ME(ce_SimpleXMLIterator, rewind, arginfo_class_SimpleXMLIterator_rewind, ZEND_ACC_PUBLIC) - PHP_ME(ce_SimpleXMLIterator, valid, arginfo_class_SimpleXMLIterator_valid, ZEND_ACC_PUBLIC) - PHP_ME(ce_SimpleXMLIterator, current, arginfo_class_SimpleXMLIterator_current, ZEND_ACC_PUBLIC) - PHP_ME(ce_SimpleXMLIterator, key, arginfo_class_SimpleXMLIterator_key, ZEND_ACC_PUBLIC) - PHP_ME(ce_SimpleXMLIterator, next, arginfo_class_SimpleXMLIterator_next, ZEND_ACC_PUBLIC) - PHP_ME(ce_SimpleXMLIterator, hasChildren, arginfo_class_SimpleXMLIterator_hasChildren, ZEND_ACC_PUBLIC) - PHP_ME(ce_SimpleXMLIterator, getChildren, arginfo_class_SimpleXMLIterator_getChildren, ZEND_ACC_PUBLIC) - PHP_FE_END -}; -/* }}} */ - PHP_MINIT_FUNCTION(sxe) /* {{{ */ { zend_class_entry *pce; @@ -190,7 +178,7 @@ PHP_MINIT_FUNCTION(sxe) /* {{{ */ ce_SimpleXMLElement = pce; - INIT_CLASS_ENTRY_EX(sxi, "SimpleXMLIterator", sizeof("SimpleXMLIterator") - 1, funcs_SimpleXMLIterator); + INIT_CLASS_ENTRY_EX(sxi, "SimpleXMLIterator", sizeof("SimpleXMLIterator") - 1, class_SimpleXMLIterator_methods); ce_SimpleXMLIterator = zend_register_internal_class_ex(&sxi, ce_SimpleXMLElement); ce_SimpleXMLIterator->create_object = ce_SimpleXMLElement->create_object; diff --git a/ext/simplexml/sxe.stub.php b/ext/simplexml/sxe.stub.php index d609e93846..a6e24dbc5c 100644 --- a/ext/simplexml/sxe.stub.php +++ b/ext/simplexml/sxe.stub.php @@ -1,5 +1,7 @@ <?php +/** @generate-function-entries */ + class SimpleXMLIterator { /** @return void */ diff --git a/ext/simplexml/sxe_arginfo.h b/ext/simplexml/sxe_arginfo.h index d3b0c6c479..c21cf3da24 100644 --- a/ext/simplexml/sxe_arginfo.h +++ b/ext/simplexml/sxe_arginfo.h @@ -14,3 +14,24 @@ ZEND_END_ARG_INFO() #define arginfo_class_SimpleXMLIterator_hasChildren arginfo_class_SimpleXMLIterator_rewind #define arginfo_class_SimpleXMLIterator_getChildren arginfo_class_SimpleXMLIterator_rewind + + +ZEND_METHOD(SimpleXMLIterator, rewind); +ZEND_METHOD(SimpleXMLIterator, valid); +ZEND_METHOD(SimpleXMLIterator, current); +ZEND_METHOD(SimpleXMLIterator, key); +ZEND_METHOD(SimpleXMLIterator, next); +ZEND_METHOD(SimpleXMLIterator, hasChildren); +ZEND_METHOD(SimpleXMLIterator, getChildren); + + +static const zend_function_entry class_SimpleXMLIterator_methods[] = { + ZEND_ME(SimpleXMLIterator, rewind, arginfo_class_SimpleXMLIterator_rewind, ZEND_ACC_PUBLIC) + ZEND_ME(SimpleXMLIterator, valid, arginfo_class_SimpleXMLIterator_valid, ZEND_ACC_PUBLIC) + ZEND_ME(SimpleXMLIterator, current, arginfo_class_SimpleXMLIterator_current, ZEND_ACC_PUBLIC) + ZEND_ME(SimpleXMLIterator, key, arginfo_class_SimpleXMLIterator_key, ZEND_ACC_PUBLIC) + ZEND_ME(SimpleXMLIterator, next, arginfo_class_SimpleXMLIterator_next, ZEND_ACC_PUBLIC) + ZEND_ME(SimpleXMLIterator, hasChildren, arginfo_class_SimpleXMLIterator_hasChildren, ZEND_ACC_PUBLIC) + ZEND_ME(SimpleXMLIterator, getChildren, arginfo_class_SimpleXMLIterator_getChildren, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; |
