changeset 191:b6b4d8c513fe

[project @ 1993-10-29 23:41:39 by jwe]
author jwe
date Fri, 29 Oct 1993 23:41:39 +0000
parents edfb6cafe85d
children 6259f4ed7285
files liboctave/idx-vector.cc liboctave/idx-vector.h src/builtins.cc src/g-builtins.cc src/lex.l src/octave.cc src/pager.cc src/parse.y src/pt-base.h src/pt-const.cc src/pt-const.h src/pt-plot.cc src/symtab.cc src/tc-assign.cc src/tc-index.cc src/tree.h.old src/variables.cc
diffstat 17 files changed, 355 insertions(+), 132 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/idx-vector.cc	Fri Oct 29 20:32:05 1993 +0000
+++ b/liboctave/idx-vector.cc	Fri Oct 29 23:41:39 1993 +0000
@@ -36,6 +36,8 @@
 
 idx_vector::idx_vector (const idx_vector& a)
 {
+  initialized = a.initialized;
+
   len = a.len;
   if (len > 0)
     {
@@ -51,7 +53,7 @@
       min_val = a.min_val;
     }
   else
-    data = 0;
+    data = (int *) 0;
 }
 
 static inline int
@@ -66,16 +68,19 @@
 idx_vector::idx_vector (const Matrix& m, int do_ftn_idx,
 			const char *rc, int z_len = 0)
 {
+  initialized = 0;
+
   int nr = m.rows ();
   int nc = m.columns ();
 
   if (nr == 0 || nc == 0)
     {
       len = 0;
-      data = 0;
+      data = (int *) 0;
       num_zeros = 0;
       num_ones = 0;
       one_zero = 0;
+      initialized = 1;
       return;
     }
   else if (nr > 1 && nc > 1 && do_ftn_idx)
@@ -102,8 +107,8 @@
     }
   else
     {
-      message ((char *) NULL, "invalid matrix index");
-      jump_to_top_level ();
+      error ("invalid matrix used as index");
+      return;
     }
 
   init_state (rc, z_len);
@@ -111,9 +116,24 @@
 
 idx_vector::idx_vector (const Range& r)
 {
+  initialized = 0;
+
   len = r.nelem ();
 
-  assert (len != 0);
+  if (len < 0)
+    {
+      error ("invalid range used as index");
+      return;
+    }
+  else if (len == 0)
+    {
+      data = (int *) 0;
+      num_zeros = 0;
+      num_ones = 0;
+      one_zero = 0;
+      initialized = 1;
+      return;
+    }
 
   double b = r.base ();
   double step = r.inc ();
@@ -134,6 +154,8 @@
 {
   if (this != &a)
     {
+      initialized = a.initialized;
+
       delete [] data;
       len = a.len;
       data = new int [len];
@@ -184,7 +206,7 @@
 	{
 	  delete [] data;
 	  len = 0;
-	  data = 0;
+	  data = (int *) 0;
 	  num_zeros = 0;
 	  num_ones = 0;
 	  one_zero = 0;
@@ -195,8 +217,11 @@
   else if (min_val < 0)
     {
       error ("%s index %d out of range", rc, min_val+1);
-      jump_to_top_level ();
+      initialized = 0;
+      return;
     }
+
+  initialized = 1;
 }
 
 void
--- a/liboctave/idx-vector.h	Fri Oct 29 20:32:05 1993 +0000
+++ b/liboctave/idx-vector.h	Fri Oct 29 23:41:39 1993 +0000
@@ -28,7 +28,6 @@
 #pragma interface
 #endif
 
-#include <stdlib.h>
 #include <assert.h>
 
 #define FAIL assert(0) /* XXX FIXME XXX */
@@ -44,7 +43,7 @@
   idx_vector (const idx_vector& a);
 
   idx_vector (const Matrix& m, int do_ftn_idx,
-	      const char *rc = (char *) NULL, int z_len = 0);
+	      const char *rc = (char *) 0, int z_len = 0);
 
   idx_vector (const Range& r);
 
@@ -52,6 +51,8 @@
 
   idx_vector& operator = (const idx_vector& a);
 
+  operator void * () const;
+
   int capacity (void) const;
   int length (void) const;
 
@@ -80,30 +81,38 @@
   int num_ones;
   int max_val;
   int min_val;
+  int initialized;
   int *data;
 
-  void init_state (const char *rc = (char *) NULL, int z_len = 0);
+  void init_state (const char *rc = (char *) 0, int z_len = 0);
   void convert_one_zero_to_idx (void);
 };
 
 inline idx_vector::idx_vector (void)
-  {
-    len = 0;
-    data = 0;
-    num_zeros = 0;
-    num_ones = 0;
-    one_zero = 0;
-  }
+{
+  len = 0;
+  data = (int *) 0;
+  num_zeros = 0;
+  num_ones = 0;
+  one_zero = 0;
+  initialized = 0;
+}
 
 inline idx_vector::~idx_vector (void)
-  {
-    delete [] data;
-    data = 0;
-    num_zeros = 0;
-    num_ones = 0;
-    len = 0;
-    one_zero = 0;
-  }
+{
+  delete [] data;
+  data = (int *) 0;
+  num_zeros = 0;
+  num_ones = 0;
+  len = 0;
+  one_zero = 0;
+  initialized = 0;
+}
+
+inline idx_vector::operator void * () const
+{
+  return initialized ? (void *) 1 : (void *) 0;
+}
 
 inline int idx_vector::capacity (void) const { return len; }
 inline int idx_vector::length (void) const { return len; }
--- a/src/builtins.cc	Fri Oct 29 20:32:05 1993 +0000
+++ b/src/builtins.cc	Fri Oct 29 23:41:39 1993 +0000
@@ -579,6 +579,9 @@
   { "Inf", "??", NULL,
     "infinity", },
 
+  { "INFO_FILE", "??", sv_info_file,
+    "name of the Octave info file", },
+
   { "J", "??", NULL,
     "sqrt (-1)", },
 
@@ -842,6 +845,10 @@
   bind_variable ("LOADPATH", tmp);
   make_eternal ("LOADPATH");
 
+  tmp = new tree_constant (info_file);
+  bind_variable ("INFO_FILE", tmp);
+  make_eternal ("INFO_FILE");
+
   tmp = new tree_constant (default_pager ());
   bind_variable ("PAGER", tmp);
   make_eternal ("PAGER");
--- a/src/g-builtins.cc	Fri Oct 29 20:32:05 1993 +0000
+++ b/src/g-builtins.cc	Fri Oct 29 23:41:39 1993 +0000
@@ -432,19 +432,26 @@
 }
 
 /*
- * Print error message and jump to top level.
+ * Print error message and set the error state.  This should
+ * eventually take us up to the top level, possibly printing traceback
+ * messages as we go.
  */
 tree_constant *
 builtin_error (tree_constant *args, int nargin, int nargout)
 {
   tree_constant *retval = NULL_TREE_CONST;
 
-  if (nargin == 2 && args != NULL_TREE_CONST && args[1].is_defined ())
-    args[1].print_if_string (cerr, 1);
-  else
-    message ((char *) NULL, "unspecified error, jumping to top level...");
+  char *msg = "unspecified_error";
 
-  jump_to_top_level ();
+  if (nargin == 2
+      && args != NULL_TREE_CONST
+      && args[1].is_defined ()
+      && args[1].is_string_type ())
+    {
+      msg = args[1].string_value ();
+    }
+
+  error (msg);
 
   return retval;
 }
