changeset 29991:3988112c7116

move i/o stream classes inside octave namespace * c-file-ptr-stream.h, c-file-ptr-stream.cc, file-io.cc, oct-fstrm.cc, oct-fstrm.h, oct-iostrm.cc, oct-iostrm.h, oct-prcstrm.cc, oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h, oct-stdstrm.h, oct-stream.cc, oct-strstrm.cc, oct-strstrm.h, procstream.cc, procstream.h: Move classes inside octave namespace. Change all uses. Provide deprecated typedefs to preserve old names where possible.
author John W. Eaton <jwe@octave.org>
date Tue, 17 Aug 2021 11:17:36 -0400
parents b839c36fd106
children 6ea4a84df9c7
files libinterp/corefcn/c-file-ptr-stream.cc libinterp/corefcn/c-file-ptr-stream.h libinterp/corefcn/file-io.cc libinterp/corefcn/oct-fstrm.cc libinterp/corefcn/oct-fstrm.h libinterp/corefcn/oct-iostrm.cc libinterp/corefcn/oct-iostrm.h libinterp/corefcn/oct-prcstrm.cc libinterp/corefcn/oct-prcstrm.h libinterp/corefcn/oct-procbuf.cc libinterp/corefcn/oct-procbuf.h libinterp/corefcn/oct-stdstrm.h libinterp/corefcn/oct-stream.cc libinterp/corefcn/oct-strstrm.cc libinterp/corefcn/oct-strstrm.h libinterp/corefcn/pager.h libinterp/corefcn/procstream.cc libinterp/corefcn/procstream.h libinterp/corefcn/syscalls.cc
diffstat 19 files changed, 378 insertions(+), 230 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/c-file-ptr-stream.cc	Mon Aug 16 22:28:30 2021 -0400
+++ b/libinterp/corefcn/c-file-ptr-stream.cc	Tue Aug 17 11:17:36 2021 -0400
@@ -33,6 +33,8 @@
 
 #include "c-file-ptr-stream.h"
 
+OCTAVE_NAMESPACE_BEGIN
+
 #if ! defined (SEEK_SET)
 #  define SEEK_SET 0
 #endif
@@ -316,4 +318,6 @@
   return retval;
 }
 
+OCTAVE_NAMESPACE_END
+
 #endif
--- a/libinterp/corefcn/c-file-ptr-stream.h	Mon Aug 16 22:28:30 2021 -0400
+++ b/libinterp/corefcn/c-file-ptr-stream.h	Tue Aug 17 11:17:36 2021 -0400
@@ -31,6 +31,12 @@
 #include <cstdio>
 #include <istream>
 
