changeset 26009:3fc9d7453ba6

where possible, use octave_stdout and avoid including <iostream> * gl-select.cc, gl-select.h, Filter.cpp, History.cpp, load-save.cc, pr-output.cc, ov-java.cc, oct-parse.yy: Use octave_stdout instead of std::cout. Avoid including <iostream> if possible.
author John W. Eaton <jwe@octave.org>
date Thu, 01 Nov 2018 18:08:27 -0400
parents 38a881b8fbec
children e3a2ef3dced9
files libgui/graphics/gl-select.cc libgui/graphics/gl-select.h libgui/qterminal/libqterminal/unix/Filter.cpp libgui/qterminal/libqterminal/unix/History.cpp libinterp/corefcn/load-save.cc libinterp/corefcn/pr-output.cc libinterp/octave-value/ov-java.cc libinterp/parse-tree/oct-parse.yy
diffstat 8 files changed, 7 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/graphics/gl-select.cc	Thu Nov 01 22:10:00 2018 +0100
+++ b/libgui/graphics/gl-select.cc	Thu Nov 01 18:08:27 2018 -0400
@@ -24,8 +24,6 @@
 #  include "config.h"
 #endif
 
-#include <iostream>
-
 #include "gl-select.h"
 
 namespace octave
--- a/libgui/graphics/gl-select.h	Thu Nov 01 22:10:00 2018 +0100
+++ b/libgui/graphics/gl-select.h	Thu Nov 01 18:08:27 2018 -0400
@@ -24,6 +24,7 @@
 #define octave_gl_select_h 1
 
 #include <map>
+#include <string>
 
 #include "gl-render.h"
 #include "oct-opengl.h"
--- a/libgui/qterminal/libqterminal/unix/Filter.cpp	Thu Nov 01 22:10:00 2018 +0100
+++ b/libgui/qterminal/libqterminal/unix/Filter.cpp	Thu Nov 01 18:08:27 2018 -0400
@@ -23,9 +23,6 @@
 // Own
 #include "unix/Filter.h"
 
-// System
-#include <iostream>
-
 // Qt
 #include <QDesktopServices>
 #include <QAction>
--- a/libgui/qterminal/libqterminal/unix/History.cpp	Thu Nov 01 22:10:00 2018 +0100
+++ b/libgui/qterminal/libqterminal/unix/History.cpp	Thu Nov 01 18:08:27 2018 -0400
@@ -24,7 +24,6 @@
 #include "unix/History.h"
 
 // System
-#include <iostream>
 #include <stdlib.h>
 #include <assert.h>
 #include <stdio.h>
--- a/libinterp/corefcn/load-save.cc	Thu Nov 01 22:10:00 2018 +0100
+++ b/libinterp/corefcn/load-save.cc	Thu Nov 01 18:08:27 2018 -0400
@@ -1469,7 +1469,7 @@
               warning ("save: ignoring -append option for output to stdout");
 
             if (nargout == 0)
-              save_vars (argv, i, argc, std::cout, format,
+              save_vars (argv, i, argc, octave_stdout, format,
                          save_as_floats, true);
             else
               {
--- a/libinterp/corefcn/pr-output.cc	Thu Nov 01 22:10:00 2018 +0100
+++ b/libinterp/corefcn/pr-output.cc	Thu Nov 01 18:08:27 2018 -0400
@@ -27,7 +27,6 @@
 #include <cmath>
 
 #include <iomanip>
-#include <iostream>
 #include <limits>
 #include <list>
 #include <sstream>
--- a/libinterp/octave-value/ov-java.cc	Thu Nov 01 22:10:00 2018 +0100
+++ b/libinterp/octave-value/ov-java.cc	Thu Nov 01 18:08:27 2018 -0400
@@ -35,7 +35,6 @@
 
 #include <algorithm>
 #include <fstream>
-#include <iostream>
 #include <map>
 #include <string>
 #include <vector>
@@ -261,8 +260,7 @@
               if (line.find ('-') == 0)
                 java_opts.push_back (line);
               else if (line.length () > 0 && Vdebug_java)
-                std::cerr << "invalid JVM option, skipping: " << line
-                                                              << std::endl;
+                warning ("invalid JVM option, skipping: %s", line.c_str ());
             }
         }
     }
@@ -297,7 +295,7 @@
           for (const auto& opt : java_opts)
             {
               if (Vdebug_java)
-                std::cout << opt << std::endl;
+                octave_stdout << opt << std::endl;
               vm_args.options[index++].optionString = strsave (opt.c_str ());
             }
 
--- a/libinterp/parse-tree/oct-parse.yy	Thu Nov 01 22:10:00 2018 +0100
+++ b/libinterp/parse-tree/oct-parse.yy	Thu Nov 01 18:08:27 2018 -0400
@@ -5056,8 +5056,8 @@
 
     if (verbose)
       {
-        std::cout << "executing commands from " << full_name << " ... ";
-        std::cout.flush ();
+        octave_stdout << "executing commands from " << full_name << " ... ";
+        octave_stdout.flush ();
       }
 
     octave_user_code *code = ov_code.user_code_value ();
@@ -5065,7 +5065,7 @@
     code->call (tw, 0, octave_value_list ());
 
     if (verbose)
-      std::cout << "done." << std::endl;
+      octave_stdout << "done." << std::endl;
   }
 }