00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 #if ! defined (MEXPROTO_H)
00049 #define MEXPROTO_H
00050
00051 #if defined (__cplusplus)
00052 #include <cstdlib>
00053 extern "C" {
00054 #else
00055 #include <stdlib.h>
00056 #endif
00057
00058
00059
00060
00061 #if ! defined (OCTINTERP_API)
00062 #if defined (_MSC_VER)
00063 #define OCTINTERP_API __declspec(dllimport)
00064 #else
00065
00066 #define OCTINTERP_API
00067 #endif
00068 #endif
00069
00070 #define MXARRAY_TYPEDEFS_ONLY
00071 #include "mxarray.h"
00072 #undef MXARRAY_TYPEDEFS_ONLY
00073
00074
00075 extern OCTINTERP_API const char *mexFunctionName (void);
00076
00077 extern OCTINTERP_API int mexCallMATLAB (int nargout, mxArray *argout[], int nargin, mxArray *argin[], const char *fname);
00078
00079 extern OCTINTERP_API void mexSetTrapFlag (int flag);
00080 extern OCTINTERP_API int mexEvalString (const char *s);
00081 extern OCTINTERP_API void mexErrMsgTxt (const char *s);
00082 extern OCTINTERP_API void mexErrMsgIdAndTxt (const char *id, const char *s, ...);
00083 extern OCTINTERP_API void mexWarnMsgTxt (const char *s);
00084 extern OCTINTERP_API void mexWarnMsgIdAndTxt (const char *id, const char *s, ...);
00085 extern OCTINTERP_API void mexPrintf (const char *fmt, ...);
00086
00087 extern OCTINTERP_API mxArray *mexGetVariable (const char *space, const char *name);
00088 extern OCTINTERP_API const mxArray *mexGetVariablePtr (const char *space, const char *name);
00089
00090 extern OCTINTERP_API int mexPutVariable (const char *space, const char *name, mxArray *ptr);
00091
00092 extern OCTINTERP_API void mexMakeArrayPersistent (mxArray *ptr);
00093 extern OCTINTERP_API void mexMakeMemoryPersistent (void *ptr);
00094
00095 extern OCTINTERP_API int mexAtExit (void (*f) (void));
00096 extern OCTINTERP_API const mxArray *mexGet (double handle, const char *property);
00097 extern OCTINTERP_API int mexIsGlobal (const mxArray *ptr);
00098 extern OCTINTERP_API int mexIsLocked (void);
00099 extern OCTINTERP_API void mexLock (void);
00100 extern OCTINTERP_API int mexSet (double handle, const char *property, mxArray *val);
00101 extern OCTINTERP_API void mexUnlock (void);
00102
00103
00104 extern OCTINTERP_API int mxIsFinite (double v);
00105 extern OCTINTERP_API int mxIsInf (double v);
00106 extern OCTINTERP_API int mxIsNaN (double v);
00107
00108
00109 extern OCTINTERP_API double mxGetEps (void);
00110 extern OCTINTERP_API double mxGetInf (void);
00111 extern OCTINTERP_API double mxGetNaN (void);
00112
00113
00114 extern OCTINTERP_API void *mxCalloc (size_t n, size_t size);
00115 extern OCTINTERP_API void *mxMalloc (size_t n);
00116 extern OCTINTERP_API void *mxRealloc (void *ptr, size_t size);
00117 extern OCTINTERP_API void mxFree (void *ptr);
00118
00119
00120 extern OCTINTERP_API mxArray *mxCreateCellArray (mwSize ndims, const mwSize *dims);
00121 extern OCTINTERP_API mxArray *mxCreateCellMatrix (mwSize m, mwSize n);
00122 extern OCTINTERP_API mxArray *mxCreateCharArray (mwSize ndims, const mwSize *dims);
00123 extern OCTINTERP_API mxArray *mxCreateCharMatrixFromStrings (mwSize m, const char **str);
00124 extern OCTINTERP_API mxArray *mxCreateDoubleMatrix (mwSize nr, mwSize nc, mxComplexity flag);
00125 extern OCTINTERP_API mxArray *mxCreateDoubleScalar (double val);
00126 extern OCTINTERP_API mxArray *mxCreateLogicalArray (mwSize ndims, const mwSize *dims);
00127 extern OCTINTERP_API mxArray *mxCreateLogicalMatrix (mwSize m, mwSize n);
00128 extern OCTINTERP_API mxArray *mxCreateLogicalScalar (mxLogical val);
00129 extern OCTINTERP_API mxArray *mxCreateNumericArray (mwSize ndims, const mwSize *dims, mxClassID class_id, mxComplexity flag);
00130 extern OCTINTERP_API mxArray *mxCreateNumericMatrix (mwSize m, mwSize n, mxClassID class_id, mxComplexity flag);
00131 extern OCTINTERP_API mxArray *mxCreateSparse (mwSize m, mwSize n, mwSize nzmax, mxComplexity flag);
00132 extern OCTINTERP_API mxArray *mxCreateSparseLogicalMatrix (mwSize m, mwSize n, mwSize nzmax);
00133 extern OCTINTERP_API mxArray *mxCreateString (const char *str);
00134 extern OCTINTERP_API mxArray *mxCreateStructArray (mwSize ndims, const mwSize *dims, int num_keys, const char **keys);
00135 extern OCTINTERP_API mxArray *mxCreateStructMatrix (mwSize rows, mwSize cols, int num_keys, const char **keys);
00136
00137
00138 extern OCTINTERP_API mxArray *mxDuplicateArray (const mxArray *v);
00139
00140
00141 extern OCTINTERP_API void mxDestroyArray (mxArray *v);
00142
00143
00144 extern OCTINTERP_API int mxIsCell (const mxArray *ptr);
00145 extern OCTINTERP_API int mxIsChar (const mxArray *ptr);
00146 extern OCTINTERP_API int mxIsClass (const mxArray *ptr, const char *name);
00147 extern OCTINTERP_API int mxIsComplex (const mxArray *ptr);
00148 extern OCTINTERP_API int mxIsDouble (const mxArray *ptr);
00149 extern OCTINTERP_API int mxIsInt16 (const mxArray *ptr);
00150 extern OCTINTERP_API int mxIsInt32 (const mxArray *ptr);
00151 extern OCTINTERP_API int mxIsInt64 (const mxArray *ptr);
00152 extern OCTINTERP_API int mxIsInt8 (const mxArray *ptr);
00153 extern OCTINTERP_API int mxIsLogical (const mxArray *ptr);
00154 extern OCTINTERP_API int mxIsNumeric (const mxArray *ptr);
00155 extern OCTINTERP_API int mxIsSingle (const mxArray *ptr);
00156 extern OCTINTERP_API int mxIsSparse (const mxArray *ptr);
00157 extern OCTINTERP_API int mxIsStruct (const mxArray *ptr);
00158 extern OCTINTERP_API int mxIsUint16 (const mxArray *ptr);
00159 extern OCTINTERP_API int mxIsUint32 (const mxArray *ptr);
00160 extern OCTINTERP_API int mxIsUint64 (const mxArray *ptr);
00161 extern OCTINTERP_API int mxIsUint8 (const mxArray *ptr);
00162
00163
00164 extern OCTINTERP_API int mxIsLogicalScalar (const mxArray *ptr);
00165
00166
00167 extern OCTINTERP_API int mxIsLogicalScalarTrue (const mxArray *ptr);
00168
00169
00170 extern OCTINTERP_API int mxIsEmpty (const mxArray *ptr);
00171
00172
00173 extern OCTINTERP_API int mxIsFromGlobalWS (const mxArray *ptr);
00174
00175
00176 extern OCTINTERP_API size_t mxGetM (const mxArray *ptr);
00177 extern OCTINTERP_API size_t mxGetN (const mxArray *ptr);
00178 extern OCTINTERP_API mwSize *mxGetDimensions (const mxArray *ptr);
00179 extern OCTINTERP_API mwSize mxGetNumberOfDimensions (const mxArray *ptr);
00180 extern OCTINTERP_API size_t mxGetNumberOfElements (const mxArray *ptr);
00181
00182
00183 extern OCTINTERP_API void mxSetM (mxArray *ptr, mwSize M);
00184 extern OCTINTERP_API void mxSetN (mxArray *ptr, mwSize N);
00185 extern OCTINTERP_API void mxSetDimensions (mxArray *ptr, mwSize *dims, mwSize ndims);
00186
00187
00188 extern OCTINTERP_API double *mxGetPi (const mxArray *ptr);
00189 extern OCTINTERP_API double *mxGetPr (const mxArray *ptr);
00190 extern OCTINTERP_API double mxGetScalar (const mxArray *ptr);
00191 extern OCTINTERP_API mxChar *mxGetChars (const mxArray *ptr);
00192 extern OCTINTERP_API mxLogical *mxGetLogicals (const mxArray *ptr);
00193 extern OCTINTERP_API void *mxGetData (const mxArray *ptr);
00194 extern OCTINTERP_API void *mxGetImagData (const mxArray *ptr);
00195
00196
00197 extern OCTINTERP_API void mxSetPr (mxArray *ptr, double *pr);
00198 extern OCTINTERP_API void mxSetPi (mxArray *ptr, double *pi);
00199 extern OCTINTERP_API void mxSetData (mxArray *ptr, void *data);
00200 extern OCTINTERP_API void mxSetImagData (mxArray *ptr, void *pi);
00201
00202
00203 extern OCTINTERP_API mxClassID mxGetClassID (const mxArray *ptr);
00204 extern OCTINTERP_API const char *mxGetClassName (const mxArray *ptr);
00205
00206 extern OCTINTERP_API void mxSetClassName (mxArray *ptr, const char *name);
00207
00208
00209 extern OCTINTERP_API mxArray *mxGetCell (const mxArray *ptr, mwIndex idx);
00210
00211 extern OCTINTERP_API void mxSetCell (mxArray *ptr, mwIndex idx, mxArray *val);
00212
00213
00214 extern OCTINTERP_API mwIndex *mxGetIr (const mxArray *ptr);
00215 extern OCTINTERP_API mwIndex *mxGetJc (const mxArray *ptr);
00216 extern OCTINTERP_API mwSize mxGetNzmax (const mxArray *ptr);
00217
00218 extern OCTINTERP_API void mxSetIr (mxArray *ptr, mwIndex *ir);
00219 extern OCTINTERP_API void mxSetJc (mxArray *ptr, mwIndex *jc);
00220 extern OCTINTERP_API void mxSetNzmax (mxArray *ptr, mwSize nzmax);
00221
00222
00223 extern OCTINTERP_API int mxAddField (mxArray *ptr, const char *key);
00224
00225 extern OCTINTERP_API void mxRemoveField (mxArray *ptr, int key_num);
00226
00227 extern OCTINTERP_API mxArray *mxGetField (const mxArray *ptr, mwIndex index, const char *key);
00228 extern OCTINTERP_API mxArray *mxGetFieldByNumber (const mxArray *ptr, mwIndex index, int key_num);
00229
00230 extern OCTINTERP_API void mxSetField (mxArray *ptr, mwIndex index, const char *key, mxArray *val);
00231 extern OCTINTERP_API void mxSetFieldByNumber (mxArray *ptr, mwIndex index, int key_num, mxArray *val);
00232
00233 extern OCTINTERP_API int mxGetNumberOfFields (const mxArray *ptr);
00234
00235 extern OCTINTERP_API const char *mxGetFieldNameByNumber (const mxArray *ptr, int key_num);
00236 extern OCTINTERP_API int mxGetFieldNumber (const mxArray *ptr, const char *key);
00237
00238 extern OCTINTERP_API int mxGetString (const mxArray *ptr, char *buf, mwSize buflen);
00239 extern OCTINTERP_API char *mxArrayToString (const mxArray *ptr);
00240
00241
00242 #ifdef NDEBUG
00243 #define mxAssert(expr, msg) \
00244 do \
00245 { \
00246 if (! expr) \
00247 { \
00248 mexPrintf ("Assertion failed: %s, at line %d of file \"%s\".\n%s\n", \
00249 #expr, __LINE__, __FILE__, msg); \
00250 } \
00251 } \
00252 while (0)
00253
00254 #define mxAssertS(expr, msg) \
00255 do \
00256 { \
00257 if (! expr) \
00258 { \
00259 mexPrintf ("Assertion failed at line %d of file \"%s\".\n%s\n", \
00260 __LINE__, __FILE__, msg); \
00261 abort (); \
00262 } \
00263 } \
00264 while (0)
00265 #else
00266 #define mxAssert(expr, msg)
00267 #define mxAssertS(expr, msg)
00268 #endif
00269
00270 extern OCTINTERP_API mwIndex mxCalcSingleSubscript (const mxArray *ptr, mwSize nsubs, mwIndex *subs);
00271
00272 extern OCTINTERP_API size_t mxGetElementSize (const mxArray *ptr);
00273
00274 #if defined (__cplusplus)
00275 }
00276 #endif
00277
00278 #endif
00279
00280
00281
00282
00283
00284