--- a/src/lex.l	Fri Oct 29 20:32:05 1993 +0000
+++ b/src/lex.l	Fri Oct 29 23:41:39 1993 +0000
@@ -161,7 +161,7 @@
 			}
 
 <TEXT_FCN>[\;\,]	{
-			  if (doing_set)
+			  if (doing_set && strcmp (yytext, ",") == 0)
 			    {
 			      yylval.tok_val = new token (yytext);
 			      token_stack.push (yylval.tok_val);
@@ -170,7 +170,10 @@
 			  else
 			    {
 			      BEGIN 0;
-			      TOK_RETURN (',');
+			      if (strcmp (yytext, ",") == 0)
+				TOK_RETURN (',');
+			      else
+				TOK_RETURN (';');
 			    }
 		        }
 
@@ -895,18 +898,26 @@
   int end_found = 0;
   if (strcmp ("break", s) == 0)
     {
+      yylval.tok_val = new token (l, c);
+      token_stack.push (yylval.tok_val);
       return BREAK;
     }
   else if (strcmp ("continue", s) == 0)
     {
+      yylval.tok_val = new token (l, c);
+      token_stack.push (yylval.tok_val);
       return CONTINUE;
     }
   else if (strcmp ("else", s) == 0)
     {
+      yylval.tok_val = new token (l, c);
+      token_stack.push (yylval.tok_val);
       return ELSE;
     }
   else if (strcmp ("elseif", s) == 0)
     {
+      yylval.tok_val = new token (l, c);
+      token_stack.push (yylval.tok_val);
       return ELSEIF;
     }
   else if (strcmp ("end", s) == 0)
@@ -943,14 +954,25 @@
     {
       promptflag--;
       looping++;
+      yylval.tok_val = new token (l, c);
+      token_stack.push (yylval.tok_val);
       return FOR;
     }
   else if (strcmp ("function", s) == 0)
     {
       if (defining_func)
 	{
-	  error ("sorry, nested functions are a no-no...");
-	  jump_to_top_level ();
+	  error ("function keyword invalid within a function body");
+
+	  if ((reading_m_file || reading_script_file)
+	      && curr_m_file_name != (char *) NULL)
+	    error ("defining new function near line %d of file `%s'",
+		   input_line_number,
+		   curr_m_file_name);
+	  else
+	    error ("defining new function near line %d", input_line_number);
+
+	  jump_to_top_level ();  // XXX FIXME XXX
 	}
       else
 	{
@@ -985,16 +1007,22 @@
     {
       iffing++;
       promptflag--;
+      yylval.tok_val = new token (l, c);
+      token_stack.push (yylval.tok_val);
       return IF;
     }
   else if (strcmp ("return", s) == 0)
     {
+      yylval.tok_val = new token (l, c);
+      token_stack.push (yylval.tok_val);
       return FUNC_RET;
     }
   else if (strcmp ("while", s) == 0)
     {
       promptflag--;
       looping++;
+      yylval.tok_val = new token (l, c);
+      token_stack.push (yylval.tok_val);
       return WHILE;
     }
 
--- a/src/octave.cc	Fri Oct 29 20:32:05 1993 +0000
+++ b/src/octave.cc	Fri Oct 29 23:41:39 1993 +0000
@@ -207,6 +207,7 @@
   int retval;
   do
     {
+      reset_parser ();
       retval = yyparse ();
       if (retval == 0 && global_command != NULL_TREE)
 	{
--- a/src/pager.cc	Fri Oct 29 20:32:05 1993 +0000
+++ b/src/pager.cc	Fri Oct 29 23:41:39 1993 +0000
@@ -36,7 +36,7 @@
 #include "pager.h"
 
 // Where we stash output headed for the screen.
-static ostrstream *pager_buf;
+static ostrstream *pager_buf = (ostrstream *) NULL;
 
 static int
 line_count (char *s)
--- a/src/parse.y	Fri Oct 29 20:32:05 1993 +0000
+++ b/src/parse.y	Fri Oct 29 23:41:39 1993 +0000
@@ -172,9 +172,10 @@
 %token <tok_val> END
 %token <tok_val> PLOT
 %token <tok_val> TEXT STYLE
+%token <tok_val> FOR WHILE IF ELSEIF ELSE BREAK CONTINUE FUNC_RET
 
 // Other tokens.
-%token FOR WHILE IF ELSEIF ELSE FCN BREAK CONTINUE FUNC_RET SCREW_TWO
+%token FCN SCREW_TWO
 %token END_OF_INPUT GLOBAL
 %token USING TITLE WITH COLON OPEN_BRACE CLOSE_BRACE
 
@@ -193,6 +194,7 @@
 %type <tree_command_type> statement
 %type <tree_if_command_type> elseif
 %type <tree_command_list_type> simple_list simple_list1 list list1 opt_list
+%type <tree_command_list_type> global_decl global_decl1
 %type <tree_word_list_command_type> word_list_cmd
 %type <tree_plot_command_type> plot_command 
 %type <tree_subplot_list_type> plot_command1 plot_command2 plot_options
@@ -345,7 +347,7 @@
 		| func_def
 		  { $$ = $1; }
 		| global_decl
-		  { $$ = NULL_TREE; }
+		  { $$ = $1; }
 		;
 
 plot_command	: PLOT plot_command1
@@ -475,11 +477,14 @@
 		;
 
 global_decl	: GLOBAL global_decl1
-		  { }
+		  { $$ = $2->reverse (); }
 		;
 
 global_decl1	: NAME
-		  { force_global ($1->sym_rec()->name ()); }
+		  {
+		    force_global ($1->sym_rec()->name ());
+		    $$ = new tree_command_list ();
+		  }
 		| NAME '=' expression
 		  {
 		    symbol_record *sr = force_global ($1->sym_rec()->name ());
@@ -488,10 +493,13 @@
 		    tree_simple_assignment_expression *expr =
 		      new tree_simple_assignment_expression
 			(id, $3, $2->line (), $2->column ());
-		    expr->eval (0);
+		    $$ = new tree_command_list (expr);
 		  }
 		| global_decl1 optcomma NAME
-		  { force_global ($3->sym_rec()->name ()); }
+		  {
+		    force_global ($3->sym_rec()->name ());
+		    $$ = $1;
+		  }
 		| global_decl1 optcomma NAME '=' expression
 		  {
 		    symbol_record *sr = force_global ($3->sym_rec()->name ());
@@ -500,7 +508,7 @@
 		    tree_simple_assignment_expression *expr =
 		      new tree_simple_assignment_expression
 			(id, $5, $4->line (), $4->column ());
-		    expr->eval (0);
+		    $$ = $1->chain (expr);
 		  }
 		;
 
@@ -519,14 +527,16 @@
 		    if (check_end ($5, token::while_end))
 		      ABORT_PARSE;
 		    looping--;
-		    $$ = new tree_while_command ($2, $4);
+		    $$ = new tree_while_command ($2, $4, $1->line (),
+						 $1->column ());
 		  }
 		| FOR variable '=' expression optsep opt_list END
 		  {
 		    if (check_end ($7, token::for_end))
 		      ABORT_PARSE;
 		    looping--;
-		    $$ = new tree_for_command ($2, $4, $6);
+		    $$ = new tree_for_command ($2, $4, $6,
+					       $1->line (), $1->column ());
 		  }
 		| IF expression optsep opt_list END
 		  {
@@ -534,7 +544,8 @@
 		    if (check_end ($5, token::if_end))
 		      ABORT_PARSE;
 		    iffing--;
-		    $$ = new tree_if_command ($2, $4);
+		    $$ = new tree_if_command ($2, $4,
+					      $1->line (), $1->column ());
 		  }
 		| IF expression optsep opt_list ELSE optsep opt_list END
 		  {
@@ -542,8 +553,9 @@
 		    if (check_end ($8, token::if_end))
 		      ABORT_PARSE;
 		    iffing--;
-		    tree_if_command *t1 = new tree_if_command ($7);
-		    $$ = t1->chain ($2, $4);
+		    tree_if_command *t1 = new tree_if_command
+					    ($7, $5->line (), $5->column ());
+		    $$ = t1->chain ($2, $4, $1->line (), $1->column ());
 		  }
 		| IF expression optsep opt_list elseif END
 		  {
@@ -554,7 +566,7 @@
 		    tree_if_command *t1 = $5->reverse ();
 		    // Add the if list to the new head of the elseif
 		    // list, and return the list.
-		    $$ = t1->chain ($2, $4);
+		    $$ = t1->chain ($2, $4, $1->line (), $1->column ());
 		  }
 		| IF expression optsep opt_list elseif ELSE optsep opt_list END
 		  {
@@ -564,11 +576,12 @@
 		    iffing--;
 		    // Add the else list to the head of the elseif list,
 		    // then reverse the list.
-		    tree_if_command *t1 = $5->chain ($8);
+		    tree_if_command *t1 = $5->chain ($8, $6->line (),
+						     $6->column ());
 		    t1 = t1->reverse ();
 		    // Add the if list to the new head of the elseif
 		    // list, and return the list.
-		    $$ = t1->chain ($2, $4);
+		    $$ = t1->chain ($2, $4, $1->line (), $1->column ());
 		  }
 		| BREAK
 		  {
@@ -579,7 +592,7 @@
  or `while' loop");
 			ABORT_PARSE;
 		      }
-		    $$ = new tree_break_command ();
+		    $$ = new tree_break_command ($1->line (), $1->column ());
 		  }
 		| CONTINUE
 		  {
@@ -590,7 +603,8 @@
  `for' or `while' loop");
 			ABORT_PARSE;
 		      }
-		    $$ = new tree_break_command ();
+		    $$ = new tree_continue_command ($1->line (),
+						    $1->column ());
 		  }
 		| FUNC_RET
 		  {
@@ -600,19 +614,20 @@
 			error ("return: only meaningful within a function");
 			ABORT_PARSE;
 		      }
-		    $$ = new tree_return_command ();
+		    $$ = new tree_return_command ($1->line (), $1->column ());
 		  }
 		;
 
 elseif		: ELSEIF optsep expression optsep opt_list
 		  {
 		    maybe_warn_assign_as_truth_value ($3);
-		    $$ = new tree_if_command ($3, $5);
+		    $$ = new tree_if_command ($3, $5, $1->line (),
+					      $1->column ());
 		  }
 		| elseif ELSEIF optsep expression optsep opt_list
 		  {
 		    maybe_warn_assign_as_truth_value ($4);
-		    $$ = $1->chain ($4, $6);
+		    $$ = $1->chain ($4, $6, $2->line (), $2->column ());
 		  }
 		;
 
@@ -927,13 +942,20 @@
 		;
 
 variable	: identifier
-		  { $$ = new tree_index_expression ($1); }
+		  {
+		    $$ = new tree_index_expression
+			   ($1, $1->line (), $1->column ());
+		  }
 		| identifier '(' arg_list ')'
-		  { $$ = new tree_index_expression ($1, $3); }
+		  {
+		    $$ = new tree_index_expression
+			   ($1, $3, $1->line (), $1->column ());
+		  }
 		| identifier '(' ')'
 		  {
 		    $$ = new tree_index_expression
-			       ($1, (tree_argument_list *) NULL);
+		           ($1, (tree_argument_list *) NULL,
+			    $1->line (), $1->column ());
 		  }
 		| identifier '['
 		  {
--- a/src/pt-base.h	Fri Oct 29 20:32:05 1993 +0000
+++ b/src/pt-base.h	Fri Oct 29 23:41:39 1993 +0000
@@ -24,6 +24,10 @@
 #if !defined (_tree_base_h)
 #define _tree_base_h 1
 
+#include <stdio.h>
+#include <time.h>
+#include <assert.h>
+
 // NOTE: don\'t put #pragma interface here because there is no
 // corresponding tree-base.cc file that implements this class!
 
@@ -35,9 +39,6 @@
 #define NULL_TREE_CONST (tree_constant *)NULL
 #endif
 
-#include <time.h>
-#include <assert.h>
-
 class ostream;
 class tree_constant;
 class tree_identifier;
--- a/src/pt-const.cc	Fri Oct 29 20:32:05 1993 +0000
+++ b/src/pt-const.cc	Fri Oct 29 23:41:39 1993 +0000
@@ -393,12 +393,12 @@
   int nel = range->nelem ();
   if (nel < 0)
     {
+      delete range;
+      type_tag = unknown_constant;
       if (nel == -1)
 	error ("number of elements in range exceeds INT_MAX");
       else
 	error ("invalid range");
-
-      jump_to_top_level ();
     }
   else if (nel > 1)
     type_tag = range_constant;
@@ -582,14 +582,11 @@
       else
 	{
 	  if (i > nr)
-	    message ((char *) NULL,
-		     "row index = %d exceeds max row dimension = %d", i, nr);
+	    error ("row index = %d exceeds max row dimension = %d", i, nr);
+
 	  if (j > nc)
-	    message ((char *) NULL,
-		     "column index = %d exceeds max column dimension = %d",
-		     j, nc);
-
-	  jump_to_top_level ();
+	    error ("column index = %d exceeds max column dimension = %d",
+		   j, nc);
 	}
     }
 }
@@ -618,33 +615,21 @@
 	    resize (1, i, 0.0);
 	}
       else
