-
Notifications
You must be signed in to change notification settings - Fork 0
/
push_swap.h
76 lines (71 loc) · 2.64 KB
/
push_swap.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_swap.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: skunert <skunert@student.42heilbronn.de +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/14 10:05:37 by skunert #+# #+# */
/* Updated: 2023/04/28 12:01:29 by skunert ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef PUSH_SWAP_H
# define PUSH_SWAP_H
# include "./includes/includes.h"
# include <stddef.h>
# include <limits.h>
//mystack struct
typedef struct Stack
{
int *collection;
int capacity;
int top;
} t_stack;
//atoi_l
long ft_atoi_long(const char *str);
//check input funcs
int check_int(int argc, char **argv);
int check_dup(int argc, char **argv);
int check_input(int argc, char **argv);
void free_arr(char **arr);
//stack argc = 2 funcs and check
t_stack *stack_make(char **argv);
int check_argv_int(char **argv);
int check_argv_dup(char **argv);
int check_argv_type(char **argv);
int check_argv_input(char **argv);
//stack funcs
t_stack *stack_create(int capacity);
void stack_destroy(t_stack *stack);
int push(t_stack *stack, int value);
int pull(t_stack *stack, int *value);
t_stack *stack_init(int argc, char **argv);
//instruction funcs
//swap
void ft_swap(t_stack *stack);
void ft_swap_a(t_stack *stack);
void ft_swap_b(t_stack *stack);
void ft_ss(t_stack *stack_a, t_stack *stack_b);
//push
void ft_push_b(t_stack *stack_a, t_stack *stack_b);
void ft_push_a(t_stack *stack_a, t_stack *stack_b);
//rotate_funcs
void ft_rotate(t_stack *stack);
void ft_rotate_a(t_stack *stack);
void ft_rotate_b(t_stack *stack);
void ft_rr(t_stack *stack_a, t_stack *stack_b);
//reverse rotate funcs
void ft_r_rotate(t_stack *stack);
void ft_r_rotate_a(t_stack *stack);
void ft_r_rotate_b(t_stack *stack);
void ft_rrr(t_stack *stack_a, t_stack *stack_b);
//sorting funcs
int is_sorted_a(t_stack *stack);
int *int_arr_cpy(t_stack *stack);
void sort_int_arr(int *collection, int len);
void convert_collection(t_stack *stack);
//small_sort_funcs
void small_sort_three(t_stack *stack_a);
void small_sort_five(t_stack *stack_a, t_stack *stack_b);
void big_sort(t_stack *stack_a, t_stack *stack_b);
#endif