changeset 2859:00c0cd0f2ee7

[project @ 1997-03-31 19:02:32 by jwe]
author jwe
date Mon, 31 Mar 1997 19:02:37 +0000
parents a8f735f0dd71
children 00e94ace3a62
files src/ChangeLog src/dassl.cc src/fsolve.cc src/load-save.cc src/lsode.cc src/npsol.cc src/parse.y src/pt-cmd.cc src/pt-const.h src/pt-exp-base.cc src/pt-exp.cc src/pt-exp.h src/pt-fcn.h src/pt-fvc.cc src/pt-fvc.h src/pt-mat.cc src/pt-mat.h src/pt-misc.cc src/pt-misc.h src/pt-mvr-base.h src/pt-mvr.cc src/pt-mvr.h src/pt-plot.cc src/quad.cc src/toplev.cc src/toplev.h src/variables.cc
diffstat 27 files changed, 106 insertions(+), 82 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,28 @@
 Mon Mar 31 00:37:48 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* pt-base-exp.h (tree_expression::eval): Give arg a default value.
+	* pt-const.h (tree_constant::eval): Likewise.
+	* pt-exp.h (tree_prefix_expression::eval, tree_colon_expression::eval,
+	tree_postfix_expression::eval, tree_unary_expression::eval,
+	tree_binary_expression::eval, tree_boolean_expression::eval,
+	tree_simple_assignment_expression::eval): Likewise.
+	* pt-fcn.h (tree_function::eval): Likewise.
+	* pt-fvc.h (tree_identifier::eval, tree_indirect_ref::eval,
+	tree_builtin::eval): Likewise.
+	* pt-mat.h (tree_matrix::eval): Likewise.
+	* pt-misc.h (tree_statement_list::eval): Likewise.
+	* pt-mvr-base.h (tree_multi_val_ret::eval): Likewise.
+	* pt-mvr.h (tree_oct_obj::eval, tree_index_expression::eval,
+	tree_multi_assignment_expression::eval): Likewise.
+	* dassl.cc, fsolve.cc, load-save.cc, lsode.cc, npsol.cc, parse.y,
+	pt-cmd.cc, pt-exp-base.cc, pt-exp.cc, pt-fvc.cc, pt-mat.cc,
+	pt-misc.cc, pt-mvr.cc, pt-plot.cc, quad.cc, toplev.cc, variables.cc:
+	Change callers of eval() to use bool instead of int and to make
+	use of default argument value.
+
+	* toplev.h, toplev.cc (parse_and_execute, eval_string): Flag args
+	are now bool instead of int.
+
 	* symtab.h, symtab.cc: Use bool instead of int in more places.
 	* variables.h, variables.cc: Likewise.
 	* lex.h, lex.l: Likewise.
