26 #if defined (HAVE_CONFIG_H)
62 if (file_name.empty ())
75 std::string class_name;
79 if (pos != std::string::npos)
81 std::string tmp = dir_name.substr (pos+1);
84 class_name = tmp.substr (1);
106 if (! file_name.empty ())
145 function_on_path = old_function_on_path;
158 if (full_name () == dispatch_type)
159 retval = load_class_constructor ();
167 if (!
retval.is_defined ())
169 std::string dir_name;
176 if (! file_name.empty ())
190 class_methods[dispatch_type] =
retval;
195 if (
retval.is_undefined ())
202 const std::list<std::string>& plist
205 auto it = plist.begin ();
207 while (it != plist.end ())
213 class_methods[dispatch_type] =
retval;
221 if (
retval.is_undefined ())
226 if (built_in_function.is_defined ())
232 retval = built_in_function;
234 class_methods[dispatch_type] =
retval;
267 sup_table[i][j] = (use_j ? jtyp : ityp);
278 std::string dispatch_type;
285 builtin_type = args(0).builtin_type ();
288 for (i = 1; i <
n; i++)
292 builtin_type = sup_table[builtin_type][bti];
304 dispatch_type = args(i).class_name ();
308 for (
int j = i+1; j <
n; j++)
320 dispatch_type = cname;
330 return dispatch_type;
363 if (
retval.is_undefined ())
373 retval = xfind (search_scope, args);
384 size_t pos =
name.rfind (
'.');
389 if (pos != std::string::npos)
391 fname =
name.substr (pos + 1);
392 pname =
name.substr (0, pos);
414 const std::string& dispatch_type =
"",
415 const std::string& package_name =
"")
437 const std::string& dispatch_type =
"",
438 bool check_relative =
true)
456 bool relative = check_relative && fcn->
is_relative ();
461 bool clear_breakpoints =
false;
462 std::string nm = fcn->
name ();
466 bool is_same_file =
false;
469 std::string dir_name;
473 int nm_len = nm.length ();
477 && (nm.substr (nm_len-4) ==
".oct"
478 || nm.substr (nm_len-4) ==
".mex"))
480 && nm.substr (nm_len-2) ==
".m")))
488 if (! dispatch_type.empty ())
504 const std::list<std::string>& plist
507 std::list<std::string>::const_iterator it
510 while (it != plist.end ())
541 file = lp.
find_fcn (nm, dir_name, pack);
561 clear_breakpoints =
true;
563 else if (is_same_file)
587 clear_breakpoints =
true;
594 clear_breakpoints =
true;
604 dispatch_type, pack);
606 clear_breakpoints =
true;
611 if (clear_breakpoints)
647 if (! fcn_file.empty ())
649 auto r = local_functions.find (fcn_file);
651 if (
r != local_functions.end ())
673 if (! dir_name.empty ())
675 auto q = private_functions.find (dir_name);
677 if (q == private_functions.end ())
741 auto q = class_constructors.find (
name);
743 if (q == class_constructors.end ())
770 if (cmdline_function.is_defined ())
771 return cmdline_function;
789 fcn = find_package ();
796 return built_in_function;
826 if (!
retval.is_defined ())
836 retval = x_builtin_find (search_scope);
846 if (built_in_function.is_defined ())
847 return built_in_function;
865 if (cmdline_function.is_defined ())
866 return cmdline_function;
874 std::string dir_name = search_scope.
dir_name ();
876 if (! dir_name.empty ())
878 auto q = private_functions.find (dir_name);
880 if (q == private_functions.end ())
910 if (! fcn_file.empty ())
912 auto r = local_functions.find (fcn_file);
914 if (
r != local_functions.end ())
942 auto q = class_methods.
find (dispatch_type);
944 if (q == class_methods.end ())
977 if (autoload_function.is_defined ())
980 if (! autoload_function.is_defined ())
987 if (! file_name.empty ())
991 std::string dir_name = file_name.substr (0, pos);
1001 return autoload_function;
1009 if (function_on_path.is_defined ())
1012 if (function_on_path.is_undefined ())
1014 std::string dir_name;
1020 std::string file_name = lp.
find_fcn (
name, dir_name, package_name);
1022 if (! file_name.empty ())
1028 function_on_path = ov_fcn;
1032 return function_on_path;
1042 if (package.is_undefined ())
1047 package = cdm.find_package_symbol (full_name ());
1056 if (built_in_function.is_defined ())
1063 warning (
"install_built_in_dispatch: '%s' already defined for class '%s'",
1064 name.c_str (), klass.c_str ());
1070 error (
"install_built_in_dispatch: '%s' is not a built-in function",
1077 std::map<std::string, octave_value>
m
1078 = {{
"name", full_name () },
1079 {
"package", package.dump () },
1084 {
"cmdline_function", cmdline_function.
dump () },
1085 {
"autoload_function", autoload_function.
dump () },
1086 {
"function_on_path", function_on_path.
dump () },
1087 {
"built_in_function", built_in_function.
dump () }};
1095 if (fcn_map.empty ())
1098 std::map<std::string, octave_value> info_map;
1100 for (
const auto& nm_fcn : fcn_map)
1102 std::string nm = nm_fcn.first;
1104 info_map[nm] = fcn.
dump ();
1111 DEFUN (ignore_function_time_stamp, args, nargout,
1133 int nargin = args.length ();
1140 if (nargout > 0 || nargin == 0)
1160 std::string sval = args(0).xstring_value (
"ignore_function_time_stamp: first argument must be a string");
1164 else if (sval ==
"system")
1166 else if (sval ==
"none")
1169 error (R
"(ignore_function_time_stamp: argument must be one of "all", "system", or "none")");
Array< octave_idx_type > find(octave_idx_type n=-1, bool backward=false) const
Find indices of (at most n) nonzero elements.
intmap remove_all_breakpoints_in_file(const std::string &fname, bool silent=false)
octave_value find_method_symbol(const std::string &method_name, const std::string &class_name)
octave_value load_private_function(const std::string &dir_name)
octave_value x_builtin_find(const symbol_scope &search_scope)
octave_value load_class_method(const std::string &dispatch_type)
octave_value find_autoload(void)
octave_value find_scoped_function(const symbol_scope &search_scope)
octave_value dump(void) const
octave_value builtin_find(const symbol_scope &search_scope)
void install_built_in_dispatch(const std::string &klass)
octave_value find_private_function(const std::string &dir_name)
octave_value find_package(void)
octave_value find_user_function(void)
octave_value load_class_constructor(void)
octave_value find(const symbol_scope &search_scope, const octave_value_list &args)
std::map< std::string, octave_value > private_functions
octave_value xfind(const symbol_scope &search_scope, const octave_value_list &args)
octave_value find_method(const std::string &dispatch_type)
octave_value find_user_function(void)
octave_value find_private_function(const std::string &dir_name) const
octave_value find_autoload(void)
octave_value find_scoped_function(const symbol_scope &search_scope) const
octave_value find_method(const std::string &dispatch_type) const
std::string find_private_fcn(const std::string &dir, const std::string &fcn, const std::string &pack_name="")
std::string find_method(const std::string &class_name, const std::string &meth, std::string &dir_name, const std::string &pack_name="")
std::string find_fcn(const std::string &fcn, std::string &dir_name, const std::string &pack_name="")
std::string fcn_file_name(void) const
octave_value find_subfunction(const std::string &name) const
std::string dir_name(void) const
bool is_superiorto(const std::string &a, const std::string &b)
std::list< std::string > parent_classes(const std::string &dispatch_type)
bool is_newer(const sys::time &time) const
static bool absolute_pathname(const std::string &s)
time_t unix_time(void) const
std::string lookup_autoload(const std::string &nm) const
virtual bool is_anonymous_function(void) const
virtual octave_function * function_value(bool silent=false)
virtual bool handles_dispatch_class(const std::string &) const
virtual std::string fcn_file_name(void) const
virtual octave::sys::time time_parsed(void) const
bool is_relative(void) const
std::string package_name(void) const
bool is_class_method(const std::string &cname="") const
virtual void push_dispatch_class(const std::string &)
virtual bool is_subfunction(void) const
virtual bool is_classdef_constructor(const std::string &="") const
std::string canonical_name(void) const
virtual octave::sys::time time_checked(void) const
virtual void mark_fcn_file_up_to_date(const octave::sys::time &)
virtual void mark_as_private_function(const std::string &cname="")
std::string name(void) const
virtual bool is_system_fcn_file(void) const
octave_idx_type length(void) const
builtin_type_t builtin_type(void) const
octave_value dump(void) const
bool is_defined(void) const
std::string class_name(void) const
octave_function * function_value(bool silent=false) const
bool is_undefined(void) const
OCTINTERP_API void print_usage(void)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void warning(const char *fmt,...)
void error(const char *fmt,...)
static int Vignore_function_time_stamp
std::string dir_sep_chars(void)
std::string canonicalize_file_name(const std::string &name)
static void split_name_with_package(const std::string &name, std::string &fname, std::string &pname)
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)
std::string get_dispatch_type(const octave_value_list &args, builtin_type_t &builtin_type)
static bool out_of_date_check(octave_value &function, const std::string &dispatch_type="", bool check_relative=true)
octave_value dump_function_map(const std::map< std::string, octave_value > &fcn_map)
bp_table & __get_bp_table__(const std::string &who)
tree_evaluator & __get_evaluator__(const std::string &who)
static builtin_type_t(* build_sup_table(void))[btyp_num_types]
static bool load_out_of_date_fcn(const std::string &ff, const std::string &dir_name, octave_value &function, const std::string &dispatch_type="", const std::string &package_name="")
sys::time Vlast_chdir_time
symbol_scope __get_current_scope__(const std::string &who)
symbol_table & __get_symbol_table__(const std::string &who)
bool same_file(const std::string &f, const std::string &g)
cdef_manager & __get_cdef_manager__(const std::string &who)
load_path & __get_load_path__(const std::string &who)
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
std::string btyp_class_name[btyp_num_types]
bool btyp_isinteger(builtin_type_t btyp)
bool btyp_isarray(builtin_type_t btyp)
octave_value::octave_value(const Array< char > &chm, char type) return retval