This commit is contained in:
CismonX 2019-04-02 16:16:11 +08:00
parent f24c4ebc63
commit c73f9039ec
5 changed files with 46 additions and 0 deletions

View File

@ -10,6 +10,7 @@ if test "$PHP_ARMA" != "no"; then
ARMA_SRC=" \
src/php_arma.cc \
src/constants.cc \
src/base.cc \
src/complex.cc \
src/mapval.cc \
"

15
src/base.cc Normal file
View File

@ -0,0 +1,15 @@
//
// php-armadillo/base.cc
//
// @Author CismonX
//
#include "base.hh"
namespace php_arma
{
void base_init()
{
base_ce = interface_register<base_php_name>();
}
}

27
src/base.hh Normal file
View File

@ -0,0 +1,27 @@
//
// php-armadillo/base.hh
//
// @Author CismonX
//
#ifndef PHP_ARMA_BASE_HH
#define PHP_ARMA_BASE_HH
#include "php_arma.hh"
namespace php_arma
{
template <typename T, typename ChildT>
struct base
{
using native_t = typename ChildT::native_t;
};
void base_init();
constexpr const char base_php_name[] = "Internal\\Base";
inline zend_class_entry *base_ce;
}
#endif // !PHP_ARMA_BASE_HH

View File

@ -7,6 +7,7 @@
#include "php_arma.hh"
#include "constants.hh"
#include "complex.hh"
#include "base.hh"
#include "mapval.hh"
#ifdef PHP_ARMA_OPERATOR
@ -19,6 +20,7 @@ PHP_MINIT_FUNCTION(arma)
{
php_arma::constants_init();
php_arma::complex_init();
php_arma::base_init();
php_arma::mapval_init();
#ifdef PHP_ARMA_OPERATOR

View File

@ -226,6 +226,7 @@ namespace php_arma
{
zend_throw_exception_ex(zend_ce_error, -3,
"Class %s is not explicitly constructible.", ZSTR_VAL(ce->name));
return zend_objects_new(ce);
}
/// Helper functions for handling scalar types.