Go to the documentation of this file.00001
00007
00008
00009
00010 #include <stdio.h>
00011 #include <string.h>
00012
00013 #include <matrix.h>
00014 #include <mex.h>
00015
00016 #include "grpc.h"
00017 #include "matlab_gs.h"
00018
00019
00029 void
00030 matlab_gs_probe(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
00031 {
00032 int i;
00033 grpc_sessionid_t sessionId;
00034 grpc_error_t retval;
00035
00036 if (nrhs != 2 || nlhs != 1) {
00037 mexErrMsgTxt("Usage: status = gs_probe(sessionId)\n");
00038 for (i=0;i<nlhs;i++) plhs[i] = mxCreateDoubleMatrix(0,0,mxREAL);
00039 return;
00040 }
00041
00042
00043 matlab_gs_error_num = 0;
00044 matlab_gs_minor_errno = 256;
00045
00046
00047 retval = grpc_initialize(NULL);
00048 if ((retval != GRPC_NO_ERROR) && (retval != GRPC_ALREADY_INITIALIZED))
00049 DO_ERROR_MACRO(retval);
00050
00051
00052
00053 sessionId = (int)mxGetPr(prhs[1])[0];
00054 if (sessionId < 0) DO_ERROR_MACRO(GRPC_OTHER_ERROR_CODE);
00055
00056 retval = grpc_probe_ft(sessionId);
00057 if ((retval != GRPC_NO_ERROR) & (retval != GRPC_NOT_COMPLETED))
00058 DO_ERROR_MACRO(retval);
00059
00060 plhs[0] = mxCreateDoubleMatrix(1,1,mxREAL);
00061 mxGetPr(plhs[0])[0] = (double)retval;
00062
00063 return;
00064
00065
00066 error:
00067 plhs[0] = mxCreateDoubleMatrix(1,1,mxREAL);
00068 mxGetPr(plhs[0])[0] = (double)-1;
00069 mexPrintf("Warning: GridSolve call failed: %d:%d: %s; %s\n", grpc_errno, grpc_minor_errno, grpc_error_string(grpc_errno), grpc_minor_error_string(grpc_minor_errno));
00070 return;
00071
00072 }