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

Diff of /stack/stack.c

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

revision 1.73 by masse, Tue Feb 12 23:16:56 2002 UTC revision 1.74 by masse, Tue Feb 12 23:59:05 2002 UTC
# Line 606  extern void pack(environment *env) Line 606  extern void pack(environment *env)
606    pack->content.ptr= temp;    pack->content.ptr= temp;
607    pack->refcount= 1;    pack->refcount= 1;
608    
609    temp= malloc(sizeof(stackitem));    push_val(env, pack);
   temp->item= pack;  
   
   push(env, temp);  
610    rev(env);    rev(env);
611  }  }
612    
# Line 1144  extern void sx_666f72(environment *env) Line 1141  extern void sx_666f72(environment *env)
1141  /* 'to' */  /* 'to' */
1142  extern void to(environment *env) {  extern void to(environment *env) {
1143    int i, start, ending;    int i, start, ending;
1144      stackitem *temp_head;
1145      value *temp_val;
1146        
1147    if((env->head)==NULL || env->head->next==NULL) {    if((env->head)==NULL || env->head->next==NULL) {
1148      printerr("Too Few Arguments");      printerr("Too Few Arguments");
# Line 1163  extern void to(environment *env) { Line 1162  extern void to(environment *env) {
1162    start= env->head->item->content.val;    start= env->head->item->content.val;
1163    toss(env); if(env->err) return;    toss(env); if(env->err) return;
1164    
1165    push_sym(env, "[");    temp_head= env->head;
1166      env->head= NULL;
1167    
1168    if(ending>=start) {    if(ending>=start) {
1169      for(i= start; i<=ending; i++)      for(i= ending; i>=start; i--)
1170        push_int(env, i);        push_int(env, i);
1171    } else {    } else {
1172      for(i= start; i>=ending; i--)      for(i= ending; i<=start; i++)
1173        push_int(env, i);        push_int(env, i);
1174    }    }
1175    
1176    pack(env); if(env->err) return;    temp_val= malloc(sizeof(value));
1177      temp_val->content.ptr= env->head;
1178      temp_val->refcount= 1;
1179      temp_val->type= list;
1180      env->head= temp_head;
1181      push_val(env, temp_val);
1182  }  }
1183    
1184  /* Read a string */  /* Read a string */

Legend:
Removed from v.1.73  
changed lines
  Added in v.1.74

root@recompile.se
ViewVC Help
Powered by ViewVC 1.1.26