update
This commit is contained in:
parent
a5f076401f
commit
dcae143cc2
|
@ -131,7 +131,6 @@ namespace php_arma
|
|||
PHP_ARMA_METHOD(complex, abs, T)
|
||||
{
|
||||
auto current = zval_get_scalar<native_t>(getThis());
|
||||
|
||||
zval_set_scalar(return_value, std::abs(current));
|
||||
}
|
||||
|
||||
|
@ -139,7 +138,6 @@ namespace php_arma
|
|||
PHP_ARMA_METHOD(complex, arg, T)
|
||||
{
|
||||
auto current = zval_get_scalar<native_t>(getThis());
|
||||
|
||||
zval_set_scalar(return_value, std::arg(current));
|
||||
}
|
||||
|
||||
|
@ -147,7 +145,6 @@ namespace php_arma
|
|||
PHP_ARMA_METHOD(complex, norm, T)
|
||||
{
|
||||
auto current = zval_get_scalar<native_t>(getThis());
|
||||
|
||||
zval_set_scalar(return_value, std::norm(current));
|
||||
}
|
||||
|
||||
|
@ -161,7 +158,6 @@ namespace php_arma
|
|||
PHP_ARMA_METHOD(complex, exp, T)
|
||||
{
|
||||
auto current = zval_get_scalar<native_t>(getThis());
|
||||
|
||||
zval_set_scalar(return_value, std::exp(current));
|
||||
}
|
||||
|
||||
|
@ -169,7 +165,6 @@ namespace php_arma
|
|||
PHP_ARMA_METHOD(complex, log, T)
|
||||
{
|
||||
auto current = zval_get_scalar<native_t>(getThis());
|
||||
|
||||
zval_set_scalar(return_value, std::log(current));
|
||||
}
|
||||
|
||||
|
@ -177,7 +172,6 @@ namespace php_arma
|
|||
PHP_ARMA_METHOD(complex, log10, T)
|
||||
{
|
||||
auto current = zval_get_scalar<native_t>(getThis());
|
||||
|
||||
zval_set_scalar(return_value, std::log10(current));
|
||||
}
|
||||
|
||||
|
@ -198,7 +192,6 @@ namespace php_arma
|
|||
PHP_ARMA_METHOD(complex, sqrt, T)
|
||||
{
|
||||
auto current = zval_get_scalar<native_t>(getThis());
|
||||
|
||||
zval_set_scalar(return_value, std::abs(current));
|
||||
}
|
||||
|
||||
|
@ -206,7 +199,6 @@ namespace php_arma
|
|||
PHP_ARMA_METHOD(complex, sin, T)
|
||||
{
|
||||
auto current = zval_get_scalar<native_t>(getThis());
|
||||
|
||||
zval_set_scalar(return_value, std::sin(current));
|
||||
}
|
||||
|
||||
|
@ -214,7 +206,6 @@ namespace php_arma
|
|||
PHP_ARMA_METHOD(complex, cos, T)
|
||||
{
|
||||
auto current = zval_get_scalar<native_t>(getThis());
|
||||
|
||||
zval_set_scalar(return_value, std::cos(current));
|
||||
}
|
||||
|
||||
|
@ -222,7 +213,6 @@ namespace php_arma
|
|||
PHP_ARMA_METHOD(complex, tan, T)
|
||||
{
|
||||
auto current = zval_get_scalar<native_t>(getThis());
|
||||
|
||||
zval_set_scalar(return_value, std::tan(current));
|
||||
}
|
||||
|
||||
|
@ -230,7 +220,6 @@ namespace php_arma
|
|||
PHP_ARMA_METHOD(complex, asin, T)
|
||||
{
|
||||
auto current = zval_get_scalar<native_t>(getThis());
|
||||
|
||||
zval_set_scalar(return_value, std::asin(current));
|
||||
}
|
||||
|
||||
|
@ -238,7 +227,6 @@ namespace php_arma
|
|||
PHP_ARMA_METHOD(complex, acos, T)
|
||||
{
|
||||
auto current = zval_get_scalar<native_t>(getThis());
|
||||
|
||||
zval_set_scalar(return_value, std::acos(current));
|
||||
}
|
||||
|
||||
|
@ -246,7 +234,6 @@ namespace php_arma
|
|||
PHP_ARMA_METHOD(complex, atan, T)
|
||||
{
|
||||
auto current = zval_get_scalar<native_t>(getThis());
|
||||
|
||||
zval_set_scalar(return_value, std::atan(current));
|
||||
}
|
||||
|
||||
|
@ -254,7 +241,6 @@ namespace php_arma
|
|||
PHP_ARMA_METHOD(complex, sinh, T)
|
||||
{
|
||||
auto current = zval_get_scalar<native_t>(getThis());
|
||||
|
||||
zval_set_scalar(return_value, std::sinh(current));
|
||||
}
|
||||
|
||||
|
@ -262,7 +248,6 @@ namespace php_arma
|
|||
PHP_ARMA_METHOD(complex, cosh, T)
|
||||
{
|
||||
auto current = zval_get_scalar<native_t>(getThis());
|
||||
|
||||
zval_set_scalar(return_value, std::cosh(current));
|
||||
}
|
||||
|
||||
|
@ -270,7 +255,6 @@ namespace php_arma
|
|||
PHP_ARMA_METHOD(complex, tanh, T)
|
||||
{
|
||||
auto current = zval_get_scalar<native_t>(getThis());
|
||||
|
||||
zval_set_scalar(return_value, std::tanh(current));
|
||||
}
|
||||
|
||||
|
@ -278,7 +262,6 @@ namespace php_arma
|
|||
PHP_ARMA_METHOD(complex, asinh, T)
|
||||
{
|
||||
auto current = zval_get_scalar<native_t>(getThis());
|
||||
|
||||
zval_set_scalar(return_value, std::asinh(current));
|
||||
}
|
||||
|
||||
|
@ -286,7 +269,6 @@ namespace php_arma
|
|||
PHP_ARMA_METHOD(complex, acosh, T)
|
||||
{
|
||||
auto current = zval_get_scalar<native_t>(getThis());
|
||||
|
||||
zval_set_scalar(return_value, std::acosh(current));
|
||||
}
|
||||
|
||||
|
@ -294,7 +276,6 @@ namespace php_arma
|
|||
PHP_ARMA_METHOD(complex, atanh, T)
|
||||
{
|
||||
auto current = zval_get_scalar<native_t>(getThis());
|
||||
|
||||
zval_set_scalar(return_value, std::atanh(current));
|
||||
}
|
||||
|
||||
|
@ -416,7 +397,6 @@ namespace php_arma
|
|||
void complex_init()
|
||||
{
|
||||
complex_ce = abstract_class_register<complex_php_name>();
|
||||
|
||||
complex<double>::ce_init(complex_ce);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ namespace php_arma
|
|||
|
||||
void complex_init();
|
||||
|
||||
constexpr const char complex_php_name[] = "Complex";
|
||||
constexpr const char complex_php_name[] = "Complex";
|
||||
constexpr const char real_property_name[] = "real";
|
||||
constexpr const char imag_property_name[] = "imag";
|
||||
|
||||
|
@ -206,7 +206,6 @@ namespace php_arma
|
|||
static void neg(zval *zv, zval *retval)
|
||||
{
|
||||
auto v = zval_get_scalar<native_t>(zv);
|
||||
|
||||
zval_set_scalar(retval, -v);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,34 +7,16 @@
|
|||
#include "resizable.hh"
|
||||
#include "mat.hh"
|
||||
#include "constants.hh"
|
||||
#include "stream_utils.hh"
|
||||
|
||||
#include <armadillo>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <ext/stdio_filebuf.h>
|
||||
#endif // __GNUC__
|
||||
|
||||
#if PHP_VERSION_ID < 70200
|
||||
#define zend_hash_str_find_deref zend_hash_str_find
|
||||
#endif
|
||||
|
||||
namespace php_arma
|
||||
{
|
||||
zend_always_inline
|
||||
int zval_to_fd(zval *zv)
|
||||
{
|
||||
auto stream = reinterpret_cast<php_stream*>(zend_fetch_resource2_ex(
|
||||
zv, "stream", php_file_le_stream(), php_file_le_pstream()));
|
||||
if (stream == nullptr) {
|
||||
return -1;
|
||||
}
|
||||
struct {
|
||||
FILE *file;
|
||||
int fd;
|
||||
} *stream_data = reinterpret_cast<decltype(stream_data)>(stream->abstract);
|
||||
return stream_data->fd;
|
||||
}
|
||||
|
||||
#ifdef ARMA_USE_HDF5
|
||||
zend_always_inline
|
||||
arma::hdf5_name zend_array_to_hdf5_name(zend_array *ht)
|
||||
|
@ -52,15 +34,6 @@ namespace php_arma
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef __GNUC__
|
||||
zend_always_inline
|
||||
void filebuf_unsupported()
|
||||
{
|
||||
zend_throw_exception(zend_ce_type_error, "Resource is not yet supported. Use file name instead, "
|
||||
"or re-compile php-armadillo with a compiler supporting GNU extensions.", 0);
|
||||
}
|
||||
#endif // !__GNUC__
|
||||
|
||||
template <typename T, typename T1>
|
||||
PHP_ARMA_METHOD(resizable, copySize, T, T1)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
//
|
||||
// php-armadillo/stream_utils.hh
|
||||
//
|
||||
// @Author CismonX
|
||||
//
|
||||
|
||||
#ifndef PHP_ARMA_STREAM_UTILS_HH
|
||||
#define PHP_ARMA_STREAM_UTILS_HH
|
||||
|
||||
#include "php_arma.hh"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <ext/stdio_filebuf.h>
|
||||
#endif // __GNUC__
|
||||
|
||||
namespace php_arma
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
zend_always_inline
|
||||
int zval_to_fd(zval *zv)
|
||||
{
|
||||
auto stream = reinterpret_cast<php_stream*>(zend_fetch_resource2_ex(
|
||||
zv, "stream", php_file_le_stream(), php_file_le_pstream()));
|
||||
if (stream == nullptr) {
|
||||
return -1;
|
||||
}
|
||||
struct {
|
||||
FILE *file;
|
||||
int fd;
|
||||
} *stream_data = reinterpret_cast<decltype(stream_data)>(stream->abstract);
|
||||
return stream_data->fd;
|
||||
}
|
||||
#else
|
||||
zend_always_inline
|
||||
void filebuf_unsupported()
|
||||
{
|
||||
zend_throw_exception(zend_ce_type_error, "Resource is not yet supported. Use file name instead, "
|
||||
"or re-compile php-armadillo with a compiler supporting GNU extensions.", 0);
|
||||
}
|
||||
#endif // __GNUC__
|
||||
}
|
||||
|
||||
#endif // !PHP_ARMA_STREAM_UTILS_HH
|
|
@ -159,7 +159,7 @@ interface Base extends Countable
|
|||
* Print the contents of the object to a stream.
|
||||
*
|
||||
* @param resource $stream[optional]
|
||||
* @return mixed
|
||||
* @return void
|
||||
*/
|
||||
function print($stream = STDOUT);
|
||||
|
||||
|
@ -167,7 +167,7 @@ interface Base extends Countable
|
|||
* Similar to the print() member function, with the difference that no formatting of the output is done.
|
||||
*
|
||||
* @param resource $stream[optional]
|
||||
* @return mixed
|
||||
* @return void
|
||||
*/
|
||||
function rawPrint($stream = STDOUT);
|
||||
}
|
||||
|
|
Reference in New Issue