void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
    /* Initialize the memory manager. */
    mexAtExit(drr_good_151204_atexit_wrapper);
    /* Dispatch the entry-point. */
    drr_good_151204_mexFunction(nlhs, plhs, nrhs, prhs);
}
void mexFunction(int32_T nlhs, mxArray *plhs[], int32_T nrhs, const mxArray
                 *prhs[])
{
  emlrtStack st = { NULL, NULL, NULL };

  mexAtExit(rffe_test_atexit);

  /* Initialize the memory manager. */
  omp_init_lock(&emlrtLockGlobal);
  omp_init_nest_lock(&emlrtNestLockGlobal);
  emlrtLoadLibrary("/usr/local/MATLAB/R2015b/sys/os/glnxa64/libiomp5.so");

  /* Module initialization. */
  rffe_test_initialize();
  st.tls = emlrtRootTLSGlobal;
  emlrtSetJmpBuf(&st, &emlrtJBEnviron);
  if (setjmp(emlrtJBEnviron) == 0) {
    /* Dispatch the entry-point. */
    rffe_test_mexFunction(nlhs, plhs, nrhs, prhs);
    omp_destroy_lock(&emlrtLockGlobal);
    omp_destroy_nest_lock(&emlrtNestLockGlobal);
  } else {
    omp_destroy_lock(&emlrtLockGlobal);
    omp_destroy_nest_lock(&emlrtNestLockGlobal);
    emlrtReportParallelRunTimeError(&st);
  }
}
Пример #3
0
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[] )
{
    ymx_debug_msg("Entering mexFunction\n");
    mexAtExit(ymx_persistent_cleanup);
    
    if (nrhs == 0) {
        command_help(nlhs, plhs, 0, NULL);
        return;
    }
    if (!mxIsChar(prhs[0]) || mxGetM(prhs[0]) != 1)
    {
        mexErrMsgTxt("First input must be a string.");
    }
    char *command = mxArrayToString(prhs[0]);
    if (strcmp(command, "load") == 0) {
        command_load(nlhs, plhs, nrhs-1, prhs+1);
    } else if (strcmp(command, "dump") == 0) {
        command_dump(nlhs, plhs, nrhs-1, prhs+1);
    } else if (strcmp(command, "help") == 0) {
        command_help(nlhs, plhs, nrhs-1, prhs+1);
    } else {
        command_help(nlhs, plhs, 0, NULL);
    }
    ymx_debug_msg("plhs: %d\n", plhs);
    ymx_debug_msg("plhs[0]: %d\n", plhs[0]);
    mxFree(command);
    ymx_debug_msg("Exiting mexFunction\n");
}
Пример #4
0
void mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
    if (!fg)
    {
        fg = new matleap::frame_grabber;
        if (fg == 0)
            mexErrMsgTxt ("Cannot allocate a frame grabber");
        mexAtExit (matleap_exit);
    }
    switch (get_command (nlhs, plhs, nrhs, prhs))
    {
        // turn on debug
        case -1:
        fg->set_debug (true);
        return;
        // get version
        case 0:
        plhs[0] = mxCreateNumericMatrix (1, 2, mxDOUBLE_CLASS, mxREAL);
        *(mxGetPr (plhs[0]) + 0) = MAJOR_REVISION;
        *(mxGetPr (plhs[0]) + 1) = MINOR_REVISION;
        return;
        // get frame
        case 1:
        get_frame (nlhs, plhs);
        return;
        default:
        // this is a logic error
        mexErrMsgTxt ("unknown error: please contact developer");
    }
}
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
  /* Initialize the memory manager. */
  mexAtExit(JenkinsCompare_atexit_wrapper);
  /* Dispatch the entry-point. */
  JenkinsCompare_mexFunction(nlhs, plhs, nrhs, prhs);
}
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
  /* Initialize the memory manager. */
  mexAtExit(composeCPPPrediction_atexit_wrapper);
  /* Dispatch the entry-point. */
  composeCPPPrediction_mexFunction(nlhs, plhs, nrhs, prhs);
}
Пример #7
0
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
  /* Initialize the memory manager. */
  mexAtExit(GetEdgesVectors_atexit_wrapper);
  /* Dispatch the entry-point. */
  GetEdgesVectors_mexFunction(nlhs, plhs, nrhs, prhs);
}
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
  /* Initialize the memory manager. */
  mexAtExit(transform_mag_atexit_wrapper);
  /* Dispatch the entry-point. */
  transform_mag_mexFunction(nlhs, plhs, nrhs, prhs);
}
Пример #9
0
/* This function adds a new item to the host/port/socket list without checking if
	the same element is already there. Also registers the cleanup routine.
*/
int add_hps_item(const char *hostname, int port, int sock) {
	host_port_sock_list_item_t *hpsli;
	int n;
	
	if (hostname == NULL) return 0;
	n = strlen(hostname);

		
	hpsli = (host_port_sock_list_item_t *) malloc(sizeof(host_port_sock_list_item_t));
	if (hpsli == NULL) return 0;	/* out of memory - probably never */
	
	hpsli->hostname = (char *) malloc(n+1);
	if (hpsli->hostname == NULL) {
		/* out of memory - probably never */
		free(hpsli);
		return 0;    
	}
	memcpy(hpsli->hostname, hostname, n+1);
	
	hpsli->port = port;
	hpsli->sock = sock;
	hpsli->next = firstHostPortSock;
	firstHostPortSock = hpsli;
	
	mexAtExit(exitFun);   /* register cleanup routine so the list get's properly destroyed */
	return 1;
}
Пример #10
0
void init() {
  PmError err1;
  PtError err2;
  
  if (isInit) return;
  
  mexPrintf("Initialising PortMidi\n");
  
  MUTEX_LOCK;
  note      = malloc(INPUT_BUFFER_SIZE*sizeof(int32_t));
  channel   = malloc(INPUT_BUFFER_SIZE*sizeof(int32_t));
  velocity  = malloc(INPUT_BUFFER_SIZE*sizeof(int32_t));
  timestamp = malloc(INPUT_BUFFER_SIZE*sizeof(int32_t));
  if (!(channel && note && velocity && timestamp)) {
    FREE(channel);
    FREE(note);
    FREE(velocity);
    FREE(timestamp);
    MUTEX_UNLOCK;
    mexErrMsgTxt("Could not allocate memory");
  }
  else {
    MUTEX_UNLOCK;
  }
  
  err1 = Pm_Initialize();
  reportPmError(err1);
  
  err2 = Pt_Start(1, receive_poll, NULL);
  reportPtError(err2);
  
  /* getting here means that PortMidi and PortTime are both fine */
  mexAtExit(exitFunction);
  isInit = 1;
}
void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) 
{
    //Entry points
    //------------
    //1) Initialize
    //2) Clear

    //  https://msdn.microsoft.com/en-us/library/windows/desktop/ms644990(v=vs.85).aspx
    //  1) WH_KEYBOARD_LL: Installs a hook procedure that monitors low-level keyboard input events.
    //  2) HOOKPROC - pointer to the hook procedure
    //  3) HINSTANCE - a handle to the dll containing the hook procedure - set
    //          to NULL if it comes from within code associated with the current
    //          process
    //  4) DWORD = the identifier of the thread with which the hook
    //      procedure is to be associated
    //      => I think this allows you to be more specific as to what
    //      you are listening to
    if (keyboard_hook == 0){
        
            shift_pressed = GetKeyState(VK_SHIFT) < 0;
            ctrl_pressed = GetKeyState(VK_CONTROL) < 0;
            caps_pressed = GetKeyState(VK_CAPITAL) == 1;
        
        keyboard_hook = SetWindowsHookEx(
                      WH_KEYBOARD_LL,      
                      keyboard_hook_procedure,    
                      NULL,            
                      0);
    }

    mexAtExit(CloseStream);

}
Пример #12
0
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
  /* Initialize the memory manager. */
  mexAtExit(naivePerfusionSSEP2X4_atexit_wrapper);
  /* Dispatch the entry-point. */
  naivePerfusionSSEP2X4_mexFunction(nlhs, plhs, nrhs, prhs);
}
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
  if(nrhs < 1)
    mexErrMsgTxt("At least one input argument is required.");
  if (nlhs > 1)
    mexErrMsgTxt("Too many output arguments.");
  
  btk::MergeAcquisitionFilter::Pointer merger = btk::MergeAcquisitionFilter::New();
  std::vector<btk::Acquisition::Pointer> acq(nrhs);
  for (int i = 0 ; i < nrhs ; ++i)
    merger->SetInput(i, btk_MOH_get_object<btk::Acquisition>(prhs[i]));

  // Redirection of the btk::Logger::Warning stream.
  btk::MEXWarnLogToWarnMsgTxt warnRedir = btk::MEXWarnLogToWarnMsgTxt("btk:MergeAcquisitions");
  
  merger->Update();
  
  plhs[0] = btk_MOH_create_handle(merger->GetOutput());
  
