everything in src|include should pass the norminette now
This commit is contained in:
parent
3ab3a384c3
commit
ed0c78d8a2
31 changed files with 453 additions and 384 deletions
|
|
@ -14,26 +14,26 @@
|
|||
#include "me/printf/printf.h"
|
||||
#include "me/vec/vec_i64.h"
|
||||
|
||||
static inline void push_inner(t_vec_i64 *to, t_vec_i64 *from, t_const_str tag,
|
||||
t_const_str print)
|
||||
static inline void push_inner(t_vec_i64 *to, t_vec_i64 *from, t_const_str tag,
|
||||
t_const_str print)
|
||||
{
|
||||
t_i64 e;
|
||||
t_i64 e;
|
||||
|
||||
(void)(tag);
|
||||
if (from->len == 0)
|
||||
return;
|
||||
return ;
|
||||
vec_i64_pop_front(from, &e);
|
||||
vec_i64_push_front(to, e);
|
||||
if (print)
|
||||
ft_printf("%s\n", print);
|
||||
}
|
||||
|
||||
void push_a(t_state *s)
|
||||
void push_a(t_state *s)
|
||||
{
|
||||
push_inner(&s->stack_a, &s->stack_b, "Push A", "pa");
|
||||
}
|
||||
|
||||
void push_b(t_state *s)
|
||||
void push_b(t_state *s)
|
||||
{
|
||||
push_inner(&s->stack_b, &s->stack_a, "Push B", "pb");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,31 +13,31 @@
|
|||
#include "app/state.h"
|
||||
#include "me/printf/printf.h"
|
||||
|
||||
static inline void rev_rotate_inner(t_vec_i64 *stack, t_const_str tag,
|
||||
t_const_str print)
|
||||
static inline void rev_rotate_inner(t_vec_i64 *stack, t_const_str tag,
|
||||
t_const_str print)
|
||||
{
|
||||
t_i64 e;
|
||||
t_i64 e;
|
||||
|
||||
(void)(tag);
|
||||
if (stack->len <= 1)
|
||||
return;
|
||||
return ;
|
||||
vec_i64_pop(stack, &e);
|
||||
vec_i64_push_front(stack, e);
|
||||
if (print)
|
||||
ft_printf("%s\n", print);
|
||||
}
|
||||
|
||||
void rev_rotate_a(t_state *s)
|
||||
void rev_rotate_a(t_state *s)
|
||||
{
|
||||
rev_rotate_inner(&s->stack_a, "RevRotate A", "rra");
|
||||
}
|
||||
|
||||
void rev_rotate_b(t_state *s)
|
||||
void rev_rotate_b(t_state *s)
|
||||
{
|
||||
rev_rotate_inner(&s->stack_b, "RevRotate B", "rrb");
|
||||
}
|
||||
|
||||
void rev_rotate_both(t_state *s)
|
||||
void rev_rotate_both(t_state *s)
|
||||
{
|
||||
rev_rotate_inner(&s->stack_a, "RevRotate Both", NULL);
|
||||
rev_rotate_inner(&s->stack_b, "RevRotate Both", "rrr");
|
||||
|
|
|
|||
|
|
@ -13,31 +13,31 @@
|
|||
#include "app/state.h"
|
||||
#include "me/printf/printf.h"
|
||||
|
||||
static inline void rotate_inner(t_vec_i64 *stack, t_const_str tag,
|
||||
t_const_str print)
|
||||
static inline void rotate_inner(t_vec_i64 *stack, t_const_str tag,
|
||||
t_const_str print)
|
||||
{
|
||||
t_i64 e;
|
||||
t_i64 e;
|
||||
|
||||
(void)(tag);
|
||||
if (stack->len <= 1)
|
||||
return;
|
||||
return ;
|
||||
vec_i64_pop_front(stack, &e);
|
||||
vec_i64_push(stack, e);
|
||||
if (print)
|
||||
ft_printf("%s\n", print);
|
||||
}
|
||||
|
||||
void rotate_a(t_state *s)
|
||||
void rotate_a(t_state *s)
|
||||
{
|
||||
rotate_inner(&s->stack_a, "Rotate A", "ra");
|
||||
}
|
||||
|
||||
void rotate_b(t_state *s)
|
||||
void rotate_b(t_state *s)
|
||||
{
|
||||
rotate_inner(&s->stack_b, "Rotate B", "rb");
|
||||
}
|
||||
|
||||
void rotate_both(t_state *s)
|
||||
void rotate_both(t_state *s)
|
||||
{
|
||||
me_eprintf("BOTHHHHHH!!!!");
|
||||
rotate_inner(&s->stack_a, "Rotate Both", NULL);
|
||||
|
|
|
|||
|
|
@ -14,15 +14,15 @@
|
|||
#include "me/printf/printf.h"
|
||||
#include "me/vec/vec_i64.h"
|
||||
|
||||
static inline void swap_inner(t_vec_i64 *stack, t_const_str tag,
|
||||
t_const_str print)
|
||||
static inline void swap_inner(t_vec_i64 *stack, t_const_str tag,
|
||||
t_const_str print)
|
||||
{
|
||||
t_i64 first;
|
||||
t_i64 second;
|
||||
t_i64 first;
|
||||
t_i64 second;
|
||||
|
||||
(void)(tag);
|
||||
if (stack->len <= 1)
|
||||
return;
|
||||
return ;
|
||||
vec_i64_pop(stack, &first);
|
||||
vec_i64_pop(stack, &second);
|
||||
vec_i64_push(stack, first);
|
||||
|
|
@ -31,17 +31,17 @@ static inline void swap_inner(t_vec_i64 *stack, t_const_str tag,
|
|||
ft_printf("%s\n", print);
|
||||
}
|
||||
|
||||
void swap_a(t_state *s)
|
||||
void swap_a(t_state *s)
|
||||
{
|
||||
swap_inner(&s->stack_a, "Swap A", "sa");
|
||||
}
|
||||
|
||||
void swap_b(t_state *s)
|
||||
void swap_b(t_state *s)
|
||||
{
|
||||
swap_inner(&s->stack_b, "Swap B", "sb");
|
||||
}
|
||||
|
||||
void swap_both(t_state *s)
|
||||
void swap_both(t_state *s)
|
||||
{
|
||||
swap_inner(&s->stack_a, "Swap Both", NULL);
|
||||
swap_inner(&s->stack_b, "Swap Both", "ss");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue