55 lines
1.8 KiB
C
55 lines
1.8 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* push_swap.h :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2022/11/23 16:51:31 by erey-bet #+# #+# */
|
|
/* Updated: 2022/12/08 11:23:13 by erey-bet ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#ifndef PUSH_SWAP_H
|
|
# define PUSH_SWAP_H
|
|
|
|
# include <unistd.h>
|
|
# include <stdlib.h>
|
|
# include "libft/libft.h"
|
|
|
|
typedef struct s_stack
|
|
{
|
|
long *list;
|
|
int len;
|
|
} t_stack;
|
|
|
|
// Push Swap
|
|
void post_push_swap(t_stack sa, t_stack sb, int x, int sa_len);
|
|
void pre_push_swap(long *tab, int len);
|
|
void push_swap_5(long *tab, int len);
|
|
void push_swap_3(long *tab, int len);
|
|
|
|
// Operations
|
|
void swap(t_stack *s, char *message);
|
|
void push(t_stack *s_push, t_stack *s_receive, char *message);
|
|
void rotate(t_stack *s, char *message);
|
|
void rrotate(t_stack *s, char *message);
|
|
|
|
// Tools
|
|
int get_min(long *tab, int len);
|
|
long *get_index(long *tab, int len);
|
|
int max_len_binary(t_stack s);
|
|
int check_sa(t_stack s);
|
|
int tab_malloc(int argc, char *argv[]);
|
|
int put_error(void);
|
|
char **set_only_space(char *argv[], int i);
|
|
int if_there_is_double(long *tab, int y);
|
|
|
|
// Parsing
|
|
int parsing(int argc, char *argv[], long *tab);
|
|
|
|
// Free
|
|
void free_strstr(char **tmp);
|
|
|
|
#endif
|