58 |
stackitem *head; /* Head of the stack */ |
stackitem *head; /* Head of the stack */ |
59 |
hashtbl symbols; /* Hash table of all variable bindings */ |
hashtbl symbols; /* Hash table of all variable bindings */ |
60 |
int err; /* Error flag */ |
int err; /* Error flag */ |
|
int non_eval_flag; |
|
61 |
char *in_string; /* Input pending to be read */ |
char *in_string; /* Input pending to be read */ |
62 |
char *free_string; /* Free this string when all input is |
char *free_string; /* Free this string when all input is |
63 |
read from in_string */ |
read from in_string */ |
74 |
|
|
75 |
env->in_string= NULL; |
env->in_string= NULL; |
76 |
env->err= 0; |
env->err= 0; |
|
env->non_eval_flag= 0; |
|
77 |
for(i= 0; i<HASHTBLSIZE; i++) |
for(i= 0; i<HASHTBLSIZE; i++) |
78 |
env->symbols[i]= NULL; |
env->symbols[i]= NULL; |
79 |
} |
} |
100 |
free(item); /* free the stackitem */ |
free(item); /* free the stackitem */ |
101 |
item=temp; /* go to next stackitem */ |
item=temp; /* go to next stackitem */ |
102 |
} |
} |
|
free(val); /* Free the actual list value */ |
|
103 |
break; |
break; |
104 |
case integer: |
case integer: |
105 |
case func: |
case func: |
106 |
|
break; |
107 |
case symb: |
case symb: |
108 |
|
free(((symbol*)(val->content.ptr))->id); |
109 |
|
if(((symbol*)(val->content.ptr))->val!=NULL) |
110 |
|
free_val(((symbol*)(val->content.ptr))->val); |
111 |
|
free(val->content.ptr); |
112 |
break; |
break; |
113 |
} |
} |
114 |
|
free(val); /* Free the actual list value */ |
115 |
} |
} |
116 |
} |
} |
117 |
|
|
177 |
|
|
178 |
new_value->content.val= in_val; |
new_value->content.val= in_val; |
179 |
new_value->type= integer; |
new_value->type= integer; |
180 |
new_value->refcount=1; |
new_value->refcount= 1; |
181 |
|
|
182 |
push_val(env, new_value); |
push_val(env, new_value); |
183 |
} |
} |
190 |
new_value->content.ptr= malloc(strlen(in_string)+1); |
new_value->content.ptr= malloc(strlen(in_string)+1); |
191 |
strcpy(new_value->content.ptr, in_string); |
strcpy(new_value->content.ptr, in_string); |
192 |
new_value->type= string; |
new_value->type= string; |
193 |
new_value->refcount=1; |
new_value->refcount= 1; |
194 |
|
|
195 |
push_val(env, new_value); |
push_val(env, new_value); |
196 |
} |
} |
216 |
} |
} |
217 |
|
|
218 |
extern void mangle(environment *env){ |
extern void mangle(environment *env){ |
|
value *new_value; |
|
219 |
char *new_string; |
char *new_string; |
220 |
|
|
221 |
if((env->head)==NULL) { |
if((env->head)==NULL) { |
235 |
toss(env); |
toss(env); |
236 |
if(env->err) return; |
if(env->err) return; |
237 |
|
|
238 |
new_value= malloc(sizeof(value)); |
push_cstring(env, new_string); |
|
new_value->content.ptr= new_string; |
|
|
new_value->type= string; |
|
|
new_value->refcount=1; |
|
|
|
|
|
push_val(env, new_value); |
|
239 |
} |
} |
240 |
|
|
241 |
/* Push a symbol onto the stack. */ |
/* Push a symbol onto the stack. */ |