#if defined(__APPLE__) || (defined(BTK_BUILD_SHARED_LIBS) && defined(__unix__))
  // It seems to be related only to Linux with shared libraries
  // This fix was only tested with Matlab r2009a (7.8)
  // FIXME: This solution clear all the acquisitions and not only the ones 
  //        created from this function
  mexAtExit(btk::MEXHandleCollector<btk::Acquisition>::ManualClear);
#endif
};
Пример #14
0
// ================================================================================================
// FUNCTION  : mexVISA_Init()
// ------------------------------------------------------------------------------------------------
// Purpose   : Initialization of the mexVISA library
// Parameters: none
// ================================================================================================
void __cdecl mexVISA_Init(void)
{
    if( !mexVISA_IsInitialized )
    {
        mexAtExit(mexVISA_Close); // register library close (DLL Detach) process
        mexVISA_IsInitialized = 1;
    }
}
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
  /* Initialize the memory manager. */
  mexAtExit(heart_rate_official_cport_atexit);
  emlrtClearAllocCount(&emlrtContextGlobal, 0, 3, "ForceOff");
  /* Dispatch the entry-point. */
  heart_rate_official_cport_mexFunction(nlhs, plhs, nrhs, prhs);
}
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
  /* Initialize the memory manager. */
  mexAtExit(drr_SK_Simplified_atexit_wrapper);
  emlrtClearAllocCount(&emlrtContextGlobal, 0, 0, NULL);
  /* Dispatch the entry-point. */
  drr_SK_Simplified_mexFunction(nlhs, plhs, nrhs, prhs);
}
Пример #17
0
void ClassD_collectorInsertAndMakeBase_19(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{
  mexAtExit(&_deleteAllObjects);
  typedef boost::shared_ptr<ClassD> Shared;

  Shared *self = *reinterpret_cast<Shared**> (mxGetData(in[0]));
  collector_ClassD.insert(self);
}
Пример #18
0
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
  /* Initialize the memory manager. */
  mexAtExit(util_sub_normalized_dot_product_atexit_wrapper);
  emlrtClearAllocCount(&emlrtContextGlobal, 0, 0, NULL);
  /* Dispatch the entry-point. */
  util_sub_normalized_dot_product_mexFunction(nlhs, plhs, nrhs, prhs);
}
/* This is the main entry point from Matlab: */
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray*prhs[])
{
    int show = 1;
    
    mexAtExit(exitfunc);    
    if (nrhs > 0) show = (int) mxGetScalar(prhs[0]);
    showHide(show);
    return;
}
Пример #20
0
void mexFunction(int nlhs, mxArray *plhs[],
		 int nrhs, const mxArray *prhs[])
{
    
  mexAtExit(&at_exit);

  __mexFunction__(nlhs, plhs, nrhs, prhs);

}
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
  emlrtMexFunction method;
  method = emlrtGetMethod(nrhs, prhs, emlrtEntryPoints, 14);
  /* Initialize the memory manager. */
  mexAtExit(BoundaryElementHeatEquation_atexit_wrapper);
  /* Dispatch the entry-point. */
  method(nlhs, plhs, nrhs-1, prhs+1);
}
Пример #22
0
void ClassD_constructor_20(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{
  mexAtExit(&_deleteAllObjects);
  typedef boost::shared_ptr<ClassD> Shared;

  Shared *self = new Shared(new ClassD());
  collector_ClassD.insert(self);
  out[0] = mxCreateNumericMatrix(1, 1, mxUINT32OR64_CLASS, mxREAL);
  *reinterpret_cast<Shared**> (mxGetData(out[0])) = self;
}
Пример #23
0
void OpenEXRforMatlab::mexEXRInit()
{
    static bool initialized = false;
    if (!initialized) {
        // Use up to 75% of CPUs to avoid oversubscription
        const int numCPUs = (3*getNumCPUs() + 3) / 4;
        OPENEXR_IMF_INTERNAL_NAMESPACE::setGlobalThreadCount(numCPUs);
        mexAtExit(mexEXRExitCallback);
        initialized = true;
    }
}
Пример #24
0
void mexFunction(int32_T nlhs, mxArray *plhs[], int32_T nrhs, const mxArray
                 *prhs[])
{
    mexAtExit(ekf_update_atexit);

    /* Initialize the memory manager. */
    /* Module initialization. */
    ekf_update_initialize();

    /* Dispatch the entry-point. */
    ekf_update_mexFunction(nlhs, plhs, nrhs, prhs);
}
Пример #25
0
/*
 * Arguments    : int32_T nlhs
 *                const mxArray * const plhs[]
 *                int32_T nrhs
 *                const mxArray * const prhs[]
 * Return Type  : void
 */
void mexFunction(int32_T nlhs, mxArray *plhs[], int32_T nrhs, const mxArray
                 *prhs[])
{
  /* Initialize the memory manager. */
  mexAtExit(Csetminmax_atexit);

  /* Module initialization. */
  Csetminmax_initialize();

  /* Dispatch the entry-point. */
  Csetminmax_mexFunction(nlhs, plhs, nrhs, prhs);
}
void mexFunction(int32_T nlhs, mxArray *plhs[], int32_T nrhs, const mxArray
                 *prhs[])
{
  /* Initialize the memory manager. */
  mexAtExit(MechanicalSpringPointForce_atexit);

  /* Module initialization. */
  MechanicalSpringPointForce_initialize();

  /* Dispatch the entry-point. */
  c_MechanicalSpringPointForce_me(nlhs, plhs, nrhs, prhs);
}
void mexFunction(int32_T nlhs, mxArray *plhs[], int32_T nrhs, const mxArray
                 *prhs[])
{
  mexAtExit(ChhabraJensen_Yuj_w0_atexit);

  /* Initialize the memory manager. */
  /* Module initialization. */
  ChhabraJensen_Yuj_w0_initialize();

  /* Dispatch the entry-point. */
  c_ChhabraJensen_Yuj_w0_mexFunct(nlhs, plhs, nrhs, prhs);
}
void mexFunction(int32_T nlhs, mxArray *plhs[], int32_T nrhs, const mxArray
                 *prhs[])
{
  mexAtExit(getStatefromKepler_Alg_atexit);

  /* Initialize the memory manager. */
  /* Module initialization. */
  getStatefromKepler_Alg_initialize();

  /* Dispatch the entry-point. */
  c_getStatefromKepler_Alg_mexFun(nlhs, plhs, nrhs, prhs);
}
void mexFunction(int32_T nlhs, mxArray *plhs[], int32_T nrhs, const mxArray
                 *prhs[])
{
  /* Initialize the memory manager. */
  mexAtExit(closestPointOnWorld_atexit);

  /* Module initialization. */
  closestPointOnWorld_initialize();

  /* Dispatch the entry-point. */
  closestPointOnWorld_mexFunction(nlhs, plhs, nrhs, prhs);
}
void initMEX(void) {
#ifdef CONSOLEDEBUG
  ThorMexDebugger::getInstance()->setConsoleAttribsForThread(FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_INTENSITY);
  CONSOLETRACE();
#endif

  scannerMap::scannerID2ThorLSMObj = new std::map<int,ThorLSM*>;
  assert(scannerMap::scannerID2ThorLSMObj!=NULL);
  mexLock();
  mexAtExit(uninitMEX);
  mexInitted = true;
}