Index: /trunk/Ohana/src/opihi/lib.shell/check_stack.c
===================================================================
--- /trunk/Ohana/src/opihi/lib.shell/check_stack.c	(revision 2800)
+++ /trunk/Ohana/src/opihi/lib.shell/check_stack.c	(revision 2801)
@@ -19,10 +19,4 @@
       } 
 
-      /** if we demand a scalar, interpret strings as strings */
-      if (validsize == 0) {
-	stack[i].type  = 'W';
-	continue;
-      } 
-	
       /** if this is a matrix, find the dimensions and check with existing values **/
       if (IsBuffer (stack[i].name)) {
@@ -66,7 +60,13 @@
 	continue;
       }
+
+      /* this is not a scalar, vector, or matrix.  must be string */
+      stack[i].type  = 'W';
+	
+      /* let's not consider this an error 
       sprintf (line, "unknown object %s", stack[i].name);
       push_error (line);
-      return (-1);
+      return (-1); 
+      */
     }
   }
@@ -80,2 +80,11 @@
   return (size);
 }
+
+/* check stack identifies the data elements as scalar, vector, matrix, or word.
+   operators have already been identified.  
+   check stack returns the total stack dimensionality (0,1,2)
+   on error, check stack returns -1
+   possible errors:
+     - mismatch with requested dimensionality
+     - mismatch in data dimensions
+*/
Index: /trunk/Ohana/src/opihi/lib.shell/dvomath.c
===================================================================
--- /trunk/Ohana/src/opihi/lib.shell/dvomath.c	(revision 2800)
+++ /trunk/Ohana/src/opihi/lib.shell/dvomath.c	(revision 2801)
@@ -1,7 +1,7 @@
 # include "opihi.h"
 
-/* return value on success is temp vector/buffer name or scalar value
-   return value on error is NULL, all internals freed? */
-
+/* return value on success is temp vector/buffer name or scalar value return value on error is NULL, all
+   internals freed.  errors are sent to error stack.  may be printed by calling function */
+   
 char *dvomath (int argc, char **argv, int *size, int validsize) {
   
Index: /trunk/Ohana/src/opihi/lib.shell/evaluate_stack.c
===================================================================
--- /trunk/Ohana/src/opihi/lib.shell/evaluate_stack.c	(revision 2800)
+++ /trunk/Ohana/src/opihi/lib.shell/evaluate_stack.c	(revision 2801)
@@ -5,4 +5,5 @@
   
   int i, j, Nvar, Nout, status;
+  char line[512];
   StackVar tmp_stack;
   Nout = Nvar = 0;
@@ -26,5 +27,5 @@
       return (TRUE);
     }
-    push_error ("syntax error!");
+    push_error ("syntax error: not a math expression");
     free (tmp_stack.name);
     return (FALSE);
