Mercurial > octave
diff src/parse.y @ 4243:7e4d5b5520e5
[project @ 2002-12-27 05:30:59 by jwe]
author | jwe |
---|---|
date | Fri, 27 Dec 2002 05:30:59 +0000 |
parents | 8627d992beb8 |
children | 189df16144fc |
line wrap: on
line diff
--- a/src/parse.y Thu Dec 26 22:06:30 2002 +0000 +++ b/src/parse.y Fri Dec 27 05:30:59 2002 +0000 @@ -45,11 +45,14 @@ #include "file-ops.h" #include "file-stat.h" #include "lo-sstream.h" +#include "oct-env.h" #include "oct-time.h" #include "quit.h" #include "comment-list.h" +#include "defaults.h" #include "defun.h" +#include "dirfns.h" #include "dynamic-ld.h" #include "error.h" #include "input.h" @@ -3373,14 +3376,24 @@ std::string nm = sym_rec->name (); - if (octave_dynamic_loader::load (nm)) + static string_vector names (2); + + names[0] = nm + ".oct"; + names[1] = nm + ".m"; + + std::string file + = octave_env::make_absolute (Vload_path_dir_path.find_first_of (names), + octave_env::getcwd ()); + + int len = file.length (); + + if (file.substr (len-4, len-1) == ".oct") { - force_link_to_function (nm); + if (octave_dynamic_loader::load (nm, file)) + force_link_to_function (nm); } else { - std::string ff = fcn_file_in_path (nm); - // These are needed by yyparse. unwind_protect::begin_frame ("load_fcn_from_file"); @@ -3389,10 +3402,10 @@ unwind_protect_str (curr_fcn_file_full_name); curr_fcn_file_name = nm; - curr_fcn_file_full_name = ff; - - if (ff.length () > 0) - script_file_executed = parse_fcn_file (ff, exec_script); + curr_fcn_file_full_name = file; + + if (file.length () > 0) + script_file_executed = parse_fcn_file (file, exec_script); if (! (error_state || script_file_executed)) force_link_to_function (nm);