matlab_gs.h

Go to the documentation of this file.
00001 
00007 /* $Id: matlab_gs.h,v 1.15 2007/08/08 18:41:07 yarkhan Exp $ */
00008 /* $UTK_Copyright: $ */
00009 
00010 #ifndef _MATLAB_GS_H_
00011 #define _MATLAB_GS_H_
00012 
00013 #include <matrix.h>
00014 #include <mex.h>
00015 
00016 #ifdef HAVE_CONFIG_H
00017 #include "config.h"
00018 #endif /* HAVE_CONFIG_H */
00019 
00020 #include "portability.h"
00021 #include "grpc.h"
00022 
00023 /* Define various types that may be missing and are used in the
00024  * matlab_client in order to take matlab native data widths and
00025  * transfer them back/forth to GridSolve */
00026 #ifdef WIN32
00027 #ifndef __int8_t_defined
00028 #define __int8_t_defined
00029 typedef char int8_t;
00030 #endif
00031 #ifndef __int16_t_defined
00032 #define __int16_t_defined
00033 typedef short int16_t;
00034 #endif
00035 #ifndef __int32_t_defined
00036 #define __int32_t_defined
00037 typedef int int32_t;
00038 #endif
00039 #ifndef __uint8_t_defined
00040 #define __uint8_t_defined
00041 typedef unsigned char uint8_t;
00042 #endif
00043 #ifndef __uint16_t_defined
00044 #define __uint16_t_defined
00045 typedef unsigned short uint16_t;
00046 #endif
00047 #ifndef __uint32_t_defined
00048 #define __uint32_t_defined
00049 typedef unsigned int uint32_t;
00050 #endif
00051 #endif /* WIN32 */
00052 
00053 /* #undef DBGPRINTF */
00054 /* #define DBGPRINTF(...) */
00055 /* #define DBGPRINTF mexPrintf("%s:%d: ", __FILE__ , __LINE__ ); mexPrintf */
00056 
00057 enum matlab_gs_case { GS_CALL=1, GS_CALL_ASYNC=2, GS_WAIT=3, GS_ERROR_STRING=4, GS_GET_LAST_ERROR=5, GS_PROBE=6, GS_CANCEL=7, GS_INFO=8, GS_PUTENV=9};
00058 
00059 int matlab_gs_error_num;
00060 int matlab_gs_minor_errno;
00061 
00062 #define DO_ERROR_MACRO(errnum) do { matlab_gs_error_num=errnum; matlab_gs_minor_errno=grpc_minor_errno; goto error; } while (0);
00063 
00064 void *matlab_gs_calloc(size_t N, size_t S);
00065 void *matlab_gs_free(void *ptr);
00066 
00067 int matlab_gs_setup_args(gs_problem_t* problem, int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]);
00068 int matlab_gs_get_output(gs_problem_t* problem, int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]);
00069 int matlab_gs_free_input_args(gs_problem_t* problem, int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[]);
00070 int matlab_gs_free_args(gs_problem_t* problem, int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]);
00071 
00072 void matlab_gs_call( int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[] );
00073 void matlab_gs_call_async( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] );
00074 void matlab_gs_error_string(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]);
00075 void matlab_gs_get_last_error(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]);
00076 void matlab_gs_wait( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] );
00077 void matlab_gs_probe( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] );
00078 void matlab_gs_cancel( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] );
00079 void matlab_gs_info(int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[] );
00080 void matlab_gs_putenv(int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[] );
00081 void matlab_gs_probe_or( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] );
00082 int matlab_gs_arg_is_sparse_index_or_pointer(gs_argument_t *argp, gs_problem_t *problem);
00083 
00084 #endif /* _MATLAB_GS_H_ */
00085