Mercurial > hg > octave-terminal
changeset 565:b04c0d02f2de
[project @ 1994-07-26 01:03:20 by jwe]
author | jwe |
---|---|
date | Tue, 26 Jul 1994 01:05:16 +0000 |
parents | 6e376eb337dd |
children | 8529a21443fa |
files | src/dassl.cc src/data.cc src/find.cc src/fsolve.cc src/lsode.cc src/npsol.cc src/oct-obj.h src/octave.cc src/pt-const.h src/pt-exp-base.cc src/quad.cc |
diffstat | 11 files changed, 42 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dassl.cc +++ b/src/dassl.cc @@ -53,9 +53,9 @@ assert (nstates == xdot.capacity ()); // tree_constant name (dassl_fcn->name ()); - Octave_object args (4); + Octave_object args; + args(3) = t; // args(0) = name; - args(3) = t; if (nstates > 1) {
--- a/src/data.cc +++ b/src/data.cc @@ -35,6 +35,7 @@ #include "tree-const.h" #include "user-prefs.h" +#include "help.h" #include "utils.h" #include "error.h" #include "defun.h"
--- a/src/find.cc +++ b/src/find.cc @@ -34,7 +34,8 @@ find_to_fortran_idx (const ColumnVector i_idx, const ColumnVector j_idx, const tree_constant& val, int nr, int nc, int nargout) { - Octave_object retval (nargout); + Octave_object retval; + retval.resize (nargout); switch (nargout) {
--- a/src/fsolve.cc +++ b/src/fsolve.cc @@ -79,7 +79,8 @@ int n = x.capacity (); // tree_constant name = fsolve_fcn->name (); - Octave_object args (2); + Octave_object args; + args.resize (2); // args(0) = name; if (n > 1)
--- a/src/lsode.cc +++ b/src/lsode.cc @@ -51,9 +51,9 @@ int nstates = x.capacity (); // tree_constant name (lsode_fcn->name ()); - Octave_object args (3); + Octave_object args; + args(2) = t; // args(0) = name; - args(2) = t; if (nstates > 1) {
--- a/src/npsol.cc +++ b/src/npsol.cc @@ -66,9 +66,9 @@ } // tree_constant name = npsol_objective->name (); - Octave_object args (2); + Octave_object args; + args(1) = decision_vars; // args(0) = name; - args(1) = decision_vars; static double retval; retval = 0.0; @@ -143,9 +143,9 @@ } // tree_constant name = npsol_constraints->name (); - Octave_object args (2); + Octave_object args; + args(1) = decision_vars; // args(0) = name; - args(1) = decision_vars; if (npsol_constraints) {
--- a/src/oct-obj.h +++ b/src/oct-obj.h @@ -47,7 +47,6 @@ public: Octave_object (void) : Array<tree_constant> () { } - Octave_object (int n) : Array<tree_constant> (n) { } Octave_object (int n, const tree_constant& val) : Array<tree_constant> (n, val) { } @@ -86,6 +85,21 @@ private: +// This constructor is private with no definition to keep statements +// like +// +// Octave_object foo = 5; +// Octave_object foo = 5.0; +// +// from doing different things. Instead, you have to use the +// constructor +// +// Octave_object (n, val); +// +// and supply a default value to create a vector-valued Octave_object. + + Octave_object (int n) : Array<tree_constant> (n); + void maybe_resize (int n); tree_constant& elem (int n);
--- a/src/octave.cc +++ b/src/octave.cc @@ -645,7 +645,8 @@ if (fcn) { int nargin = args.length () - 1; - Octave_object tmp_args (nargin); + Octave_object tmp_args; + tmp_args.resize (nargin); for (int i = 0; i < nargin; i++) tmp_args(i) = args(i+1); retval = fcn->eval (0, nargout, tmp_args);
--- a/src/pt-const.h +++ b/src/pt-const.h @@ -269,7 +269,7 @@ Octave_object eval (int print, int nargout, const Octave_object& args) { - Octave_object retval (1); + Octave_object retval; // XXX FIXME XXX -- make it safe to call do_index() with // args.length () == 0
--- a/src/pt-exp-base.cc +++ b/src/pt-exp-base.cc @@ -648,7 +648,7 @@ if (fcn) { - Octave_object args (1); + Octave_object args; args(0) = tree_constant (my_name); Octave_object tmp = (*fcn) (args, 1); if (tmp.length () > 0) @@ -1126,7 +1126,8 @@ int nargout = maybe_do_ans_assign ? 0 : 1; int nargin = (ans->is_constant ()) ? 0 : 1; - Octave_object tmp_args (nargin); + Octave_object tmp_args; + tmp_args.resize (nargin); Octave_object tmp = ans->eval (0, nargout, tmp_args); if (tmp.length () > 0) @@ -1417,7 +1418,8 @@ if (error_state || ! cmd_list) return retval; - Octave_object tmp_args (1); + Octave_object tmp_args; + tmp_args.resize (1); Octave_object tmp = eval (print, 1, tmp_args); if (! error_state && tmp.length () > 0) @@ -2750,7 +2752,8 @@ { int len = length () + 1; - Octave_object args (len); + Octave_object args; + args.resize (len); // args[0] may eventually hold something useful, like the function // name. @@ -2927,7 +2930,8 @@ { int nout = length (); - Octave_object retval (nout); + Octave_object retval; + retval.resize (nout); int i = 0;