Mercurial > hg > octave-nkf
changeset 4233:ccfdb55c8156
[project @ 2002-12-20 22:43:54 by jwe]
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,34 @@ +2002-12-20 John W. Eaton <jwe@bevo.che.wisc.edu> + + * DLD-FUNCTIONS/time.cc (extract_tm): Use int_value() instead of + casting double_value() to int. + + * DLD-FUNCITONS/time.cc () + + * ov.cc (octave_value::next_subsref): Arg "skip" is now size_t. + + * oct-obj.h (octave_value_list::octave_value_list (double), + octave_value_list::octave_value_list (const Matrix&), + octave_value_list::octave_value_list (const DiagMatrix&), + octave_value_list::octave_value_list (const RowVector&), + octave_value_list::octave_value_list (const ColumnVector&), + octave_value_list::octave_value_list (const Complex&), + octave_value_list::octave_value_list (const ComplexMatrix&), + octave_value_list::octave_value_list (const ComplexDiagMatrix&), + octave_value_list::octave_value_list (const ComplexRowVector&), + octave_value_list::octave_value_list (const ComplexColumnVector&), + octave_value_list::octave_value_list (const char *), + octave_value_list::octave_value_list (const std::string&), + octave_value_list::octave_value_list (const string_vector&), + octave_value_list::octave_value_list (double, double, double), + octave_value_list::octave_value_list (const Range&): Delete. + Adjust uses of octave_value/octave_value_list to handle this change. + + * ov.cc (octave_value::octave_value (int)): New constructor. + * ov.h: Provide decl. + In files that construct integer-valued octave_value objects, use + ints instead of casing to double. + 2002-12-19 John W. Eaton <jwe@bevo.che.wisc.edu> * load-save.cc (read_mat_ascii_data): Allow commas to separate values.
--- a/src/DLD-FUNCTIONS/chol.cc +++ b/src/DLD-FUNCTIONS/chol.cc @@ -72,7 +72,7 @@ if (arg_is_empty < 0) return retval; if (arg_is_empty > 0) - return Matrix (); + return octave_value (Matrix ()); if (arg.is_real_type ()) {
--- a/src/DLD-FUNCTIONS/det.cc +++ b/src/DLD-FUNCTIONS/det.cc @@ -57,7 +57,7 @@ if (nr == 0 && nc == 0) { - retval = 1.0; + retval(0) = 1.0; return retval; } @@ -65,7 +65,7 @@ if (arg_is_empty < 0) return retval; if (arg_is_empty > 0) - return Matrix (1, 1, 1.0); + return octave_value (Matrix (1, 1, 1.0)); if (nr != nc) {
--- a/src/DLD-FUNCTIONS/expm.cc +++ b/src/DLD-FUNCTIONS/expm.cc @@ -118,7 +118,7 @@ is ill-conditioned.\n\ @end deftypefn") { - octave_value_list retval; + octave_value retval; int nargin = args.length (); @@ -138,7 +138,7 @@ if (arg_is_empty < 0) return retval; if (arg_is_empty > 0) - return Matrix (); + return octave_value (Matrix ()); if (nr != nc) {
--- a/src/DLD-FUNCTIONS/fft.cc +++ b/src/DLD-FUNCTIONS/fft.cc @@ -47,7 +47,7 @@ padded with zeros.\n\ @end deftypefn") { - octave_value_list retval; + octave_value retval; int nargin = args.length (); @@ -86,7 +86,7 @@ if (arg_is_empty < 0) return retval; else if (arg_is_empty || n_points == 0) - return Matrix (); + return octave_value (Matrix ()); if (arg.is_real_type ()) {
--- a/src/DLD-FUNCTIONS/fft2.cc +++ b/src/DLD-FUNCTIONS/fft2.cc @@ -45,7 +45,7 @@ zeros.\n\ @end deftypefn") { - octave_value_list retval; + octave_value retval; int nargin = args.length (); @@ -94,7 +94,7 @@ if (arg_is_empty < 0) return retval; else if (arg_is_empty || n_rows == 0 || n_cols == 0) - return Matrix (); + return octave_value (Matrix ()); if (arg.is_real_type ()) {
--- a/src/DLD-FUNCTIONS/getgrent.cc +++ b/src/DLD-FUNCTIONS/getgrent.cc @@ -51,15 +51,15 @@ { Octave_map m; - m ["name"] = gr.name (); - m ["passwd"] = gr.passwd (); - m ["gid"] = static_cast<double> (gr.gid ()); - m ["mem"] = gr.mem (); + m ["name"](0) = gr.name (); + m ["passwd"](0) = gr.passwd (); + m ["gid"](0) = static_cast<double> (gr.gid ()); + m ["mem"](0) = gr.mem (); retval = m; } else - retval = 0.0; + retval = 0; return retval; } @@ -74,7 +74,7 @@ octave_value_list retval; retval(1) = std::string (); - retval(0) = 0.0; + retval(0) = 0; int nargin = args.length (); @@ -102,7 +102,7 @@ octave_value_list retval; retval(1) = std::string (); - retval(0) = 0.0; + retval(0) = 0; int nargin = args.length (); @@ -142,7 +142,7 @@ octave_value_list retval; retval(1) = std::string (); - retval(0) = 0.0; + retval(0) = 0; int nargin = args.length ();
--- a/src/DLD-FUNCTIONS/getpwent.cc +++ b/src/DLD-FUNCTIONS/getpwent.cc @@ -51,18 +51,18 @@ { Octave_map m; - m ["name"] = pw.name (); - m ["passwd"] = pw.passwd (); - m ["uid"] = static_cast<double> (pw.uid ()); - m ["gid"] = static_cast<double> (pw.gid ()); - m ["gecos"] = pw.gecos (); - m ["dir"] = pw.dir (); - m ["shell"] = pw.shell (); + m ["name"](0) = pw.name (); + m ["passwd"](0) = pw.passwd (); + m ["uid"](0) = static_cast<double> (pw.uid ()); + m ["gid"](0) = static_cast<double> (pw.gid ()); + m ["gecos"](0) = pw.gecos (); + m ["dir"](0) = pw.dir (); + m ["shell"](0) = pw.shell (); retval = m; } else - retval = 0.0; + retval = 0; return retval; } @@ -78,7 +78,7 @@ octave_value_list retval; retval(1) = std::string (); - retval(0) = 0.0; + retval(0) = 0; int nargin = args.length (); @@ -106,7 +106,7 @@ octave_value_list retval; retval(1) = std::string (); - retval(0) = 0.0; + retval(0) = 0; int nargin = args.length ();
--- a/src/DLD-FUNCTIONS/getrusage.cc +++ b/src/DLD-FUNCTIONS/getrusage.cc @@ -138,29 +138,29 @@ getrusage (RUSAGE_SELF, &ru); - tv_tmp ["sec"] = static_cast<double> (ru.ru_utime.tv_sec); - tv_tmp ["usec"] = static_cast<double> (ru.ru_utime.tv_usec); - m ["utime"] = octave_value (tv_tmp); + tv_tmp ["sec"](0) = static_cast<double> (ru.ru_utime.tv_sec); + tv_tmp ["usec"](0) = static_cast<double> (ru.ru_utime.tv_usec); + m ["utime"](0) = octave_value (tv_tmp); - tv_tmp ["sec"] = static_cast<double> (ru.ru_stime.tv_sec); - tv_tmp ["usec"] = static_cast<double> (ru.ru_stime.tv_usec); - m ["stime"] = octave_value (tv_tmp); + tv_tmp ["sec"](0) = static_cast<double> (ru.ru_stime.tv_sec); + tv_tmp ["usec"](0) = static_cast<double> (ru.ru_stime.tv_usec); + m ["stime"](0) = octave_value (tv_tmp); #if ! defined (RUSAGE_TIMES_ONLY) - m ["maxrss"] = static_cast<double> (ru.ru_maxrss); - m ["ixrss"] = static_cast<double> (ru.ru_ixrss); - m ["idrss"] = static_cast<double> (ru.ru_idrss); - m ["isrss"] = static_cast<double> (ru.ru_isrss); - m ["minflt"] = static_cast<double> (ru.ru_minflt); - m ["majflt"] = static_cast<double> (ru.ru_majflt); - m ["nswap"] = static_cast<double> (ru.ru_nswap); - m ["inblock"] = static_cast<double> (ru.ru_inblock); - m ["oublock"] = static_cast<double> (ru.ru_oublock); - m ["msgsnd"] = static_cast<double> (ru.ru_msgsnd); - m ["msgrcv"] = static_cast<double> (ru.ru_msgrcv); - m ["nsignals"] = static_cast<double> (ru.ru_nsignals); - m ["nvcsw"] = static_cast<double> (ru.ru_nvcsw); - m ["nivcsw"] = static_cast<double> (ru.ru_nivcsw); + m ["maxrss"](0) = static_cast<double> (ru.ru_maxrss); + m ["ixrss"](0) = static_cast<double> (ru.ru_ixrss); + m ["idrss"](0) = static_cast<double> (ru.ru_idrss); + m ["isrss"](0) = static_cast<double> (ru.ru_isrss); + m ["minflt"](0) = static_cast<double> (ru.ru_minflt); + m ["majflt"](0) = static_cast<double> (ru.ru_majflt); + m ["nswap"](0) = static_cast<double> (ru.ru_nswap); + m ["inblock"](0) = static_cast<double> (ru.ru_inblock); + m ["oublock"](0) = static_cast<double> (ru.ru_oublock); + m ["msgsnd"](0) = static_cast<double> (ru.ru_msgsnd); + m ["msgrcv"](0) = static_cast<double> (ru.ru_msgrcv); + m ["nsignals"](0) = static_cast<double> (ru.ru_nsignals); + m ["nvcsw"](0) = static_cast<double> (ru.ru_nvcsw); + m ["nivcsw"](0) = static_cast<double> (ru.ru_nivcsw); #endif #else @@ -178,46 +178,46 @@ fraction = ticks % HZ; seconds = ticks / HZ; - tv_tmp ["sec"] = static_cast<double> (seconds); - tv_tmp ["usec"] = static_cast<double> (fraction * 1e6 / HZ); - m ["utime"] = octave_value (tv_tmp); + tv_tmp ["sec"](0) = static_cast<double> (seconds); + tv_tmp ["usec"](0) = static_cast<double> (fraction * 1e6 / HZ); + m ["utime"](0) = octave_value (tv_tmp); ticks = t.tms_stime + t.tms_cstime; fraction = ticks % HZ; seconds = ticks / HZ; - tv_tmp ["sec"] = static_cast<double> (seconds); - tv_tmp ["usec"] = static_cast<double> (fraction * 1e6 / HZ); - m ["stime"] = octave_value (tv_tmp); + tv_tmp ["sec"](0) = static_cast<double> (seconds); + tv_tmp ["usec"](0) = static_cast<double> (fraction * 1e6 / HZ); + m ["stime"](0) = octave_value (tv_tmp); #else - tv_tmp ["sec"] = 0.0; - tv_tmp ["usec"] = 0.0; - m ["utime"] = octave_value (tv_tmp); + tv_tmp ["sec"](0) = 0; + tv_tmp ["usec"](0) = 0; + m ["utime"](0) = octave_value (tv_tmp); - tv_tmp ["sec"] = 0.0; - tv_tmp ["usec"] = 0.0; - m ["stime"] = octave_value (tv_tmp); + tv_tmp ["sec"](0) = 0; + tv_tmp ["usec"](0) = 0; + m ["stime"](0) = octave_value (tv_tmp); #endif double tmp = lo_ieee_nan_value (); - m ["maxrss"] = tmp; - m ["ixrss"] = tmp; - m ["idrss"] = tmp; - m ["isrss"] = tmp; - m ["minflt"] = tmp; - m ["majflt"] = tmp; - m ["nswap"] = tmp; - m ["inblock"] = tmp; - m ["oublock"] = tmp; - m ["msgsnd"] = tmp; - m ["msgrcv"] = tmp; - m ["nsignals"] = tmp; - m ["nvcsw"] = tmp; - m ["nivcsw"] = tmp; + m ["maxrss"](0) = tmp; + m ["ixrss"](0) = tmp; + m ["idrss"](0) = tmp; + m ["isrss"](0) = tmp; + m ["minflt"](0) = tmp; + m ["majflt"](0) = tmp; + m ["nswap"](0) = tmp; + m ["inblock"](0) = tmp; + m ["oublock"](0) = tmp; + m ["msgsnd"](0) = tmp; + m ["msgrcv"](0) = tmp; + m ["nsignals"](0) = tmp; + m ["nvcsw"](0) = tmp; + m ["nivcsw"](0) = tmp; #endif
--- a/src/DLD-FUNCTIONS/ifft.cc +++ b/src/DLD-FUNCTIONS/ifft.cc @@ -48,7 +48,7 @@ padded with zeros.\n\ @end deftypefn") { - octave_value_list retval; + octave_value retval; int nargin = args.length (); @@ -87,7 +87,7 @@ if (arg_is_empty < 0) return retval; else if (arg_is_empty || n_points == 0) - return Matrix (); + return octave_value (Matrix ()); if (arg.is_real_type ()) {
--- a/src/DLD-FUNCTIONS/ifft2.cc +++ b/src/DLD-FUNCTIONS/ifft2.cc @@ -45,7 +45,7 @@ zeros.\n\ @end deftypefn") { - octave_value_list retval; + octave_value retval; int nargin = args.length (); @@ -94,7 +94,7 @@ if (arg_is_empty < 0) return retval; else if (arg_is_empty || n_rows == 0 || n_cols == 0) - return Matrix (); + return octave_value (Matrix ()); if (arg.is_real_type ()) {
--- a/src/DLD-FUNCTIONS/inv.cc +++ b/src/DLD-FUNCTIONS/inv.cc @@ -59,7 +59,7 @@ if (arg_is_empty < 0) return retval; else if (arg_is_empty > 0) - return Matrix (); + return octave_value (Matrix ()); if (nr != nc) {
--- a/src/DLD-FUNCTIONS/log.cc +++ b/src/DLD-FUNCTIONS/log.cc @@ -62,7 +62,7 @@ if (arg_is_empty < 0) return retval; else if (arg_is_empty > 0) - return Matrix (); + return octave_value (Matrix ()); if (arg.is_real_scalar ()) { @@ -181,7 +181,7 @@ if (arg_is_empty < 0) return retval; else if (arg_is_empty > 0) - return Matrix (); + return octave_value (Matrix ()); if (arg.is_real_scalar ()) {
--- a/src/DLD-FUNCTIONS/odessa.cc +++ b/src/DLD-FUNCTIONS/odessa.cc @@ -230,7 +230,7 @@ return retval; } -static octave_value_list +static octave_value make_list (const Array<Matrix>& m_array) { octave_value_list retval; @@ -242,7 +242,7 @@ for (int i = 0; i < len; i++) retval(i) = m_array(i); - return retval; + return octave_value (retval); } #define ODESSA_ABORT() \
--- a/src/DLD-FUNCTIONS/pinv.cc +++ b/src/DLD-FUNCTIONS/pinv.cc @@ -46,7 +46,7 @@ where @code{sigma_max (@var{x})} is the maximal singular value of @var{x}.\n\ @end deftypefn") { - octave_value_list retval; + octave_value retval; int nargin = args.length (); @@ -76,7 +76,7 @@ if (arg_is_empty < 0) return retval; else if (arg_is_empty > 0) - return Matrix (); + return octave_value (Matrix ()); if (arg.is_real_type ()) {
--- a/src/DLD-FUNCTIONS/syl.cc +++ b/src/DLD-FUNCTIONS/syl.cc @@ -59,7 +59,7 @@ @end example\n\ @end deftypefn") { - octave_value_list retval; + octave_value retval; int nargin = args.length (); @@ -87,7 +87,7 @@ int arg_c_is_empty = empty_arg ("syl", c_nr, c_nc); if (arg_a_is_empty > 0 && arg_b_is_empty > 0 && arg_c_is_empty > 0) - return Matrix (); + return octave_value (Matrix ()); else if (arg_a_is_empty || arg_b_is_empty || arg_c_is_empty) return retval;
--- a/src/DLD-FUNCTIONS/time.cc +++ b/src/DLD-FUNCTIONS/time.cc @@ -40,17 +40,17 @@ { Octave_map m; - m ["usec"] = static_cast<double> (t.usec ()); - m ["sec"] = static_cast<double> (t.sec ()); - m ["min"] = static_cast<double> (t.min ()); - m ["hour"] = static_cast<double> (t.hour ()); - m ["mday"] = static_cast<double> (t.mday ()); - m ["mon"] = static_cast<double> (t.mon ()); - m ["year"] = static_cast<double> (t.year ()); - m ["wday"] = static_cast<double> (t.wday ()); - m ["yday"] = static_cast<double> (t.yday ()); - m ["isdst"] = static_cast<double> (t.isdst ()); - m ["zone"] = t.zone (); + m ["usec"](0) = static_cast<double> (t.usec ()); + m ["sec"](0) = static_cast<double> (t.sec ()); + m ["min"](0) = static_cast<double> (t.min ()); + m ["hour"](0) = static_cast<double> (t.hour ()); + m ["mday"](0) = static_cast<double> (t.mday ()); + m ["mon"](0) = static_cast<double> (t.mon ()); + m ["year"](0) = static_cast<double> (t.year ()); + m ["wday"](0) = static_cast<double> (t.wday ()); + m ["yday"](0) = static_cast<double> (t.yday ()); + m ["isdst"](0) = static_cast<double> (t.isdst ()); + m ["zone"](0) = t.zone (); return m; } @@ -60,16 +60,16 @@ { octave_base_tm tm; - tm.usec (static_cast<int> (m ["usec"](0) . double_value ())); - tm.sec (static_cast<int> (m ["sec"](0) . double_value ())); - tm.min (static_cast<int> (m ["min"](0) . double_value ())); - tm.hour (static_cast<int> (m ["hour"](0) . double_value ())); - tm.mday (static_cast<int> (m ["mday"](0) . double_value ())); - tm.mon (static_cast<int> (m ["mon"](0) . double_value ())); - tm.year (static_cast<int> (m ["year"](0) . double_value ())); - tm.wday (static_cast<int> (m ["wday"](0) . double_value ())); - tm.yday (static_cast<int> (m ["yday"](0) . double_value ())); - tm.isdst (static_cast<int> (m ["isdst"](0) . double_value ())); + tm.usec (m ["usec"](0) . int_value ()); + tm.sec (m ["sec"](0) . int_value ()); + tm.min (m ["min"](0) . int_value ()); + tm.hour (m ["hour"](0) . int_value ()); + tm.mday (m ["mday"](0) . int_value ()); + tm.mon (m ["mon"](0) . int_value ()); + tm.year (m ["year"](0) . int_value ()); + tm.wday (m ["wday"](0) . int_value ()); + tm.yday (m ["yday"](0) . int_value ()); + tm.isdst (m ["isdst"](0) . int_value ()); tm.zone (m ["zone"](0) . string_value ()); return tm;
--- a/src/data.cc +++ b/src/data.cc @@ -53,7 +53,7 @@ #define ANY_ALL(FCN) \ \ - octave_value_list retval; \ + octave_value retval; \ \ int nargin = args.length (); \ \ @@ -188,7 +188,7 @@ and @var{x}. The result is in range -pi to pi.\n\ @end deftypefn") { - octave_value_list retval; + octave_value retval; int nargin = args.length (); @@ -207,7 +207,7 @@ int arg_x_empty = empty_arg ("atan2", x_nr, x_nc); if (arg_y_empty > 0 && arg_x_empty > 0) - return Matrix (); + return octave_value (Matrix ()); else if (arg_y_empty || arg_x_empty) return retval; @@ -273,7 +273,7 @@ #define DATA_REDUCTION(FCN) \ \ - octave_value_list retval; \ + octave_value retval; \ \ int nargin = args.length (); \ \ @@ -292,14 +292,14 @@ Matrix tmp = arg.matrix_value (); \ \ if (! error_state) \ - retval(0) = tmp.FCN (dim); \ + retval = tmp.FCN (dim); \ } \ else if (arg.is_complex_type ()) \ { \ ComplexMatrix tmp = arg.complex_matrix_value (); \ \ if (! error_state) \ - retval(0) = tmp.FCN (dim); \ + retval = tmp.FCN (dim); \ } \ else \ { \ @@ -368,7 +368,7 @@ Matrix m (n, n, 0.0); for (int i = 0; i < nc; i++) m (i+roff, i+coff) = v (0, i); - retval = octave_value (m); + retval = m; } else { @@ -376,7 +376,7 @@ Matrix m (n, n, 0.0); for (int i = 0; i < nr; i++) m (i+roff, i+coff) = v (i, 0); - retval = octave_value (m); + retval = m; } return retval; @@ -410,7 +410,7 @@ ComplexMatrix m (n, n, 0.0); for (int i = 0; i < nc; i++) m (i+roff, i+coff) = v (0, i); - retval = octave_value (m); + retval = m; } else { @@ -418,7 +418,7 @@ ComplexMatrix m (n, n, 0.0); for (int i = 0; i < nr; i++) m (i+roff, i+coff) = v (i, 0); - retval = octave_value (m); + retval = m; } return retval; @@ -560,7 +560,7 @@ @end example\n\ @end deftypefn") { - octave_value_list retval; + octave_value retval; int nargin = args.length (); @@ -599,7 +599,7 @@ int len = args(0).length (); if (! error_state) - retval = static_cast<double> (len); + retval = len; } else print_usage ("length"); @@ -654,12 +654,12 @@ Matrix m (1, 2); m (0, 0) = nr; m (0, 1) = nc; - retval = m; + retval(0) = m; } else if (nargout == 2) { - retval(1) = static_cast<double> (nc); - retval(0) = static_cast<double> (nr); + retval(1) = nc; + retval(0) = nr; } } else if (nargin == 2 && nargout < 2) @@ -671,9 +671,9 @@ else { if (nd == 1) - retval(0) = static_cast<double> (args(0).rows ()); + retval(0) = args(0).rows (); else if (nd == 2) - retval(0) = static_cast<double> (args(0).columns ()); + retval(0) = args(0).columns (); else error ("size: invalid second argument -- expecting 1 or 2"); } @@ -767,16 +767,16 @@ the number of columns, or both are zero). Otherwise, return 0.\n\ @end deftypefn") { - double retval = 0.0; + octave_value retval = false; if (args.length () == 1) { octave_value arg = args(0); if (arg.is_matrix_type ()) - retval = static_cast<double> (arg.rows () == 0 || arg.columns () == 0); + retval = (arg.rows () == 0 || arg.columns () == 0); else if (arg.is_list () || arg.is_string ()) - retval = static_cast<double> (arg.length () == 0); + retval = (arg.length () == 0); } else print_usage ("isempty"); @@ -822,16 +822,16 @@ Return 1 if @var{a} is a matrix. Otherwise, return 0.\n\ @end deftypefn") { - double retval = 0.0; + octave_value retval = false; if (args.length () == 1) { octave_value arg = args(0); if (arg.is_scalar_type () || arg.is_range ()) - retval = 1.0; + retval = true; else if (arg.is_matrix_type ()) - retval = static_cast<double> (arg.rows () >= 1 && arg.columns () >= 1); + retval = (arg.rows () >= 1 && arg.columns () >= 1); } else print_usage ("ismatrix"); @@ -863,7 +863,7 @@ argument that is not a structure.\n\ @end deftypefn") { - octave_value_list retval; + octave_value retval; int nargin = args.length (); @@ -872,7 +872,7 @@ if (args (0).is_map ()) { Octave_map m = args(0).map_value (); - retval(0) = m.keys (); + retval = m.keys (); } else gripe_wrong_type_arg ("struct_elements", args (0)); @@ -891,13 +891,13 @@ the second must be a string.\n\ @end deftypefn") { - octave_value_list retval; + octave_value retval; int nargin = args.length (); if (nargin == 2) { - retval = 0.0; + retval = false; // XXX FIXME XXX -- should this work for all types that can do // structure reference operations? @@ -908,7 +908,7 @@ Octave_map m = args(0).map_value (); - retval = static_cast<double> (m.contains (key)); + retval = m.contains (key); } else print_usage ("struct_contains");
--- a/src/debug.cc +++ b/src/debug.cc @@ -144,7 +144,7 @@ else error ("dbstop: one argument when in a function and two when not\n"); - retval = static_cast<double> (result); + retval = result; return retval; }
--- a/src/dirfns.cc +++ b/src/dirfns.cc @@ -221,7 +221,7 @@ Return the current working directory.\n\ @end deftypefn") { - octave_value_list retval; + octave_value retval; std::string directory = octave_env::getcwd (); @@ -314,7 +314,7 @@ int status = file_ops::mkdir (file_ops::tilde_expand (dirname), 0777, msg); - retval(0) = static_cast<double> (status); + retval(0) = status; if (status < 0) retval(1) = msg; @@ -353,7 +353,7 @@ int status = file_ops::rmdir (file_ops::tilde_expand (dirname), msg); - retval(0) = static_cast<double> (status); + retval(0) = status; if (status < 0) retval(1) = msg; @@ -398,7 +398,7 @@ int status = file_ops::link (from, to, msg); - retval(0) = static_cast<double> (status); + retval(0) = status; if (status < 0) retval(1) = msg; @@ -444,7 +444,7 @@ int status = file_ops::symlink (from, to, msg); - retval(0) = static_cast<double> (status); + retval(0) = status; if (status < 0) retval(1) = msg; @@ -489,7 +489,7 @@ retval(0) = result; - retval(1) = static_cast<double> (status); + retval(1) = status; if (status < 0) retval(2) = msg; @@ -534,7 +534,7 @@ int status = file_ops::rename (from, to, msg); - retval(0) = static_cast<double> (status); + retval(0) = status; if (status < 0) retval(1) = msg;
--- a/src/dynamic-ld.cc +++ b/src/dynamic-ld.cc @@ -338,7 +338,7 @@ void symbols_of_dynamic_ld (void) { - DEFVAR (warn_reload_forces_clear, 1.0, warn_reload_forces_clear, + DEFVAR (warn_reload_forces_clear, true, warn_reload_forces_clear, "-*- texinfo -*-\n\ @defvr {Built-in Variable} warn_reload_forces_clear\n\ If several functions have been loaded from the same file, Octave must\n\
--- a/src/error.cc +++ b/src/error.cc @@ -769,7 +769,7 @@ void symbols_of_error (void) { - DEFVAR (beep_on_error, 0.0, beep_on_error, + DEFVAR (beep_on_error, false, beep_on_error, "-*- texinfo -*-\n\ @defvr {Built-in Variable} beep_on_error\n\ If the value of @code{beep_on_error} is nonzero, Octave will try\n\ @@ -777,7 +777,7 @@ default value is 0.\n\ @end defvr"); - DEFVAR (debug_on_error, 0.0, debug_on_error, + DEFVAR (debug_on_error, false, debug_on_error, "-*- texinfo -*-\n\ @defvr {Built-in Variable} debug_on_error\n\ If the value of @code{debug_on_error} is nonzero, Octave will try\n\ @@ -786,7 +786,7 @@ the top-level error message). The default value is 0.\n\ @end defvr"); - DEFVAR (debug_on_warning, 0.0, debug_on_warning, + DEFVAR (debug_on_warning, false, debug_on_warning, "-*- texinfo -*-\n\ @defvr {Built-in Variable} debug_on_warning\n\ If the value of @code{debug_on_warning} is nonzero, Octave will try\n\
--- a/src/file-io.cc +++ b/src/file-io.cc @@ -160,13 +160,12 @@ 0. Otherwise, it returns 1.\n\ @end deftypefn") { - double retval = -1.0; + octave_value retval = -1; int nargin = args.length (); if (nargin == 1) - retval = static_cast<double> (octave_stream_list::remove (args(0), - "fclose")); + retval = octave_stream_list::remove (args(0), "fclose"); else print_usage ("fclose"); @@ -182,7 +181,7 @@ stream before calling @code{input}.\n\ @end deftypefn") { - double retval = -1.0; + octave_value retval = -1; int nargin = args.length (); @@ -196,14 +195,14 @@ { flush_octave_stdout (); - retval = 0.0; + retval = 0; } else { octave_stream os = octave_stream_list::lookup (fid, "fflush"); if (! error_state) - retval = static_cast<double> (os.flush ()); + retval = os.flush (); } } else @@ -227,8 +226,8 @@ { octave_value_list retval; - retval(1) = 0.0; - retval(0) = -1.0; + retval(1) = 0; + retval(0) = -1; int nargin = args.length (); @@ -239,7 +238,7 @@ if (! error_state) { octave_value len_arg = (nargin == 2) - ? args(1) : octave_value (static_cast<double> (INT_MAX)); + ? args(1) : octave_value (INT_MAX); bool err = false; @@ -285,7 +284,7 @@ if (! error_state) { octave_value len_arg = (nargin == 2) - ? args(1) : octave_value (static_cast<double> (INT_MAX)); + ? args(1) : octave_value (INT_MAX); bool err = false; @@ -557,7 +556,7 @@ @code{fseek (@var{fid}, 0, SEEK_SET)}.\n\ @end deftypefn") { - double retval = -1.0; + octave_value retval = -1; int nargin = args.length (); @@ -566,7 +565,7 @@ octave_stream os = octave_stream_list::lookup (args(0), "frewind"); if (! error_state) - retval = static_cast<double> (os.rewind ()); + retval = os.rewind (); } else print_usage ("frewind"); @@ -586,7 +585,7 @@ @var{origin} must be @code{SEEK_SET}.\n\ @end deftypefn") { - double retval = -1.0; + octave_value retval = -1; int nargin = args.length (); @@ -599,7 +598,7 @@ octave_value origin_arg = (nargin == 3) ? args(2) : octave_value (-1.0); - retval = static_cast<double> (os.seek (args(1), origin_arg)); + retval = os.seek (args(1), origin_arg); } } else @@ -615,7 +614,7 @@ from the beginning of the file @var{fid}.\n\ @end deftypefn") { - double retval = -1.0; + octave_value retval = -1; int nargin = args.length (); @@ -639,7 +638,7 @@ written to the stream @var{fid} instead of @code{stdout}.\n\ @end deftypefn") { - double retval = -1.0; + octave_value retval = -1; bool return_char_count = true; int nargin = args.length (); @@ -702,7 +701,7 @@ Write a string to a file with no formatting.\n\ @end deftypefn") { - double retval = -1.0; + octave_value retval = -1; int nargin = args.length (); @@ -759,7 +758,7 @@ tmp_args(i-1) = args(i); } - retval(2) = static_cast<double> (os.printf (fmt, tmp_args)); + retval(2) = os.printf (fmt, tmp_args); retval(1) = os.error (); retval(0) = ostr->str (); } @@ -863,7 +862,7 @@ { octave_value tmp = os.scanf (fmt, size, count); - retval(1) = static_cast<double> (count); + retval(1) = count; retval(0) = tmp; } } @@ -952,7 +951,7 @@ retval(3) = static_cast<double> (os.tell () + 1); retval(2) = errmsg; - retval(1) = static_cast<double> (count); + retval(1) = count; retval(0) = tmp; } else @@ -1201,7 +1200,7 @@ octave_value tmp = do_fread (os, size, prec, skip, arch, count); - retval(1) = static_cast<double> (count); + retval(1) = count; retval(0) = tmp; } } @@ -1273,7 +1272,7 @@ are too large to fit in the specified precision.\n\ @end deftypefn") { - octave_value retval = -1.0; + octave_value retval = -1; int nargin = args.length (); @@ -1314,7 +1313,7 @@ result in an end-of-file condition.\n\ @end deftypefn") { - double retval = -1.0; + octave_value retval = -1; int nargin = args.length (); @@ -1366,7 +1365,7 @@ std::string error_message = os.error (clear, error_number); - retval(1) = static_cast<double> (error_number); + retval(1) = error_number; retval(0) = error_message; } } @@ -1409,7 +1408,7 @@ @end example\n\ @end deftypefn") { - octave_value retval = -1.0; + octave_value retval = -1; int nargin = args.length (); @@ -1457,13 +1456,12 @@ use @code{fclose} for the same purpose.\n\ @end deftypefn") { - double retval = -1.0; + octave_value retval = -1; int nargin = args.length (); if (nargin == 1) - retval = static_cast<double> (octave_stream_list::remove (args(0), - "pclose")); + retval = octave_stream_list::remove (args(0), "pclose"); else print_usage ("pclose"); @@ -1571,7 +1569,7 @@ print_usage ("umask"); if (status >= 0) - retval(0) = static_cast<double> (status); + retval(0) = status; return retval; } @@ -1582,7 +1580,7 @@ // NOTE: the values of SEEK_SET, SEEK_CUR, and SEEK_END have to be // this way for Matlab compatibility. - DEFCONSTX ("SEEK_SET", SBV_SEEK_SET, -1.0, + DEFCONSTX ("SEEK_SET", SBV_SEEK_SET, -1, "-*- texinfo -*-\n\ @defvr {Built-in Variable} SEEK_SET\n\ @defvrx {Built-in Variable} SEEK_CUR\n\ @@ -1602,13 +1600,13 @@ @end table\n\ @end defvr"); - DEFCONSTX ("SEEK_CUR", SBV_SEEK_CUR, 0.0, + DEFCONSTX ("SEEK_CUR", SBV_SEEK_CUR, 0, "-*- texinfo -*-\n\ @defvr {Built-in Variable} SEEK_CUR\n\ See SEEK_SET.\n\ @end defvr"); - DEFCONSTX ("SEEK_END", SBV_SEEK_END, 1.0, + DEFCONSTX ("SEEK_END", SBV_SEEK_END, 1, "-*- texinfo -*-\n\ @defvr {Built-in Variable} SEEK_END\n\ See SEEK_SET.\n\
--- a/src/help.cc +++ b/src/help.cc @@ -1102,7 +1102,7 @@ Its default initial value is @code{\"makeinfo\"}.\n\ @end defvr"); - DEFVAR (suppress_verbose_help_message, 0.0, suppress_verbose_help_message, + DEFVAR (suppress_verbose_help_message, false, suppress_verbose_help_message, "-*- texinfo -*-\n\ @defvr {Built-in Variable} suppress_verbose_help_message\n\ If the value of @code{suppress_verbose_help_message} is nonzero, Octave\n\
--- a/src/input.cc +++ b/src/input.cc @@ -565,12 +565,7 @@ if (debug) goto again; else - { - if (read_as_string) - return ""; - else - return Matrix (); - } + return read_as_string ? octave_value ("") : octave_value (Matrix ()); } if (debug) @@ -719,7 +714,9 @@ Vsaving_history = true; - retval = get_user_input (args, true, 0); + octave_value_list tmp = get_user_input (args, true, 0); + + retval = tmp(0); unwind_protect::run_frame ("do_keyboard"); @@ -795,11 +792,9 @@ { if ((Vecho_executing_commands & ECHO_SCRIPTS) || (Vecho_executing_commands & ECHO_FUNCTIONS)) - bind_builtin_variable ("echo_executing_commands", - static_cast<double> (ECHO_OFF)); + bind_builtin_variable ("echo_executing_commands", ECHO_OFF); else - bind_builtin_variable ("echo_executing_commands", - static_cast<double> (ECHO_SCRIPTS)); + bind_builtin_variable ("echo_executing_commands", ECHO_SCRIPTS); } break; @@ -808,11 +803,9 @@ std::string arg = argv[1]; if (arg == "on") - bind_builtin_variable ("echo_executing_commands", - static_cast<double> (ECHO_SCRIPTS)); + bind_builtin_variable ("echo_executing_commands", ECHO_SCRIPTS); else if (arg == "off") - bind_builtin_variable ("echo_executing_commands", - static_cast<double> (ECHO_OFF)); + bind_builtin_variable ("echo_executing_commands", ECHO_OFF); else print_usage ("echo"); } @@ -825,12 +818,10 @@ if (arg == "on" && argv[2] == "all") { int tmp = (ECHO_SCRIPTS | ECHO_FUNCTIONS); - bind_builtin_variable ("echo_executing_commands", - static_cast<double> (tmp)); + bind_builtin_variable ("echo_executing_commands", tmp); } else if (arg == "off" && argv[2] == "all") - bind_builtin_variable ("echo_executing_commands", - static_cast<double> (ECHO_OFF)); + bind_builtin_variable ("echo_executing_commands", ECHO_OFF); else print_usage ("echo"); } @@ -1131,8 +1122,7 @@ value is @code{\" \"} (a single space).\n\ @end defvr"); - DEFVAR (echo_executing_commands, static_cast<double> (ECHO_OFF), - echo_executing_commands, + DEFVAR (echo_executing_commands, ECHO_OFF, echo_executing_commands, "-*- texinfo -*-\n\ @defvr {Built-in Variable} echo_executing_commands\n\ This variable may also be used to control the echo state. It may be\n\
--- a/src/lex.l +++ b/src/lex.l @@ -2671,21 +2671,21 @@ void symbols_of_lex (void) { - DEFVAR (warn_matlab_incompatible, 0.0, warn_matlab_incompatible, + DEFVAR (warn_matlab_incompatible, false, warn_matlab_incompatible, "-*- texinfo -*-\n\ @defvr {Built-in Variable} warn_matlab_incompatible\n\ Print warnings for Octave language features that may cause\n\ compatibility problems with Matlab.\n\ @end defvr"); - DEFVAR (warn_separator_insert, 0.0, warn_separator_insert, + DEFVAR (warn_separator_insert, false, warn_separator_insert, "-*- texinfo -*-\n\ @defvr {Built-in Variable} warn_separator_insert\n\ Print warning if commas or semicolons might be inserted\n\ automatically in literal matrices.\n\ @end defvr"); - DEFVAR (warn_single_quote_string, 0.0, warn_single_quote_string, + DEFVAR (warn_single_quote_string, false, warn_single_quote_string, "-*- texinfo -*-\n\ @defvr {Built-in Variable} warn_single_quote_string\n\ Print warning if a signle quote character is used to introduce a\n\
--- a/src/load-save.cc +++ b/src/load-save.cc @@ -1220,7 +1220,7 @@ } if (retval > 0) - tc = lst; + tc = octave_value (lst); } return retval; @@ -1686,7 +1686,7 @@ d->global = hdf5_check_attr (group_id, "OCTAVE_GLOBAL"); if (is_list) - d->tc = lst; + d->tc = octave_value (lst); else d->tc = m; } @@ -3905,9 +3905,10 @@ Octave_map::iterator i = m.begin (); while (i != m.end ()) { - bool retval2 = add_hdf5_data (data_id, - m.contents (i), m.key (i), "", - false, save_as_floats); + // XXX FIXME XXX -- if the length of the structure array is + // 1, should we really create a list object? + bool retval2 = add_hdf5_data (data_id, octave_value (m.contents (i)), + m.key (i), "", false, save_as_floats); if (! retval2) goto error_cleanup; @@ -4267,9 +4268,11 @@ for (Octave_map::iterator i = m.begin (); i != m.end (); i++) { // write the data of each element - bool retval2 = save_mat5_binary_element (os, m.contents (i), "", - mark_as_global, - save_as_floats); + // XXX FIXME XXX -- if the length of the structure array is + // 1, should we really create a list object? + bool retval2 + = save_mat5_binary_element (os, octave_value (m.contents (i)), + "", mark_as_global, save_as_floats); if (! retval2) goto error_cleanup; @@ -5314,7 +5317,7 @@ void symbols_of_load_save (void) { - DEFVAR (crash_dumps_octave_core, 1.0, crash_dumps_octave_core, + DEFVAR (crash_dumps_octave_core, true, crash_dumps_octave_core, "-*- texinfo -*-\n\ @defvr {Built-in Variable} crash_dumps_octave_core\n\ If this variable is set to a nonzero value, Octave tries to save all\n\
--- a/src/oct-hist.cc +++ b/src/oct-hist.cc @@ -717,7 +717,7 @@ environment variable @code{OCTAVE_HISTSIZE}.\n\ @end defvr"); - DEFVAR (saving_history, 1.0, saving_history, + DEFVAR (saving_history, true, saving_history, "-*- texinfo -*-\n\ @defvr {Built-in Variable} saving_history\n\ If the value of @code{saving_history} is nonzero, command entered\n\
--- a/src/oct-obj.h +++ b/src/oct-obj.h @@ -49,51 +49,6 @@ octave_value_list (const octave_value& tc) : data (1, tc) { } - octave_value_list (double d) - : data (1, octave_value (d)) { } - - octave_value_list (const Matrix& m) - : data (1, octave_value (m)) { } - - octave_value_list (const DiagMatrix& d) - : data (1, octave_value (d)) { } - - octave_value_list (const RowVector& v) - : data (1, octave_value (v)) { } - - octave_value_list (const ColumnVector& v) - : data (1, octave_value (v)) { } - - octave_value_list (const Complex& c) - : data (1, octave_value (c)) { } - - octave_value_list (const ComplexMatrix& m) - : data (1, octave_value (m)) { } - - octave_value_list (const ComplexDiagMatrix& d) - : data (1, octave_value (d)) { } - - octave_value_list (const ComplexRowVector& v) - : data (1, octave_value (v)) { } - - octave_value_list (const ComplexColumnVector& v) - : data (1, octave_value (v)) { } - - octave_value_list (const char *s) - : data (1, octave_value (s)) { } - - octave_value_list (const std::string& s) - : data (1, octave_value (s)) { } - - octave_value_list (const string_vector& s) - : data (1, octave_value (s)) { } - - octave_value_list (double base, double limit, double inc) - : data (1, octave_value (base, limit, inc)) { } - - octave_value_list (const Range& r) - : data (1, octave_value (r)) { } - octave_value_list (const octave_value_list& obj) : data (obj.data), names (obj.names) { }
--- a/src/oct-procbuf.cc +++ b/src/oct-procbuf.cc @@ -210,8 +210,7 @@ void symbols_of_oct_procbuf (void) { - DEFVAR (__kluge_procbuf_delay__, static_cast<double> (Vkluge_procbuf_delay), - kluge_procbuf_delay, + DEFVAR (__kluge_procbuf_delay__, Vkluge_procbuf_delay, kluge_procbuf_delay, "-*- texinfo -*-\n\ @defvr __kluge_procbuf_delay__\n\ Number of microseconds to delay in the parent after forking.\n\
--- a/src/oct-stream.cc +++ b/src/oct-stream.cc @@ -1782,7 +1782,7 @@ if (OCTAVE_SCAN (is, *elt, &tmp)) { if (! discard) - retval = static_cast<double> (tmp); + retval = tmp; } else quit = true; @@ -1935,7 +1935,7 @@ } } - retval (nconv) = static_cast<double> (num_values); + retval(nconv) = num_values; if (! quit) {
--- a/src/octave.cc +++ b/src/octave.cc @@ -158,8 +158,7 @@ static void intern_argv (int argc, char **argv) { - bind_builtin_variable ("nargin", static_cast<double> (argc-1), - true, true, 0); + bind_builtin_variable ("nargin", argc-1, true, true, 0); Cell octave_argv; @@ -590,8 +589,7 @@ // XXX FIXME XXX -- is this the right thing to do? - bind_builtin_variable ("echo_executing_commands", - static_cast<double> (ECHO_CMD_LINE)); + bind_builtin_variable ("echo_executing_commands", ECHO_CMD_LINE); } if (! interactive)
--- a/src/ov-file.cc +++ b/src/ov-file.cc @@ -46,7 +46,7 @@ { CAST_CONV_ARG (const octave_file&); - return new octave_scalar (static_cast<double> (v.stream_number ())); + return new octave_scalar (v.stream_number ()); } type_conv_fcn
--- a/src/ov-list.cc +++ b/src/ov-list.cc @@ -58,7 +58,7 @@ { idx_vector i = tmp_idx (0).index_vector (); - retval = octave_value_list (lst.index (i)); + retval = octave_value (octave_value_list (lst.index (i))); } else error ("only one index allowed for lists"); @@ -106,7 +106,7 @@ { idx_vector i = idx (0).index_vector (); - retval = octave_value_list (lst.index (i, resize_ok)); + retval = octave_value (octave_value_list (lst.index (i, resize_ok))); } else error ("lists may only be indexed by a single scalar"); @@ -357,7 +357,7 @@ tmp.append (ov); } - retval = tmp; + retval = octave_value (tmp); } } else @@ -381,7 +381,7 @@ octave_value_list tmp = args(0).list_value (); if (! error_state) - retval = tmp.reverse (); + retval = octave_value (tmp.reverse ()); } else print_usage ("reverse"); @@ -441,7 +441,7 @@ } if (! error_state) - retval = list_1.splice (offset, length, list_2); + retval = octave_value (list_1.splice (offset, length, list_2)); } else error ("splice: OFFSET must be an integer");
--- a/src/ov-usr-fcn.cc +++ b/src/ov-usr-fcn.cc @@ -578,8 +578,8 @@ if (! arg_names.empty ()) argn_sr->define (arg_names); - nargin_sr->define (static_cast<double> (nargin)); - nargout_sr->define (static_cast<double> (nargout)); + nargin_sr->define (nargin); + nargout_sr->define (nargout); if (takes_varargs ()) { @@ -760,7 +760,7 @@ @code{[]}.\n\ @end defvr"); - DEFVAR (define_all_return_values, 0.0, define_all_return_values, + DEFVAR (define_all_return_values, false, define_all_return_values, "-*- texinfo -*-\n\ @defvr {Built-in Variable} define_all_return_values\n\ If the value of @code{define_all_return_values} is nonzero, Octave\n\ @@ -779,7 +779,7 @@ The default value is 256.\n\ @end defvr"); - DEFVAR (return_last_computed_value, 0.0, return_last_computed_value, + DEFVAR (return_last_computed_value, false, return_last_computed_value, "-*- texinfo -*-\n\ @defvr {Built-in Variable} return_last_computed_value\n\ If the value of @code{return_last_computed_value} is true, and a\n\
--- a/src/ov.cc +++ b/src/ov.cc @@ -343,6 +343,12 @@ rep->count = 1; } +octave_value::octave_value (int i) + : rep (new octave_scalar (i)) +{ + rep->count = 1; +} + octave_value::octave_value (double d) : rep (new octave_scalar (d)) { @@ -579,14 +585,12 @@ octave_value octave_value::next_subsref (const std::string type, const std::list<octave_value_list>& idx, - int skip) + size_t skip) { - assert (skip > 0); - if (idx.size () > skip) { std::list<octave_value_list> new_idx (idx); - for (int i = 0; i < skip; i++) + for (size_t i = 0; i < skip; i++) new_idx.erase (new_idx.begin ()); return subsref (type.substr (skip), new_idx); } @@ -1762,7 +1766,7 @@ void symbols_of_ov (void) { - DEFVAR (do_fortran_indexing, 0.0, do_fortran_indexing, + DEFVAR (do_fortran_indexing, false, do_fortran_indexing, "-*- texinfo -*-\n\ @defvr {Built-in Variable} do_fortran_indexing\n\ If the value of @code{do_fortran_indexing} is nonzero, Octave allows \n\ @@ -1771,7 +1775,7 @@ the matrix. The default value is 0. \n\ @end defvr"); - DEFVAR (implicit_str_to_num_ok, 0.0, implicit_str_to_num_ok, + DEFVAR (implicit_str_to_num_ok, false, implicit_str_to_num_ok, "-*- texinfo -*-\n\ @defvr {Built-in Variable} implicit_str_to_num_ok\n\ If the value of @code{implicit_str_to_num_ok} is nonzero, implicit\n\ @@ -1791,7 +1795,7 @@ @code{\"warn\"}.\n\ @end defvr"); - DEFVAR (prefer_column_vectors, 1.0, prefer_column_vectors, + DEFVAR (prefer_column_vectors, true, prefer_column_vectors, "-*- texinfo -*-\n\ @defvr {Built-in Variable} prefer_column_vectors\n\ If @code{prefer_column_vectors} is nonzero, operations like\n\ @@ -1811,7 +1815,7 @@ value of @code{prefer_column_vectors}.\n\ @end defvr"); - DEFVAR (print_answer_id_name, 1.0, print_answer_id_name, + DEFVAR (print_answer_id_name, true, print_answer_id_name, "-*- texinfo -*-\n\ @defvr {Built-in Variable} print_answer_id_name\n\ If the value of @code{print_answer_id_name} is nonzero, variable\n\ @@ -1819,7 +1823,7 @@ values are printed. The default value is 1.\n\ @end defvr"); - DEFVAR (propagate_empty_matrices, 1.0, propagate_empty_matrices, + DEFVAR (propagate_empty_matrices, true, propagate_empty_matrices, "-*- texinfo -*-\n\ @defvr {Built-in Variable} propagate_empty_matrices\n\ If the value of @code{propagate_empty_matrices} is nonzero,\n\ @@ -1827,7 +1831,7 @@ if they are given one as an argument. The default value is 1.\n\ @end defvr"); - DEFVAR (resize_on_range_error, 1.0, resize_on_range_error, + DEFVAR (resize_on_range_error, true, resize_on_range_error, "-*- texinfo -*-\n\ @defvr {Built-in Variable} resize_on_range_error\n\ If the value of @code{resize_on_range_error} is nonzero, expressions\n\ @@ -1847,7 +1851,7 @@ control is returned to the top level. The default value is 1.\n\ @end defvr"); - DEFVAR (silent_functions, 0.0, silent_functions, + DEFVAR (silent_functions, false, silent_functions, "-*- texinfo -*-\n\ @defvr {Built-in Variable} silent_functions\n\ If the value of @code{silent_functions} is nonzero, internal output\n\ @@ -1875,7 +1879,7 @@ built-in variable @code{struct_levels_to_print}. The default value is 2.\n\ @end defvr"); - DEFVAR (warn_divide_by_zero, 1.0, warn_divide_by_zero, + DEFVAR (warn_divide_by_zero, true, warn_divide_by_zero, "-*- texinfo -*-\n\ @defvr {Built-in Variable} warn_divide_by_zero\n\ If the value of @code{warn_divide_by_zero} is nonzero, a warning\n\
--- a/src/ov.h +++ b/src/ov.h @@ -157,6 +157,7 @@ enum all_va_args { all_va_args_t }; octave_value (void); + octave_value (int i); octave_value (double d); octave_value (const Cell& m); octave_value (const Matrix& m); @@ -261,7 +262,7 @@ octave_value next_subsref (const std::string type, const std::list<octave_value_list>& idx, - int skip = 1); + size_t skip = 1); virtual octave_value do_index_op (const octave_value_list& idx, int resize_ok)
--- a/src/pager.cc +++ b/src/pager.cc @@ -587,7 +587,7 @@ value of the variable @code{PAGER}.\n\ @end defvr"); - DEFVAR (page_output_immediately, 0.0, page_output_immediately, + DEFVAR (page_output_immediately, false, page_output_immediately, "-*- texinfo -*-\n\ @defvr {Built-in Variable} page_output_immediately\n\ If the value of @code{page_output_immediately} is nonzero, Octave sends\n\ @@ -596,7 +596,7 @@ flush it to the pager. The default value is 0.\n\ @end defvr"); - DEFVAR (page_screen_output, 1.0, page_screen_output, + DEFVAR (page_screen_output, true, page_screen_output, "-*- texinfo -*-\n\ @defvr {Built-in Variable} page_screen_output\n\ If the value of @code{page_screen_output} is nonzero, all output\n\
--- a/src/parse.y +++ b/src/parse.y @@ -3596,7 +3596,7 @@ if (error_state) { error ("eval: expecting std::string argument"); - return -1.0; + return octave_value (-1); } return eval_string (s, silent, parse_status, nargout); @@ -3741,7 +3741,7 @@ void symbols_of_parse (void) { - DEFVAR (default_eval_print_flag, 1.0, default_eval_print_flag, + DEFVAR (default_eval_print_flag, true, default_eval_print_flag, "-*- texinfo -*-\n\ @defvr {Built-in Variable} default_eval_print_flag\n\ If the value of this variable is nonzero, Octave prints the results of\n\ @@ -3749,7 +3749,7 @@ is zero, automatic printing is suppressed. The default value is 1.\n\ @end defvr"); - DEFVAR (warn_assign_as_truth_value, 1.0, warn_assign_as_truth_value, + DEFVAR (warn_assign_as_truth_value, true, warn_assign_as_truth_value, "-*- texinfo -*-\n\ @defvr {Built-in Variable} warn_assign_as_truth_value\n\ If the value of @code{warn_assign_as_truth_value} is nonzero, a\n\ @@ -3813,7 +3813,7 @@ The default value of @code{warn_assign_as_truth_value} is 1.\n\ @end defvr"); - DEFVAR (warn_function_name_clash, 1.0, warn_function_name_clash, + DEFVAR (warn_function_name_clash, true, warn_function_name_clash, "-*- texinfo -*-\n\ @defvr {Built-in Variable} warn_function_name_clash\n\ If the value of @code{warn_function_name_clash} is nonzero, a warning is\n\ @@ -3823,14 +3823,14 @@ is 0, the warning is omitted. The default value is 1.\n\ @end defvr"); - DEFVAR (warn_future_time_stamp, 1.0, warn_future_time_stamp, + DEFVAR (warn_future_time_stamp, true, warn_future_time_stamp, "-*- texinfo -*-\n\ @defvr {Built-in Variable} warn_future_time_stamp\n\ If the value of this variable is nonzero, Octave will print a warning\n\ if it finds a function file with a time stamp that is in the future.\n\ @end defvr"); - DEFVAR (warn_missing_semicolon, 0.0, warn_missing_semicolon, + DEFVAR (warn_missing_semicolon, false, warn_missing_semicolon, "-*- texinfo -*-\n\ @defvr {Built-in Variable} warn_missing_semicolon\n\ If the value of this variable is nonzero, Octave will warn when\n\ @@ -3838,7 +3838,7 @@ value is 0.\n\ @end defvr"); - DEFVAR (warn_precedence_change, 1.0, warn_precedence_change, + DEFVAR (warn_precedence_change, true, warn_precedence_change, "-*- texinfo -*-\n\ @defvr {Built-in Variable} warn_precedence_change\n\ If the value of this variable is nonzero, Octave will warn about\n\ @@ -3847,7 +3847,7 @@ been made for Matlab compatibility. The default value is 1.\n\ @end defvr"); - DEFVAR (warn_variable_switch_label, 0.0, warn_variable_switch_label, + DEFVAR (warn_variable_switch_label, false, warn_variable_switch_label, "-*- texinfo -*-\n\ @defvr {Built-in Variable} warn_variable_switch_label\n\ If the value of this variable is nonzero, Octave will print a warning if\n\
--- a/src/pr-output.cc +++ b/src/pr-output.cc @@ -1882,8 +1882,8 @@ static void set_output_prec_and_fw (int prec, int fw) { - bind_builtin_variable ("output_precision", static_cast<double> (prec)); - bind_builtin_variable ("output_max_field_width", static_cast<double> (fw)); + bind_builtin_variable ("output_precision", prec); + bind_builtin_variable ("output_max_field_width", fw); } static void @@ -2177,7 +2177,7 @@ void symbols_of_pr_output (void) { - DEFVAR (fixed_point_format, 0.0, fixed_point_format, + DEFVAR (fixed_point_format, false, fixed_point_format, "-*- texinfo -*-\n\ @defvr {Built-in Variable} fixed_point_format\n\ If the value of this variable is nonzero, Octave will scale all values\n\ @@ -2221,7 +2221,7 @@ display for numeric output. The default value is 5.\n\ @end defvr"); - DEFVAR (print_empty_dimensions, 1.0, print_empty_dimensions, + DEFVAR (print_empty_dimensions, true, print_empty_dimensions, "-*- texinfo -*-\n\ @defvr {Built-in Variable} print_empty_dimensions\n\ If the value of @code{print_empty_dimensions} is nonzero, the\n\ @@ -2240,7 +2240,7 @@ @end example\n\ @end defvr"); - DEFVAR (split_long_rows, 1.0, split_long_rows, + DEFVAR (split_long_rows, true, split_long_rows, "-*- texinfo -*-\n\ @defvr {Built-in Variable} split_long_rows\n\ For large matrices, Octave may not be able to display all the columns of\n\
--- a/src/pt-assign.cc +++ b/src/pt-assign.cc @@ -332,7 +332,7 @@ void symbols_of_pt_assign (void) { - DEFVAR (print_rhs_assign_val, 0.0, print_rhs_assign_val, + DEFVAR (print_rhs_assign_val, false, print_rhs_assign_val, "-*- texinfo -*-\n\ @defvr print_rhs_assign_val\n\ If the value of this variable is non-zero, Octave will print the value\n\
--- a/src/pt-bp.cc +++ b/src/pt-bp.cc @@ -55,7 +55,7 @@ { if (tr.is_breakpoint ()) { - bp_list.append (octave_value (static_cast<double> (tr.line ()))); + bp_list.append (octave_value (tr.line ())); line = tr.line () + 1; } }
--- a/src/pt-cell.cc +++ b/src/pt-cell.cc @@ -59,7 +59,7 @@ if (nc < 0) nc = elt->length (); - else if (nc != elt->length ()) + else if (nc != static_cast<int> (elt->length ())) { ::error ("number of columns must match"); return retval;
--- a/src/pt-decl.cc +++ b/src/pt-decl.cc @@ -216,7 +216,7 @@ the variable @code{default_global_variable_value} is initially undefined.\n\ @end defvr"); - DEFVAR (initialize_global_variables, 0.0, initialize_global_variables, + DEFVAR (initialize_global_variables, false, initialize_global_variables, "-*- texinfo -*-\n\ @defvr initialize_global_variables\n\ If the value of this variable is nonzero, global variables are given\n\
--- a/src/pt-idx.cc +++ b/src/pt-idx.cc @@ -283,7 +283,7 @@ case '.': { - idx.push_back (get_struct_index (p_arg_nm, p_dyn_field)); + idx.push_back (octave_value (get_struct_index (p_arg_nm, p_dyn_field))); if (error_state) eval_error (); @@ -349,7 +349,7 @@ case '.': { - idx.push_back (get_struct_index (p_arg_nm, p_dyn_field)); + idx.push_back (octave_value (get_struct_index (p_arg_nm, p_dyn_field))); if (error_state) eval_error ();
--- a/src/pt-mat.cc +++ b/src/pt-mat.cc @@ -621,7 +621,7 @@ void symbols_of_pt_mat (void) { - DEFVAR (empty_list_elements_ok, 1.0, empty_list_elements_ok, + DEFVAR (empty_list_elements_ok, true, empty_list_elements_ok, "-*- texinfo -*-\n\ @defvr {Built-in Variable} empty_list_elements_ok\n\ This variable controls whether Octave ignores empty matrices in a matrix\n\ @@ -640,7 +640,7 @@ The default value is 1.\n\ @end defvr"); - DEFVAR (implicit_num_to_str_ok, 0.0, implicit_num_to_str_ok, + DEFVAR (implicit_num_to_str_ok, false, implicit_num_to_str_ok, "-*- texinfo -*-\n\ @defvr {Built-in Variable} implicit_num_to_str_ok\n\ If the value of @code{implicit_num_to_str_ok} is nonzero, implicit\n\
--- a/src/pt-plot.cc +++ b/src/pt-plot.cc @@ -1031,7 +1031,7 @@ the plot device will be cleared before drawing the next line.\n\ @end deftypefn") { - return static_cast<double> (! clear_before_plotting); + return octave_value (! clear_before_plotting); } DEFUN (purge_tmp_files, , , @@ -1283,7 +1283,7 @@ void symbols_of_pt_plot (void) { - DEFVAR (automatic_replot, 0.0, automatic_replot, + DEFVAR (automatic_replot, false, automatic_replot, "-*- texinfo -*-\n\ @defvr {Built-in Variable} automatic_replot\n\ You can tell Octave to redisplay the plot each time anything about it\n\ @@ -1340,9 +1340,9 @@ @end defvr"); #if defined (GNUPLOT_HAS_FRAMES) - double with_frames = 1.0; + bool with_frames = true; #else - double with_frames = 0.0; + bool with_frames = false; #endif DEFVAR (gnuplot_has_frames, with_frames, gnuplot_has_frames, @@ -1356,9 +1356,9 @@ @end defvr"); #if defined (GNUPLOT_HAS_MULTIPLOT) - double with_multiplot = 1.0; + bool with_multiplot = true; #else - double with_multiplot = 0.0; + bool with_multiplot = false; #endif DEFVAR (gnuplot_has_multiplot, with_multiplot, gnuplot_has_multiplot,
--- a/src/pt-select.cc +++ b/src/pt-select.cc @@ -132,9 +132,6 @@ { bool retval = false; - int t1 = val.type_id (); - int t2 = test.type_id (); - // If there is no op_eq for these types, we can't compare values. if (val.rows () == test.rows () && val.columns () == test.columns ())
--- a/src/sighandlers.cc +++ b/src/sighandlers.cc @@ -625,7 +625,7 @@ void symbols_of_sighandlers (void) { - DEFVAR (debug_on_interrupt, 0.0, debug_on_interrupt, + DEFVAR (debug_on_interrupt, false, debug_on_interrupt, "-*- texinfo -*-\n\ @defvr {Built-in Variable} debug_on_interrupt\n\ If @code{debug_on_interrupt} is nonzero, Octave will try to enter\n\
--- a/src/strfns.cc +++ b/src/strfns.cc @@ -41,12 +41,12 @@ Return 1 if @var{a} is a string. Otherwise, return 0.\n\ @end deftypefn") { - octave_value_list retval; + octave_value retval; int nargin = args.length (); if (nargin == 1 && args(0).is_defined ()) - retval = static_cast<double> (args(0).is_string ()); + retval = args(0).is_string (); else print_usage ("isstr"); @@ -68,7 +68,7 @@ @end example\n\ @end deftypefn") { - octave_value_list retval; + octave_value retval; int nargin = args.length ();
--- a/src/symtab.cc +++ b/src/symtab.cc @@ -1076,7 +1076,7 @@ void symbols_of_symtab (void) { - DEFVAR (variables_can_hide_functions, 1.0, variables_can_hide_functions, + DEFVAR (variables_can_hide_functions, true, variables_can_hide_functions, "-*- texinfo -*-\n\ @defvr variables_can_hide_functions\n\ If the value of this variable is nonzero, assignments to variables may\n\
--- a/src/syscalls.cc +++ b/src/syscalls.cc @@ -65,24 +65,24 @@ { Octave_map m; - m["dev"] = static_cast<double> (fs.dev ()); - m["ino"] = static_cast<double> (fs.ino ()); - m["modestr"] = fs.mode_as_string (); - m["nlink"] = static_cast<double> (fs.nlink ()); - m["uid"] = static_cast<double> (fs.uid ()); - m["gid"] = static_cast<double> (fs.gid ()); + m["dev"](0) = static_cast<double> (fs.dev ()); + m["ino"](0) = static_cast<double> (fs.ino ()); + m["modestr"](0) = fs.mode_as_string (); + m["nlink"](0) = static_cast<double> (fs.nlink ()); + m["uid"](0) = static_cast<double> (fs.uid ()); + m["gid"](0) = static_cast<double> (fs.gid ()); #if defined (HAVE_STRUCT_STAT_ST_RDEV) - m["rdev"] = static_cast<double> (fs.rdev ()); + m["rdev"](0) = static_cast<double> (fs.rdev ()); #endif - m["size"] = static_cast<double> (fs.size ()); - m["atime"] = static_cast<double> (fs.atime ()); - m["mtime"] = static_cast<double> (fs.mtime ()); - m["ctime"] = static_cast<double> (fs.ctime ()); + m["size"](0) = static_cast<double> (fs.size ()); + m["atime"](0) = static_cast<double> (fs.atime ()); + m["mtime"](0) = static_cast<double> (fs.mtime ()); + m["ctime"](0) = static_cast<double> (fs.ctime ()); #if defined (HAVE_STRUCT_STAT_ST_BLKSIZE) - m["blksize"] = static_cast<double> (fs.blksize ()); + m["blksize"](0) = static_cast<double> (fs.blksize ()); #endif #if defined (HAVE_STRUCT_STAT_ST_BLOCKS) - m["blocks"] = static_cast<double> (fs.blocks ()); + m["blocks"](0) = static_cast<double> (fs.blocks ()); #endif return m; @@ -126,7 +126,7 @@ int status = octave_syscalls::dup2 (i_old, i_new, msg); - retval(0) = static_cast<double> (status); + retval(0) = status; retval(1) = msg; } } @@ -205,7 +205,7 @@ int status = octave_syscalls::execvp (exec_file, exec_args, msg); - retval(0) = static_cast<double> (status); + retval(0) = status; retval(1) = msg; } } @@ -301,7 +301,7 @@ int status = octave_syscalls::fcntl (fid, req, arg, msg); - retval(0) = static_cast<double> (status); + retval(0) = status; retval(1) = msg; } } @@ -351,7 +351,7 @@ pid_t pid = octave_syscalls::fork (msg); - retval(0) = static_cast<double> (pid); + retval(0) = pid; retval(1) = msg; } else @@ -377,7 +377,7 @@ { std::string msg; - retval(0) = static_cast<double> (octave_syscalls::getpgrp (msg)); + retval(0) = octave_syscalls::getpgrp (msg); retval(1) = msg; } else @@ -392,7 +392,7 @@ Return the process id of the current process.\n\ @end deftypefn") { - double retval = -1.0; + octave_value retval = -1; int nargin = args.length (); @@ -410,7 +410,7 @@ Return the process id of the parent process.\n\ @end deftypefn") { - double retval = -1.0; + octave_value retval = -1; int nargin = args.length (); @@ -428,12 +428,12 @@ Return the effective group id of the current process.\n\ @end deftypefn") { - double retval = -1.0; + octave_value retval = -1; int nargin = args.length (); if (nargin == 0) - retval = octave_syscalls::getegid (); + retval = static_cast<double> (octave_syscalls::getegid ()); else print_usage ("getegid"); @@ -446,12 +446,12 @@ Return the real group id of the current process.\n\ @end deftypefn") { - double retval = -1.0; + octave_value retval = -1; int nargin = args.length (); if (nargin == 0) - retval = octave_syscalls::getgid (); + retval = static_cast<double> (octave_syscalls::getgid ()); else print_usage ("getgid"); @@ -464,12 +464,12 @@ Return the effective user id of the current process.\n\ @end deftypefn") { - double retval = -1.0; + octave_value retval = -1; int nargin = args.length (); if (nargin == 0) - retval = octave_syscalls::geteuid (); + retval = static_cast<double> (octave_syscalls::geteuid ()); else print_usage ("geteuid"); @@ -482,12 +482,12 @@ Return the real user id of the current process.\n\ @end deftypefn") { - double retval = -1.0; + octave_value retval = -1; int nargin = args.length (); if (nargin == 0) - retval = octave_syscalls::getuid (); + retval = static_cast<double> (octave_syscalls::getuid ()); else print_usage ("getuid"); @@ -514,7 +514,7 @@ { retval(2) = std::string (); retval(1) = 0.0; - retval(0) = octave_value (mk_stat_map (fs)); + retval(0) = mk_stat_map (fs); } else { @@ -563,7 +563,7 @@ int status = file_ops::mkfifo (name, mode, msg); - retval(0) = static_cast<double> (status); + retval(0) = status; if (status < 0) retval(1) = msg; @@ -622,7 +622,7 @@ file_ids(1) = octave_stream_list::insert (os); file_ids(0) = octave_stream_list::insert (is); - retval(1) = static_cast<double> (status); + retval(1) = status; retval(0) = octave_value (file_ids); } } @@ -777,7 +777,7 @@ int status = file_ops::unlink (name, msg); - retval(0) = static_cast<double> (status); + retval(0) = status; retval(1) = msg; } else @@ -864,7 +864,7 @@ pid_t status = octave_syscalls::waitpid (pid, options, msg); - retval(0) = static_cast<double> (status); + retval(0) = status; retval(1) = msg; } } @@ -885,105 +885,105 @@ symbols_of_syscalls (void) { #if defined (F_DUPFD) - DEFCONSTX ("F_DUPFD", SBV_F_DUPFD, static_cast<double> (F_DUPFD), + DEFCONSTX ("F_DUPFD", SBV_F_DUPFD, F_DUPFD, "-*- texinfo -*-\n\ @defvr {Built-in Variable} F_DUPFD\n\ @end defvr"); #endif #if defined (F_GETFD) - DEFCONSTX ("F_GETFD", SBV_F_GETFD, static_cast<double> (F_GETFD), + DEFCONSTX ("F_GETFD", SBV_F_GETFD, F_GETFD, "-*- texinfo -*-\n\ @defvr {Built-in Variable} F_GETFD\n\ @end defvr"); #endif #if defined (F_GETFL) - DEFCONSTX ("F_GETFL", SBV_F_GETFL, static_cast<double> (F_GETFL), + DEFCONSTX ("F_GETFL", SBV_F_GETFL, F_GETFL, "-*- texinfo -*-\n\ @defvr {Built-in Variable} F_GETFL\n\ @end defvr"); #endif #if defined (F_SETFD) - DEFCONSTX ("F_SETFD", SBV_F_SETFD, static_cast<double> (F_SETFD), + DEFCONSTX ("F_SETFD", SBV_F_SETFD, F_SETFD, "-*- texinfo -*-\n\ @defvr {Built-in Variable} F_SETFD\n\ @end defvr"); #endif #if defined (F_SETFL) - DEFCONSTX ("F_SETFL", SBV_F_SETFL, static_cast<double> (F_SETFL), + DEFCONSTX ("F_SETFL", SBV_F_SETFL, F_SETFL, "-*- texinfo -*-\n\ @defvr {Built-in Variable} F_SETFL\n\ @end defvr"); #endif #if defined (O_APPEND) - DEFCONSTX ("O_APPEND", SBV_O_APPEND, static_cast<double> (O_APPEND), + DEFCONSTX ("O_APPEND", SBV_O_APPEND, O_APPEND, "-*- texinfo -*-\n\ @defvr {Built-in Variable} O_APPEND\n\ @end defvr"); #endif #if defined (O_ASYNC) - DEFCONSTX ("O_ASYNC", SBV_O_ASYNC, static_cast<double> (O_ASYNC), + DEFCONSTX ("O_ASYNC", SBV_O_ASYNC, O_ASYNC, "-*- texinfo -*-\n\ @defvr {Built-in Variable} O_ASYNC\n\ @end defvr"); #endif #if defined (O_CREAT) - DEFCONSTX ("O_CREAT", SBV_O_CREAT, static_cast<double> (O_CREAT), + DEFCONSTX ("O_CREAT", SBV_O_CREAT, O_CREAT, "-*- texinfo -*-\n\ @defvr {Built-in Variable} O_CREAT\n\ @end defvr"); #endif #if defined (O_EXCL) - DEFCONSTX ("O_EXCL", SBV_O_EXCL, static_cast<double> (O_EXCL), + DEFCONSTX ("O_EXCL", SBV_O_EXCL, O_EXCL, "-*- texinfo -*-\n\ @defvr {Built-in Variable} O_EXCL\n\ @end defvr"); #endif #if defined (O_NONBLOCK) - DEFCONSTX ("O_NONBLOCK", SBV_O_NONBLOCK, static_cast<double> (O_NONBLOCK), + DEFCONSTX ("O_NONBLOCK", SBV_O_NONBLOCK, O_NONBLOCK, "-*- texinfo -*-\n\ @defvr {Built-in Variable} O_NONBLOCK\n\ @end defvr"); #endif #if defined (O_RDONLY) - DEFCONSTX ("O_RDONLY", SBV_O_RDONLY, static_cast<double> (O_RDONLY), + DEFCONSTX ("O_RDONLY", SBV_O_RDONLY, O_RDONLY, "-*- texinfo -*-\n\ @defvr {Built-in Variable} O_RDONLY\n\ @end defvr"); #endif #if defined (O_RDWR) - DEFCONSTX ("O_RDWR", SBV_O_RDWR, static_cast<double> (O_RDWR), + DEFCONSTX ("O_RDWR", SBV_O_RDWR, O_RDWR, "-*- texinfo -*-\n\ @defvr {Built-in Variable} O_RDWR\n\ @end defvr"); #endif #if defined (O_SYNC) - DEFCONSTX ("O_SYNC", SBV_O_SYNC, static_cast<double> (O_SYNC), + DEFCONSTX ("O_SYNC", SBV_O_SYNC, O_SYNC, "-*- texinfo -*-\n\ @defvr {Built-in Variable} O_SYNC\n\ @end defvr"); #endif #if defined (O_TRUNC) - DEFCONSTX ("O_TRUNC", SBV_O_TRUNC, static_cast<double> (O_TRUNC), + DEFCONSTX ("O_TRUNC", SBV_O_TRUNC, O_TRUNC, "-*- texinfo -*-\n\ @defvr {Built-in Variable} O_TRUNC\n\ @end defvr"); #endif #if defined (O_WRONLY) - DEFCONSTX ("O_WRONLY", SBV_O_WRONLY, static_cast<double> (O_WRONLY), + DEFCONSTX ("O_WRONLY", SBV_O_WRONLY, O_WRONLY, "-*- texinfo -*-\n\ @defvr {Built-in Variable} O_WRONLY\n\ @end defvr");
--- a/src/sysdep.cc +++ b/src/sysdep.cc @@ -387,7 +387,7 @@ returns a string containing the value of your path.\n\ @end deftypefn") { - octave_value_list retval; + octave_value retval; int nargin = args.length (); @@ -461,7 +461,7 @@ returning the empty string if no key is available.\n\ @end deftypefn") { - octave_value_list retval; + octave_value retval; // XXX FIXME XXX -- add timeout and default value args? @@ -608,8 +608,8 @@ oct_mach_info::float_format flt_fmt = oct_mach_info::native_float_format (); - return static_cast<double> (flt_fmt == oct_mach_info::ieee_little_endian - || flt_fmt == oct_mach_info::ieee_big_endian); + return octave_value (flt_fmt == oct_mach_info::ieee_little_endian + || flt_fmt == oct_mach_info::ieee_big_endian); } DEFUN (tilde_expand, args, , @@ -633,7 +633,7 @@ @end example\n\ @end deftypefn") { - octave_value_list retval; + octave_value retval; int nargin = args.length ();
--- a/src/toplev.cc +++ b/src/toplev.cc @@ -262,7 +262,7 @@ @end example\n\ @end deftypefn") { - octave_value_list retval; + octave_value retval; int nargin = args.length (); @@ -563,7 +563,7 @@ if (WIFEXITED (status)) status = WEXITSTATUS (status); - retval = static_cast<double> (status); + retval(0) = status; } } } @@ -588,11 +588,11 @@ while (! octave_atexit_functions.empty ()) { - octave_value_list fcn = octave_atexit_functions.top (); + std::string fcn = octave_atexit_functions.top (); octave_atexit_functions.pop (); - feval (fcn, 0); + feval (fcn, octave_value_list (), 0); flush_octave_stdout (); } @@ -684,110 +684,110 @@ Octave_map m; - m ["ALL_CFLAGS"] = OCTAVE_CONF_ALL_CFLAGS; - m ["ALL_CXXFLAGS"] = OCTAVE_CONF_ALL_CXXFLAGS; - m ["ALL_FFLAGS"] = OCTAVE_CONF_ALL_FFLAGS; - m ["ALL_LDFLAGS"] = OCTAVE_CONF_ALL_LDFLAGS; - m ["AR"] = OCTAVE_CONF_AR; - m ["ARFLAGS"] = OCTAVE_CONF_ARFLAGS; - m ["BLAS_LIBS"] = OCTAVE_CONF_BLAS_LIBS; - m ["CC"] = OCTAVE_CONF_CC; - m ["CC_VERSION"] = OCTAVE_CONF_CC_VERSION; - m ["CFLAGS"] = OCTAVE_CONF_CFLAGS; - m ["CPICFLAG"] = OCTAVE_CONF_CPICFLAG; - m ["CPPFLAGS"] = OCTAVE_CONF_CPPFLAGS; - m ["CXX"] = OCTAVE_CONF_CXX; - m ["CXXCPP"] = OCTAVE_CONF_CXXCPP; - m ["CXXFLAGS"] = OCTAVE_CONF_CXXFLAGS; - m ["CXXPICFLAG"] = OCTAVE_CONF_CXXPICFLAG; - m ["CXX_VERSION"] = OCTAVE_CONF_CXX_VERSION; - m ["DEFAULT_PAGER"] = OCTAVE_DEFAULT_PAGER; - m ["DLFCN_INCFLAGS"] = OCTAVE_CONF_DLFCN_INCFLAGS; - m ["EXEEXT"] = OCTAVE_CONF_EXEEXT; - m ["F2C"] = OCTAVE_CONF_F2C; - m ["F2CFLAGS"] = OCTAVE_CONF_F2CFLAGS; - m ["F77"] = OCTAVE_CONF_F77; - m ["FC"] = OCTAVE_CONF_FC; - m ["FFLAGS"] = OCTAVE_CONF_FFLAGS; - m ["FFTW_LIBS"] = OCTAVE_CONF_FFTW_LIBS; - m ["FLIBS"] = OCTAVE_CONF_FLIBS; - m ["FPICFLAG"] = OCTAVE_CONF_FPICFLAG; - m ["GLOB_INCFLAGS"] = OCTAVE_CONF_GLOB_INCFLAGS; - m ["INCFLAGS"] = OCTAVE_CONF_INCFLAGS; - m ["LDFLAGS"] = OCTAVE_CONF_LDFLAGS; - m ["LD_CXX"] = OCTAVE_CONF_LD_CXX; - m ["LD_STATIC_FLAG"] = OCTAVE_CONF_LD_STATIC_FLAG; - m ["LEX"] = OCTAVE_CONF_LEX; - m ["LEXLIB"] = OCTAVE_CONF_LEXLIB; - m ["LFLAGS"] = OCTAVE_CONF_LFLAGS; - m ["LIBCRUFT"] = OCTAVE_CONF_LIBCRUFT; - m ["LIBDLFCN"] = OCTAVE_CONF_LIBDLFCN; - m ["LIBEXT"] = OCTAVE_CONF_LIBEXT; - m ["LIBFLAGS"] = OCTAVE_CONF_LIBFLAGS; - m ["LIBGLOB"] = OCTAVE_CONF_LIBGLOB; - m ["LIBKPATHSEA"] = OCTAVE_CONF_LIBKPATHSEA; - m ["LIBOCTAVE"] = OCTAVE_CONF_LIBOCTAVE; - m ["LIBOCTINTERP"] = OCTAVE_CONF_LIBOCTINTERP; - m ["LIBPLPLOT"] = OCTAVE_CONF_LIBPLPLOT; - m ["LIBREADLINE"] = OCTAVE_CONF_LIBREADLINE; - m ["LIBS"] = OCTAVE_CONF_LIBS; - m ["LN_S"] = OCTAVE_CONF_LN_S; - m ["MKOCTFILE_INCFLAGS"] = OCTAVE_CONF_MKOCTFILE_INCFLAGS; - m ["MKOCTFILE_LFLAGS"] = OCTAVE_CONF_MKOCTFILE_LFLAGS; - m ["MKOCTFILE_SH_LDFLAGS"] = OCTAVE_CONF_MKOCTFILE_SH_LDFLAGS; - m ["RANLIB"] = OCTAVE_CONF_RANLIB; - m ["RDYNAMIC_FLAG"] = OCTAVE_CONF_RDYNAMIC_FLAG; - m ["RLD_FLAG"] = OCTAVE_CONF_RLD_FLAG; - m ["RUNTEST"] = OCTAVE_CONF_RUNTEST; - m ["SED"] = OCTAVE_CONF_SED; - m ["SHARED_LIBS"] = OCTAVE_CONF_SHARED_LIBS; - m ["SHLEXT"] = OCTAVE_CONF_SHLEXT; - m ["SHLEXT_VER"] = OCTAVE_CONF_SHLEXT_VER; - m ["SH_LD"] = OCTAVE_CONF_SH_LD; - m ["SH_LDFLAGS"] = OCTAVE_CONF_SH_LDFLAGS; - m ["SONAME_FLAGS"] = OCTAVE_CONF_SONAME_FLAGS; - m ["STATIC_LIBS"] = OCTAVE_CONF_STATIC_LIBS; - m ["UGLY_DEFS"] = OCTAVE_CONF_DEFS; - m ["UGLY_DEFS"] = OCTAVE_CONF_UGLY_DEFS; - m ["ENABLE_DYNAMIC_LINKING"] = OCTAVE_CONF_ENABLE_DYNAMIC_LINKING; - m ["XTRA_CFLAGS"] = OCTAVE_CONF_XTRA_CFLAGS; - m ["XTRA_CXXFLAGS"] = OCTAVE_CONF_XTRA_CXXFLAGS; - m ["YACC"] = OCTAVE_CONF_YACC; - m ["YFLAGS"] = OCTAVE_CONF_YFLAGS; - m ["archlibdir"] = OCTAVE_ARCHLIBDIR; - m ["bindir"] = OCTAVE_BINDIR; - m ["canonical_host_type"] = OCTAVE_CANONICAL_HOST_TYPE; - m ["config_opts"] = OCTAVE_CONF_config_opts; - m ["datadir"] = OCTAVE_DATADIR; - m ["dld"] = static_cast<double> (octave_supports_dynamic_linking); - m ["exec_prefix"] = OCTAVE_EXEC_PREFIX; - m ["fcnfiledir"] = OCTAVE_FCNFILEDIR; - m ["fcnfilepath"] = OCTAVE_FCNFILEPATH; - m ["imagedir"] = OCTAVE_IMAGEDIR; - m ["imagepath"] = OCTAVE_IMAGEPATH; - m ["includedir"] = OCTAVE_INCLUDEDIR; - m ["infodir"] = OCTAVE_INFODIR; - m ["infofile"] = OCTAVE_INFOFILE; - m ["libdir"] = OCTAVE_LIBDIR; - m ["libexecdir"] = OCTAVE_LIBEXECDIR; - m ["localarchlibdir"] = OCTAVE_LOCALARCHLIBDIR; - m ["localfcnfiledir"] = OCTAVE_LOCALFCNFILEDIR; - m ["localfcnfilepath"] = OCTAVE_LOCALFCNFILEPATH; - m ["localoctfiledir"] = OCTAVE_LOCALOCTFILEDIR; - m ["localoctfilepath"] = OCTAVE_LOCALOCTFILEPATH; - m ["localstartupfiledir"] = OCTAVE_LOCALSTARTUPFILEDIR; - m ["localverarchlibdir"] = OCTAVE_LOCALVERARCHLIBDIR; - m ["localverfcnfiledir"] = OCTAVE_LOCALVERFCNFILEDIR; - m ["localveroctfiledir"] = OCTAVE_LOCALVEROCTFILEDIR; - m ["man1dir"] = OCTAVE_MAN1DIR; - m ["man1ext"] = OCTAVE_MAN1EXT; - m ["mandir"] = OCTAVE_MANDIR; - m ["octfiledir"] = OCTAVE_OCTFILEDIR; - m ["octincludedir"] = OCTAVE_OCTINCLUDEDIR; - m ["octlibdir"] = OCTAVE_OCTLIBDIR; - m ["prefix"] = OCTAVE_PREFIX; - m ["startupfiledir"] = OCTAVE_STARTUPFILEDIR; - m ["version"] = OCTAVE_VERSION; + m ["ALL_CFLAGS"](0) = OCTAVE_CONF_ALL_CFLAGS; + m ["ALL_CXXFLAGS"](0) = OCTAVE_CONF_ALL_CXXFLAGS; + m ["ALL_FFLAGS"](0) = OCTAVE_CONF_ALL_FFLAGS; + m ["ALL_LDFLAGS"](0) = OCTAVE_CONF_ALL_LDFLAGS; + m ["AR"](0) = OCTAVE_CONF_AR; + m ["ARFLAGS"](0) = OCTAVE_CONF_ARFLAGS; + m ["BLAS_LIBS"](0) = OCTAVE_CONF_BLAS_LIBS; + m ["CC"](0) = OCTAVE_CONF_CC; + m ["CC_VERSION"](0) = OCTAVE_CONF_CC_VERSION; + m ["CFLAGS"](0) = OCTAVE_CONF_CFLAGS; + m ["CPICFLAG"](0) = OCTAVE_CONF_CPICFLAG; + m ["CPPFLAGS"](0) = OCTAVE_CONF_CPPFLAGS; + m ["CXX"](0) = OCTAVE_CONF_CXX; + m ["CXXCPP"](0) = OCTAVE_CONF_CXXCPP; + m ["CXXFLAGS"](0) = OCTAVE_CONF_CXXFLAGS; + m ["CXXPICFLAG"](0) = OCTAVE_CONF_CXXPICFLAG; + m ["CXX_VERSION"](0) = OCTAVE_CONF_CXX_VERSION; + m ["DEFAULT_PAGER"](0) = OCTAVE_DEFAULT_PAGER; + m ["DLFCN_INCFLAGS"](0) = OCTAVE_CONF_DLFCN_INCFLAGS; + m ["EXEEXT"](0) = OCTAVE_CONF_EXEEXT; + m ["F2C"](0) = OCTAVE_CONF_F2C; + m ["F2CFLAGS"](0) = OCTAVE_CONF_F2CFLAGS; + m ["F77"](0) = OCTAVE_CONF_F77; + m ["FC"](0) = OCTAVE_CONF_FC; + m ["FFLAGS"](0) = OCTAVE_CONF_FFLAGS; + m ["FFTW_LIBS"](0) = OCTAVE_CONF_FFTW_LIBS; + m ["FLIBS"](0) = OCTAVE_CONF_FLIBS; + m ["FPICFLAG"](0) = OCTAVE_CONF_FPICFLAG; + m ["GLOB_INCFLAGS"](0) = OCTAVE_CONF_GLOB_INCFLAGS; + m ["INCFLAGS"](0) = OCTAVE_CONF_INCFLAGS; + m ["LDFLAGS"](0) = OCTAVE_CONF_LDFLAGS; + m ["LD_CXX"](0) = OCTAVE_CONF_LD_CXX; + m ["LD_STATIC_FLAG"](0) = OCTAVE_CONF_LD_STATIC_FLAG; + m ["LEX"](0) = OCTAVE_CONF_LEX; + m ["LEXLIB"](0) = OCTAVE_CONF_LEXLIB; + m ["LFLAGS"](0) = OCTAVE_CONF_LFLAGS; + m ["LIBCRUFT"](0) = OCTAVE_CONF_LIBCRUFT; + m ["LIBDLFCN"](0) = OCTAVE_CONF_LIBDLFCN; + m ["LIBEXT"](0) = OCTAVE_CONF_LIBEXT; + m ["LIBFLAGS"](0) = OCTAVE_CONF_LIBFLAGS; + m ["LIBGLOB"](0) = OCTAVE_CONF_LIBGLOB; + m ["LIBKPATHSEA"](0) = OCTAVE_CONF_LIBKPATHSEA; + m ["LIBOCTAVE"](0) = OCTAVE_CONF_LIBOCTAVE; + m ["LIBOCTINTERP"](0) = OCTAVE_CONF_LIBOCTINTERP; + m ["LIBPLPLOT"](0) = OCTAVE_CONF_LIBPLPLOT; + m ["LIBREADLINE"](0) = OCTAVE_CONF_LIBREADLINE; + m ["LIBS"](0) = OCTAVE_CONF_LIBS; + m ["LN_S"](0) = OCTAVE_CONF_LN_S; + m ["MKOCTFILE_INCFLAGS"](0) = OCTAVE_CONF_MKOCTFILE_INCFLAGS; + m ["MKOCTFILE_LFLAGS"](0) = OCTAVE_CONF_MKOCTFILE_LFLAGS; + m ["MKOCTFILE_SH_LDFLAGS"](0) = OCTAVE_CONF_MKOCTFILE_SH_LDFLAGS; + m ["RANLIB"](0) = OCTAVE_CONF_RANLIB; + m ["RDYNAMIC_FLAG"](0) = OCTAVE_CONF_RDYNAMIC_FLAG; + m ["RLD_FLAG"](0) = OCTAVE_CONF_RLD_FLAG; + m ["RUNTEST"](0) = OCTAVE_CONF_RUNTEST; + m ["SED"](0) = OCTAVE_CONF_SED; + m ["SHARED_LIBS"](0) = OCTAVE_CONF_SHARED_LIBS; + m ["SHLEXT"](0) = OCTAVE_CONF_SHLEXT; + m ["SHLEXT_VER"](0) = OCTAVE_CONF_SHLEXT_VER; + m ["SH_LD"](0) = OCTAVE_CONF_SH_LD; + m ["SH_LDFLAGS"](0) = OCTAVE_CONF_SH_LDFLAGS; + m ["SONAME_FLAGS"](0) = OCTAVE_CONF_SONAME_FLAGS; + m ["STATIC_LIBS"](0) = OCTAVE_CONF_STATIC_LIBS; + m ["UGLY_DEFS"](0) = OCTAVE_CONF_DEFS; + m ["UGLY_DEFS"](0) = OCTAVE_CONF_UGLY_DEFS; + m ["ENABLE_DYNAMIC_LINKING"](0) = OCTAVE_CONF_ENABLE_DYNAMIC_LINKING; + m ["XTRA_CFLAGS"](0) = OCTAVE_CONF_XTRA_CFLAGS; + m ["XTRA_CXXFLAGS"](0) = OCTAVE_CONF_XTRA_CXXFLAGS; + m ["YACC"](0) = OCTAVE_CONF_YACC; + m ["YFLAGS"](0) = OCTAVE_CONF_YFLAGS; + m ["archlibdir"](0) = OCTAVE_ARCHLIBDIR; + m ["bindir"](0) = OCTAVE_BINDIR; + m ["canonical_host_type"](0) = OCTAVE_CANONICAL_HOST_TYPE; + m ["config_opts"](0) = OCTAVE_CONF_config_opts; + m ["datadir"](0) = OCTAVE_DATADIR; + m ["dld"](0) = octave_supports_dynamic_linking; + m ["exec_prefix"](0) = OCTAVE_EXEC_PREFIX; + m ["fcnfiledir"](0) = OCTAVE_FCNFILEDIR; + m ["fcnfilepath"](0) = OCTAVE_FCNFILEPATH; + m ["imagedir"](0) = OCTAVE_IMAGEDIR; + m ["imagepath"](0) = OCTAVE_IMAGEPATH; + m ["includedir"](0) = OCTAVE_INCLUDEDIR; + m ["infodir"](0) = OCTAVE_INFODIR; + m ["infofile"](0) = OCTAVE_INFOFILE; + m ["libdir"](0) = OCTAVE_LIBDIR; + m ["libexecdir"](0) = OCTAVE_LIBEXECDIR; + m ["localarchlibdir"](0) = OCTAVE_LOCALARCHLIBDIR; + m ["localfcnfiledir"](0) = OCTAVE_LOCALFCNFILEDIR; + m ["localfcnfilepath"](0) = OCTAVE_LOCALFCNFILEPATH; + m ["localoctfiledir"](0) = OCTAVE_LOCALOCTFILEDIR; + m ["localoctfilepath"](0) = OCTAVE_LOCALOCTFILEPATH; + m ["localstartupfiledir"](0) = OCTAVE_LOCALSTARTUPFILEDIR; + m ["localverarchlibdir"](0) = OCTAVE_LOCALVERARCHLIBDIR; + m ["localverfcnfiledir"](0) = OCTAVE_LOCALVERFCNFILEDIR; + m ["localveroctfiledir"](0) = OCTAVE_LOCALVEROCTFILEDIR; + m ["man1dir"](0) = OCTAVE_MAN1DIR; + m ["man1ext"](0) = OCTAVE_MAN1EXT; + m ["mandir"](0) = OCTAVE_MANDIR; + m ["octfiledir"](0) = OCTAVE_OCTFILEDIR; + m ["octincludedir"](0) = OCTAVE_OCTINCLUDEDIR; + m ["octlibdir"](0) = OCTAVE_OCTLIBDIR; + m ["prefix"](0) = OCTAVE_PREFIX; + m ["startupfiledir"](0) = OCTAVE_STARTUPFILEDIR; + m ["version"](0) = OCTAVE_VERSION; int nargin = args.length (); @@ -796,10 +796,10 @@ std::string arg = args(0).string_value (); if (! error_state) - retval = octave_value (m [arg.c_str ()](0)); + retval = m [arg.c_str ()](0); } else if (nargin == 0) - retval = octave_value (m); + retval = m; else print_usage ("octave_config_info");
--- a/src/utils.cc +++ b/src/utils.cc @@ -823,7 +823,7 @@ void symbols_of_utils (void) { - DEFVAR (treat_neg_dim_as_zero, 0.0, treat_neg_dim_as_zero, + DEFVAR (treat_neg_dim_as_zero, false, treat_neg_dim_as_zero, "-*- texinfo -*-\n\ @defvr {Built-in Variable} treat_neg_dim_as_zero\n\ If the value of @code{treat_neg_dim_as_zero} is nonzero, expressions\n\
--- a/src/variables.cc +++ b/src/variables.cc @@ -502,7 +502,7 @@ @end example\n\ @end deftypefn") { - octave_value retval = 0.0; + octave_value retval = false; int nargin = args.length (); @@ -522,7 +522,7 @@ symbol_record *sr = curr_sym_tab->lookup (name); - retval = static_cast<double> (sr && sr->is_linked_to_global ()); + retval = (sr && sr->is_linked_to_global ()); return retval; } @@ -671,7 +671,7 @@ @end table\n\ @end deftypefn") { - octave_value retval = 0.0; + octave_value retval = false; int nargin = args.length (); @@ -685,7 +685,7 @@ = (nargin == 2) ? args(1).string_value () : std::string ("any"); if (! error_state) - retval = static_cast<double> (symbol_exist (name, type)); + retval = symbol_exist (name, type); else error ("exist: expecting second argument to be a string"); }