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 |
|
|
308 |
*stack_head= new_head; |
*stack_head= new_head; |
309 |
} |
} |
310 |
|
|
311 |
|
extern void swap(stackitem** stack_head) |
312 |
|
{ |
313 |
|
stackitem* temp= (*stack_head); |
314 |
|
|
315 |
|
if((*stack_head)==NULL || (*stack_head)->next==NULL) |
316 |
|
return; |
317 |
|
|
318 |
|
*stack_head= (*stack_head)->next; |
319 |
|
temp->next= (*stack_head)->next; |
320 |
|
(*stack_head)->next= temp; |
321 |
|
} |
322 |
|
|
323 |
|
extern void eq(stackitem** stack_head) |
324 |
|
{ |
325 |
|
void *left, *right; |
326 |
|
int result; |
327 |
|
|
328 |
|
if((*stack_head)==NULL || (*stack_head)->next==NULL) |
329 |
|
return; |
330 |
|
|
331 |
|
left= (*stack_head)->content.ptr; |
332 |
|
right= (*stack_head)->next->content.ptr; |
333 |
|
result= (left==right); |
334 |
|
|
335 |
|
toss(stack_head); toss(stack_head); |
336 |
|
push_val(stack_head, (left==right)); |
337 |
|
} |
338 |
|
|
339 |
|
extern void not(stackitem** stack_head) |
340 |
|
{ |
341 |
|
int value; |
342 |
|
|
343 |
|
if((*stack_head)==NULL) |
344 |
|
return; |
345 |
|
|
346 |
|
value= (*stack_head)->content.val; |
347 |
|
toss(stack_head); |
348 |
|
push_val(stack_head, !value); |
349 |
|
} |
350 |
|
|
351 |
|
extern void neq(stackitem** stack_head) |
352 |
|
{ |
353 |
|
eq(stack_head); |
354 |
|
not(stack_head); |
355 |
|
} |
356 |
|
|
357 |
extern void quit() |
extern void quit() |
358 |
{ |
{ |
359 |
exit(EXIT_SUCCESS); |
exit(EXIT_SUCCESS); |
374 |
printf("okidok\n "); |
printf("okidok\n "); |
375 |
} |
} |
376 |
|
|
377 |
|
exit(EXIT_SUCCESS); |
|
return EXIT_SUCCESS; |
|
378 |
} |
} |
379 |
|
|
380 |
/* Local Variables: */ |
/* Local Variables: */ |