-	{
-	  message ((char *) NULL,
-		   "matrix index = %d exceeds max dimension = %d", i, nc);
-	  jump_to_top_level ();
-	}
+	error ("matrix index = %d exceeds max dimension = %d", i, nc);
     }
   else if (nr == 1 && i > nc)
     {
       if (user_pref.resize_on_range_error)
 	resize (1, i, 0.0);
       else
-	{
-	  message ((char *) NULL,
-		   "matrix index = %d exceeds max dimension = %d", i, nc);
-	  jump_to_top_level ();
-	}
+	error ("matrix index = %d exceeds max dimension = %d", i, nc);
     }
   else if (nc == 1 && i > nr)
     {
       if (user_pref.resize_on_range_error)
 	resize (i, 1, 0.0);
       else
-	{
-	  message ((char *) NULL,
-		   "matrix index = %d exceeds max dimension = ", i, nc);
-	  jump_to_top_level ();
-	}
+	error ("matrix index = %d exceeds max dimension = ", i, nc);
     }
 }
 
@@ -2320,15 +2305,6 @@
   return retval;
 }
 
-void
-tree_constant_rep::print_if_string (ostream& os, int warn)
-{
-  if (type_tag == string_constant)
-    os << string << "\n";
-  else if (warn)
-    warning ("expecting string, found numeric constant");
-}
-
 tree_constant
 tree_constant_rep::mapper (Mapper_fcn& m_fcn, int print) const
 {
--- a/src/pt-const.h	Fri Oct 29 20:32:05 1993 +0000
+++ b/src/pt-const.h	Fri Oct 29 23:41:39 1993 +0000
@@ -507,8 +507,6 @@
 				       int nargin, int nargout,
 				       int debug = 0);
 
