160 |
else |
else |
161 |
def_sym(in_hash, in_string); /* Make symbol */ |
def_sym(in_hash, in_string); /* Make symbol */ |
162 |
|
|
163 |
new_item->content.ptr= *hash(in_hash, in_string); /* XXX */ |
new_item->content.ptr= *hash(in_hash, in_string); /* The new reference |
164 |
|
shouldn't point at |
165 |
|
NULL */ |
166 |
new_item->type= ref; |
new_item->type= ref; |
167 |
} |
} |
168 |
|
|
198 |
} |
} |
199 |
|
|
200 |
/* Prints the top element of the stack. */ |
/* Prints the top element of the stack. */ |
201 |
void print_(stackitem** stack_head) |
extern void print_(stackitem** stack_head) |
202 |
{ |
{ |
203 |
if((*stack_head)==NULL) { |
stackitem* temp= *stack_head; |
204 |
|
|
205 |
|
if(temp==NULL) { |
206 |
printerr("Stack empty"); |
printerr("Stack empty"); |
207 |
return; |
return; |
208 |
} |
} |
209 |
|
|
210 |
switch((*stack_head)->type) { |
while(temp->type==ref) |
211 |
|
temp= temp->content.ptr; |
212 |
|
|
213 |
|
switch(temp->type) { |
214 |
case value: |
case value: |
215 |
printf("%d", (*stack_head)->content.val); |
printf("%d", temp->content.val); |
216 |
break; |
break; |
217 |
case string: |
case string: |
218 |
printf("\"%s\"", (char*)(*stack_head)->content.ptr); |
printf("\"%s\"", (char*)temp->content.ptr); |
|
break; |
|
|
case ref: |
|
|
printf("%s", ((stackitem*)(*stack_head)->content.ptr)->id); |
|
219 |
break; |
break; |
220 |
case symbol: |
case symbol: |
221 |
|
printf("%s", temp->id); |
222 |
|
break; |
223 |
default: |
default: |
224 |
printf("%p", (*stack_head)->content.ptr); |
printf("%p", temp->content.ptr); |
225 |
break; |
break; |
226 |
} |
} |
227 |
} |
} |