26 #if defined (HAVE_CONFIG_H)
64 if (canonical_dir.empty ())
70 if (! is_absolute_path)
75 if (dir.compare (0, cwd.length (), cwd) == 0)
76 dir.erase (0, cwd.length ()+1);
99 static std::list<std::string>
102 std::list<std::string> retval;
107 std::size_t
len = p.length ();
109 while (end != std::string::npos)
111 std::string elt = p.substr (beg, end-beg);
114 retval.push_back (elt);
124 std::string elt = p.substr (beg);
127 retval.push_back (elt);
137 std::string dir = dir_arg;
139 std::size_t k = dir.length ();
144 if (k < dir.length ())
171 std::string dir_name = curr_code->
dir_name ();
173 if (! dir_name.empty ())
179 sys::file_stat fs (pfname);
181 if (fs.exists () && fs.is_reg ())
194 std::size_t ps = path.size ();
195 std::size_t pls = path_list.size ();
196 std::size_t pos = path_list.find (path);
198 while (pos != std::string::npos)
200 if ((pos == 0 || path_list[pos-1] == psc)
201 && (pos + ps == pls || path_list[pos + ps] == psc))
204 pos = path_list.find (path, pos + 1);
254 sys::dir_entry dir (
d);
264 std::string fname = flist[i];
268 sys::file_stat fs (full_name);
272 if (fs && fs.is_dir ()
273 && (fname[0] ==
'@' || fname[0] ==
'+' || fname ==
"private")
274 && ((fs.mtime () + fs.time_resolution () > last_checked)
275 || ((fname[0] ==
'@' || fname[0] ==
'+')
282 std::string msg = dir.error ();
283 warning (
"load_path: %s: %s",
d.c_str (), msg.c_str ());
293 : add_hook ([=] (const std::string& dir) { this->
execute_pkg_add (dir); }),
294 remove_hook ([=] (
const std::string& dir) { this->
execute_pkg_del (dir); }),
295 m_interpreter (interp), m_package_map (), m_top_level_package (),
296 m_dir_info_list (), m_init_dirs (), m_command_line_path ()
304 if (set_initial_path)
320 tpath = sys::env::getenv (
"OCTAVE_PATH");
324 if (! tpath.empty ())
334 set (xpath,
false,
true);
353 for (
auto& elt : elts)
357 std::set<std::string> elts_set (elts.begin (), elts.end ());
365 if (elts_set.find (init_dir) == elts_set.end ())
368 "default load path altered. Some built-in functions may not be found. Try restoredefaultpath() to recover it.");
383 for (
const auto& elt : elts)
405 add (dir,
true, warn);
412 add (dir,
false, warn);
420 if (! dir_arg.empty ())
424 warning (R
"(rmpath: can't remove "." from path)");
469 bool ok = di.update ();
473 (
"Octave:load-path:update-failed",
474 "load-path: update failed for '%s', removing from path",
475 di.dir_name.c_str ());
477 add (di,
true,
"",
true);
500 const std::string& dir)
503 bool addpath_option =
true;
505 std::string curr_dir = sys::env::get_current_directory ();
514 std::string base_file = (file.length () > dir.length ())
515 ? file.substr (dir.length () + 1)
516 : sys::env::base_pathname (file);
518 std::string lp_file =
find_file (base_file);
520 if (dir_in_load_path)
538 addpath_option =
false;
572 std::list<std::string>
575 std::list<std::string> retval;
582 nm_ldr.second.overloads (meth, retval);
587 std::list<std::string>
590 std::list<std::string> retval;
594 if (! only_top_level || dir_ldr.first.find (
'.') == std::string::npos)
595 retval.push_back (dir_ldr.first);
607 || sys::env::rooted_relative_pathname (file))
609 sys::file_stat fs (file);
611 return fs.exists () ? file : retval;
617 if (! tfile.empty ())
622 != std::string::npos)
630 sys::file_stat fs (tfile);
647 if (all_files[i] == file)
663 || sys::env::rooted_relative_pathname (dir)))
665 sys::file_stat fs (dir);
667 if (fs.exists () && fs.is_dir ())
675 std::string dname = di.abs_dir_name;
677 std::size_t dname_len = dname.length ();
679 if (dname.substr (dname_len - 1)
682 dname = dname.substr (0, dname_len - 1);
686 std::size_t dir_len = canon_dir.length ();
688 if (dname_len > dir_len
690 && canon_dir == dname.substr (dname_len - dir_len))
692 sys::file_stat fs (di.dir_name);
694 if (fs.exists () && fs.is_dir ())
695 return di.abs_dir_name;
706 std::list<std::string> retlist;
710 || sys::env::rooted_relative_pathname (dir)))
712 sys::file_stat fs (dir);
714 if (fs.exists () && fs.is_dir ())
715 retlist.push_back (dir);
722 std::string dname = di.abs_dir_name;
724 std::size_t dname_len = dname.length ();
726 if (dname.substr (dname_len - 1)
729 dname = dname.substr (0, dname_len - 1);
733 std::size_t dir_len = canon_dir.length ();
735 if (dname_len > dir_len
737 && canon_dir == dname.substr (dname_len - dir_len))
739 sys::file_stat fs (di.dir_name);
741 if (fs.exists () && fs.is_dir ())
742 retlist.push_back (di.abs_dir_name);
755 std::string dir_name;
756 std::string file_name;
765 std::string file = flist[i];
768 != std::string::npos)
771 || sys::env::rooted_relative_pathname (file))
773 sys::file_stat fs (file);
785 sys::file_stat fs (tfile);
793 rel_flist[rel_flen++] = file;
796 rel_flist.
resize (rel_flen);
808 if (all_files[i] == rel_flist[j])
810 dir_name = di.abs_dir_name;
811 file_name = rel_flist[j];
821 if (! dir_name.empty ())
830 std::list<std::string> retlist;
832 std::string dir_name;
833 std::string file_name;
842 std::string file = flist[i];
845 != std::string::npos)
848 || sys::env::rooted_relative_pathname (file))
850 sys::file_stat fs (file);
853 retlist.push_back (file);
862 sys::file_stat fs (tfile);
865 retlist.push_back (tfile);
870 rel_flist[rel_flen++] = file;
873 rel_flist.
resize (rel_flen);
885 if (all_files[i] == rel_flist[j])
905 retval[k++] = di.dir_name;
910 std::list<std::string>
913 std::list<std::string> retval;
916 retval.push_back (di.dir_name);
929 retval = p->fcn_files;
937 std::string fname = retval[i];
939 std::size_t pos = fname.rfind (
'.');
941 if (pos != std::string::npos)
942 retval[i] = fname.substr (0, pos);
980 if (! fcn_files.
empty ())
982 os <<
"\n*** function files in " << di.dir_name <<
":\n\n";
988 = di.method_file_map;
990 if (! method_file_map.empty ())
992 for (
const auto& cls_ci : method_file_map)
994 os <<
"\n*** methods in " << di.dir_name
995 <<
"/@" << cls_ci.first <<
":\n\n";
1009 nm_ldr.second.display (os);
1025 const std::string& script_file)
1032 sys::file_stat fs (file);
1052 if (retval->dir_name == dir)
1072 if (retval->dir_name == dir)
1110 l.
move (di, at_end);
1114 for (
const auto& pkg_di : package_dir_map)
1116 std::string full_name = pkg_di.first;
1118 if (! pname.empty ())
1119 full_name = pname +
'.' + full_name;
1121 move (pkg_di.second, at_end, full_name);
1128 std::size_t
len = dir_arg.length ();
1130 if (
len > 1 && dir_arg.substr (
len-2) ==
"//")
1132 "trailing '//' is no longer special in search path elements");
1146 sys::file_stat fs (dir);
1167 warning (
"addpath: %s: not a directory", dir_arg.c_str ());
1171 std::string msg = fs.error ();
1172 warning (
"addpath: %s: %s", dir_arg.c_str (), msg.c_str ());
1193 for (
const auto& pkg_di : package_dir_map)
1195 std::string full_name = pkg_di.first;
1197 if (! pname.empty ())
1198 full_name = pname +
'.' + full_name;
1200 remove (pkg_di.second, full_name);
1221 std::string enc_val =
"delete";
1226 unwind_action close_file ([cfile] (
void) { fclose (cfile); });
1230 const std::string enc_prop =
"encoding";
1233 std::string conf_str =
fgets (cfile, eof);
1236 auto it = std::find_if_not (conf_str.begin (), conf_str.end (),
1237 [] (
unsigned char c)
1238 { return std::isblank (c); });
1239 conf_str.erase (conf_str.begin (), it);
1242 if (conf_str.compare (0, enc_prop.size (), enc_prop) == 0)
1245 std::size_t pos = conf_str.find_first_not_of (
" \t=:",
1247 if (pos == std::string::npos)
1250 std::string enc_val = conf_str.substr (pos);
1253 it = std::find_if_not (enc_val.begin (), enc_val.end (),
1254 [] (
unsigned char c)
1255 { return std::isalnum (c) || c ==
'-'; });
1256 enc_val.erase(it, enc_val.end ());
1258 if (enc_val.empty ())
1271 std::string enc_val =
"delete";
1281 if (di.is_package (name))
1290 const std::string& pname,
bool updating)
1294 l.
add (di, at_end, updating);
1298 for (
const auto& pkg_di : package_dir_map)
1300 std::string full_name = pkg_di.first;
1302 if (! pname.empty ())
1303 full_name = pname +
'.' + full_name;
1305 add (pkg_di.second, at_end, full_name);
1318 for (
const auto& nm_typ : lst)
1320 std::string nm = nm_typ.first;
1322 int types = nm_typ.second;
1331 retval[count++] = nm;
1346 warning (
"load_path: %s: %s",
d.c_str (), msg.c_str ());
1353 std::string fname = flist[i];
1355 std::size_t pos = fname.rfind (
'.');
1357 if (pos != std::string::npos)
1359 std::string base = fname.substr (0, pos);
1360 std::string ext = fname.substr (pos);
1368 else if (ext ==
".oct")
1370 else if (ext ==
".mex")
1376 = retval.find (base);
1378 if (p == retval.end ())
1398 std::string msg = fs.error ();
1400 "load_path: %s: %s",
dir_name.c_str (), msg.c_str ());
1422 if ((fs.mtime () + fs.time_resolution ()
1467 std::size_t pos = name.find (
'.');
1469 if (pos == std::string::npos)
1470 return package_dir_map.find (name) != package_dir_map.end ();
1473 std::string name_head = name.substr (0, pos);
1474 std::string name_tail = name.substr (pos + 1);
1478 if (it != package_dir_map.end ())
1479 return it->second.is_package (name_tail);
1490 dir_time_last_checked = sys::time (
static_cast<OCTAVE_TIME_T
> (0));
1492 sys::file_stat fs (dir_name);
1496 method_file_map.clear ();
1497 package_dir_map.clear ();
1499 dir_mtime = fs.mtime ();
1500 dir_time_last_checked = sys::time ();
1526 std::string msg = fs.error ();
1527 warning (
"load_path: %s: %s", dir_name.c_str (), msg.c_str ());
1539 warning (
"load_path: %s: %s",
d.c_str (), msg.c_str ());
1545 all_files.resize (
len);
1546 fcn_files.resize (
len);
1553 std::string fname = flist[i];
1557 sys::file_stat fs (full_name);
1563 if (fname ==
"private")
1564 get_private_file_map (full_name);
1565 else if (fname[0] ==
'@')
1566 get_method_file_map (full_name, fname.substr (1));
1567 else if (fname[0] ==
'+')
1568 get_package_dir (full_name, fname.substr (1));
1572 all_files[all_files_count++] = fname;
1574 std::size_t pos = fname.rfind (
'.');
1576 if (pos != std::string::npos)
1578 std::string ext = fname.substr (pos);
1580 if (ext ==
".m" || ext ==
".oct" || ext ==
".mex")
1582 std::string base = fname.substr (0, pos);
1585 fcn_files[fcn_files_count++] = fname;
1592 all_files.resize (all_files_count);
1593 fcn_files.resize (fcn_files_count);
1604 const std::string& class_name)
1610 sys::file_stat fs (pd);
1612 if (fs && fs.is_dir ())
1613 method_file_map[class_name].private_file_map =
get_fcn_files (pd);
1618 const std::string& package_name)
1620 package_dir_map[package_name] =
dir_info (
d);
1628 auto s =
std::find (m_dir_list.begin (), m_dir_list.end (), dir_name);
1630 if (s != m_dir_list.end ())
1632 m_dir_list.erase (s);
1635 m_dir_list.push_back (dir_name);
1637 m_dir_list.push_front (dir_name);
1640 move_fcn_map (dir_name, di.
fcn_files, at_end);
1644 move_method_map (dir_name, at_end);
1654 m_dir_list.remove (dir);
1656 remove_fcn_map (dir, fcn_files);
1658 remove_private_fcn_map (dir);
1660 remove_method_map (dir);
1666 os <<
"*** package_info: "
1667 << (m_package_name.empty () ?
"<top-level>" : m_package_name)
1670 for (
const auto& dir : m_dir_list)
1674 for (
const auto& dir_fnlst : m_private_fcn_map)
1676 os <<
"\n*** private functions in "
1680 print_fcn_list (os, dir_fnlst.second);
1683 #if defined (DEBUG_LOAD_PATH)
1685 for (
const auto& nm_filst : m_fcn_map)
1687 os << nm_filst.first <<
":\n";
1691 for (
const auto& finfo : file_info_list)
1693 os <<
" " << finfo.dir_name <<
" (";
1695 print_types (os, finfo.types);
1701 for (
const auto& cls_fnmap : m_method_map)
1703 os <<
"CLASS " << cls_fnmap.first <<
":\n";
1707 for (
const auto& nm_fnlst : m_fcn_map)
1709 os <<
" " << nm_fnlst.first <<
":\n";
1713 for (
const auto& finfo : file_info_list)
1715 os <<
" " << finfo.dir_name <<
" (";
1717 print_types (os, finfo.types);
1731 std::string& dir_name,
1738 if (fcn.length () > 0 && fcn[0] ==
'@')
1740 std::size_t pos = fcn.find (
'/');
1742 if (pos != std::string::npos)
1744 std::string class_name = fcn.substr (1, pos-1);
1745 std::string meth = fcn.substr (pos+1);
1747 retval =
find_method (class_name, meth, dir_name);
1758 if (p != m_fcn_map.end ())
1762 for (
const auto&
fi : file_info_list)
1766 if (check_file_type (retval, type,
fi.types,
1767 fcn,
"load_path::find_fcn"))
1769 dir_name =
fi.dir_name;
1783 const std::string& fcn,
1792 if (q != m_private_fcn_map.end ())
1798 if (p != fcn_file_map.end ())
1804 if (check_file_type (fname, type, p->second, fcn,
1805 "load_path::find_private_fcn"))
1815 const std::string& meth,
1816 std::string& dir_name,
1827 if (q != m_method_map.end ())
1837 for (
const auto&
fi : file_info_list)
1841 bool found = check_file_type (retval, type,
fi.types,
1842 meth,
"load_path::find_method");
1846 dir_name =
fi.dir_name;
1858 std::list<std::string>
1861 std::list<std::string> retval;
1867 if (mtd_map_it != m_method_map.end ())
1869 for (
const auto& nm_filst : mtd_map_it->second)
1870 retval.push_back (nm_filst.first);
1873 if (! retval.empty ())
1881 std::list<std::string>& l)
const
1883 for (
const auto& cls_fnmap : m_method_map)
1887 if (
m.find (meth) !=
m.end ())
1889 std::string class_name = cls_fnmap.first;
1891 if (! m_package_name.empty ())
1892 class_name = m_package_name +
'.' + class_name;
1894 l.push_back (class_name);
1902 std::size_t
len = m_fcn_map.size ();
1908 for (
const auto& nm_filst : m_fcn_map)
1909 retval[count++] = nm_filst.first;
1916 bool at_end,
bool updating)
1926 std::string fname = fcn_files[i];
1929 std::string base = fname;
1931 std::size_t pos = fname.rfind (
'.');
1933 if (pos != std::string::npos)
1935 base = fname.substr (0, pos);
1936 ext = fname.substr (pos);
1941 auto p = file_info_list.begin ();
1943 while (p != file_info_list.end ())
1945 if (p->dir_name == dir_name)
1954 else if (ext ==
".oct")
1956 else if (ext ==
".mex")
1959 if (p == file_info_list.end ())
1966 if (file_info_list.empty ())
1976 "function %s shadows a built-in function",
1982 file_info& old = file_info_list.front ();
1991 if (fname !=
"Contents.m"
1999 "function %s shadows a core library function",
2008 file_info_list.push_back (
fi);
2010 file_info_list.push_front (
fi);
2026 if (! private_file_map.empty ())
2038 for (
const auto& cls_ci : method_file_map)
2040 std::string class_name = cls_ci.first;
2044 std::string full_dir_name
2052 for (
const auto& nm_typ :
m)
2054 std::string base = nm_typ.first;
2055 int types = nm_typ.second;
2059 auto p2 = file_info_list.begin ();
2060 while (p2 != file_info_list.end ())
2062 if (p2->dir_name == full_dir_name)
2068 if (p2 == file_info_list.end ())
2073 file_info_list.push_back (
fi);
2075 file_info_list.push_front (
fi);
2089 if (! private_file_map.empty ())
2090 m_private_fcn_map[full_dir_name] = private_file_map;
2103 std::string fname = fcn_files[k];
2106 std::string base = fname;
2108 std::size_t pos = fname.rfind (
'.');
2110 if (pos != std::string::npos)
2112 base = fname.substr (0, pos);
2113 ext = fname.substr (pos);
2118 if (file_info_list.size () == 1)
2122 for (
auto fi_it = file_info_list.begin ();
2123 fi_it != file_info_list.end ();
2126 if (fi_it->dir_name == dir_name)
2130 file_info_list.erase (fi_it);
2133 file_info_list.push_back (fi_tmp);
2135 file_info_list.push_front (fi_tmp);
2148 for (
auto& cls_fnmap : m_method_map)
2150 std::string class_name = cls_fnmap.first;
2154 std::string full_dir_name
2157 for (
auto& nm_filst : fn_map)
2161 if (file_info_list.size () == 1)
2165 for (
auto fi_it = file_info_list.begin ();
2166 fi_it != file_info_list.end (); fi_it++)
2168 if (fi_it->dir_name == full_dir_name)
2172 file_info_list.erase (fi_it);
2175 file_info_list.push_back (fi_tmp);
2177 file_info_list.push_front (fi_tmp);
2195 std::string fname = fcn_files[k];
2198 std::string base = fname;
2200 std::size_t pos = fname.rfind (
'.');
2202 if (pos != std::string::npos)
2204 base = fname.substr (0, pos);
2205 ext = fname.substr (pos);
2210 for (
auto fi_it = file_info_list.begin ();
2211 fi_it != file_info_list.end ();
2214 if (fi_it->dir_name == dir)
2216 file_info_list.erase (fi_it);
2218 if (file_info_list.empty ())
2219 m_fcn_map.erase (fname);
2230 auto p = m_private_fcn_map.find (dir);
2232 if (p != m_private_fcn_map.end ())
2233 m_private_fcn_map.erase (p);
2239 for (
auto& cls_fnmap : m_method_map)
2241 std::string class_name = cls_fnmap.first;
2245 std::string full_dir_name
2248 for (
auto& nm_filst : fn_map)
2252 if (file_info_list.size () == 1)
2256 for (
auto fi_it = file_info_list.begin ();
2257 fi_it != file_info_list.end (); fi_it++)
2259 if (fi_it->dir_name == full_dir_name)
2261 file_info_list.erase (fi_it);
2277 const std::string& fcn,
2278 const char *who)
const
2280 bool retval =
false;
2365 error (
"%s: %s: invalid type code = %d", who, fcn.c_str (), type);
2373 bool printed_type =
false;
2378 printed_type =
true;
2386 printed_type =
true;
2394 printed_type =
true;
2402 for (
const auto& nm_typ : lst)
2404 os <<
" " << nm_typ.first <<
" (";
2406 print_types (os, nm_typ.second);
2424 dirlist = dirlist.
sort (
false);
2430 std::string elt = dirlist[i];
2432 bool skip_p = (elt ==
"." || elt ==
".." || elt[0] ==
'@'
2439 skip_p = (elt == skip[j]);
2448 sys::file_stat fs (nm);
2450 if (fs && fs.is_dir ())
2475 int nargin = args.length ();
2484 std::string
dirname = args(0).xstring_value (
"genpath: DIR must be a string");
2490 std::string
dirname = args(0).xstring_value (
"genpath: all arguments must be strings");
2495 skip[i-1] = args(i).xstring_value (
"genpath: all arguments must be strings");
2514 DEFMETHOD (command_line_path, interp, args, ,
2523 if (! args.empty ())
2526 load_path& lp = interp.get_load_path ();
2531 DEFMETHOD (restoredefaultpath, interp, args, ,
2540 if (! args.empty ())
2543 load_path& lp = interp.get_load_path ();
2561 load_path& lp = interp.get_load_path ();
2587 int nargin = args.length ();
2591 load_path& lp = interp.get_load_path ();
2595 std::string
path = argv[1];
2597 for (
int i = 2; i <= nargin; i++)
2607 else if (nargin == 0 && nargout == 0)
2610 "\nOctave's search path contains the following directories:\n\n";
2622 DEFMETHOD (addpath, interp, args, nargout,
2657 int nargin = args.length ();
2662 load_path& lp = interp.get_load_path ();
2667 retval = lp.
path ();
2677 if (option ==
"-end")
2682 else if (option ==
"-begin")
2687 int val = option_arg.
xint_value (
"addpath: OPTION must be '-begin'/0 or '-end'/1");
2697 error (
"addpath: OPTION must be '-begin'/0 or '-end'/1");
2700 bool need_to_update =
false;
2706 for (
int i = 0; i < arglist.
length (); i++)
2708 std::string arg = arglist(i).xstring_value (
"addpath: all arguments must be strings");
2710 std::list<std::string> dir_elts =
split_path (arg);
2713 std::reverse (dir_elts.begin (), dir_elts.end ());
2715 for (
auto dir : dir_elts)
2718 auto it_start = dir.begin ();
2719 #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM)
2723 dir.erase (std::unique
2724 (it_start, dir.end (),
2727 return l == r && sys::file_ops::is_dir_sep (l);
2732 if (pos == std::string::npos)
2734 if (! dir.empty () && dir[0] ==
'+')
2736 "addpath: package directories should not be "
2737 "added to path: %s\n", dir.c_str ());
2741 if (pos + 1 < dir.length () && dir[pos+1] ==
'+')
2743 "addpath: package directories should not be "
2744 "added to path: %s\n", dir.c_str ());
2752 need_to_update =
true;
2762 DEFMETHOD (rmpath, interp, args, nargout,
2785 int nargin = args.length ();
2792 load_path& lp = interp.get_load_path ();
2795 retval = lp.
path ();
2797 bool need_to_update =
false;
2799 for (
int i = 0; i < nargin; i++)
2801 std::string arg = args(i).xstring_value (
"rmpath: all arguments must be strings");
2802 std::list<std::string> dir_elts =
split_path (arg);
2804 for (
const auto& dir : dir_elts)
2810 warning (
"rmpath: %s: not found", dir.c_str ());
2812 need_to_update =
true;
2822 DEFMETHOD (__dump_load_path__, interp, , ,
2828 load_path& lp = interp.get_load_path ();
ComplexNDArray concat(NDArray &ra, ComplexNDArray &rb, const Array< octave_idx_type > &ra_idx)
static std::string path_sep_str(void)
static char path_sep_char(void)
Provides threadsafe access to octave.
void update_path_dialog(void)
int debug_cd_or_addpath_error(const std::string &file, const std::string &dir, bool addpath_option)
event_manager & get_event_manager(void)
int chdir(const std::string &dir)
void recover_from_exception(void)
package_dir_map_type package_dir_map
sys::time dir_time_last_checked
void get_file_list(const std::string &d)
std::map< std::string, dir_info > package_dir_map_type
fcn_file_map_type::iterator fcn_file_map_iterator
void get_private_file_map(const std::string &d)
std::map< std::string, int > fcn_file_map_type
fcn_file_map_type::const_iterator const_fcn_file_map_iterator
std::map< std::string, class_info > method_file_map_type
void get_package_dir(const std::string &d, const std::string &package_name)
fcn_file_map_type private_file_map
void get_method_file_map(const std::string &d, const std::string &class_name)
package_dir_map_type::const_iterator const_package_dir_map_iterator
method_file_map_type method_file_map
bool is_package(const std::string &name) const
std::string find_method(const std::string &class_name, const std::string &meth, std::string &dir_name, int type=M_FILE|OCT_FILE|MEX_FILE) const
void add_to_private_fcn_map(const dir_info &di)
void remove_method_map(const std::string &dir)
std::string find_fcn(const std::string &fcn, std::string &dir_name, int type=M_FILE|OCT_FILE|MEX_FILE) const
void add_to_method_map(const dir_info &di, bool at_end)
std::list< std::string > methods(const std::string &class_name) const
void remove_fcn_map(const std::string &dir, const string_vector &fcn_files)
void move(const dir_info &di, bool at_end)
void add(const dir_info &di, bool at_end, bool updating)
void overloads(const std::string &meth, std::list< std::string > &l) const
bool check_file_type(std::string &fname, int type, int possible_types, const std::string &fcn, const char *who) const
void add_to_fcn_map(const dir_info &di, bool at_end, bool updating)
void remove(const dir_info &di)
void move_method_map(const std::string &dir, bool at_end)
void display(std::ostream &out) const
std::string find_private_fcn(const std::string &dir, const std::string &fcn, int type=M_FILE|OCT_FILE|MEX_FILE) const
void remove_private_fcn_map(const std::string &dir)
void print_fcn_list(std::ostream &os, const dir_info::fcn_file_map_type &lst) const
void move_fcn_map(const std::string &dir, const string_vector &fcn_files, bool at_end)
void print_types(std::ostream &os, int types) const
string_vector fcn_names(void) const
std::string find_first_of(const string_vector &files) const
string_vector files(const std::string &dir, bool omit_exts=false) const
string_vector find_matching_dirs(const std::string &dir) const
void set(const std::string &p, bool warn=false, bool is_init=false)
static std::string s_sys_path
std::list< file_info > file_info_list_type
const_dir_info_list_iterator find_dir_info(const std::string &dir) const
method_map_type::const_iterator const_method_map_iterator
dir_info_list_type::const_iterator const_dir_info_list_iterator
load_path(interpreter &interp)
bool contains_canonical(const std::string &dir_name) const
bool contains(const std::string &dir) const
string_vector find_all_first_of(const string_vector &files) const
void prepend(const std::string &dir, bool warn=false)
void initialize(bool set_initial_path=false)
string_vector dirs(void) const
dir_info_list_type m_dir_info_list
std::map< std::string, dir_info > abs_dir_cache_type
std::set< std::string > m_init_dirs
static abs_dir_cache_type s_abs_dir_cache
dir_info_list_type::iterator dir_info_list_iterator
void move(dir_info_list_iterator i, bool at_end)
std::string find_file(const std::string &file) const
friend dir_info::fcn_file_map_type get_fcn_files(const std::string &d)
string_vector fcn_names(void) const
std::function< void(const std::string &)> add_hook
interpreter & m_interpreter
package_map_type m_package_map
std::string system_path(void) const
package_info m_top_level_package
void display(std::ostream &os) const
std::string path(void) const
void read_dir_config(const std::string &dir) const
void execute_pkg_add(const std::string &dir)
bool remove(const std::string &dir)
std::string find_dir(const std::string &dir) const
std::list< std::string > overloads(const std::string &meth) const
std::list< std::string > dir_list(void) const
std::string get_command_line_path(void) const
fcn_map_type::const_iterator const_fcn_map_iterator
abs_dir_cache_type::const_iterator const_abs_dir_cache_iterator
package_info & get_package(const std::string &name)
bool contains_file_in_dir(const std::string &file_name, const std::string &dir_name)
void add(const std::string &dir, bool at_end, bool warn)
bool is_package(const std::string &name) const
string_vector get_file_list(const dir_info::fcn_file_map_type &lst) const
void append(const std::string &dir, bool warn=false)
static const int OCT_FILE
std::string m_command_line_path
void execute_pkg_del(const std::string &dir)
private_fcn_map_type::const_iterator const_private_fcn_map_iterator
std::list< std::string > get_all_package_names(bool only_top_level=true) const
std::string find_method(const std::string &class_name, const std::string &meth, std::string &dir_name, const std::string &pack_name="")
std::function< void(const std::string &)> remove_hook
static const int MEX_FILE
std::map< std::string, file_info_list_type > fcn_map_type
void execute_pkg_add_or_del(const std::string &dir, const std::string &script_file)
std::string dir_name(void) const
octave_idx_type length(void) const
octave_value_list & reverse(void)
OCTINTERP_API int xint_value(const char *fmt,...) const
bool isnumeric(void) const
bool is_string(void) const
std::string string_value(bool force=false) const
string_vector & sort(bool make_uniq=false)
void resize(octave_idx_type n, const std::string &rfv="")
std::ostream & list_in_columns(std::ostream &, int width=0, const std::string &prefix="") const
octave_idx_type numel(void) const
octave_user_code * user_code(void) const
bool is_built_in_function_name(const std::string &name)
static octave_idx_type find(octave_idx_type i, octave_idx_type *pp)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
std::string local_fcn_file_dir(void)
std::string local_ver_oct_file_dir(void)
std::string local_api_fcn_file_dir(void)
std::string local_oct_file_dir(void)
std::string fcn_file_dir(void)
std::string oct_file_dir(void)
std::string oct_data_dir(void)
std::string local_api_oct_file_dir(void)
std::string local_ver_fcn_file_dir(void)
OCTINTERP_API void print_usage(void)
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void warning(const char *fmt,...)
void warning_with_id(const char *id, const char *fmt,...)
void error(const char *fmt,...)
std::string canonicalize_file_name(const std::string &name)
std::string dirname(const std::string &path)
std::string dir_sep_str(void)
std::string tilde_expand(const std::string &name)
input_system & __get_input_system__(void)
interpreter & __get_interpreter__(void)
load_path & __get_load_path__(void)
event_manager & __get_event_manager__(void)
symbol_table & __get_symbol_table__(void)
symbol_scope __get_current_scope__(void)
bool octave_interpreter_ready
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
std::FILE * fopen(const std::string &filename, const std::string &mode)
bool get_dirlist(const std::string &dirname, string_vector &dirlist, std::string &msg)
std::string fgets(FILE *f)
static std::string strip_trailing_separators(const std::string &dir_arg)
static std::string find_private_file(const std::string &fname)
static bool subdirs_modified(const std::string &d, const sys::time &last_checked)
static void maybe_add_path_elts(std::string &path, const std::string &dir)
static bool in_path_list(const std::string &path_list, const std::string &path)
std::string genpath(const std::string &dirname, const string_vector &skip)
static std::string maybe_canonicalize(const std::string &dir_arg)
static std::list< std::string > split_path(const std::string &p)
load_path::dir_info::fcn_file_map_type get_fcn_files(const std::string &d)
static void rehash_internal(void)
void source_file(const std::string &file_name, const std::string &context, bool verbose, bool require_file)
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
static bool absolute_pathname(const std::string &s)
static bool is_dir_sep(char c)
static std::string dir_sep_chars
fcn_file_map_type method_file_map
fcn_file_map_type private_file_map
bool valid_identifier(const char *s)
bool same_file(const std::string &f, const std::string &g)