+#if defined (HAVE_ZLIB_H)
+#  include <zlib.h>
+#endif
+
+OCTAVE_NAMESPACE_BEGIN
+
 class
 c_file_ptr_buf : public std::streambuf
 {
@@ -141,12 +147,9 @@
 typedef c_file_ptr_stream<std::iostream, FILE *, c_file_ptr_buf>
   io_c_file_ptr_stream;
 
+
 #if defined (HAVE_ZLIB)
 
-#if defined (HAVE_ZLIB_H)
-#  include <zlib.h>
-#endif
-
 class
 c_zfile_ptr_buf : public std::streambuf
 {
@@ -225,4 +228,41 @@
 
 #endif
 
+OCTAVE_NAMESPACE_END
+
+#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
+
+OCTAVE_DEPRECATED (7, "use 'octave::i_c_file_ptr_stream' instead")
+typedef octave::i_c_file_ptr_stream i_c_file_ptr_stream;
+
+OCTAVE_DEPRECATED (7, "use 'octave::o_c_file_ptr_stream' instead")
+typedef octave::o_c_file_ptr_stream o_c_file_ptr_stream;
+
+OCTAVE_DEPRECATED (7, "use 'octave::io_c_file_ptr_stream' instead")
+typedef octave::io_c_file_ptr_stream io_c_file_ptr_stream;
+
+// FIXME: HAVE_ZLIB is not defined here because we do not (and should
+// not) include config.h in this header file.  We need to find a way to
+// define this interface without exposing gzFile.  Should this be a
+// private header that can only be used if included after config.h in an
+// Octave source file and not inside another header file?
+
+#  if defined (HAVE_ZLIB)
+
+OCTAVE_DEPRECATED (7, "use 'octave::i_c_zfile_ptr_stream' instead")
+typedef octave::c_file_ptr_stream<std::istream, gzFile, octave::c_zfile_ptr_buf>
+  i_c_zfile_ptr_stream;
+
+OCTAVE_DEPRECATED (7, "use 'octave::o_c_zfile_ptr_stream' instead")
+typedef octave::c_file_ptr_stream<std::ostream, gzFile, octave::c_zfile_ptr_buf>
+  o_c_zfile_ptr_stream;
+
+OCTAVE_DEPRECATED (7, "use 'octave::io_c_zfile_ptr_stream' instead")
+typedef octave::c_file_ptr_stream<std::iostream, gzFile, octave::c_zfile_ptr_buf>
+  io_c_zfile_ptr_stream;
+
+#  endif
+
 #endif
+
+#endif
--- a/libinterp/corefcn/file-io.cc	Mon Aug 16 22:28:30 2021 -0400
+++ b/libinterp/corefcn/file-io.cc	Tue Aug 17 11:17:36 2021 -0400
@@ -442,8 +442,8 @@
 
               gzFile gzf = ::gzdopen (fd, mode.c_str ());
 
-              retval = octave_zstdiostream::create (fname, gzf, fd, md,
-                                                    flt_fmt, encoding);
+              retval = zstdiostream::create (fname, gzf, fd, md, flt_fmt,
+                                             encoding);
             }
           else
             retval.error (std::strerror (errno));
@@ -453,8 +453,7 @@
         {
           FILE *fptr = sys::fopen (fname, mode);
 
-          retval = octave_stdiostream::create (fname, fptr, md, flt_fmt,
-                                               encoding);
+          retval = stdiostream::create (fname, fptr, md, flt_fmt, encoding);
 
           if (! fptr)
             retval.error (std::strerror (errno));
@@ -948,10 +947,10 @@
   if (nargin == 0)
     print_usage ();
 
-  // We don't use octave_ostrstream::create here because need direct
+  // We don't use ostrstream::create here because need direct
   // access to the OSTR object so that we can extract a string object
   // from it to return.
-  octave_ostrstream *ostr = new octave_ostrstream ();
+  ostrstream *ostr = new ostrstream ();
 
   // The stream destructor will delete OSTR for us.
   stream os (ostr);
@@ -1121,7 +1120,7 @@
 
   std::string data = get_scan_string_data (args(0), who);
 
-  stream os = octave_istrstream::create (data);
+  stream os = istrstream::create (data);
 
   if (! os.is_valid ())
     error ("%s: unable to create temporary input buffer", who.c_str ());
@@ -1194,7 +1193,7 @@
     {
       std::string data = get_scan_string_data (args(0), who);
 
-      os = octave_istrstream::create (data);
+      os = istrstream::create (data);
 
       if (! os.is_valid ())
         error ("%s: unable to create temporary input buffer", who.c_str ());
@@ -2974,13 +2973,13 @@
 
       std::ios::openmode md = fopen_mode_to_ios_mode ("w+b");
 
-      stream s = octave_stdiostream::create (nm, fid, md);
+      stream s = stdiostream::create (nm, fid, md);
 
       if (! s)
         {
           fclose (fid);
 
-          error ("tmpfile: failed to create octave_stdiostream object");
+          error ("tmpfile: failed to create stdiostream object");
         }
 
       stream_list& streams = interp.get_stream_list ();
@@ -3053,10 +3052,10 @@
 
           std::ios::openmode md = fopen_mode_to_ios_mode (fopen_mode);
 
-          stream s = octave_stdiostream::create (nm, fid, md);
+          stream s = stdiostream::create (nm, fid, md);
 
           if (! s)
-            error ("mkstemp: failed to create octave_stdiostream object");
+            error ("mkstemp: failed to create stdiostream object");
 
           stream_list& streams = interp.get_stream_list ();
 
--- a/libinterp/corefcn/oct-fstrm.cc	Mon Aug 16 22:28:30 2021 -0400
+++ b/libinterp/corefcn/oct-fstrm.cc	Tue Aug 17 11:17:36 2021 -0400
@@ -33,31 +33,32 @@
 #include "error.h"
 #include "oct-fstrm.h"
 
-octave::stream
-octave_fstream::create (const std::string& nm_arg, std::ios::openmode arg_md,
-                        octave::mach_info::float_format ff)
+OCTAVE_NAMESPACE_BEGIN
+
+stream
+fstream::create (const std::string& nm_arg, std::ios::openmode arg_md,
+                 mach_info::float_format ff)
 {
-  return octave::stream (new octave_fstream (nm_arg, arg_md, ff));
+  return stream (new fstream (nm_arg, arg_md, ff));
 }
 
-octave_fstream::octave_fstream (const std::string& nm_arg,
-                                std::ios::openmode arg_md,
-                                octave::mach_info::float_format ff)
-  : octave::base_stream (arg_md, ff), m_name (nm_arg)
+fstream::fstream (const std::string& nm_arg, std::ios::openmode arg_md,
+                  mach_info::float_format ff)
+  : base_stream (arg_md, ff), m_name (nm_arg)
 {
   m_fstream.open (m_name.c_str (), arg_md);
 
   if (! m_fstream)
-    // Note: error is inherited from octave::base_stream, not ::error.
+    // Note: error is inherited from base_stream, not ::error.
     error (std::strerror (errno));
 }
 
 // Position a stream at OFFSET relative to ORIGIN.
 
 int
-octave_fstream::seek (off_t, int)
+fstream::seek (off_t, int)
 {
-  // Note: error is inherited from octave::base_stream, not ::error.
+  // Note: error is inherited from base_stream, not ::error.
   // This error function does not halt execution so "return ..." must exist.
   error ("fseek: invalid_operation");
   return -1;
@@ -66,9 +67,9 @@
 // Return current stream position.
 
 off_t
-octave_fstream::tell (void)
+fstream::tell (void)
 {
-  // Note: error is inherited from octave::base_stream, not ::error.
+  // Note: error is inherited from base_stream, not ::error.
   // This error function does not halt execution so "return ..." must exist.
   error ("ftell: invalid_operation");
   return -1;
@@ -77,19 +78,19 @@
 // Return nonzero if EOF has been reached on this stream.
 
 bool
-octave_fstream::eof (void) const
+fstream::eof (void) const
 {
   return m_fstream.eof ();
 }
 
 void
-octave_fstream::do_close (void)
+fstream::do_close (void)
 {
   m_fstream.close ();
 }
 
 std::istream *
-octave_fstream::input_stream (void)
+fstream::input_stream (void)
 {
   std::istream *retval = nullptr;
 
@@ -100,7 +101,7 @@
 }
 
 std::ostream *
-octave_fstream::output_stream (void)
+fstream::output_stream (void)
 {
   std::ostream *retval = nullptr;
 
@@ -109,3 +110,5 @@
 
   return retval;
 }
+
+OCTAVE_NAMESPACE_END
--- a/libinterp/corefcn/oct-fstrm.h	Mon Aug 16 22:28:30 2021 -0400
+++ b/libinterp/corefcn/oct-fstrm.h	Tue Aug 17 11:17:36 2021 -0400
@@ -33,27 +33,27 @@
 
 #include "oct-stream.h"
 
+OCTAVE_NAMESPACE_BEGIN
+
 class
-octave_fstream : public octave::base_stream
+fstream : public base_stream
 {
 public:
 
-  octave_fstream (const std::string& nm_arg,
-                  std::ios::openmode arg_md = std::ios::in | std::ios::out,
-                  octave::mach_info::float_format flt_fmt
-                    = octave::mach_info::native_float_format ());
+  fstream (const std::string& nm_arg,
+           std::ios::openmode arg_md = std::ios::in | std::ios::out,
+           mach_info::float_format flt_fmt = mach_info::native_float_format ());
 
   // No copying!
 
-  octave_fstream (const octave_fstream&) = delete;
+  fstream (const fstream&) = delete;
 
-  octave_fstream& operator = (const octave_fstream&) = delete;
+  fstream& operator = (const fstream&) = delete;
 
-  static octave::stream
+  static stream
   create (const std::string& nm_arg,
           std::ios::openmode arg_md = std::ios::in | std::ios::out,
-          octave::mach_info::float_format flt_fmt
-            = octave::mach_info::native_float_format ());
+          mach_info::float_format flt_fmt = mach_info::native_float_format ());
 
   // Position a stream at OFFSET relative to ORIGIN.
 
@@ -79,7 +79,7 @@
 
 protected:
 
-  ~octave_fstream (void) = default;
+  ~fstream (void) = default;
 
 private:
 
@@ -88,4 +88,13 @@
   std::fstream m_fstream;
 };
 
+OCTAVE_NAMESPACE_END
+
+#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
+
+OCTAVE_DEPRECATED (7, "use 'octave::fstream' instead")
+typedef octave::fstream octave_fstream;
+
 #endif
+
+#endif
--- a/libinterp/corefcn/oct-iostrm.cc	Mon Aug 16 22:28:30 2021 -0400
+++ b/libinterp/corefcn/oct-iostrm.cc	Tue Aug 17 11:17:36 2021 -0400
@@ -33,10 +33,12 @@
 #include "error.h"
 #include "oct-iostrm.h"
 
+OCTAVE_NAMESPACE_BEGIN
+
 // Position a stream at OFFSET relative to ORIGIN.
 
 int
-octave_base_iostream::seek (off_t, int)
+base_iostream::seek (off_t, int)
 {
   invalid_operation ();
   return -1;
@@ -45,7 +47,7 @@
 // Return current stream position.
 
 off_t
-octave_base_iostream::tell (void)
+base_iostream::tell (void)
 {
   invalid_operation ();
   return -1;
@@ -54,14 +56,14 @@
 // Return nonzero if EOF has been reached on this stream.
 
 bool
-octave_base_iostream::eof (void) const
+base_iostream::eof (void) const
 {
   invalid_operation ();
   return false;
 }
 
 void
-octave_base_iostream::invalid_operation (void) const
+base_iostream::invalid_operation (void) const
 {
   // Note: use ::error to get error from error.h which halts operation.
   ::error ("%s: invalid operation", stream_type ());
@@ -70,27 +72,29 @@
 // Return nonzero if EOF has been reached on this stream.
 
 bool
-octave_istream::eof (void) const
+istream::eof (void) const
 {
   return m_istream && m_istream->eof ();
 }
 
 octave::stream
-octave_istream::create (std::istream *arg, const std::string& n)
+istream::create (std::istream *arg, const std::string& n)
 {
-  return octave::stream (new octave_istream (arg, n));
+  return octave::stream (new istream (arg, n));
 }
 
 // Return nonzero if EOF has been reached on this stream.
 
 bool
-octave_ostream::eof (void) const
+ostream::eof (void) const
 {
   return m_ostream && m_ostream->eof ();
 }
 
 octave::stream
-octave_ostream::create (std::ostream *arg, const std::string& n)
+ostream::create (std::ostream *arg, const std::string& n)
 {
-  return octave::stream (new octave_ostream (arg, n));
+  return octave::stream (new ostream (arg, n));
 }
+
+OCTAVE_NAMESPACE_END
--- a/libinterp/corefcn/oct-iostrm.h	Mon Aug 16 22:28:30 2021 -0400
+++ b/libinterp/corefcn/oct-iostrm.h	Tue Aug 17 11:17:36 2021 -0400
@@ -32,26 +32,27 @@
 
 #include "oct-stream.h"
 
+OCTAVE_NAMESPACE_BEGIN
+
 class
-octave_base_iostream : public octave::base_stream
+base_iostream : public base_stream
 {
 public:
 
-  octave_base_iostream (const std::string& n = "",
-                        std::ios::openmode m = std::ios::in | std::ios::out,
-                        octave::mach_info::float_format ff
-                          = octave::mach_info::native_float_format ())
-    : octave::base_stream (m, ff), m_name (n) { }
+  base_iostream (const std::string& n = "",
+                 std::ios::openmode m = std::ios::in | std::ios::out,
+                 mach_info::float_format ff = mach_info::native_float_format ())
+    : base_stream (m, ff), m_name (n) { }
 
   // No copying!
 
-  octave_base_iostream (const octave_base_iostream&) = delete;
+  base_iostream (const base_iostream&) = delete;
 
-  octave_base_iostream& operator = (const octave_base_iostream&) = delete;
+  base_iostream& operator = (const base_iostream&) = delete;
 
 protected:
 
-  ~octave_base_iostream (void) = default;
+  ~base_iostream (void) = default;
 
 public:
 
@@ -83,17 +84,16 @@
 };
 
 class
-octave_istream : public octave_base_iostream
+istream : public base_iostream
 {
 public:
 
-  octave_istream (std::istream *arg = nullptr, const std::string& n = "")
-    : octave_base_iostream (n, std::ios::in,
-                            octave::mach_info::native_float_format ()),
+  istream (std::istream *arg = nullptr, const std::string& n = "")
+    : base_iostream (n, std::ios::in, mach_info::native_float_format ()),
       m_istream (arg)
   { }
 
-  static octave::stream
+  static stream
   create (std::istream *arg = nullptr, const std::string& n = "");
 
   // Return nonzero if EOF has been reached on this stream.
@@ -106,33 +106,32 @@
 
 protected:
 
-  ~octave_istream (void) = default;
+  ~istream (void) = default;
 
 private:
 
   std::istream *m_istream;
 
-  const char * stream_type (void) const { return "octave_istream"; }
+  const char * stream_type (void) const { return "istream"; }
 
   // No copying!
 
-  octave_istream (const octave_istream&) = delete;
+  istream (const istream&) = delete;
 
-  octave_istream& operator = (const octave_istream&) = delete;
+  istream& operator = (const istream&) = delete;
 };
 
 class
-octave_ostream : public octave_base_iostream
+ostream : public base_iostream
 {
 public:
 
-  octave_ostream (std::ostream *arg, const std::string& n = "")
-    : octave_base_iostream (n, std::ios::out,
-                            octave::mach_info::native_float_format ()),
+  ostream (std::ostream *arg, const std::string& n = "")
+    : base_iostream (n, std::ios::out, mach_info::native_float_format ()),
       m_ostream (arg)
   { }
 
-  static octave::stream
+  static stream
   create (std::ostream *arg, const std::string& n = "");
 
   // Return nonzero if EOF has been reached on this stream.
@@ -145,19 +144,34 @@
 
 protected:
 
-  ~octave_ostream (void) = default;
+  ~ostream (void) = default;
 
 private:
 
   std::ostream *m_ostream;
 
-  const char * stream_type (void) const { return "octave_ostream"; }
+  const char * stream_type (void) const { return "ostream"; }
 
   // No copying!
 
-  octave_ostream (const octave_ostream&) = delete;
+  ostream (const ostream&) = delete;
 
-  octave_ostream& operator = (const octave_ostream&) = delete;
+  ostream& operator = (const ostream&) = delete;
 };
 
+OCTAVE_NAMESPACE_END
+
+#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
+
+OCTAVE_DEPRECATED (7, "use 'octave::base_iostream' instead")
+typedef octave::base_iostream octave_base_iostream;
+
+OCTAVE_DEPRECATED (7, "use 'octave::istream' instead")
+typedef octave::istream octave_istream;
+
+OCTAVE_DEPRECATED (7, "use 'octave::ostream' instead")
+typedef octave::ostream octave_ostream;
+
 #endif
+
+#endif
--- a/libinterp/corefcn/oct-prcstrm.cc	Mon Aug 16 22:28:30 2021 -0400
+++ b/libinterp/corefcn/oct-prcstrm.cc	Tue Aug 17 11:17:36 2021 -0400
@@ -32,6 +32,8 @@
 #include "oct-prcstrm.h"
 #include "sysdep.h"
 
+OCTAVE_NAMESPACE_BEGIN
+
 octave::stream
 octave_iprocstream::create (const std::string& n, std::ios::openmode arg_md,
                             octave::mach_info::float_format ff,
@@ -44,8 +46,8 @@
                                         std::ios::openmode arg_md,
                                         octave::mach_info::float_format ff,
                                         const std::string& encoding)
-  : octave_stdiostream (n, octave::popen (n.c_str (), "r"),
-                        arg_md, ff, encoding, octave::pclose)
+  : octave::stdiostream (n, octave::popen (n.c_str (), "r"),
+                         arg_md, ff, encoding, octave::pclose)
 { }
 
 octave_iprocstream::~octave_iprocstream (void)
@@ -65,11 +67,13 @@
                                         std::ios::openmode arg_md,
                                         octave::mach_info::float_format ff,
                                         const std::string& encoding)
-  : octave_stdiostream (n, octave::popen (n.c_str (), "w"),
-                        arg_md, ff, encoding, octave::pclose)
+  : octave::stdiostream (n, octave::popen (n.c_str (), "w"),
+                         arg_md, ff, encoding, octave::pclose)
 { }
 
 octave_oprocstream::~octave_oprocstream (void)
 {
   do_close ();
 }
+
+OCTAVE_NAMESPACE_END
--- a/libinterp/corefcn/oct-prcstrm.h	Mon Aug 16 22:28:30 2021 -0400
+++ b/libinterp/corefcn/oct-prcstrm.h	Tue Aug 17 11:17:36 2021 -0400
@@ -33,8 +33,15 @@
 // FIXME: why don't these classes use iprocstream and oprocstream,
 //        which in turn use the octave_procbuf class?
 
+// Note: Even though these classes are now inside the octave namespace,
+// we can't rename them to iprocstream and oprocstream because we
+// already have classes with those names (see procstream.h).  We need to
+// find a way to resolve this naming issue.
+
+OCTAVE_NAMESPACE_BEGIN
+
 class
-octave_iprocstream : public octave_stdiostream
+octave_iprocstream : public octave::stdiostream
 {
 public:
 
@@ -62,7 +69,7 @@
 };
 
 class
-octave_oprocstream : public octave_stdiostream
+octave_oprocstream : public octave::stdiostream
 {
 public:
 
@@ -89,4 +96,16 @@
   ~octave_oprocstream (void);
 };
 
+OCTAVE_NAMESPACE_END
+
+#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
+
+OCTAVE_DEPRECATED (7, "use 'octave::octave_iprocstream' instead")
+typedef octave::octave_iprocstream octave_iprocstream;
+
+OCTAVE_DEPRECATED (7, "use 'octave::octave_oprocstream' instead")
+typedef octave::octave_oprocstream octave_oprocstream;
+
 #endif
+
+#endif
--- a/libinterp/corefcn/oct-procbuf.cc	Mon Aug 16 22:28:30 2021 -0400
+++ b/libinterp/corefcn/oct-procbuf.cc	Tue Aug 17 11:17:36 2021 -0400
@@ -55,6 +55,8 @@
 #include "errwarn.h"
 #include "utils.h"
 
+OCTAVE_NAMESPACE_BEGIN
+
 #if ! defined (SHELL_PATH)
 #  define SHELL_PATH "/bin/sh"
 #endif
@@ -65,7 +67,7 @@
 #if (! (defined (__CYGWIN__) || defined (__MINGW32__) || defined (_MSC_VER)) \
      && defined (HAVE_UNISTD_H))
 
-static octave_procbuf *octave_procbuf_list = nullptr;
+static procbuf *procbuf_list = nullptr;
 
 #endif
 
@@ -73,8 +75,8 @@
 #  define BUFSIZ 1024
 #endif
 
-octave_procbuf *
-octave_procbuf::open (const char *command, int mode)
+procbuf *
+procbuf::open (const char *command, int mode)
 {
 #if defined (__CYGWIN__) || defined (__MINGW32__) || defined (_MSC_VER)
 
@@ -134,9 +136,9 @@
           octave_close_wrapper (child_end);
         }
 
-      while (octave_procbuf_list)
+      while (procbuf_list)
         {
-          FILE *fp = octave_procbuf_list->f;
+          FILE *fp = procbuf_list->f;
 
           if (fp)
             {
@@ -144,7 +146,7 @@
               fp = nullptr;
             }
 
-          octave_procbuf_list = octave_procbuf_list->next;
+          procbuf_list = procbuf_list->next;
         }
 
       execl (SHELL_PATH, "sh", "-c", command, static_cast<void *> (nullptr));
@@ -167,8 +169,8 @@
 
   open_p = true;
 
-  next = octave_procbuf_list;
-  octave_procbuf_list = this;
+  next = procbuf_list;
+  procbuf_list = this;
 
   return this;
 
@@ -179,8 +181,8 @@
 #endif
 }
 
-octave_procbuf *
-octave_procbuf::close (void)
+procbuf *
+procbuf::close (void)
 {
 #if defined (__CYGWIN__) || defined (__MINGW32__) || defined (_MSC_VER)
 
@@ -202,7 +204,7 @@
 
       int status = -1;
 
-      for (octave_procbuf **ptr = &octave_procbuf_list;
+      for (procbuf **ptr = &procbuf_list;
            *ptr != nullptr;
            ptr = &(*ptr)->next)
         {
@@ -238,3 +240,5 @@
 
 #endif
 }
+
+OCTAVE_NAMESPACE_END
--- a/libinterp/corefcn/oct-procbuf.h	Mon Aug 16 22:28:30 2021 -0400
+++ b/libinterp/corefcn/oct-procbuf.h	Tue Aug 17 11:17:36 2021 -0400
@@ -35,30 +35,32 @@
 
 #include "c-file-ptr-stream.h"
 
+OCTAVE_NAMESPACE_BEGIN
+
 class
-octave_procbuf : public c_file_ptr_buf
+procbuf : public c_file_ptr_buf
 {
 public:
 
-  octave_procbuf (void)
+  procbuf (void)
     : c_file_ptr_buf (nullptr), wstatus (-1), open_p (false), proc_pid (-1),
       next (nullptr) { }
 
-  octave_procbuf (const char *command, int mode)
+  procbuf (const char *command, int mode)
     : c_file_ptr_buf (nullptr), wstatus (-1), open_p (false), proc_pid (-1),
       next (nullptr) { open (command, mode); }
 
   // No copying!
 
-  octave_procbuf (const octave_procbuf&) = delete;
+  procbuf (const procbuf&) = delete;
 
-  octave_procbuf& operator = (const octave_procbuf&) = delete;
+  procbuf& operator = (const procbuf&) = delete;
 
-  ~octave_procbuf (void) { close (); }
+  ~procbuf (void) { close (); }
 
-  octave_procbuf * open (const char *command, int mode);
+  procbuf * open (const char *command, int mode);
 
-  octave_procbuf * close (void);
+  procbuf * close (void);
 
   int wait_status (void) const { return wstatus; }
 
@@ -74,9 +76,16 @@
 
   pid_t proc_pid;
 
-  octave_procbuf *next;
+  procbuf *next;
 };
 
-extern void symbols_of_oct_procbuf (void);
+OCTAVE_NAMESPACE_END
+
+#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
+
+OCTAVE_DEPRECATED (7, "use octave::procbuf' instead")
+typedef octave::procbuf procbuf;
 
 #endif
+
+#endif
--- a/libinterp/corefcn/oct-stdstrm.h	Mon Aug 16 22:28:30 2021 -0400
+++ b/libinterp/corefcn/oct-stdstrm.h	Tue Aug 17 11:17:36 2021 -0400
@@ -33,27 +33,28 @@
 #include "oct-stream.h"
 #include "c-file-ptr-stream.h"
 
+OCTAVE_NAMESPACE_BEGIN
+
 template <typename BUF_T, typename STREAM_T, typename FILE_T>
 class
-octave_tstdiostream : public octave::base_stream
+tstdiostream : public base_stream
 {
 public:
 
-  octave_tstdiostream (const std::string& n, FILE_T f = 0, int fid = 0,
-                       std::ios::openmode m = std::ios::in | std::ios::out,
-                       octave::mach_info::float_format ff
-                         = octave::mach_info::native_float_format (),
-                       const std::string& encoding = "utf-8",
-                       typename BUF_T::close_fcn cf = BUF_T::file_close)
-    : octave::base_stream (m, ff, encoding), m_name (n), m_mode (m),
+  tstdiostream (const std::string& n, FILE_T f = 0, int fid = 0,
+                std::ios::openmode m = std::ios::in | std::ios::out,
+                mach_info::float_format ff = mach_info::native_float_format (),
+                const std::string& encoding = "utf-8",
+                typename BUF_T::close_fcn cf = BUF_T::file_close)
+    : base_stream (m, ff, encoding), m_name (n), m_mode (m),
       m_stream (f ? new STREAM_T (f, cf) : nullptr), fnum (fid)
   { }
 
   // No copying!
 
-  octave_tstdiostream (const octave_tstdiostream&) = delete;
+  tstdiostream (const tstdiostream&) = delete;
 
-  octave_tstdiostream& operator = (const octave_tstdiostream&) = delete;
+  tstdiostream& operator = (const tstdiostream&) = delete;
 
   // Position a stream at OFFSET relative to ORIGIN.
 
@@ -117,87 +118,93 @@
   // The file number associated with this file.
   int fnum;
 
-  ~octave_tstdiostream (void) { delete m_stream; }
+  ~tstdiostream (void) { delete m_stream; }
 };
 
 class
-octave_stdiostream
-  : public octave_tstdiostream<c_file_ptr_buf, io_c_file_ptr_stream, FILE *>
+stdiostream
+  : public tstdiostream<c_file_ptr_buf, io_c_file_ptr_stream, FILE *>
 {
 public:
 
-  octave_stdiostream (const std::string& n, FILE *f = nullptr,
-                      std::ios::openmode m = std::ios::in | std::ios::out,
-                      octave::mach_info::float_format ff
-                        = octave::mach_info::native_float_format (),
-                      const std::string& encoding = "utf-8",
-                      c_file_ptr_buf::close_fcn cf = c_file_ptr_buf::file_close)
-    : octave_tstdiostream<c_file_ptr_buf, io_c_file_ptr_stream, FILE *>
+  stdiostream (const std::string& n, FILE *f = nullptr,
+               std::ios::openmode m = std::ios::in | std::ios::out,
+               mach_info::float_format ff = mach_info::native_float_format (),
+               const std::string& encoding = "utf-8",
+               c_file_ptr_buf::close_fcn cf = c_file_ptr_buf::file_close)
+    : tstdiostream<c_file_ptr_buf, io_c_file_ptr_stream, FILE *>
        (n, f, f ? fileno (f) : -1, m, ff, encoding, cf) { }
 
-  static octave::stream
+  static stream
   create (const std::string& n, FILE *f = nullptr,
           std::ios::openmode m = std::ios::in | std::ios::out,
-          octave::mach_info::float_format ff
-            = octave::mach_info::native_float_format (),
+          mach_info::float_format ff = mach_info::native_float_format (),
           const std::string& encoding = "utf-8",
           c_file_ptr_buf::close_fcn cf = c_file_ptr_buf::file_close)
   {
-    return octave::stream (new octave_stdiostream (n, f, m, ff, encoding, cf));
+    return stream (new stdiostream (n, f, m, ff, encoding, cf));
   }
 
   // No copying!
 
-  octave_stdiostream (const octave_stdiostream&) = delete;
+  stdiostream (const stdiostream&) = delete;
 
-  octave_stdiostream& operator = (const octave_stdiostream&) = delete;
+  stdiostream& operator = (const stdiostream&) = delete;
 
 protected:
 
-  ~octave_stdiostream (void) = default;
+  ~stdiostream (void) = default;
 };
 
 #if defined (HAVE_ZLIB)
 
 class
-octave_zstdiostream
-  : public octave_tstdiostream<c_zfile_ptr_buf, io_c_zfile_ptr_stream, gzFile>
+zstdiostream
+  : public tstdiostream<c_zfile_ptr_buf, io_c_zfile_ptr_stream, gzFile>
 {
 public:
 
-  octave_zstdiostream (const std::string& n, gzFile f = nullptr, int fid = 0,
-                       std::ios::openmode m = std::ios::in | std::ios::out,
-                       octave::mach_info::float_format ff
-                         = octave::mach_info::native_float_format (),
-                       const std::string& encoding = "utf-8",
-                       c_zfile_ptr_buf::close_fcn cf
-                         = c_zfile_ptr_buf::file_close)
-    : octave_tstdiostream<c_zfile_ptr_buf, io_c_zfile_ptr_stream, gzFile>
+  zstdiostream (const std::string& n, gzFile f = nullptr, int fid = 0,
+                std::ios::openmode m = std::ios::in | std::ios::out,
+                mach_info::float_format ff = mach_info::native_float_format (),
+                const std::string& encoding = "utf-8",
+                c_zfile_ptr_buf::close_fcn cf = c_zfile_ptr_buf::file_close)
+    : tstdiostream<c_zfile_ptr_buf, io_c_zfile_ptr_stream, gzFile>
        (n, f, fid, m, ff, encoding, cf) { }
 
-  static octave::stream
+  static stream
   create (const std::string& n, gzFile f = nullptr, int fid = 0,
           std::ios::openmode m = std::ios::in | std::ios::out,
-          octave::mach_info::float_format ff
-            = octave::mach_info::native_float_format (),
+          mach_info::float_format ff = mach_info::native_float_format (),
           const std::string& encoding = "utf-8",
           c_zfile_ptr_buf::close_fcn cf = c_zfile_ptr_buf::file_close)
   {
-    return octave::stream (new octave_zstdiostream (n, f, fid, m, ff, encoding,
-                                                    cf));
+    return stream (new zstdiostream (n, f, fid, m, ff, encoding, cf));
   }
 
   // No copying!
 
-  octave_zstdiostream (const octave_zstdiostream&) = delete;
+  zstdiostream (const zstdiostream&) = delete;
 
-  octave_zstdiostream& operator = (const octave_zstdiostream&) = delete;
+  zstdiostream& operator = (const zstdiostream&) = delete;
 
 protected:
 
-  ~octave_zstdiostream (void) = default;
+  ~zstdiostream (void) = default;
 };
 
 #endif
 
+OCTAVE_NAMESPACE_END
+
+#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
+
+OCTAVE_DEPRECATED (7, "use 'octave::stdiostream' instead")
+typedef octave::stdiostream octave_stdiostream;
+
+OCTAVE_DEPRECATED (7, "use 'octave::zstdiostream' instead")
+typedef octave::zstdiostream octave_zstdiostream;
+
 #endif
+
+#endif
--- a/libinterp/corefcn/oct-stream.cc	Mon Aug 16 22:28:30 2021 -0400
+++ b/libinterp/corefcn/oct-stream.cc	Tue Aug 17 11:17:36 2021 -0400
@@ -7326,7 +7326,7 @@
     : m_list (), m_lookup_cache (m_list.end ()), m_stdin_file (-1),
       m_stdout_file (-1), m_stderr_file (-1)
   {
-    stream stdin_stream = octave_istream::create (&std::cin, "stdin");
+    stream stdin_stream = istream::create (&std::cin, "stdin");
 
     // This uses octave_stdout (see pager.h), not std::cout so that
     // Octave's standard output stream will pass through the pager.
@@ -7336,9 +7336,9 @@
     output_system& output_sys = interp.get_output_system ();
 
     stream stdout_stream
-      = octave_ostream::create (&(output_sys.__stdout__ ()), "stdout");
-
-    stream stderr_stream = octave_ostream::create (&std::cerr, "stderr");
+      = ostream::create (&(output_sys.__stdout__ ()), "stdout");
+
+    stream stderr_stream = ostream::create (&std::cerr, "stderr");
 
     m_stdin_file = insert (stdin_stream);
     m_stdout_file = insert (stdout_stream);
--- a/libinterp/corefcn/oct-strstrm.cc	Mon Aug 16 22:28:30 2021 -0400
+++ b/libinterp/corefcn/oct-strstrm.cc	Tue Aug 17 11:17:36 2021 -0400
@@ -29,12 +29,14 @@
 
 #include "oct-strstrm.h"
 
+OCTAVE_NAMESPACE_BEGIN
+
 // Position a stream at OFFSET relative to ORIGIN.
 
 int
-octave_base_strstream::seek (off_t, int)
+base_strstream::seek (off_t, int)
 {
-  // Note: error is inherited from octave::base_stream, not ::error.
+  // Note: error is inherited from base_stream, not ::error.
   // This error function does not halt execution so "return ..." must exist.
   error ("fseek: invalid operation");
   return -1;
@@ -43,37 +45,36 @@
 // Return current stream position.
 
 off_t
-octave_base_strstream::tell (void)
+base_strstream::tell (void)
 {
-  // Note: error is inherited from octave::base_stream, not ::error.
+  // Note: error is inherited from base_stream, not ::error.
   // This error function does not halt execution so "return ..." must exist.
   error ("ftell: invalid operation");
   return -1;
 }
 
-octave::stream
-octave_istrstream::create (const char *data, std::ios::openmode arg_md,
-                           octave::mach_info::float_format flt_fmt,
-                           const std::string& encoding)
+stream
+istrstream::create (const char *data, std::ios::openmode arg_md,
+                    mach_info::float_format flt_fmt,
+                    const std::string& encoding)
 {
-  return octave::stream (new octave_istrstream (data, arg_md, flt_fmt,
-                                                encoding));
+  return stream (new istrstream (data, arg_md, flt_fmt, encoding));
 }
 
-octave::stream
-octave_istrstream::create (const std::string& data, std::ios::openmode arg_md,
-                           octave::mach_info::float_format flt_fmt,
+stream
+istrstream::create (const std::string& data, std::ios::openmode arg_md,
+                           mach_info::float_format flt_fmt,
                            const std::string& encoding)
 {
-  return octave::stream (new octave_istrstream (data, arg_md, flt_fmt,
-                                                encoding));
+  return stream (new istrstream (data, arg_md, flt_fmt, encoding));
 }
 
-octave::stream
-octave_ostrstream::create (std::ios::openmode arg_md,
-                           octave::mach_info::float_format flt_fmt,
+stream
+ostrstream::create (std::ios::openmode arg_md,
+                           mach_info::float_format flt_fmt,
                            const std::string& encoding)
 {
-  return octave::stream (new octave_ostrstream (arg_md, flt_fmt,
-                                                encoding));
+  return stream (new ostrstream (arg_md, flt_fmt, encoding));
 }
+
+OCTAVE_NAMESPACE_END
--- a/libinterp/corefcn/oct-strstrm.h	Mon Aug 16 22:28:30 2021 -0400
+++ b/libinterp/corefcn/oct-strstrm.h	Tue Aug 17 11:17:36 2021 -0400
@@ -33,26 +33,28 @@
 
 #include "oct-stream.h"
 
+OCTAVE_NAMESPACE_BEGIN
+
 class
-octave_base_strstream : public octave::base_stream
+base_strstream : public base_stream
 {
 public:
 
-  octave_base_strstream (std::ios::openmode m = std::ios::out,
-                         octave::mach_info::float_format ff
-                           = octave::mach_info::native_float_format (),
-                         const std::string& encoding = "utf-8")
-    : octave::base_stream (m, ff, encoding) { }
+  base_strstream (std::ios::openmode m = std::ios::out,
+                  mach_info::float_format ff
+                    = mach_info::native_float_format (),
+                  const std::string& encoding = "utf-8")
+    : base_stream (m, ff, encoding) { }
 
   // No copying!
 
-  octave_base_strstream (const octave_base_strstream&) = delete;
+  base_strstream (const base_strstream&) = delete;
 
-  octave_base_strstream& operator = (const octave_base_strstream&) = delete;
+  base_strstream& operator = (const base_strstream&) = delete;
 
 protected:
 
-  ~octave_base_strstream (void) = default;
+  ~base_strstream (void) = default;
 
 public:
 
@@ -76,47 +78,43 @@
 };
 
 class
-octave_istrstream : public octave_base_strstream
+istrstream : public base_strstream
 {
 public:
 
-  octave_istrstream (const char *data,
-                     std::ios::openmode arg_md = std::ios::out,
-                     octave::mach_info::float_format ff
-                       = octave::mach_info::native_float_format (),
-                     const std::string& encoding = "utf-8")
-    : octave_base_strstream (arg_md, ff, encoding), m_istream (data) { }
+  istrstream (const char *data,
+              std::ios::openmode arg_md = std::ios::out,
+              mach_info::float_format ff = mach_info::native_float_format (),
+              const std::string& encoding = "utf-8")
+    : base_strstream (arg_md, ff, encoding), m_istream (data) { }
 
-  octave_istrstream (const std::string& data,
-                     std::ios::openmode arg_md = std::ios::out,
-                     octave::mach_info::float_format ff
-                       = octave::mach_info::native_float_format (),
-                     const std::string& encoding = "utf-8")
-    : octave_base_strstream (arg_md, ff, encoding), m_istream (data) { }
+  istrstream (const std::string& data,
+              std::ios::openmode arg_md = std::ios::out,
+              mach_info::float_format ff = mach_info::native_float_format (),
+              const std::string& encoding = "utf-8")
+    : base_strstream (arg_md, ff, encoding), m_istream (data) { }
 
   // No copying!
 
-  octave_istrstream (const octave_istrstream&) = delete;
+  istrstream (const istrstream&) = delete;
 
-  octave_istrstream& operator = (const octave_istrstream&) = delete;
+  istrstream& operator = (const istrstream&) = delete;
 
 protected:
 
-  ~octave_istrstream (void) = default;
+  ~istrstream (void) = default;
 
 public:
 
 
-  static octave::stream
+  static stream
   create (const char *data, std::ios::openmode arg_md = std::ios::out,
-          octave::mach_info::float_format ff
-            = octave::mach_info::native_float_format (),
+          mach_info::float_format ff = mach_info::native_float_format (),
           const std::string& encoding = "utf-8");
 
-  static octave::stream
+  static stream
   create (const std::string& data, std::ios::openmode arg_md = std::ios::out,
-          octave::mach_info::float_format ff
-            = octave::mach_info::native_float_format (),
+          mach_info::float_format ff = mach_info::native_float_format (),
           const std::string& encoding = "utf-8");
 
   // Return nonzero if EOF has been reached on this stream.
@@ -144,32 +142,30 @@
 };
 
 class
-octave_ostrstream : public octave_base_strstream
+ostrstream : public base_strstream
 {
 public:
 
-  octave_ostrstream (std::ios::openmode arg_md = std::ios::out,
-                     octave::mach_info::float_format ff
-                       = octave::mach_info::native_float_format (),
-                     const std::string& encoding = "utf-8")
-    : octave_base_strstream (arg_md, ff, encoding), m_ostream () { }
+  ostrstream (std::ios::openmode arg_md = std::ios::out,
+              mach_info::float_format ff = mach_info::native_float_format (),
+              const std::string& encoding = "utf-8")
+    : base_strstream (arg_md, ff, encoding), m_ostream () { }
 
   // No copying!
 
-  octave_ostrstream (const octave_ostrstream&) = delete;
+  ostrstream (const ostrstream&) = delete;
 
-  octave_ostrstream& operator = (const octave_ostrstream&) = delete;
+  ostrstream& operator = (const ostrstream&) = delete;
 
 protected:
 
-  ~octave_ostrstream (void) = default;
+  ~ostrstream (void) = default;
 
 public:
 
-  static octave::stream
+  static stream
   create (std::ios::openmode arg_md = std::ios::out,
-          octave::mach_info::float_format ff
-            = octave::mach_info::native_float_format (),
+          mach_info::float_format ff = mach_info::native_float_format (),
           const std::string& encoding = "utf-8");
 
   // Return nonzero if EOF has been reached on this stream.
@@ -196,4 +192,19 @@
   std::ostringstream m_ostream;
 };
 
+OCTAVE_NAMESPACE_END
+
+#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
+
+OCTAVE_DEPRECATED (7, "use 'octave::base_strstream' instead")
+typedef octave::base_strstream octave_base_strstream;
+
+OCTAVE_DEPRECATED (7, "use 'octave::istrstream' instead")
+typedef octave::istrstream octave_istrstream;
+
+OCTAVE_DEPRECATED (7, "use 'octave::ostrstream' instead")
+typedef octave::ostrstream octave_ostrstream;
+
 #endif
+
+#endif
--- a/libinterp/corefcn/pager.h	Mon Aug 16 22:28:30 2021 -0400
+++ b/libinterp/corefcn/pager.h	Tue Aug 17 11:17:36 2021 -0400
@@ -35,11 +35,11 @@
 
 class octave_value;
 class octave_value_list;
-class oprocstream;
 
 OCTAVE_NAMESPACE_BEGIN
 
   class interpreter;
+class oprocstream;
 
   class
   OCTINTERP_API
--- a/libinterp/corefcn/procstream.cc	Mon Aug 16 22:28:30 2021 -0400
+++ b/libinterp/corefcn/procstream.cc	Tue Aug 17 11:17:36 2021 -0400
@@ -31,6 +31,8 @@
 
 #include "procstream.h"
 
+OCTAVE_NAMESPACE_BEGIN
+
 procstreambase::procstreambase (const std::string& command, int mode)
 {
   pb_init ();
@@ -71,3 +73,5 @@
 
   return status;
 }
+
+OCTAVE_NAMESPACE_END
--- a/libinterp/corefcn/procstream.h	Mon Aug 16 22:28:30 2021 -0400
+++ b/libinterp/corefcn/procstream.h	Tue Aug 17 11:17:36 2021 -0400
@@ -35,6 +35,8 @@
 
 #include "oct-procbuf.h"
 
+OCTAVE_NAMESPACE_BEGIN
+
 class
 OCTINTERP_API
 procstreambase : virtual public std::ios
@@ -66,7 +68,7 @@
 
 private:
 
-  octave_procbuf m_pb;
+  procbuf m_pb;
 
   void pb_init (void)
   {
@@ -183,4 +185,22 @@
   procstream& operator = (const procstream&);
 };
 
+OCTAVE_NAMESPACE_END
+
+#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
+
+OCTAVE_DEPRECATED (7, "use 'octave::procstreambase' instead")
+typedef octave::procstreambase procstreambase;
+
+OCTAVE_DEPRECATED (7, "use 'octave::iprocstream' instead")
+typedef octave::iprocstream iprocstream;
+
+OCTAVE_DEPRECATED (7, "use 'octave::oprocstream' instead")
+typedef octave::oprocstream oprocstream;
+
+OCTAVE_DEPRECATED (7, "use 'octave::procstream' instead")
+typedef octave::procstream procstream;
+
 #endif
+
+#endif
--- a/libinterp/corefcn/syscalls.cc	Mon Aug 16 22:28:30 2021 -0400
+++ b/libinterp/corefcn/syscalls.cc	Tue Aug 17 11:17:36 2021 -0400
@@ -300,11 +300,9 @@
   FILE *ifile = fdopen (filedesc[1], "r");
   FILE *ofile = fdopen (filedesc[0], "w");
 
-  stream is
-    = octave_stdiostream::create (exec_file + "-in", ifile, std::ios::in);
+  stream is = stdiostream::create (exec_file + "-in", ifile, std::ios::in);
 
-  stream os
-    = octave_stdiostream::create (exec_file + "-out", ofile, std::ios::out);
+  stream os = stdiostream::create (exec_file + "-out", ofile, std::ios::out);
 
   stream_list& streams = interp.get_stream_list ();
 
@@ -798,11 +796,9 @@
       FILE *ifile = fdopen (fid[0], "r");
       FILE *ofile = fdopen (fid[1], "w");
 
-      stream is
-        = octave_stdiostream::create ("pipe-in", ifile, std::ios::in);
+      stream is = stdiostream::create ("pipe-in", ifile, std::ios::in);
 
-      stream os
-        = octave_stdiostream::create ("pipe-out", ofile, std::ios::out);
+      stream os = stdiostream::create ("pipe-out", ofile, std::ios::out);
 
       stream_list& streams = interp.get_stream_list ();