/[cvs]/stack/stack.c
ViewVC logotype

Diff of /stack/stack.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.104 by masse, Tue Mar 12 14:06:05 2002 UTC revision 1.105 by masse, Tue Mar 12 14:53:19 2002 UTC
# Line 467  void print_h(value *stack_head, int noqu Line 467  void print_h(value *stack_head, int noqu
467        printf("\"%s\"", (char*)CAR(stack_head)->content.ptr);        printf("\"%s\"", (char*)CAR(stack_head)->content.ptr);
468      break;      break;
469    case symb:    case symb:
470      printf("%s", ((symbol *)(CAR(stack_head)->content.ptr))->id);      printf("%s", CAR(stack_head)->content.sym->id);
471      break;      break;
472    case func:    case func:
473      printf("#<function %p>", (funcp)(CAR(stack_head)->content.ptr));      printf("#<function %p>", (funcp)(CAR(stack_head)->content.ptr));
# Line 594  extern void rcl(environment *env) Line 594  extern void rcl(environment *env)
594      return;      return;
595    }    }
596    
597    val= ((symbol *)(CAR(env->head)->content.ptr))->val;    val= CAR(env->head)->content.sym->val;
598    if(val == NULL){    if(val == NULL){
599      printerr("Unbound Variable");      printerr("Unbound Variable");
600      env->err= 3;      env->err= 3;
# Line 655  extern void eval(environment *env) Line 655  extern void eval(environment *env)
655        push_val(env, CAR(iterator));        push_val(env, CAR(iterator));
656                
657        if(CAR(env->head)->type==symb        if(CAR(env->head)->type==symb
658           && (((symbol*)(CAR(env->head)->content.ptr))->id[0]==';')) {           && CAR(env->head)->content.sym->id[0]==';') {
659          toss(env);          toss(env);
660          if(env->err) return;          if(env->err) return;
661                    
# Line 717  extern void pack(environment *env) Line 717  extern void pack(environment *env)
717    iterator= env->head;    iterator= env->head;
718    if(iterator==NULL    if(iterator==NULL
719       || (CAR(iterator)->type==symb       || (CAR(iterator)->type==symb
720       && ((symbol*)(CAR(iterator)->content.ptr))->id[0]=='[')) {       && CAR(iterator)->content.sym->id[0]=='[')) {
721      temp= NULL;      temp= NULL;
722      toss(env);      toss(env);
723    } else {    } else {
724      /* Search for first delimiter */      /* Search for first delimiter */
725      while(CDR(iterator)!=NULL      while(CDR(iterator)!=NULL
726            && (CAR(CDR(iterator))->type!=symb            && (CAR(CDR(iterator))->type!=symb
727             || ((symbol*)(CAR(CDR(iterator))->content.ptr))->id[0]!='['))             || CAR(CDR(iterator))->content.sym->id[0]!='['))
728        iterator= CDR(iterator);        iterator= CDR(iterator);
729            
730      /* Extract list */      /* Extract list */
# Line 940  extern void forget(environment *env) Line 940  extern void forget(environment *env)
940      return;      return;
941    }    }
942    
943    sym_id= ((symbol*)(CAR(stack_head)->content.ptr))->id;    sym_id= CAR(stack_head)->content.sym->id;
944    toss(env);    toss(env);
945    
946    return forget_sym(hash(env->symbols, sym_id));    return forget_sym(hash(env->symbols, sym_id));
# Line 1013  under certain conditions; type `copying; Line 1013  under certain conditions; type `copying;
1013        return EXIT_SUCCESS;      /* EOF */        return EXIT_SUCCESS;      /* EOF */
1014      } else if(myenv.head!=NULL      } else if(myenv.head!=NULL
1015                && CAR(myenv.head)->type==symb                && CAR(myenv.head)->type==symb
1016                && ((symbol*)(CAR(myenv.head)->content.ptr))->id[0]                && CAR(myenv.head)->content.sym->id[0]
1017                ==';') {                ==';') {
1018        toss(&myenv);             /* No error check in main */        toss(&myenv);             /* No error check in main */
1019        eval(&myenv);        eval(&myenv);
# Line 1488  extern void foreach(environment *env) Line 1488  extern void foreach(environment *env)
1488      push_val(env, CAR(iterator));      push_val(env, CAR(iterator));
1489      push_val(env, loop);      push_val(env, loop);
1490      eval(env); if(env->err) return;      eval(env); if(env->err) return;
1491      if (CDR(iterator)->type == tcons){      if (iterator->type == tcons){
1492        iterator= CDR(iterator);        iterator= CDR(iterator);
1493      } else {      } else {
1494        printerr("Bad Argument Type"); /* Improper list */        printerr("Bad Argument Type"); /* Improper list */
# Line 1537  extern void to(environment *env) Line 1537  extern void to(environment *env)
1537    
1538    if(iterator==NULL    if(iterator==NULL
1539       || (CAR(iterator)->type==symb       || (CAR(iterator)->type==symb
1540           && ((symbol*)(CAR(iterator)->content.ptr))->id[0]=='[')) {           && CAR(iterator)->content.sym->id[0]=='[')) {
1541      temp= NULL;      temp= NULL;
1542      toss(env);      toss(env);
1543    } else {    } else {
1544      /* Search for first delimiter */      /* Search for first delimiter */
1545      while(CDR(iterator)!=NULL      while(CDR(iterator)!=NULL
1546            && (CAR(CDR(iterator))->type!=symb            && (CAR(CDR(iterator))->type!=symb
1547                || ((symbol*)(CAR(CDR(iterator))->content.ptr))->id[0]                || CAR(CDR(iterator))->content.sym->id[0]!='['))
               !='['))  
1548        iterator= CDR(iterator);        iterator= CDR(iterator);
1549            
1550      /* Extract list */      /* Extract list */

Legend:
Removed from v.1.104  
changed lines
  Added in v.1.105

root@recompile.se
ViewVC Help
Powered by ViewVC 1.1.26