matlab_gs_mexFunction.c

Go to the documentation of this file.
00001 
00007 /* $Id: matlab_gs_mexFunction.c,v 1.5 2007/07/05 19:18:25 yarkhan Exp $ */
00008 /* $UTK_Copyright: $ */
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 "comm_data.h"
00018 #include "matlab_gs.h"
00019 
00037 void
00038 mexFunction( int nlhs, mxArray *plhs[],
00039              int nrhs, const mxArray *prhs[] )
00040 {
00041 
00042   if (nrhs == 0 || !mxIsDouble(prhs[0]) ||
00043       mxGetM(prhs[0]) != 1 || mxGetN(prhs[0]) != 1)
00044     mexErrMsgTxt("Illegal call to mex functions");
00045   
00046   DBGPRINTF("nlhs %d nrhs %d \n", nlhs, nrhs);
00047   
00048   switch ((int)(mxGetScalar(prhs[0]))) 
00049   {
00050   case 1: matlab_gs_call(nlhs, plhs, nrhs, prhs); break;
00051   case 2: matlab_gs_call_async(nlhs, plhs, nrhs, prhs); break;
00052   case 3: matlab_gs_wait(nlhs, plhs, nrhs, prhs); break;
00053   case 4: matlab_gs_error_string(nlhs, plhs, nrhs, prhs); break;
00054   case 5: matlab_gs_get_last_error(nlhs, plhs, nrhs, prhs); break;
00055   case 6: matlab_gs_probe(nlhs, plhs, nrhs, prhs); break;
00056   case 7: matlab_gs_cancel(nlhs, plhs, nrhs, prhs); break;
00057   case 8: matlab_gs_info(nlhs, plhs, nrhs, prhs); break;
00058   case 9: matlab_gs_putenv(nlhs, plhs, nrhs, prhs); break;
00059   case 10: matlab_gs_probe_or(nlhs, plhs, nrhs, prhs); break;
00060     
00061   default: mexErrMsgTxt("Illegal function ID parameter");
00062   }
00063 
00064   DBGPRINTF("nlhs %d nrhs %d \n", nlhs, nrhs);
00065   return;
00066 }