--- stack/stack.c 2002/02/02 15:26:10 1.21 +++ stack/stack.c 2002/02/02 18:11:54 1.22 @@ -254,19 +254,24 @@ extern void eval(stackitem** stack_head) { funcp in_func; + stackitem* temp= *stack_head; - if((*stack_head)==NULL || (*stack_head)->type!=ref) { - printerr("Stack empty or not a reference"); + if(temp==NULL) { + printerr("Stack empty"); return; } - if(((stackitem*)(*stack_head)->content.ptr)->type==func) { - in_func= (funcp)((stackitem*)(*stack_head)->content.ptr)->content.ptr; + while(temp->type==ref) + temp= temp->content.ptr; + + if(temp->type==func) { + in_func= (funcp)(temp->content.ptr); toss(stack_head); (*in_func)(stack_head); return; - } else - printerr("Not a function"); + } + + printerr("Couldn't evaluate"); } /* Make a list. */