Mercurial > hg > octave-lyh
changeset 8593:4e39b00218d3
load-path.cc (load_path::do_find_fcn): handle @foo/bar
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 26 Jan 2009 22:35:20 -0500 |
parents | dacfd030633a |
children | 756b0ba61350 |
files | src/ChangeLog src/load-path.cc |
diffstat | 2 files changed, 38 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2009-01-26 John W. Eaton <jwe@octave.org> + + * load-path.cc (load_path::do_find_fcn): Handle @foo/bar. + 2009-01-24 Jaroslav Hajek <highegg@gmail.com> * pt-cell.cc (tree_cell::rvalue): Optimize the single row case.
--- a/src/load-path.cc +++ b/src/load-path.cc @@ -903,30 +903,47 @@ // update (); - dir_name = std::string (); - - const_fcn_map_iterator p = fcn_map.find (fcn); - - if (p != fcn_map.end ()) + if (fcn.length () > 0 && fcn[0] == '@') { - const file_info_list_type& file_info_list = p->second; + size_t pos = fcn.find ('/'); - for (const_file_info_list_iterator i = file_info_list.begin (); - i != file_info_list.end (); - i++) + if (pos != std::string::npos) { - const file_info& fi = *i; + std::string class_name = fcn.substr (1, pos-1); + std::string meth = fcn.substr (pos+1); - retval = file_ops::concat (fi.dir_name, fcn); + retval = do_find_method (class_name, meth, dir_name); + } + else + retval = std::string (); + } + else + { + dir_name = std::string (); + + const_fcn_map_iterator p = fcn_map.find (fcn); + + if (p != fcn_map.end ()) + { + const file_info_list_type& file_info_list = p->second; - if (check_file_type (retval, type, fi.types, - fcn, "load_path::do_find_fcn")) + for (const_file_info_list_iterator i = file_info_list.begin (); + i != file_info_list.end (); + i++) { - dir_name = fi.dir_name; - break; + const file_info& fi = *i; + + retval = file_ops::concat (fi.dir_name, fcn); + + if (check_file_type (retval, type, fi.types, + fcn, "load_path::do_find_fcn")) + { + dir_name = fi.dir_name; + break; + } + else + retval = std::string (); } - else - retval = std::string (); } }