--- a/src/dassl.cc
+++ b/src/dassl.cc
@@ -83,7 +83,7 @@
 
   if (dassl_fcn)
     {
-      octave_value_list tmp = dassl_fcn->eval (0, 1, args);
+      octave_value_list tmp = dassl_fcn->eval (false, 1, args);
 
       if (error_state)
 	{
--- a/src/fsolve.cc
+++ b/src/fsolve.cc
@@ -106,7 +106,7 @@
 
   if (fsolve_fcn)
     {
-      octave_value_list tmp = fsolve_fcn->eval (0, 1, args);
+      octave_value_list tmp = fsolve_fcn->eval (false, 1, args);
       if (tmp.length () > 0 && tmp(0).is_defined ())
 	{
 	  retval = tmp(0).vector_value ();
--- a/src/load-save.cc
+++ b/src/load-save.cc
@@ -2226,7 +2226,7 @@
   string help = sr->help ();
   int global = sr->is_linked_to_global ();
   tree_fvc *tmp = sr->def ();
-  octave_value tc = tmp->eval (0);
+  octave_value tc = tmp->eval ();
 
   if (tc.is_undefined ())
     return;
--- a/src/lsode.cc
+++ b/src/lsode.cc
@@ -66,7 +66,7 @@
 
   if (lsode_fcn)
     {
-      octave_value_list tmp = lsode_fcn->eval (0, 1, args);
+      octave_value_list tmp = lsode_fcn->eval (false, 1, args);
 
       if (error_state)
 	{
@@ -106,7 +106,7 @@
 
   if (lsode_jac)
     {
-      octave_value_list tmp = lsode_jac->eval (0, 1, args);
+      octave_value_list tmp = lsode_jac->eval (false, 1, args);
 
       if (error_state)
 	{
--- a/src/npsol.cc
+++ b/src/npsol.cc
@@ -77,7 +77,7 @@
   octave_value objective_value;
   if (npsol_objective)
     {
-      octave_value_list tmp = npsol_objective->eval (0, 1, args);
+      octave_value_list tmp = npsol_objective->eval (false, 1, args);
 
       if (error_state)
 	{
@@ -146,7 +146,7 @@
 
   if (npsol_constraints)
     {
-      octave_value_list tmp = npsol_constraints->eval (0, 1, args);
+      octave_value_list tmp = npsol_constraints->eval (false, 1, args);
 
       if (error_state)
 	{
--- a/src/parse.y
+++ b/src/parse.y
@@ -1457,7 +1457,7 @@
 
   if (op1->is_constant () && op2->is_constant ())
     {
-      octave_value tmp = e->eval (0);
+      octave_value tmp = e->eval ();
 
       if (! error_state)
 	{
@@ -1499,7 +1499,7 @@
 
   if (op1->is_constant ())
     {
-      octave_value tmp = e->eval (0);
+      octave_value tmp = e->eval ();
 
       if (! error_state)
 	{
@@ -1546,7 +1546,7 @@
   if (base->is_constant () && limit->is_constant ()
       && (! incr || (incr && incr->is_constant ())))
     {
-      octave_value tmp = e->eval (0);
+      octave_value tmp = e->eval ();
 
       if (! error_state)
 	{
@@ -2311,7 +2311,7 @@
 
   if (m->all_elements_are_constant ())
     {
-      octave_value tmp = m->eval (0);
+      octave_value tmp = m->eval ();
 
       if (! error_state)
 	{
--- a/src/pt-cmd.cc
+++ b/src/pt-cmd.cc
@@ -105,7 +105,7 @@
 	      id->link_to_global ();
 
 	      if (! (skip_initializer || error_state))
-		expr->eval (false);
+		expr->eval ();
 	    }
 	  else
 	    error ("global: unable to make structure elements global");
@@ -149,7 +149,7 @@
 	      id->mark_as_static ();
 
 	      if (! error_state)
-		expr->eval (false);
+		expr->eval ();
 	    }
 	  else
 	    error ("global: unable to make structure elements global");
@@ -197,7 +197,7 @@
 	{
 	  if (list)
 	    {
-	      list->eval (1);
+	      list->eval (true);
 	      if (error_state)
 		{
 		  eval_error ();
@@ -245,7 +245,7 @@
 
   tree_oct_obj *tmp = new tree_oct_obj (rhs);
   tree_multi_assignment_expression tmp_ass (lst, tmp, 1);
-  tmp_ass.eval (false);
+  tmp_ass.eval ();
 
   if (error_state)
     {
@@ -255,7 +255,7 @@
 
   if (list)
     {
-      list->eval (1);
+      list->eval (true);
       if (error_state)
 	{
 	  eval_error ();
@@ -275,7 +275,7 @@
 
   octave_value *tmp = new octave_value (rhs);
   tree_simple_assignment_expression tmp_ass (idx_expr, tmp, true);
-  tmp_ass.eval (false);
+  tmp_ass.eval ();
 
   if (error_state)
     {
@@ -285,7 +285,7 @@
 
   if (list)
     {
-      list->eval (1);
+      list->eval (true);
       if (error_state)
 	{
 	  eval_error ();
@@ -315,7 +315,7 @@
 
   if (list)
     {
-      list->eval (1);
+      list->eval (true);
       if (error_state)
 	{
 	  eval_error ();
@@ -366,7 +366,7 @@
   if (error_state || ! expr)
     return;
 
-  octave_value tmp_expr = expr->eval (false);
+  octave_value tmp_expr = expr->eval ();
 
   if (error_state || tmp_expr.is_undefined ())
     {
@@ -609,7 +609,7 @@
 {
   if (expr)
     {
-      octave_value val = expr->eval (0);
+      octave_value val = expr->eval ();
 
       if (! error_state)
 	{
--- a/src/pt-const.h
+++ b/src/pt-const.h
@@ -332,7 +332,7 @@
   void print_with_name (ostream& os, const string& name,
 			bool print_padding = true);
 
-  octave_value eval (bool print_result);
+  octave_value eval (bool print = false);
 
   octave_value_list eval (bool, int, const octave_value_list&);
 
--- a/src/pt-exp-base.cc
+++ b/src/pt-exp-base.cc
@@ -45,7 +45,7 @@
 {
   bool expr_value = false;
 
-  octave_value t1 = eval (false);
+  octave_value t1 = eval ();
 
   if (! error_state)
     {
--- a/src/pt-exp.cc
+++ b/src/pt-exp.cc
@@ -228,7 +228,7 @@
 
   if (op)
     {
-      octave_value u = op->eval (false);
+      octave_value u = op->eval ();
 
       if (error_state)
 	eval_error ();
@@ -323,13 +323,13 @@
 
   if (op_lhs)
     {
-      octave_value a = op_lhs->eval (false);
+      octave_value a = op_lhs->eval ();
 
       if (error_state)
 	eval_error ();
       else if (a.is_defined () && op_rhs)
 	{
-	  octave_value b = op_rhs->eval (false);
+	  octave_value b = op_rhs->eval ();
 
 	  if (error_state)
 	    eval_error ();
@@ -549,7 +549,7 @@
 
   if (op_lhs)
     {
-      octave_value a = op_lhs->eval (false);
+      octave_value a = op_lhs->eval ();
 
       if (error_state)
 	eval_error ();
@@ -577,7 +577,7 @@
 
 	      if (op_rhs)
 		{
-		  octave_value b = op_rhs->eval (false);
+		  octave_value b = op_rhs->eval ();
 
 		  if (error_state)
 		    eval_error ();
@@ -692,7 +692,7 @@
 
   if (rhs)
     {
-      octave_value rhs_val = rhs->eval (false);
+      octave_value rhs_val = rhs->eval ();
 
       if (error_state)
 	{
@@ -813,7 +813,7 @@
   if (error_state || ! op_base || ! op_limit)
     return retval;
 
-  octave_value tmp = op_base->eval (false);
+  octave_value tmp = op_base->eval ();
 
   if (tmp.is_undefined ())
     {
@@ -830,7 +830,7 @@
       return retval;
     }
 
-  tmp = op_limit->eval (false);
+  tmp = op_limit->eval ();
 
   if (tmp.is_undefined ())
     {
@@ -851,7 +851,7 @@
 
   if (op_increment)
     {
-      tmp = op_increment->eval (false);
+      tmp = op_increment->eval ();
 
       if (tmp.is_undefined ())
 	{
--- a/src/pt-exp.h
+++ b/src/pt-exp.h
@@ -61,7 +61,7 @@
 
   ~tree_prefix_expression (void);
 
-  octave_value eval (bool print);
+  octave_value eval (bool print = false);
 
   void eval_error (void);
 
@@ -106,7 +106,7 @@
 
   ~tree_postfix_expression (void);
 
-  octave_value eval (bool print);
+  octave_value eval (bool print = false);
 
   void eval_error (void);
 
@@ -151,7 +151,7 @@
   ~tree_unary_expression (void)
     { delete op; }
 
-  octave_value eval (bool print);
+  octave_value eval (bool print = false);
 
   void eval_error (void);
 
@@ -215,7 +215,7 @@
       delete op_rhs;
     }
 
-  octave_value eval (bool print);
+  octave_value eval (bool print = false);
 
   void eval_error (void);
 
@@ -261,7 +261,7 @@
 
   ~tree_boolean_expression (void) { }
 
-  octave_value eval (bool print);
+  octave_value eval (bool print = false);
 
   const char *oper (void) const;
 
@@ -317,7 +317,7 @@
   bool is_ans_assign (void)
     { return ans_ass; }
 
-  octave_value eval (bool print);
+  octave_value eval (bool print = false);
 
   bool is_assignment_expression (void) const
     { return true; }
@@ -392,7 +392,7 @@
 
   tree_colon_expression *chain (tree_expression *t);
 
-  octave_value eval (bool print);
+  octave_value eval (bool print = false);
 
   void eval_error (const char *s);
 
--- a/src/pt-fcn.h
+++ b/src/pt-fcn.h
@@ -106,7 +106,7 @@
   string function_name (void)
     { return fcn_name; }
 
-  octave_value eval (bool print);
+  octave_value eval (bool print = false);
 
   octave_value_list eval (bool print, int nargout, const octave_value_list& args);
 
--- a/src/pt-fvc.cc
+++ b/src/pt-fvc.cc
@@ -329,13 +329,14 @@
 	  if (nargout)
 	    {
 	      octave_value_list tmp_args;
-	      octave_value_list tmp = object_to_eval->eval (0, nargout, tmp_args);
+	      octave_value_list tmp
+		= object_to_eval->eval (false, nargout, tmp_args);
 
 	      if (tmp.length () > 0)
 		retval = tmp(0);
 	    }
 	  else
-	    retval = object_to_eval->eval (false);
+	    retval = object_to_eval->eval ();
 	}
       else
 	eval_undefined_error ();
@@ -381,7 +382,7 @@
 
 	      nargout = 0;
 
-	      retval = object_to_eval->eval (0, nargout, args);
+	      retval = object_to_eval->eval (false, nargout, args);
 
 	      if (retval.length () > 0 && retval(0).is_defined ())
 		bind_ans (retval(0), print);
--- a/src/pt-fvc.h
+++ b/src/pt-fvc.h
@@ -88,7 +88,7 @@
   void mark_for_possible_ans_assign (void)
     { maybe_do_ans_assign = true; }
 
-  octave_value eval (bool print);
+  octave_value eval (bool print = false);
 
   octave_value_list eval (bool print, int nargout,
 			  const octave_value_list& args); 
@@ -164,7 +164,7 @@
 
   string name (void) const;
 
-  octave_value eval (bool print);
+  octave_value eval (bool print = false);
 
   octave_value_list eval (bool print, int nargout,
 			  const octave_value_list& args);
@@ -221,7 +221,7 @@
   bool is_mapper_function (void) const
     { return is_mapper; }
 
-  octave_value eval (bool print);
+  octave_value eval (bool print = false);
 
   octave_value_list eval (bool print, int nargout, const octave_value_list& args);
 
--- a/src/pt-mat.cc
+++ b/src/pt-mat.cc
@@ -178,7 +178,7 @@
     {
       tree_expression *elt = mr (p);
 
-      octave_value tmp = elt->eval (false);
+      octave_value tmp = elt->eval ();
 
       if (error_state || tmp.is_undefined ())
 	break;
--- a/src/pt-mat.h
+++ b/src/pt-mat.h
@@ -77,7 +77,7 @@
 
   bool all_elements_are_constant (void) const;
 
-  octave_value eval (bool print);
+  octave_value eval (bool print = false);
 
   void accept (tree_walker& tw);
 };
--- a/src/pt-misc.cc
+++ b/src/pt-misc.cc
@@ -233,7 +233,7 @@
       tree_expression *elt = this->operator () (p);
       if (elt)
 	{
-	  octave_value tmp = elt->eval (false);
+	  octave_value tmp = elt->eval ();
 	  if (error_state)
 	    {
 	      ::error ("evaluating argument list element number %d", k);
@@ -369,7 +369,7 @@
       tree_identifier *elt = this->operator () (p);
 
       if (elt->is_defined ())
-	retval(i) = elt->eval (false);
+	retval(i) = elt->eval ();
 
       i++;
     }
@@ -523,7 +523,7 @@
 {
   bool retval = false;
 
-  octave_value label_value = label->eval (false);
+  octave_value label_value = label->eval ();
 
   if (! error_state)
     {
--- a/src/pt-misc.h
+++ b/src/pt-misc.h
@@ -139,7 +139,7 @@
 
   void mark_as_function_body (void) { function_body = true; }
 
-  octave_value eval (bool print);
+  octave_value eval (bool print = false);
 
   octave_value_list eval (bool print, int nargout);
 
--- a/src/pt-mvr-base.h
+++ b/src/pt-mvr-base.h
@@ -49,7 +49,7 @@
   bool is_multi_val_ret_expression (void) const
     { return true; }
 
-  octave_value eval (bool print);
+  octave_value eval (bool print = false);
 
   virtual octave_value_list eval (bool print, int nargout,
 			      const octave_value_list& args) = 0;
--- a/src/pt-mvr.cc
+++ b/src/pt-mvr.cc
@@ -288,7 +288,7 @@
 
   nargout = lhs->length ();
   octave_value_list tmp_args;
-  octave_value_list results = rhs->eval (0, nargout, tmp_args);
+  octave_value_list results = rhs->eval (false, nargout, tmp_args);
 
   if (error_state)
     eval_error ();
@@ -325,7 +325,7 @@
 	      tree_simple_assignment_expression tmp_expr
 		(lhs_expr, tmp, 1, 0, ma_line, ma_column);
 
-	      results(i) = tmp_expr.eval (false); // May change
+	      results(i) = tmp_expr.eval (); // May change
 
 	      if (error_state)
 		break;
@@ -345,7 +345,7 @@
 	      tree_simple_assignment_expression tmp_expr
 		(lhs_expr, 0, 1, 0, ma_line, ma_column);
 
-	      tmp_expr.eval (false);
+	      tmp_expr.eval ();
 	    }
 	}
 
--- a/src/pt-mvr.h
+++ b/src/pt-mvr.h
@@ -59,7 +59,7 @@
 
   ~tree_oct_obj (void) { }
 
-  octave_value eval (bool print);
+  octave_value eval (bool print = false);
 
   octave_value_list eval (bool print, int nargout,
 			  const octave_value_list& args);
@@ -108,7 +108,7 @@
 
   void mark_for_possible_ans_assign (void);
 
-  octave_value eval (bool print);
+  octave_value eval (bool print = false);
 
   octave_value_list eval (bool print, int nargout, const octave_value_list& args);
 
@@ -143,7 +143,7 @@
 
   ~tree_multi_assignment_expression (void);
 
-  octave_value eval (bool print);
+  octave_value eval (bool print = false);
 
   octave_value_list eval (bool print, int nargout, const octave_value_list& args);
 
--- a/src/pt-plot.cc
+++ b/src/pt-plot.cc
@@ -406,7 +406,7 @@
 
   if (lower)
     {
-      octave_value lower_val = lower->eval (false);
+      octave_value lower_val = lower->eval ();
       if (error_state)
 	{
 	  ::error ("evaluating lower bound of plot range");
@@ -423,7 +423,7 @@
 
   if (upper)
     {
-      octave_value upper_val = upper->eval (false);
+      octave_value upper_val = upper->eval ();
       if (error_state)
 	{
 	  ::error ("evaluating upper bound of plot range");
@@ -464,7 +464,7 @@
     {
       if (x[i])
 	{
-	  octave_value tmp = x[i]->eval (false);
+	  octave_value tmp = x[i]->eval ();
 	  if (error_state)
 	    {
 	      ::error ("evaluating plot using command");
@@ -561,7 +561,7 @@
 
       if (sp_linetype)
 	{
-	  octave_value tmp = sp_linetype->eval (false);
+	  octave_value tmp = sp_linetype->eval ();
 	  if (! error_state && tmp.is_defined ())
 	    {
 	      double val = tmp.double_value ();
@@ -582,7 +582,7 @@
 
       if (sp_pointtype)
 	{
-	  octave_value tmp = sp_pointtype->eval (false);
+	  octave_value tmp = sp_pointtype->eval ();
 	  if (! error_state && tmp.is_defined ())
 	    {
 	      double val = tmp.double_value ();
@@ -686,7 +686,7 @@
 {
   if (sp_plot_data)
     {
-      octave_value data = sp_plot_data->eval (false);
+      octave_value data = sp_plot_data->eval ();
 
       if (! error_state && data.is_defined ())
 	{
@@ -778,7 +778,7 @@
 
   if (sp_title_clause)
     {
-      octave_value tmp = sp_title_clause->eval (false);
+      octave_value tmp = sp_title_clause->eval ();
       if (! error_state && tmp.is_string ())
 	plot_buf << " " << GPLOT_CMD_TITLE << " "
 	  << '"' << tmp.string_value () << '"';
--- a/src/quad.cc
+++ b/src/quad.cc
@@ -60,7 +60,7 @@
 
   if (quad_fcn)
     {
-      octave_value_list tmp = quad_fcn->eval (0, 1, args);
+      octave_value_list tmp = quad_fcn->eval (false, 1, args);
 
       if (error_state)
 	{
--- a/src/toplev.cc
+++ b/src/toplev.cc
@@ -140,7 +140,7 @@
 jmp_buf toplevel;
 
 void
-parse_and_execute (FILE *f, int print)
+parse_and_execute (FILE *f, bool print)
 {
   begin_unwind_frame ("parse_and_execute");
   
@@ -208,7 +208,7 @@
 }
 
 void
-parse_and_execute (const string& s, int print, int verbose,
+parse_and_execute (const string& s, bool print, bool verbose,
 		   const char *warn_for)
 {
   begin_unwind_frame ("parse_and_execute_2");
@@ -282,7 +282,7 @@
 
       if (retval == 0 && global_command)
 	{
-	  global_command->eval (1);
+	  global_command->eval (true);
 
 	  delete global_command;
 
@@ -504,7 +504,7 @@
       tmp_args.resize (tmp_nargin);
       for (int i = 0; i < tmp_nargin; i++)
 	tmp_args(i) = args(i+1);
-      retval = fcn->eval (0, nargout, tmp_args);
+      retval = fcn->eval (false, nargout, tmp_args);
     }
 
   return retval;
@@ -528,7 +528,7 @@
 }
 
 static octave_value_list
-eval_string (const string& s, int print, int& parse_status, int nargout)
+eval_string (const string& s, bool print, int& parse_status, int nargout)
 {
   begin_unwind_frame ("eval_string");
 
@@ -575,7 +575,7 @@
 }
 
 octave_value
-eval_string (const string& s, int print, int& parse_status)
+eval_string (const string& s, bool print, int& parse_status)
 {
   octave_value retval;
 
@@ -587,7 +587,7 @@
 }
 
 static octave_value_list
-eval_string (const octave_value& arg, int print, int& parse_status,
+eval_string (const octave_value& arg, bool print, int& parse_status,
 	     int nargout)
 {
   string s = arg.string_value ();
@@ -816,7 +816,7 @@
     {
       octave_value_list fcn = octave_atexit_functions.pop ();
 
-      feval (fcn, 0);
+      feval (fcn, false);
     }
 }
 
--- a/src/toplev.h
+++ b/src/toplev.h
@@ -37,14 +37,14 @@
 clean_up_and_exit (int) GCC_ATTR_NORETURN;
 
 extern void
-parse_and_execute (FILE *f, int print = 0);
+parse_and_execute (FILE *f, bool print = false);
 
 extern void
-parse_and_execute (const string& s, int print = 0, int verbose = 0,
+parse_and_execute (const string& s, bool print = false, bool verbose = false,
 		   const char *warn_for = 0);
 
 extern octave_value
-eval_string (const string&, int print, int& parse_status);
+eval_string (const string&, bool print, int& parse_status);
 
 extern int
 main_loop (void);
--- a/src/variables.cc
+++ b/src/variables.cc
@@ -846,7 +846,7 @@
       tree_fvc *sr_def = sr->def ();
 
       if (sr_def)
-	retval  = sr_def->eval (1);
+	retval  = sr_def->eval (true);
       else
 	error ("get_global_by_name: undefined symbol `%s'", nm.c_str ());
     }
@@ -909,7 +909,7 @@
 
   if (defn)
     {
-      octave_value val = defn->eval (0);
+      octave_value val = defn->eval ();
 
       if (! error_state && val.is_string ())
 	retval = val.string_value ();
@@ -936,7 +936,7 @@
 
   if (defn)
     {
-      octave_value val = defn->eval (0);
+      octave_value val = defn->eval ();
 
       if (! error_state && val.is_scalar_type ())
 	{
@@ -964,7 +964,7 @@
   tree_fvc *defn = sr->def ();
 
   if (defn)
-    retval = defn->eval (0);
+    retval = defn->eval ();
 
   return retval;
 }