Mercurial > octave
changeset 21416:fdeb0d731512
Backed out changeset 74a676d5ce09
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 08 Mar 2016 12:14:15 -0500 |
parents | 74a676d5ce09 |
children | 7ce76114b321 |
files | libinterp/corefcn/load-path.cc libinterp/octave.cc libinterp/parse-tree/oct-parse.in.yy libinterp/parse-tree/parse.h |
diffstat | 4 files changed, 40 insertions(+), 47 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/load-path.cc Tue Mar 08 06:19:57 2016 -0500 +++ b/libinterp/corefcn/load-path.cc Tue Mar 08 12:14:15 2016 -0500 @@ -2216,7 +2216,7 @@ file_stat fs (file); if (fs.exists ()) - safe_source_file (file, "base"); + source_file (file, "base"); } void
--- a/libinterp/octave.cc Tue Mar 08 06:19:57 2016 -0500 +++ b/libinterp/octave.cc Tue Mar 08 12:14:15 2016 -0500 @@ -257,6 +257,45 @@ F__version_info__ (args, 0); } +static void +gripe_safe_source_exception (const std::string& file, const std::string& msg) +{ + std::cerr << "error: " << msg << "\n" + << "error: execution of " << file << " failed\n" + << "error: trying to make my way to a command prompt" + << std::endl; +} + +// Execute commands from a file and catch potential exceptions in a consistent +// way. This function should be called anywhere we might parse and execute +// commands from a file before before we have entered the main loop in +// toplev.cc. + +static void +safe_source_file (const std::string& file_name, + const std::string& context = "", + bool verbose = false, bool require_file = true, + const std::string& warn_for = "") +{ + try + { + source_file (file_name, context, verbose, require_file, warn_for); + } + catch (const octave_interrupt_exception&) + { + recover_from_exception (); + + if (quitting_gracefully) + clean_up_and_exit (exit_status); + } + catch (const octave_execution_exception&) + { + recover_from_exception (); + + gripe_safe_source_exception (file_name, "unhandled execution exception"); + } +} + // Initialize by reading startup files. static void @@ -743,9 +782,6 @@ install_classdef (); - // Setting the command line path just stores the directory names, it - // does not execute PKG_ADD scripts as we are not ready to do that yet. - for (std::list<std::string>::const_iterator it = command_line_path.begin (); it != command_line_path.end (); it++) load_path::set_command_line_path (*it);
--- a/libinterp/parse-tree/oct-parse.in.yy Tue Mar 08 06:19:57 2016 -0500 +++ b/libinterp/parse-tree/oct-parse.in.yy Tue Mar 08 12:14:15 2016 -0500 @@ -4622,43 +4622,6 @@ } } -static void -gripe_safe_source_exception (const std::string& file, const std::string& msg) -{ - std::cerr << "error: " << msg << "\n" - << "error: execution of " << file << " failed\n" - << "error: trying to make my way to a command prompt" - << std::endl; -} - -// Execute commands from a file and catch potential exceptions in a consistent -// way. This function should be called anywhere we might parse and execute -// commands from a file before before we have entered the main loop in -// toplev.cc. - -void -safe_source_file (const std::string& file_name, const std::string& context, - bool verbose, bool require_file, const std::string& warn_for) -{ - try - { - source_file (file_name, context, verbose, require_file, warn_for); - } - catch (const octave_interrupt_exception&) - { - recover_from_exception (); - - if (quitting_gracefully) - clean_up_and_exit (exit_status); - } - catch (const octave_execution_exception&) - { - recover_from_exception (); - - gripe_safe_source_exception (file_name, "unhandled execution exception"); - } -} - DEFUN (mfilename, args, , "-*- texinfo -*-\n\ @deftypefn {} {} mfilename ()\n\
--- a/libinterp/parse-tree/parse.h Tue Mar 08 06:19:57 2016 -0500 +++ b/libinterp/parse-tree/parse.h Tue Mar 08 12:14:15 2016 -0500 @@ -117,12 +117,6 @@ bool verbose = false, bool require_file = true, const std::string& warn_for = ""); -extern OCTINTERP_API void -safe_source_file (const std::string& file_name, - const std::string& context = "", - bool verbose = false, bool require_file = true, - const std::string& warn_for = ""); - extern OCTINTERP_API octave_value_list feval (const std::string& name, const octave_value_list& args = octave_value_list (),