changeset 2972:ae2471c4e5c0

[project @ 1997-05-15 19:22:05 by jwe]
author jwe
date Thu, 15 May 1997 19:22:33 +0000
parents f2be17e6f1ea
children ef3379196bcf
files src/pt-indir.cc src/pt-indir.h src/pt-plot.cc
diffstat 3 files changed, 26 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/pt-indir.cc
+++ b/src/pt-indir.cc
@@ -61,13 +61,13 @@
   octave_value_list retval;
 
   if (nargout > 1)
-    error ("%s, %s", __FILE__, __LINE__);
+    error ("invalid number of output arguments for structure reference");
   else
     {
       octave_value_list tmp = expr->rvalue (nargout);
 
       if (tmp.empty ())
-	error ("%s, %s", __FILE__, __LINE__);
+	eval_error ();
       else
 	{
 	  octave_value val = tmp(0).do_struct_elt_index_op (nm);
@@ -112,6 +112,14 @@
   tw.visit_indirect_ref (*this);
 }
 
+void
+tree_indirect_ref::eval_error (void) const
+{
+  if (error_state > 0)
+    ::error ("evaluating structure reference operator near line %d, column %d",
+	     oper () . c_str (), line (), column ());
+}
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***
--- a/src/pt-indir.h
+++ b/src/pt-indir.h
@@ -82,6 +82,8 @@
 
   // The sub-element name.
   string nm;
+
+  void eval_error (void) const;
 };
 
 #endif
--- a/src/pt-plot.cc
+++ b/src/pt-plot.cc
@@ -58,6 +58,7 @@
 #include "oct-obj.h"
 #include "pt-cmd.h"
 #include "pt-exp.h"
+#include "pt-misc.h"
 #include "pt-plot.h"
 #include "pt-walk.h"
 #include "sighandlers.h"
@@ -406,7 +407,8 @@
 
   if (lower)
     {
-      octave_value lower_val = lower->eval ();
+      octave_value lower_val = lower->rvalue ();
+
       if (error_state)
 	{
 	  ::error ("evaluating lower bound of plot range");
@@ -423,7 +425,8 @@
 
   if (upper)
     {
-      octave_value upper_val = upper->eval ();
+      octave_value upper_val = upper->rvalue ();
+
       if (error_state)
 	{
 	  ::error ("evaluating upper bound of plot range");
@@ -464,7 +467,8 @@
     {
       if (x[i])
 	{
-	  octave_value tmp = x[i]->eval ();
+	  octave_value tmp = x[i]->rvalue ();
+
 	  if (error_state)
 	    {
 	      ::error ("evaluating plot using command");
@@ -561,7 +565,8 @@
 
       if (sp_linetype)
 	{
-	  octave_value tmp = sp_linetype->eval ();
+	  octave_value tmp = sp_linetype->rvalue ();
+
 	  if (! error_state && tmp.is_defined ())
 	    {
 	      double val = tmp.double_value ();
@@ -582,7 +587,8 @@
 
       if (sp_pointtype)
 	{
-	  octave_value tmp = sp_pointtype->eval ();
+	  octave_value tmp = sp_pointtype->rvalue ();
+
 	  if (! error_state && tmp.is_defined ())
 	    {
 	      double val = tmp.double_value ();
@@ -687,7 +693,7 @@
 {
   if (sp_plot_data)
     {
-      octave_value data = sp_plot_data->eval ();
+      octave_value data = sp_plot_data->rvalue ();
 
       if (! error_state && data.is_defined ())
 	{
@@ -779,7 +785,8 @@
 
   if (sp_title_clause)
     {
-      octave_value tmp = sp_title_clause->eval ();
+      octave_value tmp = sp_title_clause->rvalue ();
+
       if (! error_state && tmp.is_string ())
 	plot_buf << " " << GPLOT_CMD_TITLE << " "
 	  << '"' << tmp.string_value () << '"';