-  void print_if_string (ostream& os, int warn);
-
   constant_type const_type (void) const { return type_tag; }
 
   tree_constant mapper (Mapper_fcn& m_fcn, int print) const;
@@ -717,9 +715,6 @@
   tree_constant diag (void) const { return rep->diag (); }
   tree_constant diag (const tree_constant& a) const { return rep->diag (a); }
 
-  void print_if_string (ostream& os, int warn)
-    { rep->print_if_string (os, warn); }
-
   tree_constant_rep::constant_type const_type (void) const
     { return rep->const_type (); }
 
--- a/src/pt-plot.cc	Fri Oct 29 20:32:05 1993 +0000
+++ b/src/pt-plot.cc	Fri Oct 29 23:41:39 1993 +0000
@@ -102,6 +102,9 @@
   if (range != (tree_plot_limits *) NULL)
     range->print (ndim, plot_buf);
 
+  if (error_state)
+    return retval;
+
   plot_line_count = 0;
   tree_subplot_list *ptr = plot_list;
   for ( ; ptr != NULL_TREE ; ptr = ptr->next_elem ())
@@ -238,7 +241,7 @@
   if (plot_data != NULL_TREE)
     {
       tree_constant data = plot_data->eval (0);
-      if (data.is_defined ())
+      if (! error_state && data.is_defined ())
 	{
 	  char *file = (char *) NULL;
 	  if (data.is_string_type ())
@@ -301,7 +304,7 @@
   if (title != NULL_TREE)
     {
       tree_constant tmp = title->eval (0);
-      if (tmp.is_string_type ())
+      if (! error_state && tmp.is_string_type ())
 	plot_buf << " title " << '"' << tmp.string_value () << '"';
       else
 	{
@@ -420,8 +423,16 @@
   if (lower != NULL_TREE)
     {
       tree_constant lower_val = lower->eval (0);
-      double lo = lower_val.to_scalar ();
-      plot_buf << lo;
+      if (error_state)
+	{
+	  error ("evaluating lower bound of plot range");
+	  return;
+	}
+      else
+	{
+	  double lo = lower_val.to_scalar ();
+	  plot_buf << lo;
+	}
     }
 
   plot_buf << ":";
@@ -429,8 +440,16 @@
   if (upper != NULL_TREE)
     {
       tree_constant upper_val = upper->eval (0);
-      double hi = upper_val.to_scalar ();
-      plot_buf << hi;
+      if (error_state)
+	{
+	  error ("evaluating upper bound of plot range");
+	  return;
+	}
+      else
+	{
+	  double hi = upper_val.to_scalar ();
+	  plot_buf << hi;
+	}
     }
 
   plot_buf << "]";
@@ -498,6 +517,12 @@
       if (x[i] != NULL_TREE)
 	{
 	  tree_constant tmp = x[i]->eval (0);
+	  if (error_state)
+	    {
+	      error ("evaluating plot using command");
+	      return -1;
+	    }
+
 	  double val;
 	  if (tmp.is_defined ())
 	    {
@@ -582,25 +607,31 @@
       if (linetype != NULL_TREE)
 	{
 	  tree_constant tmp = linetype->eval (0);
-	  if (tmp.is_defined ())
+	  if (! error_state && tmp.is_defined ())
 	    {
 	      double val = tmp.to_scalar ();
 	      plot_buf << " " << NINT (val);
 	    }
 	  else
-	    return -1;
+	    {
+	      error ("evaluating plot style command");
+	      return -1;
+	    }
 	}
 
       if (pointtype != NULL_TREE)
 	{
 	  tree_constant tmp = pointtype->eval (0);
-	  if (tmp.is_defined ())
+	  if (! error_state && tmp.is_defined ())
 	    {
 	      double val = tmp.to_scalar ();
 	      plot_buf << " " << NINT (val);
 	    }
 	  else
-	    return -1;
+	    {
+	      error ("evaluating plot style command");
+	      return -1;
+	    }
 	}
     }
   else
--- a/src/symtab.cc	Fri Oct 29 20:32:05 1993 +0000
+++ b/src/symtab.cc	Fri Oct 29 23:41:39 1993 +0000
@@ -502,8 +502,8 @@
 {
   sv_fcn = s->sv_fcn; // Maybe this should go in the var symbol_def?
 
-  formal_param = s->formal_param; // Hmm.
-  forced_global = s->forced_global; // Hmm.
+//  formal_param = s->formal_param; // Hmm.
+//  forced_global = s->forced_global; // Hmm.
 
   if (force && s->var == (symbol_def *) NULL
       && s->fcn == (symbol_def *) NULL)
@@ -619,7 +619,7 @@
 	{
 	  char *nm = ptr->name ();
 	  symbol_record *sr = global_sym_tab->lookup (nm, 0, 0);
-	  if (sr != (symbol_record *) NULL)
+	  if (sr != (symbol_record *) NULL && sr->is_forced_global ())
 	    ptr->alias (sr, 1);
 	  ptr = ptr->next ();
 	}
--- a/src/tc-assign.cc	Fri Oct 29 20:32:05 1993 +0000
+++ b/src/tc-assign.cc	Fri Oct 29 23:41:39 1993 +0000
@@ -246,7 +246,11 @@
 	if (index_check (i-1, "") < 0)
 	  return;
 	if (nr <= 1 || nc <= 1)
-	  maybe_resize (i-1);
+	  {
+	    maybe_resize (i-1);
+	    if (error_state)
+	      return;
+	  }
 	else if (range_max_check (i-1, nr * nc) < 0)
 	  return;
 
@@ -269,10 +273,17 @@
 	Matrix mi = tmp_i.matrix_value ();
 	int len = nr * nc;
 	idx_vector ii (mi, 1, "", len);  // Always do fortran indexing here...
+	if (! ii)
+	  return;
+
 	int imax = ii.max ();
 
 	if (nr <= 1 || nc <= 1)
-	  maybe_resize (imax-1);
+	  {
+	    maybe_resize (imax-1);
+	    if (error_state)
+	      return;
+	  }
 	else if (range_max_check (imax-1, len) < 0)
 	  return;
 
@@ -330,6 +341,9 @@
 	Matrix mi = tmp_i.matrix_value ();
 	int len = nr * nc;
 	idx_vector iv (mi, user_pref.do_fortran_indexing, "", len);
+	if (! iv)
+	  return;
+
 	do_vector_assign (rhs, iv);
       }
       break;
@@ -413,6 +427,8 @@
     }
 
   maybe_resize (i);
+  if (error_state)
+    return;
 
   int nr = rows ();
   int nc = columns ();
@@ -448,6 +464,8 @@
     f_orient = column_orient;
 
   maybe_resize (iv.max (), f_orient);
+  if (error_state)
+    return;
 
   int nr = rows ();
   int nc = columns ();
@@ -485,6 +503,8 @@
     f_orient = column_orient;
 
   maybe_resize (imax, f_orient);
+  if (error_state)
+    return;
 
   int nr = rows ();
   int nc = columns ();
@@ -629,6 +649,9 @@
       {
 	Matrix mi = tmp_i.matrix_value ();
 	idx_vector iv (mi, user_pref.do_fortran_indexing, "row", rows ());
+	if (! iv)
+	  return;
+
 	do_matrix_assignment (rhs, iv, j_arg);
       }
       break;
@@ -685,6 +708,9 @@
 	    return;
 	  }
 	maybe_resize (i, j);
+	if (error_state)
+	  return;
+
 	do_matrix_assignment (rhs, i, j);
       }
       break;
@@ -694,6 +720,9 @@
 	Matrix mj = tmp_j.matrix_value ();
 	idx_vector jv (mj, user_pref.do_fortran_indexing, "column",
 		       columns ());
+	if (! jv)
+	  return;
+
 	if (! indexed_assign_conforms (1, jv.capacity (), rhs_nr, rhs_nc))
 	  {
 	    error ("A(int,matrix) = X: X must be a row vector with the\
@@ -701,6 +730,9 @@
 	    return;
 	  }
 	maybe_resize (i, jv.max ());
+	if (error_state)
+	  return;
+
 	do_matrix_assignment (rhs, i, jv);
       }
       break;
@@ -727,6 +759,9 @@
 	    if (index_check (rj, jmax, "column") < 0)
 	      return;
 	    maybe_resize (i, jmax);
+	    if (error_state)
+	      return;
+
 	    do_matrix_assignment (rhs, i, rj);
 	  }
       }
