modifs non push
This commit is contained in:
BIN
builds/algo.o
BIN
builds/algo.o
Binary file not shown.
Binary file not shown.
BIN
builds/print.o
BIN
builds/print.o
Binary file not shown.
BIN
builds/push.o
BIN
builds/push.o
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
builds/rotate.o
BIN
builds/rotate.o
Binary file not shown.
BIN
builds/stop.o
BIN
builds/stop.o
Binary file not shown.
BIN
builds/swap.o
BIN
builds/swap.o
Binary file not shown.
@@ -23,7 +23,7 @@ int bubble_sort(t_stack **a, t_stack **b, t_list *solution);
|
||||
int check_flag(int *ac, char ***av);
|
||||
void is_valid(int ac, char **av);
|
||||
t_stack *init_stack(int ac, char **av);
|
||||
t_list *launch_algo(t_stack *stack);
|
||||
t_list *launch_algo(t_stack *stack, int i);
|
||||
|
||||
/*
|
||||
** stop.c
|
||||
|
||||
@@ -24,7 +24,6 @@ void fill_solution(t_list *solution, char *sp)
|
||||
char *stack;
|
||||
|
||||
print_test(solution, "fill_solution (beginning)");
|
||||
|
||||
tmp1 = solution->content;
|
||||
tmp2 = solution->next->content;
|
||||
a = *tmp1;
|
||||
@@ -44,22 +43,17 @@ print_test(solution, "fill_solution (beginning)");
|
||||
stack = ft_strjoinfree(stack, ft_itoa(b->n));
|
||||
b = b->next;
|
||||
}
|
||||
|
||||
print_test(solution, "fill_solu. (bfr add_back)");
|
||||
|
||||
ft_lstadd_back(&solution, ft_lstnew(stack));
|
||||
|
||||
print_test(solution, "fill_solu. (aft add_back)");
|
||||
|
||||
}
|
||||
|
||||
void print_result(t_list *result, int flag)
|
||||
{
|
||||
char **part;
|
||||
|
||||
print_test(result, "print result ");
|
||||
result = result->next->next;
|
||||
if (!flag)
|
||||
result = result->next;
|
||||
while (result)
|
||||
{
|
||||
part = ft_split(result->content, '!');
|
||||
|
||||
@@ -56,7 +56,7 @@ t_stack *init_stack(int ac, char **av)
|
||||
** then it calls the sorting algorithm
|
||||
** then it calls ps_stop() to free everything that needs to be freed
|
||||
*/
|
||||
t_list *launch_algo(t_stack *a)
|
||||
t_list *launch_algo(t_stack *a, int flag)
|
||||
{
|
||||
t_stack *b;
|
||||
t_list *solution;
|
||||
@@ -64,18 +64,13 @@ t_list *launch_algo(t_stack *a)
|
||||
b = NULL;
|
||||
solution = ft_lstnew(&a);
|
||||
ft_lstadd_back(&solution, ft_lstnew(&b));
|
||||
|
||||
print_test(solution, "launch_algo ");
|
||||
|
||||
fill_solution(solution, ft_strdup("start"));
|
||||
|
||||
if (flag)
|
||||
fill_solution(solution, ft_strdup("start"));
|
||||
print_test(solution, "launch_algo (after fill) ");
|
||||
|
||||
hugo_sort(&a, &b, solution);
|
||||
//bubble_sort(&a, &b, solution);
|
||||
|
||||
print_test(solution, "launch_algo (bfr return) ");
|
||||
|
||||
return (solution);
|
||||
}
|
||||
|
||||
@@ -96,12 +91,10 @@ int main(int ac, char **av)
|
||||
is_valid(ac, av);
|
||||
flag = check_flag(&ac, &av);
|
||||
stack = init_stack(ac, av);
|
||||
result = launch_algo(stack);
|
||||
|
||||
result = launch_algo(stack, flag);
|
||||
print_test(result, "main ");
|
||||
//sa(&stack, &result);
|
||||
print_result(result, flag);
|
||||
|
||||
print_result(result, flag);
|
||||
ps_stop(NULL, result, 0);
|
||||
return(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user