Added perl callback for three doubles

This commit is contained in:
Enrico Turri 2018-09-07 14:21:04 +02:00
parent 775ec1b546
commit e1deb03d3c
2 changed files with 21 additions and 3 deletions

View file

@ -97,8 +97,9 @@ public:
void call(int i) const;
void call(int i, int j) const;
void call(const std::vector<int>& ints) const;
void call(double d) const;
void call(double a) const;
void call(double a, double b) const;
void call(double a, double b, double c) const;
void call(double a, double b, double c, double d) const;
void call(bool b) const;
private:

View file

@ -251,7 +251,7 @@ void PerlCallback::call(const std::vector<int>& ints) const
LEAVE;
}
void PerlCallback::call(double d) const
void PerlCallback::call(double a) const
{
if (!m_callback)
return;
@ -259,7 +259,7 @@ void PerlCallback::call(double d) const
ENTER;
SAVETMPS;
PUSHMARK(SP);
XPUSHs(sv_2mortal(newSVnv(d)));
XPUSHs(sv_2mortal(newSVnv(a)));
PUTBACK;
perl_call_sv(SvRV((SV*)m_callback), G_DISCARD);
FREETMPS;
@ -282,6 +282,23 @@ void PerlCallback::call(double a, double b) const
LEAVE;
}
void PerlCallback::call(double a, double b, double c) const
{
if (!m_callback)
return;
dSP;
ENTER;
SAVETMPS;
PUSHMARK(SP);
XPUSHs(sv_2mortal(newSVnv(a)));
XPUSHs(sv_2mortal(newSVnv(b)));
XPUSHs(sv_2mortal(newSVnv(c)));
PUTBACK;
perl_call_sv(SvRV((SV*)m_callback), G_DISCARD);
FREETMPS;
LEAVE;
}
void PerlCallback::call(double a, double b, double c, double d) const
{
if (!m_callback)