62 lines
1.9 KiB
C
62 lines
1.9 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_bsq.h :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: apago <apago@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/04/05 09:56:45 by tischmid #+# #+# */
|
|
/* Updated: 2023/04/05 19:27:20 by apago ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#ifndef FT_BSQ_H
|
|
# define FT_BSQ_H
|
|
|
|
# include <fcntl.h>
|
|
# include <limits.h>
|
|
# include <stdlib.h>
|
|
# include <unistd.h>
|
|
|
|
typedef struct Meta
|
|
{
|
|
char empty;
|
|
char obstacle;
|
|
char full;
|
|
int height;
|
|
int width;
|
|
} t_meta;
|
|
|
|
typedef struct Map
|
|
{
|
|
t_meta meta;
|
|
char *data;
|
|
int *index;
|
|
} t_map;
|
|
|
|
char *read_file(int file);
|
|
size_t read_uint(char *str);
|
|
int parse_valid_uint(char *str, size_t len);
|
|
int read_char(char *str, char *dst);
|
|
int printable(char c);
|
|
size_t count_first_line(char *line);
|
|
int parse_file(int file, t_map *map);
|
|
void copy_bytes(char *dst, char *src, size_t bytes);
|
|
void ft_memset_int(int *dst, int set, size_t bytes);
|
|
|
|
void ft_putchar(char c, int fd);
|
|
void ft_putstr(char *str, int fd);
|
|
int ft_putnbr(int nb);
|
|
void print_map(t_map *map, int as_numbers);
|
|
int ft_err(char *str, int exit_code);
|
|
|
|
char *ft_strcpy(char *dest, char *src);
|
|
size_t ft_strlen(char const *str);
|
|
void solve(t_map *map);
|
|
int itoc(int idx, int width);
|
|
int itor(int idx, int width);
|
|
int get_index(t_map *map, int idx, int top, int left);
|
|
int validate_meta(t_meta *meta);
|
|
|
|
#endif
|