summaryrefslogtreecommitdiffstats
path: root/matlab
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <wjp@usecode.org>2016-11-18 09:06:40 -0800
committerGitHub <noreply@github.com>2016-11-18 09:06:40 -0800
commit7f284de17492cba08848821387c8c49e7348f02c (patch)
tree323747764903567f0de3b484bc202059637d5ac9 /matlab
parent6c9756b1d26d1e920b12cdcf8580362690427ddc (diff)
parent64a48bea80b909311351dc3b1345a17c693ddb69 (diff)
downloadastra-7f284de17492cba08848821387c8c49e7348f02c.tar.gz
astra-7f284de17492cba08848821387c8c49e7348f02c.tar.bz2
astra-7f284de17492cba08848821387c8c49e7348f02c.tar.xz
astra-7f284de17492cba08848821387c8c49e7348f02c.zip
Merge pull request #73 from wjp/octave
Add experimental support for Octave
Diffstat (limited to 'matlab')
-rw-r--r--matlab/mex/mexDataManagerHelpFunctions.cpp12
-rw-r--r--matlab/mex/octave_support.cpp44
2 files changed, 50 insertions, 6 deletions
diff --git a/matlab/mex/mexDataManagerHelpFunctions.cpp b/matlab/mex/mexDataManagerHelpFunctions.cpp
index 1794abb..a514565 100644
--- a/matlab/mex/mexDataManagerHelpFunctions.cpp
+++ b/matlab/mex/mexDataManagerHelpFunctions.cpp
@@ -42,10 +42,10 @@ $Id$
#ifdef USE_MATLAB_UNDOCUMENTED
extern "C" {
mxArray *mxCreateSharedDataCopy(const mxArray *pr);
-bool mxUnshareArray(const mxArray *pr, const bool noDeepCopy);
-mxArray *mxUnreference(const mxArray *pr);
+bool mxUnshareArray(mxArray *pr, bool noDeepCopy);
+mxArray *mxUnreference(mxArray *pr);
#if 0
-// Unsupported in Matlab R2014b
+// Unsupported in Matlab R2014b and later
bool mxIsSharedArray(const mxArray *pr);
#endif
}
@@ -66,12 +66,12 @@ public:
// First unshare the input array, so that we may modify it.
if (bUnshare) {
#if 0
- // Unsupported in Matlab R2014b
+ // Unsupported in Matlab R2014b and later
if (mxIsSharedArray(_pArray)) {
fprintf(stderr, "Performance note: unsharing shared array in link\n");
}
#endif
- mxUnshareArray(_pArray, false);
+ mxUnshareArray(const_cast<mxArray*>(_pArray), false);
//fprintf(stderr, "Unshared:\narray: %p\tdata: %p\n", (void*)_pArray, (void*)mxGetData(_pArray));
}
// Then create a (persistent) copy so the data won't be deleted
@@ -79,7 +79,7 @@ public:
m_pLink = mxCreateSharedDataCopy(_pArray);
//fprintf(stderr, "SharedDataCopy:\narray: %p\tdata: %p\n", (void*)m_pLink, (void*)mxGetData(m_pLink));
mexMakeArrayPersistent(m_pLink);
- m_fPtr = (float *)mxGetData(m_pLink);
+ m_fPtr = (float *)mxGetData(_pArray);
m_fPtr += iOffset;
}
virtual ~CFloat32CustomMemoryMatlab3D() {
diff --git a/matlab/mex/octave_support.cpp b/matlab/mex/octave_support.cpp
new file mode 100644
index 0000000..ed04bf0
--- /dev/null
+++ b/matlab/mex/octave_support.cpp
@@ -0,0 +1,44 @@
+/*
+-----------------------------------------------------------------------
+Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp
+ 2014-2016, CWI, Amsterdam
+
+Contact: astra@uantwerpen.be
+Website: http://sf.net/projects/astra-toolbox
+
+This file is part of the ASTRA Toolbox.
+
+
+The ASTRA Toolbox is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+The ASTRA Toolbox is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with the ASTRA Toolbox. If not, see <http://www.gnu.org/licenses/>.
+
+-----------------------------------------------------------------------
+*/
+
+#include <oct.h>
+
+extern "C" {
+
+bool utIsInterruptPending() {
+ return octave_signal_caught;
+}
+
+mxArray *mxCreateSharedDataCopy(const mxArray *) {
+ return 0;
+}
+
+bool mxUnshareArray(mxArray *, bool) {
+ return false;
+}
+
+}