changeset 30006:75dff8f2de2e

move some load-save utilities to octave namespace * ls-ascii-helper.h, ls-ascii-helper.cc (skip_until_newline, read_until_newline, skip_preceeding_newline): Move inside octave namespace. Change all uses as needed. Provide deprecated inline wrapper functions to preserve old names. * ls-utils.h, ls-utils.cc (get_save_type): Move inside octave namespace. Change all uses as needed. Provide deprecated inline wrapper functions to preserve old names.
author John W. Eaton <jwe@octave.org>
date Wed, 18 Aug 2021 15:47:29 -0400
parents 7677b6184c0b
children 62f2c0a3982c
files libinterp/corefcn/ls-ascii-helper.cc libinterp/corefcn/ls-ascii-helper.h libinterp/corefcn/ls-mat-ascii.cc libinterp/corefcn/ls-mat5.cc libinterp/corefcn/ls-oct-text.cc libinterp/corefcn/ls-oct-text.h libinterp/corefcn/ls-utils.cc libinterp/corefcn/ls-utils.h libinterp/octave-value/ov-cx-diag.cc libinterp/octave-value/ov-cx-mat.cc libinterp/octave-value/ov-cx-sparse.cc libinterp/octave-value/ov-fcn-handle.cc libinterp/octave-value/ov-flt-cx-diag.cc libinterp/octave-value/ov-flt-cx-mat.cc libinterp/octave-value/ov-flt-re-diag.cc libinterp/octave-value/ov-flt-re-mat.cc libinterp/octave-value/ov-range.cc libinterp/octave-value/ov-re-diag.cc libinterp/octave-value/ov-re-mat.cc libinterp/octave-value/ov-re-sparse.cc libinterp/octave-value/ov-str-mat.cc
diffstat 21 files changed, 96 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/ls-ascii-helper.cc	Wed Aug 18 14:11:56 2021 -0400
+++ b/libinterp/corefcn/ls-ascii-helper.cc	Wed Aug 18 15:47:29 2021 -0400
@@ -32,6 +32,8 @@
 #include <istream>
 #include <sstream>
 
+OCTAVE_NAMESPACE_BEGIN
+
 // Helper functions when reading from ascii files.
 
 // These functions take care of different line endings (LF, CR, CRLF)
@@ -177,3 +179,5 @@
 
   return buf.str ();
 }
+
+OCTAVE_NAMESPACE_END
--- a/libinterp/corefcn/ls-ascii-helper.h	Wed Aug 18 14:11:56 2021 -0400
+++ b/libinterp/corefcn/ls-ascii-helper.h	Wed Aug 18 15:47:29 2021 -0400
@@ -31,6 +31,8 @@
 #include <iosfwd>
 #include <string>
 
+OCTAVE_NAMESPACE_BEGIN
+
 extern OCTINTERP_API void
 skip_until_newline (std::istream& is, bool keep_newline = false);
 
@@ -40,4 +42,31 @@
 extern OCTINTERP_API std::string
 read_until_newline (std::istream& is, bool keep_newline = false);
 
