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 int 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 mxIsFunctionHandle (const mxArray *ptr);
00150 extern OCTINTERP_API int mxIsInt16 (const mxArray *ptr);
00151 extern OCTINTERP_API int mxIsInt32 (const mxArray *ptr);
00152 extern OCTINTERP_API int mxIsInt64 (const mxArray *ptr);
00153 extern OCTINTERP_API int mxIsInt8 (const mxArray *ptr);
00154 extern OCTINTERP_API int mxIsLogical (const mxArray *ptr);
00155 extern OCTINTERP_API int mxIsNumeric (const mxArray *ptr);
00156 extern OCTINTERP_API int mxIsSingle (const mxArray *ptr);
00157 extern OCTINTERP_API int mxIsSparse (const mxArray *ptr);
00158 extern OCTINTERP_API int mxIsStruct (const mxArray *ptr);
00159 extern OCTINTERP_API int mxIsUint16 (const mxArray *ptr);
00160 extern OCTINTERP_API int mxIsUint32 (const mxArray *ptr);
00161 extern OCTINTERP_API int mxIsUint64 (const mxArray *ptr);
00162 extern OCTINTERP_API int mxIsUint8 (const mxArray *ptr);
00163
00164
00165 extern OCTINTERP_API int mxIsLogicalScalar (const mxArray *ptr);
00166
00167
00168 extern OCTINTERP_API int mxIsLogicalScalarTrue (const mxArray *ptr);
00169
00170
00171 extern OCTINTERP_API int mxIsEmpty (const mxArray *ptr);
00172
00173
00174 extern OCTINTERP_API int mxIsFromGlobalWS (const mxArray *ptr);
00175
00176
00177 extern OCTINTERP_API size_t mxGetM (const mxArray *ptr);
00178 extern OCTINTERP_API size_t mxGetN (const mxArray *ptr);
00179 extern OCTINTERP_API mwSize *mxGetDimensions (const mxArray *ptr);
00180 extern OCTINTERP_API mwSize mxGetNumberOfDimensions (const mxArray *ptr);
00181 extern OCTINTERP_API size_t mxGetNumberOfElements (const mxArray *ptr);
00182
00183
00184 extern OCTINTERP_API void mxSetM (mxArray *ptr, mwSize M);
00185 extern OCTINTERP_API void mxSetN (mxArray *ptr, mwSize N);
00186 extern OCTINTERP_API void mxSetDimensions (mxArray *ptr, const mwSize *dims, mwSize ndims);
00187
00188
00189 extern OCTINTERP_API double *mxGetPi (const mxArray *ptr);
00190 extern OCTINTERP_API double *mxGetPr (const mxArray *ptr);
00191 extern OCTINTERP_API double mxGetScalar (const mxArray *ptr);
00192 extern OCTINTERP_API mxChar *mxGetChars (const mxArray *ptr);
00193 extern OCTINTERP_API mxLogical *mxGetLogicals (const mxArray *ptr);
00194 extern OCTINTERP_API void *mxGetData (const mxArray *ptr);
00195 extern OCTINTERP_API void *mxGetImagData (const mxArray *ptr);
00196
00197
00198 extern OCTINTERP_API void mxSetPr (mxArray *ptr, double *pr);
00199 extern OCTINTERP_API void mxSetPi (mxArray *ptr, double *pi);
00200 extern OCTINTERP_API void mxSetData (mxArray *ptr, void *data);
00201 extern OCTINTERP_API void mxSetImagData (mxArray *ptr, void *pi);
00202
00203
00204 extern OCTINTERP_API mxClassID mxGetClassID (const mxArray *ptr);
00205 extern OCTINTERP_API const char *mxGetClassName (const mxArray *ptr);
00206
00207 extern OCTINTERP_API void mxSetClassName (mxArray *ptr, const char *name);
00208
00209
00210 extern OCTINTERP_API mxArray *mxGetCell (const mxArray *ptr, mwIndex idx);
00211
00212 extern OCTINTERP_API void mxSetCell (mxArray *ptr, mwIndex idx, mxArray *val);
00213
00214
00215 extern OCTINTERP_API mwIndex *mxGetIr (const mxArray *ptr);
00216 extern OCTINTERP_API mwIndex *mxGetJc (const mxArray *ptr);
00217 extern OCTINTERP_API mwSize mxGetNzmax (const mxArray *ptr);
00218
00219 extern OCTINTERP_API void mxSetIr (mxArray *ptr, mwIndex *ir);
00220 extern OCTINTERP_API void mxSetJc (mxArray *ptr, mwIndex *jc);
00221 extern OCTINTERP_API void mxSetNzmax (mxArray *ptr, mwSize nzmax);
00222
00223
00224 extern OCTINTERP_API int mxAddField (mxArray *ptr, const char *key);
00225
00226 extern OCTINTERP_API void mxRemoveField (mxArray *ptr, int key_num);
00227
00228 extern OCTINTERP_API mxArray *mxGetField (const mxArray *ptr, mwIndex index, const char *key);
00229 extern OCTINTERP_API mxArray *mxGetFieldByNumber (const mxArray *ptr, mwIndex index, int key_num);
00230
00231 extern OCTINTERP_API void mxSetField (mxArray *ptr, mwIndex index, const char *key, mxArray *val);
00232 extern OCTINTERP_API void mxSetFieldByNumber (mxArray *ptr, mwIndex index, int key_num, mxArray *val);
00233
00234 extern OCTINTERP_API int mxGetNumberOfFields (const mxArray *ptr);
00235
00236 extern OCTINTERP_API const char *mxGetFieldNameByNumber (const mxArray *ptr, int key_num);
00237 extern OCTINTERP_API int mxGetFieldNumber (const mxArray *ptr, const char *key);
00238
00239 extern OCTINTERP_API int mxGetString (const mxArray *ptr, char *buf, mwSize buflen);
00240 extern OCTINTERP_API char *mxArrayToString (const mxArray *ptr);
00241
00242
00243 #ifdef NDEBUG
00244 #define mxAssert(expr, msg) \
00245 do \
00246 { \
00247 if (! expr) \
00248 { \
00249 mexPrintf ("Assertion failed: %s, at line %d of file \"%s\".\n%s\n", \
00250 #expr, __LINE__, __FILE__, msg); \
00251 } \
00252 } \
00253 while (0)
00254
00255 #define mxAssertS(expr, msg) \
00256 do \
00257 { \
00258 if (! expr) \
00259 { \
00260 mexPrintf ("Assertion failed at line %d of file \"%s\".\n%s\n", \
00261 __LINE__, __FILE__, msg); \
00262 abort (); \
00263 } \
00264 } \
00265 while (0)
00266 #else
00267 #define mxAssert(expr, msg)
00268 #define mxAssertS(expr, msg)
00269 #endif
00270
00271 extern OCTINTERP_API mwIndex mxCalcSingleSubscript (const mxArray *ptr, mwSize nsubs, mwIndex *subs);
00272
00273 extern OCTINTERP_API size_t mxGetElementSize (const mxArray *ptr);
00274
00275 #if defined (__cplusplus)
00276 }
00277 #endif
00278
00279 #endif