DEBUG flags cleanup, some dead code removal
This commit is contained in:
34
stack.c
34
stack.c
@@ -52,7 +52,7 @@ STACK *new_stack(size, name, keep)
|
||||
STACK *stack;
|
||||
int i;
|
||||
|
||||
# ifdef DEBUG_STACK
|
||||
# ifdef DEBUG_STACK2
|
||||
printf("new_stack(size=%d, name=[%s] last=%d total=%d)\n",
|
||||
size, name, laststack, totalstacks);
|
||||
# endif
|
||||
@@ -105,7 +105,7 @@ int *push_stack(stack, val)
|
||||
int size=stack->size;
|
||||
int *pelt=stack->stack+stack->last;
|
||||
|
||||
# ifdef DEBUG_STACK
|
||||
# ifdef DEBUG_STACK2
|
||||
printf("push_stack(%d:[%s]): last=%d size=%d\n",
|
||||
val, stack->name, stack->last, stack->size);
|
||||
# endif
|
||||
@@ -201,34 +201,24 @@ void gen_stacks(stack)
|
||||
int n=1;
|
||||
int exists=1;
|
||||
|
||||
printf("sorting stack...\n");
|
||||
printf("last=%d laststack=%d totalstacks=%d\n", last, laststack, totalstacks);
|
||||
//printf("before sort: ");
|
||||
//print_stack(stack, 0);
|
||||
# ifdef DEBUG_STACK
|
||||
printf("generating stacks...\n");
|
||||
# endif
|
||||
//printf("last=%d laststack=%d totalstacks=%d\n", last, laststack, totalstacks);
|
||||
# ifdef DEBUG_STACK
|
||||
printf("sorting initial stack...\n");
|
||||
# endif
|
||||
mergesort_stack(stack->stack, 0, last-1);
|
||||
printf("last=%d total=%d\n", laststack, totalstacks);
|
||||
//printf("after sort: ");
|
||||
//print_stack(stack, 0);
|
||||
// push initial stack
|
||||
//printf("++++++++++++++++ Adding main stack... ");
|
||||
# ifdef DEBUG_STACK
|
||||
print_stack(stack, 0);
|
||||
# endif
|
||||
dup_stack(stack, "Main stack");
|
||||
//keep_stack(new);
|
||||
//print_stacks();
|
||||
//print_stack(stack, 1);
|
||||
while (exists) {
|
||||
sprintf(name, "Stack copy %d", n);
|
||||
//new=dup_stack(new, name);
|
||||
exists=permute_stack(stack->stack, stack->last);
|
||||
//printf("Permute : ");
|
||||
//print_stack(stack, 0);
|
||||
if (exists) {
|
||||
//printf("++++++++++++++++ Adding stack... ");
|
||||
dup_stack(stack, name);
|
||||
// print_stack(new, 0);
|
||||
//keep_stack(new);
|
||||
}
|
||||
// printf("---------------------- Stack... ");
|
||||
// print_stacks();
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user