Unify headers
This commit is contained in:
parent
6809293e60
commit
dec52215e3
6
Makefile
6
Makefile
|
@ -8,11 +8,7 @@ SRC = \
|
|||
map_helpers.c \
|
||||
ft_string.c \
|
||||
|
||||
HEADERS = \
|
||||
parsing.h \
|
||||
printing.h \
|
||||
solution.h \
|
||||
ft_string.h \
|
||||
HEADERS = ft_bsq.h
|
||||
|
||||
OBJDIR = obj
|
||||
SRCDIR = srcs
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* parsing.h :+: :+: :+: */
|
||||
/* ft_bsq.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: apago <apago@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/04 18:22:11 by apago #+# #+# */
|
||||
/* Updated: 2023/04/05 18:08:33 by apago ### ########.fr */
|
||||
/* Created: 2023/04/05 09:56:45 by tischmid #+# #+# */
|
||||
/* Updated: 2023/04/05 19:08:07 by apago ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef PARSING_H
|
||||
# define PARSING_H
|
||||
#ifndef FT_BSQ_H
|
||||
# define FT_BSQ_H
|
||||
|
||||
# include "fcntl.h"
|
||||
# include "stdio.h"
|
||||
# include "stdlib.h"
|
||||
# include "unistd.h"
|
||||
# include <fcntl.h>
|
||||
# include <limits.h>
|
||||
# include <stdlib.h>
|
||||
# include <unistd.h>
|
||||
|
||||
typedef struct Meta
|
||||
{
|
||||
|
@ -44,4 +44,17 @@ 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);
|
||||
|
||||
#endif
|
|
@ -1,20 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_string.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/05 09:56:45 by tischmid #+# #+# */
|
||||
/* Updated: 2023/04/05 10:02:30 by tischmid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef FT_STRING_H
|
||||
# define FT_STRING_H
|
||||
# include <stdio.h>
|
||||
|
||||
char *ft_strcpy(char *dest, char *src);
|
||||
size_t ft_strlen(char const *str);
|
||||
|
||||
#endif
|
|
@ -1,29 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* printing.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: apago <apago@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/05 04:11:08 by tischmid #+# #+# */
|
||||
/* Updated: 2023/04/05 17:50:16 by apago ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef PRINTING_H
|
||||
# define PRINTING_H
|
||||
# include "parsing.h"
|
||||
# include <limits.h>
|
||||
# include <unistd.h>
|
||||
# define RED "\x1b[31m"
|
||||
# define GRN "\x1b[32m"
|
||||
# define YLW "\x1b[33m"
|
||||
# define CLR_RST "\x1b[m"
|
||||
|
||||
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);
|
||||
|
||||
#endif
|
|
@ -1,23 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* solution.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: apago <apago@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/05 04:02:35 by tischmid #+# #+# */
|
||||
/* Updated: 2023/04/05 17:40:16 by apago ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef SOLUTION_H
|
||||
# define SOLUTION_H
|
||||
# include "parsing.h"
|
||||
# include "printing.h"
|
||||
|
||||
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);
|
||||
|
||||
#endif
|
|
@ -3,14 +3,14 @@
|
|||
/* ::: :::::::: */
|
||||
/* ft_string.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* By: apago <apago@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/05 09:57:31 by tischmid #+# #+# */
|
||||
/* Updated: 2023/04/05 09:57:39 by tischmid ### ########.fr */
|
||||
/* Updated: 2023/04/05 19:06:23 by apago ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ft_string.h"
|
||||
#include "ft_bsq.h"
|
||||
|
||||
char *ft_strcpy(char *dest, char *src)
|
||||
{
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
/* By: apago <apago@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/04 18:23:57 by apago #+# #+# */
|
||||
/* Updated: 2023/04/05 17:32:11 by apago ### ########.fr */
|
||||
/* Updated: 2023/04/05 19:06:21 by apago ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "parsing.h"
|
||||
#include "ft_bsq.h"
|
||||
|
||||
void copy_bytes(char *dst, char *src, size_t bytes)
|
||||
{
|
||||
|
|
|
@ -6,14 +6,11 @@
|
|||
/* By: apago <apago@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/04 21:50:50 by tischmid #+# #+# */
|
||||
/* Updated: 2023/04/05 18:16:13 by apago ### ########.fr */
|
||||
/* Updated: 2023/04/05 19:05:50 by apago ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ft_string.h"
|
||||
#include "printing.h"
|
||||
#include "solution.h"
|
||||
#include <stdio.h>
|
||||
#include "ft_bsq.h"
|
||||
|
||||
int handle_file(int file)
|
||||
{
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
/* By: apago <apago@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/05 06:50:28 by tischmid #+# #+# */
|
||||
/* Updated: 2023/04/05 17:35:58 by apago ### ########.fr */
|
||||
/* Updated: 2023/04/05 19:06:18 by apago ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "solution.h"
|
||||
#include "ft_bsq.h"
|
||||
|
||||
// index to column
|
||||
int itoc(int idx, int width)
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
/* By: apago <apago@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/04 16:19:27 by apago #+# #+# */
|
||||
/* Updated: 2023/04/05 18:07:43 by apago ### ########.fr */
|
||||
/* Updated: 2023/04/05 19:06:08 by apago ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "parsing.h"
|
||||
#include "ft_bsq.h"
|
||||
|
||||
int parse_meta(char *str, t_meta *meta)
|
||||
{
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
/* By: apago <apago@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/04 18:25:47 by apago #+# #+# */
|
||||
/* Updated: 2023/04/04 21:56:56 by tischmid ### ########.fr */
|
||||
/* Updated: 2023/04/05 19:06:14 by apago ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "parsing.h"
|
||||
#include "ft_bsq.h"
|
||||
|
||||
size_t read_uint(char *str)
|
||||
{
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
/* By: apago <apago@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/05 04:09:39 by tischmid #+# #+# */
|
||||
/* Updated: 2023/04/05 17:48:29 by apago ### ########.fr */
|
||||
/* Updated: 2023/04/05 19:06:03 by apago ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "printing.h"
|
||||
#include "ft_bsq.h"
|
||||
|
||||
void ft_putchar(char c, int fd)
|
||||
{
|
||||
|
@ -19,9 +19,7 @@ void ft_putchar(char c, int fd)
|
|||
|
||||
int ft_err(char *str, int exit_code)
|
||||
{
|
||||
ft_putstr(RED, 2);
|
||||
ft_putstr(str, 2);
|
||||
ft_putstr(CLR_RST, 2);
|
||||
return (exit_code);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
/* By: apago <apago@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/04 21:46:57 by tischmid #+# #+# */
|
||||
/* Updated: 2023/04/05 18:24:14 by apago ### ########.fr */
|
||||
/* Updated: 2023/04/05 19:06:00 by apago ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "solution.h"
|
||||
#include "ft_bsq.h"
|
||||
|
||||
// Replace each cell by the number of obstacles a rectangle starting
|
||||
// from the top left cell, filling the board until the cell in question,
|
||||
|
|
Loading…
Reference in New Issue