matlab_gs_error_string.c

Go to the documentation of this file.
00001 
00007 /* $Id: matlab_gs_error_string.c,v 1.5 2006/05/09 20:19:44 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 
00018 
00028 void 
00029 matlab_gs_error_string(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
00030 {
00031   int i;
00032   grpc_error_t error_num;
00033 
00034   if ((nlhs != 1)||(nrhs != 2)) {
00035     mexErrMsgTxt("Usage: str = gs_error_string(error_code)\n");
00036     goto error;
00037   }
00038 
00039   error_num = (grpc_error_t)(*mxGetPr(prhs[0]));
00040   plhs[0] = mxCreateString(grpc_error_string(error_num));
00041 
00042   return; 
00043 
00044 
00045  error:
00046   for (i=0;i<nlhs;i++) plhs[i] = mxCreateDoubleMatrix(0,0,mxREAL); 
00047   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));  
00048   return;
00049 
00050 }
00051 
00052