+OCTAVE_NAMESPACE_END
+
+#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
+
+OCTAVE_DEPRECATED (7, "use 'octave::skip_until_newline' instead")
+inline void
+skip_until_newline (std::istream& is, bool keep_newline = false)
+{
+  return octave::skip_until_newline (is, keep_newline);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::skip_preceding_newline' instead")
+inline void
+skip_preceeding_newline (std::istream& is)
+{
+  return octave::skip_preceeding_newline (is);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::read_until_newline' instead")
+inline std::string
+read_until_newline (std::istream& is, bool keep_newline = false)
+{
+  return octave::read_until_newline (is, keep_newline);
+}
+
 #endif
+
+#endif
--- a/libinterp/corefcn/ls-mat-ascii.cc	Wed Aug 18 14:11:56 2021 -0400
+++ b/libinterp/corefcn/ls-mat-ascii.cc	Wed Aug 18 15:47:29 2021 -0400
@@ -81,13 +81,13 @@
           if (c == '\n' || c == '\r')
             {
               is.putback (c);
-              skip_preceeding_newline (is);
+              octave::skip_preceeding_newline (is);
               break;
             }
 
           if (c == '%' || c == '#')
             {
-              skip_until_newline (is, false);
+              octave::skip_until_newline (is, false);
               break;
             }
 
--- a/libinterp/corefcn/ls-mat5.cc	Wed Aug 18 14:11:56 2021 -0400
+++ b/libinterp/corefcn/ls-mat5.cc	Wed Aug 18 15:47:29 2021 -0400
@@ -1663,7 +1663,7 @@
 
   double max_val, min_val;
   if (m.all_integers (max_val, min_val))
-    st = get_save_type (max_val, min_val);
+    st = octave::get_save_type (max_val, min_val);
 
   mat5_data_type mst;
   int size;
@@ -1748,7 +1748,7 @@
 
   float max_val, min_val;
   if (m.all_integers (max_val, min_val))
-    st = get_save_type (max_val, min_val);
+    st = octave::get_save_type (max_val, min_val);
 
   mat5_data_type mst;
   int size;
@@ -1962,9 +1962,9 @@
             size = 4;
         }
 
-      // The code below is disabled since get_save_type currently doesn't
-      // deal with integer types.  This will need to be activated if
-      // get_save_type is changed.
+      // The code below is disabled since get_save_type currently
+      // doesn't deal with integer types.  This will need to be
+      // activated if get_save_type is changed.
 
       // double max_val = val[0];
       // double min_val = val[0];
@@ -2016,9 +2016,9 @@
     {
       int size = 4;
 
-      // The code below is disabled since get_save_type currently doesn't
-      // deal with integer types.  This will need to be activated if
-      // get_save_type is changed.
+      // The code below is disabled since get_save_type currently
+      // doesn't deal with integer types.  This will need to be
+      // activated if get_save_type is changed.
 
       // float max_val = val[0];
       // float min_val = val[0];
--- a/libinterp/corefcn/ls-oct-text.cc	Wed Aug 18 14:11:56 2021 -0400
+++ b/libinterp/corefcn/ls-oct-text.cc	Wed Aug 18 15:47:29 2021 -0400
@@ -115,13 +115,13 @@
                 ; // Skip whitespace and the colon.
 
               is.putback (c);
-              retval = read_until_newline (is, false);
+              retval = octave::read_until_newline (is, false);
               break;
             }
           else if (next_only)
             break;
           else
-            skip_until_newline (is, false);
+            octave::skip_until_newline (is, false);
         }
     }
 
@@ -254,7 +254,7 @@
       if (name == "0")
         name = "";
 
-      skip_preceeding_newline (is);
+      octave::skip_preceeding_newline (is);
 
       std::string buf;
 
@@ -263,7 +263,7 @@
 
           // Get a line of text whitespace characters included,
           // leaving newline in the stream.
-          buf = read_until_newline (is, true);
+          buf = octave::read_until_newline (is, true);
         }
 
       if (is)
--- a/libinterp/corefcn/ls-oct-text.h	Wed Aug 18 14:11:56 2021 -0400
+++ b/libinterp/corefcn/ls-oct-text.h	Wed Aug 18 15:47:29 2021 -0400
@@ -112,7 +112,7 @@
                 is >> value;
               if (is)
                 status = true;
-              skip_until_newline (is, false);
+              octave::skip_until_newline (is, false);
               break;
             }
           else if (next_only)
@@ -181,7 +181,7 @@
                     is >> value;
                   if (is)
                     status = true;
-                  skip_until_newline (is, false);
+                  octave::skip_until_newline (is, false);
                   return status;
                 }
             }
--- a/libinterp/corefcn/ls-utils.cc	Wed Aug 18 14:11:56 2021 -0400
+++ b/libinterp/corefcn/ls-utils.cc	Wed Aug 18 15:47:29 2021 -0400
@@ -31,6 +31,8 @@
 
 #include "ls-utils.h"
 
+OCTAVE_NAMESPACE_BEGIN
+
 // MAX_VAL and MIN_VAL are assumed to have integral values even though
 // they are stored in doubles.
 
@@ -89,3 +91,6 @@
 
   return st;
 }
+
+OCTAVE_NAMESPACE_END
+
--- a/libinterp/corefcn/ls-utils.h	Wed Aug 18 14:11:56 2021 -0400
+++ b/libinterp/corefcn/ls-utils.h	Wed Aug 18 15:47:29 2021 -0400
@@ -30,10 +30,32 @@
 
 #include "data-conv.h"
 
+OCTAVE_NAMESPACE_BEGIN
+
 extern OCTINTERP_API save_type
 get_save_type (double max_val, double min_val);
 
 extern OCTINTERP_API save_type
 get_save_type (float max_val, float min_val);
 
