diff --git a/README.md b/README.md index c637833..7ddc0ea 100644 --- a/README.md +++ b/README.md @@ -175,15 +175,15 @@ make install # installs extension in your system - [x] CI for different PHP versions ## Links -* [CAN-Bus wikipedia](https:// en.wikipedia.org/wiki/CAN_bus) -* [Linux CAN utils](https:// github.com/linux-can/can-utils) -* [Raspberry PI + MCP2515](https:// forums.raspberrypi.com/viewtopic.php?t=141052), [Polish guide](http:// www.emvn.pl/can-bus-mcp2515-raspberrypi-socketcan/) -* [How to write PHP exntesion by ZEND](https:// www.zend.com/resources/writing-php-extensions) -* [PHP extension whitepaper](https:// www.zend.com/sites/zend/files/pdfs/whitepaper-zend-php-extensions.pdf) -* [PHP internals book](https:// www.phpinternalsbook.com/) -* [PHP Fast Parameter Parsing API](https:// wiki.php.net/rfc/fast_zpp) RFC From 2014, included in PHP 7.x (2015+) -* [2011 PHP extension guide](https:// kchodorow.com/2011/08/11/php-extensions-made-eldrich-php-variables/), - [Archive](https:// web.archive.org/web/20210416205006/https:// kchodorow.com/2011/08/11/php-extensions-made-eldrich-php-variables/) (uses old parameter parsing api) -* [Archive: 2005 PHP extension guide](http:// web.archive.org/web/20110222035803/http:// devzone.zend.com/article/1021) (uses old parameter parsing api) -* [Archive: PHP Documentation on internals](https:// web.archive.org/web/20200501034044/https:// www.php.net/manual/en/internals2.php) +* [CAN-Bus wikipedia](https://en.wikipedia.org/wiki/CAN_bus) +* [Linux CAN utils](https://github.com/linux-can/can-utils) +* [Raspberry PI + MCP2515](https://forums.raspberrypi.com/viewtopic.php?t=141052), [Polish guide](http://www.emvn.pl/can-bus-mcp2515-raspberrypi-socketcan/) +* [How to write PHP exntesion by ZEND](https://www.zend.com/resources/writing-php-extensions) +* [PHP extension whitepaper](https://www.zend.com/sites/zend/files/pdfs/whitepaper-zend-php-extensions.pdf) +* [PHP internals book](https://www.phpinternalsbook.com/) +* [PHP Fast Parameter Parsing API](https://wiki.php.net/rfc/fast_zpp) RFC From 2014, included in PHP 7.x (2015+) +* [2011 PHP extension guide](https://kchodorow.com/2011/08/11/php-extensions-made-eldrich-php-variables/), + [Archive](https://web.archive.org/web/20210416205006/https://kchodorow.com/2011/08/11/php-extensions-made-eldrich-php-variables/) (uses old parameter parsing api) +* [Archive: 2005 PHP extension guide](http://web.archive.org/web/20110222035803/http://devzone.zend.com/article/1021) (uses old parameter parsing api) +* [Archive: PHP Documentation on internals](https://web.archive.org/web/20200501034044/https://www.php.net/manual/en/internals2.php) diff --git a/canbus.c b/canbus.c index cab1755..2d42ee8 100644 --- a/canbus.c +++ b/canbus.c @@ -283,12 +283,8 @@ PHP_METHOD(CanFrame, __construct) { /* }}} */ /* {{{ CanBus class registry */ -static zend_class_entry *register_class_CanBus(void) { - zend_class_entry ce, *classEntry; - - // Register class - INIT_CLASS_ENTRY(ce, "CanBus", class_CanBus_methods); - classEntry = zend_register_internal_class_ex(&ce, NULL); +static zend_class_entry *register_class_CanBus_with_members(void) { + zend_class_entry *classEntry = register_class_CanBus(); // Register member: public string $id = undefined zval property_interface_default_value; @@ -310,12 +306,8 @@ static zend_class_entry *register_class_CanBus(void) { /* }}} */ /* {{{ CanFrame class registry */ -static zend_class_entry *register_class_CanFrame(void) { - zend_class_entry ce, *classEntry; - - // Register class - INIT_CLASS_ENTRY(ce, "CanFrame", class_CanFrame_methods); - classEntry = zend_register_internal_class(&ce); +static zend_class_entry *register_class_CanFrame_with_members(void) { + zend_class_entry *classEntry = register_class_CanFrame(); // Register member: public int $id = 0 zval id; @@ -354,8 +346,8 @@ PHP_RINIT_FUNCTION(canbus){ /*{{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(canbus) { - canBus_ce = register_class_CanBus(); - canFrame_ce = register_class_CanFrame(); + canBus_ce = register_class_CanBus_with_members(); + canFrame_ce = register_class_CanFrame_with_members(); return SUCCESS; } diff --git a/canbus_arginfo.h b/canbus_arginfo.h index 792c302..ba491eb 100644 --- a/canbus_arginfo.h +++ b/canbus_arginfo.h @@ -47,3 +47,23 @@ static const zend_function_entry class_CanFrame_methods[] = { ZEND_ME(CanFrame, __construct, arginfo_class_CanFrame___construct, ZEND_ACC_PUBLIC) ZEND_FE_END }; + +static zend_class_entry *register_class_CanBus(void) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "CanBus", class_CanBus_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +} + +static zend_class_entry *register_class_CanFrame(void) +{ + zend_class_entry ce, *class_entry; + + INIT_CLASS_ENTRY(ce, "CanFrame", class_CanFrame_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + + return class_entry; +}