Diff of /mex/ltfat_mex_template_helper.h [dbf0ef] .. [6db11f]  Maximize  Restore

Switch to unified view

a/mex/ltfat_mex_template_helper.h b/mex/ltfat_mex_template_helper.h
...
...
76
       Only for Linux. In conjuction with compiler flag -fvisibility=hidden
76
       Only for Linux. In conjuction with compiler flag -fvisibility=hidden
77
       export symbols of functions only with EXPORT_EXTERN_C (used also in mex.h).
77
       export symbols of functions only with EXPORT_EXTERN_C (used also in mex.h).
78
 **/
78
 **/
79
#if defined(_WIN32) || defined(__WIN32__)
79
#if defined(_WIN32) || defined(__WIN32__)
80
#  define DLL_EXPORT_SYM __declspec(dllexport)
80
#  define DLL_EXPORT_SYM __declspec(dllexport)
81
#  define EXPORT_SYM __declspec(dllexport)
81
#else
82
#else
82
#  define EXPORT_EXTERN_C __attribute__((visibility("default")))
83
#  define EXPORT_EXTERN_C __attribute__((visibility("default")))
84
#  define EXPORT_SYM __attribute__((visibility("default")))
83
#endif
85
#endif
84
86
85
87
86
/** Template macros */
88
/** Template macros */
87
#define LTFAT_CAT(prefix,name) prefix##name
89
#define LTFAT_CAT(prefix,name) prefix##name
...
...
109
#include "ltfat.h"
111
#include "ltfat.h"
110
#include <stdio.h>
112
#include <stdio.h>
111
#include <string.h>
113
#include <string.h>
112
#include <mex.h>
114
#include <mex.h>
113
/* This is just for the case when we want to skip registration of the atExit function */
115
/* This is just for the case when we want to skip registration of the atExit function */
116
EXPORT_SYM
114
static inline void mexFunctionInner( int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[] );
117
void mexFunctionInner( int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[] );
115
/** C99 headers for a generic complex number manipulations */
118
/** C99 headers for a generic complex number manipulations */
116
#if (defined(COMPLEXINDEPENDENT)||defined(COMPLEXARGS)) && !defined(NOCOMPLEXFMTCHANGE)
119
#if (defined(COMPLEXINDEPENDENT)||defined(COMPLEXARGS)) && !defined(NOCOMPLEXFMTCHANGE)
117
#  include <complex.h>
120
#  include <complex.h>
118
//#  include <tgmath.h>
121
//#  include <tgmath.h>
119
#endif
122
#endif
...
...
146
/*
149
/*
147
  If EXPORTALIAS macro is set, a wrapper function for the mexFunction is created.
150
  If EXPORTALIAS macro is set, a wrapper function for the mexFunction is created.
148
  This allows to call the MEX function from another MEX function without having to
151
  This allows to call the MEX function from another MEX function without having to
149
  deal with which mexFunction to call.
152
  deal with which mexFunction to call.
150
*/
153
*/
151
#  ifdef DLL_EXPORT_SYM
152
DLL_EXPORT_SYM
154
EXPORT_SYM
153
#  endif
154
#  ifdef EXPORT_EXTERN_C
155
EXPORT_EXTERN_C
156
#  endif
157
void EXPORTALIAS( int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[] );
155
void EXPORTALIAS( int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[] );
158
156
159
void EXPORTALIAS( int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[] )
157
void EXPORTALIAS( int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[] )
160
{
158
{
161
   mexFunctionInner(nlhs,plhs,nrhs,prhs);
159
   mexFunctionInner(nlhs,plhs,nrhs,prhs);
162
}
160
}
163
161
164
#  ifdef DLL_EXPORT_SYM
165
DLL_EXPORT_SYM
162
EXPORT_SYM
166
#  endif
167
#  ifdef EXPORT_EXTERN_C
168
EXPORT_EXTERN_C
169
#  endif
170
171
void STR(EXPORTALIAS)();
163
void STR(EXPORTALIAS)();
172
164
173
void STR(EXPORTALIAS)()
165
void STR(EXPORTALIAS)()
174
{
166
{
175
   ltfatMexAtExitGlobal();
167
   ltfatMexAtExitGlobal();
...
...
504
       mexAtExit(ltfatMexAtExitGlobal);
496
       mexAtExit(ltfatMexAtExitGlobal);
505
       exitFncRegistered = 1;
497
       exitFncRegistered = 1;
506
   }
498
   }
507
499
508
  mexFunctionInner(nlhs,plhs,nrhs,prhs);
500
  mexFunctionInner(nlhs,plhs,nrhs,prhs);
509
  
501
510
 }
502
 }
511
503
512
static inline void mexFunctionInner(int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[])
504
void mexFunctionInner(int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[])
513
{
505
{
514
   #ifdef MEX_BEGINNING_HOOK
506
   #ifdef MEX_BEGINNING_HOOK
515
   MEX_BEGINNING_HOOK
507
   MEX_BEGINNING_HOOK
516
   #endif
508
   #endif
517
   #if defined(ISNARGINEQ) || defined(ISNARGINLE) || defined(ISNARGINGE)
509
   #if defined(ISNARGINEQ) || defined(ISNARGINLE) || defined(ISNARGINGE)
...
...
644
           LTFAT_NAME_COMPLEXDOUBLE(ltfatMexFnc)(nlhs,plhs,nrhs, prhsAlt);
636
           LTFAT_NAME_COMPLEXDOUBLE(ltfatMexFnc)(nlhs,plhs,nrhs, prhsAlt);
645
637
646
        #else
638
        #else
647
          LTFAT_NAME_DOUBLE(ltfatMexFnc)(nlhs,plhs,nrhs,prhsAlt);
639
          LTFAT_NAME_DOUBLE(ltfatMexFnc)(nlhs,plhs,nrhs,prhsAlt);
648
        #endif
640
        #endif
649
      
641
650
        #if defined(TYPEDEPARGS) && ((defined(COMPLEXINDEPENDENT) || defined(COMPLEXARGS) || defined(REALARGS)) && !defined(NOCOMPLEXFMTCHANGE))
642
        #if defined(TYPEDEPARGS) && ((defined(COMPLEXINDEPENDENT) || defined(COMPLEXARGS) || defined(REALARGS)) && !defined(NOCOMPLEXFMTCHANGE))
651
        if(!checkIsReal(plhs[0]))
643
        if(!checkIsReal(plhs[0]))
652
           plhs[0] = LTFAT_NAME_DOUBLE(mexCombined2split)(plhs[0]);
644
           plhs[0] = LTFAT_NAME_DOUBLE(mexCombined2split)(plhs[0]);
653
        #endif
645
        #endif
654
646