@@ -747,9 +782,15 @@
 		type_tag = matrix_constant;
 	      }
 	    maybe_resize (i, rhs_nc-1);
+	    if (error_state)
+	      return;
 	  }
 	else if (indexed_assign_conforms (1, nc, rhs_nr, rhs_nc))
-	  maybe_resize (i, nc-1);
+	  {
+	    maybe_resize (i, nc-1);
+	    if (error_state)
+	      return;
+	  }
 	else
 	  {
 	    error ("A(int,:) = X: X must be a row vector with the\
@@ -792,6 +833,9 @@
 	    return;
 	  }
 	maybe_resize (iv.max (), j);
+	if (error_state)
+	  return;
+
 	do_matrix_assignment (rhs, iv, j);
       }
       break;
@@ -801,6 +845,9 @@
 	Matrix mj = tmp_j.matrix_value ();
 	idx_vector jv (mj, user_pref.do_fortran_indexing, "column",
 		       columns ());
+	if (! jv)
+	  return;
+
 	if (! indexed_assign_conforms (iv.capacity (), jv.capacity (),
 				       rhs_nr, rhs_nc))
 	  {
@@ -810,6 +857,9 @@
 	    return;
 	  }
 	maybe_resize (iv.max (), jv.max ());
+	if (error_state)
+	  return;
+
 	do_matrix_assignment (rhs, iv, jv);
       }
       break;