+OCTAVE_NAMESPACE_END
+
+#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
+
+OCTAVE_DEPRECATED (7, "use 'octave::get_save_type' instead")
+inline save_type
+get_save_type (double max_val, double min_val)
+{
+  return octave::get_save_type (max_val, min_val);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::get_save_type' instead")
+inline save_type
+get_save_type (float max_val, float min_val)
+{
+  return octave::get_save_type (max_val, min_val);
+}
+
 #endif
+
+#endif
--- a/libinterp/octave-value/ov-cx-diag.cc	Wed Aug 18 14:11:56 2021 -0400
+++ b/libinterp/octave-value/ov-cx-diag.cc	Wed Aug 18 15:47:29 2021 -0400
@@ -204,7 +204,7 @@
     {
       double max_val, min_val;
       if (m.all_integers (max_val, min_val))
-        st = get_save_type (max_val, min_val);
+        st = octave::get_save_type (max_val, min_val);
     }
 
   const Complex *mtmp = m.data ();
--- a/libinterp/octave-value/ov-cx-mat.cc	Wed Aug 18 14:11:56 2021 -0400
+++ b/libinterp/octave-value/ov-cx-mat.cc	Wed Aug 18 15:47:29 2021 -0400
@@ -443,7 +443,7 @@
     {
       double max_val, min_val;
       if (m.all_integers (max_val, min_val))
-        st = get_save_type (max_val, min_val);
+        st = octave::get_save_type (max_val, min_val);
     }
 
   const Complex *mtmp = m.data ();
@@ -574,7 +574,7 @@
 
       if (m.all_integers (max_val, min_val))
         save_type_hid
-          = save_type_to_hdf5 (get_save_type (max_val, min_val));
+          = save_type_to_hdf5 (octave::get_save_type (max_val, min_val));
     }
 #endif
 
--- a/libinterp/octave-value/ov-cx-sparse.cc	Wed Aug 18 14:11:56 2021 -0400
+++ b/libinterp/octave-value/ov-cx-sparse.cc	Wed Aug 18 15:47:29 2021 -0400
@@ -263,7 +263,7 @@
     {
       double max_val, min_val;
       if (matrix.all_integers (max_val, min_val))
-        st = get_save_type (max_val, min_val);
+        st = octave::get_save_type (max_val, min_val);
     }
 
   // add one to the printed indices to go from
@@ -569,7 +569,7 @@
 
       if (m.all_integers (max_val, min_val))
         save_type_hid
-          = save_type_to_hdf5 (get_save_type (max_val, min_val));
+          = save_type_to_hdf5 (octave::get_save_type (max_val, min_val));
     }
 #endif
 
--- a/libinterp/octave-value/ov-fcn-handle.cc	Wed Aug 18 14:11:56 2021 -0400
+++ b/libinterp/octave-value/ov-fcn-handle.cc	Wed Aug 18 15:47:29 2021 -0400
@@ -2098,7 +2098,7 @@
 
   bool base_anonymous_fcn_handle::load_ascii (std::istream& is)
   {
-    skip_preceeding_newline (is);
+    octave::skip_preceeding_newline (is);
 
     std::string buf;
 
@@ -2107,7 +2107,7 @@
         // Get a line of text whitespace characters included, leaving
         // newline in the stream.
 
-        buf = read_until_newline (is, true);
+        buf = octave::read_until_newline (is, true);
       }
 
     std::streampos pos = is.tellg ();
--- a/libinterp/octave-value/ov-flt-cx-diag.cc	Wed Aug 18 14:11:56 2021 -0400
+++ b/libinterp/octave-value/ov-flt-cx-diag.cc	Wed Aug 18 15:47:29 2021 -0400
@@ -175,7 +175,7 @@
     {
       float max_val, min_val;
       if (m.all_integers (max_val, min_val))
-        st = get_save_type (max_val, min_val);
+        st = octave::get_save_type (max_val, min_val);
     }
 
   const FloatComplex *mtmp = m.data ();
--- a/libinterp/octave-value/ov-flt-cx-mat.cc	Wed Aug 18 14:11:56 2021 -0400
+++ b/libinterp/octave-value/ov-flt-cx-mat.cc	Wed Aug 18 15:47:29 2021 -0400
@@ -407,7 +407,7 @@
     {
       float max_val, min_val;
       if (m.all_integers (max_val, min_val))
-        st = get_save_type (max_val, min_val);
+        st = octave::get_save_type (max_val, min_val);
     }
 
   const FloatComplex *mtmp = m.data ();
@@ -529,7 +529,7 @@
 
       if (m.all_integers (max_val, min_val))
         save_type_hid
-          = save_type_to_hdf5 (get_save_type (max_val, min_val));
+          = save_type_to_hdf5 (octave::get_save_type (max_val, min_val));
     }
 #endif
 
