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 |
|
|
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"); |
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 */ |