Mercurial > octave
diff src/parse.y @ 5744:1c36a2e82266
[project @ 2006-04-06 19:38:34 by jwe]
author | jwe |
---|---|
date | Thu, 06 Apr 2006 19:38:35 +0000 |
parents | a527e0f77aa5 |
children | b09d4d0f5b63 |
line wrap: on
line diff
--- a/src/parse.y Thu Apr 06 08:20:23 2006 +0000 +++ b/src/parse.y Thu Apr 06 19:38:35 2006 +0000 @@ -2997,6 +2997,10 @@ { unwind_protect::add (safe_fclose, f); + octave_user_script *script = new octave_user_script (s, s, ""); + octave_call_stack::push (script); + unwind_protect::add (octave_call_stack::unwind_pop_script, 0); + unwind_protect_int (input_line_number); unwind_protect_int (current_input_column); @@ -3377,6 +3381,10 @@ bind_builtin_variable ("current_script_file_name", ff); + octave_user_script *script = new octave_user_script (ff, ff, ""); + octave_call_stack::push (script); + unwind_protect::add (octave_call_stack::unwind_pop_script, 0); + parse_and_execute (ffile); script_file_executed = true; @@ -3619,29 +3627,9 @@ } } - // XXX FIXME XXX -- the logic below fails for the following - // situation, because script files are not functions that can be - // entered into the call stack. - // - // foo.m: - // ----- - // function foo () - // bar; - // - // bar.m: - // ----- - // mfilename (); - // - // foo () - // ==> foo - // - // though it should report "bar". Perhaps we need a dummy function - // object that can be used for scripts to at least hold file names - // and some other information so we could store it on the call stack. - std::string fname; - octave_user_function *fcn = octave_call_stack::caller_script (); + octave_function *fcn = octave_call_stack::caller_user_script_or_function (); if (fcn) { @@ -3650,8 +3638,6 @@ if (fname.empty ()) fname = fcn->name (); } - else if (reading_script_file) - fname = curr_fcn_file_full_name; if (arg == "fullpathext") retval = fname;