--- stack/stack.c 2002/03/12 22:03:21 1.108 +++ stack/stack.c 2002/03/14 10:39:11 1.109 @@ -1000,7 +1000,7 @@ } if(myenv.interactive) { - printf("Stack version $Revision: 1.108 $\n\ + printf("Stack version $Revision: 1.109 $\n\ Copyright (C) 2002 Mats Alritzson and Teddy Hogeborn\n\ Stack comes with ABSOLUTELY NO WARRANTY; for details type `warranty;'.\n\ This is free software, and you are welcome to redistribute it\n\ @@ -1376,7 +1376,30 @@ extern void sx_656c7365(environment *env) { if(env->head==NULL || CDR(env->head)==NULL - || CDR(CDR(env->head))==NULL || CDR(CDR(CDR(env->head)))==NULL) { + || CDR(CDR(env->head))==NULL || CDR(CDR(CDR(env->head)))==NULL + || CDR(CDR(CDR(CDR(env->head))))==NULL) { + printerr("Too Few Arguments"); + env->err= 1; + return; + } + + if(CAR(CDR(env->head))->type!=symb + || strcmp(CAR(CDR(env->head))->content.sym->id, "then")!=0 + || CAR(CDR(CDR(CDR(env->head))))->type!=symb + || strcmp(CAR(CDR(CDR(CDR(env->head))))->content.sym->id, "if")!=0) { + printerr("Bad Argument Type"); + env->err= 2; + return; + } + + swap(env); toss(env); rot(env); toss(env); + ifelse(env); +} + +extern void then(environment *env) +{ + if(env->head==NULL || CDR(env->head)==NULL + || CDR(CDR(env->head))==NULL) { printerr("Too Few Arguments"); env->err= 1; return; @@ -1390,7 +1413,7 @@ } swap(env); toss(env); - ifelse(env); + sx_6966(env); } /* "while" */