#include <cstdarg>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <limits>
#include <map>
#include <set>
#include <string>
#include "f77-fcn.h"
#include "lo-ieee.h"
#include "oct-locbuf.h"
#include "quit.h"
#include "Cell.h"
#include "call-stack.h"
#include "error.h"
#include "interpreter-private.h"
#include "interpreter.h"
#include "mxarray.h"
#include "mexproto.h"
#include "oct-map.h"
#include "ovl.h"
#include "ov.h"
#include "ov-mex-fcn.h"
#include "ov-usr-fcn.h"
#include "pager.h"
#include "parse.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_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) (F77_INT &nlhs, mxArray **plhs, F77_INT &nrhs, mxArray **prhs) |
Variables | |
mex * | mex_context = nullptr |
std::map< std::string, int > | mex_lock_count |
|
static |
Definition at line 113 of file mex.cc.
References dims, octave_value::ndims(), retval, and subs.
Referenced by mxArray_octave_value::calc_single_subscript(), and mxArray_matlab::calc_single_subscript().
octave_value_list call_mex | ( | octave_mex_function & | mex_fcn, |
const octave_value_list & | args, | ||
int | nargout_arg | ||
) |
Definition at line 3141 of file mex.cc.
References mxArray::as_octave_value(), octave::context, fcn, frame, i, octave_mex_function::is_fmex(), octave_value_list::length(), mex_context, octave_mex_function::mex_fcn_ptr(), nargout(), OCTAVE_LOCAL_BUFFER, octave::action_container::protect_var(), octave_value::resize(), and retval.
Referenced by octave_mex_function::call().
Definition at line 2562 of file mex.cc.
References mex::mark_array(), and mex_context.
Referenced by mxCreateCellArray(), mxCreateCellMatrix(), mxCreateCharArray(), mxCreateCharMatrixFromStrings(), mxCreateDoubleMatrix(), mxCreateDoubleScalar(), mxCreateLogicalArray(), mxCreateLogicalMatrix(), mxCreateLogicalScalar(), mxCreateNumericArray(), mxCreateNumericMatrix(), mxCreateSparse(), mxCreateSparseLogicalMatrix(), mxCreateString(), mxCreateStructArray(), mxCreateStructMatrix(), mxCreateUninitNumericArray(), mxCreateUninitNumericMatrix(), and mxDuplicateArray().
|
inlinestatic |
Definition at line 2450 of file mex.cc.
References mex::mark_foreign(), and mex_context.
Referenced by mxArray_octave_value::get_data(), mxArray_octave_value::get_ir(), and mxArray_octave_value::get_jc().
|
inlinestatic |
Definition at line 2468 of file mex.cc.
References mex_context, and mex::unmark().
Referenced by mexMakeMemoryPersistent(), mxSetData(), mxSetDimensions(), mxSetImagData(), mxSetIr(), mxSetJc(), mxSetPi(), and mxSetPr().
Definition at line 2459 of file mex.cc.
References mex_context, and 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 3579 of file mex.cc.
References octave_mex_function::atexit(), mex::current_mex_function(), f, and mex_context.
int mexCallMATLAB | ( | int | nargout, |
mxArray * | argout[], | ||
int | nargin, | ||
mxArray * | argin[], | ||
const char * | fname | ||
) |
Definition at line 3218 of file mex.cc.
References mxArray::as_octave_value(), octave::feval(), fname, i, octave_value::length(), mex::make_value(), mex_context, nargout(), octave::interpreter::recover_from_exception(), octave_value_list::resize(), octave_value::resize(), retval, and mex::trap_feval_error.
Referenced by mexCallMATLABWithTrap().
mxArray* mexCallMATLABWithTrap | ( | int | nargout, |
mxArray * | argout[], | ||
int | nargin, | ||
mxArray * | argin[], | ||
const char * | fname | ||
) |
Definition at line 3281 of file mex.cc.
References fname, mex_context, mexCallMATLAB(), mexSetTrapFlag(), mxCreateCellMatrix(), mxCreateString(), mxCreateStructMatrix(), mxSetFieldByNumber(), nargout(), string, and mex::trap_feval_error.
void mexErrMsgIdAndTxt | ( | const char * | id, |
const char * | fmt, | ||
... | |||
) |
Definition at line 3388 of file mex.cc.
References error(), fname, mexFunctionName(), OCTAVE_LOCAL_BUFFER, strlen(), and verror_with_id().
void mexErrMsgTxt | ( | const char * | s | ) |
Definition at line 3375 of file mex.cc.
References error(), mexFunctionName(), s, and strlen().
Referenced by mexGetVariable(), mexPutVariable(), and mxIsFromGlobalWS().
int mexEvalString | ( | const char * | s | ) |
Definition at line 3312 of file mex.cc.
References octave::eval_string(), octave::interpreter::recover_from_exception(), retval, and s.
mxArray* mexEvalStringWithTrap | ( | const char * | s | ) |
Definition at line 3339 of file mex.cc.
References octave::eval_string(), mxCreateCellMatrix(), mxCreateString(), mxCreateStructMatrix(), mxSetFieldByNumber(), octave::interpreter::recover_from_exception(), s, and string.
const char* mexFunctionName | ( | void | ) |
Definition at line 3212 of file mex.cc.
References mex::function_name(), and mex_context.
Referenced by mexErrMsgIdAndTxt(), mexErrMsgTxt(), mexIsLocked(), mexLock(), mexUnlock(), and mexWarnMsgIdAndTxt().
Definition at line 3594 of file mex.cc.
References octave_value::as_mxArray(), get_property_from_handle(), handle, and octave_value::is_defined().
mxArray* mexGetVariable | ( | const char * | space, |
const char * | name | ||
) |
Definition at line 3446 of file mex.cc.
References octave::__get_call_stack__(), octave::__get_symbol_table__(), octave::__require_current_scope__(), octave::action_container::add_method(), cs, frame, octave::symbol_table::global_varval(), octave::call_stack::goto_base_frame(), mex::make_value(), mex_context, mexErrMsgTxt(), name, octave::call_stack::pop(), retval, octave::string::strcmp(), val, and octave::symbol_scope::varval().
Referenced by mexGetVariablePtr().
const mxArray* mexGetVariablePtr | ( | const char * | space, |
const char * | name | ||
) |
Definition at line 3503 of file mex.cc.
References mexGetVariable(), and name.
int mexIsGlobal | ( | const mxArray * | ptr | ) |
Definition at line 3607 of file mex.cc.
References mxIsFromGlobalWS().
int mexIsLocked | ( | void | ) |
Definition at line 3613 of file mex.cc.
References octave::__get_interpreter__(), fname, mex_context, mexFunctionName(), octave::interpreter::mislocked(), and retval.
void mexLock | ( | void | ) |
Definition at line 3632 of file mex.cc.
References octave::__get_interpreter__(), fname, mex_context, mex_lock_count, mexFunctionName(), and octave::interpreter::mlock().
void mexMakeArrayPersistent | ( | mxArray * | ptr | ) |
Definition at line 3567 of file mex.cc.
References maybe_unmark_array().
void mexMakeMemoryPersistent | ( | void * | ptr | ) |
Definition at line 3573 of file mex.cc.
References maybe_unmark().
int mexPrintf | ( | const char * | fmt, |
... | |||
) |
Definition at line 3435 of file mex.cc.
References octave_stdout, octave_vformat(), and retval.
int mexPutVariable | ( | const char * | space, |
const char * | name, | ||
const mxArray * | ptr | ||
) |
Definition at line 3509 of file mex.cc.
References octave::__get_call_stack__(), octave::__get_symbol_table__(), octave::__require_current_scope__(), octave::action_container::add_method(), mxArray::as_octave_value(), octave::symbol_scope::assign(), cs, frame, mxArray::get_name(), octave::symbol_table::global_assign(), octave::call_stack::goto_base_frame(), mexErrMsgTxt(), name, octave::call_stack::pop(), and octave::string::strcmp().
Definition at line 3650 of file mex.cc.
References mxArray::as_octave_value(), handle, set_property_in_handle(), and val.
void mexSetTrapFlag | ( | int | flag | ) |
Definition at line 3305 of file mex.cc.
References mex_context, and mex::trap_feval_error.
Referenced by mexCallMATLABWithTrap().
void mexUnlock | ( | void | ) |
Definition at line 3659 of file mex.cc.
References octave::__get_interpreter__(), fname, mex_context, mex_lock_count, mexFunctionName(), octave::interpreter::munlock(), and p.
void mexWarnMsgIdAndTxt | ( | const char * | id, |
const char * | fmt, | ||
... | |||
) |
Definition at line 3416 of file mex.cc.
References fname, mexFunctionName(), OCTAVE_LOCAL_BUFFER, strlen(), and vwarning_with_id().
void mexWarnMsgTxt | ( | const char * | s | ) |
int mxAddField | ( | mxArray * | ptr, |
const char * | key | ||
) |
Definition at line 3055 of file mex.cc.
References mxArray::add_field().
char* mxArrayToString | ( | const mxArray * | ptr | ) |
Definition at line 3117 of file mex.cc.
References mxArray::array_to_string().
Definition at line 3123 of file mex.cc.
References mxArray::calc_single_subscript(), and subs.
Definition at line 2534 of file mex.cc.
References mex::calloc(), and mex_context.
Definition at line 2569 of file mex.cc.
References dims, and maybe_mark_array().
Definition at line 2575 of file mex.cc.
References maybe_mark_array().
Referenced by mexCallMATLABWithTrap(), and mexEvalStringWithTrap().
Definition at line 2581 of file mex.cc.
References dims, maybe_mark_array(), and mxCHAR_CLASS.
Definition at line 2587 of file mex.cc.
References maybe_mark_array(), and str.
mxArray* mxCreateDoubleMatrix | ( | mwSize | m, |
mwSize | n, | ||
mxComplexity | flag | ||
) |
Definition at line 2593 of file mex.cc.
References maybe_mark_array(), and mxDOUBLE_CLASS.
Definition at line 2599 of file mex.cc.
References maybe_mark_array(), mxDOUBLE_CLASS, and val.
Definition at line 2605 of file mex.cc.
References dims, maybe_mark_array(), and mxLOGICAL_CLASS.
Definition at line 2611 of file mex.cc.
References maybe_mark_array(), and mxLOGICAL_CLASS.
Definition at line 2617 of file mex.cc.
References maybe_mark_array(), mxLOGICAL_CLASS, and val.
mxArray* mxCreateNumericArray | ( | mwSize | ndims, |
const mwSize * | dims, | ||
mxClassID | class_id, | ||
mxComplexity | flag | ||
) |
Definition at line 2623 of file mex.cc.
References dims, and maybe_mark_array().
mxArray* mxCreateNumericMatrix | ( | mwSize | m, |
mwSize | n, | ||
mxClassID | class_id, | ||
mxComplexity | flag | ||
) |
Definition at line 2630 of file mex.cc.
References maybe_mark_array().
mxArray* mxCreateSparse | ( | mwSize | m, |
mwSize | n, | ||
mwSize | nzmax, | ||
mxComplexity | flag | ||
) |
Definition at line 2651 of file mex.cc.
References maybe_mark_array(), and mxDOUBLE_CLASS.
Definition at line 2657 of file mex.cc.
References maybe_mark_array(), and mxLOGICAL_CLASS.
mxArray* mxCreateString | ( | const char * | str | ) |
Definition at line 2663 of file mex.cc.
References maybe_mark_array(), and str.
Referenced by mexCallMATLABWithTrap(), and mexEvalStringWithTrap().
mxArray* mxCreateStructArray | ( | mwSize | ndims, |
const mwSize * | dims, | ||
int | num_keys, | ||
const char ** | keys | ||
) |
Definition at line 2669 of file mex.cc.
References dims, and maybe_mark_array().
Definition at line 2676 of file mex.cc.
References maybe_mark_array().
Referenced by mexCallMATLABWithTrap(), and mexEvalStringWithTrap().
mxArray* mxCreateUninitNumericArray | ( | mwSize | ndims, |
const mwSize * | dims, | ||
mxClassID | class_id, | ||
mxComplexity | flag | ||
) |
Definition at line 2637 of file mex.cc.
References dims, and maybe_mark_array().
mxArray* mxCreateUninitNumericMatrix | ( | mwSize | m, |
mwSize | n, | ||
mxClassID | class_id, | ||
mxComplexity | flag | ||
) |
Definition at line 2644 of file mex.cc.
References maybe_mark_array().
void mxDestroyArray | ( | mxArray * | ptr | ) |
Definition at line 2690 of file mex.cc.
References mex::free_value(), and mex_context.
Definition at line 2683 of file mex.cc.
References mxArray::dup(), and maybe_mark_array().
void mxFree | ( | void * | ptr | ) |
Definition at line 2553 of file mex.cc.
References mex::free(), mex_context, and xfree().
Referenced by mxArray_struct::add_field(), mxArray_octave_value::as_mxArray(), mxArray_struct::remove_field(), mxArray_matlab::set_class_name(), mxArray_matlab::set_dimensions(), mxArray::set_name(), mex::~mex(), mxArray::~mxArray(), 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 3005 of file mex.cc.
References mxArray::get_cell().
Definition at line 2920 of file mex.cc.
References mxArray::get_data(), and mxIsChar().
Definition at line 2973 of file mex.cc.
References mxArray::get_class_id().
const char* mxGetClassName | ( | const mxArray * | ptr | ) |
Definition at line 2979 of file mex.cc.
References mxArray::get_class_name().
void* mxGetData | ( | const mxArray * | ptr | ) |
Definition at line 2935 of file mex.cc.
References mxArray::get_data().
Definition at line 2862 of file mex.cc.
References mxArray::get_dimensions().
Definition at line 3129 of file mex.cc.
References mxArray::get_element_size().
Definition at line 3067 of file mex.cc.
References mxGetFieldByNumber(), and mxGetFieldNumber().
Definition at line 3074 of file mex.cc.
References mxArray::get_field_by_number().
Referenced by mxGetField().
const char* mxGetFieldNameByNumber | ( | const mxArray * | ptr, |
int | key_num | ||
) |
Definition at line 3099 of file mex.cc.
References mxArray::get_field_name_by_number().
int mxGetFieldNumber | ( | const mxArray * | ptr, |
const char * | key | ||
) |
Definition at line 3105 of file mex.cc.
References mxArray::get_field_number().
Referenced by mxGetField(), and mxSetField().
void* mxGetImagData | ( | const mxArray * | ptr | ) |
Definition at line 2941 of file mex.cc.
References mxArray::get_imag_data().
double mxGetInf | ( | void | ) |
Definition at line 2521 of file mex.cc.
References lo_ieee_inf_value().
Definition at line 3018 of file mex.cc.
References mxArray::get_ir().
Definition at line 3024 of file mex.cc.
References mxArray::get_jc().
Definition at line 2929 of file mex.cc.
References mxArray::get_data().
Definition at line 2850 of file mex.cc.
References mxArray::get_m().
Definition at line 2856 of file mex.cc.
References mxArray::get_n().
double mxGetNaN | ( | void | ) |
Definition at line 2527 of file mex.cc.
References lo_ieee_nan_value().
Definition at line 2868 of file mex.cc.
References mxArray::get_number_of_dimensions().
Definition at line 2874 of file mex.cc.
References mxArray::get_number_of_elements().
int mxGetNumberOfFields | ( | const mxArray * | ptr | ) |
Definition at line 3093 of file mex.cc.
References mxArray::get_number_of_fields().
Definition at line 3030 of file mex.cc.
References mxArray::get_nzmax().
Definition at line 2908 of file mex.cc.
References mxArray::get_imag_data().
Definition at line 2902 of file mex.cc.
References mxArray::get_data().
Definition at line 2998 of file mex.cc.
References mxArray::get_property().
Definition at line 2914 of file mex.cc.
References mxArray::get_scalar().
Definition at line 3111 of file mex.cc.
References mxArray::get_string().
Definition at line 2698 of file mex.cc.
References mxArray::iscell().
Definition at line 2710 of file mex.cc.
References mxArray::is_class(), and name.
Definition at line 2716 of file mex.cc.
References mxArray::is_complex().
Definition at line 2722 of file mex.cc.
References mxArray::is_double().
Definition at line 2827 of file mex.cc.
References mxArray::isempty().
Definition at line 2497 of file mex.cc.
References lo_ieee_finite.
Definition at line 2728 of file mex.cc.
References mxArray::is_function_handle().
Definition at line 2503 of file mex.cc.
References lo_ieee_isinf.
Definition at line 2734 of file mex.cc.
References mxArray::is_int16().
Definition at line 2740 of file mex.cc.
References mxArray::is_int32().
Definition at line 2746 of file mex.cc.
References mxArray::is_int64().
Definition at line 2752 of file mex.cc.
References mxArray::is_int8().
Definition at line 2758 of file mex.cc.
References mxArray::is_logical().
Definition at line 2813 of file mex.cc.
References mxArray::is_logical_scalar().
Definition at line 2820 of file mex.cc.
References mxArray::is_logical_scalar_true().
Definition at line 2509 of file mex.cc.
References lo_ieee_isnan.
Definition at line 2764 of file mex.cc.
References mxArray::is_numeric().
Definition at line 2833 of file mex.cc.
References mxArray::is_scalar().
Definition at line 2770 of file mex.cc.
References mxArray::is_single().
Definition at line 2776 of file mex.cc.
References mxArray::is_sparse().
Definition at line 2782 of file mex.cc.
References mxArray::is_struct().
Definition at line 2788 of file mex.cc.
References mxArray::is_uint16().
Definition at line 2794 of file mex.cc.
References mxArray::is_uint32().
Definition at line 2800 of file mex.cc.
References mxArray::is_uint64().
Definition at line 2806 of file mex.cc.
References mxArray::is_uint8().
void* mxMalloc | ( | size_t | n | ) |
Definition at line 2540 of file mex.cc.
References mex::malloc(), and mex_context.
void* mxRealloc | ( | void * | ptr, |
size_t | size | ||
) |
Definition at line 2546 of file mex.cc.
References mex_context, and mex::realloc().
Referenced by mxArray_struct::add_field().
void mxRemoveField | ( | mxArray * | ptr, |
int | key_num | ||
) |
Definition at line 3061 of file mex.cc.
References mxArray::remove_field().
Definition at line 3011 of file mex.cc.
References mxArray::set_cell(), and val.
void mxSetClassName | ( | mxArray * | ptr, |
const char * | name | ||
) |
Definition at line 2985 of file mex.cc.
References name, and mxArray::set_class_name().
void mxSetData | ( | mxArray * | ptr, |
void * | pr | ||
) |
Definition at line 2960 of file mex.cc.
References maybe_unmark(), and mxArray::set_data().
Definition at line 2893 of file mex.cc.
References dims, maybe_unmark(), and mxArray::set_dimensions().
Definition at line 3080 of file mex.cc.
References mxGetFieldNumber(), mxSetFieldByNumber(), and val.
Definition at line 3087 of file mex.cc.
References mxArray::set_field_by_number(), and val.
Referenced by mexCallMATLABWithTrap(), mexEvalStringWithTrap(), and mxSetField().
void mxSetImagData | ( | mxArray * | ptr, |
void * | pi | ||
) |
Definition at line 2966 of file mex.cc.
References maybe_unmark(), octave::math::pi, and mxArray::set_imag_data().
Definition at line 3036 of file mex.cc.
References maybe_unmark(), and mxArray::set_ir().
Definition at line 3042 of file mex.cc.
References maybe_unmark(), and mxArray::set_jc().
Definition at line 2881 of file mex.cc.
References mxArray::set_m().
Definition at line 2887 of file mex.cc.
References mxArray::set_n().
Definition at line 3048 of file mex.cc.
References mxArray::set_nzmax().
Definition at line 2954 of file mex.cc.
References maybe_unmark(), octave::math::pi, and mxArray::set_imag_data().
Definition at line 2948 of file mex.cc.
References maybe_unmark(), and mxArray::set_data().
void mxSetProperty | ( | mxArray * | ptr, |
mwIndex | idx, | ||
const char * | property_name, | ||
const mxArray * | property_value | ||
) |
Definition at line 2991 of file mex.cc.
References mxArray::set_property().
|
static |
|
static |
Definition at line 65 of file mex.cc.
Referenced by mex::free(), mxFree(), and mex::~mex().
mex* mex_context = nullptr |
Definition at line 2435 of file mex.cc.
Referenced by call_mex(), mxArray::calloc(), mxArray::malloc(), maybe_mark_array(), maybe_mark_foreign(), maybe_unmark(), maybe_unmark_array(), mexAtExit(), mexCallMATLAB(), mexCallMATLABWithTrap(), mexFunctionName(), mexGetVariable(), mexIsLocked(), mexLock(), mexSetTrapFlag(), mexUnlock(), mxCalloc(), mxDestroyArray(), mxFree(), mxMalloc(), and mxRealloc().
std::map<std::string,int> mex_lock_count |
Definition at line 3629 of file mex.cc.
Referenced by mexLock(), and mexUnlock().