/* matlab wrapper for ezcaNewMonitorValue */ /* Author: Till Straumann , 2002-2003 */ /* LICENSE: EPICS open license, see ../LICENSE file */ #include "mglue.h" #include "multiEzca.h" #include #include #include void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { PVs pvs = { {0} }; char type = ezcaNative; LcaError theErr; lcaErrorInit(&theErr); LHSCHECK(nlhs, plhs); if ( nlhs > 1 ) { lcaSetError(&theErr, EZCA_INVALIDARG, "Too many output args"); goto cleanup; } if ( nrhs < 1 || nrhs > 2 ) { lcaSetError(&theErr, EZCA_INVALIDARG, "Expected 1..2 rhs argument"); goto cleanup; } /* check for an optional data type argument */ if ( nrhs > 1 ) { if ( ezcaInvalid == (type = marg2ezcaType( prhs[1], &theErr )) ) { goto cleanup; } } if ( buildPVs(prhs[0], &pvs, &theErr) ) goto cleanup; if ( ! (plhs[0] = mxCreateNumericMatrix( pvs.m, 1, mxINT32_CLASS, mxREAL )) ) { lcaSetError(&theErr, EZCA_FAILEDMALLOC, "Not enough memory"); goto cleanup; } if ( 0 == multi_ezca_check_mon( pvs.names, pvs.m, type, (int*)mxGetData(plhs[0]), &theErr) ) { nlhs = 0; } cleanup: releasePVs(&pvs); /* do this LAST (in case mexErrMsgTxt is called) */ ERR_CHECK(nlhs, plhs, &theErr); }