changeset 27507:2d537a089e5d

eliminate warn_for argument for source_file and parse_fcn_file functions * interpreter.h, interpreter.cc (interpreter::source_file, interpreter::parse_fcn_file): Eliminate warn_for argument. Change all uses. * pt-eval.h, pt-eval.cc (tree_evaluator::source_file): Eliminate warn_for argument. Change all uses.
author John W. Eaton <jwe@octave.org>
date Thu, 10 Oct 2019 16:50:58 -0400
parents 17cc96fc55d6
children 290d424b9d10
files libinterp/corefcn/interpreter.cc libinterp/corefcn/interpreter.h libinterp/parse-tree/oct-parse.yy libinterp/parse-tree/parse.h libinterp/parse-tree/pt-eval.cc libinterp/parse-tree/pt-eval.h
diffstat 6 files changed, 18 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/interpreter.cc	Thu Oct 10 16:27:57 2019 -0400
+++ b/libinterp/corefcn/interpreter.cc	Thu Oct 10 16:50:58 2019 -0400
@@ -256,14 +256,13 @@
   static int safe_source_file (const std::string& file_name,
                                const std::string& context = "",
                                bool verbose = false,
-                               bool require_file = true,
-                               const std::string& warn_for = "")
+                               bool require_file = true)
   {
     interpreter& interp = __get_interpreter__ ("safe_source_file");
 
     try
       {
-        source_file (file_name, context, verbose, require_file, warn_for);
+        source_file (file_name, context, verbose, require_file);
       }
     catch (const interrupt_exception&)
       {
@@ -968,7 +967,7 @@
     bool verbose = false;
     bool require_file = true;
 
-    return safe_source_file (fname, context, verbose, require_file, "octave");
+    return safe_source_file (fname, context, verbose, require_file);
   }
 
   int interpreter::main_loop (void)
@@ -1409,11 +1408,9 @@
 
   void interpreter::source_file (const std::string& file_name,
                                  const std::string& context, bool verbose,
-                                 bool require_file,
-                                 const std::string& warn_for)
+                                 bool require_file)
   {
-    m_evaluator.source_file (file_name, context, verbose, require_file,
-                             warn_for);
+    m_evaluator.source_file (file_name, context, verbose, require_file);
   }
 
   octave_value
@@ -1424,8 +1421,7 @@
                                const std::string& package_name,
                                bool require_file,
                                bool force_script, bool autoload,
-                               bool relative_lookup,
-                               const std::string& warn_for)
+                               bool relative_lookup)
   {
     octave_value retval;
 
@@ -1502,9 +1498,6 @@
       }
     else if (require_file)
       error ("no such file, '%s'", full_file.c_str ());
-    else if (! warn_for.empty ())
-      error ("%s: unable to open file '%s'", warn_for.c_str (),
-             full_file.c_str ());
 
     return retval;
   }
--- a/libinterp/corefcn/interpreter.h	Thu Oct 10 16:27:57 2019 -0400
+++ b/libinterp/corefcn/interpreter.h	Thu Oct 10 16:50:58 2019 -0400
@@ -348,8 +348,7 @@
 
     void source_file (const std::string& file_name,
                       const std::string& context = "",
-                      bool verbose = false, bool require_file = true,
-                      const std::string& warn_for = "");
+                      bool verbose = false, bool require_file = true);
 
     octave_value parse_fcn_file (const std::string& full_file,
                                  const std::string& file,
@@ -357,8 +356,7 @@
                                  const std::string& dispatch_type,
                                  const std::string& package_name,
                                  bool require_file, bool force_script,
-                                 bool autoload, bool relative_lookup,
-                                 const std::string& warn_for);
+                                 bool autoload, bool relative_lookup);
 
     bool at_top_level (void) const;
 
--- a/libinterp/parse-tree/oct-parse.yy	Thu Oct 10 16:27:57 2019 -0400
+++ b/libinterp/parse-tree/oct-parse.yy	Thu Oct 10 16:50:58 2019 -0400
@@ -4538,7 +4538,7 @@
 
         octave_value ov_fcn
           = interp.parse_fcn_file (full_file, file, "", "", "", true,
-                                   false, false, false, "");
+                                   false, false, false);
 
         if (ov_fcn.is_defined ())
           {
@@ -4626,7 +4626,7 @@
         octave_value ov_fcn
           = interp.parse_fcn_file (file.substr (0, len - 2), nm, dir_name,
                                    dispatch_type, package_name, false,
-                                   autoload, autoload, relative_lookup, "");
+                                   autoload, autoload, relative_lookup);
 
         if (ov_fcn.is_defined ())
           {
@@ -4651,7 +4651,7 @@
       {
         retval = interp.parse_fcn_file (file, nm, dir_name, dispatch_type,
                                         package_name, true, autoload,
-                                        autoload, relative_lookup, "");
+                                        autoload, relative_lookup);
       }
 
     return retval;
@@ -4766,11 +4766,11 @@
 
   void
   source_file (const std::string& file_name, const std::string& context,
-               bool verbose, bool require_file, const std::string& warn_for)
+               bool verbose, bool require_file)
   {
     interpreter& interp = __get_interpreter__ ("source_file");
 
-    interp.source_file (file_name, context, verbose, require_file, warn_for);
+    interp.source_file (file_name, context, verbose, require_file);
   }
 }
 
@@ -5391,7 +5391,7 @@
 
   octave_value ov_fcn
     = interp.parse_fcn_file (full_file, file, dir_name, "", "", true, false,
-                             false, false, "__parse_file__");
+                             false, false);
 
   return retval;
 }
--- a/libinterp/parse-tree/parse.h	Thu Oct 10 16:27:57 2019 -0400
+++ b/libinterp/parse-tree/parse.h	Thu Oct 10 16:50:58 2019 -0400
@@ -571,8 +571,7 @@
   extern OCTINTERP_API void
   source_file (const std::string& file_name,
                const std::string& context = "",
-               bool verbose = false, bool require_file = true,
-               const std::string& warn_for = "");
+               bool verbose = false, bool require_file = true);
 
   extern OCTINTERP_API octave_value_list
   feval (const char *name,
--- a/libinterp/parse-tree/pt-eval.cc	Thu Oct 10 16:27:57 2019 -0400
+++ b/libinterp/parse-tree/pt-eval.cc	Thu Oct 10 16:50:58 2019 -0400
@@ -1129,8 +1129,7 @@
   void
   tree_evaluator::source_file (const std::string& file_name,
                                const std::string& context,
-                               bool verbose, bool require_file,
-                               const std::string& warn_for)
+                               bool verbose, bool require_file)
   {
     // Map from absolute name of script file to recursion level.  We
     // use a map instead of simply placing a limit on recursion in the
@@ -1249,7 +1248,7 @@
             ov_code = m_interpreter.parse_fcn_file (file_full_name, file_name,
                                                     dir_name, "", "",
                                                     require_file, true, false,
-                                                    false, warn_for);
+                                                    false);
           }
         catch (execution_exception& e)
           {
--- a/libinterp/parse-tree/pt-eval.h	Thu Oct 10 16:27:57 2019 -0400
+++ b/libinterp/parse-tree/pt-eval.h	Thu Oct 10 16:50:58 2019 -0400
@@ -340,8 +340,7 @@
 
     void source_file (const std::string& file_name,
                       const std::string& context = "",
-                      bool verbose = false, bool require_file = true,
-                      const std::string& warn_for = "");
+                      bool verbose = false, bool require_file = true);
 
     void set_auto_fcn_var (stack_frame::auto_var_type avt,
                            const octave_value& val = octave_value ());