# HG changeset patch # User joh342@DHLRI-0810.OSUMC.EDU # Date 1374850120 14400 # Node ID e9e0b73094bba50115470836e51c2aad516f7d06 # Parent d5f634d5b852fc896d7eb6de4cec5756302fc01f fixed int64 problems in the penalty_mex.c file by using mwSize more often added a separate .h file to deal with compilers lacking mwSize. diff -r d5f634d5b852 -r e9e0b73094bb irt/mex/src/def/def,mexarg.h --- a/irt/mex/src/def/def,mexarg.h Thu Jul 25 10:45:42 2013 -0400 +++ b/irt/mex/src/def/def,mexarg.h Fri Jul 26 10:48:40 2013 -0400 @@ -18,15 +18,7 @@ #define jf_clock ( (clock() - jf_clock_store) / (double) CLOCKS_PER_SEC ) #endif - -// Matlab 2006b release changed many things -// to use mwSize and mwIndex, to support 64bit. -// I include these for backwards compatibility. - -#if defined(Need_mwIndex_int) - typedef int mwSize; - typedef int mwIndex; -#endif +#include "def,mwSizePatch.h" // mexarg.c typedef Const mxArray *Cmx; diff -r d5f634d5b852 -r e9e0b73094bb irt/mex/src/def/def,mwSizePatch.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/irt/mex/src/def/def,mwSizePatch.h Fri Jul 26 10:48:40 2013 -0400 @@ -0,0 +1,34 @@ +// def,mwSizePatch.h +// Moved mwSize stuff here so that the function declarations can use const mwSize for arguments. +// David Johnson + +#ifndef DefmwSizePatch +#define DefmwSizePatch + + +// Matlab 2006b release changed many things +// to use mwSize and mwIndex, to support 64bit. +// I include these for backwards compatibility. + +#if defined(Need_mwIndex_int) + typedef int mwSize; + typedef int mwIndex; + typedef const int cmwSize; +#endif + + +#if defined(Mmex) + +#include "mex.h" + +// 64-bit support: use the Matlab convention for dimensions, which are defined const by matlab +typedef const mwSize cmwSize; + +#endif // Mmex + + + + + + +#endif // DefmwSizePatch diff -r d5f634d5b852 -r e9e0b73094bb irt/mex/src/penalty/defs-misc.h --- a/irt/mex/src/penalty/defs-misc.h Thu Jul 25 10:45:42 2013 -0400 +++ b/irt/mex/src/penalty/defs-misc.h Fri Jul 26 10:48:40 2013 -0400 @@ -7,6 +7,7 @@ #define DefMisc #include "defs-env.h" +#include "def,mwSizePatch.h" /* penalty,diff.c */ #if 0 @@ -17,8 +18,8 @@ extern sof penalty_diff2_wk_tight(float *, cfloat *, cint *, cint, cint *, cint, cdouble); extern sof penalty_diff2_wk_leak(float *, cfloat *, cint *, cint, cint *, cint, cdouble); #endif -extern sof penalty_diff_wk_tight(float *, cfloat *, cint *, cint, cint *, cint, cdouble, cint); -extern sof penalty_diff_wk_leak(float *, cfloat *, cint *, cint, cint *, cint, cdouble, cint); +extern sof penalty_diff_wk_tight(float *, cfloat *, cmwSize *, cint, cint *, cint, cdouble, cint); +extern sof penalty_diff_wk_leak(float *, cfloat *, cmwSize *, cint, cint *, cint, cdouble, cint); #if 0 extern void penalty_diff1_forw_offset(float *, cfloat *, cint, cint); extern void penalty_diff1_forw2_offset(float *, cfloat *, cint, cint); diff -r d5f634d5b852 -r e9e0b73094bb irt/mex/src/penalty/penalty,diff.c --- a/irt/mex/src/penalty/penalty,diff.c Thu Jul 25 10:45:42 2013 -0400 +++ b/irt/mex/src/penalty/penalty,diff.c Fri Jul 26 10:48:40 2013 -0400 @@ -142,7 +142,7 @@ sof penalty_diff_wk_tight( float *po, /* [[dim_i],noffset], each mask */ cfloat *kappa, /* [[dim_i]] "kappa" array or mask */ -cint *dim_i, /* [nod_i] */ +cmwSize *dim_i, /* [nod_i] */ cint nod_i, /* # of dim of mask */ cint *offset, /* [noffset] */ cint noffset, @@ -220,7 +220,7 @@ sof penalty_diff_wk_leak( float *po, /* [[dim_i],noffset], each mask */ cfloat *kappa, /* [[dim_i]] "kappa" array or mask */ -cint *dim_i, /* [nod_i] */ +cmwSize *dim_i, /* [nod_i] */ cint nod_i, /* # of dim of mask */ cint *offset, /* [noffset] */ cint noffset, diff -r d5f634d5b852 -r e9e0b73094bb irt/mex/src/penalty/penalty_mex.c --- a/irt/mex/src/penalty/penalty_mex.c Thu Jul 25 10:45:42 2013 -0400 +++ b/irt/mex/src/penalty/penalty_mex.c Fri Jul 26 10:48:40 2013 -0400 @@ -75,8 +75,8 @@ int n_offset; int nod_i; int nod_o; - cint *dim_i; - int dim_o[Max_ndim+1]; + cmwSize *dim_i; + mwSize dim_o[Max_ndim+1]; if (nlhs != 1 || nrhs != 4) { penalty_mex_help(); @@ -155,8 +155,8 @@ int n_offset; int nod_i; int nod_o; - cint *dim_i; - int dim_o[Max_ndim+1]; + cmwSize *dim_i; + mwSize dim_o[Max_ndim+1]; if (nlhs != 1 || nrhs < 3 || nrhs > 4) { penalty_mex_help(); @@ -249,9 +249,9 @@ int nr = 1; /* # of realizations */ int n_offset; int nod_i; - cint *dim_i; + cmwSize *dim_i; int nod_o; - int dim_o[Max_ndim]; + mwSize dim_o[Max_ndim]; if (nlhs != 1 || nrhs < 3 || nrhs > 4) { penalty_mex_help();