#include <config.h>
#include <cfloat>
#include <csetjmp>
#include <cstdarg>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <set>
#include "f77-fcn.h"
#include "lo-ieee.h"
#include "oct-locbuf.h"
#include "Cell.h"
#include "mexproto.h"
#include "oct-map.h"
#include "oct-obj.h"
#include "ov.h"
#include "ov-mex-fcn.h"
#include "ov-usr-fcn.h"
#include "pager.h"
#include "parse.h"
#include "toplev.h"
#include "unwind-prot.h"
#include "utils.h"
#include "variables.h"
#include "graphics.h"
Go to the source code of this file.
Classes | |
class | mex |
class | mxArray_base |
class | mxArray_cell |
class | mxArray_matlab |
class | mxArray_number |
class | mxArray_octave_value |
class | mxArray_sparse |
class | mxArray_struct |
Typedefs | |
typedef void(* | cmex_fptr )(int nlhs, mxArray **plhs, int nrhs, mxArray **prhs) |
typedef F77_RET_T(* | fmex_fptr )(int &nlhs, mxArray **plhs, int &nrhs, mxArray **prhs) |
Functions | |
static mwIndex | calc_single_subscript_internal (mwSize ndims, const mwSize *dims, mwSize nsubs, const mwIndex *subs) |
octave_value_list | call_mex (bool have_fmex, void *f, const octave_value_list &args, int nargout_arg, octave_mex_function *curr_mex_fcn) |
static mwSize | max_str_len (mwSize m, const char **str) |
static mxArray * | maybe_mark_array (mxArray *ptr) |
static void * | maybe_mark_foreign (void *ptr) |
static void * | maybe_unmark (void *ptr) |
static mxArray * | maybe_unmark_array (mxArray *ptr) |
int | mexAtExit (void(*f)(void)) |
int | mexCallMATLAB (int nargout, mxArray *argout[], int nargin, mxArray *argin[], const char *fname) |
void | mexErrMsgIdAndTxt (const char *id, const char *fmt,...) |
void | mexErrMsgTxt (const char *s) |
int | mexEvalString (const char *s) |
const char * | mexFunctionName (void) |
const mxArray * | mexGet (double handle, const char *property) |
mxArray * | mexGetVariable (const char *space, const char *name) |
const mxArray * | mexGetVariablePtr (const char *space, const char *name) |
int | mexIsGlobal (const mxArray *ptr) |
int | mexIsLocked (void) |
void | mexLock (void) |
void | mexMakeArrayPersistent (mxArray *ptr) |
void | mexMakeMemoryPersistent (void *ptr) |
int | mexPrintf (const char *fmt,...) |
int | mexPutVariable (const char *space, const char *name, mxArray *ptr) |
int | mexSet (double handle, const char *property, mxArray *val) |
void | mexSetTrapFlag (int flag) |
void | mexUnlock (void) |
void | mexWarnMsgIdAndTxt (const char *id, const char *fmt,...) |
void | mexWarnMsgTxt (const char *s) |
int | mxAddField (mxArray *ptr, const char *key) |
char * | mxArrayToString (const mxArray *ptr) |
mwIndex | mxCalcSingleSubscript (const mxArray *ptr, mwSize nsubs, mwIndex *subs) |
void * | mxCalloc (size_t n, size_t size) |
mxArray * | mxCreateCellArray (mwSize ndims, const mwSize *dims) |
mxArray * | mxCreateCellMatrix (mwSize m, mwSize n) |
mxArray * | mxCreateCharArray (mwSize ndims, const mwSize *dims) |
mxArray * | mxCreateCharMatrixFromStrings (mwSize m, const char **str) |
mxArray * | mxCreateDoubleMatrix (mwSize m, mwSize n, mxComplexity flag) |
mxArray * | mxCreateDoubleScalar (double val) |
mxArray * | mxCreateLogicalArray (mwSize ndims, const mwSize *dims) |
mxArray * | mxCreateLogicalMatrix (mwSize m, mwSize n) |
mxArray * | mxCreateLogicalScalar (mxLogical val) |
mxArray * | mxCreateNumericArray (mwSize ndims, const mwSize *dims, mxClassID class_id, mxComplexity flag) |
mxArray * | mxCreateNumericMatrix (mwSize m, mwSize n, mxClassID class_id, mxComplexity flag) |
mxArray * | mxCreateSparse (mwSize m, mwSize n, mwSize nzmax, mxComplexity flag) |
mxArray * | mxCreateSparseLogicalMatrix (mwSize m, mwSize n, mwSize nzmax) |
mxArray * | mxCreateString (const char *str) |
mxArray * | mxCreateStructArray (mwSize ndims, const mwSize *dims, int num_keys, const char **keys) |
mxArray * | mxCreateStructMatrix (mwSize m, mwSize n, int num_keys, const char **keys) |
void | mxDestroyArray (mxArray *ptr) |
mxArray * | mxDuplicateArray (const mxArray *ptr) |
void | mxFree (void *ptr) |
mxArray * | mxGetCell (const mxArray *ptr, mwIndex idx) |
mxChar * | mxGetChars (const mxArray *ptr) |
mxClassID | mxGetClassID (const mxArray *ptr) |
const char * | mxGetClassName (const mxArray *ptr) |
void * | mxGetData (const mxArray *ptr) |
mwSize * | mxGetDimensions (const mxArray *ptr) |
size_t | mxGetElementSize (const mxArray *ptr) |
double | mxGetEps (void) |
mxArray * | mxGetField (const mxArray *ptr, mwIndex index, const char *key) |
mxArray * | mxGetFieldByNumber (const mxArray *ptr, mwIndex index, int key_num) |
const char * | mxGetFieldNameByNumber (const mxArray *ptr, int key_num) |
int | mxGetFieldNumber (const mxArray *ptr, const char *key) |
void * | mxGetImagData (const mxArray *ptr) |
double | mxGetInf (void) |
mwIndex * | mxGetIr (const mxArray *ptr) |
mwIndex * | mxGetJc (const mxArray *ptr) |
mxLogical * | mxGetLogicals (const mxArray *ptr) |
size_t | mxGetM (const mxArray *ptr) |
size_t | mxGetN (const mxArray *ptr) |
double | mxGetNaN (void) |
mwSize | mxGetNumberOfDimensions (const mxArray *ptr) |
size_t | mxGetNumberOfElements (const mxArray *ptr) |
int | mxGetNumberOfFields (const mxArray *ptr) |
mwSize | mxGetNzmax (const mxArray *ptr) |
double * | mxGetPi (const mxArray *ptr) |
double * | mxGetPr (const mxArray *ptr) |
double | mxGetScalar (const mxArray *ptr) |
int | mxGetString (const mxArray *ptr, char *buf, mwSize buflen) |
int | mxIsCell (const mxArray *ptr) |
int | mxIsChar (const mxArray *ptr) |
int | mxIsClass (const mxArray *ptr, const char *name) |
int | mxIsComplex (const mxArray *ptr) |
int | mxIsDouble (const mxArray *ptr) |
int | mxIsEmpty (const mxArray *ptr) |
int | mxIsFinite (const double v) |
int | mxIsFromGlobalWS (const mxArray *) |
int | mxIsFunctionHandle (const mxArray *ptr) |
int | mxIsInf (const double v) |
int | mxIsInt16 (const mxArray *ptr) |
int | mxIsInt32 (const mxArray *ptr) |
int | mxIsInt64 (const mxArray *ptr) |
int | mxIsInt8 (const mxArray *ptr) |
int | mxIsLogical (const mxArray *ptr) |
int | mxIsLogicalScalar (const mxArray *ptr) |
int | mxIsLogicalScalarTrue (const mxArray *ptr) |
int | mxIsNaN (const double v) |
int | mxIsNumeric (const mxArray *ptr) |
int | mxIsSingle (const mxArray *ptr) |
int | mxIsSparse (const mxArray *ptr) |
int | mxIsStruct (const mxArray *ptr) |
int | mxIsUint16 (const mxArray *ptr) |
int | mxIsUint32 (const mxArray *ptr) |
int | mxIsUint64 (const mxArray *ptr) |
int | mxIsUint8 (const mxArray *ptr) |
void * | mxMalloc (size_t n) |
void * | mxRealloc (void *ptr, size_t size) |
void | mxRemoveField (mxArray *ptr, int key_num) |
void | mxSetCell (mxArray *ptr, mwIndex idx, mxArray *val) |
void | mxSetClassName (mxArray *ptr, const char *name) |
void | mxSetData (mxArray *ptr, void *pr) |
void | mxSetDimensions (mxArray *ptr, const mwSize *dims, mwSize ndims) |
void | mxSetField (mxArray *ptr, mwIndex index, const char *key, mxArray *val) |
void | mxSetFieldByNumber (mxArray *ptr, mwIndex index, int key_num, mxArray *val) |
void | mxSetImagData (mxArray *ptr, void *pi) |
void | mxSetIr (mxArray *ptr, mwIndex *ir) |
void | mxSetJc (mxArray *ptr, mwIndex *jc) |
void | mxSetM (mxArray *ptr, mwSize m) |
void | mxSetN (mxArray *ptr, mwSize n) |
void | mxSetNzmax (mxArray *ptr, mwSize nzmax) |
void | mxSetPi (mxArray *ptr, double *pi) |
void | mxSetPr (mxArray *ptr, double *pr) |
static int | valid_key (const char *key) |
static void | xfree (void *ptr) |
Variables | |
mex * | mex_context = 0 |
std::map< std::string, int > | mex_lock_count |
static mwIndex calc_single_subscript_internal | ( | mwSize | ndims, | |
const mwSize * | dims, | |||
mwSize | nsubs, | |||
const mwIndex * | subs | |||
) | [static] |
Definition at line 278 of file mex.cc.
Referenced by mxArray_matlab::calc_single_subscript(), and mxArray_octave_value::calc_single_subscript().
octave_value_list call_mex | ( | bool | have_fmex, | |
void * | f, | |||
const octave_value_list & | args, | |||
int | nargout_arg, | |||
octave_mex_function * | curr_mex_fcn | |||
) |
Definition at line 3099 of file mex.cc.
References unwind_protect::add(), mex::cleanup(), error_state, mex::jump, octave_value_list::length(), mex::make_value(), OCTAVE_LOCAL_BUFFER, unwind_protect::protect_var(), octave_value_list::resize(), and unwind_protect::run().
Referenced by octave_mex_function::do_multi_index_op().
static mwSize max_str_len | ( | mwSize | m, | |
const char ** | str | |||
) | [static] |
Definition at line 2560 of file mex.cc.
References mex::mark_array().
Referenced by mxCreateCellArray(), mxCreateCellMatrix(), mxCreateCharArray(), mxCreateCharMatrixFromStrings(), mxCreateDoubleMatrix(), mxCreateDoubleScalar(), mxCreateLogicalArray(), mxCreateLogicalMatrix(), mxCreateLogicalScalar(), mxCreateNumericArray(), mxCreateNumericMatrix(), mxCreateSparse(), mxCreateSparseLogicalMatrix(), mxCreateString(), mxCreateStructArray(), mxCreateStructMatrix(), and mxDuplicateArray().
static void * maybe_mark_foreign | ( | void * | ptr | ) | [inline, static] |
Definition at line 2449 of file mex.cc.
References mex::mark_foreign().
Referenced by mxArray_octave_value::get_data(), mxArray_octave_value::get_ir(), and mxArray_octave_value::get_jc().
static void* maybe_unmark | ( | void * | ptr | ) | [inline, static] |
Definition at line 2467 of file mex.cc.
References mex::unmark().
Referenced by mexMakeMemoryPersistent(), mxSetData(), mxSetDimensions(), mxSetImagData(), mxSetIr(), mxSetJc(), mxSetPi(), and mxSetPr().
Definition at line 2458 of file mex.cc.
References mex::unmark_array().
Referenced by mexMakeArrayPersistent(), mxArray_cell::set_cell(), and mxArray_struct::set_field_by_number().
int mexAtExit | ( | void(*)(void) | f | ) |
Definition at line 3446 of file mex.cc.
References octave_mex_function::atexit(), mex::current_mex_function(), and f.
int mexCallMATLAB | ( | int | nargout, | |
mxArray * | argout[], | |||
int | nargin, | |||
mxArray * | argin[], | |||
const char * | fname | |||
) |
Definition at line 3183 of file mex.cc.
References mex::abort(), error_state, feval(), octave_value_list::length(), mex::make_value(), octave_value_list::resize(), and mex::trap_feval_error.
Definition at line 3282 of file mex.cc.
References mex::abort(), error(), mexFunctionName(), OCTAVE_LOCAL_BUFFER, and verror_with_id().
void mexErrMsgTxt | ( | const char * | s | ) |
Definition at line 3270 of file mex.cc.
References mex::abort(), error(), and mexFunctionName().
Referenced by mexGetVariable(), and mexPutVariable().
Definition at line 3249 of file mex.cc.
References error_state, and eval_string().
const char* mexFunctionName | ( | void | ) |
Definition at line 3177 of file mex.cc.
References mex::function_name().
Referenced by mexErrMsgIdAndTxt(), mexErrMsgTxt(), mexIsLocked(), mexLock(), mexUnlock(), and mexWarnMsgIdAndTxt().
Definition at line 3461 of file mex.cc.
References octave_value::as_mxArray(), error_state, get_property_from_handle(), and octave_value::is_defined().
Definition at line 3339 of file mex.cc.
References unwind_protect::add_fcn(), error_state, get_global_value(), octave_call_stack::goto_base_frame(), octave_call_stack::goto_caller_frame(), octave_value::is_defined(), mex::make_value(), mexErrMsgTxt(), octave_call_stack::pop(), and symbol_table::varval().
Referenced by mexGetVariablePtr().
Definition at line 3383 of file mex.cc.
References mexGetVariable().
Definition at line 3472 of file mex.cc.
References mxIsFromGlobalWS().
int mexIsLocked | ( | void | ) |
Definition at line 3478 of file mex.cc.
References mexFunctionName(), and mislocked().
void mexLock | ( | void | ) |
Definition at line 3495 of file mex.cc.
References mexFunctionName(), and mlock().
void mexMakeArrayPersistent | ( | mxArray * | ptr | ) |
Definition at line 3434 of file mex.cc.
References maybe_unmark_array().
void mexMakeMemoryPersistent | ( | void * | ptr | ) |
Definition at line 3440 of file mex.cc.
References maybe_unmark().
Definition at line 3328 of file mex.cc.
References octave_stdout, and octave_vformat().
Definition at line 3389 of file mex.cc.
References unwind_protect::add_fcn(), error_state, octave_call_stack::goto_base_frame(), octave_call_stack::goto_caller_frame(), mexErrMsgTxt(), octave_call_stack::pop(), set_global_value(), and symbol_table::varref().
Definition at line 3511 of file mex.cc.
References set_property_in_handle().
void mexSetTrapFlag | ( | int | flag | ) |
Definition at line 3242 of file mex.cc.
References mex::trap_feval_error.
void mexUnlock | ( | void | ) |
Definition at line 3520 of file mex.cc.
References mexFunctionName(), and munlock().
Definition at line 3309 of file mex.cc.
References mexFunctionName(), OCTAVE_LOCAL_BUFFER, and vwarning_with_id().
mwIndex mxCalcSingleSubscript | ( | const mxArray * | ptr, | |
mwSize | nsubs, | |||
mwIndex * | subs | |||
) |
void* mxCalloc | ( | size_t | n, | |
size_t | size | |||
) |
Definition at line 2533 of file mex.cc.
References mex::calloc().
mxArray* mxCreateCellArray | ( | mwSize | ndims, | |
const mwSize * | dims | |||
) |
Definition at line 2567 of file mex.cc.
References maybe_mark_array().
mxArray* mxCreateCellMatrix | ( | mwSize | m, | |
mwSize | n | |||
) |
Definition at line 2573 of file mex.cc.
References maybe_mark_array().
mxArray* mxCreateCharArray | ( | mwSize | ndims, | |
const mwSize * | dims | |||
) |
Definition at line 2579 of file mex.cc.
References maybe_mark_array().
Definition at line 2585 of file mex.cc.
References maybe_mark_array().
mxArray* mxCreateDoubleMatrix | ( | mwSize | m, | |
mwSize | n, | |||
mxComplexity | flag | |||
) |
Definition at line 2591 of file mex.cc.
References maybe_mark_array().
Definition at line 2597 of file mex.cc.
References maybe_mark_array().
mxArray* mxCreateLogicalArray | ( | mwSize | ndims, | |
const mwSize * | dims | |||
) |
Definition at line 2603 of file mex.cc.
References maybe_mark_array().
mxArray* mxCreateLogicalMatrix | ( | mwSize | m, | |
mwSize | n | |||
) |
Definition at line 2609 of file mex.cc.
References maybe_mark_array().
mxArray* mxCreateLogicalScalar | ( | mxLogical | val | ) |
Definition at line 2615 of file mex.cc.
References maybe_mark_array().
mxArray* mxCreateNumericArray | ( | mwSize | ndims, | |
const mwSize * | dims, | |||
mxClassID | class_id, | |||
mxComplexity | flag | |||
) |
Definition at line 2621 of file mex.cc.
References maybe_mark_array().
mxArray* mxCreateNumericMatrix | ( | mwSize | m, | |
mwSize | n, | |||
mxClassID | class_id, | |||
mxComplexity | flag | |||
) |
Definition at line 2628 of file mex.cc.
References maybe_mark_array().
mxArray* mxCreateSparse | ( | mwSize | m, | |
mwSize | n, | |||
mwSize | nzmax, | |||
mxComplexity | flag | |||
) |
Definition at line 2634 of file mex.cc.
References maybe_mark_array().
mxArray* mxCreateSparseLogicalMatrix | ( | mwSize | m, | |
mwSize | n, | |||
mwSize | nzmax | |||
) |
Definition at line 2640 of file mex.cc.
References maybe_mark_array().
Definition at line 2646 of file mex.cc.
References maybe_mark_array().
mxArray* mxCreateStructArray | ( | mwSize | ndims, | |
const mwSize * | dims, | |||
int | num_keys, | |||
const char ** | keys | |||
) |
Definition at line 2652 of file mex.cc.
References maybe_mark_array().
Definition at line 2658 of file mex.cc.
References maybe_mark_array().
void mxDestroyArray | ( | mxArray * | ptr | ) |
Definition at line 2672 of file mex.cc.
References mex::free_value().
Definition at line 2665 of file mex.cc.
References maybe_mark_array().
void mxFree | ( | void * | ptr | ) |
Definition at line 2551 of file mex.cc.
References mex::free(), and xfree().
Referenced by mxArray_struct::add_field(), mxArray_struct::remove_field(), mxArray_matlab::set_class_name(), mex::~mex(), mxArray_cell::~mxArray_cell(), mxArray_matlab::~mxArray_matlab(), mxArray_number::~mxArray_number(), mxArray_octave_value::~mxArray_octave_value(), mxArray_sparse::~mxArray_sparse(), and mxArray_struct::~mxArray_struct().
Definition at line 3026 of file mex.cc.
References mxGetFieldByNumber(), and mxGetFieldNumber().
Definition at line 3033 of file mex.cc.
Referenced by mxGetField().
Definition at line 3064 of file mex.cc.
Referenced by mxGetField(), and mxSetField().
double mxGetInf | ( | void | ) |
Definition at line 2520 of file mex.cc.
References lo_ieee_inf_value().
double mxGetNaN | ( | void | ) |
Definition at line 2526 of file mex.cc.
References lo_ieee_nan_value().
Definition at line 2496 of file mex.cc.
References lo_ieee_finite.
Definition at line 2816 of file mex.cc.
Referenced by mexIsGlobal().
Definition at line 2502 of file mex.cc.
References lo_ieee_isinf.
Definition at line 2508 of file mex.cc.
References lo_ieee_isnan.
void* mxMalloc | ( | size_t | n | ) |
Definition at line 2539 of file mex.cc.
References mex::malloc().
void* mxRealloc | ( | void * | ptr, | |
size_t | size | |||
) |
Definition at line 2545 of file mex.cc.
References mex::realloc().
Referenced by mxArray_struct::add_field().
void mxSetData | ( | mxArray * | ptr, | |
void * | pr | |||
) |
Definition at line 2932 of file mex.cc.
References maybe_unmark().
void mxSetDimensions | ( | mxArray * | ptr, | |
const mwSize * | dims, | |||
mwSize | ndims | |||
) |
Definition at line 2868 of file mex.cc.
References maybe_unmark().
Definition at line 3039 of file mex.cc.
References mxGetFieldNumber(), and mxSetFieldByNumber().
Definition at line 3046 of file mex.cc.
Referenced by mxSetField().
void mxSetImagData | ( | mxArray * | ptr, | |
void * | pi | |||
) |
Definition at line 2938 of file mex.cc.
References maybe_unmark().
void mxSetIr | ( | mxArray * | ptr, | |
mwIndex * | ir | |||
) |
Definition at line 2995 of file mex.cc.
References maybe_unmark().
void mxSetJc | ( | mxArray * | ptr, | |
mwIndex * | jc | |||
) |
Definition at line 3001 of file mex.cc.
References maybe_unmark().
Definition at line 2926 of file mex.cc.
References maybe_unmark().
Definition at line 2920 of file mex.cc.
References maybe_unmark().
Definition at line 80 of file mex.cc.
Referenced by mxArray_struct::add_field().
static void xfree | ( | void * | ptr | ) | [static] |
Definition at line 58 of file mex.cc.
Referenced by mex::cleanup(), mex::free(), and mxFree().
mex* mex_context = 0 |
std::map<std::string,int> mex_lock_count |