@@ -838,6 +888,9 @@
 	    if (index_check (rj, jmax, "column") < 0)
 	      return;
 	    maybe_resize (iv.max (), jmax);
+	    if (error_state)
+	      return;
+
 	    do_matrix_assignment (rhs, iv, rj);
 	  }
       }
@@ -858,6 +911,9 @@
 	    return;
 	  }
 	maybe_resize (iv.max (), new_nc-1);
+	if (error_state)
+	  return;
+
 	do_matrix_assignment (rhs, iv, magic_colon);
       }
       break;
@@ -894,6 +950,9 @@
 	    return;
 	  }
 	maybe_resize (imax, j);
+	if (error_state)
+	  return;
+
 	do_matrix_assignment (rhs, ri, j);
       }
       break;
@@ -903,6 +962,9 @@
 	Matrix mj = tmp_j.matrix_value ();
 	idx_vector jv (mj, user_pref.do_fortran_indexing, "column",
 		       columns ());
+	if (! jv)
+	  return;
+
 	if (! indexed_assign_conforms (ri.nelem (), jv.capacity (),
 				       rhs_nr, rhs_nc))
 	  {
@@ -912,6 +974,9 @@
 	    return;
 	  }
 	maybe_resize (imax, jv.max ());
+	if (error_state)
+	  return;
+
 	do_matrix_assignment (rhs, ri, jv);
       }
       break;