@@ -50,5 +51,6 @@
 
       if (i < 2) {  /* need two variables to operate on */
-	fprintf (stderr, "syntax error\n");
+	sprintf (line, "syntax error: binary operator with one operand: %s\n", stack[i].name);
+	push_error (line);
 	free (tmp_stack.name); 
 	return (FALSE);
@@ -123,5 +125,5 @@
 
       if (i < 1) {  /* need one variable to operate on */
-	fprintf (stderr, "syntax error\n");
+	push_error ("syntax error: unary operator with no operand");
 	free (tmp_stack.name);
 	return (FALSE);
@@ -137,5 +139,5 @@
       /* there are no valid unary string operators */
       if (!strncasecmp (&stack[i - 1].type, "W", 1)) {
-	fprintf (stderr, "syntax error\n");
+	push_error ("syntax error: no valid string unary ops");
 	free (tmp_stack.name);
 	return (FALSE);
@@ -156,5 +158,5 @@
 
   if (*Nstack > 1) {
-    fprintf (stderr, "syntax error\n");
+    push_error ("syntax error in evaluation");
     return (FALSE);
   }
Index: /trunk/Ohana/src/opihi/lib.shell/parse.c
===================================================================
--- /trunk/Ohana/src/opihi/lib.shell/parse.c	(revision 2800)
+++ /trunk/Ohana/src/opihi/lib.shell/parse.c	(revision 2801)
@@ -56,6 +56,6 @@
     if (*V1 == 0) goto error;
 
+    /* command replacement.  execute the line, place answer in val. */
     if (*V1 == '`') {
-      /* command replacement.  execute the line, place answer in val. */
 
       /* look for end of line, must be ` */
@@ -79,5 +79,8 @@
 	if (*B == '\n') *B = ' ';
       }
-    } else {
+    } 
+
+    /* simple variable assignment */
+    if (*V1 != '`') {
       /* dvomath returns a new string, or NULL, with the result of the expression */
       val = dvomath (1, &V1, &size, 0);
@@ -107,5 +110,5 @@
     V = strncreate (N+1, L - N - 1);
 
-    /* expand value in parenthesis */
+    /* expand value in brackets */
     val = dvomath (1, &V, &size, 0);
     if (val == NULL) {
@@ -172,5 +175,6 @@
     *c1 = 0;
 
-    /* value in brackets must be an expression of some sort */
+    /* value in brackets must be a math expression of some sort.
+       isolated words are not valid here */
     val = dvomath (1, &L, &size, -1);
     if (val == NULL) {
Index: /trunk/Ohana/src/opihi/lib.shell/stack_math.c
===================================================================
--- /trunk/Ohana/src/opihi/lib.shell/stack_math.c	(revision 2800)
+++ /trunk/Ohana/src/opihi/lib.shell/stack_math.c	(revision 2801)
@@ -10,4 +10,5 @@
   int i, Nx;
   float *out, *M1, *M2;
+  char line[512];
   
   Nx = V1[0].vector[0].Nelements;
@@ -104,5 +105,7 @@
     break; 
   default:
-    fprintf (stderr, "error: op %c not defined!\n", op[0]);
+    sprintf (line, "error: op %c not defined!", op[0]);
+    push_error (line);
+    return (FALSE);
   }
 
@@ -127,4 +130,5 @@
   int i, Nx;
   float *out, *M1, *M2;
+  char line[512];
   
   Nx = V2[0].vector[0].Nelements;
@@ -213,5 +217,7 @@
     break; 
   default:
-    fprintf (stderr, "error: op %c not defined!\n", op[0]);
+    sprintf (line, "error: op %c not defined!", op[0]);
+    push_error (line);
+    return (FALSE);
   }
 
@@ -231,4 +237,5 @@
   int i, Nx;
   float *out, *M1, *M2;
+  char line[512];
   
   Nx = V1[0].vector[0].Nelements;
@@ -317,5 +324,7 @@
     break; 
   default:
-    fprintf (stderr, "error: op %c not defined!\n", op[0]);
+    sprintf (line, "error: op %c not defined!", op[0]);
+    push_error (line);
+    return (FALSE);
   }
 
@@ -335,9 +344,10 @@
   int i, j, Nx, Ny;
   float *out, *M1, *M2;
-  
+  char line[512];
+ 
   Nx = V1[0].buffer[0].matrix.Naxis[0];
   Ny = V1[0].buffer[0].matrix.Naxis[1];
   if (Ny != V2[0].vector[0].Nelements) {
-    fprintf (stderr, "dimension mismatch\n");
+    push_error ("dimension mismatch");
     return (FALSE);
   }
@@ -462,5 +472,7 @@
     break; 
   default:
-    fprintf (stderr, "error: op %c not defined!\n", op[0]);
+    sprintf (line, "error: op %c not defined!", op[0]);
+    push_error (line);
+    return (FALSE);
   }
 
@@ -486,4 +498,5 @@
   int i, j, Nx, Ny;
   float *out, *M1, *M2;
+  char line[512];
   
   Nx = V2[0].buffer[0].matrix.Naxis[0];
@@ -628,5 +641,7 @@
     break; 
   default:
-    fprintf (stderr, "error: op %c not defined!\n", op[0]);
+    sprintf (line, "error: op %c not defined!", op[0]);
+    push_error (line);
+    return (FALSE);
   }
 
@@ -651,4 +666,5 @@
   int i, Nx, Ny;
   float *out, *M1, *M2;
+  char line[512];
   
   Nx = V1[0].buffer[0].matrix.Naxis[0];
@@ -743,5 +759,7 @@
     break; 
   default:
-    fprintf (stderr, "error: op %c not defined!\n", op[0]);
+    sprintf (line, "error: op %c not defined!", op[0]);
+    push_error (line);
+    return (FALSE);
   }
 
@@ -768,4 +786,5 @@
   int i, Nx, Ny;
   float *out, *M1, *M2;
+  char line[512];
   
   Nx = V1[0].buffer[0].matrix.Naxis[0];
@@ -856,5 +875,7 @@
     break; 
   default:
-    fprintf (stderr, "error: op %c not defined!\n", op[0]);
+    sprintf (line, "error: op %c not defined!", op[0]);
+    push_error (line);
+    return (FALSE);
   }
 
@@ -873,4 +894,5 @@
   int i, Nx, Ny;
   float *out, *M1, *M2;
+  char line[512];
   
   Nx = V2[0].buffer[0].matrix.Naxis[0];
@@ -960,5 +982,7 @@
     break; 
   default:
-    fprintf (stderr, "error: op %c not defined!\n", op[0]);
+    sprintf (line, "error: op %c not defined!", op[0]);
+    push_error (line);
+    return (FALSE);
   }
 
@@ -976,5 +1000,6 @@
 
   float *M1, *M2, *out;
-  
+  char line[512];
+
   M1  = V1[0].ptr;
   M2  = V2[0].ptr;
@@ -1036,5 +1061,7 @@
     break; 
   default:
-    fprintf (stderr, "error: op %c not defined!\n", op[0]);
+    sprintf (line, "error: op %c not defined!", op[0]);
+    push_error (line);
+    return (FALSE);
   }
   OUT[0].Float = *(OUT[0].ptr);
@@ -1047,5 +1074,6 @@
 
   int value;
-  
+  char line[512];
+
   switch (op[0]) { 
   case 'E': 
@@ -1056,5 +1084,7 @@
     break; 
   default:
-    fprintf (stderr, "error: op %c not valid\n", op[0]);
+    sprintf (line, "error: op %c not defined!", op[0]);
+    push_error (line);
+    return (FALSE);
   }
 
