summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2022-09-19 14:48:33 +0100
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2022-09-19 14:48:33 +0100
commite407ccd4fe53400d250d00e0c144b1def2966a2d (patch)
tree23c5e6821e6bb0c831dcbd38e12b2b1246662574
parented333b6b9720e0569cd3c7ccee8f1fc1b60da9f8 (diff)
downloadswig-e407ccd4fe53400d250d00e0c144b1def2966a2d.tar.gz
Move SWIG_Octave_Raise into a function
For efficiency and to fix some warnings
-rw-r--r--Lib/octave/octtypemaps.swg11
1 files changed, 9 insertions, 2 deletions
diff --git a/Lib/octave/octtypemaps.swg b/Lib/octave/octtypemaps.swg
index 8962d1b71..652112312 100644
--- a/Lib/octave/octtypemaps.swg
+++ b/Lib/octave/octtypemaps.swg
@@ -32,8 +32,15 @@
#define SWIG_SetConstant(name, obj) SWIG_Octave_SetConstant(module_ns,name,obj)
// raise
-#define SWIG_Octave_Raise(OBJ, TYPE, DESC) error(OBJ.is_string() ? OBJ.string_value().c_str() : "C++ side threw an exception of type " TYPE)
-#define SWIG_Raise(obj, type, desc) SWIG_Octave_Raise(obj, type, desc)
+%runtime %{
+void SWIG_Octave_Raise(const octave_value &obj, const char *type) {
+ if (obj.is_string())
+ error("%s", obj.string_value().c_str());
+ else
+ error("C++ side threw an exception of type %s", type);
+}
+%}
+#define SWIG_Raise(obj, type, desc) SWIG_Octave_Raise(obj, type)
// Include the unified typemap library
%include <typemaps/swigtypemaps.swg>