# HG changeset patch # User jwe # Date 949487185 0 # Node ID b80bbb43a1a951eb9eb8591a38a36826316227f2 # Parent bd422cf62f0c92a6004b0cbc13448100c508ed1e [project @ 2000-02-02 10:25:52 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2000-02-02 John W. Eaton + + * All source files: Sprinkle with std:: qualifier as needed. + 2000-01-31 John W. Eaton * sighandlers.cc (install_signal_handlers): Add std:: qualifier diff --git a/src/DLD-FUNCTIONS/balance.cc b/src/DLD-FUNCTIONS/balance.cc --- a/src/DLD-FUNCTIONS/balance.cc +++ b/src/DLD-FUNCTIONS/balance.cc @@ -116,7 +116,7 @@ // determine if it's AEP or GEP int AEPcase = nargin == 1 ? 1 : args(1).is_string (); - string bal_job; + std::string bal_job; // problem dimension int nn = args(0).rows (); diff --git a/src/DLD-FUNCTIONS/colloc.cc b/src/DLD-FUNCTIONS/colloc.cc --- a/src/DLD-FUNCTIONS/colloc.cc +++ b/src/DLD-FUNCTIONS/colloc.cc @@ -91,7 +91,7 @@ return retval; } - string s = args(i).string_value (); + std::string s = args(i).string_value (); if ((s.length () == 1 && (s[0] == 'R' || s[0] == 'r')) || s == "right") diff --git a/src/DLD-FUNCTIONS/dassl.cc b/src/DLD-FUNCTIONS/dassl.cc --- a/src/DLD-FUNCTIONS/dassl.cc +++ b/src/DLD-FUNCTIONS/dassl.cc @@ -26,7 +26,7 @@ #include -#include +#include #include "DASSL.h" @@ -300,7 +300,7 @@ }; static void -print_dassl_option_list (ostream& os) +print_dassl_option_list (std::ostream& os) { print_usage ("dassl_options", 1); @@ -330,7 +330,7 @@ } static void -set_dassl_option (const string& keyword, double val) +set_dassl_option (const std::string& keyword, double val) { DASSL_OPTIONS *list = dassl_option_table; @@ -350,7 +350,7 @@ } static octave_value_list -show_dassl_option (const string& keyword) +show_dassl_option (const std::string& keyword) { octave_value retval; @@ -398,7 +398,7 @@ } else if (nargin == 1 || nargin == 2) { - string keyword = args(0).string_value (); + std::string keyword = args(0).string_value (); if (! error_state) { diff --git a/src/DLD-FUNCTIONS/fsolve.cc b/src/DLD-FUNCTIONS/fsolve.cc --- a/src/DLD-FUNCTIONS/fsolve.cc +++ b/src/DLD-FUNCTIONS/fsolve.cc @@ -26,7 +26,7 @@ #include -#include +#include #include "NLEqn.h" @@ -240,7 +240,7 @@ }; static void -print_fsolve_option_list (ostream& os) +print_fsolve_option_list (std::ostream& os) { print_usage ("fsolve_options", 1); @@ -270,7 +270,7 @@ } static void -set_fsolve_option (const string& keyword, double val) +set_fsolve_option (const std::string& keyword, double val) { NLEQN_OPTIONS *list = fsolve_option_table; @@ -290,7 +290,7 @@ } static octave_value_list -show_fsolve_option (const string& keyword) +show_fsolve_option (const std::string& keyword) { octave_value retval; @@ -338,7 +338,7 @@ } else if (nargin == 1 || nargin == 2) { - string keyword = args(0).string_value (); + std::string keyword = args(0).string_value (); if (! error_state) { diff --git a/src/DLD-FUNCTIONS/getgrent.cc b/src/DLD-FUNCTIONS/getgrent.cc --- a/src/DLD-FUNCTIONS/getgrent.cc +++ b/src/DLD-FUNCTIONS/getgrent.cc @@ -73,14 +73,14 @@ { octave_value_list retval; - retval(1) = string (); + retval(1) = std::string (); retval(0) = 0.0; int nargin = args.length (); if (nargin == 0) { - string msg; + std::string msg; retval(0) = mk_gr_map (octave_group::getgrent (msg)); retval(1) = msg; @@ -101,7 +101,7 @@ { octave_value_list retval; - retval(1) = string (); + retval(1) = std::string (); retval(0) = 0.0; int nargin = args.length (); @@ -116,7 +116,7 @@ { gid_t gid = static_cast (dval); - string msg; + std::string msg; retval(0) = mk_gr_map (octave_group::getgrgid (gid, msg)); retval(1) = msg; @@ -141,18 +141,18 @@ { octave_value_list retval; - retval(1) = string (); + retval(1) = std::string (); retval(0) = 0.0; int nargin = args.length (); if (nargin == 1) { - string s = args(0).string_value (); + std::string s = args(0).string_value (); if (! error_state) { - string msg; + std::string msg; retval(0) = mk_gr_map (octave_group::getgrnam (s.c_str (), msg)); retval(1) = msg; @@ -172,14 +172,14 @@ { octave_value_list retval; - retval(1) = string (); + retval(1) = std::string (); retval(0) = -1.0; int nargin = args.length (); if (nargin == 0) { - string msg; + std::string msg; retval(0) = static_cast (octave_group::setgrent (msg)); retval(1) = msg; @@ -198,14 +198,14 @@ { octave_value_list retval; - retval(1) = string (); + retval(1) = std::string (); retval(0) = -1.0; int nargin = args.length (); if (nargin == 0) { - string msg; + std::string msg; retval(0) = static_cast (octave_group::endgrent (msg)); retval(1) = msg; diff --git a/src/DLD-FUNCTIONS/getpwent.cc b/src/DLD-FUNCTIONS/getpwent.cc --- a/src/DLD-FUNCTIONS/getpwent.cc +++ b/src/DLD-FUNCTIONS/getpwent.cc @@ -77,14 +77,14 @@ { octave_value_list retval; - retval(1) = string (); + retval(1) = std::string (); retval(0) = 0.0; int nargin = args.length (); if (nargin == 0) { - string msg; + std::string msg; retval(0) = mk_pw_map (octave_passwd::getpwent (msg)); retval(1) = msg; @@ -105,7 +105,7 @@ { octave_value_list retval; - retval(1) = string (); + retval(1) = std::string (); retval(0) = 0.0; int nargin = args.length (); @@ -120,7 +120,7 @@ { uid_t uid = static_cast (dval); - string msg; + std::string msg; retval(0) = mk_pw_map (octave_passwd::getpwuid (uid, msg)); retval(1) = msg; @@ -145,18 +145,18 @@ { octave_value_list retval; - retval(1) = string (); + retval(1) = std::string (); retval(0) = 0.0; int nargin = args.length (); if (nargin == 1) { - string s = args(0).string_value (); + std::string s = args(0).string_value (); if (! error_state) { - string msg; + std::string msg; retval(0) = mk_pw_map (octave_passwd::getpwnam (s.c_str (), msg)); retval(1) = msg; @@ -176,14 +176,14 @@ { octave_value_list retval; - retval(1) = string (); + retval(1) = std::string (); retval(0) = -1.0; int nargin = args.length (); if (nargin == 0) { - string msg; + std::string msg; retval(0) = static_cast (octave_passwd::setpwent (msg)); retval(1) = msg; @@ -202,14 +202,14 @@ { octave_value_list retval; - retval(1) = string (); + retval(1) = std::string (); retval(0) = -1.0; int nargin = args.length (); if (nargin == 0) { - string msg; + std::string msg; retval(0) = static_cast (octave_passwd::endpwent (msg)); retval(1) = msg; diff --git a/src/DLD-FUNCTIONS/lsode.cc b/src/DLD-FUNCTIONS/lsode.cc --- a/src/DLD-FUNCTIONS/lsode.cc +++ b/src/DLD-FUNCTIONS/lsode.cc @@ -26,7 +26,7 @@ #include -#include +#include #include "LSODE.h" #include "lo-mappers.h" @@ -360,7 +360,7 @@ }; static void -print_lsode_option_list (ostream& os) +print_lsode_option_list (std::ostream& os) { print_usage ("lsode_options", 1); @@ -399,7 +399,7 @@ } static void -set_lsode_option (const string& keyword, double val) +set_lsode_option (const std::string& keyword, double val) { LSODE_OPTIONS *list = lsode_option_table; @@ -429,7 +429,7 @@ } static octave_value_list -show_lsode_option (const string& keyword) +show_lsode_option (const std::string& keyword) { octave_value retval; @@ -488,7 +488,7 @@ } else if (nargin == 1 || nargin == 2) { - string keyword = args(0).string_value (); + std::string keyword = args(0).string_value (); if (! error_state) { diff --git a/src/DLD-FUNCTIONS/quad.cc b/src/DLD-FUNCTIONS/quad.cc --- a/src/DLD-FUNCTIONS/quad.cc +++ b/src/DLD-FUNCTIONS/quad.cc @@ -26,7 +26,7 @@ #include -#include +#include #include "Quad.h" #include "lo-mappers.h" @@ -320,7 +320,7 @@ }; static void -print_quad_option_list (ostream& os) +print_quad_option_list (std::ostream& os) { print_usage ("quad_options", 1); @@ -350,7 +350,7 @@ } static void -set_quad_option (const string& keyword, double val) +set_quad_option (const std::string& keyword, double val) { QUAD_OPTIONS *list = quad_option_table; @@ -370,7 +370,7 @@ } static octave_value_list -show_quad_option (const string& keyword) +show_quad_option (const std::string& keyword) { octave_value retval; @@ -412,7 +412,7 @@ } else if (nargin == 1 || nargin == 2) { - string keyword = args(0).string_value (); + std::string keyword = args(0).string_value (); if (! error_state) { diff --git a/src/DLD-FUNCTIONS/qz.cc b/src/DLD-FUNCTIONS/qz.cc --- a/src/DLD-FUNCTIONS/qz.cc +++ b/src/DLD-FUNCTIONS/qz.cc @@ -30,7 +30,7 @@ #include "config.h" #include -#include +#include #include #include #include @@ -259,7 +259,7 @@ #endif // Determine ordering option - string ord_job; + std::string ord_job; static double safmin; if (nargin == 2) diff --git a/src/DLD-FUNCTIONS/rand.cc b/src/DLD-FUNCTIONS/rand.cc --- a/src/DLD-FUNCTIONS/rand.cc +++ b/src/DLD-FUNCTIONS/rand.cc @@ -165,7 +165,7 @@ if (tmp.is_string ()) { - string s_arg = tmp.string_value (); + std::string s_arg = tmp.string_value (); if (s_arg == "dist") { diff --git a/src/DLD-FUNCTIONS/schur.cc b/src/DLD-FUNCTIONS/schur.cc --- a/src/DLD-FUNCTIONS/schur.cc +++ b/src/DLD-FUNCTIONS/schur.cc @@ -255,7 +255,7 @@ octave_value arg = args(0); - string ord; + std::string ord; if (nargin == 2) { diff --git a/src/DLD-FUNCTIONS/time.cc b/src/DLD-FUNCTIONS/time.cc --- a/src/DLD-FUNCTIONS/time.cc +++ b/src/DLD-FUNCTIONS/time.cc @@ -369,7 +369,7 @@ if (args.length () == 2) { - string fmt = args(0).string_value (); + std::string fmt = args(0).string_value (); if (! error_state) { @@ -407,11 +407,11 @@ if (args.length () == 2) { - string str = args(0).string_value (); + std::string str = args(0).string_value (); if (! error_state) { - string fmt = args(1).string_value (); + std::string fmt = args(1).string_value (); if (! error_state) { diff --git a/src/Map.cc b/src/Map.cc --- a/src/Map.cc +++ b/src/Map.cc @@ -46,7 +46,7 @@ #include "Map.h" static unsigned int -hash (const string& str) +hash (const std::string& str) { unsigned h = 0; for (unsigned i = 0; i < str.length (); i++) @@ -56,7 +56,7 @@ template Pix -Map::seek (const string& item) const +Map::seek (const std::string& item) const { Pix i = 0; @@ -94,14 +94,14 @@ template int -Map::contains (const string& item) const +Map::contains (const std::string& item) const { return seek (item) != 0; } template void -Map::error (const string& msg) const +Map::error (const std::string& msg) const { cerr << "Map: " << msg << "\n"; } @@ -154,7 +154,7 @@ template Pix -CHMap::seek (const string& key) const +CHMap::seek (const std::string& key) const { unsigned int h = hash (key) % size; @@ -167,7 +167,7 @@ template C& -CHMap::operator [] (const string& item) +CHMap::operator [] (const std::string& item) { unsigned int h = hash (item) % size; @@ -184,7 +184,7 @@ template void -CHMap::del (const string& key) +CHMap::del (const std::string& key) { unsigned int h = hash (key) % size; diff --git a/src/Map.h b/src/Map.h --- a/src/Map.h +++ b/src/Map.h @@ -59,25 +59,25 @@ int length (void) const { return count; } // current number of items int empty (void) const { return count == 0; } - virtual int contains (const string& key) const; // is key mapped? + virtual int contains (const std::string& key) const; // is key mapped? virtual void clear (void); // delete all items - virtual C& operator [] (const string& key) = 0; // access contents by key + virtual C& operator [] (const std::string& key) = 0; // access contents by key - virtual void del (const string& key) = 0; // delete entry + virtual void del (const std::string& key) = 0; // delete entry virtual Pix first (void) const = 0; // Pix of first item or 0 virtual void next (Pix& i) const = 0; // advance to next or 0 - virtual string key (Pix i) const = 0; // access key at i + virtual std::string key (Pix i) const = 0; // access key at i virtual C& contents (Pix i) const = 0; // access contents at i virtual int owns (Pix i) const; // is i a valid Pix ? - virtual Pix seek (const string& key) const; // Pix of key + virtual Pix seek (const std::string& key) const; // Pix of key C& dflt (void) { return def; } // access default val - void error (const string& msg) const; + void error (const std::string& msg) const; virtual int OK (void) const = 0; // rep invariant }; @@ -86,12 +86,12 @@ struct CHNode { CHNode *tl; - string hd; + std::string hd; C cont; CHNode (void) : tl (0), hd (), cont () { } - CHNode (const string& h, const C& c, CHNode *t = 0) + CHNode (const std::string& h, const C& c, CHNode *t = 0) : tl (t), hd (h), cont (c) { } ~CHNode (void) { } @@ -119,14 +119,14 @@ delete tab; } - C& operator [] (const string& key); + C& operator [] (const std::string& key); - void del (const string& key); + void del (const std::string& key); Pix first (void) const; void next (Pix& i) const; - string key (Pix p) const + std::string key (Pix p) const { if (p == 0) error ("null Pix"); @@ -142,9 +142,9 @@ return ((CHNode *) p)->cont; } - Pix seek (const string& key) const; + Pix seek (const std::string& key) const; - int contains (const string& key) const + int contains (const std::string& key) const { return seek (key) != 0; } diff --git a/src/OPERATORS/op-fil-b.cc b/src/OPERATORS/op-fil-b.cc --- a/src/OPERATORS/op-fil-b.cc +++ b/src/OPERATORS/op-fil-b.cc @@ -28,7 +28,7 @@ #include #endif -#include +#include #include "mach-info.h" @@ -50,11 +50,11 @@ if (oct_stream) { - ostream *osp = oct_stream.output_stream (); + std::ostream *osp = oct_stream.output_stream (); if (osp) { - ostream& os = *osp; + std::ostream& os = *osp; v2.print_raw (os); } diff --git a/src/OPERATORS/op-fil-bm.cc b/src/OPERATORS/op-fil-bm.cc --- a/src/OPERATORS/op-fil-bm.cc +++ b/src/OPERATORS/op-fil-bm.cc @@ -28,7 +28,7 @@ #include #endif -#include +#include #include "mach-info.h" @@ -50,11 +50,11 @@ if (oct_stream) { - ostream *osp = oct_stream.output_stream (); + std::ostream *osp = oct_stream.output_stream (); if (osp) { - ostream& os = *osp; + std::ostream& os = *osp; v2.print_raw (os); } diff --git a/src/OPERATORS/op-fil-cm.cc b/src/OPERATORS/op-fil-cm.cc --- a/src/OPERATORS/op-fil-cm.cc +++ b/src/OPERATORS/op-fil-cm.cc @@ -28,7 +28,7 @@ #include #endif -#include +#include #include "mach-info.h" @@ -50,11 +50,11 @@ if (oct_stream) { - ostream *osp = oct_stream.output_stream (); + std::ostream *osp = oct_stream.output_stream (); if (osp) { - ostream& os = *osp; + std::ostream& os = *osp; v2.print_raw (os); } diff --git a/src/OPERATORS/op-fil-cs.cc b/src/OPERATORS/op-fil-cs.cc --- a/src/OPERATORS/op-fil-cs.cc +++ b/src/OPERATORS/op-fil-cs.cc @@ -28,7 +28,7 @@ #include #endif -#include +#include #include "mach-info.h" @@ -50,11 +50,11 @@ if (oct_stream) { - ostream *osp = oct_stream.output_stream (); + std::ostream *osp = oct_stream.output_stream (); if (osp) { - ostream& os = *osp; + std::ostream& os = *osp; v2.print_raw (os); } diff --git a/src/OPERATORS/op-fil-lis.cc b/src/OPERATORS/op-fil-lis.cc --- a/src/OPERATORS/op-fil-lis.cc +++ b/src/OPERATORS/op-fil-lis.cc @@ -28,7 +28,7 @@ #include #endif -#include +#include #include "mach-info.h" @@ -50,11 +50,11 @@ if (oct_stream) { - ostream *osp = oct_stream.output_stream (); + std::ostream *osp = oct_stream.output_stream (); if (osp) { - ostream& os = *osp; + std::ostream& os = *osp; v2.print_raw (os); } diff --git a/src/OPERATORS/op-fil-m.cc b/src/OPERATORS/op-fil-m.cc --- a/src/OPERATORS/op-fil-m.cc +++ b/src/OPERATORS/op-fil-m.cc @@ -28,7 +28,7 @@ #include #endif -#include +#include #include "mach-info.h" @@ -50,11 +50,11 @@ if (oct_stream) { - ostream *osp = oct_stream.output_stream (); + std::ostream *osp = oct_stream.output_stream (); if (osp) { - ostream& os = *osp; + std::ostream& os = *osp; v2.print_raw (os); } diff --git a/src/OPERATORS/op-fil-rec.cc b/src/OPERATORS/op-fil-rec.cc --- a/src/OPERATORS/op-fil-rec.cc +++ b/src/OPERATORS/op-fil-rec.cc @@ -28,7 +28,7 @@ #include #endif -#include +#include #include "mach-info.h" @@ -50,11 +50,11 @@ if (oct_stream) { - ostream *osp = oct_stream.output_stream (); + std::ostream *osp = oct_stream.output_stream (); if (osp) { - ostream& os = *osp; + std::ostream& os = *osp; v2.print_raw (os); } diff --git a/src/OPERATORS/op-fil-s.cc b/src/OPERATORS/op-fil-s.cc --- a/src/OPERATORS/op-fil-s.cc +++ b/src/OPERATORS/op-fil-s.cc @@ -28,7 +28,7 @@ #include #endif -#include +#include #include "mach-info.h" @@ -50,11 +50,11 @@ if (oct_stream) { - ostream *osp = oct_stream.output_stream (); + std::ostream *osp = oct_stream.output_stream (); if (osp) { - ostream& os = *osp; + std::ostream& os = *osp; v2.print_raw (os); } diff --git a/src/OPERATORS/op-fil-str.cc b/src/OPERATORS/op-fil-str.cc --- a/src/OPERATORS/op-fil-str.cc +++ b/src/OPERATORS/op-fil-str.cc @@ -28,7 +28,7 @@ #include #endif -#include +#include #include "mach-info.h" @@ -50,11 +50,11 @@ if (oct_stream) { - ostream *osp = oct_stream.output_stream (); + std::ostream *osp = oct_stream.output_stream (); if (osp) { - ostream& os = *osp; + std::ostream& os = *osp; v2.print_raw (os); } diff --git a/src/TEMPLATE-INST/SLStack-str.cc b/src/TEMPLATE-INST/SLStack-str.cc --- a/src/TEMPLATE-INST/SLStack-str.cc +++ b/src/TEMPLATE-INST/SLStack-str.cc @@ -37,12 +37,12 @@ #include -template class SLNode; -template class SLList; +template class SLNode; +template class SLList; -template class Stack; +template class Stack; -template class SLStack; +template class SLStack; /* ;;; Local Variables: *** diff --git a/src/data.cc b/src/data.cc --- a/src/data.cc +++ b/src/data.cc @@ -984,7 +984,7 @@ if (args(0).is_map () && args(1).is_string ()) { - string s = args(1).string_value (); + std::string s = args(1).string_value (); octave_value tmp = args(0).do_struct_elt_index_op (s, true); retval = static_cast (tmp.is_defined ()); } diff --git a/src/defaults.cc b/src/defaults.cc --- a/src/defaults.cc +++ b/src/defaults.cc @@ -51,44 +51,44 @@ #include "variables.h" #include -string Voctave_home; +std::string Voctave_home; -string Vbin_dir; -string Vinfo_dir; -string Vdata_dir; -string Vlibexec_dir; -string Varch_lib_dir; -string Vlocal_arch_lib_dir; -string Vfcn_file_dir; +std::string Vbin_dir; +std::string Vinfo_dir; +std::string Vdata_dir; +std::string Vlibexec_dir; +std::string Varch_lib_dir; +std::string Vlocal_arch_lib_dir; +std::string Vfcn_file_dir; // The path that will be searched for programs that we execute. // (--exec-path path) -string Vexec_path; +std::string Vexec_path; // Load path specified on command line. // (--path path; -p path) -static string Vload_path; +static std::string Vload_path; // The default load path with OCTAVE_HOME appropriately substituted. -static string Vdefault_load_path; +static std::string Vdefault_load_path; // And the cached directory path corresponding to Vload_path. dir_path Vload_path_dir_path; // Name of the editor to be invoked by the edit_history command. -string Veditor; +std::string Veditor; -string Vimagepath; +std::string Vimagepath; -string Vlocal_site_defaults_file; -string Vsite_defaults_file; +std::string Vlocal_site_defaults_file; +std::string Vsite_defaults_file; static string -subst_octave_home (const string& s) +subst_octave_home (const std::string& s) { - string retval; + std::string retval; - string prefix = OCTAVE_PREFIX; + std::string prefix = OCTAVE_PREFIX; retval = s; @@ -109,9 +109,9 @@ static void set_octave_home (void) { - string oh = octave_env::getenv ("OCTAVE_HOME"); + std::string oh = octave_env::getenv ("OCTAVE_HOME"); - Voctave_home = oh.empty () ? string (OCTAVE_PREFIX) : oh; + Voctave_home = oh.empty () ? std::string (OCTAVE_PREFIX) : oh; } static void @@ -159,20 +159,20 @@ static void set_default_exec_path (void) { - string octave_exec_path = octave_env::getenv ("OCTAVE_EXEC_PATH"); + std::string octave_exec_path = octave_env::getenv ("OCTAVE_EXEC_PATH"); if (octave_exec_path.empty ()) { - string shell_path = octave_env::getenv ("PATH"); + std::string shell_path = octave_env::getenv ("PATH"); if (! shell_path.empty ()) { - Vexec_path = string (":"); + Vexec_path = std::string (":"); Vexec_path.append (shell_path); } } else - Vexec_path = string (octave_exec_path); + Vexec_path = std::string (octave_exec_path); } static void @@ -180,9 +180,9 @@ { Vdefault_load_path = subst_octave_home (OCTAVE_FCNFILEPATH); - string oct_path = octave_env::getenv ("OCTAVE_PATH"); + std::string oct_path = octave_env::getenv ("OCTAVE_PATH"); - Vload_path = oct_path.empty () ? string (":") : oct_path; + Vload_path = oct_path.empty () ? std::string (":") : oct_path; Vload_path_dir_path = dir_path (Vload_path, Vdefault_load_path); } @@ -190,9 +190,9 @@ static void set_default_info_file (void) { - string std_info_file = subst_octave_home (OCTAVE_INFOFILE); + std::string std_info_file = subst_octave_home (OCTAVE_INFOFILE); - string oct_info_file = octave_env::getenv ("OCTAVE_INFO_FILE"); + std::string oct_info_file = octave_env::getenv ("OCTAVE_INFO_FILE"); Vinfo_file = oct_info_file.empty () ? std_info_file : oct_info_file; } @@ -200,12 +200,12 @@ static void set_default_info_prog (void) { - string oct_info_prog = octave_env::getenv ("OCTAVE_INFO_PROGRAM"); + std::string oct_info_prog = octave_env::getenv ("OCTAVE_INFO_PROGRAM"); if (oct_info_prog.empty ()) Vinfo_prog = "info"; else - Vinfo_prog = string (oct_info_prog); + Vinfo_prog = std::string (oct_info_prog); } static void @@ -213,7 +213,7 @@ { Veditor = "emacs"; - string env_editor = octave_env::getenv ("EDITOR"); + std::string env_editor = octave_env::getenv ("EDITOR"); if (! env_editor.empty ()) Veditor = env_editor; @@ -234,9 +234,9 @@ } string -maybe_add_default_load_path (const string& pathstring) +maybe_add_default_load_path (const std::string& pathstring) { - string retval; + std::string retval; if (! pathstring.empty ()) { @@ -306,7 +306,7 @@ { int status = 0; - string s = builtin_string_variable ("EDITOR"); + std::string s = builtin_string_variable ("EDITOR"); if (s.empty ()) { @@ -324,7 +324,7 @@ { int status = 0; - string s = builtin_string_variable ("EXEC_PATH"); + std::string s = builtin_string_variable ("EXEC_PATH"); if (s.empty ()) { @@ -335,10 +335,10 @@ { Vexec_path = s; - string std_path = Vlocal_arch_lib_dir + string (SEPCHAR_STR) - + Varch_lib_dir + string (SEPCHAR_STR) + Vbin_dir; + std::string std_path = Vlocal_arch_lib_dir + std::string (SEPCHAR_STR) + + Varch_lib_dir + std::string (SEPCHAR_STR) + Vbin_dir; - string path; + std::string path; int eplen = Vexec_path.length (); @@ -376,7 +376,7 @@ { int status = 0; - string s = builtin_string_variable ("IMAGEPATH"); + std::string s = builtin_string_variable ("IMAGEPATH"); if (s.empty ()) { @@ -394,7 +394,7 @@ { int status = 0; - string s = builtin_string_variable ("LOADPATH"); + std::string s = builtin_string_variable ("LOADPATH"); if (s.empty ()) { diff --git a/src/defun-int.h b/src/defun-int.h --- a/src/defun-int.h +++ b/src/defun-int.h @@ -33,34 +33,34 @@ class octave_value; -extern void print_usage (const string& nm, bool just_usage = false); +extern void print_usage (const std::string& nm, bool just_usage = false); -extern void check_version (const string& version, const string& fcn); +extern void check_version (const std::string& version, const std::string& fcn); extern void install_builtin_mapper (octave_mapper *mf); extern void -install_builtin_function (octave_builtin::fcn f, const string& name, - const string& doc, bool is_text_fcn = false); +install_builtin_function (octave_builtin::fcn f, const std::string& name, + const std::string& doc, bool is_text_fcn = false); extern void -install_builtin_variable (const string& n, const octave_value& v, +install_builtin_variable (const std::string& n, const octave_value& v, bool p, bool e, symbol_record::change_function chg_fcn, - const string& h); + const std::string& h); extern void -install_builtin_constant (const string& n, const octave_value& v, - bool p, const string& h); +install_builtin_constant (const std::string& n, const octave_value& v, + bool p, const std::string& h); extern void -install_dld_function (octave_dld_function::fcn f, const string& name, +install_dld_function (octave_dld_function::fcn f, const std::string& name, const octave_shlib& shl, - const string& doc, bool is_text_fcn = false); + const std::string& doc, bool is_text_fcn = false); extern void -alias_builtin (const string& alias, const string& name); +alias_builtin (const std::string& alias, const std::string& name); #define DECLARE_FUN(name, args_name, nargout_name) \ octave_value_list \ @@ -68,7 +68,7 @@ // Define the code that will be used to insert the new function into // the symbol table. We look for this name instead of the actual -// function so that we can easily install the doc string too. +// function so that we can easily install the doc std::string too. typedef bool (*octave_dld_fcn_installer) (const octave_shlib&); diff --git a/src/defun.cc b/src/defun.cc --- a/src/defun.cc +++ b/src/defun.cc @@ -40,13 +40,13 @@ #include "variables.h" void -print_usage (const string& nm, bool just_usage) +print_usage (const std::string& nm, bool just_usage) { symbol_record *sym_rec = global_sym_tab->lookup (nm); if (sym_rec) { - string h = sym_rec->help (); + std::string h = sym_rec->help (); if (h.length () > 0) { @@ -65,7 +65,7 @@ } void -check_version (const string& version, const string& fcn) +check_version (const std::string& version, const std::string& fcn) { if (version != OCTAVE_VERSION) warning ("incompatible version %s found in function `%s'", @@ -90,8 +90,8 @@ } void -install_builtin_function (octave_builtin::fcn f, const string& name, - const string& doc, bool is_text_fcn) +install_builtin_function (octave_builtin::fcn f, const std::string& name, + const std::string& doc, bool is_text_fcn) { symbol_record *sym_rec = global_sym_tab->lookup (name, true); @@ -108,25 +108,25 @@ } void -install_builtin_constant (const string& name, const octave_value& val, - bool protect, const string& help) +install_builtin_constant (const std::string& name, const octave_value& val, + bool protect, const std::string& help) { bind_builtin_constant (name, val, protect, false, help); } void -install_builtin_variable (const string& name, const octave_value& value, +install_builtin_variable (const std::string& name, const octave_value& value, bool protect, bool eternal, symbol_record::change_function chg_fcn, - const string& doc) + const std::string& doc) { bind_builtin_variable (name, value, protect, eternal, chg_fcn, doc); } void -install_dld_function (octave_dld_function::fcn f, const string& name, +install_dld_function (octave_dld_function::fcn f, const std::string& name, const octave_shlib& shl, - const string& doc, bool is_text_fcn) + const std::string& doc, bool is_text_fcn) { symbol_record *sym_rec = global_sym_tab->lookup (name, true); @@ -143,7 +143,7 @@ } void -alias_builtin (const string& alias, const string& name) +alias_builtin (const std::string& alias, const std::string& name) { symbol_record *sr_name = global_sym_tab->lookup (name); diff --git a/src/defun.h b/src/defun.h --- a/src/defun.h +++ b/src/defun.h @@ -60,7 +60,7 @@ // This one can be used when `name' cannot be used directly (if it is // already defined as a macro). In that case, name is already a -// quoted string, and the name of the structure has to be passed too. +// quoted std::string, and the name of the structure has to be passed too. #define DEFCONSTX(name, sname, defn, doc) \ DEFCONSTX_INTERNAL (name, sname, defn, doc) diff --git a/src/dirfns.cc b/src/dirfns.cc --- a/src/dirfns.cc +++ b/src/dirfns.cc @@ -66,7 +66,7 @@ // this function can be eliminated. static int -octave_change_to_directory (const string& newdir) +octave_change_to_directory (const std::string& newdir) { int cd_ok = octave_env::chdir (newdir); @@ -107,7 +107,7 @@ if (argc > 1) { - string dirname = file_ops::tilde_expand (argv[1]); + std::string dirname = file_ops::tilde_expand (argv[1]); if (dirname.length () > 0 && ! octave_change_to_directory (dirname)) @@ -117,7 +117,7 @@ } else { - string home_dir = octave_env::get_home_directory (); + std::string home_dir = octave_env::get_home_directory (); if (home_dir.empty () || ! octave_change_to_directory (home_dir)) return retval; @@ -163,7 +163,7 @@ if (error_state) return retval; - ostrstream ls_buf; + std::ostrstream ls_buf; ls_buf << "ls -C "; for (int i = 1; i < argc; i++) @@ -220,7 +220,7 @@ { octave_value_list retval; - string directory = octave_env::getcwd (); + std::string directory = octave_env::getcwd (); if (directory.empty ()) warning ("pwd: can't find working directory!"); @@ -248,13 +248,13 @@ { octave_value_list retval; - retval(2) = string (); + retval(2) = std::string (); retval(1) = -1.0; retval(0) = Matrix (); if (args.length () == 1) { - string dirname = args(0).string_value (); + std::string dirname = args(0).string_value (); if (error_state) gripe_wrong_type_arg ("readdir", args(0)); @@ -295,18 +295,18 @@ { octave_value_list retval; - retval(1) = string (); + retval(1) = std::string (); retval(0) = -1.0; if (args.length () == 1) { - string dirname = args(0).string_value (); + std::string dirname = args(0).string_value (); if (error_state) gripe_wrong_type_arg ("mkdir", args(0)); else { - string msg; + std::string msg; int status = file_ops::mkdir (file_ops::tilde_expand (dirname), 0777, msg); @@ -335,18 +335,18 @@ { octave_value_list retval; - retval(1) = string (); + retval(1) = std::string (); retval(0) = -1.0; if (args.length () == 1) { - string dirname = args(0).string_value (); + std::string dirname = args(0).string_value (); if (error_state) gripe_wrong_type_arg ("rmdir", args(0)); else { - string msg; + std::string msg; int status = file_ops::rmdir (file_ops::tilde_expand (dirname), msg); @@ -374,24 +374,24 @@ { octave_value_list retval; - retval(1) = string (); + retval(1) = std::string (); retval(0) = -1.0; if (args.length () == 2) { - string from = args(0).string_value (); + std::string from = args(0).string_value (); if (error_state) gripe_wrong_type_arg ("rename", args(0)); else { - string to = args(1).string_value (); + std::string to = args(1).string_value (); if (error_state) gripe_wrong_type_arg ("rename", args(1)); else { - string msg; + std::string msg; int status = file_ops::rename (from, to, msg); diff --git a/src/dirfns.h b/src/dirfns.h --- a/src/dirfns.h +++ b/src/dirfns.h @@ -27,12 +27,12 @@ #include -extern string polite_directory_format (const string&); -extern string base_pathname (const string&); -extern string make_absolute (const string&, const string&); -extern string get_working_directory (const string&); +extern std::string polite_directory_format (const std::string&); +extern std::string base_pathname (const std::string&); +extern std::string make_absolute (const std::string&, const std::string&); +extern std::string get_working_directory (const std::string&); -extern string Vcurrent_directory; +extern std::string Vcurrent_directory; #endif diff --git a/src/dynamic-ld.cc b/src/dynamic-ld.cc --- a/src/dynamic-ld.cc +++ b/src/dynamic-ld.cc @@ -54,7 +54,7 @@ static void remove (octave_shlib& shl); - static void *search (const string& fcn_name, octave_shlib& shl, + static void *search (const std::string& fcn_name, octave_shlib& shl, octave_shlib::name_mangler mangler = 0); private: @@ -67,7 +67,7 @@ void do_remove (octave_shlib& shl); - void *do_search (const string& fcn_name, octave_shlib& shl, + void *do_search (const std::string& fcn_name, octave_shlib& shl, octave_shlib::name_mangler mangler = 0); static octave_shlib_list *instance; @@ -109,7 +109,7 @@ } void * -octave_shlib_list::do_search (const string& fcn_name, octave_shlib& shl, +octave_shlib_list::do_search (const std::string& fcn_name, octave_shlib& shl, octave_shlib::name_mangler mangler) { void *function = 0; @@ -164,7 +164,7 @@ } void * -octave_shlib_list::search (const string& fcn_name, octave_shlib& shl, +octave_shlib_list::search (const std::string& fcn_name, octave_shlib& shl, octave_shlib::name_mangler mangler) { return (instance_ok ()) ? instance->do_search (fcn_name, shl, mangler) : 0; @@ -193,7 +193,7 @@ } static -void clear_function (const string& fcn_name) +void clear_function (const std::string& fcn_name) { if (Vwarn_reload_forces_clear) warning (" %s", fcn_name.c_str ()); @@ -207,7 +207,7 @@ } bool -octave_dynamic_loader::do_load (const string& fcn_name) +octave_dynamic_loader::do_load (const std::string& fcn_name) { bool retval = false; @@ -239,7 +239,7 @@ if (! function) { - string oct_file_name = oct_file_in_path (fcn_name); + std::string oct_file_name = oct_file_in_path (fcn_name); if (! oct_file_name.empty ()) { @@ -278,7 +278,7 @@ } bool -octave_dynamic_loader::do_remove (const string& fcn_name, octave_shlib& shl) +octave_dynamic_loader::do_remove (const std::string& fcn_name, octave_shlib& shl) { bool retval = false; @@ -297,24 +297,24 @@ } bool -octave_dynamic_loader::load (const string& fcn_name) +octave_dynamic_loader::load (const std::string& fcn_name) { return (instance_ok ()) ? instance->do_load (fcn_name) : false; } bool -octave_dynamic_loader::remove (const string& fcn_name, octave_shlib& shl) +octave_dynamic_loader::remove (const std::string& fcn_name, octave_shlib& shl) { return (instance_ok ()) ? instance->do_remove (fcn_name, shl) : false; } string -octave_dynamic_loader::mangle_name (const string& name) +octave_dynamic_loader::mangle_name (const std::string& name) { #if defined (CXX_PREPENDS_UNDERSCORE) - string retval ("_FS"); + std::string retval ("_FS"); #else - string retval ("FS"); + std::string retval ("FS"); #endif retval.append (name); retval.append ("__FRC12octave_shlib"); diff --git a/src/dynamic-ld.h b/src/dynamic-ld.h --- a/src/dynamic-ld.h +++ b/src/dynamic-ld.h @@ -38,9 +38,9 @@ virtual ~octave_dynamic_loader (void) { } - static bool load (const string& fcn_name); + static bool load (const std::string& fcn_name); - static bool remove (const string& fcn_name, octave_shlib& shl); + static bool remove (const std::string& fcn_name, octave_shlib& shl); private: @@ -54,15 +54,15 @@ static bool instance_ok (void); - bool do_load (const string& fcn_name); + bool do_load (const std::string& fcn_name); - bool do_remove (const string& fcn_name, octave_shlib& shl); + bool do_remove (const std::string& fcn_name, octave_shlib& shl); static bool doing_load; protected: - static string mangle_name (const string& name); + static std::string mangle_name (const std::string& name); }; #endif diff --git a/src/error.cc b/src/error.cc --- a/src/error.cc +++ b/src/error.cc @@ -54,7 +54,7 @@ bool buffer_error_messages = false; // The message buffer -ostrstream *error_message_buffer = 0; +std::ostrstream *error_message_buffer = 0; // Warning messages are never buffered. // XXX FIXME XXX -- we should provide another way to turn them off... @@ -64,7 +64,7 @@ { flush_octave_stdout (); - ostrstream output_buf; + std::ostrstream output_buf; if (name) { @@ -86,7 +86,7 @@ bool to_beep_or_not_to_beep_p = Vbeep_on_error && ! error_state; - ostrstream output_buf; + std::ostrstream output_buf; if (to_beep_or_not_to_beep_p) output_buf << "\a"; @@ -240,7 +240,7 @@ { octave_value_list retval; - string tstr; + std::string tstr; int nargin = args.length (); diff --git a/src/error.h b/src/error.h --- a/src/error.h +++ b/src/error.h @@ -48,7 +48,7 @@ extern bool buffer_error_messages; // The message buffer -extern ostrstream *error_message_buffer; +extern std::ostrstream *error_message_buffer; #endif diff --git a/src/file-io.cc b/src/file-io.cc --- a/src/file-io.cc +++ b/src/file-io.cc @@ -95,7 +95,7 @@ } static int -fopen_mode_to_ios_mode (const string& mode) +fopen_mode_to_ios_mode (const std::string& mode) { int retval = 0; @@ -241,7 +241,7 @@ bool err = false; - string tmp = os.getl (len_arg, err); + std::string tmp = os.getl (len_arg, err); if (! err) { @@ -287,7 +287,7 @@ bool err = false; - string tmp = os.gets (len_arg, err); + std::string tmp = os.gets (len_arg, err); if (! err) { @@ -303,8 +303,8 @@ } static octave_stream -do_stream_open (const string& name, const string& mode, - const string& arch, int& fid) +do_stream_open (const std::string& name, const std::string& mode, + const std::string& arch, int& fid) { octave_stream retval; @@ -332,15 +332,15 @@ fid = -1; - string name = tc_name.string_value (); + std::string name = tc_name.string_value (); if (! error_state) { - string mode = tc_mode.string_value (); + std::string mode = tc_mode.string_value (); if (! error_state) { - string arch = tc_arch.string_value (); + std::string arch = tc_arch.string_value (); if (! error_state) retval = do_stream_open (name, mode, arch, fid); @@ -658,7 +658,7 @@ { if (args(fmt_n).is_string ()) { - string fmt = args(fmt_n).string_value (); + std::string fmt = args(fmt_n).string_value (); octave_value_list tmp_args; @@ -733,7 +733,7 @@ { if (args(0).is_string ()) { - string fmt = args(0).string_value (); + std::string fmt = args(0).string_value (); octave_value_list tmp_args; @@ -816,7 +816,7 @@ { if (args(1).is_string ()) { - string fmt = args(1).string_value (); + std::string fmt = args(1).string_value (); retval = os.oscanf (fmt); } @@ -837,7 +837,7 @@ { if (args(1).is_string ()) { - string fmt = args(1).string_value (); + std::string fmt = args(1).string_value (); int count = 0; @@ -880,7 +880,7 @@ { if (args(0).is_string ()) { - string data = args(0).string_value (); + std::string data = args(0).string_value (); octave_stream os = octave_istrstream::create (data); @@ -888,7 +888,7 @@ { if (args(1).is_string ()) { - string fmt = args(1).string_value (); + std::string fmt = args(1).string_value (); retval = os.oscanf (fmt); } @@ -912,7 +912,7 @@ if (args(0).is_string ()) { - string data = args(0).string_value (); + std::string data = args(0).string_value (); octave_stream os = octave_istrstream::create (data); @@ -920,7 +920,7 @@ { if (args(1).is_string ()) { - string fmt = args(1).string_value (); + std::string fmt = args(1).string_value (); int count = 0; @@ -932,7 +932,7 @@ // XXX FIXME XXX -- is this the right thing to do? // Extract error message first, because getting // position will clear it. - string errmsg = os.error (); + std::string errmsg = os.error (); retval(3) = static_cast (os.tell () + 1); retval(2) = errmsg; @@ -989,7 +989,7 @@ if (! error_state) { - string prec = prec_arg.string_value (); + std::string prec = prec_arg.string_value (); if (! error_state) { @@ -1002,7 +1002,7 @@ if (! error_state) { - string arch = arch_arg.string_value (); + std::string arch = arch_arg.string_value (); if (! error_state) { @@ -1202,7 +1202,7 @@ { int retval = -1; - string prec = prec_arg.string_value (); + std::string prec = prec_arg.string_value (); if (! error_state) { @@ -1215,7 +1215,7 @@ if (! error_state) { - string arch = arch_arg.string_value (); + std::string arch = arch_arg.string_value (); if (! error_state) { @@ -1338,7 +1338,7 @@ if (nargin == 2) { - string opt = args(1).string_value (); + std::string opt = args(1).string_value (); if (! error_state) clear = (opt == "clear"); @@ -1348,7 +1348,7 @@ int error_number = 0; - string error_message = os.error (clear, error_number); + std::string error_message = os.error (clear, error_number); retval(1) = static_cast (error_number); retval(0) = error_message; @@ -1399,11 +1399,11 @@ if (nargin == 2) { - string name = args(0).string_value (); + std::string name = args(0).string_value (); if (! error_state) { - string mode = args(1).string_value (); + std::string mode = args(1).string_value (); if (! error_state) { @@ -1470,8 +1470,8 @@ if (len < 3) { - string dir = len > 0 ? args(0).string_value () : string (); - string pfx = len > 1 ? args(1).string_value () : string ("oct-"); + std::string dir = len > 0 ? args(0).string_value () : std::string (); + std::string pfx = len > 1 ? args(1).string_value () : std::string ("oct-"); if (! error_state) retval = file_ops::tempnam (dir, pfx); diff --git a/src/fn-cache.cc b/src/fn-cache.cc --- a/src/fn-cache.cc +++ b/src/fn-cache.cc @@ -44,7 +44,7 @@ // we don't delete any old ones. bool -octave_fcn_file_name_cache::update (const string& path) +octave_fcn_file_name_cache::update (const std::string& path) { bool something_changed = false; @@ -56,7 +56,7 @@ for (int i = 0; i < len; i++) { - string d = dirs[i]; + std::string d = dirs[i]; if (cache.contains (d)) { @@ -74,7 +74,7 @@ } string_vector -octave_fcn_file_name_cache::list (const string& path, bool no_suffix) +octave_fcn_file_name_cache::list (const std::string& path, bool no_suffix) { string_vector retval; @@ -93,7 +93,7 @@ // updated, then return the list of names in the cache. string_vector -octave_fcn_file_name_cache::do_list (const string& path, bool no_suffix) +octave_fcn_file_name_cache::do_list (const std::string& path, bool no_suffix) { update (path); @@ -121,7 +121,7 @@ { for (int i = 0; i < ndirs; i++) { - string d = dirs[i]; + std::string d = dirs[i]; total_len += cache[d].length (); } @@ -133,7 +133,7 @@ for (int j = 0; j < ndirs; j++) { - string d = dirs[j]; + std::string d = dirs[j]; file_name_cache_elt elt = cache[d]; @@ -153,7 +153,7 @@ } else if (ndirs == 1) { - string d = dirs[0]; + std::string d = dirs[0]; file_name_cache_elt elt = cache[d]; @@ -168,7 +168,7 @@ // TRUE if the cache element was out of date. bool -file_name_cache_elt::update (const string& dir_name) +file_name_cache_elt::update (const std::string& dir_name) { bool retval = false; @@ -200,7 +200,7 @@ int i; for (i = 0; i < max_len; i++) { - string entry = tmp[i]; + std::string entry = tmp[i]; int len = entry.length (); @@ -218,8 +218,8 @@ fcn_file_names[k] = entry; fcn_file_names_no_suffix[k] = (entry[len-1] == 'm') - ? string (entry, 0, len-2) - : string (entry, 0, len-4); + ? std::string (entry, 0, len-2) + : std::string (entry, 0, len-4); k++; } diff --git a/src/fn-cache.h b/src/fn-cache.h --- a/src/fn-cache.h +++ b/src/fn-cache.h @@ -42,9 +42,9 @@ file_name_cache_elt (void) : timestamp (static_cast (0)), fcn_file_names (), fcn_file_names_no_suffix () - { update (string ()); } + { update (std::string ()); } - file_name_cache_elt (const string& dir_name) + file_name_cache_elt (const std::string& dir_name) : timestamp (static_cast (0)), fcn_file_names (), fcn_file_names_no_suffix () { update (dir_name); } @@ -71,7 +71,7 @@ int length (void) { return fcn_file_names.length (); } - bool update (const string& dir_name); + bool update (const std::string& dir_name); // The time we last read this directory. octave_time timestamp; @@ -91,23 +91,23 @@ octave_fcn_file_name_cache (void) : cache (file_name_cache_elt ()) - { update (string ()); } + { update (std::string ()); } public: ~octave_fcn_file_name_cache (void) { } - bool update (const string& path); + bool update (const std::string& path); static string_vector list (bool no_suffix = false) - { return list (string (), no_suffix); } + { return list (std::string (), no_suffix); } - static string_vector list (const string& path, bool no_suffix = false); + static string_vector list (const std::string& path, bool no_suffix = false); static string_vector list_no_suffix (void) { return list (true); } - static string_vector list_no_suffix (const string& path) + static string_vector list_no_suffix (const std::string& path) { return list (path, true); } private: @@ -118,7 +118,7 @@ // and the corresponding cache elements. CHMap cache; - string_vector do_list (const string& path, bool no_suffix); + string_vector do_list (const std::string& path, bool no_suffix); }; #endif diff --git a/src/gripes.cc b/src/gripes.cc --- a/src/gripes.cc +++ b/src/gripes.cc @@ -37,7 +37,7 @@ void gripe_string_invalid (void) { - error ("string constant used in invalid context"); + error ("std::string constant used in invalid context"); } void @@ -87,7 +87,7 @@ } void -gripe_invalid_conversion (const string& from, const string& to) +gripe_invalid_conversion (const std::string& from, const std::string& to) { error ("invalid conversion from %s to %s", from.c_str (), to.c_str ()); } @@ -123,7 +123,7 @@ } void -gripe_wrong_type_arg (const char *name, const string& s, bool is_error) +gripe_wrong_type_arg (const char *name, const std::string& s, bool is_error) { if (is_error) error ("%s: wrong type argument `%s'", name, s.c_str ()); @@ -135,7 +135,7 @@ gripe_wrong_type_arg (const char *name, const octave_value& tc, bool is_error) { - string type = tc.type_name (); + std::string type = tc.type_name (); if (is_error) error ("%s: wrong type argument `%s'", name, type.c_str ()); @@ -146,14 +146,14 @@ void gripe_wrong_type_arg_for_unary_op (const octave_value& op) { - string type = op.type_name (); + std::string type = op.type_name (); error ("invalid operand `%s' for unary operator", type.c_str ()); } void gripe_wrong_type_arg_for_binary_op (const octave_value& op) { - string type = op.type_name (); + std::string type = op.type_name (); error ("invalid operand `%s' for binary operator", type.c_str ()); } diff --git a/src/gripes.h b/src/gripes.h --- a/src/gripes.h +++ b/src/gripes.h @@ -55,7 +55,7 @@ gripe_user_returned_invalid (const char *name); extern void -gripe_invalid_conversion (const string& from, const string& to); +gripe_invalid_conversion (const std::string& from, const std::string& to); extern void gripe_invalid_value_specified (const char *name); @@ -73,7 +73,7 @@ gripe_data_conversion (const char *from, const char *to); extern void -gripe_wrong_type_arg (const char *name, const string& s, +gripe_wrong_type_arg (const char *name, const std::string& s, bool is_error = true); extern void diff --git a/src/help.cc b/src/help.cc --- a/src/help.cc +++ b/src/help.cc @@ -70,11 +70,11 @@ // Name of the info file specified on command line. // (--info-file file) -string Vinfo_file; +std::string Vinfo_file; // Name of the info reader we'd like to use. // (--info-program program) -string Vinfo_prog; +std::string Vinfo_prog; // If TRUE, don't print additional help message in help and usage // functions. @@ -387,7 +387,7 @@ } void -additional_help_message (ostream& os) +additional_help_message (std::ostream& os) { if (! Vsuppress_verbose_help_message) os << "\n\ @@ -404,7 +404,7 @@ // symbol table stuff. static void -display_names_from_help_list (ostream& os, help_list *list, +display_names_from_help_list (std::ostream& os, help_list *list, const char *desc) { string_vector symbols = names (list); @@ -420,8 +420,8 @@ } static void -display_symtab_names (ostream& os, const string_vector& names, - const string& desc) +display_symtab_names (std::ostream& os, const string_vector& names, + const std::string& desc) { if (! names.empty ()) { @@ -483,7 +483,7 @@ if (! names.empty ()) { - string dir + std::string dir = octave_env::make_absolute (dirs[i], octave_env::getcwd ()); octave_stdout << "\n*** function files in " << dir << ":\n\n"; @@ -496,7 +496,7 @@ } static int -try_info (const string& nm) +try_info (const std::string& nm) { int status = 0; @@ -505,11 +505,11 @@ delete [] cmd_str; cmd_str = 0; - ostrstream cmd_buf; + std::ostrstream cmd_buf; cmd_buf << Vinfo_prog << " --file " << Vinfo_file; - string directory_name = Vinfo_file; + std::string directory_name = Vinfo_file; size_t pos = directory_name.rfind ('/'); if (pos != NPOS) @@ -544,7 +544,7 @@ help_from_info (const string_vector& argv, int idx, int argc) { if (idx == argc) - try_info (string ()); + try_info (std::string ()); else { for (int i = idx; i < argc; i++) @@ -570,11 +570,11 @@ } static bool -looks_like_texinfo (const string& msg, size_t& p1) +looks_like_texinfo (const std::string& msg, size_t& p1) { p1 = msg.find ('\n'); - string t = msg.substr (0, p1); + std::string t = msg.substr (0, p1); if (p1 == NPOS) p1 = 0; @@ -585,7 +585,7 @@ } void -display_help_text (ostream& os, const string& msg) +display_help_text (std::ostream& os, const std::string& msg) { // Look for "-*- texinfo -*-" in first line of help message. If it // is present, use makeinfo to format the rest of the message before @@ -596,7 +596,7 @@ if (looks_like_texinfo (msg, pos)) { - string tmp_file_name = file_ops::tempnam ("", ""); + std::string tmp_file_name = file_ops::tempnam ("", ""); int cols = command_editor::terminal_cols (); @@ -609,7 +609,7 @@ if (cols > 80) cols = 72; - ostrstream buf; + std::ostrstream buf; buf << "sed -e 's/^[#%]+ *//' -e 's/^ *@/@/' | makeinfo" << " -D \"VERSION " << OCTAVE_VERSION << "\"" << " -D \"OCTAVEHOME " << OCTAVE_PREFIX << "\"" @@ -641,7 +641,7 @@ filter.close (); - ifstream tmp_file (tmp_file_name.c_str ()); + std::ifstream tmp_file (tmp_file_name.c_str ()); int c; while ((c = tmp_file.get ()) != EOF) @@ -659,8 +659,8 @@ } static bool -help_from_list (ostream& os, const help_list *list, - const string& nm, int usage) +help_from_list (std::ostream& os, const help_list *list, + const std::string& nm, int usage) { const char *name; @@ -688,7 +688,7 @@ } static bool -help_from_symbol_table (ostream& os, const string& nm) +help_from_symbol_table (std::ostream& os, const std::string& nm) { bool retval = false; @@ -696,7 +696,7 @@ if (sym_rec && sym_rec->is_defined ()) { - string h = sym_rec->help (); + std::string h = sym_rec->help (); if (h.length () > 0) { @@ -712,13 +712,13 @@ } static bool -help_from_file (ostream& os, const string& nm) +help_from_file (std::ostream& os, const std::string& nm) { bool retval = false; - string path = fcn_file_in_path (nm); + std::string path = fcn_file_in_path (nm); - string h = get_help_from_file (path); + std::string h = get_help_from_file (path); if (! h.empty ()) { @@ -800,7 +800,7 @@ } static void -do_type (ostream& os, const string& name, bool pr_type_info, +do_type (std::ostream& os, const std::string& name, bool pr_type_info, bool quiet, bool pr_orig_txt) { symbol_record *sym_rec = lookup_by_name (name, 0); @@ -809,11 +809,11 @@ sym_rec->type (os, pr_type_info, quiet, pr_orig_txt); else { - string ff = fcn_file_in_path (name); + std::string ff = fcn_file_in_path (name); if (! ff.empty ()) { - ifstream fs (ff.c_str (), ios::in); + std::ifstream fs (ff.c_str (), ios::in); if (fs) { @@ -882,11 +882,11 @@ if (idx < argc) { - ostrstream output_buf; + std::ostrstream output_buf; for (int i = idx; i < argc; i++) { - string id = argv[i]; + std::string id = argv[i]; if (nargout == 0) do_type (octave_stdout, id, true, quiet, pr_orig_txt); @@ -921,9 +921,9 @@ } static string -do_which (const string& name) +do_which (const std::string& name) { - string retval; + std::string retval; symbol_record *sym_rec = lookup_by_name (name, 0); @@ -931,7 +931,7 @@ retval = sym_rec->which (); else { - string path = fcn_file_in_path (name); + std::string path = fcn_file_in_path (name); if (! path.empty ()) retval = path; @@ -943,7 +943,7 @@ } static void -do_which (ostream& os, const string& name) +do_which (std::ostream& os, const std::string& name) { symbol_record *sym_rec = lookup_by_name (name, 0); @@ -951,7 +951,7 @@ sym_rec->which (os); else { - string path = fcn_file_in_path (name); + std::string path = fcn_file_in_path (name); if (! path.empty ()) os << "which: `" << name << "' is the script file\n" @@ -983,7 +983,7 @@ { for (int i = 1; i < argc; i++) { - string id = argv[i]; + std::string id = argv[i]; if (nargout == 0) do_which (octave_stdout, id); @@ -1003,7 +1003,7 @@ { int status = 0; - string s = builtin_string_variable ("INFO_FILE"); + std::string s = builtin_string_variable ("INFO_FILE"); if (s.empty ()) { @@ -1021,7 +1021,7 @@ { int status = 0; - string s = builtin_string_variable ("INFO_PROGRAM"); + std::string s = builtin_string_variable ("INFO_PROGRAM"); if (s.empty ()) { diff --git a/src/help.h b/src/help.h --- a/src/help.h +++ b/src/help.h @@ -30,17 +30,17 @@ extern string_vector make_name_list (void); -extern void display_help_text (ostream&, const string&); +extern void display_help_text (std::ostream&, const std::string&); -extern void additional_help_message (ostream&); +extern void additional_help_message (std::ostream&); // Name of the info file specified on command line. // (--info-file file) -extern string Vinfo_file; +extern std::string Vinfo_file; // Name of the info reader we'd like to use. // (--info-program program) -extern string Vinfo_prog; +extern std::string Vinfo_prog; #endif diff --git a/src/input.cc b/src/input.cc --- a/src/input.cc +++ b/src/input.cc @@ -68,13 +68,13 @@ #include "variables.h" // Primary prompt string. -static string Vps1; +static std::string Vps1; // Secondary prompt string. -static string Vps2; +static std::string Vps2; // String printed before echoed input (enabled by --echo-input). -string Vps4; +std::string Vps4; // Echo commands as they are executed? // @@ -92,7 +92,7 @@ static char Vcompletion_append_char; // Global pointer for eval(). -string current_eval_string; +std::string current_eval_string; // TRUE means get input from current_eval_string. bool get_input_from_eval_string = false; @@ -101,10 +101,10 @@ bool reading_fcn_file = false; // Simple name of function file we are reading. -string curr_fcn_file_name; +std::string curr_fcn_file_name; // Full name of file we are reading. -string curr_fcn_file_full_name; +std::string curr_fcn_file_full_name; // TRUE means we're parsing a script file. bool reading_script_file = false; @@ -122,13 +122,13 @@ int promptflag = 1; // The current line of input, from wherever. -string current_input_line; +std::string current_input_line; // TRUE after a call to completion_matches(). bool octave_completion_matches_called = false; static void -do_input_echo (const string& input_string) +do_input_echo (const std::string& input_string) { int do_echo = reading_script_file ? (Vecho_executing_commands & ECHO_SCRIPTS) @@ -157,9 +157,9 @@ } string -gnu_readline (const string& s, bool force_readline) +gnu_readline (const std::string& s, bool force_readline) { - string retval; + std::string retval; if (line_editing || force_readline) { @@ -194,16 +194,16 @@ static string octave_gets (void) { - string retval; + std::string retval; Vlast_prompt_time.stamp (); if ((interactive || forced_interactive) && (! (reading_fcn_file || reading_script_file))) { - string ps = (promptflag > 0) ? Vps1 : Vps2; + std::string ps = (promptflag > 0) ? Vps1 : Vps2; - string prompt = command_editor::decode_prompt_string (ps); + std::string prompt = command_editor::decode_prompt_string (ps); pipe_handler_error_count = 0; @@ -244,7 +244,7 @@ static string get_user_input (void) { - string retval; + std::string retval; if (get_input_from_eval_string) { @@ -271,7 +271,7 @@ { // XXX FIXME XXX -- is this a safe way to buffer the input? - static string input_buf; + static std::string input_buf; static const char *pos = 0; static size_t chars_left = 0; @@ -338,7 +338,7 @@ // warning if the file doesn't exist. FILE * -get_input_from_file (const string& name, int warn) +get_input_from_file (const std::string& name, int warn) { FILE *instream = 0; @@ -370,8 +370,8 @@ // XXX FIXME XXX -- make this generate file names when appropriate. static string_vector -generate_possible_completions (const string& text, string& prefix, - string& hint) +generate_possible_completions (const std::string& text, std::string& prefix, + std::string& hint) { string_vector names; @@ -390,12 +390,12 @@ } static string -generate_completion (const string& text, int state) +generate_completion (const std::string& text, int state) { - string retval; + std::string retval; - static string prefix; - static string hint; + static std::string prefix; + static std::string hint; static size_t prefix_len = 0; static size_t hint_len = 0; @@ -433,7 +433,7 @@ { while (list_index < name_list_len) { - string name = name_list[list_index]; + std::string name = name_list[list_index]; list_index++; @@ -472,7 +472,7 @@ } static bool -match_sans_spaces (const string& standard, const string& test) +match_sans_spaces (const std::string& standard, const std::string& test) { size_t beg = test.find_first_not_of (" \t"); @@ -502,7 +502,7 @@ if (nargin == 2) read_as_string++; - string prompt ("debug> "); + std::string prompt ("debug> "); if (nargin > 0) { @@ -519,7 +519,7 @@ flush_octave_stdout (); - string input_buf = gnu_readline (prompt.c_str (), true); + std::string input_buf = gnu_readline (prompt.c_str (), true); if (! input_buf.empty ()) { @@ -737,7 +737,7 @@ case 2: { - string arg = argv[1]; + std::string arg = argv[1]; if (arg == "on") bind_builtin_variable ("echo_executing_commands", @@ -752,7 +752,7 @@ case 3: { - string arg = argv[1]; + std::string arg = argv[1]; if (arg == "on" && argv[2] == "all") { @@ -793,7 +793,7 @@ if (nargin == 1) { - string hint = args(0).string_value (); + std::string hint = args(0).string_value (); if (! error_state) { @@ -805,7 +805,7 @@ for (;;) { - string cmd = generate_completion (hint, k); + std::string cmd = generate_completion (hint, k); if (! cmd.empty ()) { @@ -868,7 +868,7 @@ command_editor::read_init_file (); else if (nargin == 1) { - string file = file_ops::tilde_expand (args(0).string_value ()); + std::string file = file_ops::tilde_expand (args(0).string_value ()); if (! error_state) command_editor::read_init_file (file); @@ -879,7 +879,7 @@ return retval; } -static string hook_fcn; +static std::string hook_fcn; static octave_value user_data; static void @@ -917,7 +917,7 @@ { octave_value tmp_user_data; - string tmp_hook_fcn; + std::string tmp_hook_fcn; if (nargin > 1) tmp_user_data = args(1); @@ -983,7 +983,7 @@ { int status = 0; - string s = builtin_string_variable ("completion_append_char"); + std::string s = builtin_string_variable ("completion_append_char"); switch (s.length ()) { diff --git a/src/input.h b/src/input.h --- a/src/input.h +++ b/src/input.h @@ -32,11 +32,11 @@ #include "oct-time.h" extern int octave_read (char *buf, unsigned max_size); -extern FILE *get_input_from_file (const string& name, int warn = 1); +extern FILE *get_input_from_file (const std::string& name, int warn = 1); extern FILE *get_input_from_stdin (void); // Global pointer for eval(). -extern string current_eval_string; +extern std::string current_eval_string; // TRUE means get input from current_eval_string. extern bool get_input_from_eval_string; @@ -45,10 +45,10 @@ extern bool reading_fcn_file; // Simple name of function file we are reading. -extern string curr_fcn_file_name; +extern std::string curr_fcn_file_name; // Full name of file we are reading. -extern string curr_fcn_file_full_name; +extern std::string curr_fcn_file_full_name; // TRUE means we're parsing a script file. extern bool reading_script_file; @@ -66,16 +66,16 @@ extern int promptflag; // A line of input. -extern string current_input_line; +extern std::string current_input_line; // TRUE after a call to completion_matches(). extern bool octave_completion_matches_called; -extern string gnu_readline (const string& s, bool force_readline = false); +extern std::string gnu_readline (const std::string& s, bool force_readline = false); extern void initialize_command_input (void); -extern string Vps4; +extern std::string Vps4; enum echo_state { diff --git a/src/lex.l b/src/lex.l --- a/src/lex.l +++ b/src/lex.l @@ -171,20 +171,20 @@ static void fixup_column_count (char *s); static void do_comma_insert_check (void); -static int is_plot_keyword (const string& s); -static int is_keyword (const string& s); -static string plot_style_token (const string& s); -static symbol_record *lookup_identifier (const string& s); +static int is_plot_keyword (const std::string& s); +static int is_keyword (const std::string& s); +static std::string plot_style_token (const std::string& s); +static symbol_record *lookup_identifier (const std::string& s); static void grab_help_text (void); static bool match_any (char c, const char *s); static bool next_token_is_sep_op (void); static bool next_token_is_bin_op (bool spc_prev); static bool next_token_is_postfix_unary_op (bool spc_prev); -static string strip_trailing_whitespace (char *s); +static std::string strip_trailing_whitespace (char *s); static void handle_number (void); static int handle_string (char delim, int text_style = 0); static int handle_close_bracket (int spc_gobbled); -static int handle_identifier (const string& tok, int spc_gobbled); +static int handle_identifier (const std::string& tok, int spc_gobbled); static bool have_continuation (bool trailing_comments_ok = true); static bool have_ellipsis_continuation (bool trailing_comments_ok = true); static yum_yum eat_whitespace (void); @@ -250,7 +250,7 @@ } [^ \t\n\;\,\"\'][^ \t\n\;\,]*{S}* { - string tok = strip_trailing_whitespace (yytext); + std::string tok = strip_trailing_whitespace (yytext); TOK_PUSH_AND_RETURN (tok, TEXT); } @@ -488,7 +488,7 @@ %} {IDENT}{S}* { - string tok = strip_trailing_whitespace (yytext); + std::string tok = strip_trailing_whitespace (yytext); int c = yytext[yyleng-1]; int cont_is_spc = eat_continuation (); int spc_gobbled = (cont_is_spc || c == ' ' || c == '\t'); @@ -851,9 +851,9 @@ // styles for plots. static string -plot_style_token (const string& s) +plot_style_token (const std::string& s) { - string retval; + std::string retval; static const char *plot_styles[] = { @@ -897,9 +897,9 @@ // tags for plots. static string -plot_axes_token (const string& s) +plot_axes_token (const std::string& s) { - string retval; + std::string retval; static char *plot_axes[] = { @@ -931,7 +931,7 @@ // to abbreviate actual gnuplot keywords). static int -is_plot_keyword (const string& s) +is_plot_keyword (const std::string& s) { const char *t = s.c_str (); if (almost_match ("title", t)) @@ -966,13 +966,13 @@ // Handle keywords. static int -is_keyword (const string& s) +is_keyword (const std::string& s) { if (lexer_flags.plotting) { if (lexer_flags.in_plot_style) { - string sty = plot_style_token (s); + std::string sty = plot_style_token (s); if (! sty.empty ()) { @@ -984,7 +984,7 @@ } else if (lexer_flags.in_plot_axes) { - string axes = plot_axes_token (s); + std::string axes = plot_axes_token (s); if (! axes.empty ()) { @@ -1150,13 +1150,13 @@ // variables occurs when expressions are evaluated. static symbol_record * -lookup_identifier (const string& name) +lookup_identifier (const std::string& name) { return curr_sym_tab->lookup (name, true); } static bool -is_variable (const string& name) +is_variable (const std::string& name) { symbol_record *sr = curr_sym_tab->lookup (name); @@ -1164,7 +1164,7 @@ } static void -force_local_variable (const string& name) +force_local_variable (const std::string& name) { symbol_record *sr = curr_sym_tab->lookup (name, true); @@ -1447,7 +1447,7 @@ static string strip_trailing_whitespace (char *s) { - string retval = s; + std::string retval = s; size_t pos = retval.find_first_of (" \t"); @@ -1592,7 +1592,7 @@ static bool have_continuation (bool trailing_comments_ok) { - ostrstream buf; + std::ostrstream buf; bool in_comment = false; int c; @@ -1701,7 +1701,7 @@ static int handle_string (char delim, int text_style) { - ostrstream buf; + std::ostrstream buf; int c; int escape_pending = 0; @@ -1753,12 +1753,12 @@ unput (c); buf << ends; char *t = buf.str (); - string s = do_string_escapes (t); + std::string s = do_string_escapes (t); delete [] t; if (text_style && lexer_flags.doing_set) { - s = string (1, delim) + s + string (1, delim); + s = std::string (1, delim) + s + std::string (1, delim); } else { @@ -1977,7 +1977,7 @@ // an identifier. Handles keywords. static int -handle_identifier (const string& tok, int spc_gobbled) +handle_identifier (const std::string& tok, int spc_gobbled) { // It is almost always an error for an identifier to be followed // directly by another identifier. Special cases are handled @@ -2233,7 +2233,7 @@ static void maybe_warn_separator_insert (char sep) { - string nm = curr_fcn_file_full_name; + std::string nm = curr_fcn_file_full_name; if (Vwarn_separator_insert) { @@ -2249,7 +2249,7 @@ static void gripe_single_quote_string (void) { - string nm = curr_fcn_file_full_name; + std::string nm = curr_fcn_file_full_name; if (Vwarn_single_quote_string) { @@ -2283,7 +2283,7 @@ { int pref = 0; - string val = builtin_string_variable ("whitespace_in_literal_matrix"); + std::string val = builtin_string_variable ("whitespace_in_literal_matrix"); if (! val.empty ()) { diff --git a/src/load-save.cc b/src/load-save.cc --- a/src/load-save.cc +++ b/src/load-save.cc @@ -63,7 +63,7 @@ // The default output format. May be one of "binary", "text", or // "mat-binary". -static string Vdefault_save_format; +static std::string Vdefault_save_format; // The number of decimal digits to use when writing ascii data. static int Vsave_precision; @@ -99,7 +99,7 @@ } static bool -valid_identifier (const string& s) +valid_identifier (const std::string& s) { return valid_identifier (s.c_str ()); } @@ -248,7 +248,7 @@ // Skip white space and comments on stream IS. static void -skip_comments (istream& is) +skip_comments (std::istream& is) { char c = '\0'; while (is.get (c)) @@ -277,7 +277,7 @@ // #[ \t]*keyword[ \t]*:[ \t]*string-value[ \t]*\n static char * -extract_keyword (istream& is, const char *keyword) +extract_keyword (std::istream& is, const char *keyword) { char *retval = 0; @@ -286,7 +286,7 @@ { if (c == '#') { - ostrstream buf; + std::ostrstream buf; while (is.get (c) && (c == ' ' || c == '\t' || c == '#')) ; // Skip whitespace and comment characters. @@ -304,7 +304,7 @@ if (match) { - ostrstream value; + std::ostrstream value; while (is.get (c) && (c == ' ' || c == '\t' || c == ':')) ; // Skip whitespace and the colon. @@ -344,7 +344,7 @@ // [ \t]*keyword[ \t]*int-value.*\n static bool -extract_keyword (istream& is, const char *keyword, int& value) +extract_keyword (std::istream& is, const char *keyword, int& value) { bool status = false; value = 0; @@ -354,7 +354,7 @@ { if (c == '#') { - ostrstream buf; + std::ostrstream buf; while (is.get (c) && (c == ' ' || c == '\t' || c == '#')) ; // Skip whitespace and comment characters. @@ -468,7 +468,7 @@ // arbitrary comments, etc. Someone should fix that. static char * -read_ascii_data (istream& is, const string& filename, bool& global, +read_ascii_data (std::istream& is, const std::string& filename, bool& global, octave_value& tc, int count) { // Read name for this entry or break on EOF. @@ -739,9 +739,9 @@ // FILENAME is used for error messages. static char * -read_binary_data (istream& is, bool swap, +read_binary_data (std::istream& is, bool swap, oct_mach_info::float_format fmt, - const string& filename, bool& global, + const std::string& filename, bool& global, octave_value& tc, char *&doc) { char tmp = 0; @@ -946,9 +946,9 @@ } static string -get_mat_data_input_line (istream& is) +get_mat_data_input_line (std::istream& is) { - string retval; + std::string retval; bool have_data = false; @@ -986,7 +986,7 @@ } static void -get_lines_and_columns (istream& is, const string& filename, int& nr, int& nc) +get_lines_and_columns (std::istream& is, const std::string& filename, int& nr, int& nc) { streampos pos = is.tellg (); @@ -997,7 +997,7 @@ while (is && ! error_state) { - string buf = get_mat_data_input_line (is); + std::string buf = get_mat_data_input_line (is); file_line_number++; @@ -1051,12 +1051,12 @@ // This format provides no way to tag the data as global. static char * -read_mat_ascii_data (istream& is, const string& filename, +read_mat_ascii_data (std::istream& is, const std::string& filename, octave_value& tc) { char *name = 0; - string varname; + std::string varname; size_t pos = filename.rfind ('/'); @@ -1088,9 +1088,9 @@ double d; for (int i = 0; i < nr; i++) { - string buf = get_mat_data_input_line (is); - - istrstream tmp_stream (buf.c_str ()); + std::string buf = get_mat_data_input_line (is); + + std::istrstream tmp_stream (buf.c_str ()); for (int j = 0; j < nc; j++) { @@ -1138,7 +1138,7 @@ // numbers. static void -read_mat_binary_data (istream& is, double *data, int precision, +read_mat_binary_data (std::istream& is, double *data, int precision, int len, bool swap, oct_mach_info::float_format flt_fmt) { @@ -1174,7 +1174,7 @@ } static int -read_mat_file_header (istream& is, bool& swap, FOUR_BYTE_INT& mopt, +read_mat_file_header (std::istream& is, bool& swap, FOUR_BYTE_INT& mopt, FOUR_BYTE_INT& nr, FOUR_BYTE_INT& nc, FOUR_BYTE_INT& imag, FOUR_BYTE_INT& len, int quiet = 0) @@ -1323,7 +1323,7 @@ // This format provides no way to tag the data as global. static char * -read_mat_binary_data (istream& is, const string& filename, +read_mat_binary_data (std::istream& is, const std::string& filename, octave_value& tc) { // These are initialized here instead of closer to where they are @@ -1447,7 +1447,7 @@ static bool matches_patterns (const string_vector& patterns, int pat_idx, - int num_pat, const string& name) + int num_pat, const std::string& name) { for (int i = pat_idx; i < num_pat; i++) { @@ -1460,7 +1460,7 @@ } static int -read_binary_file_header (istream& is, bool& swap, +read_binary_file_header (std::istream& is, bool& swap, oct_mach_info::float_format& flt_fmt, bool quiet = false) { @@ -1495,11 +1495,11 @@ } static load_save_format -get_file_format (const string& fname, const string& orig_fname) +get_file_format (const std::string& fname, const std::string& orig_fname) { load_save_format retval = LS_UNKNOWN; - ifstream file (fname.c_str ()); + std::ifstream file (fname.c_str ()); if (! file) { @@ -1560,14 +1560,14 @@ } static octave_value_list -do_load (istream& stream, const string& orig_fname, bool force, +do_load (std::istream& stream, const std::string& orig_fname, bool force, load_save_format format, oct_mach_info::float_format flt_fmt, bool list_only, bool swap, bool verbose, const string_vector& argv, int argv_idx, int argc, int nargout) { octave_value_list retval; - ostrstream output_buf; + std::ostrstream output_buf; int count = 0; for (;;) { @@ -1790,7 +1790,7 @@ return retval; } - string orig_fname = argv[i]; + std::string orig_fname = argv[i]; oct_mach_info::float_format flt_fmt = oct_mach_info::unknown; @@ -1816,7 +1816,7 @@ } else { - string fname = file_ops::tilde_expand (argv[i]); + std::string fname = file_ops::tilde_expand (argv[i]); if (format == LS_UNKNOWN) format = get_file_format (fname, orig_fname); @@ -1829,7 +1829,7 @@ if (format == LS_BINARY || format == LS_MAT_BINARY) mode |= ios::bin; - ifstream file (fname.c_str (), mode); + std::ifstream file (fname.c_str (), mode); if (file) { @@ -1860,7 +1860,7 @@ // Return TRUE if PATTERN has any special globbing chars in it. static bool -glob_pattern_p (const string& pattern) +glob_pattern_p (const std::string& pattern) { int open = 0; @@ -1926,8 +1926,8 @@ // binary format described above for read_binary_data. static bool -save_binary_data (ostream& os, const octave_value& tc, - const string& name, const string& doc, +save_binary_data (std::ostream& os, const octave_value& tc, + const std::string& name, const std::string& doc, bool mark_as_global, bool save_as_floats) { FOUR_BYTE_INT name_len = name.length (); @@ -1956,7 +1956,7 @@ { FOUR_BYTE_INT len = chm.cols (); os.write (&len, 4); - string tstr = chm.row_as_string (i); + std::string tstr = chm.row_as_string (i); const char *tmp = tstr.data (); os.write (tmp, len); } @@ -2063,8 +2063,8 @@ // in the MatLab binary format. static bool -save_mat_binary_data (ostream& os, const octave_value& tc, - const string& name) +save_mat_binary_data (std::ostream& os, const octave_value& tc, + const std::string& name) { FOUR_BYTE_INT mopt = 0; @@ -2147,7 +2147,7 @@ } static void -ascii_save_type (ostream& os, const char *type, bool mark_as_global) +ascii_save_type (std::ostream& os, const char *type, bool mark_as_global) { if (mark_as_global) os << "# type: global "; @@ -2243,8 +2243,8 @@ // XXX FIXME XXX -- should probably write the help string here too. bool -save_ascii_data (ostream& os, const octave_value& tc, - const string& name, bool strip_nan_and_inf, +save_ascii_data (std::ostream& os, const octave_value& tc, + const std::string& name, bool strip_nan_and_inf, bool mark_as_global, int precision) { bool success = true; @@ -2268,7 +2268,7 @@ { int len = chm.cols (); os << "# length: " << len << "\n"; - string tstr = chm.row_as_string (i); + std::string tstr = chm.row_as_string (i); const char *tmp = tstr.data (); os.write (tmp, len); os << "\n"; @@ -2367,7 +2367,7 @@ // Save the info from sr on stream os in the format specified by fmt. static void -do_save (ostream& os, symbol_record *sr, load_save_format fmt, +do_save (std::ostream& os, symbol_record *sr, load_save_format fmt, int save_as_floats) { if (! sr->is_variable ()) @@ -2376,8 +2376,8 @@ return; } - string name = sr->name (); - string help = sr->help (); + std::string name = sr->name (); + std::string help = sr->help (); int global = sr->is_linked_to_global (); octave_value tc = sr->def (); @@ -2410,7 +2410,7 @@ // builtin variables with names that match PATTERN. static int -save_vars (ostream& os, const string& pattern, bool save_builtins, +save_vars (std::ostream& os, const std::string& pattern, bool save_builtins, load_save_format fmt, int save_as_floats) { Array vars = curr_sym_tab->glob @@ -2452,7 +2452,7 @@ { load_save_format retval = LS_ASCII; - string fmt = Vdefault_save_format; + std::string fmt = Vdefault_save_format; if (fmt == "binary") retval = LS_BINARY; @@ -2463,7 +2463,7 @@ } static void -write_header (ostream& os, load_save_format format) +write_header (std::ostream& os, load_save_format format) { switch (format) { @@ -2484,7 +2484,7 @@ case LS_ASCII: { octave_gmtime now; - string time_string = now.asctime (); + std::string time_string = now.asctime (); time_string = time_string.substr (0, time_string.length () - 1); os << "# Created by Octave " OCTAVE_VERSION ", " @@ -2504,7 +2504,7 @@ static void save_vars (const string_vector& argv, int argv_idx, int argc, - ostream& os, bool save_builtins, load_save_format fmt, + std::ostream& os, bool save_builtins, load_save_format fmt, bool save_as_floats, bool write_header_info) { if (write_header_info) @@ -2543,7 +2543,7 @@ if (format == LS_BINARY || format == LS_MAT_BINARY) mode |= ios::bin; - ofstream file (fname, mode); + std::ofstream file (fname, mode); if (file) { @@ -2702,7 +2702,7 @@ } else { - string fname = file_ops::tilde_expand (argv[i]); + std::string fname = file_ops::tilde_expand (argv[i]); i++; @@ -2712,7 +2712,7 @@ mode |= append ? ios::ate : ios::trunc; - ofstream file (fname.c_str (), mode); + std::ofstream file (fname.c_str (), mode); if (file) { @@ -2739,7 +2739,7 @@ // TRUE, assume a parametric 3-dimensional plot will be generated. bool -save_three_d (ostream& os, const octave_value& tc, bool parametric) +save_three_d (std::ostream& os, const octave_value& tc, bool parametric) { bool fail = false; @@ -2806,7 +2806,7 @@ { int status = 0; - string s = builtin_string_variable ("default_save_format"); + std::string s = builtin_string_variable ("default_save_format"); if (s.empty ()) { diff --git a/src/load-save.h b/src/load-save.h --- a/src/load-save.h +++ b/src/load-save.h @@ -29,13 +29,13 @@ class octave_value; -extern bool save_ascii_data (ostream& os, const octave_value& t, - const string& name = string (), +extern bool save_ascii_data (std::ostream& os, const octave_value& t, + const std::string& name = std::string (), bool strip_nan_and_inf = false, bool mark_as_global = false, int precision = 0); -extern bool save_three_d (ostream& os, const octave_value& t, +extern bool save_three_d (std::ostream& os, const octave_value& t, bool parametric = false); extern void save_user_variables (void); diff --git a/src/oct-fstrm.cc b/src/oct-fstrm.cc --- a/src/oct-fstrm.cc +++ b/src/oct-fstrm.cc @@ -31,13 +31,13 @@ #include "oct-fstrm.h" octave_stream -octave_fstream::create (const string& nm_arg, ios::openmode md, +octave_fstream::create (const std::string& nm_arg, ios::openmode md, oct_mach_info::float_format flt_fmt) { return octave_stream (new octave_fstream (nm_arg, md, flt_fmt)); } -octave_fstream::octave_fstream (const string& nm_arg, +octave_fstream::octave_fstream (const std::string& nm_arg, ios::openmode md = ios::in|ios::out, oct_mach_info::float_format flt_fmt) : octave_base_stream (md, flt_fmt), nm (nm_arg) @@ -98,10 +98,10 @@ return fs.eof (); } -istream * +std::istream * octave_fstream::input_stream (void) { - istream *retval = 0; + std::istream *retval = 0; if (mode () & ios::in) retval = &fs; @@ -109,10 +109,10 @@ return retval; } -ostream * +std::ostream * octave_fstream::output_stream (void) { - ostream *retval = 0; + std::ostream *retval = 0; if (mode () & ios::out) retval = &fs; diff --git a/src/oct-fstrm.h b/src/oct-fstrm.h --- a/src/oct-fstrm.h +++ b/src/oct-fstrm.h @@ -32,13 +32,13 @@ { public: - octave_fstream (const string& nm_arg, + octave_fstream (const std::string& nm_arg, ios::openmode md = ios::in|ios::out, oct_mach_info::float_format flt_fmt = oct_mach_info::native); static octave_stream - create (const string& nm_arg, ios::openmode md = ios::in|ios::out, + create (const std::string& nm_arg, ios::openmode md = ios::in|ios::out, oct_mach_info::float_format flt_fmt = oct_mach_info::native); // Position a stream at OFFSET relative to ORIGIN. @@ -55,11 +55,11 @@ // The name of the file. - string name (void) const { return nm; } + std::string name (void) const { return nm; } - istream *input_stream (void); + std::istream *input_stream (void); - ostream *output_stream (void); + std::ostream *output_stream (void); protected: @@ -67,7 +67,7 @@ private: - string nm; + std::string nm; fstream fs; diff --git a/src/oct-hist.cc b/src/oct-hist.cc --- a/src/oct-hist.cc +++ b/src/oct-hist.cc @@ -76,7 +76,7 @@ bool input_from_tmp_history_file = false; // Where history is saved. -static string Vhistory_file; +static std::string Vhistory_file; // The number of lines to keep in the history file. static int Vhistory_size; @@ -92,7 +92,7 @@ { int size = 1024; - string env_size = octave_env::getenv ("OCTAVE_HISTSIZE"); + std::string env_size = octave_env::getenv ("OCTAVE_HISTSIZE"); if (! env_size.empty ()) { @@ -108,9 +108,9 @@ string default_history_file (void) { - string file; + std::string file; - string env_file = octave_env::getenv ("OCTAVE_HISTFILE"); + std::string env_file = octave_env::getenv ("OCTAVE_HISTFILE"); if (! env_file.empty ()) { @@ -125,7 +125,7 @@ if (file.empty ()) { - string home_dir = octave_env::get_home_directory (); + std::string home_dir = octave_env::get_home_directory (); if (! home_dir.empty ()) { @@ -153,14 +153,14 @@ int i; for (i = 1; i < argc; i++) { - string option = argv[i]; + std::string option = argv[i]; if (option == "-r" || option == "-w" || option == "-a" || option == "-n") { if (i < argc - 1) { - string file = file_ops::tilde_expand (argv[i+1]); + std::string file = file_ops::tilde_expand (argv[i+1]); command_history::set_file (file); } @@ -283,7 +283,7 @@ // your heart's content. static void -edit_history_repl_hist (const string& command) +edit_history_repl_hist (const std::string& command) { if (! command.empty ()) { @@ -295,11 +295,11 @@ { int i = len - 1; - string histent = command_history::get_entry (i); + std::string histent = command_history::get_entry (i); if (! histent.empty ()) { - string cmd = command; + std::string cmd = command; int cmd_len = cmd.length (); @@ -314,11 +314,11 @@ } static void -edit_history_add_hist (const string& line) +edit_history_add_hist (const std::string& line) { if (! line.empty ()) { - string tmp = line; + std::string tmp = line; int len = tmp.length (); @@ -334,7 +334,7 @@ mk_tmp_hist_file (int argc, const string_vector& argv, int insert_curr, const char *warn_for) { - string retval; + std::string retval; string_vector hlist = command_history::list (); @@ -403,7 +403,7 @@ reverse = 1; } - string name = file_ops::tempnam ("", "oct-"); + std::string name = file_ops::tempnam ("", "oct-"); fstream file (name.c_str (), ios::out); @@ -433,14 +433,14 @@ static void do_edit_history (int argc, const string_vector& argv) { - string name = mk_tmp_hist_file (argc, argv, 0, "edit_history"); + std::string name = mk_tmp_hist_file (argc, argv, 0, "edit_history"); if (name.empty ()) return; // Call up our favorite editor on the file of commands. - string cmd = Veditor; + std::string cmd = Veditor; cmd.append (" "); cmd.append (name); @@ -506,7 +506,7 @@ static void do_run_history (int argc, const string_vector& argv) { - string name = mk_tmp_hist_file (argc, argv, 1, "run_history"); + std::string name = mk_tmp_hist_file (argc, argv, 1, "run_history"); if (name.empty ()) return; @@ -671,7 +671,7 @@ { int status = 0; - string s = builtin_string_variable ("history_file"); + std::string s = builtin_string_variable ("history_file"); if (s.empty ()) { diff --git a/src/oct-hist.h b/src/oct-hist.h --- a/src/oct-hist.h +++ b/src/oct-hist.h @@ -28,7 +28,7 @@ #include "cmd-hist.h" extern int default_history_size (void); -extern string default_history_file (void); +extern std::string default_history_file (void); // TRUE means input is coming from temporary history file. extern bool input_from_tmp_history_file; diff --git a/src/oct-iostrm.cc b/src/oct-iostrm.cc --- a/src/oct-iostrm.cc +++ b/src/oct-iostrm.cc @@ -69,7 +69,7 @@ } octave_stream -octave_istream::create (istream *arg, const string& nm) +octave_istream::create (std::istream *arg, const std::string& nm) { return octave_stream (new octave_istream (arg, nm)); } @@ -83,7 +83,7 @@ } octave_stream -octave_ostream::create (ostream *arg, const string& nm) +octave_ostream::create (std::ostream *arg, const std::string& nm) { return octave_stream (new octave_ostream (arg, nm)); } diff --git a/src/oct-iostrm.h b/src/oct-iostrm.h --- a/src/oct-iostrm.h +++ b/src/oct-iostrm.h @@ -32,7 +32,7 @@ { public: - octave_base_iostream (const string& n = string (), + octave_base_iostream (const std::string& n = std::string (), ios::openmode md = ios::in|ios::out, oct_mach_info::float_format flt_fmt = oct_mach_info::native) @@ -52,7 +52,7 @@ // The name of the file. - string name (void) const { return nm; } + std::string name (void) const { return nm; } protected: @@ -62,7 +62,7 @@ private: - string nm; + std::string nm; virtual const char *stream_type (void) const = 0; @@ -78,20 +78,20 @@ { public: - octave_istream (istream *arg = 0, const string& nm = string ()) + octave_istream (std::istream *arg = 0, const std::string& nm = std::string ()) : octave_base_iostream (nm, ios::in, oct_mach_info::native), is (arg) { } static octave_stream - create (istream *arg = 0, const string& nm = string ()); + create (std::istream *arg = 0, const std::string& nm = std::string ()); // Return non-zero if EOF has been reached on this stream. bool eof (void) const; - istream *input_stream (void) { return is; } + std::istream *input_stream (void) { return is; } - ostream *output_stream (void) { return 0; } + std::ostream *output_stream (void) { return 0; } protected: @@ -99,7 +99,7 @@ private: - istream *is; + std::istream *is; const char *stream_type (void) const { return "octave_istream"; } @@ -115,20 +115,20 @@ { public: - octave_ostream (ostream *arg, const string& nm = string ()) + octave_ostream (std::ostream *arg, const std::string& nm = std::string ()) : octave_base_iostream (nm, ios::out, oct_mach_info::native), os (arg) { } static octave_stream - create (ostream *arg, const string& nm = string ()); + create (std::ostream *arg, const std::string& nm = std::string ()); // Return non-zero if EOF has been reached on this stream. bool eof (void) const; - istream *input_stream (void) { return 0; } + std::istream *input_stream (void) { return 0; } - ostream *output_stream (void) { return os; } + std::ostream *output_stream (void) { return os; } protected: @@ -136,7 +136,7 @@ private: - ostream *os; + std::ostream *os; const char *stream_type (void) const { return "octave_ostream"; } diff --git a/src/oct-lvalue.h b/src/oct-lvalue.h --- a/src/oct-lvalue.h +++ b/src/oct-lvalue.h @@ -39,7 +39,7 @@ octave_lvalue (octave_value *v = 0, symbol_record::change_function f = 0) : val (v), idx (), chg_fcn (f), struct_elt_name (), index_set (false) { } - octave_lvalue (octave_value *v, const string& nm, + octave_lvalue (octave_value *v, const std::string& nm, symbol_record::change_function f = 0) : val (v), idx (), chg_fcn (f), struct_elt_name (nm), index_set (false) { } @@ -73,7 +73,7 @@ void assign (octave_value::assign_op, const octave_value&); - octave_lvalue struct_elt_ref (const string& nm) + octave_lvalue struct_elt_ref (const std::string& nm) { val->make_unique (); return val->struct_elt_ref (nm); @@ -104,7 +104,7 @@ symbol_record::change_function chg_fcn; - string struct_elt_name; + std::string struct_elt_name; bool index_set; }; diff --git a/src/oct-map.h b/src/oct-map.h --- a/src/oct-map.h +++ b/src/oct-map.h @@ -39,7 +39,7 @@ public: Octave_map (void) : CHMap (octave_value ()) { } - Octave_map (const string& key, const octave_value& value) + Octave_map (const std::string& key, const octave_value& value) : CHMap (octave_value ()) { CHMap::operator [] (key) = value; diff --git a/src/oct-obj.cc b/src/oct-obj.cc --- a/src/oct-obj.cc +++ b/src/oct-obj.cc @@ -155,7 +155,7 @@ } string_vector -octave_value_list::make_argv (const string& fcn_name) const +octave_value_list::make_argv (const std::string& fcn_name) const { string_vector argv; @@ -167,7 +167,7 @@ for (int i = 0; i < len; i++) { - // An empty string ("") has zero columns and zero rows (a + // An empty std::string ("") has zero columns and zero rows (a // change that was made for Matlab contemptibility. int n = elem(i).rows (); diff --git a/src/oct-obj.h b/src/oct-obj.h --- a/src/oct-obj.h +++ b/src/oct-obj.h @@ -82,7 +82,7 @@ octave_value_list (const char *s) : data (1, octave_value (s)) { } - octave_value_list (const string& s) + octave_value_list (const std::string& s) : data (1, octave_value (s)) { } octave_value_list (const string_vector& s) @@ -140,7 +140,7 @@ bool all_strings_p (void) const; - string_vector make_argv (const string&) const; + string_vector make_argv (const std::string&) const; void stash_name_tags (const string_vector& nm) { names = nm; } diff --git a/src/oct-prcstrm.cc b/src/oct-prcstrm.cc --- a/src/oct-prcstrm.cc +++ b/src/oct-prcstrm.cc @@ -29,13 +29,13 @@ #include "oct-prcstrm.h" octave_stream -octave_iprocstream::create (const string& n, ios::openmode arg_md, +octave_iprocstream::create (const std::string& n, ios::openmode arg_md, oct_mach_info::float_format flt_fmt) { return octave_stream (new octave_iprocstream (n, arg_md, flt_fmt)); } -octave_iprocstream::octave_iprocstream (const string& n, +octave_iprocstream::octave_iprocstream (const std::string& n, ios::openmode arg_md, oct_mach_info::float_format flt_fmt) : octave_istdiostream (n, 0, arg_md, flt_fmt) @@ -45,7 +45,7 @@ if (fp) { delete is; - is = new istdiostream (fp); + is = new std::istdiostream (fp); } } @@ -59,13 +59,13 @@ } octave_stream -octave_oprocstream::create (const string& n, ios::openmode arg_md, +octave_oprocstream::create (const std::string& n, ios::openmode arg_md, oct_mach_info::float_format flt_fmt) { return octave_stream (new octave_oprocstream (n, arg_md, flt_fmt)); } -octave_oprocstream::octave_oprocstream (const string& n, +octave_oprocstream::octave_oprocstream (const std::string& n, ios::openmode arg_md, oct_mach_info::float_format flt_fmt) : octave_ostdiostream (n, 0, arg_md, flt_fmt) @@ -75,7 +75,7 @@ if (fp) { delete os; - os = new ostdiostream (fp); + os = new std::ostdiostream (fp); } } diff --git a/src/oct-prcstrm.h b/src/oct-prcstrm.h --- a/src/oct-prcstrm.h +++ b/src/oct-prcstrm.h @@ -30,13 +30,13 @@ { public: - octave_iprocstream (const string& n, + octave_iprocstream (const std::string& n, ios::openmode arg_md = ios::in, oct_mach_info::float_format flt_fmt = oct_mach_info::native); static octave_stream - create (const string& n, ios::openmode arg_md = ios::in, + create (const std::string& n, ios::openmode arg_md = ios::in, oct_mach_info::float_format flt_fmt = oct_mach_info::native); protected: @@ -57,13 +57,13 @@ { public: - octave_oprocstream (const string& n, + octave_oprocstream (const std::string& n, ios::openmode arg_md = ios::out, oct_mach_info::float_format flt_fmt = oct_mach_info::native); static octave_stream - create (const string& n, ios::openmode arg_md = ios::out, + create (const std::string& n, ios::openmode arg_md = ios::out, oct_mach_info::float_format flt_fmt = oct_mach_info::native); protected: diff --git a/src/oct-stdstrm.cc b/src/oct-stdstrm.cc --- a/src/oct-stdstrm.cc +++ b/src/oct-stdstrm.cc @@ -84,20 +84,20 @@ } octave_stream -octave_istdiostream::create (const string& n, FILE *f, +octave_istdiostream::create (const std::string& n, FILE *f, ios::openmode arg_md, oct_mach_info::float_format flt_fmt) { return octave_stream (new octave_istdiostream (n, f, arg_md, flt_fmt)); } -octave_istdiostream::octave_istdiostream (const string& n, FILE *f, +octave_istdiostream::octave_istdiostream (const std::string& n, FILE *f, ios::openmode arg_md, oct_mach_info::float_format flt_fmt) : octave_base_stdiostream (n, f, arg_md, flt_fmt), is (0) { if (f) - is = new istdiostream (f); + is = new std::istdiostream (f); } octave_istdiostream::~octave_istdiostream (void) @@ -106,20 +106,20 @@ } octave_stream -octave_ostdiostream::create (const string& n, FILE *f, +octave_ostdiostream::create (const std::string& n, FILE *f, ios::openmode arg_md, oct_mach_info::float_format flt_fmt) { return octave_stream (new octave_ostdiostream (n, f, arg_md, flt_fmt)); } -octave_ostdiostream::octave_ostdiostream (const string& n, FILE *f, +octave_ostdiostream::octave_ostdiostream (const std::string& n, FILE *f, ios::openmode arg_md, oct_mach_info::float_format flt_fmt) : octave_base_stdiostream (n, f, arg_md, flt_fmt), os (0) { if (f) - os = new ostdiostream (f); + os = new std::ostdiostream (f); } octave_ostdiostream::~octave_ostdiostream (void) diff --git a/src/oct-stdstrm.h b/src/oct-stdstrm.h --- a/src/oct-stdstrm.h +++ b/src/oct-stdstrm.h @@ -32,7 +32,7 @@ { public: - octave_base_stdiostream (const string& n, FILE *f, + octave_base_stdiostream (const std::string& n, FILE *f, ios::openmode arg_md = ios::in|ios::out, oct_mach_info::float_format flt_fmt = oct_mach_info::native) @@ -48,7 +48,7 @@ // The name of the file. - string name (void) const { return nm; } + std::string name (void) const { return nm; } virtual stdiobuf *rdbuf (void) const = 0; @@ -58,7 +58,7 @@ protected: - string nm; + std::string nm; FILE *fp; @@ -76,26 +76,26 @@ { public: - octave_istdiostream (const string& n, FILE *f = 0, + octave_istdiostream (const std::string& n, FILE *f = 0, ios::openmode arg_md = ios::in, oct_mach_info::float_format flt_fmt = oct_mach_info::native); static octave_stream - create (const string& n, FILE *f = 0, ios::openmode arg_md = ios::in, + create (const std::string& n, FILE *f = 0, ios::openmode arg_md = ios::in, oct_mach_info::float_format flt_fmt = oct_mach_info::native); // Return non-zero if EOF has been reached on this stream. bool eof (void) const { return is ? is->eof () : true; } - istream *input_stream (void) { return is; } + std::istream *input_stream (void) { return is; } - ostream *output_stream (void) { return 0; } + std::ostream *output_stream (void) { return 0; } // XXX FIXME XXX -- should not have to cast away const here. stdiobuf *rdbuf (void) const - { return is ? (const_cast (is))->rdbuf () : 0; } + { return is ? (const_cast (is))->rdbuf () : 0; } bool bad (void) const { return is ? is->bad () : true; } @@ -107,7 +107,7 @@ protected: - istdiostream *is; + std::istdiostream *is; ~octave_istdiostream (void); @@ -125,26 +125,26 @@ { public: - octave_ostdiostream (const string& n, FILE *f = 0, + octave_ostdiostream (const std::string& n, FILE *f = 0, ios::openmode arg_md = ios::out, oct_mach_info::float_format flt_fmt = oct_mach_info::native); static octave_stream - create (const string& n, FILE *f = 0, ios::openmode arg_md = ios::out, + create (const std::string& n, FILE *f = 0, ios::openmode arg_md = ios::out, oct_mach_info::float_format flt_fmt = oct_mach_info::native); // Return non-zero if EOF has been reached on this stream. bool eof (void) const { return os ? os->eof () : true; } - istream *input_stream (void) { return 0; } + std::istream *input_stream (void) { return 0; } - ostream *output_stream (void) { return os; } + std::ostream *output_stream (void) { return os; } // XXX FIXME XXX -- should not have to cast away const here. stdiobuf *rdbuf (void) const - { return os ? (const_cast (os))->rdbuf () : 0; } + { return os ? (const_cast (os))->rdbuf () : 0; } bool bad (void) const { return os ? os->bad () : true; } @@ -156,7 +156,7 @@ protected: - ostdiostream *os; + std::ostdiostream *os; ~octave_ostdiostream (void); diff --git a/src/oct-stream.cc b/src/oct-stream.cc --- a/src/oct-stream.cc +++ b/src/oct-stream.cc @@ -152,7 +152,7 @@ } } -scanf_format_list::scanf_format_list (const string& s) +scanf_format_list::scanf_format_list (const std::string& s) : nconv (0), curr_idx (0), list (16), buf (0) { int num_elts = 0; @@ -173,7 +173,7 @@ have_more = true; if (! buf) - buf = new ostrstream (); + buf = new std::ostrstream (); if (s[i] == '%') { @@ -244,7 +244,7 @@ void scanf_format_list::add_elt_to_list (int width, bool discard, char type, char modifier, int& num_elts, - const string& char_class) + const std::string& char_class) { if (buf) { @@ -275,9 +275,9 @@ } static string -expand_char_class (const string& s) +expand_char_class (const std::string& s) { - string retval; + std::string retval; size_t len = s.length (); @@ -310,7 +310,7 @@ } void -scanf_format_list::process_conversion (const string& s, int& i, int n, +scanf_format_list::process_conversion (const std::string& s, int& i, int n, int& width, bool& discard, char& type, char& modifier, int& num_elts) { @@ -412,13 +412,13 @@ } int -scanf_format_list::finish_conversion (const string& s, int& i, int n, +scanf_format_list::finish_conversion (const std::string& s, int& i, int n, int& width, bool discard, char& type, char modifier, int& num_elts) { int retval = 0; - string char_class; + std::string char_class; if (s[i] == '%') *buf << s[i++]; @@ -572,7 +572,7 @@ // Ugh again. -printf_format_list::printf_format_list (const string& s) +printf_format_list::printf_format_list (const std::string& s) : nconv (0), curr_idx (0), list (16), buf (0) { int num_elts = 0; @@ -592,7 +592,7 @@ have_more = true; if (! buf) - buf = new ostrstream (); + buf = new std::ostrstream (); switch (s[i]) { @@ -667,7 +667,7 @@ } void -printf_format_list::process_conversion (const string& s, int& i, int n, +printf_format_list::process_conversion (const std::string& s, int& i, int n, int& args, char& modifier, char& type, int& num_elts) { @@ -750,7 +750,7 @@ } void -printf_format_list::finish_conversion (const string& s, int& i, +printf_format_list::finish_conversion (const std::string& s, int& i, int args, char modifier, char& type, int& num_elts) @@ -839,8 +839,8 @@ int retval = -1; - istream *is = input_stream (); - ostream *os = output_stream (); + std::istream *is = input_stream (); + std::ostream *os = output_stream (); int i_fid = is ? ((filebuf *) (is->rdbuf ()))->fd () : -1; int o_fid = os ? ((filebuf *) (os->rdbuf ()))->fd () : -1; @@ -859,7 +859,7 @@ } void -octave_base_stream::error (const string& msg) +octave_base_stream::error (const std::string& msg) { fail = true; errmsg = msg; @@ -879,19 +879,19 @@ octave_base_stream::do_gets (int max_len, bool& err, bool strip_newline, const char *fcn) { - string retval; + std::string retval; err = false; - istream *isp = input_stream (); + std::istream *isp = input_stream (); if (isp) { - istream& is = *isp; + std::istream& is = *isp; // XXX FIXME XXX -- this should probably be converted to use // sstream when that is available. - ostrstream buf; + std::ostrstream buf; int c = 0; int count = 0; @@ -920,14 +920,14 @@ if (is.fail ()) { err = true; - string msg = fcn; + std::string msg = fcn; msg.append (": read error"); error (msg); } else if (count == 0 && is.eof ()) { err = true; - string msg = fcn; + std::string msg = fcn; msg.append (": at end of file"); error (msg); } @@ -969,11 +969,11 @@ count = 0; - istream *isp = input_stream (); + std::istream *isp = input_stream (); if (isp) { - istream& is = *isp; + std::istream& is = *isp; int nr = -1; int nc = -1; @@ -1003,7 +1003,7 @@ template void -do_scanf_conv (istream& is, const char *fmt, T valptr, Matrix& mval, +do_scanf_conv (std::istream& is, const char *fmt, T valptr, Matrix& mval, double *data, int& idx, int& conv_count, int nr, int max_size, bool discard) { @@ -1032,25 +1032,25 @@ } template void -do_scanf_conv (istream&, const char*, int*, Matrix&, double*, int&, +do_scanf_conv (std::istream&, const char*, int*, Matrix&, double*, int&, int&, int, int, bool); template void -do_scanf_conv (istream&, const char*, long int*, Matrix&, double*, int&, +do_scanf_conv (std::istream&, const char*, long int*, Matrix&, double*, int&, int&, int, int, bool); template void -do_scanf_conv (istream&, const char*, short int*, Matrix&, double*, int&, +do_scanf_conv (std::istream&, const char*, short int*, Matrix&, double*, int&, int&, int, int, bool); #if 0 template void -do_scanf_conv (istream&, const char*, float*, Matrix&, double*, int&, +do_scanf_conv (std::istream&, const char*, float*, Matrix&, double*, int&, int&, int, int, bool); #endif template void -do_scanf_conv (istream&, const char*, double*, Matrix&, double*, int&, +do_scanf_conv (std::istream&, const char*, double*, Matrix&, double*, int&, int&, int, int, bool); #define DO_WHITESPACE_CONVERSION() \ @@ -1170,7 +1170,7 @@ { \ ostrstream buf; \ \ - string char_class = elt->char_class; \ + std::string char_class = elt->char_class; \ \ int c = EOF; \ \ @@ -1260,7 +1260,7 @@ return Matrix (nr, nc, 0.0); } - istream *isp = input_stream (); + std::istream *isp = input_stream (); bool all_char_conv = fmt_list.all_character_conversions (); @@ -1316,7 +1316,7 @@ if (isp) { - istream& is = *isp; + std::istream& is = *isp; const scanf_format_elt *elt = fmt_list.first (); @@ -1554,11 +1554,11 @@ count = 0; - istream *isp = input_stream (); + std::istream *isp = input_stream (); if (isp) { - istream& is = *isp; + std::istream& is = *isp; scanf_format_list fmt_list (fmt); @@ -1631,11 +1631,11 @@ { bool quit = false; - istream *isp = input_stream (); + std::istream *isp = input_stream (); if (isp) { - istream& is = *isp; + std::istream& is = *isp; ios::fmtflags flags = is.flags (); @@ -1766,15 +1766,15 @@ } octave_value_list -octave_base_stream::oscanf (const string& fmt) +octave_base_stream::oscanf (const std::string& fmt) { octave_value_list retval; - istream *isp = input_stream (); + std::istream *isp = input_stream (); if (isp) { - istream& is = *isp; + std::istream& is = *isp; scanf_format_list fmt_list (fmt); @@ -1878,7 +1878,7 @@ { int retval = -1; - ostream *os = output_stream (); + std::ostream *os = output_stream (); if (os) { @@ -1900,11 +1900,11 @@ { int retval = -1; - ostream *osp = output_stream (); + std::ostream *osp = output_stream (); if (osp) { - ostream& os = *osp; + std::ostream& os = *osp; Matrix mval = data.matrix_value (); @@ -1948,7 +1948,7 @@ int int_value (void); // Get the current value as a string and advance the internal pointer. - string string_value (void); + std::string string_value (void); operator bool () const { return (curr_state == ok); } @@ -2072,7 +2072,7 @@ string printf_value_cache::string_value (void) { - string retval; + std::string retval; if (looking_at_string ()) { @@ -2095,7 +2095,7 @@ template void -do_printf_conv (ostream& os, const char *fmt, int nsa, int sa_1, +do_printf_conv (std::ostream& os, const char *fmt, int nsa, int sa_1, int sa_2, bool have_arg, T arg) { switch (nsa) @@ -2128,16 +2128,16 @@ } template void -do_printf_conv (ostream&, const char*, int, int, int, bool, int); +do_printf_conv (std::ostream&, const char*, int, int, int, bool, int); template void -do_printf_conv (ostream&, const char*, int, int, int, bool, long); +do_printf_conv (std::ostream&, const char*, int, int, int, bool, long); template void -do_printf_conv (ostream&, const char*, int, int, int, bool, double); +do_printf_conv (std::ostream&, const char*, int, int, int, bool, double); template void -do_printf_conv (ostream&, const char*, int, int, int, bool, const char*); +do_printf_conv (std::ostream&, const char*, int, int, int, bool, const char*); int octave_base_stream::do_printf (printf_format_list& fmt_list, @@ -2145,11 +2145,11 @@ { int retval = -1; - ostream *osp = output_stream (); + std::ostream *osp = output_stream (); if (osp) { - ostream& os = *osp; + std::ostream& os = *osp; const printf_format_elt *elt = fmt_list.first (); @@ -2196,7 +2196,7 @@ { if (elt->type == 's' && val_cache.looking_at_string ()) { - string val = val_cache.string_value (); + std::string val = val_cache.string_value (); if (val_cache) do_printf_conv (os, fmt, nsa, sa_1, sa_2, true, @@ -2273,15 +2273,15 @@ } int -octave_base_stream::printf (const string& fmt, const octave_value_list& args) +octave_base_stream::printf (const std::string& fmt, const octave_value_list& args) { int retval = -1; - ostream *osp = output_stream (); + std::ostream *osp = output_stream (); if (osp) { - ostream& os = *osp; + std::ostream& os = *osp; printf_format_list fmt_list (fmt); @@ -2324,15 +2324,15 @@ } int -octave_base_stream::puts (const string& s) +octave_base_stream::puts (const std::string& s) { int retval = -1; - ostream *osp = output_stream (); + std::ostream *osp = output_stream (); if (osp) { - ostream& os = *osp; + std::ostream& os = *osp; os << s; @@ -2374,7 +2374,7 @@ { err_num = fail ? -1 : 0; - string tmp = errmsg; + std::string tmp = errmsg; if (clear_err) clear (); @@ -2385,7 +2385,7 @@ void octave_base_stream::invalid_operation (const char *op, const char *rw) { - string msg = op; + std::string msg = op; msg.append (": stream not open for "); msg.append (rw); error (msg); @@ -2442,7 +2442,7 @@ string octave_stream::getl (int max_len, bool& err) { - string retval; + std::string retval; if (stream_ok ("getl")) retval = rep->getl (max_len, err); @@ -2453,7 +2453,7 @@ string octave_stream::getl (const octave_value& tc_max_len, bool& err) { - string retval; + std::string retval; err = false; @@ -2475,7 +2475,7 @@ string octave_stream::gets (int max_len, bool& err) { - string retval; + std::string retval; if (stream_ok ("fgets")) retval = rep->gets (max_len, err); @@ -2486,7 +2486,7 @@ string octave_stream::gets (const octave_value& tc_max_len, bool& err) { - string retval; + std::string retval; err = false; @@ -2532,7 +2532,7 @@ if (tc_origin.is_string ()) { - string xorigin = tc_origin.string_value (); + std::string xorigin = tc_origin.string_value (); if (xorigin == "bof") origin = ios::beg; @@ -2638,7 +2638,7 @@ } octave_value -octave_stream::scanf (const string& fmt, const Matrix& size, int& count) +octave_stream::scanf (const std::string& fmt, const Matrix& size, int& count) { octave_value retval; @@ -2649,7 +2649,7 @@ } octave_value_list -octave_stream::oscanf (const string& fmt) +octave_stream::oscanf (const std::string& fmt) { octave_value_list retval; @@ -2660,7 +2660,7 @@ } int -octave_stream::printf (const string& fmt, const octave_value_list& args) +octave_stream::printf (const std::string& fmt, const octave_value_list& args) { int retval = -1; @@ -2671,7 +2671,7 @@ } int -octave_stream::puts (const string& s) +octave_stream::puts (const std::string& s) { int retval = -1; @@ -2690,7 +2690,7 @@ if (tc_s.is_string ()) { - string s = tc_s.string_value (); + std::string s = tc_s.string_value (); retval = rep->puts (s); } else @@ -2713,7 +2713,7 @@ string octave_stream::error (bool clear, int& err_num) { - string retval; + std::string retval; if (stream_ok ("ferror", false)) retval = rep->error (clear, err_num); @@ -2724,7 +2724,7 @@ string octave_stream::name (void) const { - string retval; + std::string retval; if (stream_ok ("name")) retval = rep->name (); @@ -2757,7 +2757,7 @@ string octave_stream::mode_as_string (int mode) { - string retval = "???"; + std::string retval = "???"; switch (mode) { @@ -2851,25 +2851,25 @@ } octave_stream -octave_stream_list::lookup (int fid, const string& who) +octave_stream_list::lookup (int fid, const std::string& who) { return (instance_ok ()) ? instance->do_lookup (fid, who) : octave_stream (); } octave_stream -octave_stream_list::lookup (const octave_value& fid, const string& who) +octave_stream_list::lookup (const octave_value& fid, const std::string& who) { return (instance_ok ()) ? instance->do_lookup (fid, who) : octave_stream (); } int -octave_stream_list::remove (int fid, const string& who) +octave_stream_list::remove (int fid, const std::string& who) { return (instance_ok ()) ? instance->do_remove (fid, who) : -1; } int -octave_stream_list::remove (const octave_value& fid, const string& who) +octave_stream_list::remove (const octave_value& fid, const std::string& who) { return (instance_ok ()) ? instance->do_remove (fid, who) : -1; } @@ -2896,7 +2896,7 @@ string octave_stream_list::list_open_files (void) { - return (instance_ok ()) ? instance->do_list_open_files () : string (); + return (instance_ok ()) ? instance->do_list_open_files () : std::string (); } octave_value @@ -2950,7 +2950,7 @@ } static void -gripe_invalid_file_id (int fid, const string& who) +gripe_invalid_file_id (int fid, const std::string& who) { if (who.empty ()) ::error ("invalid stream number = %d", fid); @@ -2959,7 +2959,7 @@ } octave_stream -octave_stream_list::do_lookup (int fid, const string& who) const +octave_stream_list::do_lookup (int fid, const std::string& who) const { octave_stream retval; @@ -2973,7 +2973,7 @@ octave_stream octave_stream_list::do_lookup (const octave_value& fid, - const string& who) const + const std::string& who) const { octave_stream retval; @@ -2986,7 +2986,7 @@ } int -octave_stream_list::do_remove (int fid, const string& who) +octave_stream_list::do_remove (int fid, const std::string& who) { int retval = -1; @@ -3012,7 +3012,7 @@ } int -octave_stream_list::do_remove (const octave_value& fid, const string& who) +octave_stream_list::do_remove (const octave_value& fid, const std::string& who) { int retval = -1; @@ -3079,11 +3079,11 @@ string octave_stream_list::do_list_open_files (void) const { - string retval; + std::string retval; // XXX FIXME XXX -- this should probably be converted to use sstream // when that is available. - ostrstream buf; + std::ostrstream buf; buf << "\n" << " number mode arch name\n" @@ -3095,12 +3095,12 @@ if (os) { - string mode = octave_stream::mode_as_string (os.mode ()); - - string arch = + std::string mode = octave_stream::mode_as_string (os.mode ()); + + std::string arch = oct_mach_info::float_format_as_string (os.float_format ()); - string name = os.name (); + std::string name = os.name (); buf << " " << setiosflags (ios::right) @@ -3150,7 +3150,7 @@ if (fid.is_string ()) { - string nm = fid.string_value (); + std::string nm = fid.string_value (); // stdin (cin), stdout (cout), and stderr (cerr) are unnamed. @@ -3172,7 +3172,7 @@ int int_fid = convert_to_valid_int (fid, conv_err); if (conv_err) - ::error ("file id must be a file object, string, or integer value"); + ::error ("file id must be a file object, std::string, or integer value"); else retval = int_fid; } diff --git a/src/oct-stream.h b/src/oct-stream.h --- a/src/oct-stream.h +++ b/src/oct-stream.h @@ -47,7 +47,7 @@ scanf_format_elt (const char *txt = 0, int w = 0, bool d = false, char typ = '\0', char mod = '\0', - const string& ch_class = string ()) + const std::string& ch_class = std::string ()) : text (txt), width (w), discard (d), type (typ), modifier (mod), char_class (ch_class) { } @@ -58,7 +58,7 @@ bool discard; char type; char modifier; - string char_class; + std::string char_class; }; class @@ -66,7 +66,7 @@ { public: - scanf_format_list (const string& fmt = string ()); + scanf_format_list (const std::string& fmt = std::string ()); ~scanf_format_list (void); @@ -108,7 +108,7 @@ private: - // Number of conversions specified by this format string, or -1 if + // Number of conversions specified by this format std::string, or -1 if // invalid conversions have been found. int nconv; @@ -119,16 +119,16 @@ Array list; // Temporary buffer. - ostrstream *buf; + std::ostrstream *buf; void add_elt_to_list (int width, bool discard, char type, char modifier, - int& num_elts, const string& char_class = string ()); + int& num_elts, const std::string& char_class = std::string ()); - void process_conversion (const string& s, int& i, int n, int& width, + void process_conversion (const std::string& s, int& i, int n, int& width, bool& discard, char& type, char& modifier, int& num_elts); - int finish_conversion (const string& s, int& i, int n, int& width, + int finish_conversion (const std::string& s, int& i, int n, int& width, bool discard, char& type, char modifier, int& num_elts); // No copying! @@ -158,7 +158,7 @@ { public: - printf_format_list (const string& fmt = string ()); + printf_format_list (const std::string& fmt = std::string ()); ~printf_format_list (void); @@ -189,7 +189,7 @@ private: - // Number of conversions specified by this format string, or -1 if + // Number of conversions specified by this format std::string, or -1 if // invalid conversions have been found. int nconv; @@ -200,15 +200,15 @@ Array list; // Temporary buffer. - ostrstream *buf; + std::ostrstream *buf; void add_elt_to_list (int args, char type, char modifier, int& num_elts); - void process_conversion (const string& s, int& i, int n, int& args, + void process_conversion (const std::string& s, int& i, int n, int& args, char& modifier, char& type, int& num_elts); - void finish_conversion (const string& s, int& i, int args, + void finish_conversion (const std::string& s, int& i, int args, char modifier, char& type, int& num_elts); // No copying! @@ -251,19 +251,19 @@ // The name of the file. - virtual string name (void) const = 0; + virtual std::string name (void) const = 0; // If the derived class provides this function and it returns a // pointer to a valid istream, scanf(), read(), getl(), and gets() // will automatically work for this stream. - virtual istream *input_stream (void) { return 0; } + virtual std::istream *input_stream (void) { return 0; } // If the derived class provides this function and it returns a // pointer to a valid ostream, flush(), write(), and printf() will // automatically work for this stream. - virtual ostream *output_stream (void) { return 0; } + virtual std::ostream *output_stream (void) { return 0; } // Return TRUE if this stream is open. @@ -277,7 +277,7 @@ // Return current error message for this stream. - string error (bool clear, int& err_num); + std::string error (bool clear, int& err_num); protected: @@ -287,7 +287,7 @@ // Set current error state and set fail to TRUE. - void error (const string& msg); + void error (const std::string& msg); // Clear any error message and set fail to FALSE. @@ -312,16 +312,16 @@ bool open_state; // Should contain error message if fail is TRUE. - string errmsg; + std::string errmsg; // Functions that are defined for all input streams (input streams // are those that define is). - string do_gets (int max_len, bool& err, bool strip_newline, + std::string do_gets (int max_len, bool& err, bool strip_newline, const char *fcn); - string getl (int max_len, bool& err); - string gets (int max_len, bool& err); + std::string getl (int max_len, bool& err); + std::string gets (int max_len, bool& err); octave_value do_read (int nr, int nc, oct_data_conv::data_type dt, int skip, oct_mach_info::float_format flt_fmt, @@ -340,11 +340,11 @@ octave_value do_scanf (scanf_format_list& fmt_list, int nr, int nc, bool one_elt_size_spec, int& count); - octave_value scanf (const string& fmt, const Matrix& size, int& count); + octave_value scanf (const std::string& fmt, const Matrix& size, int& count); bool do_oscanf (const scanf_format_elt *elt, octave_value&); - octave_value_list oscanf (const string& fmt); + octave_value_list oscanf (const std::string& fmt); // Functions that are defined for all output streams (output streams // are those that define os). @@ -359,9 +359,9 @@ int do_printf (printf_format_list& fmt_list, const octave_value_list& args); - int printf (const string& fmt, const octave_value_list& args); + int printf (const std::string& fmt, const octave_value_list& args); - int puts (const string& s); + int puts (const std::string& s); // We can always do this in terms of seek(), so the derived class // only has to provide that. @@ -392,11 +392,11 @@ int flush (void); - string getl (int max_len, bool& err); - string getl (const octave_value& max_len, bool& err); + std::string getl (int max_len, bool& err); + std::string getl (const octave_value& max_len, bool& err); - string gets (int max_len, bool& err); - string gets (const octave_value& max_len, bool& err); + std::string gets (int max_len, bool& err); + std::string gets (const octave_value& max_len, bool& err); int seek (streamoff offset, ios::seek_dir origin); int seek (const octave_value& offset, const octave_value& origin); @@ -416,20 +416,20 @@ int write (const octave_value& data, oct_data_conv::data_type dt, int skip, oct_mach_info::float_format flt_fmt); - octave_value scanf (const string& fmt, const Matrix& size, int& count); + octave_value scanf (const std::string& fmt, const Matrix& size, int& count); - octave_value_list oscanf (const string& fmt); + octave_value_list oscanf (const std::string& fmt); - int printf (const string& fmt, const octave_value_list& args); + int printf (const std::string& fmt, const octave_value_list& args); - int puts (const string& s); + int puts (const std::string& s); int puts (const octave_value& s); bool eof (void) const; - string error (bool clear, int& err_num); + std::string error (bool clear, int& err_num); - string error (bool clear = false) + std::string error (bool clear = false) { int err_num; return error (clear, err_num); @@ -443,17 +443,17 @@ operator bool () const { return ok (); } - string name (void) const; + std::string name (void) const; int mode (void) const; oct_mach_info::float_format float_format (void) const; - static string mode_as_string (int mode); + static std::string mode_as_string (int mode); - istream *input_stream (void) { return rep ? rep->input_stream () : 0; } + std::istream *input_stream (void) { return rep ? rep->input_stream () : 0; } - ostream *output_stream (void) { return rep ? rep->output_stream () : 0; } + std::ostream *output_stream (void) { return rep ? rep->output_stream () : 0; } private: @@ -480,7 +480,7 @@ return retval; } - void error (const string& msg) + void error (const std::string& msg) { if (rep) rep->error (msg); @@ -502,20 +502,20 @@ static octave_value insert (const octave_stream& os); - static octave_stream lookup (int fid, const string& who = string ()); + static octave_stream lookup (int fid, const std::string& who = std::string ()); static octave_stream lookup (const octave_value& fid, - const string& who = string ()); + const std::string& who = std::string ()); - static int remove (int fid, const string& who = string ()); + static int remove (int fid, const std::string& who = std::string ()); static int remove (const octave_value& fid, - const string& who = string ()); + const std::string& who = std::string ()); static void clear (void); static string_vector get_info (int fid); static string_vector get_info (const octave_value& fid); - static string list_open_files (void); + static std::string list_open_files (void); static octave_value open_file_numbers (void); @@ -531,19 +531,19 @@ octave_value do_insert (const octave_stream& os); - octave_stream do_lookup (int fid, const string& who = string ()) const; + octave_stream do_lookup (int fid, const std::string& who = std::string ()) const; octave_stream do_lookup (const octave_value& fid, - const string& who = string ()) const; + const std::string& who = std::string ()) const; - int do_remove (int fid, const string& who = string ()); - int do_remove (const octave_value& fid, const string& who = string ()); + int do_remove (int fid, const std::string& who = std::string ()); + int do_remove (const octave_value& fid, const std::string& who = std::string ()); void do_clear (void); string_vector do_get_info (int fid) const; string_vector do_get_info (const octave_value& fid) const; - string do_list_open_files (void) const; + std::string do_list_open_files (void) const; octave_value do_open_file_numbers (void) const; diff --git a/src/oct-strstrm.cc b/src/oct-strstrm.cc --- a/src/oct-strstrm.cc +++ b/src/oct-strstrm.cc @@ -35,7 +35,7 @@ if (! bad ()) { - streambuf *sb = rdbuf (); + std::streambuf *sb = rdbuf (); if (sb) { @@ -60,7 +60,7 @@ { // XXX FIXME XXX -- shouldn't have to do this! - streambuf *sb = (const_cast(this))->rdbuf (); + std::streambuf *sb = (const_cast(this))->rdbuf (); if (sb) { @@ -82,7 +82,7 @@ } octave_stream -octave_istrstream::create (const string& data, ios::openmode arg_md, +octave_istrstream::create (const std::string& data, ios::openmode arg_md, oct_mach_info::float_format flt_fmt) { return octave_stream (new octave_istrstream (data, arg_md, flt_fmt)); diff --git a/src/oct-strstrm.h b/src/oct-strstrm.h --- a/src/oct-strstrm.h +++ b/src/oct-strstrm.h @@ -48,9 +48,9 @@ // The name of the file. - string name (void) const { return string (); } + std::string name (void) const { return std::string (); } - virtual streambuf *rdbuf (void) = 0; + virtual std::streambuf *rdbuf (void) = 0; virtual bool bad (void) const = 0; @@ -80,7 +80,7 @@ oct_mach_info::native) : octave_base_strstream (arg_md, flt_fmt), is (data) { } - octave_istrstream (const string& data, + octave_istrstream (const std::string& data, ios::openmode arg_md = ios::out, oct_mach_info::float_format flt_fmt = oct_mach_info::native) @@ -91,18 +91,18 @@ oct_mach_info::float_format flt_fmt = oct_mach_info::native); static octave_stream - create (const string& data, ios::openmode arg_md = ios::out, + create (const std::string& data, ios::openmode arg_md = ios::out, oct_mach_info::float_format flt_fmt = oct_mach_info::native); // Return non-zero if EOF has been reached on this stream. bool eof (void) const { return is.eof (); } - istream *input_stream (void) { return &is; } + std::istream *input_stream (void) { return &is; } - ostream *output_stream (void) { return 0; } + std::ostream *output_stream (void) { return 0; } - streambuf *rdbuf (void) { return is ? is.rdbuf () : 0; } + std::streambuf *rdbuf (void) { return is ? is.rdbuf () : 0; } bool bad (void) const { return is.bad (); } @@ -114,7 +114,7 @@ private: - istrstream is; + std::istrstream is; // No copying! @@ -141,20 +141,20 @@ bool eof (void) const { return os.eof (); } - istream *input_stream (void) { return 0; } + std::istream *input_stream (void) { return 0; } - ostream *output_stream (void) { return &os; } + std::ostream *output_stream (void) { return &os; } - string str (void) + std::string str (void) { os << ends; char *tmp = os.str (); - string retval = tmp; + std::string retval = tmp; delete [] tmp; return retval; } - streambuf *rdbuf (void) { return os ? os.rdbuf () : 0; } + std::streambuf *rdbuf (void) { return os ? os.rdbuf () : 0; } bool bad (void) const { return os.bad (); } @@ -166,7 +166,7 @@ private: - ostrstream os; + std::ostrstream os; // No copying! diff --git a/src/octave.cc b/src/octave.cc --- a/src/octave.cc +++ b/src/octave.cc @@ -176,7 +176,7 @@ // This may seem odd, but doing it this way means that we don't have // to modify the kpathsea library... - string odb = octave_env::getenv ("OCTAVE_DB_PATH"); + std::string odb = octave_env::getenv ("OCTAVE_DB_PATH"); // For backward compatibility. @@ -184,7 +184,7 @@ odb = octave_env::getenv ("OCTAVE_DB_DIR"); if (odb.empty ()) - odb = Vdata_dir + string ("/octave:") + Vlibexec_dir + string ("/octave"); + odb = Vdata_dir + std::string ("/octave:") + Vlibexec_dir + std::string ("/octave"); octave_env::putenv ("TEXMFDBS", odb); } @@ -225,15 +225,15 @@ int home_rc_already_executed = 0; - string initfile = octave_env::getenv ("OCTAVE_INITFILE"); + std::string initfile = octave_env::getenv ("OCTAVE_INITFILE"); if (initfile.empty ()) initfile = ".octaverc"; - string home_dir = octave_env::get_home_directory (); + std::string home_dir = octave_env::get_home_directory (); - string home_rc = home_dir + "/" + initfile; - string local_rc = string ("./") + initfile; + std::string home_rc = home_dir + "/" + initfile; + std::string local_rc = std::string ("./") + initfile; if (! home_dir.empty ()) { @@ -531,7 +531,7 @@ size_t pos = curr_fcn_file_name.rfind ('/'); - string tmp = (pos != NPOS) + std::string tmp = (pos != NPOS) ? curr_fcn_file_name.substr (pos+1) : curr_fcn_file_name; bind_builtin_variable ("program_name", tmp); diff --git a/src/ov-base-mat.cc b/src/ov-base-mat.cc --- a/src/ov-base-mat.cc +++ b/src/ov-base-mat.cc @@ -63,7 +63,7 @@ default: { - string n = type_name (); + std::string n = type_name (); error ("invalid number of indices (%d) for %s value", len, n.c_str ()); @@ -111,7 +111,7 @@ template void -octave_base_matrix::print (ostream& os, bool pr_as_read_syntax) const +octave_base_matrix::print (std::ostream& os, bool pr_as_read_syntax) const { print_raw (os, pr_as_read_syntax); newline (os); @@ -119,7 +119,7 @@ template void -octave_base_matrix::print_raw (ostream& os, bool pr_as_read_syntax) const +octave_base_matrix::print_raw (std::ostream& os, bool pr_as_read_syntax) const { octave_print_internal (os, matrix, pr_as_read_syntax, current_print_indent_level ()); @@ -127,7 +127,7 @@ template bool -octave_base_matrix::print_name_tag (ostream& os, const string& name) const +octave_base_matrix::print_name_tag (std::ostream& os, const std::string& name) const { bool retval = false; diff --git a/src/ov-base-mat.h b/src/ov-base-mat.h --- a/src/ov-base-mat.h +++ b/src/ov-base-mat.h @@ -93,11 +93,11 @@ virtual bool print_as_scalar (void) const; - void print (ostream& os, bool pr_as_read_syntax = false) const; + void print (std::ostream& os, bool pr_as_read_syntax = false) const; - void print_raw (ostream& os, bool pr_as_read_syntax = false) const; + void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; - bool print_name_tag (ostream& os, const string& name) const; + bool print_name_tag (std::ostream& os, const std::string& name) const; protected: diff --git a/src/ov-base-scalar.cc b/src/ov-base-scalar.cc --- a/src/ov-base-scalar.cc +++ b/src/ov-base-scalar.cc @@ -36,7 +36,7 @@ template void -octave_base_scalar::print (ostream& os, bool pr_as_read_syntax) const +octave_base_scalar::print (std::ostream& os, bool pr_as_read_syntax) const { print_raw (os, pr_as_read_syntax); newline (os); @@ -44,7 +44,7 @@ template void -octave_base_scalar::print_raw (ostream& os, bool pr_as_read_syntax) const +octave_base_scalar::print_raw (std::ostream& os, bool pr_as_read_syntax) const { indent (os); octave_print_internal (os, scalar, pr_as_read_syntax); @@ -52,7 +52,7 @@ template bool -octave_base_scalar::print_name_tag (ostream& os, const string& name) const +octave_base_scalar::print_name_tag (std::ostream& os, const std::string& name) const { indent (os); os << name << " = "; diff --git a/src/ov-base-scalar.h b/src/ov-base-scalar.h --- a/src/ov-base-scalar.h +++ b/src/ov-base-scalar.h @@ -79,11 +79,11 @@ bool is_true (void) const { return (scalar != 0.0); } - void print (ostream& os, bool pr_as_read_syntax = false) const; + void print (std::ostream& os, bool pr_as_read_syntax = false) const; - void print_raw (ostream& os, bool pr_as_read_syntax = false) const; + void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; - bool print_name_tag (ostream& os, const string& name) const; + bool print_name_tag (std::ostream& os, const std::string& name) const; protected: diff --git a/src/ov-base.cc b/src/ov-base.cc --- a/src/ov-base.cc +++ b/src/ov-base.cc @@ -55,7 +55,7 @@ octave_value octave_base_value::do_index_op (const octave_value_list&) { - string nm = type_name (); + std::string nm = type_name (); error ("can't perform indexing operations for %s type", nm.c_str ()); return octave_value (); } @@ -63,7 +63,7 @@ octave_value_list octave_base_value::do_index_op (int, const octave_value_list&) { - string nm = type_name (); + std::string nm = type_name (); error ("can't perform indexing operations for %s type", nm.c_str ()); return octave_value (); } @@ -71,35 +71,35 @@ idx_vector octave_base_value::index_vector (void) const { - string nm = type_name (); + std::string nm = type_name (); error ("%s type invalid as index value", nm.c_str ()); return idx_vector (); } octave_value -octave_base_value::do_struct_elt_index_op (const string&, +octave_base_value::do_struct_elt_index_op (const std::string&, const octave_value_list&, bool) { - string nm = type_name (); + std::string nm = type_name (); error ("can't perform indexed structure reference operations for %s type", nm.c_str ()); return octave_value (); } octave_value -octave_base_value::do_struct_elt_index_op (const string&, bool) +octave_base_value::do_struct_elt_index_op (const std::string&, bool) { - string nm = type_name (); + std::string nm = type_name (); error ("can't perform structure reference operations for %s type", nm.c_str ()); return octave_value (); } octave_lvalue -octave_base_value::struct_elt_ref (octave_value *, const string&) +octave_base_value::struct_elt_ref (octave_value *, const std::string&) { - string nm = type_name (); + std::string nm = type_name (); error ("can't perform structure reference operations for %s type", nm.c_str ()); return octave_lvalue (); @@ -122,19 +122,19 @@ } void -octave_base_value::print (ostream&, bool) const +octave_base_value::print (std::ostream&, bool) const { gripe_wrong_type_arg ("octave_base_value::print ()", type_name ()); } void -octave_base_value::print_raw (ostream&, bool) const +octave_base_value::print_raw (std::ostream&, bool) const { gripe_wrong_type_arg ("octave_base_value::print_raw ()", type_name ()); } bool -octave_base_value::print_name_tag (ostream& os, const string& name) const +octave_base_value::print_name_tag (std::ostream& os, const std::string& name) const { indent (os); os << name << " ="; @@ -250,7 +250,7 @@ string octave_base_value::string_value (void) const { - string retval; + std::string retval; gripe_wrong_type_arg ("octave_base_value::string_value()", type_name ()); return retval; } diff --git a/src/ov-base.h b/src/ov-base.h --- a/src/ov-base.h +++ b/src/ov-base.h @@ -77,12 +77,12 @@ idx_vector index_vector (void) const; octave_value - do_struct_elt_index_op (const string& nm, const octave_value_list& idx, + do_struct_elt_index_op (const std::string& nm, const octave_value_list& idx, bool silent); - octave_value do_struct_elt_index_op (const string& nm, bool silent); + octave_value do_struct_elt_index_op (const std::string& nm, bool silent); - octave_lvalue struct_elt_ref (octave_value *parent, const string& nm); + octave_lvalue struct_elt_ref (octave_value *parent, const std::string& nm); int rows (void) const { return -1; } @@ -177,7 +177,7 @@ string_vector all_strings (void) const; - string string_value (void) const; + std::string string_value (void) const; Range range_value (void) const; @@ -199,11 +199,11 @@ void convert_to_row_or_column_vector (void); - void print (ostream& os, bool pr_as_read_syntax = false) const; + void print (std::ostream& os, bool pr_as_read_syntax = false) const; - void print_raw (ostream& os, bool pr_as_read_syntax = false) const; + void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; - bool print_name_tag (ostream& os, const string& name) const; + bool print_name_tag (std::ostream& os, const std::string& name) const; private: diff --git a/src/ov-builtin.h b/src/ov-builtin.h --- a/src/ov-builtin.h +++ b/src/ov-builtin.h @@ -44,8 +44,8 @@ typedef octave_value_list (*fcn) (const octave_value_list&, int); - octave_builtin (fcn ff, const string& nm = string (), - const string& ds = string ()) + octave_builtin (fcn ff, const std::string& nm = std::string (), + const std::string& ds = std::string ()) : octave_function (nm, ds), f (ff) { } ~octave_builtin (void) { } diff --git a/src/ov-cell.cc b/src/ov-cell.cc --- a/src/ov-cell.cc +++ b/src/ov-cell.cc @@ -72,7 +72,7 @@ default: { - string n = type_name (); + std::string n = type_name (); error ("invalid number of indices (%d) for %s value", len, n.c_str ()); @@ -109,13 +109,13 @@ } void -octave_cell::print (ostream& os, bool) const +octave_cell::print (std::ostream& os, bool) const { print_raw (os); } void -octave_cell::print_raw (ostream& os, bool) const +octave_cell::print_raw (std::ostream& os, bool) const { unwind_protect::begin_frame ("octave_cell_print"); @@ -134,7 +134,7 @@ { for (int i = 0; i < nr; i++) { - ostrstream buf; + std::ostrstream buf; buf << "[" << i+1 << "," << j+1 << "]" << ends; const char *nm = buf.str (); @@ -161,7 +161,7 @@ } bool -octave_cell::print_name_tag (ostream& os, const string& name) const +octave_cell::print_name_tag (std::ostream& os, const std::string& name) const { indent (os); if (is_empty ()) diff --git a/src/ov-cell.h b/src/ov-cell.h --- a/src/ov-cell.h +++ b/src/ov-cell.h @@ -74,11 +74,11 @@ bool is_constant (void) const { return true; } - void print (ostream& os, bool pr_as_read_syntax = false) const; + void print (std::ostream& os, bool pr_as_read_syntax = false) const; - void print_raw (ostream& os, bool pr_as_read_syntax = false) const; + void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; - bool print_name_tag (ostream& os, const string& name) const; + bool print_name_tag (std::ostream& os, const std::string& name) const; private: diff --git a/src/ov-ch-mat.h b/src/ov-ch-mat.h --- a/src/ov-ch-mat.h +++ b/src/ov-ch-mat.h @@ -65,7 +65,7 @@ octave_char_matrix (const char *s) : octave_base_matrix (s) { } - octave_char_matrix (const string& s) + octave_char_matrix (const std::string& s) : octave_base_matrix (s) { } octave_char_matrix (const string_vector& s) diff --git a/src/ov-colon.cc b/src/ov-colon.cc --- a/src/ov-colon.cc +++ b/src/ov-colon.cc @@ -37,14 +37,14 @@ DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_magic_colon, "magic-colon"); void -octave_magic_colon::print (ostream& os, bool) const +octave_magic_colon::print (std::ostream& os, bool) const { indent (os); print_raw (os); } void -octave_magic_colon::print_raw (ostream& os, bool) const +octave_magic_colon::print_raw (std::ostream& os, bool) const { os << ":"; } diff --git a/src/ov-colon.h b/src/ov-colon.h --- a/src/ov-colon.h +++ b/src/ov-colon.h @@ -69,9 +69,9 @@ bool valid_as_zero_index (void) const { return false; } - void print (ostream& os, bool pr_as_read_syntax = false) const; + void print (std::ostream& os, bool pr_as_read_syntax = false) const; - void print_raw (ostream& os, bool pr_as_read_syntax = false) const; + void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; private: diff --git a/src/ov-dld-fcn.cc b/src/ov-dld-fcn.cc --- a/src/ov-dld-fcn.cc +++ b/src/ov-dld-fcn.cc @@ -45,12 +45,12 @@ octave_dld_function::octave_dld_function (octave_builtin::fcn ff, const octave_shlib& shl, - const string& nm, const string& ds) + const std::string& nm, const std::string& ds) : octave_builtin (ff, nm, ds), sh_lib (shl) { mark_fcn_file_up_to_date (time_parsed ()); - string file_name = fcn_file_name (); + std::string file_name = fcn_file_name (); system_fcn_file = (! file_name.empty () diff --git a/src/ov-dld-fcn.h b/src/ov-dld-fcn.h --- a/src/ov-dld-fcn.h +++ b/src/ov-dld-fcn.h @@ -48,14 +48,14 @@ public: octave_dld_function (octave_builtin::fcn ff, const octave_shlib& shl, - const string& nm = string (), - const string& ds = string ()); + const std::string& nm = std::string (), + const std::string& ds = std::string ()); ~octave_dld_function (void); void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; } - string fcn_file_name (void) const; + std::string fcn_file_name (void) const; octave_time time_parsed (void) const; diff --git a/src/ov-fcn.h b/src/ov-fcn.h --- a/src/ov-fcn.h +++ b/src/ov-fcn.h @@ -62,7 +62,7 @@ virtual bool is_system_fcn_file (void) { return false; } - virtual string fcn_file_name (void) const { return string (); } + virtual std::string fcn_file_name (void) const { return std::string (); } virtual void mark_fcn_file_up_to_date (const octave_time&) { } @@ -72,9 +72,9 @@ virtual octave_time time_checked (void) const { return octave_time (static_cast (0)); } - string name (void) const { return my_name; } + std::string name (void) const { return my_name; } - string doc_string (void) const { return doc; } + std::string doc_string (void) const { return doc; } virtual void unload (void) { } @@ -82,14 +82,14 @@ protected: - octave_function (const string& nm, const string& ds) + octave_function (const std::string& nm, const std::string& ds) : my_name (nm), doc (ds) { } // The name of this function. - string my_name; + std::string my_name; // The help text for this function. - string doc; + std::string doc; private: diff --git a/src/ov-file.cc b/src/ov-file.cc --- a/src/ov-file.cc +++ b/src/ov-file.cc @@ -55,14 +55,14 @@ } void -octave_file::print (ostream& os, bool) const +octave_file::print (std::ostream& os, bool) const { print_raw (os); newline (os); } void -octave_file::print_raw (ostream& os, bool) const +octave_file::print_raw (std::ostream& os, bool) const { indent (os); os << "{"; newline (os); @@ -70,11 +70,11 @@ { increment_indent_level (); - string name = stream.name (); - string mode = octave_stream::mode_as_string (stream.mode ()); - string arch + std::string name = stream.name (); + std::string mode = octave_stream::mode_as_string (stream.mode ()); + std::string arch = oct_mach_info::float_format_as_string (stream.float_format ()); - string status = stream.is_open () ? "open" : "closed"; + std::string status = stream.is_open () ? "open" : "closed"; indent (os); os << "id = " << number; newline (os); indent (os); os << "name = " << name; newline (os); @@ -89,7 +89,7 @@ } bool -octave_file::print_name_tag (ostream& os, const string& name) const +octave_file::print_name_tag (std::ostream& os, const std::string& name) const { indent (os); os << name << " ="; diff --git a/src/ov-file.h b/src/ov-file.h --- a/src/ov-file.h +++ b/src/ov-file.h @@ -76,11 +76,11 @@ bool is_stream (void) const { return true; } - void print (ostream& os, bool pr_as_read_syntax = false) const; + void print (std::ostream& os, bool pr_as_read_syntax = false) const; - void print_raw (ostream& os, bool pr_as_read_syntax = false) const; + void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; - bool print_name_tag (ostream& os, const string& name) const; + bool print_name_tag (std::ostream& os, const std::string& name) const; private: diff --git a/src/ov-list.cc b/src/ov-list.cc --- a/src/ov-list.cc +++ b/src/ov-list.cc @@ -83,13 +83,13 @@ } void -octave_list::print (ostream& os, bool) const +octave_list::print (std::ostream& os, bool) const { print_raw (os); } void -octave_list::print_raw (ostream& os, bool) const +octave_list::print_raw (std::ostream& os, bool) const { unwind_protect::begin_frame ("octave_list_print"); @@ -105,7 +105,7 @@ for (int i = 0; i < n; i++) { - ostrstream buf; + std::ostrstream buf; buf << "[" << i+1 << "]" << ends; const char *nm = buf.str (); @@ -130,7 +130,7 @@ } bool -octave_list::print_name_tag (ostream& os, const string& name) const +octave_list::print_name_tag (std::ostream& os, const std::string& name) const { indent (os); if (lst.length () == 0) diff --git a/src/ov-list.h b/src/ov-list.h --- a/src/ov-list.h +++ b/src/ov-list.h @@ -77,11 +77,11 @@ octave_value_list list_value (void) const { return lst; } - void print (ostream& os, bool pr_as_read_syntax = false) const; + void print (std::ostream& os, bool pr_as_read_syntax = false) const; - void print_raw (ostream& os, bool pr_as_read_syntax = false) const; + void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; - bool print_name_tag (ostream& os, const string& name) const; + bool print_name_tag (std::ostream& os, const std::string& name) const; private: diff --git a/src/ov-mapper.h b/src/ov-mapper.h --- a/src/ov-mapper.h +++ b/src/ov-mapper.h @@ -52,8 +52,8 @@ octave_mapper (ch_mapper ch, d_b_mapper db, c_b_mapper cb, d_d_mapper dd, d_c_mapper dc, c_c_mapper cc, double ll, double ul, int f, - const string& nm = string (), - const string& ds = string ()) + const std::string& nm = std::string (), + const std::string& ds = std::string ()) : octave_function (nm, ds), ch_map_fcn (ch), d_b_map_fcn (db), c_b_map_fcn (cb), d_d_map_fcn (dd), d_c_map_fcn (dc), c_c_map_fcn (cc), @@ -94,7 +94,7 @@ // // 0 => this function returns a matrix of ones and zeros // 1 => this function returns a numeric matrix (any values) - // 2 => this function returns a string array + // 2 => this function returns a std::string array // // For other mappers, nonzero means that this function can return a // complex value for some real arguments. diff --git a/src/ov-range.cc b/src/ov-range.cc --- a/src/ov-range.cc +++ b/src/ov-range.cc @@ -178,21 +178,21 @@ } void -octave_range::print (ostream& os, bool pr_as_read_syntax) const +octave_range::print (std::ostream& os, bool pr_as_read_syntax) const { print_raw (os, pr_as_read_syntax); newline (os); } void -octave_range::print_raw (ostream& os, bool pr_as_read_syntax) const +octave_range::print_raw (std::ostream& os, bool pr_as_read_syntax) const { octave_print_internal (os, range, pr_as_read_syntax, current_print_indent_level ()); } bool -octave_range::print_name_tag (ostream& os, const string& name) const +octave_range::print_name_tag (std::ostream& os, const std::string& name) const { bool retval = false; diff --git a/src/ov-range.h b/src/ov-range.h --- a/src/ov-range.h +++ b/src/ov-range.h @@ -139,11 +139,11 @@ octave_value convert_to_str (void) const; - void print (ostream& os, bool pr_as_read_syntax = false) const; + void print (std::ostream& os, bool pr_as_read_syntax = false) const; - void print_raw (ostream& os, bool pr_as_read_syntax = false) const; + void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; - bool print_name_tag (ostream& os, const string& name) const; + bool print_name_tag (std::ostream& os, const std::string& name) const; private: diff --git a/src/ov-str-mat.cc b/src/ov-str-mat.cc --- a/src/ov-str-mat.cc +++ b/src/ov-str-mat.cc @@ -189,7 +189,7 @@ } void -octave_char_matrix_str::print_raw (ostream& os, bool pr_as_read_syntax) const +octave_char_matrix_str::print_raw (std::ostream& os, bool pr_as_read_syntax) const { octave_print_internal (os, matrix, pr_as_read_syntax, current_print_indent_level (), true); diff --git a/src/ov-str-mat.h b/src/ov-str-mat.h --- a/src/ov-str-mat.h +++ b/src/ov-str-mat.h @@ -65,7 +65,7 @@ octave_char_matrix_str (const char *s) : octave_char_matrix (s) { } - octave_char_matrix_str (const string& s) + octave_char_matrix_str (const std::string& s) : octave_char_matrix (s) { } octave_char_matrix_str (const string_vector& s) @@ -101,11 +101,11 @@ string_vector all_strings (void) const; - string string_value (void) const; + std::string string_value (void) const; bool print_as_scalar (void) const { return (rows () <= 1); } - void print_raw (ostream& os, bool pr_as_read_syntax = false) const; + void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; private: diff --git a/src/ov-struct.cc b/src/ov-struct.cc --- a/src/ov-struct.cc +++ b/src/ov-struct.cc @@ -41,7 +41,7 @@ DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(octave_struct, "struct"); octave_value -octave_struct::do_struct_elt_index_op (const string& nm, +octave_struct::do_struct_elt_index_op (const std::string& nm, const octave_value_list& idx, bool silent) { @@ -49,7 +49,7 @@ } octave_value -octave_struct::do_struct_elt_index_op (const string& nm, bool silent) +octave_struct::do_struct_elt_index_op (const std::string& nm, bool silent) { octave_value retval; @@ -64,19 +64,19 @@ } octave_lvalue -octave_struct::struct_elt_ref (octave_value *, const string& nm) +octave_struct::struct_elt_ref (octave_value *, const std::string& nm) { return octave_lvalue (&map [nm]); } void -octave_struct::print (ostream& os, bool) const +octave_struct::print (std::ostream& os, bool) const { print_raw (os); } void -octave_struct::print_raw (ostream& os, bool) const +octave_struct::print_raw (std::ostream& os, bool) const { // XXX FIXME XXX -- would be nice to print the output in some // standard order. Maybe all substructures first, maybe @@ -96,7 +96,7 @@ for (Pix p = map.first (); p; map.next (p)) { - string key = map.key (p); + std::string key = map.key (p); octave_value val = map.contents (p); val.print_with_name (os, key); @@ -118,7 +118,7 @@ } bool -octave_struct::print_name_tag (ostream& os, const string& name) const +octave_struct::print_name_tag (std::ostream& os, const std::string& name) const { indent (os); os << name << " ="; diff --git a/src/ov-struct.h b/src/ov-struct.h --- a/src/ov-struct.h +++ b/src/ov-struct.h @@ -67,12 +67,12 @@ octave_value *clone (void) { return new octave_struct (*this); } octave_value - do_struct_elt_index_op (const string& nm, const octave_value_list& idx, + do_struct_elt_index_op (const std::string& nm, const octave_value_list& idx, bool silent); - octave_value do_struct_elt_index_op (const string& nm, bool silent); + octave_value do_struct_elt_index_op (const std::string& nm, bool silent); - octave_lvalue struct_elt_ref (octave_value *parent, const string& nm); + octave_lvalue struct_elt_ref (octave_value *parent, const std::string& nm); bool is_defined (void) const { return true; } @@ -82,11 +82,11 @@ Octave_map map_value (void) const { return map; } - void print (ostream& os, bool pr_as_read_syntax = false) const; + void print (std::ostream& os, bool pr_as_read_syntax = false) const; - void print_raw (ostream& os, bool pr_as_read_syntax = false) const; + void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; - bool print_name_tag (ostream& os, const string& name) const; + bool print_name_tag (std::ostream& os, const std::string& name) const; private: diff --git a/src/ov-typeinfo.cc b/src/ov-typeinfo.cc --- a/src/ov-typeinfo.cc +++ b/src/ov-typeinfo.cc @@ -79,7 +79,7 @@ } int -octave_value_typeinfo::register_type (const string& name) +octave_value_typeinfo::register_type (const std::string& name) { return (instance_ok ()) ? instance->do_register_type (name) : -1; @@ -145,7 +145,7 @@ } int -octave_value_typeinfo::do_register_type (const string& name) +octave_value_typeinfo::do_register_type (const std::string& name) { int i = 0; @@ -159,7 +159,7 @@ { len *= 2; - types.resize (len, string ()); + types.resize (len, std::string ()); unary_ops.resize (static_cast (octave_value::num_unary_ops), len, static_cast (0)); diff --git a/src/ov-typeinfo.h b/src/ov-typeinfo.h --- a/src/ov-typeinfo.h +++ b/src/ov-typeinfo.h @@ -44,7 +44,7 @@ static bool instance_ok (void); - static int register_type (const string&); + static int register_type (const std::string&); static bool register_unary_op (octave_value::unary_op, int, unary_op_fcn); @@ -114,7 +114,7 @@ protected: octave_value_typeinfo (void) - : num_types (0), types (init_tab_sz, string ()), + : num_types (0), types (init_tab_sz, std::string ()), unary_ops (octave_value::num_unary_ops, init_tab_sz, (unary_op_fcn) 0), non_const_unary_ops (octave_value::num_unary_ops, init_tab_sz, @@ -136,7 +136,7 @@ int num_types; - Array types; + Array types; Array2 unary_ops; @@ -152,7 +152,7 @@ Array2 widening_ops; - int do_register_type (const string&); + int do_register_type (const std::string&); bool do_register_unary_op (octave_value::unary_op, int, unary_op_fcn); diff --git a/src/ov-usr-fcn.cc b/src/ov-usr-fcn.cc --- a/src/ov-usr-fcn.cc +++ b/src/ov-usr-fcn.cc @@ -74,7 +74,7 @@ octave_user_function::octave_user_function (tree_parameter_list *pl, tree_parameter_list *rl, tree_statement_list *cl, symbol_table *st) - : octave_function (string (), string ()), + : octave_function (std::string (), std::string ()), param_list (pl), ret_list (rl), cmd_list (cl), sym_tab (st), file_name (), fcn_name (), t_parsed (static_cast (0)), @@ -136,7 +136,7 @@ // function file is parsed, it probably doesn't matter that // much. - string ff_name = fcn_file_in_path (file_name); + std::string ff_name = fcn_file_in_path (file_name); if (Vfcn_file_dir.compare (ff_name, 0, Vfcn_file_dir.length ()) == 0) system_fcn_file = 1; @@ -199,7 +199,7 @@ } void -octave_user_function::stash_function_name (const string& s) +octave_user_function::stash_function_name (const std::string& s) { fcn_name = s; } diff --git a/src/ov-usr-fcn.h b/src/ov-usr-fcn.h --- a/src/ov-usr-fcn.h +++ b/src/ov-usr-fcn.h @@ -78,7 +78,7 @@ void stash_symtab_ptr (symbol_record *sr) { symtab_entry = sr; } - string fcn_file_name (void) const + std::string fcn_file_name (void) const { return file_name; } octave_time time_parsed (void) const @@ -105,9 +105,9 @@ void octave_vr_val (const octave_value& val); - void stash_function_name (const string& s); + void stash_function_name (const std::string& s); - string function_name (void) + std::string function_name (void) { return fcn_name; } void clear_args_passed (void) @@ -145,10 +145,10 @@ symbol_table *sym_tab; // The name of the file we parsed - string file_name; + std::string file_name; // The name of the function. - string fcn_name; + std::string fcn_name; // The time the file was parsed. octave_time t_parsed; diff --git a/src/ov-va-args.cc b/src/ov-va-args.cc --- a/src/ov-va-args.cc +++ b/src/ov-va-args.cc @@ -37,14 +37,14 @@ DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_all_va_args, "va-arg"); void -octave_all_va_args::print (ostream& os, bool) const +octave_all_va_args::print (std::ostream& os, bool) const { indent (os); print (os); } void -octave_all_va_args::print_raw (ostream& os, bool) const +octave_all_va_args::print_raw (std::ostream& os, bool) const { os << "all_va_args"; } diff --git a/src/ov-va-args.h b/src/ov-va-args.h --- a/src/ov-va-args.h +++ b/src/ov-va-args.h @@ -61,9 +61,9 @@ bool is_all_va_args (void) const { return true; } - void print (ostream& os, bool pr_as_read_syntax = false) const; + void print (std::ostream& os, bool pr_as_read_syntax = false) const; - void print_raw (ostream& os, bool pr_as_read_syntax = false) const; + void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; private: diff --git a/src/ov.cc b/src/ov.cc --- a/src/ov.cc +++ b/src/ov.cc @@ -124,7 +124,7 @@ string octave_value::unary_op_as_string (unary_op op) { - string retval; + std::string retval; switch (op) { @@ -162,7 +162,7 @@ string octave_value::binary_op_as_string (binary_op op) { - string retval; + std::string retval; switch (op) { @@ -260,7 +260,7 @@ string octave_value::assign_op_as_string (assign_op op) { - string retval; + std::string retval; switch (op) { @@ -432,7 +432,7 @@ maybe_mutate (); } -octave_value::octave_value (const string& s) +octave_value::octave_value (const std::string& s) : rep (new octave_char_matrix_str (s)) { rep->count = 1; @@ -556,22 +556,22 @@ } static void -gripe_no_conversion (const string& on, const string& tn1, const string& tn2) +gripe_no_conversion (const std::string& on, const std::string& tn1, const std::string& tn2) { error ("operator %s: no conversion for assignment of `%s' to indexed `%s'", on.c_str (), tn2.c_str (), tn1.c_str ()); } static void -gripe_assign_failed (const string& on, const string& tn1, const string& tn2) +gripe_assign_failed (const std::string& on, const std::string& tn1, const std::string& tn2) { error ("assignment failed for `%s %s %s'", tn1.c_str (), on.c_str (), tn2.c_str ()); } static void -gripe_assign_failed_or_no_method (const string& on, const string& tn1, - const string& tn2) +gripe_assign_failed_or_no_method (const std::string& on, const std::string& tn1, + const std::string& tn2) { error ("assignment failed, or no method for `%s %s %s'", tn1.c_str (), on.c_str (), tn2.c_str ()); @@ -684,7 +684,7 @@ } void -octave_value::assign_struct_elt (assign_op op, const string& elt_nm, +octave_value::assign_struct_elt (assign_op op, const std::string& elt_nm, const octave_value& rhs) { make_unique (); @@ -694,7 +694,7 @@ void -octave_value::assign_struct_elt (assign_op op, const string& elt_nm, +octave_value::assign_struct_elt (assign_op op, const std::string& elt_nm, const octave_value_list& idx, const octave_value& rhs) { @@ -704,13 +704,13 @@ } octave_lvalue -octave_value::struct_elt_ref (const string& nm) +octave_value::struct_elt_ref (const std::string& nm) { return rep->struct_elt_ref (this, nm); } octave_lvalue -octave_value::struct_elt_ref (octave_value *, const string&) +octave_value::struct_elt_ref (octave_value *, const std::string&) { panic_impossible (); @@ -775,7 +775,7 @@ } else { - string tn = type_name (); + std::string tn = type_name (); gripe_invalid_conversion (tn.c_str (), "real column vector"); } @@ -804,7 +804,7 @@ } else { - string tn = type_name (); + std::string tn = type_name (); gripe_invalid_conversion (tn.c_str (), "complex column vector"); } @@ -833,7 +833,7 @@ } else { - string tn = type_name (); + std::string tn = type_name (); gripe_invalid_conversion (tn.c_str (), "real row vector"); } @@ -862,7 +862,7 @@ } else { - string tn = type_name (); + std::string tn = type_name (); gripe_invalid_conversion (tn.c_str (), "complex row vector"); } @@ -908,7 +908,7 @@ } else { - string tn = type_name (); + std::string tn = type_name (); gripe_invalid_conversion (tn.c_str (), "real vector"); } @@ -952,7 +952,7 @@ } else { - string tn = type_name (); + std::string tn = type_name (); gripe_invalid_conversion (tn.c_str (), "complex vector"); } @@ -960,7 +960,7 @@ } void -octave_value::print_with_name (ostream& output_buf, const string& name, +octave_value::print_with_name (std::ostream& output_buf, const std::string& name, bool print_padding) const { bool pad_after = print_name_tag (output_buf, name); @@ -972,14 +972,14 @@ } static void -gripe_indexed_assignment (const string& tn1, const string& tn2) +gripe_indexed_assignment (const std::string& tn1, const std::string& tn2) { error ("assignment of `%s' to indexed `%s' not implemented", tn2.c_str (), tn1.c_str ()); } static void -gripe_assign_conversion_failed (const string& tn1, const string& tn2) +gripe_assign_conversion_failed (const std::string& tn1, const std::string& tn2) { error ("type conversion for assignment of `%s' to indexed `%s' failed", tn2.c_str (), tn1.c_str ()); @@ -1144,14 +1144,14 @@ } static void -gripe_binary_op (const string& on, const string& tn1, const string& tn2) +gripe_binary_op (const std::string& on, const std::string& tn1, const std::string& tn2) { error ("binary operator `%s' not implemented for `%s' by `%s' operations", on.c_str (), tn1.c_str (), tn2.c_str ()); } static void -gripe_binary_op_conv (const string& on) +gripe_binary_op_conv (const std::string& on) { error ("type conversion failed for binary operator `%s'", on.c_str ()); } @@ -1233,14 +1233,14 @@ } static void -gripe_unary_op (const string& on, const string& tn) +gripe_unary_op (const std::string& on, const std::string& tn) { error ("unary operator `%s' not implemented for `%s' operands", on.c_str (), tn.c_str ()); } static void -gripe_unary_op_conv (const string& on) +gripe_unary_op_conv (const std::string& on) { error ("type conversion failed for unary operator `%s'", on.c_str ()); } @@ -1290,7 +1290,7 @@ } static void -gripe_unary_op_conversion_failed (const string& op, const string& tn) +gripe_unary_op_conversion_failed (const std::string& op, const std::string& tn) { error ("operator %s: type conversion for `%s' failed", op.c_str (), tn.c_str ()); @@ -1361,7 +1361,7 @@ } static void -gripe_unary_op_failed_or_no_method (const string& on, const string& tn) +gripe_unary_op_failed_or_no_method (const std::string& on, const std::string& tn) { error ("operator %s: no method, or unable to evaluate for %s operand", on.c_str (), tn.c_str ()); @@ -1395,7 +1395,7 @@ // This doesn't need to be fast, but isn't there a better way? void -octave_value::indent (ostream& os) const +octave_value::indent (std::ostream& os) const { assert (curr_print_indent_level >= 0); @@ -1414,7 +1414,7 @@ // All print() functions should use this to print new lines. void -octave_value::newline (ostream& os) const +octave_value::newline (std::ostream& os) const { os << "\n"; @@ -1447,7 +1447,7 @@ default: { - string on = unary_op_as_string (op); + std::string on = unary_op_as_string (op); error ("operator %s: no assign operator found", on.c_str ()); } } @@ -1512,7 +1512,7 @@ default: { - string on = assign_op_as_string (op); + std::string on = assign_op_as_string (op); error ("operator %s: no binary operator found", on.c_str ()); } } diff --git a/src/ov.h b/src/ov.h --- a/src/ov.h +++ b/src/ov.h @@ -141,11 +141,11 @@ unknown_assign_op }; - static string unary_op_as_string (unary_op); + static std::string unary_op_as_string (unary_op); - static string binary_op_as_string (binary_op); + static std::string binary_op_as_string (binary_op); - static string assign_op_as_string (assign_op); + static std::string assign_op_as_string (assign_op); enum magic_colon { magic_colon_t }; enum all_va_args { all_va_args_t }; @@ -166,7 +166,7 @@ octave_value (const boolMatrix& bm); octave_value (char c); octave_value (const char *s); - octave_value (const string& s); + octave_value (const std::string& s); octave_value (const string_vector& s); octave_value (const charMatrix& chm, bool is_string = false); octave_value (double base, double limit, double inc); @@ -245,29 +245,29 @@ const octave_value& rhs); virtual void - assign_struct_elt (assign_op, const string& elt_nm, + assign_struct_elt (assign_op, const std::string& elt_nm, const octave_value& rhs); virtual void - assign_struct_elt (assign_op, const string& elt_nm, + assign_struct_elt (assign_op, const std::string& elt_nm, const octave_value_list& idx, const octave_value& rhs); virtual idx_vector index_vector (void) const { return rep->index_vector (); } virtual octave_value - do_struct_elt_index_op (const string& nm, bool silent = false) + do_struct_elt_index_op (const std::string& nm, bool silent = false) { return rep->do_struct_elt_index_op (nm, silent); } virtual octave_value - do_struct_elt_index_op (const string& nm, const octave_value_list& idx, + do_struct_elt_index_op (const std::string& nm, const octave_value_list& idx, bool silent = false) { return rep->do_struct_elt_index_op (nm, idx, silent); } - octave_lvalue struct_elt_ref (const string& nm); + octave_lvalue struct_elt_ref (const std::string& nm); virtual octave_lvalue - struct_elt_ref (octave_value *parent, const string& nm); + struct_elt_ref (octave_value *parent, const std::string& nm); // Size. @@ -423,7 +423,7 @@ virtual string_vector all_strings (void) const { return rep->all_strings (); } - virtual string string_value (void) const + virtual std::string string_value (void) const { return rep->string_value (); } virtual Range range_value (void) const @@ -475,21 +475,21 @@ virtual void convert_to_row_or_column_vector (void) { rep->convert_to_row_or_column_vector (); } - virtual void print (ostream& os, bool pr_as_read_syntax = false) const + virtual void print (std::ostream& os, bool pr_as_read_syntax = false) const { rep->print (os, pr_as_read_syntax); } - virtual void print_raw (ostream& os, bool pr_as_read_syntax = false) const + virtual void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const { rep->print_raw (os, pr_as_read_syntax); } - virtual bool print_name_tag (ostream& os, const string& name) const + virtual bool print_name_tag (std::ostream& os, const std::string& name) const { return rep->print_name_tag (os, name); } - void print_with_name (ostream& os, const string& name, + void print_with_name (std::ostream& os, const std::string& name, bool print_padding = true) const; virtual int type_id (void) const { return rep->type_id (); } - virtual string type_name (void) const { return rep->type_name (); } + virtual std::string type_name (void) const { return rep->type_name (); } // Unary and binary operations. @@ -523,9 +523,9 @@ int current_print_indent_level (void) const { return curr_print_indent_level; } - void newline (ostream& os) const; + void newline (std::ostream& os) const; - void indent (ostream& os) const; + void indent (std::ostream& os) const; void reset (void) const; @@ -638,18 +638,18 @@ #define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA \ public: \ int type_id (void) const { return t_id; } \ - string type_name (void) const { return t_name; } \ + std::string type_name (void) const { return t_name; } \ static volatile int static_type_id (void) { return t_id; } \ static void register_type (void) \ { t_id = octave_value_typeinfo::register_type (t_name); } \ \ private: \ static volatile int t_id; \ - static const string t_name; + static const std::string t_name; #define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n) \ volatile int t::t_id (-1); \ - const string t::t_name (n) + const std::string t::t_name (n) // If TRUE, allow assignments like // diff --git a/src/pager.cc b/src/pager.cc --- a/src/pager.cc +++ b/src/pager.cc @@ -55,13 +55,13 @@ static bool write_to_diary_file = false; // The name of the current diary file. -static string diary_file; +static std::string diary_file; // The diary file. -static ofstream external_diary_file; +static std::ofstream external_diary_file; // The shell command to run as the pager. -static string Vpager_binary; +static std::string Vpager_binary; // TRUE means that if output is going to the pager, it is sent as soon // as it is available. Otherwise, it is buffered and only sent to the @@ -129,7 +129,7 @@ { if (! external_pager) { - string pgr = Vpager_binary; + std::string pgr = Vpager_binary; if (! pgr.empty ()) { @@ -278,7 +278,7 @@ octave_pager_stream *octave_pager_stream::instance = 0; -octave_pager_stream::octave_pager_stream (void) : ostream (), pb (0) +octave_pager_stream::octave_pager_stream (void) : std::ostream (), pb (0) { pb = new octave_pager_buf; rdbuf (pb); @@ -309,7 +309,7 @@ octave_diary_stream *octave_diary_stream::instance = 0; -octave_diary_stream::octave_diary_stream (void) : ostream (), db (0) +octave_diary_stream::octave_diary_stream (void) : std::ostream (), db (0) { db = new octave_diary_buf; rdbuf (db); @@ -429,7 +429,7 @@ case 2: { - string arg = argv[1]; + std::string arg = argv[1]; if (arg == "on") { @@ -478,7 +478,7 @@ if (argc == 2) { - string arg = argv[1]; + std::string arg = argv[1]; if (arg == "on") bind_builtin_variable ("page_screen_output", 1.0); @@ -496,18 +496,18 @@ static string default_pager (void) { - string pager_binary = octave_env::getenv ("PAGER"); + std::string pager_binary = octave_env::getenv ("PAGER"); #ifdef DEFAULT_PAGER if (pager_binary.empty ()) { - pager_binary = string (DEFAULT_PAGER); + pager_binary = std::string (DEFAULT_PAGER); if (pager_binary == "less") { pager_binary.append (" -e"); - string lessflags = octave_env::getenv ("LESS"); + std::string lessflags = octave_env::getenv ("LESS"); if (lessflags.empty ()) pager_binary.append (" -P'-- less ?pB(%pB\\%):--. (f)orward, (b)ack, (q)uit$'"); @@ -523,7 +523,7 @@ { int status = 0; - string s = builtin_string_variable ("PAGER"); + std::string s = builtin_string_variable ("PAGER"); if (s.empty ()) { diff --git a/src/pager.h b/src/pager.h --- a/src/pager.h +++ b/src/pager.h @@ -32,11 +32,11 @@ #endif class -octave_pager_buf : public strstreambuf +octave_pager_buf : public std::strstreambuf { public: - octave_pager_buf (int size = 0) : strstreambuf (size) { } + octave_pager_buf (int size = 0) : std::strstreambuf (size) { } void flush_current_contents_to_diary (void); @@ -74,11 +74,11 @@ }; class -octave_diary_buf : public strstreambuf +octave_diary_buf : public std::strstreambuf { public: - octave_diary_buf (int size = 0) : strstreambuf (size) { } + octave_diary_buf (int size = 0) : std::strstreambuf (size) { } protected: diff --git a/src/parse.h b/src/parse.h --- a/src/parse.h +++ b/src/parse.h @@ -54,7 +54,7 @@ extern int current_input_column; // Buffer for help text snagged from function files. -extern string help_buf; +extern std::string help_buf; // TRUE means we are using readline. extern bool line_editing; @@ -81,25 +81,25 @@ parse_and_execute (FILE *f); extern void -parse_and_execute (const string& s, bool verbose = false, +parse_and_execute (const std::string& s, bool verbose = false, const char *warn_for = 0); -extern string get_help_from_file (const string& f); +extern std::string get_help_from_file (const std::string& f); extern bool load_fcn_from_file (symbol_record *sym_rec, bool exec_script); extern octave_value_list -feval (const string& name, const octave_value_list& args, int nargout); +feval (const std::string& name, const octave_value_list& args, int nargout); extern octave_value_list feval (const octave_value_list& args, int nargout); extern octave_value_list -eval_string (const string&, bool silent, int& parse_status, int hargout); +eval_string (const std::string&, bool silent, int& parse_status, int hargout); extern octave_value -eval_string (const string&, bool silent, int& parse_status); +eval_string (const std::string&, bool silent, int& parse_status); #endif diff --git a/src/parse.y b/src/parse.y --- a/src/parse.y +++ b/src/parse.y @@ -101,7 +101,7 @@ int current_input_column = 1; // Buffer for help text snagged from function files. -string help_buf; +std::string help_buf; // TRUE means we are using readline. // (--no-line-editing) @@ -266,7 +266,7 @@ // Make an indirect reference expression. static tree_indirect_ref * -make_indirect_ref (tree_expression *expr, const string&); +make_indirect_ref (tree_expression *expr, const std::string&); // Make a declaration command. static tree_decl_command * @@ -1405,7 +1405,7 @@ { int err_col = current_input_column - 1; - ostrstream output_buf; + std::ostrstream output_buf; if (reading_fcn_file || reading_script_file) output_buf << "parse error near line " << input_line_number @@ -1626,7 +1626,7 @@ { tree_constant *tc_retval = new tree_constant (tmp); - ostrstream buf; + std::ostrstream buf; tree_print_code tpc (buf); @@ -1675,7 +1675,7 @@ { tree_constant *tc_retval = new tree_constant (tmp); - ostrstream buf; + std::ostrstream buf; tree_print_code tpc (buf); @@ -1733,7 +1733,7 @@ { tree_constant *tc_retval = new tree_constant (tmp); - ostrstream buf; + std::ostrstream buf; tree_print_code tpc (buf); @@ -2370,7 +2370,7 @@ static octave_user_function * frob_function (tree_identifier *id, octave_user_function *fcn) { - string id_name = id->name (); + std::string id_name = id->name (); // If input is coming from a file, issue a warning if the name of // the file does not match the name of the function stated in the @@ -2404,7 +2404,7 @@ if (Vwarn_future_time_stamp) { - string nm = fcn->fcn_file_name (); + std::string nm = fcn->fcn_file_name (); file_stat fs (nm); @@ -2490,7 +2490,7 @@ // Make an indirect reference expression. static tree_indirect_ref * -make_indirect_ref (tree_expression *expr, const string& elt) +make_indirect_ref (tree_expression *expr, const std::string& elt) { tree_indirect_ref *retval = 0; @@ -2565,7 +2565,7 @@ { tree_constant *tc_retval = new tree_constant (tmp); - ostrstream buf; + std::ostrstream buf; tree_print_code tpc (buf); @@ -2710,7 +2710,7 @@ } void -parse_and_execute (const string& s, bool verbose, const char *warn_for) +parse_and_execute (const std::string& s, bool verbose, const char *warn_for) { unwind_protect::begin_frame ("parse_and_execute_2"); @@ -2751,11 +2751,11 @@ } static bool -looks_like_octave_copyright (const string& s) +looks_like_octave_copyright (const std::string& s) { bool retval = false; - string t = s.substr (0, 14); + std::string t = s.substr (0, 14); if (t == "Copyright (C) ") { @@ -2793,7 +2793,7 @@ static string gobble_leading_white_space (FILE *ffile, bool in_parts, bool update_pos) { - string help_txt; + std::string help_txt; bool first_comments_seen = false; bool begin_comment = false; @@ -2904,9 +2904,9 @@ } string -get_help_from_file (const string& path) +get_help_from_file (const std::string& path) { - string retval; + std::string retval; if (! path.empty ()) { @@ -2965,7 +2965,7 @@ } static bool -parse_fcn_file (const string& ff, bool exec_script, bool force_script = false) +parse_fcn_file (const std::string& ff, bool exec_script, bool force_script = false) { unwind_protect::begin_frame ("parse_fcn_file"); @@ -3084,7 +3084,7 @@ { bool script_file_executed = false; - string nm = sym_rec->name (); + std::string nm = sym_rec->name (); if (octave_dynamic_loader::load (nm)) { @@ -3092,7 +3092,7 @@ } else { - string ff = fcn_file_in_path (nm); + std::string ff = fcn_file_in_path (nm); // These are needed by yyparse. @@ -3130,11 +3130,11 @@ if (nargin == 1) { - string file_name = args(0).string_value (); + std::string file_name = args(0).string_value (); if (! error_state) { - string file_full_name = file_ops::tilde_expand (file_name); + std::string file_full_name = file_ops::tilde_expand (file_name); unwind_protect::begin_frame ("Fsource"); @@ -3162,7 +3162,7 @@ } octave_value_list -feval (const string& name, const octave_value_list& args, int nargout) +feval (const std::string& name, const octave_value_list& args, int nargout) { octave_value_list retval; @@ -3181,7 +3181,7 @@ if (args.length () > 0) { - string name = args(0).string_value (); + std::string name = args(0).string_value (); if (! error_state) { @@ -3248,7 +3248,7 @@ } octave_value_list -eval_string (const string& s, bool silent, int& parse_status, int nargout) +eval_string (const std::string& s, bool silent, int& parse_status, int nargout) { unwind_protect::begin_frame ("eval_string"); @@ -3295,7 +3295,7 @@ } octave_value -eval_string (const string& s, bool silent, int& parse_status) +eval_string (const std::string& s, bool silent, int& parse_status) { octave_value retval; @@ -3311,11 +3311,11 @@ eval_string (const octave_value& arg, bool silent, int& parse_status, int nargout) { - string s = arg.string_value (); + std::string s = arg.string_value (); if (error_state) { - error ("eval: expecting string argument"); + error ("eval: expecting std::string argument"); return -1.0; } diff --git a/src/pr-output.cc b/src/pr-output.cc --- a/src/pr-output.cc +++ b/src/pr-output.cc @@ -73,11 +73,11 @@ // smaller slices that fit on the screen. static bool Vsplit_long_rows; -// Current format string for real numbers and the real part of complex +// Current format std::string for real numbers and the real part of complex // numbers. static char *curr_real_fmt = 0; -// Current format string for the imaginary part of complex numbers. +// Current format std::string for the imaginary part of complex numbers. static char *curr_imag_fmt = 0; // TRUE means don't do any fancy formatting. @@ -942,7 +942,7 @@ while (0) static void -pr_any_float (const char *fmt, ostream& os, double d, int fw = 0) +pr_any_float (const char *fmt, std::ostream& os, double d, int fw = 0) { #if defined (SCO) // Apparently on some SCO systems NaN == -0.0 is true. Compiler bug? @@ -1058,19 +1058,19 @@ } static inline void -pr_float (ostream& os, double d, int fw = 0) +pr_float (std::ostream& os, double d, int fw = 0) { pr_any_float (curr_real_fmt, os, d, fw); } static inline void -pr_imag_float (ostream& os, double d, int fw = 0) +pr_imag_float (std::ostream& os, double d, int fw = 0) { pr_any_float (curr_imag_fmt, os, d, fw); } static void -pr_complex (ostream& os, const Complex& c, int r_fw = 0, int i_fw = 0) +pr_complex (std::ostream& os, const Complex& c, int r_fw = 0, int i_fw = 0) { double r = c.real (); pr_float (os, r, r_fw); @@ -1097,7 +1097,7 @@ } static void -print_empty_matrix (ostream& os, int nr, int nc, bool pr_as_read_syntax) +print_empty_matrix (std::ostream& os, int nr, int nc, bool pr_as_read_syntax) { assert (nr == 0 || nc == 0); @@ -1117,7 +1117,7 @@ } static void -pr_scale_header (ostream& os, double scale) +pr_scale_header (std::ostream& os, double scale) { if (Vfixed_point_format && scale != 1.0) { @@ -1129,7 +1129,7 @@ } static void -pr_col_num_header (ostream& os, int total_width, int max_width, +pr_col_num_header (std::ostream& os, int total_width, int max_width, int lim, int col, int extra_indent) { if (total_width > max_width && Vsplit_long_rows) @@ -1154,7 +1154,7 @@ } static inline void -do_plus_format (ostream& os, double d) +do_plus_format (std::ostream& os, double d) { if (d == 0.0) os << " "; @@ -1165,7 +1165,7 @@ } void -octave_print_internal (ostream& os, double d, bool pr_as_read_syntax) +octave_print_internal (std::ostream& os, double d, bool pr_as_read_syntax) { if (plus_format) { @@ -1182,7 +1182,7 @@ } void -octave_print_internal (ostream& os, const Matrix& m, bool pr_as_read_syntax, +octave_print_internal (std::ostream& os, const Matrix& m, bool pr_as_read_syntax, int extra_indent) { int nr = m.rows (); @@ -1316,7 +1316,7 @@ } static inline void -do_plus_format (ostream& os, const Complex& c) +do_plus_format (std::ostream& os, const Complex& c) { double rp = c.real (); double ip = c.imag (); @@ -1335,7 +1335,7 @@ } void -octave_print_internal (ostream& os, const Complex& c, +octave_print_internal (std::ostream& os, const Complex& c, bool pr_as_read_syntax) { if (plus_format) @@ -1353,7 +1353,7 @@ } void -octave_print_internal (ostream& os, const ComplexMatrix& cm, +octave_print_internal (std::ostream& os, const ComplexMatrix& cm, bool pr_as_read_syntax, int extra_indent) { int nr = cm.rows (); @@ -1488,7 +1488,7 @@ } void -octave_print_internal (ostream& os, const Range& r, +octave_print_internal (std::ostream& os, const Range& r, bool pr_as_read_syntax, int extra_indent) { double base = r.base (); @@ -1594,7 +1594,7 @@ } void -octave_print_internal (ostream& os, const boolMatrix& bm, +octave_print_internal (std::ostream& os, const boolMatrix& bm, bool pr_as_read_syntax, int extra_indent) { @@ -1603,7 +1603,7 @@ } void -octave_print_internal (ostream& os, const charMatrix& chm, +octave_print_internal (std::ostream& os, const charMatrix& chm, bool pr_as_read_syntax, int /* extra_indent XXX FIXME XXX */, bool pr_as_string) @@ -1619,7 +1619,7 @@ { for (int i = 0; i < nstr; i++) { - string row = chm.row_as_string (i); + std::string row = chm.row_as_string (i); if (pr_as_read_syntax) { @@ -1701,7 +1701,7 @@ if (--argc > 0) { - string arg = argv[idx++]; + std::string arg = argv[idx++]; if (arg == "short") { diff --git a/src/pr-output.h b/src/pr-output.h --- a/src/pr-output.h +++ b/src/pr-output.h @@ -34,35 +34,35 @@ class charMatrix; extern void -octave_print_internal (ostream& os, double d, +octave_print_internal (std::ostream& os, double d, bool pr_as_read_syntax = false); extern void -octave_print_internal (ostream& os, const Matrix& m, +octave_print_internal (std::ostream& os, const Matrix& m, bool pr_as_read_syntax = false, int extra_indent = 0); extern void -octave_print_internal (ostream& os, const Complex& c, +octave_print_internal (std::ostream& os, const Complex& c, bool pr_as_read_syntax = false); extern void -octave_print_internal (ostream& os, const ComplexMatrix& cm, +octave_print_internal (std::ostream& os, const ComplexMatrix& cm, bool pr_as_read_syntax = false, int extra_indent = 0); extern void -octave_print_internal (ostream& os, const Range& r, +octave_print_internal (std::ostream& os, const Range& r, bool pr_as_read_syntax = false, int extra_indent = 0); extern void -octave_print_internal (ostream& os, const boolMatrix& m, +octave_print_internal (std::ostream& os, const boolMatrix& m, bool pr_as_read_syntax = false, int extra_indent = 0); extern void -octave_print_internal (ostream& os, const charMatrix& chm, +octave_print_internal (std::ostream& os, const charMatrix& chm, bool pr_as_read_syntax = false, int extra_indent = 0, bool pr_as_string = false); diff --git a/src/pt-assign.h b/src/pt-assign.h --- a/src/pt-assign.h +++ b/src/pt-assign.h @@ -71,7 +71,7 @@ void eval_error (void); - string oper (void) const; + std::string oper (void) const; tree_expression *left_hand_side (void) { return lhs; } @@ -139,7 +139,7 @@ void eval_error (void); - string oper (void) const; + std::string oper (void) const; tree_argument_list *left_hand_side (void) { return lhs; } diff --git a/src/pt-binop.cc b/src/pt-binop.cc --- a/src/pt-binop.cc +++ b/src/pt-binop.cc @@ -199,7 +199,7 @@ string tree_boolean_expression::oper (void) const { - string retval = ""; + std::string retval = ""; switch (etype) { diff --git a/src/pt-binop.h b/src/pt-binop.h --- a/src/pt-binop.h +++ b/src/pt-binop.h @@ -71,7 +71,7 @@ void eval_error (void); - string oper (void) const; + std::string oper (void) const; tree_expression *lhs (void) { return op_lhs; } tree_expression *rhs (void) { return op_rhs; } @@ -126,7 +126,7 @@ octave_value_list rvalue (int nargout); - string oper (void) const; + std::string oper (void) const; private: diff --git a/src/pt-check.cc b/src/pt-check.cc --- a/src/pt-check.cc +++ b/src/pt-check.cc @@ -622,7 +622,7 @@ } void -tree_checker::gripe (const string& msg, int line) +tree_checker::gripe (const std::string& msg, int line) { if (curr_fcn_file_name.empty ()) error ("%s", msg.c_str ()); diff --git a/src/pt-check.h b/src/pt-check.h --- a/src/pt-check.h +++ b/src/pt-check.h @@ -129,7 +129,7 @@ bool do_lvalue_check; - void gripe (const string& msg, int line); + void gripe (const std::string& msg, int line); // No copying! diff --git a/src/pt-cmd.h b/src/pt-cmd.h --- a/src/pt-cmd.h +++ b/src/pt-cmd.h @@ -63,7 +63,7 @@ { public: - tree_no_op_command (const string& cmd = "no_op", int l = -1, int c = -1) + tree_no_op_command (const std::string& cmd = "no_op", int l = -1, int c = -1) : tree_command (l, c), orig_cmd (cmd) { } ~tree_no_op_command (void) { } @@ -72,11 +72,11 @@ void accept (tree_walker& tw); - string original_command (void) { return orig_cmd; } + std::string original_command (void) { return orig_cmd; } private: - string orig_cmd; + std::string orig_cmd; // No copying! diff --git a/src/pt-colon.cc b/src/pt-colon.cc --- a/src/pt-colon.cc +++ b/src/pt-colon.cc @@ -158,7 +158,7 @@ } void -tree_colon_expression::eval_error (const string& s) +tree_colon_expression::eval_error (const std::string& s) { if (error_state > 0) { diff --git a/src/pt-colon.h b/src/pt-colon.h --- a/src/pt-colon.h +++ b/src/pt-colon.h @@ -72,7 +72,7 @@ octave_value_list rvalue (int nargout); - void eval_error (const string& s = string ()); + void eval_error (const std::string& s = std::string ()); tree_expression *base (void) { return op_base; } diff --git a/src/pt-const.cc b/src/pt-const.cc --- a/src/pt-const.cc +++ b/src/pt-const.cc @@ -42,7 +42,7 @@ tree_constant::allocator (sizeof (tree_constant), 1024); void -tree_constant::print (ostream& os, bool pr_as_read_syntax, bool pr_orig_text) +tree_constant::print (std::ostream& os, bool pr_as_read_syntax, bool pr_orig_text) { if (pr_orig_text && ! orig_text.empty ()) os << orig_text; @@ -51,7 +51,7 @@ } void -tree_constant::print_raw (ostream& os, bool pr_as_read_syntax, +tree_constant::print_raw (std::ostream& os, bool pr_as_read_syntax, bool pr_orig_text) { if (pr_orig_text && ! orig_text.empty ()) diff --git a/src/pt-const.h b/src/pt-const.h --- a/src/pt-const.h +++ b/src/pt-const.h @@ -67,10 +67,10 @@ void maybe_mutate (void) { val.maybe_mutate (); } - void print (ostream& os, bool pr_as_read_syntax = false, + void print (std::ostream& os, bool pr_as_read_syntax = false, bool pr_orig_txt = true); - void print_raw (ostream& os, bool pr_as_read_syntax = false, + void print_raw (std::ostream& os, bool pr_as_read_syntax = false, bool pr_orig_txt = true); bool rvalue_ok (void) const @@ -86,10 +86,10 @@ // Store the original text corresponding to this constant for later // pretty printing. - void stash_original_text (const string& s) + void stash_original_text (const std::string& s) { orig_text = s; } - string original_text (void) const + std::string original_text (void) const { return orig_text; } private: @@ -101,7 +101,7 @@ octave_value val; // The original text form of this constant. - string orig_text; + std::string orig_text; // No copying! diff --git a/src/pt-decl.h b/src/pt-decl.h --- a/src/pt-decl.h +++ b/src/pt-decl.h @@ -115,10 +115,10 @@ { public: - tree_decl_command (const string& n, int l = -1, int c = -1) + tree_decl_command (const std::string& n, int l = -1, int c = -1) : tree_command (l, c), cmd_name (n), initialized (false), init_list (0) { } - tree_decl_command (const string& n, tree_decl_init_list *t, + tree_decl_command (const std::string& n, tree_decl_init_list *t, int l = -1, int c = -1) : tree_command (l, c), cmd_name (n), initialized (false), init_list (t) { } @@ -128,12 +128,12 @@ void accept (tree_walker& tw); - string name (void) { return cmd_name; } + std::string name (void) { return cmd_name; } protected: // The name of this command -- global, static, etc. - string cmd_name; + std::string cmd_name; // TRUE if this command has been evaluated. bool initialized; diff --git a/src/pt-exp.cc b/src/pt-exp.cc --- a/src/pt-exp.cc +++ b/src/pt-exp.cc @@ -85,7 +85,7 @@ string tree_expression::original_text (void) const { - return string (); + return std::string (); } /* diff --git a/src/pt-exp.h b/src/pt-exp.h --- a/src/pt-exp.h +++ b/src/pt-exp.h @@ -91,13 +91,13 @@ bool print_result (void) const { return print_flag; } - virtual string oper (void) const + virtual std::string oper (void) const { return ""; } - virtual string name (void) const + virtual std::string name (void) const { return ""; } - virtual string original_text (void) const; + virtual std::string original_text (void) const; tree_expression *mark_in_parens (void) { diff --git a/src/pt-id.cc b/src/pt-id.cc --- a/src/pt-id.cc +++ b/src/pt-id.cc @@ -44,7 +44,7 @@ string tree_identifier::name (void) const { - string retval; + std::string retval; if (sym) retval = sym->name (); return retval; @@ -58,7 +58,7 @@ } void -tree_identifier::document (const string& s) +tree_identifier::document (const std::string& s) { if (sym) sym->document (s); diff --git a/src/pt-id.h b/src/pt-id.h --- a/src/pt-id.h +++ b/src/pt-id.h @@ -59,11 +59,11 @@ bool is_identifier (void) const { return true; } - string name (void) const; + std::string name (void) const; tree_identifier *define (octave_function *f, unsigned int sym_type); - void document (const string& s); + void document (const std::string& s); bool is_defined (void); diff --git a/src/pt-idx.h b/src/pt-idx.h --- a/src/pt-idx.h +++ b/src/pt-idx.h @@ -54,7 +54,7 @@ bool is_index_expression (void) const { return true; } - string name (void) const; + std::string name (void) const; tree_expression *expression (void) { return expr; } diff --git a/src/pt-indir.cc b/src/pt-indir.cc --- a/src/pt-indir.cc +++ b/src/pt-indir.cc @@ -50,7 +50,7 @@ tree_indirect_ref::name (void) const { // ??? FIXME ??? - string xname = expr->name (); + std::string xname = expr->name (); return (xname == "") ? xname : xname + "." + nm; } @@ -76,7 +76,7 @@ { // ??? FIXME ??? - string xname = name (); + std::string xname = name (); if (xname == "") bind_ans (val, true); diff --git a/src/pt-indir.h b/src/pt-indir.h --- a/src/pt-indir.h +++ b/src/pt-indir.h @@ -46,7 +46,7 @@ tree_indirect_ref (int l = -1, int c = -1) : tree_expression (l, c), expr (0), nm () { } - tree_indirect_ref (tree_expression *e, const string& n, + tree_indirect_ref (tree_expression *e, const std::string& n, int l = -1, int c = -1) : tree_expression (l, c), expr (e), nm (n) { } @@ -55,7 +55,7 @@ bool is_indirect_ref (void) const { return true; } - string name (void) const; + std::string name (void) const; bool lvalue_ok (void) const { return true; } @@ -69,7 +69,7 @@ tree_expression *expression (void) { return expr; } - string elt_name (void) + std::string elt_name (void) { return nm; } void accept (tree_walker& tw); @@ -80,7 +80,7 @@ tree_expression *expr; // The sub-element name. - string nm; + std::string nm; void eval_error (void) const; diff --git a/src/pt-mat.cc b/src/pt-mat.cc --- a/src/pt-mat.cc +++ b/src/pt-mat.cc @@ -585,7 +585,7 @@ { int status = 0; - string s = builtin_string_variable ("string_fill_char"); + std::string s = builtin_string_variable ("string_fill_char"); switch (s.length ()) { diff --git a/src/pt-mat.h b/src/pt-mat.h --- a/src/pt-mat.h +++ b/src/pt-mat.h @@ -27,7 +27,7 @@ #pragma interface #endif -class ostream; +#include class octave_value; class octave_value_list; diff --git a/src/pt-plot.cc b/src/pt-plot.cc --- a/src/pt-plot.cc +++ b/src/pt-plot.cc @@ -68,7 +68,7 @@ static bool Vautomatic_replot; // The name of the shell command to execute to start gnuplot. -static string Vgnuplot_binary; +static std::string Vgnuplot_binary; // TRUE if gnuplot appears to support multiple plot windows with X11. static bool Vgnuplot_has_frames; @@ -92,7 +92,7 @@ // // XXX FIXME XXX -- this should really be static, but that causes // problems on some systems. -SLStack tmp_files; +SLStack tmp_files; // Pipe to gnuplot. static oprocstream *plot_stream = 0; @@ -101,14 +101,14 @@ static pid_t plot_stream_pid = 0; // Gnuplot command strings that we use. -static string Vgnuplot_command_plot; -static string Vgnuplot_command_replot; -static string Vgnuplot_command_splot; -static string Vgnuplot_command_using; -static string Vgnuplot_command_with; -static string Vgnuplot_command_axes; -static string Vgnuplot_command_title; -static string Vgnuplot_command_end; +static std::string Vgnuplot_command_plot; +static std::string Vgnuplot_command_replot; +static std::string Vgnuplot_command_splot; +static std::string Vgnuplot_command_using; +static std::string Vgnuplot_command_with; +static std::string Vgnuplot_command_axes; +static std::string Vgnuplot_command_title; +static std::string Vgnuplot_command_end; static void plot_stream_death_handler (pid_t pid, int) @@ -136,7 +136,7 @@ plot_line_count = 0; - string plot_prog = Vgnuplot_binary; + std::string plot_prog = Vgnuplot_binary; if (plot_prog.empty ()) plot_prog = "gnuplot"; @@ -245,7 +245,7 @@ open_plot_stream (); - ostrstream plot_buf; + std::ostrstream plot_buf; switch (ndim) { @@ -346,7 +346,7 @@ } void -plot_limits::print (int ndim, ostrstream& plot_buf) +plot_limits::print (int ndim, std::ostrstream& plot_buf) { if (ndim == 2 || ndim == 3) { @@ -378,7 +378,7 @@ } void -plot_range::print (ostrstream& plot_buf) +plot_range::print (std::ostrstream& plot_buf) { plot_buf << " ["; @@ -501,7 +501,7 @@ } int -subplot_using::print (int ndim, int n_max, ostrstream& plot_buf) +subplot_using::print (int ndim, int n_max, std::ostrstream& plot_buf) { int status = eval (ndim, n_max); @@ -534,7 +534,7 @@ } int -subplot_style::print (ostrstream& plot_buf) +subplot_style::print (std::ostrstream& plot_buf) { if (! sp_style.empty ()) { @@ -626,7 +626,7 @@ } int -subplot_axes::print (ostrstream& plot_buf) +subplot_axes::print (std::ostrstream& plot_buf) { if (! sp_axes.empty ()) plot_buf << " " << Vgnuplot_command_axes << " " << sp_axes; @@ -682,7 +682,7 @@ } int -subplot::handle_plot_data (int ndim, ostrstream& plot_buf) +subplot::handle_plot_data (int ndim, std::ostrstream& plot_buf) { if (sp_plot_data) { @@ -690,7 +690,7 @@ if (! error_state && data.is_defined ()) { - string file; + std::string file; if (data.is_string ()) { @@ -702,7 +702,7 @@ file = file_ops::tilde_expand (data.string_value ()); - ifstream ftmp (file.c_str ()); + std::ifstream ftmp (file.c_str ()); if (ftmp) { @@ -769,7 +769,7 @@ } int -subplot::print (int ndim, ostrstream& plot_buf) +subplot::print (int ndim, std::ostrstream& plot_buf) { int status = handle_plot_data (ndim, plot_buf); @@ -827,7 +827,7 @@ } int -subplot_list::print (int ndim, ostrstream& plot_buf) +subplot_list::print (int ndim, std::ostrstream& plot_buf) { int status = 0; @@ -858,11 +858,11 @@ string save_in_tmp_file (octave_value& t, int ndim, bool parametric) { - string name = file_ops::tempnam ("", "oct-"); + std::string name = file_ops::tempnam ("", "oct-"); if (! name.empty ()) { - ofstream file (name.c_str ()); + std::ofstream file (name.c_str ()); if (file) { @@ -892,7 +892,7 @@ } void -mark_for_deletion (const string& file) +mark_for_deletion (const std::string& file) { tmp_files.push (file); } @@ -902,7 +902,7 @@ { while (! tmp_files.empty ()) { - string filename = tmp_files.pop (); + std::string filename = tmp_files.pop (); unlink (filename.c_str ()); } } @@ -923,11 +923,11 @@ } void -do_external_plotter_cd (const string& newdir) +do_external_plotter_cd (const std::string& newdir) { if (plot_stream && *plot_stream) { - ostrstream plot_buf; + std::ostrstream plot_buf; plot_buf << "cd \"" << newdir << "\"" << Vgnuplot_command_end << ends; char *message = plot_buf.str (); send_to_plot_stream (message); @@ -1074,7 +1074,7 @@ if (args.length () == 1 && args(0).is_string ()) { - string cmd = args(0).string_value (); + std::string cmd = args(0).string_value (); if (! (plot_stream && *plot_stream)) open_plot_stream (); @@ -1107,7 +1107,7 @@ if (error_state) return retval; - ostrstream plot_buf; + std::ostrstream plot_buf; if (argc > 1) { @@ -1118,7 +1118,7 @@ else if (almost_match ("term", argv[1], 1)) { delete [] gnuplot_terminal_type; - ostrstream buf; + std::ostrstream buf; int i; for (i = 2; i < argc-1; i++) buf << argv[i] << " "; @@ -1169,7 +1169,7 @@ if (error_state) return retval; - ostrstream plot_buf; + std::ostrstream plot_buf; int i; for (i = 0; i < argc-1; i++) @@ -1204,11 +1204,11 @@ } static int -set_string_var (string& var, const char *nm) +set_string_var (std::string& var, const char *nm) { int retval = 0; - string s = builtin_string_variable (nm); + std::string s = builtin_string_variable (nm); if (s.empty ()) { diff --git a/src/pt-plot.h b/src/pt-plot.h --- a/src/pt-plot.h +++ b/src/pt-plot.h @@ -102,7 +102,7 @@ ~plot_limits (void); - void print (int ndim, ostrstream& plot_buf); + void print (int ndim, std::ostrstream& plot_buf); plot_range *x_limits (void) { return x_range; } plot_range *y_limits (void) { return y_range; } @@ -135,7 +135,7 @@ ~plot_range (void); - void print (ostrstream& plot_buf); + void print (std::ostrstream& plot_buf); tree_expression *lower_bound (void) { return lower; } @@ -190,7 +190,7 @@ ColumnVector values (int ndim, int n_max = 0); - int print (int ndim, int n_max, ostrstream& plot_buf); + int print (int ndim, int n_max, std::ostrstream& plot_buf); int qualifier_count (void) { return qual_count; } @@ -229,17 +229,17 @@ { public: - subplot_style (const string& s = string (), + subplot_style (const std::string& s = std::string (), tree_expression *lt = 0, tree_expression *pt = 0) : sp_style (s), sp_linetype (lt), sp_pointtype (pt) { } ~subplot_style (void); - int print (ostrstream& plot_buf); + int print (std::ostrstream& plot_buf); bool columns_ok (int nc); - string style (void) { return sp_style; } + std::string style (void) { return sp_style; } tree_expression *linetype (void) { return sp_linetype; } @@ -250,7 +250,7 @@ private: // The style we are using: `lines', `points', etc. - string sp_style; + std::string sp_style; // The number of the line type to use. tree_expression *sp_linetype; @@ -270,21 +270,21 @@ { public: - subplot_axes (const string& s = string ()) + subplot_axes (const std::string& s = std::string ()) : sp_axes (s) { } ~subplot_axes (void) { } - int print (ostrstream& plot_buf); + int print (std::ostrstream& plot_buf); - string axes (void) { return sp_axes; } + std::string axes (void) { return sp_axes; } void accept (tree_walker& tw); private: // The axes we are using: `x1y1', `x1y2', etc. - string sp_axes; + std::string sp_axes; // No copying! @@ -356,9 +356,9 @@ octave_value extract_plot_data (int ndim, octave_value& data); - int handle_plot_data (int ndim, ostrstream& plot_buf); + int handle_plot_data (int ndim, std::ostrstream& plot_buf); - int print (int ndim, ostrstream& plot_buf); + int print (int ndim, std::ostrstream& plot_buf); tree_expression *plot_data (void) { return sp_plot_data; } @@ -409,7 +409,7 @@ ~subplot_list (void); - int print (int ndim, ostrstream& plot_buf); + int print (int ndim, std::ostrstream& plot_buf); void accept (tree_walker& tw); @@ -422,16 +422,16 @@ subplot_list& operator = (const subplot_list&); }; -extern string save_in_tmp_file (octave_value& t, int ndim = 2, +extern std::string save_in_tmp_file (octave_value& t, int ndim = 2, bool parametric = false); -extern void mark_for_deletion (const string&); +extern void mark_for_deletion (const std::string&); extern void cleanup_tmp_files (void); extern void close_plot_stream (void); -extern void do_external_plotter_cd (const string& newdir); +extern void do_external_plotter_cd (const std::string& newdir); #endif diff --git a/src/pt-pr-code.cc b/src/pt-pr-code.cc --- a/src/pt-pr-code.cc +++ b/src/pt-pr-code.cc @@ -302,9 +302,9 @@ os << " = "; } - string fcn_name = fcn.function_name (); + std::string fcn_name = fcn.function_name (); - os << (fcn_name.empty () ? string ("(empty)") : fcn_name) << " "; + os << (fcn_name.empty () ? std::string ("(empty)") : fcn_name) << " "; tree_parameter_list *param_list = fcn.parameter_list (); @@ -357,8 +357,8 @@ print_parens (id, "("); - string nm = id.name (); - os << (nm.empty () ? string ("(empty)") : nm); + std::string nm = id.name (); + os << (nm.empty () ? std::string ("(empty)") : nm); print_parens (id, ")"); } diff --git a/src/pt-pr-code.h b/src/pt-pr-code.h --- a/src/pt-pr-code.h +++ b/src/pt-pr-code.h @@ -40,7 +40,7 @@ { public: - tree_print_code (ostream& os_arg, const string& pfx = string (), + tree_print_code (std::ostream& os_arg, const std::string& pfx = std::string (), bool pr_orig_txt = true) : os (os_arg), prefix (pfx), print_original_text (pr_orig_txt) { } @@ -142,9 +142,9 @@ private: - ostream& os; + std::ostream& os; - string prefix; + std::string prefix; bool print_original_text; diff --git a/src/pt-unop.h b/src/pt-unop.h --- a/src/pt-unop.h +++ b/src/pt-unop.h @@ -58,7 +58,7 @@ tree_expression *operand (void) { return op; } - string oper (void) const; + std::string oper (void) const; protected: diff --git a/src/pt.cc b/src/pt.cc --- a/src/pt.cc +++ b/src/pt.cc @@ -41,7 +41,7 @@ string tree::str_print_code (void) { - ostrstream buf; + std::ostrstream buf; tree_print_code tpc (buf); @@ -51,7 +51,7 @@ const char *s = buf.str (); - string retval = s; + std::string retval = s; delete [] s; diff --git a/src/pt.h b/src/pt.h --- a/src/pt.h +++ b/src/pt.h @@ -56,7 +56,7 @@ virtual void accept (tree_walker& tw) = 0; - string str_print_code (void); + std::string str_print_code (void); private: diff --git a/src/symtab.cc b/src/symtab.cc --- a/src/symtab.cc +++ b/src/symtab.cc @@ -61,7 +61,7 @@ string SYMBOL_DEF::type_as_string (void) const { - string retval = ""; + std::string retval = ""; if (is_user_variable ()) retval = "user-defined variable"; @@ -84,18 +84,18 @@ } void -SYMBOL_DEF::type (ostream& os, const string& name, bool pr_type_info, +SYMBOL_DEF::type (std::ostream& os, const std::string& name, bool pr_type_info, bool quiet, bool pr_orig_txt) { if (is_user_function ()) { octave_function *defn = definition.function_value (); - string fn = defn ? defn->fcn_file_name () : string (); + std::string fn = defn ? defn->fcn_file_name () : std::string (); if (pr_orig_txt && ! fn.empty ()) { - ifstream fs (fn.c_str (), ios::in); + std::ifstream fs (fn.c_str (), ios::in); if (fs) { @@ -138,9 +138,9 @@ } string -SYMBOL_DEF::which (const string& name) +SYMBOL_DEF::which (const std::string& name) { - string retval; + std::string retval; if (is_user_function () || is_dld_function ()) { @@ -156,7 +156,7 @@ } void -SYMBOL_DEF::which (ostream& os, const string& name) +SYMBOL_DEF::which (std::ostream& os, const std::string& name) { os << name; @@ -164,7 +164,7 @@ { octave_function *defn = definition.function_value (); - string fn = defn ? defn->fcn_file_name () : string (); + std::string fn = defn ? defn->fcn_file_name () : std::string (); if (! fn.empty ()) { @@ -192,7 +192,7 @@ // probably be temporarily ignoring interrupts. void -symbol_record::rename (const string& new_name) +symbol_record::rename (const std::string& new_name) { if (! read_only_error ("rename")) nm = new_name; @@ -445,7 +445,7 @@ } void -symbol_record::print_symbol_info_line (ostream& os) +symbol_record::print_symbol_info_line (std::ostream& os) { os << (is_read_only () ? " r-" : " rw") << (is_eternal () ? "-" : "d") @@ -541,7 +541,7 @@ // A symbol table. symbol_record * -symbol_table::lookup (const string& nm, bool insert, bool warn) +symbol_table::lookup (const std::string& nm, bool insert, bool warn) { unsigned int index = hash (nm); @@ -570,7 +570,7 @@ } void -symbol_table::rename (const string& old_name, const string& new_name) +symbol_table::rename (const std::string& old_name, const std::string& new_name) { unsigned int index = hash (old_name); @@ -627,7 +627,7 @@ } bool -symbol_table::clear (const string& nm, bool clear_user_functions) +symbol_table::clear (const std::string& nm, bool clear_user_functions) { unsigned int index = hash (nm); @@ -669,7 +669,7 @@ } static bool -matches_patterns (const string& name, const string_vector& pats) +matches_patterns (const std::string& name, const string_vector& pats) { int npats = pats.length (); @@ -706,7 +706,7 @@ unsigned int my_type = ptr->type (); - string my_name = ptr->name (); + std::string my_name = ptr->name (); if ((type & my_type) && (scope & my_scope) && matches_patterns (my_name, pats)) @@ -751,15 +751,15 @@ const symbol_record *a = *(X_CAST (const symbol_record **, a_arg)); const symbol_record *b = *(X_CAST (const symbol_record **, b_arg)); - string a_nm = a->name (); - string b_nm = b->name (); + std::string a_nm = a->name (); + std::string b_nm = b->name (); return a_nm.compare (b_nm); } int symbol_table::maybe_list (const char *header, const string_vector& argv, - ostream& os, bool show_verbose, + std::ostream& os, bool show_verbose, unsigned type, unsigned scope) { int status = 0; @@ -802,7 +802,7 @@ } Array -symbol_table::glob (const string& pat, unsigned int type, +symbol_table::glob (const std::string& pat, unsigned int type, unsigned int scope) const { int count = 0; @@ -926,7 +926,7 @@ // Chris Torek's fave hash function. unsigned int -symbol_table::hash (const string& str) +symbol_table::hash (const std::string& str) { unsigned int h = 0; diff --git a/src/symtab.h b/src/symtab.h --- a/src/symtab.h +++ b/src/symtab.h @@ -124,7 +124,7 @@ { return (symbol_type & symbol_record::DLD_FUNCTION); } // XXX FIXME XXX - bool is_map_element (const string& /* elts */) const + bool is_map_element (const std::string& /* elts */) const { return false; } bool is_defined (void) const @@ -139,16 +139,16 @@ int rows (void) const { return definition.rows (); } int columns (void) const { return definition.columns (); } - string type_name (void) const { return definition.type_name (); } + std::string type_name (void) const { return definition.type_name (); } - string type_as_string (void) const; + std::string type_as_string (void) const; - void type (ostream& os, const string& name, bool pr_type_info, + void type (std::ostream& os, const std::string& name, bool pr_type_info, bool quiet, bool pr_orig_txt); - string which (const string& name); + std::string which (const std::string& name); - void which (ostream& os, const string& name); + void which (std::ostream& os, const std::string& name); void define (const octave_value& val, unsigned int sym_type) { @@ -164,9 +164,9 @@ octave_value& def (void) { return definition; } - string help (void) const { return help_string; } + std::string help (void) const { return help_string; } - void document (const string& h) { help_string = h; } + void document (const std::string& h) { help_string = h; } unsigned int type (void) { return symbol_type; } @@ -188,7 +188,7 @@ unsigned int read_only : 1; // The doc string associated with this variable. - string help_string; + std::string help_string; // The value of this definition. See ov.h and related files. octave_value definition; @@ -219,20 +219,20 @@ nm (), chg_fcn (0), definition (new symbol_def ()), next_elem (0) { } - symbol_record (const string& n, symbol_record *nxt) + symbol_record (const std::string& n, symbol_record *nxt) : formal_param (0), linked_to_global (0), tagged_static (0), nm (n), chg_fcn (0), definition (new symbol_def ()), next_elem (nxt) { } ~symbol_record (void) { } - string name (void) const { return nm; } + std::string name (void) const { return nm; } - string help (void) const { return definition->help (); } + std::string help (void) const { return definition->help (); } octave_value& def (void) { return definition->def (); } - void rename (const string& new_name); + void rename (const std::string& new_name); bool is_function (void) const { return definition->is_function (); } @@ -267,7 +267,7 @@ bool is_builtin_variable (void) const { return definition->is_builtin_variable (); } - bool is_map_element (const string& elts) const + bool is_map_element (const std::string& elts) const { return definition->is_map_element (elts); } unsigned int type (void) const { return definition->type (); } @@ -294,7 +294,7 @@ bool define (octave_function *f, unsigned int sym_type); - void document (const string& h) { definition->document (h); } + void document (const std::string& h) { definition->document (h); } void clear (void); @@ -315,17 +315,17 @@ int rows (void) const { return definition->rows (); } int columns (void) const { return definition->columns (); } - string type_name (void) const { return definition->type_name (); } + std::string type_name (void) const { return definition->type_name (); } - string type_as_string (void) const + std::string type_as_string (void) const { return definition->type_as_string (); } - void type (ostream& os, bool pr_type_info, bool quiet, bool pr_orig_txt) + void type (std::ostream& os, bool pr_type_info, bool quiet, bool pr_orig_txt) { definition->type (os, name (), pr_type_info, quiet, pr_orig_txt); } - string which (void) { return definition->which (name ()); } + std::string which (void) { return definition->which (name ()); } - void which (ostream& os) { definition->which (os, name ()); } + void which (std::ostream& os) { definition->which (os, name ()); } octave_value& variable_value (void); octave_lvalue variable_reference (void); @@ -338,7 +338,7 @@ void pop_context (void); - void print_symbol_info_line (ostream& os); + void print_symbol_info_line (std::ostream& os); void dump_symbol_info (void); @@ -348,7 +348,7 @@ unsigned int linked_to_global : 1; unsigned int tagged_static : 1; - string nm; + std::string nm; change_function chg_fcn; symbol_def *definition; symbol_record *next_elem; @@ -410,13 +410,13 @@ delete [] table; } - symbol_record *lookup (const string& nm, bool insert = false, + symbol_record *lookup (const std::string& nm, bool insert = false, bool warn = false); - void rename (const string& old_name, const string& new_name); + void rename (const std::string& old_name, const std::string& new_name); void clear (bool clear_user_functions = true); - bool clear (const string& nm, bool clear_user_functions = true); + bool clear (const std::string& nm, bool clear_user_functions = true); int size (void) const; @@ -433,10 +433,10 @@ int maybe_list (const char *header, const string_vector& argv, - ostream& os, bool show_verbose, + std::ostream& os, bool show_verbose, unsigned type, unsigned scope); - Array glob (const string& pat = string ("*"), + Array glob (const std::string& pat = std::string ("*"), unsigned int type = SYMTAB_ALL_TYPES, unsigned int scope = SYMTAB_ALL_SCOPES) const; @@ -452,7 +452,7 @@ symbol_record *table; - unsigned int hash (const string& s); + unsigned int hash (const std::string& s); // No copying! diff --git a/src/syscalls.cc b/src/syscalls.cc --- a/src/syscalls.cc +++ b/src/syscalls.cc @@ -101,7 +101,7 @@ { octave_value_list retval; - retval(1) = string (); + retval(1) = std::string (); retval(0) = -1.0; int nargin = args.length (); @@ -123,7 +123,7 @@ if (i_old >= 0 && i_new >= 0) { - string msg; + std::string msg; int status = octave_syscalls::dup2 (i_old, i_new, msg); @@ -162,14 +162,14 @@ { octave_value_list retval; - retval(1) = string (); + retval(1) = std::string (); retval(0) = -1.0; int nargin = args.length (); if (nargin == 1 || nargin == 2) { - string exec_file = args(0).string_value (); + std::string exec_file = args(0).string_value (); if (! error_state) { @@ -202,7 +202,7 @@ if (! error_state) { - string msg; + std::string msg; int status = octave_syscalls::execvp (exec_file, exec_args, msg); @@ -275,7 +275,7 @@ { octave_value_list retval; - retval(1) = string (); + retval(1) = std::string (); retval(0) = -1.0; int nargin = args.length (); @@ -293,7 +293,7 @@ error ("fcntl: invalid file id"); else { - string msg; + std::string msg; int status = octave_syscalls::fcntl (fid, req, arg, msg); @@ -335,14 +335,14 @@ { octave_value_list retval; - retval(1) = string (); + retval(1) = std::string (); retval(0) = -1.0; int nargin = args.length (); if (nargin == 0) { - string msg; + std::string msg; pid_t pid = octave_syscalls::fork (msg); @@ -363,14 +363,14 @@ { octave_value_list retval; - retval(1) = string (); + retval(1) = std::string (); retval(0) = -1.0; int nargin = args.length (); if (nargin == 0) { - string msg; + std::string msg; retval(0) = static_cast (octave_syscalls::getpgrp (msg)); retval(1) = msg; @@ -499,7 +499,7 @@ if (args.length () == 1) { - string fname = file_ops::tilde_expand (args(0).string_value ()); + std::string fname = file_ops::tilde_expand (args(0).string_value ()); if (! error_state) { @@ -507,7 +507,7 @@ if (fs) { - retval(2) = string (); + retval(2) = std::string (); retval(1) = 0.0; retval(0) = octave_value (mk_stat_map (fs)); } @@ -539,7 +539,7 @@ { octave_value_list retval; - retval(1) = string (); + retval(1) = std::string (); retval(0) = -1.0; int nargin = args.length (); @@ -548,13 +548,13 @@ { if (args(0).is_string ()) { - string name = args(0).string_value (); + std::string name = args(0).string_value (); if (args(1).is_scalar_type ()) { long mode = static_cast (args(1).double_value ()); - string msg; + std::string msg; int status = file_ops::mkfifo (name, mode, msg); @@ -588,7 +588,7 @@ { octave_value_list retval; - retval(2) = string (); + retval(2) = std::string (); retval(1) = -1.0; retval(0) = Matrix (); @@ -598,7 +598,7 @@ { int fid[2]; - string msg; + std::string msg; int status = octave_syscalls::pipe (fid, msg); @@ -609,8 +609,8 @@ FILE *ifile = fdopen (fid[0], "r"); FILE *ofile = fdopen (fid[1], "w"); - octave_stream is = octave_istdiostream::create (string (), ifile); - octave_stream os = octave_ostdiostream::create (string (), ofile); + octave_stream is = octave_istdiostream::create (std::string (), ifile); + octave_stream os = octave_ostdiostream::create (std::string (), ofile); octave_value_list file_ids; @@ -719,7 +719,7 @@ if (args.length () == 1) { - string fname = file_ops::tilde_expand (args(0).string_value ()); + std::string fname = file_ops::tilde_expand (args(0).string_value ()); if (! error_state) { @@ -727,7 +727,7 @@ if (fs) { - retval(2) = string (); + retval(2) = std::string (); retval(1) = 0.0; retval(0) = octave_value (mk_stat_map (fs)); } @@ -757,7 +757,7 @@ { octave_value_list retval; - retval(1) = string (); + retval(1) = std::string (); retval(0) = -1.0; int nargin = args.length (); @@ -766,9 +766,9 @@ { if (args(0).is_string ()) { - string name = args(0).string_value (); + std::string name = args(0).string_value (); - string msg; + std::string msg; int status = file_ops::unlink (name, msg); @@ -827,7 +827,7 @@ { octave_value_list retval; - retval(1) = string (); + retval(1) = std::string (); retval(0) = -1.0; int nargin = args.length (); @@ -855,7 +855,7 @@ if (! error_state) { - string msg; + std::string msg; pid_t status = octave_syscalls::waitpid (pid, options, msg); diff --git a/src/sysdep.cc b/src/sysdep.cc --- a/src/sysdep.cc +++ b/src/sysdep.cc @@ -351,7 +351,7 @@ if (nargin == 1) { - string name = args(0).string_value (); + std::string name = args(0).string_value (); if (! error_state) retval = octave_env::getenv (name); @@ -374,11 +374,11 @@ if (nargin == 2) { - string var = args(0).string_value (); + std::string var = args(0).string_value (); if (! error_state) { - string val = args(1).string_value (); + std::string val = args(1).string_value (); if (! error_state) octave_env::putenv (var, val); diff --git a/src/token.cc b/src/token.cc --- a/src/token.cc +++ b/src/token.cc @@ -43,15 +43,15 @@ type_tag = generic_token; } -token::token (const string& s, int l, int c) +token::token (const std::string& s, int l, int c) { line_num = l; column_num = c; type_tag = string_token; - str = new string (s); + str = new std::string (s); } -token::token (double d, const string& s, int l, int c) +token::token (double d, const std::string& s, int l, int c) { line_num = l; column_num = c; diff --git a/src/token.h b/src/token.h --- a/src/token.h +++ b/src/token.h @@ -65,8 +65,8 @@ }; token (int l = -1, int c = -1); - token (const string& s, int l = -1, int c = -1); - token (double d, const string& s = string (), int l = -1, int c = -1); + token (const std::string& s, int l = -1, int c = -1); + token (double d, const std::string& s = std::string (), int l = -1, int c = -1); token (end_tok_type t, int l = -1, int c = -1); token (plot_tok_type t, int l = -1, int c = -1); token (symbol_record *s, int l = -1, int c = -1); @@ -76,13 +76,13 @@ int line (void) { return line_num; } int column (void) { return column_num; } - string text (void); + std::string text (void); double number (void); end_tok_type ettype (void); plot_tok_type pttype (void); symbol_record *sym_rec (void); - string text_rep (void); + std::string text_rep (void); private: token (const token& tok); @@ -93,13 +93,13 @@ token_type type_tag; union { - string *str; + std::string *str; double num; end_tok_type et; plot_tok_type pt; symbol_record *sr; }; - string orig_text; + std::string orig_text; }; #endif diff --git a/src/toplev.cc b/src/toplev.cc --- a/src/toplev.cc +++ b/src/toplev.cc @@ -222,7 +222,7 @@ if (nargin != 0) warning ("computer: ignoring extra arguments"); - string msg; + std::string msg; if (strcmp (CANONICAL_HOST_TYPE, "unknown") == 0) msg = "Hi Dave, I'm a HAL-9000"; @@ -312,7 +312,7 @@ } static octave_value_list -run_command_and_return_output (const string& cmd_str) +run_command_and_return_output (const std::string& cmd_str) { octave_value_list retval; @@ -324,7 +324,7 @@ if (*cmd) { - ostrstream output_buf; + std::ostrstream output_buf; // XXX FIXME XXX -- sometimes, the subprocess hasn't written // anything before we try to read from the procstream. The @@ -424,7 +424,7 @@ { bool return_output = (nargout > 0 || nargin > 1); - string cmd_str = args(0).string_value (); + std::string cmd_str = args(0).string_value (); enum exec_type { sync, async }; @@ -434,7 +434,7 @@ { if (nargin > 2) { - string type_str = args(2).string_value (); + std::string type_str = args(2).string_value (); if (! error_state) { @@ -450,7 +450,7 @@ } } else - error ("system: expecting string as first argument"); + error ("system: expecting std::string as first argument"); if (! error_state) { @@ -500,7 +500,7 @@ // XXX FIXME XXX -- this should really be static, but that causes // problems on some systems. -SLStack octave_atexit_functions; +SLStack octave_atexit_functions; void do_octave_atexit (void) @@ -566,7 +566,7 @@ if (nargin == 1) { #if defined (HAVE_ATEXIT) || defined (HAVE_ON_EXIT) - string arg = args(0).string_value (); + std::string arg = args(0).string_value (); if (! error_state) octave_atexit_functions.push (arg); @@ -654,7 +654,7 @@ if (nargin == 1) { - string arg = args(0).string_value (); + std::string arg = args(0).string_value (); if (! error_state) retval = octave_value (m [arg.c_str ()]); diff --git a/src/unwind-prot.cc b/src/unwind-prot.cc --- a/src/unwind-prot.cc +++ b/src/unwind-prot.cc @@ -62,7 +62,7 @@ saved_variable (int *p, int v); - saved_variable (string *p, const string& v); + saved_variable (std::string *p, const std::string& v); saved_variable (void **p, void *v); @@ -86,7 +86,7 @@ { bool bool_value; int int_value; - const string *str_value; + const std::string *str_value; void *gen_ptr_value; }; @@ -119,11 +119,11 @@ size = sizeof (int); // Is this necessary? } -saved_variable::saved_variable (string *p, const string& v) +saved_variable::saved_variable (std::string *p, const std::string& v) { type_tag = string_type; gen_ptr = p; - str_value = new string (v); + str_value = new std::string (v); size = sizeof (string); // Is this necessary? } @@ -167,7 +167,7 @@ break; case string_type: - (static_cast (gen_ptr)) -> assign (*str_value); + (static_cast (gen_ptr)) -> assign (*str_value); break; case generic_ptr: @@ -217,14 +217,14 @@ } void -unwind_protect::begin_frame (const string& tag) +unwind_protect::begin_frame (const std::string& tag) { unwind_elem elem (tag); list.push (elem); } void -unwind_protect::run_frame (const string& tag) +unwind_protect::run_frame (const std::string& tag) { while (! list.empty ()) { @@ -241,7 +241,7 @@ } void -unwind_protect::discard_frame (const string& tag) +unwind_protect::discard_frame (const std::string& tag) { while (! list.empty ()) { @@ -287,7 +287,7 @@ } void -unwind_protect::save_str (string *ptr, const string& value) +unwind_protect::save_str (std::string *ptr, const std::string& value) { saved_variable *s = new saved_variable (ptr, value); add (saved_variable::restore, s); diff --git a/src/unwind-prot.h b/src/unwind-prot.h --- a/src/unwind-prot.h +++ b/src/unwind-prot.h @@ -43,7 +43,7 @@ unwind_elem (void) : ue_tag (), ue_fptr (0), ue_ptr (0) { } - unwind_elem (const string &t) + unwind_elem (const std::string &t) : ue_tag (t), ue_fptr (0), ue_ptr (0) { } unwind_elem (cleanup_func f, void *p) @@ -63,7 +63,7 @@ return *this; } - string tag (void) { return ue_tag; } + std::string tag (void) { return ue_tag; } cleanup_func fptr (void) { return ue_fptr; } @@ -71,7 +71,7 @@ private: - string ue_tag; + std::string ue_tag; cleanup_func ue_fptr; @@ -89,11 +89,11 @@ static void discard (void); - static void begin_frame (const string& tag); + static void begin_frame (const std::string& tag); - static void run_frame (const string& tag); + static void run_frame (const std::string& tag); - static void discard_frame (const string& tag); + static void discard_frame (const std::string& tag); static void run_all (void); @@ -105,7 +105,7 @@ static void save_int (int *ptr, int value); - static void save_str (string *ptr, const string& value); + static void save_str (std::string *ptr, const std::string& value); static void save_ptr (void **ptr, void *value); diff --git a/src/utils.cc b/src/utils.cc --- a/src/utils.cc +++ b/src/utils.cc @@ -95,7 +95,7 @@ } int -almost_match (const string& std, const string& s, int min_match_len, +almost_match (const std::string& std, const std::string& s, int min_match_len, int case_sens) { int stdlen = std.length (); @@ -111,7 +111,7 @@ // Ugh. int -keyword_almost_match (const char * const *std, int *min_len, const string& s, +keyword_almost_match (const char * const *std, int *min_len, const std::string& s, int min_toks_to_match, int max_toks) { int status = 0; @@ -229,7 +229,7 @@ // See if the given file is in the path. string -search_path_for_file (const string& path, const string& name) +search_path_for_file (const std::string& path, const std::string& name) { dir_path p (path); @@ -290,7 +290,7 @@ if (argc == 3) { - string fname = search_path_for_file (argv[1], argv[2]); + std::string fname = search_path_for_file (argv[1], argv[2]); if (fname.empty ()) retval = Matrix (); @@ -304,9 +304,9 @@ } string -file_in_path (const string& name, const string& suffix) +file_in_path (const std::string& name, const std::string& suffix) { - string nm = name; + std::string nm = name; if (! suffix.empty ()) nm.append (suffix); @@ -319,9 +319,9 @@ // full path to the file. string -fcn_file_in_path (const string& name) +fcn_file_in_path (const std::string& name) { - string retval; + std::string retval; int len = name.length (); @@ -340,9 +340,9 @@ // full path to the file. string -oct_file_in_path (const string& name) +oct_file_in_path (const std::string& name) { - string retval; + std::string retval; int len = name.length (); @@ -361,9 +361,9 @@ // Replace backslash escapes in a string with the real values. string -do_string_escapes (const string& s) +do_string_escapes (const std::string& s) { - string retval; + std::string retval; size_t i = 0; size_t j = 0; @@ -507,9 +507,9 @@ } string -undo_string_escapes (const string& s) +undo_string_escapes (const std::string& s) { - string retval; + std::string retval; for (size_t i = 0; i < s.length (); i++) retval.append (undo_string_escape (s[i])); @@ -563,7 +563,7 @@ } static void -warn_old_style_preference (bool val, const string& sval) +warn_old_style_preference (bool val, const std::string& sval) { warning ("preference of \"%s\" is obsolete -- use numeric value of %d instead", @@ -578,11 +578,11 @@ // return of -1 => ok, but give me warning (default). int -check_preference (const string& var) +check_preference (const std::string& var) { int pref = -1; - string val = builtin_string_variable (var); + std::string val = builtin_string_variable (var); if (val.empty ()) { diff --git a/src/utils.h b/src/utils.h --- a/src/utils.h +++ b/src/utils.h @@ -32,30 +32,30 @@ class octave_value_list; class string_vector; -extern string search_path_for_file (const string&, const string&); -extern string file_in_path (const string&, const string&); -extern string fcn_file_in_path (const string&); -extern string oct_file_in_path (const string&); +extern std::string search_path_for_file (const std::string&, const std::string&); +extern std::string file_in_path (const std::string&, const std::string&); +extern std::string fcn_file_in_path (const std::string&); +extern std::string oct_file_in_path (const std::string&); extern void jump_to_top_level (void) GCC_ATTR_NORETURN; -extern int almost_match (const string& std, const string& s, +extern int almost_match (const std::string& std, const std::string& s, int min_match_len = 1, int case_sens = 1); extern int keyword_almost_match (const char * const *std, int *min_len, - const string& s, int min_toks_to_match, + const std::string& s, int min_toks_to_match, int max_toks); extern int empty_arg (const char *name, int nr, int nc); extern const char *undo_string_escape (char c); -extern string do_string_escapes (const string& s); +extern std::string do_string_escapes (const std::string& s); -extern string undo_string_escapes (const string& s); +extern std::string undo_string_escapes (const std::string& s); -extern int check_preference (const string& var); +extern int check_preference (const std::string& var); extern void get_dimensions (const octave_value& a, const octave_value& b, diff --git a/src/variables.cc b/src/variables.cc --- a/src/variables.cc +++ b/src/variables.cc @@ -88,7 +88,7 @@ // Is this variable a builtin? bool -is_builtin_variable (const string& name) +is_builtin_variable (const std::string& name) { symbol_record *sr = global_sym_tab->lookup (name); return (sr && sr->is_builtin_variable ()); @@ -97,7 +97,7 @@ // Is this a text-style function? bool -is_text_function_name (const string& s) +is_text_function_name (const std::string& s) { symbol_record *sr = global_sym_tab->lookup (s); return (sr && sr->is_text_function ()); @@ -106,7 +106,7 @@ // Is this a built-in function? bool -is_builtin_function_name (const string& s) +is_builtin_function_name (const std::string& s) { symbol_record *sr = global_sym_tab->lookup (s); return (sr && sr->is_builtin_function ()); @@ -115,7 +115,7 @@ // Is this a mapper function? bool -is_mapper_function_name (const string& s) +is_mapper_function_name (const std::string& s) { symbol_record *sr = global_sym_tab->lookup (s); return (sr && sr->is_mapper_function ()); @@ -124,7 +124,7 @@ // Is this function globally in this scope? bool -is_globally_visible (const string& name) +is_globally_visible (const std::string& name) { symbol_record *sr = curr_sym_tab->lookup (name); return (sr && sr->is_linked_to_global ()); @@ -133,7 +133,7 @@ // Is this octave_value a valid function? octave_function * -is_valid_function (const string& fcn_name, const string& warn_for, bool warn) +is_valid_function (const std::string& fcn_name, const std::string& warn_for, bool warn) { octave_function *ans = 0; @@ -160,11 +160,11 @@ } octave_function * -is_valid_function (const octave_value& arg, const string& warn_for, bool warn) +is_valid_function (const octave_value& arg, const std::string& warn_for, bool warn) { octave_function *ans = 0; - string fcn_name; + std::string fcn_name; if (arg.is_string ()) fcn_name = arg.string_value (); @@ -178,9 +178,9 @@ } octave_function * -extract_function (const octave_value& arg, const string& warn_for, - const string& fname, const string& header, - const string& trailer) +extract_function (const octave_value& arg, const std::string& warn_for, + const std::string& fname, const std::string& header, + const std::string& trailer) { octave_function *retval = 0; @@ -188,9 +188,9 @@ if (! retval) { - string s = arg.string_value (); + std::string s = arg.string_value (); - string cmd = header; + std::string cmd = header; cmd.append (s); cmd.append (trailer); @@ -224,7 +224,7 @@ } string_vector -get_struct_elts (const string& text) +get_struct_elts (const std::string& text) { int n = 1; @@ -261,13 +261,13 @@ } string_vector -generate_struct_completions (const string& text, string& prefix, string& hint) +generate_struct_completions (const std::string& text, std::string& prefix, std::string& hint) { string_vector names; size_t pos = text.rfind ('.'); - string id; + std::string id; string_vector elts; if (pos == NPOS) @@ -324,13 +324,13 @@ } bool -looks_like_struct (const string& text) +looks_like_struct (const std::string& text) { bool retval = true; string_vector elts = get_struct_elts (text); - string id = elts[0]; + std::string id = elts[0]; symbol_record *sr = curr_sym_tab->lookup (id); @@ -391,11 +391,11 @@ return retval; } - string name = args(0).string_value (); + std::string name = args(0).string_value (); if (error_state) { - error ("is_global: expecting string argument"); + error ("is_global: expecting std::string argument"); return retval; } @@ -430,16 +430,16 @@ return retval; } - string name = args(0).string_value (); + std::string name = args(0).string_value (); if (error_state) { - error ("exist: expecting string argument"); + error ("exist: expecting std::string argument"); return retval; } - string struct_elts; - string symbol_name = name; + std::string struct_elts; + std::string symbol_name = name; size_t pos = name.find ('.'); @@ -475,7 +475,7 @@ } else { - string path = fcn_file_in_path (name); + std::string path = fcn_file_in_path (name); if (path.length () > 0) { @@ -491,7 +491,7 @@ } else { - string file_name = file_in_path (name, ""); + std::string file_name = file_in_path (name, ""); if (! file_name.empty ()) { @@ -523,7 +523,7 @@ if (tmp) { - string ff = tmp->fcn_file_name (); + std::string ff = tmp->fcn_file_name (); if (! (ff.empty () || (Vignore_function_time_stamp @@ -533,7 +533,7 @@ { time_t tp = tmp->time_parsed (); - string fname; + std::string fname; if (tmp->is_dld_function ()) fname = ff; @@ -587,7 +587,7 @@ // current symbol table. symbol_record * -lookup_by_name (const string& nm, bool exec_script) +lookup_by_name (const std::string& nm, bool exec_script) { symbol_record *sym_rec = curr_sym_tab->lookup (nm, true); @@ -597,7 +597,7 @@ } octave_value -get_global_value (const string& nm) +get_global_value (const std::string& nm) { octave_value retval; @@ -619,7 +619,7 @@ } void -set_global_value (const string& nm, const octave_value& val) +set_global_value (const std::string& nm, const octave_value& val) { symbol_record *sr = global_sym_tab->lookup (nm, true); @@ -634,8 +634,8 @@ // Look for the given name in the global symbol table. If it refers // to a string, return a new copy. If not, return 0; -string -builtin_string_variable (const string& name) +std::string +builtin_string_variable (const std::string& name) { symbol_record *sr = global_sym_tab->lookup (name); @@ -643,7 +643,7 @@ assert (sr); - string retval; + std::string retval; octave_value val = sr->def (); @@ -658,7 +658,7 @@ // return 0. int -builtin_real_scalar_variable (const string& name, double& d) +builtin_real_scalar_variable (const std::string& name, double& d) { int status = 0; symbol_record *sr = global_sym_tab->lookup (name); @@ -681,7 +681,7 @@ // Look for the given name in the global symbol table. octave_value -builtin_any_variable (const string& name) +builtin_any_variable (const std::string& name) { symbol_record *sr = global_sym_tab->lookup (name); @@ -707,7 +707,7 @@ if (! error_state) { - string nm = sr->name (); + std::string nm = sr->name (); symbol_record *gsr = global_sym_tab->lookup (nm, true); @@ -756,7 +756,7 @@ // given name defined in the global symbol table. void -force_link_to_function (const string& id_name) +force_link_to_function (const std::string& id_name) { symbol_record *gsr = global_sym_tab->lookup (id_name, true); if (gsr->is_function ()) @@ -779,11 +779,11 @@ if (nargin == 2) { - string name = args(0).string_value (); + std::string name = args(0).string_value (); if (! error_state) { - string help = args(1).string_value (); + std::string help = args(1).string_value (); if (! error_state) { @@ -820,7 +820,7 @@ bool show_variables = false; bool show_verbose = false; - string my_name = argv[0]; + std::string my_name = argv[0]; int i; for (i = 1; i < argc; i++) @@ -1014,13 +1014,13 @@ // functions needed? void -bind_builtin_constant (const string& name, const octave_value& val, - bool protect, bool eternal, const string& help) +bind_builtin_constant (const std::string& name, const octave_value& val, + bool protect, bool eternal, const std::string& help) { symbol_record *sym_rec = global_sym_tab->lookup (name, true); sym_rec->unprotect (); - string tmp_help = help.empty () ? sym_rec->help () : help; + std::string tmp_help = help.empty () ? sym_rec->help () : help; sym_rec->define_builtin_const (val); @@ -1040,10 +1040,10 @@ // functions needed? void -bind_builtin_variable (const string& varname, const octave_value& val, +bind_builtin_variable (const std::string& varname, const octave_value& val, bool protect, bool eternal, symbol_record::change_function chg_fcn, - const string& help) + const std::string& help) { symbol_record *sr = global_sym_tab->lookup (varname, true); @@ -1179,7 +1179,7 @@ for (int k = idx; k < argc; k++) { - string patstr = argv[k]; + std::string patstr = argv[k]; if (! patstr.empty ()) { @@ -1189,7 +1189,7 @@ for (int i = 0; i < lcount; i++) { - string nm = lvars[i]; + std::string nm = lvars[i]; int match = pattern.match (nm); if ((exclusive && ! match) || (! exclusive && match)) curr_sym_tab->clear (nm); @@ -1198,7 +1198,7 @@ int gcount = gvars.length (); for (int i = 0; i < gcount; i++) { - string nm = gvars[i]; + std::string nm = gvars[i]; int match = pattern.match (nm); if ((exclusive && ! match) || (! exclusive && match)) { @@ -1211,7 +1211,7 @@ int fcount = fcns.length (); for (int i = 0; i < fcount; i++) { - string nm = fcns[i]; + std::string nm = fcns[i]; int match = pattern.match (nm); if ((exclusive && ! match) || (! exclusive && match)) { @@ -1238,7 +1238,7 @@ if (nargin == 1) { - string arg = args(0).string_value (); + std::string arg = args(0).string_value (); if (arg == "global") global_sym_tab->print_stats (); @@ -1265,7 +1265,7 @@ if (nargin == 1) { - string symbol_name = args(0).string_value (); + std::string symbol_name = args(0).string_value (); if (! error_state) { @@ -1294,7 +1294,7 @@ { int pref = 0; - string val = builtin_string_variable ("ignore_function_time_stamp"); + std::string val = builtin_string_variable ("ignore_function_time_stamp"); if (! val.empty ()) { diff --git a/src/variables.h b/src/variables.h --- a/src/variables.h +++ b/src/variables.h @@ -43,52 +43,52 @@ extern void initialize_symbol_tables (void); -extern bool is_builtin_variable (const string&); -extern bool is_text_function_name (const string&); -extern bool is_mapper_function_name (const string&); -extern bool is_builtin_function_name (const string&); -extern bool is_globally_visible (const string&); +extern bool is_builtin_variable (const std::string&); +extern bool is_text_function_name (const std::string&); +extern bool is_mapper_function_name (const std::string&); +extern bool is_builtin_function_name (const std::string&); +extern bool is_globally_visible (const std::string&); extern octave_function * -is_valid_function (const octave_value&, const string& = string (), +is_valid_function (const octave_value&, const std::string& = std::string (), bool warn = false); extern octave_function * -is_valid_function (const string&, const string& = string (), +is_valid_function (const std::string&, const std::string& = std::string (), bool warn = false); extern octave_function * -extract_function (const octave_value& arg, const string& warn_for, - const string& fname, const string& header, - const string& trailer); +extract_function (const octave_value& arg, const std::string& warn_for, + const std::string& fname, const std::string& header, + const std::string& trailer); extern string_vector -get_struct_elts (const string& text); +get_struct_elts (const std::string& text); extern string_vector -generate_struct_completions (const string& text, string& prefix, - string& hint); +generate_struct_completions (const std::string& text, std::string& prefix, + std::string& hint); extern bool -looks_like_struct (const string& text); +looks_like_struct (const std::string& text); extern bool lookup (symbol_record *s, bool exec_script = true); extern symbol_record * -lookup_by_name (const string& nm, bool exec_script = true); +lookup_by_name (const std::string& nm, bool exec_script = true); -extern octave_value get_global_value (const string& nm); +extern octave_value get_global_value (const std::string& nm); -extern void set_global_value (const string& nm, const octave_value& val); +extern void set_global_value (const std::string& nm, const octave_value& val); -extern string builtin_string_variable (const string&); -extern int builtin_real_scalar_variable (const string&, double&); -extern octave_value builtin_any_variable (const string&); +extern std::string builtin_string_variable (const std::string&); +extern int builtin_real_scalar_variable (const std::string&, double&); +extern octave_value builtin_any_variable (const std::string&); extern void link_to_global_variable (symbol_record *sr); extern void link_to_builtin_or_function (symbol_record *sr); -extern void force_link_to_function (const string&); +extern void force_link_to_function (const std::string&); extern void bind_ans (const octave_value& val, bool print); @@ -97,15 +97,15 @@ extern void clear_global_error_variable (void *); extern void -bind_builtin_constant (const string&, const octave_value&, +bind_builtin_constant (const std::string&, const octave_value&, bool protect = false, bool eternal = false, - const string& help = string ()); + const std::string& help = std::string ()); extern void -bind_builtin_variable (const string&, const octave_value&, +bind_builtin_variable (const std::string&, const octave_value&, bool protect = false, bool eternal = false, symbol_record::change_function f = 0, - const string& help = string ()); + const std::string& help = std::string ()); // Symbol table for symbols at the top level. extern symbol_table *top_level_sym_tab;