From cc2e917ad6b826da578180095d74d788893d96e3 Mon Sep 17 00:00:00 2001 From: Robin Deits Date: Tue, 5 Jan 2016 12:50:56 -0500 Subject: [PATCH 1/2] fix duplicate colon matlab error identifiers Matlab error IDs must consist only of words and single colon separators, but runtime errors that get passed up the chain currently use a double colon (SWIG::RuntimeError) which causes Matlab to complain: "The error message identifier is invalid." The fix is to remove the duplicate colon --- Source/Modules/matlab.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Modules/matlab.cxx b/Source/Modules/matlab.cxx index 1468e566b6f..e93b81443f2 100644 --- a/Source/Modules/matlab.cxx +++ b/Source/Modules/matlab.cxx @@ -432,10 +432,10 @@ int MATLAB::top(Node *n) { Iterator i = First(l_modules); if (i.item) { Printf(f_init, "mxArray *id = mxCreateDoubleScalar(double(4)), *error;\n"); - Printf(f_init, "if (!id) mexErrMsgIdAndTxt(\"SWIG::RuntimeError\", \"Setup failed\");\n"); + Printf(f_init, "if (!id) mexErrMsgIdAndTxt(\"SWIG:RuntimeError\", \"Setup failed\");\n"); for (; i.item; i = Next(i)) { Printf(f_init, "error = mexCallMATLABWithTrap(0, 0, 1, &id, \"%s\");\n", i.item); - Printf(f_init, "if (error) mexErrMsgIdAndTxt(\"SWIG::RuntimeError\", \"Cannot initialize %s\");\n", i.item); + Printf(f_init, "if (error) mexErrMsgIdAndTxt(\"SWIG:RuntimeError\", \"Cannot initialize %s\");\n", i.item); Delete(i.item); } Printf(f_init, "mxDestroyArray(id);\n"); From 388538c104e2cbf0450f37dd2c0020bdb637f44c Mon Sep 17 00:00:00 2001 From: Robin Deits Date: Tue, 5 Jan 2016 13:01:17 -0500 Subject: [PATCH 2/2] fix another instance --- Lib/matlab/matlabtypemaps.swg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/matlab/matlabtypemaps.swg b/Lib/matlab/matlabtypemaps.swg index 715e42927c8..c670617ddf1 100644 --- a/Lib/matlab/matlabtypemaps.swg +++ b/Lib/matlab/matlabtypemaps.swg @@ -19,7 +19,7 @@ #define SWIG_SetConstant(name, obj) SWIG_Matlab_SetConstant(module_ns,name,obj) // raise -#define SWIG_Matlab_Raise(OBJ, TYPE, DESC) mexErrMsgIdAndTxt("SWIG::RuntimeError", "C++ side threw an exception of type " TYPE) +#define SWIG_Matlab_Raise(OBJ, TYPE, DESC) mexErrMsgIdAndTxt("SWIG:RuntimeError", "C++ side threw an exception of type " TYPE) #define SWIG_Raise(obj, type, desc) SWIG_Matlab_Raise(obj, type, desc) /* directors are supported in Matlab */