diff options
author | Enrico Turri <enricoturri@seznam.cz> | 2018-09-07 15:21:04 +0300 |
---|---|---|
committer | Enrico Turri <enricoturri@seznam.cz> | 2018-09-07 15:21:04 +0300 |
commit | e1deb03d3cc469f29aff0bfe461b782330526250 (patch) | |
tree | fabcfa050ba2d5b653560e917210ccc7580405c2 /xs/src/libslic3r | |
parent | 775ec1b5467d0d27776bc6c598cda010d1137f2c (diff) |
Added perl callback for three doubles
Diffstat (limited to 'xs/src/libslic3r')
-rw-r--r-- | xs/src/libslic3r/Utils.hpp | 3 | ||||
-rw-r--r-- | xs/src/libslic3r/utils.cpp | 21 |
2 files changed, 21 insertions, 3 deletions
diff --git a/xs/src/libslic3r/Utils.hpp b/xs/src/libslic3r/Utils.hpp index 349222854..f1390b8a2 100644 --- a/xs/src/libslic3r/Utils.hpp +++ b/xs/src/libslic3r/Utils.hpp @@ -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: diff --git a/xs/src/libslic3r/utils.cpp b/xs/src/libslic3r/utils.cpp index 55164bbdd..95aaf5453 100644 --- a/xs/src/libslic3r/utils.cpp +++ b/xs/src/libslic3r/utils.cpp @@ -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) |