Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
rask24 committed Feb 7, 2024
1 parent 8b35e51 commit 7d6c274
Show file tree
Hide file tree
Showing 19 changed files with 63 additions and 66 deletions.
72 changes: 34 additions & 38 deletions include/push_swap.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,64 +6,60 @@
/* By: reasuke <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/10 12:37:54 by reasuke #+# #+# */
/* Updated: 2024/01/24 17:03:30 by reasuke ### ########.fr */
/* Updated: 2024/02/07 15:04:00 by reasuke ### ########.fr */
/* */
/* ************************************************************************** */

#ifndef PUSH_SWAP_H
# define PUSH_SWAP_H

# include "../libft/libft.h"
# include <limits.h>
# include <stdbool.h>
# include <stdlib.h>
# include <unistd.h>

// TODO: delete
# include <stdio.h>

# include "../libft/libft.h"

typedef t_list t_stack;
typedef struct s_content
{
int index;
int delta_a;
int delta_b;
int target;
} t_content;
int index;
int delta_a;
int delta_b;
int target;
} t_content;

int check_args(int argc, char **argv);
int check_args(int argc, char **argv);

t_stack *generate_stack(int argc, char **argv);
t_stack *generate_stack(int argc, char **argv);

void sort(t_stack **p_a, t_stack **p_b, int num_a);
void nano_sort(t_stack **p_a, int num_a);
void micro_sort(t_stack **p_a, t_stack **p_b, int num_a);
void sort(t_stack **p_a, t_stack **p_b, int num_a);
void nano_sort(t_stack **p_a, int num_a);
void micro_sort(t_stack **p_a, t_stack **p_b, int num_a);
// void large_sort(t_stack **p_a, t_stack **p_b, int num_a);

void operate_sa(t_stack **p_a);
void operate_sb(t_stack **p_b);
void operate_ss(t_stack **p_a, t_stack **p_b);
void operate_ra(t_stack **p_a);
void operate_rb(t_stack **p_b);
void operate_rr(t_stack **p_a, t_stack **p_b);
void operate_rra(t_stack **p_a);
void operate_rrb(t_stack **p_a);
void operate_rrr(t_stack **p_a, t_stack **p_b);
void operate_pa(t_stack **p_b, t_stack **p_a);
void operate_pb(t_stack **p_a, t_stack **p_b);
void operate_sa(t_stack **p_a);
void operate_sb(t_stack **p_b);
void operate_ss(t_stack **p_a, t_stack **p_b);
void operate_ra(t_stack **p_a);
void operate_rb(t_stack **p_b);
void operate_rr(t_stack **p_a, t_stack **p_b);
void operate_rra(t_stack **p_a);
void operate_rrb(t_stack **p_a);
void operate_rrr(t_stack **p_a, t_stack **p_b);
void operate_pa(t_stack **p_b, t_stack **p_a);
void operate_pb(t_stack **p_a, t_stack **p_b);

void push_stack(t_stack **p_s1, t_stack **p_s2);
void swap_stack(t_stack **p_stack);
void rotate_stack(t_stack **p_stack);
void reverse_rotate_stack(t_stack **p_stack);
t_list *ft_lst_before(t_list *lst, t_list *trg);
void push_stack(t_stack **p_s1, t_stack **p_s2);
void swap_stack(t_stack **p_stack);
void rotate_stack(t_stack **p_stack);
void reverse_rotate_stack(t_stack **p_stack);
t_list *ft_lst_before(t_list *lst, t_list *trg);

int first_content(t_stack **p_stack);
int second_content(t_stack **p_stack);
int third_content(t_stack **p_stack);
void exit_with_error(void);
void clear_stack(t_stack **p_stack, void (*del)(void *));
int stack_size(t_stack *stack);
int first_content(t_stack **p_stack);
int second_content(t_stack **p_stack);
int third_content(t_stack **p_stack);
void exit_with_error(void);
void clear_stack(t_stack **p_stack, void (*del)(void *));
int stack_size(t_stack *stack);

