diff --git a/obj/algo/algo.o b/obj/algo/algo.o new file mode 100644 index 0000000..f59ac65 Binary files /dev/null and b/obj/algo/algo.o differ diff --git a/obj/algo/get_min_max.o b/obj/algo/get_min_max.o new file mode 100644 index 0000000..d65ddc7 Binary files /dev/null and b/obj/algo/get_min_max.o differ diff --git a/obj/algo/insertion.o b/obj/algo/insertion.o new file mode 100644 index 0000000..accbb9f Binary files /dev/null and b/obj/algo/insertion.o differ diff --git a/obj/algo/median.o b/obj/algo/median.o new file mode 100644 index 0000000..46141a2 Binary files /dev/null and b/obj/algo/median.o differ diff --git a/obj/algo/small_mouv.o b/obj/algo/small_mouv.o new file mode 100644 index 0000000..a942909 Binary files /dev/null and b/obj/algo/small_mouv.o differ diff --git a/obj/main.o b/obj/main.o new file mode 100644 index 0000000..44b6706 Binary files /dev/null and b/obj/main.o differ diff --git a/obj/operations/ft_pushstack.o b/obj/operations/ft_pushstack.o new file mode 100644 index 0000000..749911f Binary files /dev/null and b/obj/operations/ft_pushstack.o differ diff --git a/obj/operations/ft_reverserotate.o b/obj/operations/ft_reverserotate.o new file mode 100644 index 0000000..19e08f4 Binary files /dev/null and b/obj/operations/ft_reverserotate.o differ diff --git a/obj/operations/ft_rotatestack.o b/obj/operations/ft_rotatestack.o new file mode 100644 index 0000000..5cbf347 Binary files /dev/null and b/obj/operations/ft_rotatestack.o differ diff --git a/obj/operations/ft_swapstack.o b/obj/operations/ft_swapstack.o new file mode 100644 index 0000000..2760856 Binary files /dev/null and b/obj/operations/ft_swapstack.o differ diff --git a/obj/parsing.o b/obj/parsing.o new file mode 100644 index 0000000..c619081 Binary files /dev/null and b/obj/parsing.o differ diff --git a/obj/print_stack.o b/obj/print_stack.o new file mode 100644 index 0000000..47fd69d Binary files /dev/null and b/obj/print_stack.o differ diff --git a/obj/stack/ft_stackadd_back.o b/obj/stack/ft_stackadd_back.o new file mode 100644 index 0000000..c4687a8 Binary files /dev/null and b/obj/stack/ft_stackadd_back.o differ diff --git a/obj/stack/ft_stackadd_front.o b/obj/stack/ft_stackadd_front.o new file mode 100644 index 0000000..e037279 Binary files /dev/null and b/obj/stack/ft_stackadd_front.o differ diff --git a/obj/stack/ft_stackclear.o b/obj/stack/ft_stackclear.o new file mode 100644 index 0000000..510ee92 Binary files /dev/null and b/obj/stack/ft_stackclear.o differ diff --git a/obj/stack/ft_stackdelone.o b/obj/stack/ft_stackdelone.o new file mode 100644 index 0000000..987d30a Binary files /dev/null and b/obj/stack/ft_stackdelone.o differ diff --git a/obj/stack/ft_stacklast.o b/obj/stack/ft_stacklast.o new file mode 100644 index 0000000..7b5cd9c Binary files /dev/null and b/obj/stack/ft_stacklast.o differ diff --git a/obj/stack/ft_stacknew.o b/obj/stack/ft_stacknew.o new file mode 100644 index 0000000..801231c Binary files /dev/null and b/obj/stack/ft_stacknew.o differ diff --git a/obj/stack/ft_stacksize.o b/obj/stack/ft_stacksize.o new file mode 100644 index 0000000..7714de8 Binary files /dev/null and b/obj/stack/ft_stacksize.o differ diff --git a/obj/utils/is_sorted.o b/obj/utils/is_sorted.o new file mode 100644 index 0000000..add2937 Binary files /dev/null and b/obj/utils/is_sorted.o differ diff --git a/obj/utils/print_error.o b/obj/utils/print_error.o new file mode 100644 index 0000000..ab9bb41 Binary files /dev/null and b/obj/utils/print_error.o differ diff --git a/push_swap b/push_swap new file mode 100755 index 0000000..56cbf8e Binary files /dev/null and b/push_swap differ diff --git a/src/main.c b/src/main.c index 826dc91..9d29c7a 100644 --- a/src/main.c +++ b/src/main.c @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/04 12:14:22 by adjoly #+# #+# */ -/* Updated: 2024/03/16 21:01:23 by adjoly ### ########.fr */ +/* Updated: 2024/03/18 16:51:24 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -26,7 +26,7 @@ void check_invalid_char(char **av) { if (!ft_isdigit(*tmp_args) && *tmp_args != '-' \ && *tmp_args != '+' && *tmp_args != 32) - ft_senderror(); + ft_senderror(NULL); tmp_args++; } tmp++; @@ -45,10 +45,7 @@ void check_double(t_stack **stack) while (check_dup) { if (check_dup->nb == tmp->nb) - { - ft_stackclear(stack); - ft_senderror(); - } + ft_senderror(stack); check_dup = check_dup->next; } tmp = tmp->next; @@ -69,9 +66,9 @@ void check_sign(char **av) { if ((*tmp_av == '-' || *tmp_av == '+') \ && !ft_isdigit(*(tmp_av + 1))) - ft_senderror(); + ft_senderror(NULL); if ((*tmp_av == '-' || *tmp_av == '+') && ft_isdigit(*(tmp_av - 1))) - ft_senderror(); + ft_senderror(NULL); tmp_av++; } tmp++; @@ -89,7 +86,7 @@ void check_empty_args(char **av) { tmp_av = *tmp; if (!*tmp_av) - ft_senderror(); + ft_senderror(NULL); while (*tmp_av) { if (*tmp_av != 32) @@ -97,7 +94,7 @@ void check_empty_args(char **av) tmp_av++; } if (!*tmp_av) - ft_senderror(); + ft_senderror(NULL); tmp++; } } diff --git a/src/parsing.c b/src/parsing.c index d1da6f2..b65495a 100644 --- a/src/parsing.c +++ b/src/parsing.c @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/04 12:05:43 by adjoly #+# #+# */ -/* Updated: 2024/03/16 15:13:43 by adjoly ### ########.fr */ +/* Updated: 2024/03/18 16:57:06 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -39,6 +39,12 @@ void ft_freearr(char **arr) free(arr); } +void ft_senderror_split(t_stack **stack, char **split) +{ + ft_freearr(split); + ft_senderror(stack); +} + t_stack *ft_parsing(char **av) { t_stack *parsed_data; @@ -57,7 +63,7 @@ t_stack *ft_parsing(char **av) { if (ft_nbrlen(*tmp_split) > 11 || ft_atoll(*tmp_split) > 2147483647 \ || ft_atoll(*tmp_split) < -2147483648) - ft_senderror(); + ft_senderror_split(&parsed_data, split); ft_stackadd_back(&parsed_data, ft_stacknew(ft_atoi(*tmp_split))); tmp_split++; } diff --git a/src/push_swap.h b/src/push_swap.h index abc85be..9a0ec97 100644 --- a/src/push_swap.h +++ b/src/push_swap.h @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/04 12:18:29 by adjoly #+# #+# */ -/* Updated: 2024/03/13 14:35:19 by adjoly ### ########.fr */ +/* Updated: 2024/03/18 16:47:27 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -68,6 +68,6 @@ void ft_print_stack(t_stack *stack); // utils t_boolean ft_is_sort(t_stack **stack); -void ft_senderror(void); +void ft_senderror(t_stack **stack); #endif diff --git a/src/utils/print_error.c b/src/utils/print_error.c index 75f145d..a591f7a 100644 --- a/src/utils/print_error.c +++ b/src/utils/print_error.c @@ -6,14 +6,15 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/03/11 15:47:05 by adjoly #+# #+# */ -/* Updated: 2024/03/16 19:01:15 by adjoly ### ########.fr */ +/* Updated: 2024/03/18 16:50:28 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ #include "../push_swap.h" -void ft_senderror(void) +void ft_senderror(t_stack **stack) { ft_putendl_fd("Error", STDERR_FILENO); + ft_stackclear(stack); exit(EXIT_FAILURE); }