24 #if defined (HAVE_CONFIG_H) 53 if (file_name.empty ())
70 if (pos != std::string::npos)
75 class_name =
tmp.substr (1);
97 if (! file_name.empty ())
136 function_on_path = old_function_on_path;
149 if (full_name () == dispatch_type)
150 retval = load_class_constructor ();
170 if (! file_name.empty ())
184 class_methods[dispatch_type] =
retval;
196 const std::list<std::string>& plist =
199 std::list<std::string>::const_iterator it = plist.begin ();
201 while (it != plist.end ())
207 class_methods[dispatch_type] =
retval;
220 if (built_in_function.is_defined ())
226 retval = built_in_function;
228 class_methods[dispatch_type] =
retval;
261 sup_table[
i][j] = (use_j ? jtyp : ityp);
279 builtin_type = args(0).builtin_type ();
282 for (
i = 1;
i < n;
i++)
286 builtin_type = sup_table[builtin_type][bti];
298 dispatch_type = args(
i).class_name ();
302 for (
int j =
i+1; j < n; j++)
314 dispatch_type = cname;
324 return dispatch_type;
362 retval = xfind (args, local_funcs);
378 = curr_scope ? curr_scope.
function () :
nullptr;
392 if (fcn_file.empty ()
396 = curr_scope.
parent_scope ()->function ()->fcn_file_name();
399 if (! fcn_file.empty ())
403 if (r != local_functions.end ())
421 if (! dir_name.empty ())
425 if (q == private_functions.end ())
429 if (
val.is_defined ())
445 if (
val.is_defined ())
469 if (q == class_constructors.end ())
473 if (
val.is_defined ())
489 if (
val.is_defined ())
496 if (cmdline_function.is_defined ())
497 return cmdline_function;
515 fcn = find_package ();
522 return built_in_function;
558 retval = x_builtin_find ();
568 if (built_in_function.is_defined ())
569 return built_in_function;
587 if (cmdline_function.is_defined ())
588 return cmdline_function;
602 if (! dir_name.empty ())
606 if (q == private_functions.end ())
610 if (
val.is_defined ())
626 if (
val.is_defined ())
639 if (! fcn_file.empty ())
643 if (r != local_functions.end ())
662 if (
val.is_defined ())
676 if (q == class_methods.end ())
680 if (
val.is_defined ())
696 if (
val.is_defined ())
709 if (autoload_function.is_defined ())
712 if (! autoload_function.is_defined ())
716 if (! file_name.empty ())
730 return autoload_function;
738 if (function_on_path.is_defined ())
741 if (function_on_path.is_undefined ())
751 if (! file_name.empty ())
757 function_on_path = ov_fcn;
761 return function_on_path;
771 if (package.is_undefined ())
779 package = octave_value (fcn);
788 if (built_in_function.is_defined ())
795 warning (
"install_built_in_dispatch: '%s' already defined for class '%s'",
796 name.c_str (), klass.c_str ());
802 error (
"install_built_in_dispatch: '%s' is not a built-in function",
809 std::map<std::string, octave_value> m
810 = {{
"name", full_name () },
811 {
"package", package.
dump () },
816 {
"cmdline_function", cmdline_function.
dump () },
817 {
"autoload_function", autoload_function.
dump () },
818 {
"function_on_path", function_on_path.
dump () },
819 {
"built_in_function", built_in_function.
dump () }};
827 if (fcn_map.empty ())
830 std::map<std::string, octave_value> info_map;
832 for (
const auto& nm_fcn : fcn_map)
octave_value find(const octave_value_list &args, bool local_funcs)
octave_value builtin_find(void)
octave_value x_builtin_find(void)
octave_value dump_function_map(const std::map< std::string, octave_value > &fcn_map)
octave_function * find_package_symbol(const std::string &pack_name)
octave_value load_class_constructor(void)
octave_value load_class_method(const std::string &dispatch_type)
octave_value dump(void) const
std::string dir_sep_chars(void)
std::map< std::string, octave_value > private_functions
identity matrix If supplied two scalar respectively For allows like xample val
octave_value find_method(const std::string &dispatch_type)
OCTINTERP_API octave_value load_fcn_from_file(const std::string &file_name, const std::string &dir_name="", const std::string &dispatch_type="", const std::string &package_name="", const std::string &fcn_name="", bool autoload=false)
void error(const char *fmt,...)
bool is_superiorto(const std::string &a, const std::string &b)
octave_function * find_method_symbol(const std::string &method_name, const std::string &class_name)
bool btyp_isarray(builtin_type_t btyp)
bool is_defined(void) const
octave_value find_user_function(void)
OCTINTERP_API std::string lookup_autoload(const std::string &nm)
symbol_scope __get_current_scope__(const std::string &who)
cdef_manager & __get_cdef_manager__(const std::string &who)
virtual bool is_classdef_constructor(const std::string &="") const
std::string find_method(const std::string &class_name, const std::string &meth, std::string &dir_name, const std::string &pack_name="")
static builtin_type_t(* build_sup_table(void))[btyp_num_types]
std::list< std::string > parent_classes(const std::string &dispatch_type)
bool is_defined(void) const
octave_value dump(void) const
symbol_table & __get_symbol_table__(const std::string &who)
nd deftypefn *std::string name
std::shared_ptr< symbol_scope_rep > parent_scope(void) const
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
std::string find_private_fcn(const std::string &dir, const std::string &fcn, const std::string &pack_name="")
std::string find_fcn(const std::string &fcn, std::string &dir_name, const std::string &pack_name="")
std::string get_dispatch_type(const octave_value_list &args, builtin_type_t &builtin_type)
std::string btyp_class_name[btyp_num_types]
std::map< std::string, octave_value >::iterator str_val_iterator
virtual bool handles_dispatch_class(const std::string &) const
virtual bool is_class_method(const std::string &="") const
octave_value find_subfunction(const std::string &name) const
virtual void mark_as_private_function(const std::string &cname="")
octave_value xfind(const octave_value_list &args, bool local_funcs)
octave_function * function_value(bool silent=false) const
virtual octave_value dump(void) const
std::string class_name(void) const
octave_value find_method(const std::string &dispatch_type) const
std::string dir_name(void) const
bool btyp_isinteger(builtin_type_t btyp)
load_path & __get_load_path__(const std::string &who)
bool is_anonymous_function(void) const
void warning(const char *fmt,...)
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
std::string fcn_file_name(void) const
builtin_type_t builtin_type(void) const
void install_built_in_dispatch(const std::string &klass)
bool is_undefined(void) const
octave_value find_package(void)
octave_value find_autoload(void)
bool out_of_date_check(octave_value &function, const std::string &dispatch_type, bool check_relative)
octave_idx_type length(void) const
octave_value find_autoload(void)
virtual octave_function * function_value(bool silent=false)
octave_value load_private_function(const std::string &dir_name)
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
virtual void push_dispatch_class(const std::string &)
octave_user_function * function(void)
octave_value find_user_function(void)