modifs non push

This commit is contained in:
hugogogo
2021-06-26 09:51:17 +02:00
parent ff5a71b840
commit 1d85935cf9
13 changed files with 7 additions and 20 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -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

BIN
push_swap

Binary file not shown.

View File

@@ -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, '!');

View File

@@ -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);
}