@@ -940,6 +1005,9 @@
 	    if (index_check (rj, jmax, "column") < 0)
 	      return;
 	    maybe_resize (imax, jmax);
+	    if (error_state)
+	      return;
+
 	    do_matrix_assignment (rhs, ri, rj);
 	  }
       }
@@ -959,6 +1027,9 @@
 	    return;
 	  }
 	maybe_resize (imax, new_nc-1);
+	if (error_state)
+	  return;
+
 	do_matrix_assignment (rhs, ri, magic_colon);
       }
       break;
@@ -1002,9 +1073,15 @@
 		type_tag = matrix_constant;
 	      }
 	    maybe_resize (rhs_nr-1, j);
+	    if (error_state)
+	      return;
 	  }
 	else if (indexed_assign_conforms (nr, 1, rhs_nr, rhs_nc))
-	  maybe_resize (nr-1, j);
+	  {
+	    maybe_resize (nr-1, j);
+	    if (error_state)
+	      return;
+	  }
 	else
 	  {
 	    error ("A(:,int) = X: X must be a column vector with the\
@@ -1021,6 +1098,9 @@
 	Matrix mj = tmp_j.matrix_value ();
 	idx_vector jv (mj, user_pref.do_fortran_indexing, "column",
 		       columns ());
+	if (! jv)
+	  return;
+
 	int nr = rows ();
 	int new_nr = nr;
 	if (nr == 0)
@@ -1035,6 +1115,9 @@
 	    return;
 	  }
 	maybe_resize (new_nr-1, jv.max ());
+	if (error_state)
+	  return;
+
 	do_matrix_assignment (rhs, magic_colon, jv);
       }
       break;
@@ -1067,6 +1150,9 @@
 	    if (index_check (rj, jmax, "column") < 0)
 	      return;
 	    maybe_resize (new_nr-1, jmax);
+	    if (error_state)
+	      return;
+
 	    do_matrix_assignment (rhs, magic_colon, rj);
 	  }
       }
--- a/src/tc-index.cc	Fri Oct 29 20:32:05 1993 +0000
+++ b/src/tc-index.cc	Fri Oct 29 23:41:39 1993 +0000
@@ -72,6 +72,8 @@
 		Matrix mj = args[2].matrix_value ();
 
 		idx_vector j (mj, user_pref.do_fortran_indexing, "");
+		if (! j)
+		  return tree_constant ();
 
 		int len = j.length ();
 		if (len == j.ones_count ())
@@ -93,6 +95,8 @@
 		Matrix mi = args[1].matrix_value ();
 
 		idx_vector i (mi, user_pref.do_fortran_indexing, "");
+		if (! i)
+		  return tree_constant ();
 
 		int len = i.length ();
 		if (len == i.ones_count ())
@@ -283,6 +287,8 @@
       double *cop_out_index = mi.fortran_vec ();
 
       idx_vector iv (mi, 1, "", len);
+      if (! iv)
+	return tree_constant ();
 
       int result_size = iv.length ();
 
