Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2018-09-18 11:09:58 +0300
committerbubnikv <bubnikv@gmail.com>2018-09-18 11:09:58 +0300
commit3ddaccb6410478ad02d8c0e02d6d8e6eb1785b9f (patch)
tree97e9b632bdd5abc546d951771f144fe5b1d6ac73 /xs/src/xsinit.h
parent27bba453312d59898f773aa54d7b625e65fc501e (diff)
Replaced CONFESS with throw std::exception in libslic3r, so now
libslic3r should be compilable without Perl.
Diffstat (limited to 'xs/src/xsinit.h')
-rw-r--r--xs/src/xsinit.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/xs/src/xsinit.h b/xs/src/xsinit.h
index c9e363602..47d71a09f 100644
--- a/xs/src/xsinit.h
+++ b/xs/src/xsinit.h
@@ -209,6 +209,41 @@ SV* to_SV(TriangleMesh* THIS);
// Return a pointer to the associated wxWidgets object instance given by classname.
extern void* wxPli_sv_2_object( pTHX_ SV* scalar, const char* classname );
+inline void confess_at(const char *file, int line, const char *func, const char *pat, ...)
+{
+ #ifdef SLIC3RXS
+ va_list args;
+ SV *error_sv = newSVpvf("Error in function %s at %s:%d: ", func,
+ file, line);
+
+ va_start(args, pat);
+ sv_vcatpvf(error_sv, pat, &args);
+ va_end(args);
+
+ sv_catpvn(error_sv, "\n\t", 2);
+
+ dSP;
+ ENTER;
+ SAVETMPS;
+ PUSHMARK(SP);
+ XPUSHs( sv_2mortal(error_sv) );
+ PUTBACK;
+ call_pv("Carp::confess", G_DISCARD);
+ FREETMPS;
+ LEAVE;
+ #endif
+}
+
+#ifndef CONFESS
+/* Implementation of CONFESS("foo"): */
+#ifdef _MSC_VER
+ #define CONFESS(...) confess_at(__FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
+#else
+ #define CONFESS(...) confess_at(__FILE__, __LINE__, __func__, __VA_ARGS__)
+#endif
+/* End implementation of CONFESS("foo"): */
+#endif /* CONFESS */
+
using namespace Slic3r;
#endif