| 254 |
extern void eval(stackitem** stack_head) |
extern void eval(stackitem** stack_head) |
| 255 |
{ |
{ |
| 256 |
funcp in_func; |
funcp in_func; |
| 257 |
|
stackitem* temp= *stack_head; |
| 258 |
|
|
| 259 |
if((*stack_head)==NULL || (*stack_head)->type!=ref) { |
if(temp==NULL) { |
| 260 |
printerr("Stack empty or not a reference"); |
printerr("Stack empty"); |
| 261 |
return; |
return; |
| 262 |
} |
} |
| 263 |
|
|
| 264 |
if(((stackitem*)(*stack_head)->content.ptr)->type==func) { |
while(temp->type==ref) |
| 265 |
in_func= (funcp)((stackitem*)(*stack_head)->content.ptr)->content.ptr; |
temp= temp->content.ptr; |
| 266 |
|
|
| 267 |
|
if(temp->type==func) { |
| 268 |
|
in_func= (funcp)(temp->content.ptr); |
| 269 |
toss(stack_head); |
toss(stack_head); |
| 270 |
(*in_func)(stack_head); |
(*in_func)(stack_head); |
| 271 |
return; |
return; |
| 272 |
} else |
} |
| 273 |
printerr("Not a function"); |
|
| 274 |
|
printerr("Couldn't evaluate"); |
| 275 |
} |
} |
| 276 |
|
|
| 277 |
/* Make a list. */ |
/* Make a list. */ |