0
0
mirror of https://github.com/pmmp/ext-encoding.git synced 2025-02-28 18:21:37 +00:00
ext-encoding/encoding.cpp
Dylan K. Taylor d0e71a30aa Pull simple type encoders out into a separate class
this isn't the final form, but these statics already turned out to be
handy for the tests, and they'll probably be good for attributes and
other stuff like it.
2024-04-10 15:07:05 +01:00

78 lines
1.8 KiB
C++

/* encoding extension for PHP */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
extern "C" {
#include "php.h"
#include "ext/standard/info.h"
#include "php_encoding.h"
#include "ext/spl/spl_exceptions.h"
#include "stubs/DataDecodeException_arginfo.h"
}
#include "classes/ByteBuffer.h"
#include "classes/Types.h"
#include "classes/DataDecodeException.h"
/* {{{ PHP_MINFO_FUNCTION */
PHP_MINFO_FUNCTION(encoding)
{
php_info_print_table_start();
php_info_print_table_header(2, "Version", PHP_ENCODING_VERSION);
php_info_print_table_header(2, "Experimental", "YES");
php_info_print_table_end();
}
/* }}} */
/* {{{ PHP_RINIT_FUNCTION
*/
PHP_RINIT_FUNCTION(encoding)
{
#if defined(ZTS) && defined(COMPILE_DL_ENCODING)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
return SUCCESS;
}
/* }}} */
zend_class_entry* data_decode_exception_ce;
PHP_MINIT_FUNCTION(encoding) {
data_decode_exception_ce = register_class_pmmp_encoding_DataDecodeException(spl_ce_RuntimeException);
init_class_ByteBuffer();
init_class_Types();
return SUCCESS;
}
static const zend_module_dep module_dependencies[] = {
ZEND_MOD_REQUIRED("spl")
ZEND_MOD_END
};
/* {{{ encoding_module_entry */
zend_module_entry encoding_module_entry = {
STANDARD_MODULE_HEADER_EX,
NULL, /* ini_entries */
module_dependencies,
"encoding", /* Extension name */
NULL, /* zend_function_entry */
PHP_MINIT(encoding), /* PHP_MINIT - Module initialization */
NULL, /* PHP_MSHUTDOWN - Module shutdown */
PHP_RINIT(encoding), /* PHP_RINIT - Request initialization */
NULL, /* PHP_RSHUTDOWN - Request shutdown */
PHP_MINFO(encoding), /* PHP_MINFO - Module info */
PHP_ENCODING_VERSION, /* Version */
STANDARD_MODULE_PROPERTIES
};
/* }}} */
#ifdef COMPILE_DL_ENCODING
# ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE()
# endif
ZEND_GET_MODULE(encoding)
#endif