#endif
5 changes: 2 additions & 3 deletions src/check_args.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: reasuke <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/11 14:44:55 by reasuke #+# #+# */
/* Updated: 2024/01/15 13:18:39 by reasuke ### ########.fr */
/* Updated: 2024/02/07 15:06:08 by reasuke ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -66,8 +66,7 @@ static bool _has_duplicate(int argc, char **argv)

int check_args(int argc, char **argv)
{
if (_has_not_digit(argc, argv)
|| _has_overflow(argc, argv)
if (_has_not_digit(argc, argv) || _has_overflow(argc, argv)
|| _has_duplicate(argc, argv))
exit_with_error();
return (0);
Expand Down
2 changes: 1 addition & 1 deletion src/generate_stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: reasuke <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/11 19:04:40 by reasuke #+# #+# */
/* Updated: 2024/01/24 16:51:54 by reasuke ### ########.fr */
/* Updated: 2024/02/07 15:06:20 by reasuke ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
7 changes: 4 additions & 3 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: reasuke <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/10 12:37:36 by reasuke #+# #+# */
/* Updated: 2024/01/23 15:48:43 by reasuke ### ########.fr */
/* Updated: 2024/02/07 15:12:35 by reasuke ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -15,8 +15,9 @@
#ifdef LEAK
# ifdef __APPLE__

__attribute__((destructor))
void destructor(void)
void leak_chek(void) __attribute__((destructor));

void leak_chek(void)
{
system("leaks -q push_swap");
}
Expand Down
11 changes: 7 additions & 4 deletions src/sort/large_sort.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: reasuke <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/22 16:55:10 by reasuke #+# #+# */
/* Updated: 2024/01/24 16:47:42 by reasuke ### ########.fr */
/* Updated: 2024/02/06 17:45:36 by reasuke ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -18,6 +18,9 @@
// push to b
// push to a

// void large_sort(t_stack **p_a, t_stack **p_b, int num_a)
// {
// }
void large_sort(t_stack **p_a, t_stack **p_b, int num_a)
{
(void)p_a;
(void)p_b;
(void)num_a;
}
2 changes: 1 addition & 1 deletion src/sort/micro_sort.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: reasuke <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/15 16:32:27 by reasuke #+# #+# */
/* Updated: 2024/01/23 15:29:19 by reasuke ### ########.fr */
/* Updated: 2024/02/07 15:04:27 by reasuke ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
2 changes: 1 addition & 1 deletion src/sort/nano_sort.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: reasuke <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/12 15:58:22 by reasuke #+# #+# */
/* Updated: 2024/01/24 17:04:50 by reasuke ### ########.fr */
/* Updated: 2024/02/07 15:04:35 by reasuke ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
4 changes: 1 addition & 3 deletions src/sort/sort.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: reasuke <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/15 15:10:35 by reasuke #+# #+# */
/* Updated: 2024/01/24 16:47:53 by reasuke ### ########.fr */
/* Updated: 2024/02/07 15:04:45 by reasuke ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -18,6 +18,4 @@ void sort(t_stack **p_a, t_stack **p_b, int num_a)
nano_sort(p_a, num_a);
else if (num_a <= 5)
micro_sort(p_a, p_b, num_a);
// else
// large_sort(p_a, p_b, num_a);
}
2 changes: 1 addition & 1 deletion src/stack_operations/ft_lst_before.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: reasuke <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/15 16:54:29 by reasuke #+# #+# */
/* Updated: 2024/01/15 16:54:44 by reasuke ### ########.fr */
/* Updated: 2024/02/07 15:04:54 by reasuke ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
2 changes: 1 addition & 1 deletion src/stack_operations/push.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: reasuke <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/15 15:56:53 by reasuke #+# #+# */
/* Updated: 2024/01/23 15:36:08 by reasuke ### ########.fr */
/* Updated: 2024/02/07 15:05:10 by reasuke ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
4 changes: 2 additions & 2 deletions src/stack_operations/reverse_rotate.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* reverse_ratate.c :+: :+: :+: */
/* reverse_rotate.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: reasuke <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/23 17:18:15 by reasuke #+# #+# */
/* Updated: 2024/01/23 17:19:30 by reasuke ### ########.fr */
/* Updated: 2024/02/07 15:04:58 by reasuke ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
2 changes: 1 addition & 1 deletion src/stack_operations/rotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: reasuke <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/15 14:05:46 by reasuke #+# #+# */
/* Updated: 2024/01/23 17:20:38 by reasuke ### ########.fr */
/* Updated: 2024/02/07 15:05:17 by reasuke ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
2 changes: 1 addition & 1 deletion src/stack_operations/swap.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: reasuke <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/15 13:28:54 by reasuke #+# #+# */
/* Updated: 2024/01/23 17:21:56 by reasuke ### ########.fr */
/* Updated: 2024/02/07 15:05:21 by reasuke ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
2 changes: 1 addition & 1 deletion src/utils/clear_stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: reasuke <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/23 15:46:24 by reasuke #+# #+# */
/* Updated: 2024/01/23 15:47:39 by reasuke ### ########.fr */
/* Updated: 2024/02/07 15:05:27 by reasuke ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
2 changes: 1 addition & 1 deletion src/utils/exit_with_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: reasuke <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/11 14:38:17 by reasuke #+# #+# */
/* Updated: 2024/01/11 14:38:59 by reasuke ### ########.fr */
/* Updated: 2024/02/07 15:05:34 by reasuke ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
2 changes: 1 addition & 1 deletion src/utils/first_content.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: reasuke <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/17 18:27:37 by reasuke #+# #+# */
/* Updated: 2024/01/24 16:55:24 by reasuke ### ########.fr */
/* Updated: 2024/02/07 15:05:41 by reasuke ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
2 changes: 1 addition & 1 deletion src/utils/second_content.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: reasuke <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/17 18:28:02 by reasuke #+# #+# */
/* Updated: 2024/01/24 16:55:35 by reasuke ### ########.fr */
/* Updated: 2024/02/07 15:05:48 by reasuke ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
2 changes: 1 addition & 1 deletion src/utils/stack_size.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: reasuke <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/23 16:25:21 by reasuke #+# #+# */
/* Updated: 2024/01/23 16:26:01 by reasuke ### ########.fr */
/* Updated: 2024/02/07 15:05:54 by reasuke ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down
2 changes: 1 addition & 1 deletion src/utils/third_content.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: reasuke <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/17 18:28:02 by reasuke #+# #+# */
/* Updated: 2024/01/24 17:03:02 by reasuke ### ########.fr */
/* Updated: 2024/02/07 15:06:04 by reasuke ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down

0 comments on commit 7d6c274

Please sign in to comment.