@@ -392,6 +398,9 @@
 	else
 	  {
 	    idx_vector iv (mi, user_pref.do_fortran_indexing, "", len);
+	    if (! iv)
+	      return tree_constant ();
+
 	    int imax = iv.max ();
 	    if (swap_indices)
 	      {
@@ -481,6 +490,9 @@
       {
 	Matrix mi = tmp_i.matrix_value ();
 	idx_vector iv (mi, user_pref.do_fortran_indexing, "row", rows ());
+	if (! iv)
+	  return tree_constant ();
+
 	if (iv.length () == 0)
 	  {
 	    Matrix mtmp;
@@ -550,6 +562,9 @@
       {
 	Matrix mj = tmp_j.matrix_value ();
 	idx_vector jv (mj, user_pref.do_fortran_indexing, "column", nc);
+	if (! jv)
+	  return tree_constant ();
+
 	if (jv.length () == 0)
 	  {
 	    Matrix mtmp;
@@ -628,6 +643,9 @@
       {
 	Matrix mj = tmp_j.matrix_value ();
 	idx_vector jv (mj, user_pref.do_fortran_indexing, "column", nc);
+	if (! jv)
+	  return tree_constant ();
+
 	if (jv.length () == 0)
 	  {
 	    Matrix mtmp;
@@ -706,6 +724,9 @@
       {
 	Matrix mj = tmp_j.matrix_value ();
 	idx_vector jv (mj, user_pref.do_fortran_indexing, "column", nc);
+	if (! jv)
+	  return tree_constant ();
+
 	if (jv.length () == 0)
 	  {
 	    Matrix mtmp;
@@ -782,6 +803,9 @@
       {
 	Matrix mj = tmp_j.matrix_value ();
 	idx_vector jv (mj, user_pref.do_fortran_indexing, "column", nc);
+	if (! jv)
+	  return tree_constant ();
+
 	if (jv.length () == 0)
 	  {
 	    Matrix mtmp;
--- a/src/tree.h.old	Fri Oct 29 20:32:05 1993 +0000
+++ b/src/tree.h.old	Fri Oct 29 23:41:39 1993 +0000
@@ -650,14 +650,16 @@
 tree_while_command : public tree_command
 {
  public:
-  tree_while_command (void);
-  tree_while_command (tree *e);
-  tree_while_command (tree *e, tree *lst);
+  tree_while_command (int l = -1, int c = -1);
+  tree_while_command (tree *e, int l = -1, int c = -1);
+  tree_while_command (tree *e, tree *lst, int l = -1, int c = -1);
 
   ~tree_while_command (void);
 
   tree_constant eval (int print);
 
+  void eval_error (void);
+
  private:
   tree *expr;			// Expression to test.
   tree *list;			// List of commands to execute.
@@ -670,13 +672,16 @@
 tree_for_command : public tree_command
 {
  public:
-  tree_for_command (void);
-  tree_for_command (tree_index_expression *id, tree *e, tree *lst);
+  tree_for_command (int l = -1, int c = -1);
+  tree_for_command (tree_index_expression *id, tree *e, tree *lst,
+		    int l = -1, int c = -1);
 
   ~tree_for_command (void);
 
   tree_constant eval (int print);
 
+  void eval_error (void);
+
  private:
   tree_index_expression *id;	// Identifier to modify.
   tree *expr;			// Expression to evaluate.
@@ -690,18 +695,20 @@
 tree_if_command : public tree_command
 {
  public:
-  tree_if_command (void);
-  tree_if_command (tree *t);
-  tree_if_command (tree *e, tree *t);
+  tree_if_command (int l = -1, int c = -1);
+  tree_if_command (tree *t, int l = -1, int c = -1);
+  tree_if_command (tree *e, tree *t, int l = -1, int c = -1);
 
   ~tree_if_command (void);
 
-  tree_if_command *chain (tree *t);
-  tree_if_command *chain (tree *t1, tree *t2);
+  tree_if_command *chain (tree *t, int l = -1, int c = -1);
+  tree_if_command *chain (tree *t1, tree *t2, int l = -1, int c = -1);
   tree_if_command *reverse (void);
 
   tree_constant eval (int print);
 
+  void eval_error (void);
+
  private:
   tree *expr;			// Expression to test.
   tree *list;			// Commands to execute.
@@ -715,7 +722,7 @@
 tree_break_command : public tree_command
 {
  public:
-  tree_break_command (void);
+  tree_break_command (int l = -1, int c = -1);
 
   ~tree_break_command (void);
 
@@ -729,7 +736,7 @@
 tree_continue_command : public tree_command
 {
  public:
-  tree_continue_command (void);
+  tree_continue_command (int l = -1, int c = -1);
 
   ~tree_continue_command (void);
 
@@ -743,7 +750,7 @@
 tree_return_command : public tree_command
 {
  public:
-  tree_return_command (void);
+  tree_return_command (int l = -1, int c = -1);
 
   ~tree_return_command (void);
 
--- a/src/variables.cc	Fri Oct 29 20:32:05 1993 +0000
+++ b/src/variables.cc	Fri Oct 29 23:41:39 1993 +0000
@@ -189,7 +189,9 @@
   if (defn != NULL_TREE)
     {
       tree_constant val = defn->eval (0);
-      if (val.is_string_type ())
+      if (error_state)
+	return retval;
+      else if (val.is_string_type ())
 	{
 	  char *s = val.string_value ();
 	  if (s != (char *) NULL)
@@ -222,7 +224,9 @@
   if (defn != NULL_TREE)
     {
       tree_constant val = defn->eval (0);
-      if (val.const_type () == tree_constant_rep::scalar_constant)
+      if (error_state)
+	return status;
+      else if (val.const_type () == tree_constant_rep::scalar_constant)
 	{
 	  d = val.double_value ();
 	  status = 0;