165 |
printf("\n"); |
printf("\n"); |
166 |
} |
} |
167 |
|
|
168 |
void prin(stackitem** stack_head) |
void print_(stackitem** stack_head) |
169 |
{ |
{ |
170 |
if((*stack_head)==NULL) |
if((*stack_head)==NULL) |
171 |
return; |
return; |
189 |
|
|
190 |
extern void print(stackitem** stack_head) |
extern void print(stackitem** stack_head) |
191 |
{ |
{ |
192 |
prin(stack_head); |
print_(stack_head); |
193 |
toss(stack_head); |
toss(stack_head); |
194 |
} |
} |
195 |
|
|
200 |
print_st(stack_head->next, counter+1); |
print_st(stack_head->next, counter+1); |
201 |
|
|
202 |
printf("%ld: ", counter); |
printf("%ld: ", counter); |
203 |
prin(&stack_head); |
print_(&stack_head); |
204 |
nl(); |
nl(); |
205 |
} |
} |
206 |
|
|
242 |
push_cstring(stack_head, temp); |
push_cstring(stack_head, temp); |
243 |
else if((convert= sscanf(in_line, "%d %[^\n\r]", &itemp, rest)) >= 1) |
else if((convert= sscanf(in_line, "%d %[^\n\r]", &itemp, rest)) >= 1) |
244 |
push_val(stack_head, itemp); |
push_val(stack_head, itemp); |
245 |
else if((convert= sscanf(in_line, "%[^ ;\n\r]%[^\n\r]", temp, rest)) >= 1) |
else if((convert= sscanf(in_line, "\\%c%[^\n\r]", temp, rest)) >= 1) { |
246 |
|
temp[1]= '\0'; push_ref(stack_head, in_hash, temp); |
247 |
|
} else if((convert= sscanf(in_line, "%[^ ;\n\r]%[^\n\r]", temp, rest)) >= 1) |
248 |
push_ref(stack_head, in_hash, temp); |
push_ref(stack_head, in_hash, temp); |
249 |
else if((convert= sscanf(in_line, "%c%[^\n\r]", temp, rest)) >= 1) |
else if((convert= sscanf(in_line, "%c%[^\n\r]", temp, rest)) >= 1) |
250 |
if(*temp==';') |
if(*temp==';') |
310 |
*stack_head= new_head; |
*stack_head= new_head; |
311 |
} |
} |
312 |
|
|
313 |
|
extern void swap(stackitem** stack_head) |
314 |
|
{ |
315 |
|
stackitem* temp= (*stack_head); |
316 |
|
|
317 |
|
if((*stack_head)==NULL || (*stack_head)->next==NULL) |
318 |
|
return; |
319 |
|
|
320 |
|
*stack_head= (*stack_head)->next; |
321 |
|
temp->next= (*stack_head)->next; |
322 |
|
(*stack_head)->next= temp; |
323 |
|
} |
324 |
|
|
325 |
|
extern void eq(stackitem** stack_head) |
326 |
|
{ |
327 |
|
void *left, *right; |
328 |
|
int result; |
329 |
|
|
330 |
|
if((*stack_head)==NULL || (*stack_head)->next==NULL) |
331 |
|
return; |
332 |
|
|
333 |
|
left= (*stack_head)->content.ptr; |
334 |
|
swap(stack_head); |
335 |
|
right= (*stack_head)->content.ptr; |
336 |
|
result= (left==right); |
337 |
|
|
338 |
|
toss(stack_head); toss(stack_head); |
339 |
|
push_val(stack_head, (left==right)); |
340 |
|
} |
341 |
|
|
342 |
|
extern void not(stackitem** stack_head) |
343 |
|
{ |
344 |
|
int value; |
345 |
|
|
346 |
|
if((*stack_head)==NULL) |
347 |
|
return; |
348 |
|
|
349 |
|
value= (*stack_head)->content.val; |
350 |
|
toss(stack_head); |
351 |
|
push_val(stack_head, !value); |
352 |
|
} |
353 |
|
|
354 |
|
extern void neq(stackitem** stack_head) |
355 |
|
{ |
356 |
|
eq(stack_head); |
357 |
|
not(stack_head); |
358 |
|
} |
359 |
|
|
360 |
|
extern void def(stackitem** stack_head) |
361 |
|
{ |
362 |
|
stackitem *temp, *value; |
363 |
|
|
364 |
|
if(*stack_head==NULL || (*stack_head)->next==NULL |
365 |
|
|| (*stack_head)->type!=ref) |
366 |
|
return; |
367 |
|
|
368 |
|
temp= (*stack_head)->content.ptr; |
369 |
|
value= (*stack_head)->next; |
370 |
|
temp->content= value->content; |
371 |
|
value->content.ptr=NULL; |
372 |
|
temp->type= value->type; |
373 |
|
|
374 |
|
toss(stack_head); toss(stack_head); |
375 |
|
} |
376 |
|
|
377 |
extern void quit() |
extern void quit() |
378 |
{ |
{ |
379 |
exit(EXIT_SUCCESS); |
exit(EXIT_SUCCESS); |
394 |
printf("okidok\n "); |
printf("okidok\n "); |
395 |
} |
} |
396 |
|
|
397 |
|
exit(EXIT_SUCCESS); |
|
return EXIT_SUCCESS; |
|
398 |
} |
} |
399 |
|
|
400 |
/* Local Variables: */ |
/* Local Variables: */ |