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