From a1f18a6f970cfeae77ab5bcbde43c6da92a6c3d8 Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 19 Sep 2025 17:27:19 +0200 Subject: [PATCH] feat: adding internal header - Adding the internal header allow to don't get all the function needed by printf in the main header --- includes/_internal.h | 48 ++++++++++++++++++++++++++++++++++++++++++ sources/ft_printf.c | 4 ++-- sources/print_char.c | 2 +- sources/print_number.c | 4 ++-- 4 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 includes/_internal.h diff --git a/includes/_internal.h b/includes/_internal.h new file mode 100644 index 0000000..407417e --- /dev/null +++ b/includes/_internal.h @@ -0,0 +1,48 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* _internal.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/09/19 17:15:50 by rparodi #+# #+# */ +/* Updated: 2025/09/19 17:25:25 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef _INTERNAL_H +# define _INTERNAL_H + +# include +# include +# include + +typedef int (*t_func)(va_list, int fd); + +typedef struct s_format +{ + char character; + t_func function; +} t_format; + +size_t ft_strlen(const char *str); + +char *itoa_base(uint64_t nbr, char *base); + +int flag_c(va_list args, int fd); + +int flag_i(va_list args, int fd); + +int flag_p(va_list args, int fd); + +int flag_percent(va_list args, int fd); + +int flag_s(va_list args, int fd); + +int flag_u(va_list args, int fd); + +int flag_x(va_list args, int fd); + +int flag_x_maj(va_list args, int fd); + +#endif diff --git a/sources/ft_printf.c b/sources/ft_printf.c index 3ffd37c..1c56d56 100644 --- a/sources/ft_printf.c +++ b/sources/ft_printf.c @@ -6,11 +6,11 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/09/17 17:44:34 by rparodi #+# #+# */ -/* Updated: 2025/09/19 15:35:38 by rparodi ### ########.fr */ +/* Updated: 2025/09/19 17:17:12 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ -#include "ft_printf.h" +#include "_internal.h" #include #include #include diff --git a/sources/print_char.c b/sources/print_char.c index b559e77..4462656 100644 --- a/sources/print_char.c +++ b/sources/print_char.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "ft_printf.h" +#include "_internal.h" #include #include #include diff --git a/sources/print_number.c b/sources/print_number.c index a1a19a5..e3659ab 100644 --- a/sources/print_number.c +++ b/sources/print_number.c @@ -6,11 +6,11 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/09/18 15:00:27 by rparodi #+# #+# */ -/* Updated: 2025/09/19 16:06:27 by rparodi ### ########.fr */ +/* Updated: 2025/09/19 17:19:45 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ -#include "ft_printf.h" +#include "_internal.h" #include #include #include