-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpush_swap.h
executable file
·108 lines (99 loc) · 3.21 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_swap.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: abadidi < abadidi@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/12/11 18:49:07 by abadidi #+# #+# */
/* Updated: 2021/12/11 18:49:07 by abadidi ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef PUSH_SWAP_H
# define PUSH_SWAP_H
# include <stdlib.h>
# include <unistd.h>
# include <string.h>
typedef struct s_stack
{
int val;
struct s_stack *next;
} t_stack;
typedef struct s_sort_vars
{
int maxnum;
int maxbit;
int i;
int j;
int k;
} t_sort_vars;
typedef struct s_sort_five_vars
{
int index;
int size;
int small;
} t_sort_five_vars;
typedef struct s_sort_three_vars
{
int val0;
int val1;
int val2;
} t_sort_three_vars;
typedef struct s_vars
{
int i;
int j;
} t_vars;
typedef struct s_main_vars
{
int *tab;
int *copy;
t_stack *b;
t_stack *a;
t_vars v;
} t_main_vars;
int check1(char *str);
void bubblesort(int *arr, int n);
long long ft_atoi(char const *s);
int ft_isdigit(int c);
void ft_bzero(void *str, size_t n);
void *ft_memcpy(void *dest, const void *src, size_t n);
void push(t_stack **s, int val);
int pop(t_stack **s);
int peak(t_stack *s);
void swap(t_stack *s);
void print_stack_a(t_stack *s);
int print(char *str);
void help_main(int argc, t_main_vars c);
void help_help_main(int argc, t_main_vars c);
void help_main_bis(int argc, t_main_vars c);
void help_main_tiers(int argc, char **argv, t_main_vars c);
void help_main_quater(int argc, t_main_vars c);
void help_main_quinquies(int argc, t_main_vars c);
int check(char *str);
void gobal_check(int argc, char **argv);
void free_tabs(int *a, int *b);
void free_stack(t_stack *s);
void push(t_stack **s, int val);
int pop(t_stack **s);
int peak(t_stack *s);
void swap(t_stack *s);
int push_from(t_stack **a, t_stack **b);
int checkisnotsorted(int *t, int size);
int checkduplicated(int *t, int size);
void sort_five(t_stack **a, t_stack **b);
void sort_four_help(int index, t_stack **a, t_stack **b);
void sort_four(t_stack **a, t_stack **b);
void sort_three_help(t_sort_three_vars v, t_stack **a);
void sort_three(t_stack **a);
void sort_tow(void);
void sort(t_stack **a, t_stack **b, int size);
void rotate_stack(t_stack **s);
void revers_rotate(t_stack **s);
int findsmall(t_stack *a, int *index);
int stack_size(t_stack *s);
int ft_strlen(char *str);
int ft_strcmp(const char *s1, const char *s2);
void fill_tab(int *tab, t_stack **a, int argc, char **argv);
char *get_next_line(int fd);
#endif