blob: 484c858440ea912509f4b92c82d5db24d7756dbd (
plain)
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
|
#include "libft/libft.h"
#include "push_swap.h"
static int add_cmd_to_queue(t_list **cmds, enum e_pscmd cmd)
{
t_list *new_elem;
enum e_pscmd *ptr_cmd;
ptr_cmd = malloc(sizeof(enum e_pscmd));
if (!ptr_cmd)
return 1;
new_elem = ft_lstnew(ptr_cmd);
if (!new_elem)
{
free(ptr_cmd);
return 1;
}
ft_lstadd_back(cmds, new_elem);
return 0;
}
void run_command(t_list **stack_a, t_list **stack_b, t_list **cmds, enum e_pscmd cmd)
{
if (cmd == SA)
;
else if (cmd == SB)
;
else if (cmd == SS)
;
else if (cmd == PA)
;
else if (cmd == PB)
;
else if (cmd == RA)
;
else if (cmd == RB)
;
else if (cmd == RR)
;
else if (cmd == RRA)
;
else if (cmd == RRB)
;
else if (cmd == RRR)
;
add_cmd_to_queue(cmds, cmd);
}
|