--- a/libinterp/octave-value/ov-flt-re-diag.cc	Wed Aug 18 14:11:56 2021 -0400
+++ b/libinterp/octave-value/ov-flt-re-diag.cc	Wed Aug 18 15:47:29 2021 -0400
@@ -193,7 +193,7 @@
     {
       float max_val, min_val;
       if (m.all_integers (max_val, min_val))
-        st = get_save_type (max_val, min_val);
+        st = octave::get_save_type (max_val, min_val);
     }
 
   const float *mtmp = m.data ();
--- a/libinterp/octave-value/ov-flt-re-mat.cc	Wed Aug 18 14:11:56 2021 -0400
+++ b/libinterp/octave-value/ov-flt-re-mat.cc	Wed Aug 18 15:47:29 2021 -0400
@@ -484,7 +484,7 @@
     {
       float max_val, min_val;
       if (m.all_integers (max_val, min_val))
-        st = get_save_type (max_val, min_val);
+        st = octave::get_save_type (max_val, min_val);
     }
 
   const float *mtmp = m.data ();
@@ -604,7 +604,7 @@
 
       if (m.all_integers (max_val, min_val))
         save_type_hid
-          = save_type_to_hdf5 (get_save_type (max_val, min_val));
+          = save_type_to_hdf5 (octave::get_save_type (max_val, min_val));
     }
 #endif
 #if defined (HAVE_HDF5_18)
--- a/libinterp/octave-value/ov-range.cc	Wed Aug 18 14:11:56 2021 -0400
+++ b/libinterp/octave-value/ov-range.cc	Wed Aug 18 15:47:29 2021 -0400
@@ -626,7 +626,7 @@
         break;
     }
 
-  skip_until_newline (is, false);
+  octave::skip_until_newline (is, false);
 }
 
 template <typename T>
--- a/libinterp/octave-value/ov-re-diag.cc	Wed Aug 18 14:11:56 2021 -0400
+++ b/libinterp/octave-value/ov-re-diag.cc	Wed Aug 18 15:47:29 2021 -0400
@@ -270,7 +270,7 @@
     {
       double max_val, min_val;
       if (m.all_integers (max_val, min_val))
-        st = get_save_type (max_val, min_val);
+        st = octave::get_save_type (max_val, min_val);
     }
 
   const double *mtmp = m.data ();
--- a/libinterp/octave-value/ov-re-mat.cc	Wed Aug 18 14:11:56 2021 -0400
+++ b/libinterp/octave-value/ov-re-mat.cc	Wed Aug 18 15:47:29 2021 -0400
@@ -598,7 +598,7 @@
     {
       double max_val, min_val;
       if (m.all_integers (max_val, min_val))
-        st = get_save_type (max_val, min_val);
+        st = octave::get_save_type (max_val, min_val);
     }
 
   const double *mtmp = m.data ();
@@ -729,7 +729,7 @@
 
       if (m.all_integers (max_val, min_val))
         save_type_hid
-          = save_type_to_hdf5 (get_save_type (max_val, min_val));
+          = save_type_to_hdf5 (octave::get_save_type (max_val, min_val));
     }
 #endif
 
--- a/libinterp/octave-value/ov-re-sparse.cc	Wed Aug 18 14:11:56 2021 -0400
+++ b/libinterp/octave-value/ov-re-sparse.cc	Wed Aug 18 15:47:29 2021 -0400
@@ -288,7 +288,7 @@
     {
       double max_val, min_val;
       if (matrix.all_integers (max_val, min_val))
-        st = get_save_type (max_val, min_val);
+        st = octave::get_save_type (max_val, min_val);
     }
 
   // add one to the printed indices to go from
@@ -588,7 +588,7 @@
 
       if (m.all_integers (max_val, min_val))
         save_type_hid
-          = save_type_to_hdf5 (get_save_type (max_val, min_val));
+          = save_type_to_hdf5 (octave::get_save_type (max_val, min_val));
     }
 #endif
 
--- a/libinterp/octave-value/ov-str-mat.cc	Wed Aug 18 14:11:56 2021 -0400
+++ b/libinterp/octave-value/ov-str-mat.cc	Wed Aug 18 15:47:29 2021 -0400
@@ -393,7 +393,7 @@
         {
           char *ftmp = tmp.fortran_vec ();
 
-          skip_preceeding_newline (is);
+          octave::skip_preceeding_newline (is);
 
           if (! is.read (ftmp, dv.numel ()) || ! is)
             error ("load: failed to load string constant");