diff options
author | bubnikv <bubnikv@gmail.com> | 2018-11-26 16:41:58 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2018-11-26 16:41:58 +0300 |
commit | a378bb7bed57f036441075928cd14f252c45ef7f (patch) | |
tree | db3ab427fbd49a67f1cb5638861758e0fc6a0a0e /xs | |
parent | 63faa917a99fd08239cab7ff920bfa9f0648bbbc (diff) |
Removed some obsolete Perl bindings.
Removed libslic3r from the default include paths for all modules but
libslic3r. Now headers from libslic3r need to be included with an
explicit path (libslic3r/libslic3r.h etc)
Split the localization macros into I18N.{cpp,h}
Diffstat (limited to 'xs')
-rw-r--r-- | xs/CMakeLists.txt | 6 | ||||
-rw-r--r-- | xs/src/callback.cpp | 175 | ||||
-rw-r--r-- | xs/src/callback.hpp | 33 |
3 files changed, 1 insertions, 213 deletions
diff --git a/xs/CMakeLists.txt b/xs/CMakeLists.txt index 27228dacf..f14499bf9 100644 --- a/xs/CMakeLists.txt +++ b/xs/CMakeLists.txt @@ -99,11 +99,7 @@ else() endif() add_library(XS ${XS_SHARED_LIBRARY_TYPE} ${XS_MAIN_CPP} -# ${LIBDIR}/libslic3r/utils.cpp -# ${LIBDIR}/slic3r/GUI/wxPerlIface.cpp src/perlglue.cpp -# src/callback.cpp -# src/callback.hpp src/ppport.h src/xsinit.h xsp/my.map @@ -119,7 +115,7 @@ if(APPLE) endif() target_link_libraries(XS libslic3r) -target_include_directories(XS PRIVATE src) +target_include_directories(XS PRIVATE src ${LIBDIR}/libslic3r) target_compile_definitions(XS PRIVATE -DSLIC3RXS) set_target_properties(XS PROPERTIES PREFIX "") # Prevent cmake from generating libXS.so instead of XS.so diff --git a/xs/src/callback.cpp b/xs/src/callback.cpp deleted file mode 100644 index 3d2a8e903..000000000 --- a/xs/src/callback.cpp +++ /dev/null @@ -1,175 +0,0 @@ -#include "callback.hpp" - -#include <xsinit.h> - -void PerlCallback::register_callback(void *sv) -{ - if (! SvROK((SV*)sv) || SvTYPE(SvRV((SV*)sv)) != SVt_PVCV) - croak("Not a Callback %_ for PerlFunction", (SV*)sv); - if (m_callback) - SvSetSV((SV*)m_callback, (SV*)sv); - else - m_callback = newSVsv((SV*)sv); -} - -void PerlCallback::deregister_callback() -{ - if (m_callback) { - sv_2mortal((SV*)m_callback); - m_callback = nullptr; - } -} - -void PerlCallback::call() const -{ - if (! m_callback) - return; - dSP; - ENTER; - SAVETMPS; - PUSHMARK(SP); - PUTBACK; - perl_call_sv(SvRV((SV*)m_callback), G_DISCARD); - FREETMPS; - LEAVE; -} - -void PerlCallback::call(int i) const -{ - if (! m_callback) - return; - dSP; - ENTER; - SAVETMPS; - PUSHMARK(SP); - XPUSHs(sv_2mortal(newSViv(i))); - PUTBACK; - perl_call_sv(SvRV((SV*)m_callback), G_DISCARD); - FREETMPS; - LEAVE; -} - -void PerlCallback::call(int i, int j) const -{ - if (! m_callback) - return; - dSP; - ENTER; - SAVETMPS; - PUSHMARK(SP); - XPUSHs(sv_2mortal(newSViv(i))); - XPUSHs(sv_2mortal(newSViv(j))); - PUTBACK; - perl_call_sv(SvRV((SV*)m_callback), G_DISCARD); - FREETMPS; - LEAVE; -} - -void PerlCallback::call(const std::vector<int>& ints) const -{ - if (! m_callback) - return; - dSP; - ENTER; - SAVETMPS; - PUSHMARK(SP); - for (int i : ints) - { - XPUSHs(sv_2mortal(newSViv(i))); - } - PUTBACK; - perl_call_sv(SvRV((SV*)m_callback), G_DISCARD); - FREETMPS; - LEAVE; -} - -void PerlCallback::call(double a) const -{ - if (!m_callback) - return; - dSP; - ENTER; - SAVETMPS; - PUSHMARK(SP); - XPUSHs(sv_2mortal(newSVnv(a))); - PUTBACK; - perl_call_sv(SvRV((SV*)m_callback), G_DISCARD); - FREETMPS; - LEAVE; -} - -void PerlCallback::call(double a, double b) const -{ - if (!m_callback) - return; - dSP; - ENTER; - SAVETMPS; - PUSHMARK(SP); - XPUSHs(sv_2mortal(newSVnv(a))); - XPUSHs(sv_2mortal(newSVnv(b))); - PUTBACK; - perl_call_sv(SvRV((SV*)m_callback), G_DISCARD); - FREETMPS; - 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) - return; - dSP; - ENTER; - SAVETMPS; - PUSHMARK(SP); - XPUSHs(sv_2mortal(newSVnv(a))); - XPUSHs(sv_2mortal(newSVnv(b))); - XPUSHs(sv_2mortal(newSVnv(c))); - XPUSHs(sv_2mortal(newSVnv(d))); - PUTBACK; - perl_call_sv(SvRV((SV*)m_callback), G_DISCARD); - FREETMPS; - LEAVE; -} - -void PerlCallback::call(double a, double b, double c, double d, double e, double f) 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))); - XPUSHs(sv_2mortal(newSVnv(d))); - XPUSHs(sv_2mortal(newSVnv(e))); - XPUSHs(sv_2mortal(newSVnv(f))); - PUTBACK; - perl_call_sv(SvRV((SV*)m_callback), G_DISCARD); - FREETMPS; - LEAVE; -} - -void PerlCallback::call(bool b) const -{ - call(b ? 1 : 0); -}
\ No newline at end of file diff --git a/xs/src/callback.hpp b/xs/src/callback.hpp deleted file mode 100644 index ee7a5eadf..000000000 --- a/xs/src/callback.hpp +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef slic3r_PerlCallback_hpp_ -#define slic3r_PerlCallback_hpp_ - -#include <locale> - -#include "libslic3r.h" - -namespace Slic3r { - -class PerlCallback { -public: - PerlCallback(void *sv) : m_callback(nullptr) { this->register_callback(sv); } - PerlCallback() : m_callback(nullptr) {} - ~PerlCallback() { this->deregister_callback(); } - void register_callback(void *sv); - void deregister_callback(); - void call() const; - void call(int i) const; - void call(int i, int j) const; - void call(const std::vector<int>& ints) 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(double a, double b, double c, double d, double e, double f) const; - void call(bool b) const; -private: - void *m_callback; -}; - -} // namespace Slic3r - -#endif /* slic3r_PerlCallback_hpp_ */ |