From d16b39091a7fb36300cced4a073223530f285a05 Mon Sep 17 00:00:00 2001 From: EniumRaphael Date: Wed, 29 May 2024 15:34:47 +0200 Subject: [PATCH] Correcting all stuff for libft --- math/Makefile | 17 ++++++-------- math/{sources => libft}/ft_split.c | 0 math/main.c | 37 ++++++++---------------------- sources/exec/separator/and_and.c | 2 +- stdme/include/me/char/char.h | 4 ++-- stdme/src/char/isascii.c | 4 ++-- 6 files changed, 21 insertions(+), 43 deletions(-) rename math/{sources => libft}/ft_split.c (100%) diff --git a/math/Makefile b/math/Makefile index 99f37d40..f79bae6e 100644 --- a/math/Makefile +++ b/math/Makefile @@ -6,7 +6,7 @@ # By: rparodi +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/12 11:05:05 by rparodi #+# #+# # -# Updated: 2024/05/28 15:50:04 by rparodi ### ########.fr # +# Updated: 2024/05/29 14:20:08 by rparodi ### ########.fr # # # # **************************************************************************** # @@ -14,7 +14,7 @@ # Variables # Name -NAME = test +NAME = libmmath.a LIBDIRNAME = libft SRCDIRNAME = sources @@ -26,17 +26,15 @@ RM = rm -rf CFLAGS = -Werror -Wextra -Wall -Wno-unused-command-line-argument -g3 -MMD # Sources -LIB = +LIB = ./libft/ft_split.c -SRC = ./main.c \ - ./sources/operation/ft_pow.c \ +SRC = ./sources/operation/ft_pow.c \ ./sources/operation/ft_add.c \ ./sources/utils/ft_init_numbers.c \ ./sources/utils/ft_nblen.c \ ./sources/comparison/ft_is_less.c \ ./sources/comparison/ft_equal.c \ - ./sources/comparison/ft_is_greater.c \ - ./sources/ft_split.c + ./sources/comparison/ft_is_greater.c # Objects OBJDIRNAME = ./objects @@ -85,8 +83,7 @@ $(NAME): $(OBJ) $(LIB_OBJ) @mkdir -p $(OBJDIRNAME)/$(LIBDIRNAME) @mkdir -p $(OBJDIRNAME)/$(SRCDIRNAME) @printf '$(GREY) Creating $(END)$(GREEN)$(OBJDIRNAME)$(END)\n' - @cc $(CFLAGS) -o $(NAME) -c $(OBJ) $(LIB_OBJ) - @ar rc $(NAME) $(OBJ) $(OBJBonus) + @ar rc $(NAME) $(OBJ) $(OBJBonus) 1>/dev/null @ranlib $(NAME) # Creating the objects $(OBJDIRNAME)/%.o: %.c @@ -128,5 +125,5 @@ footer: # Phony .PHONY: all bonus clean fclean re --DCMAKE_EXPORT_COMPILE_COMMANDS=ON +# -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -include ${OBJ:.o=.d} diff --git a/math/sources/ft_split.c b/math/libft/ft_split.c similarity index 100% rename from math/sources/ft_split.c rename to math/libft/ft_split.c diff --git a/math/main.c b/math/main.c index 62045190..a66d5602 100644 --- a/math/main.c +++ b/math/main.c @@ -1,36 +1,17 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* main.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: rparodi +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2024/05/27 14:41:26 by rparodi #+# #+# */ -/* Updated: 2024/05/28 15:48:40 by rparodi ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include #include "./includes/ft_math.h" -int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { - t_number nb; + t_number nb; - if (argc != 2) + if (argc == 2) { - printf("Usage: %s \n", argv[0]); - return 1; - } - else if (argc == 2) - { - if (ft_init_numbers(argv[1], &nb) == ERROR) - { - printf("Error\n"); - return 1; - } - else - printf("Number = %s \n(int: %s, %zu) (float: %s, %zu)\n", nb.number, nb.int_part, nb.int_size, nb.float_part, nb.float_size); + ft_init_numbers(argv[1], &nb); + printf("Number: %s\n", nb.number); + printf("Integer: %s\n", nb.int_part); + printf("Float: %s\n", nb.float_part); + printf("Integer size: %zu\n", nb.int_size); + printf("Float size: %zu\n", nb.float_size); } return (0); } diff --git a/sources/exec/separator/and_and.c b/sources/exec/separator/and_and.c index 224c2229..de8ad7ad 100644 --- a/sources/exec/separator/and_and.c +++ b/sources/exec/separator/and_and.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/12 19:16:12 by rparodi #+# #+# */ -/* Updated: 2024/05/12 19:19:08 by rparodi ### ########.fr */ +/* Updated: 2024/05/18 17:48:43 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/stdme/include/me/char/char.h b/stdme/include/me/char/char.h index 8be68e39..9120ac54 100644 --- a/stdme/include/me/char/char.h +++ b/stdme/include/me/char/char.h @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/19 17:11:41 by maiboyer #+# #+# */ -/* Updated: 2024/05/19 17:11:42 by maiboyer ### ########.fr */ +/* Updated: 2024/05/24 20:10:07 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -33,7 +33,7 @@ bool me_isdigit(char chr); /// @brief Check if a character is in the ascii range /// @param chr char to check /// @return chr is a ascii character -bool me_isascii(char chr); +bool me_isascii(signed char chr); /// @brief Check if a character is lowercase /// @param chr char to check diff --git a/stdme/src/char/isascii.c b/stdme/src/char/isascii.c index 1171b48c..80832225 100644 --- a/stdme/src/char/isascii.c +++ b/stdme/src/char/isascii.c @@ -6,13 +6,13 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/09 17:51:01 by maiboyer #+# #+# */ -/* Updated: 2024/04/28 19:41:21 by maiboyer ### ########.fr */ +/* Updated: 2024/05/24 20:09:25 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ #include "me/char/char.h" -bool me_isascii(char chr) +bool me_isascii(signed char chr) { return (0 <= chr && chr); }