From 3cadabea0a7fc637286c2ae94e00247caf66c450 Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 5 Sep 2025 16:29:29 +0200 Subject: [PATCH] docs(list): moving the actual documentation on the header - The documentation on the header allow u to see on the files where the header is inclued --- includes/list.h | 66 +++++++++++++++++++++++++++++++++++++++++- list/ft_lstadd_back.c | 8 +---- list/ft_lstadd_front.c | 8 +---- list/ft_lstclear.c | 8 +---- list/ft_lstdelone.c | 8 +---- list/ft_lstiter.c | 8 +---- list/ft_lstlast.c | 8 +---- list/ft_lstmap.c | 10 +------ list/ft_lstnew.c | 8 +---- list/ft_lstsize.c | 8 +---- 10 files changed, 74 insertions(+), 66 deletions(-) diff --git a/includes/list.h b/includes/list.h index 88aee8c..6b831c4 100644 --- a/includes/list.h +++ b/includes/list.h @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/31 15:00:12 by rparodi #+# #+# */ -/* Updated: 2025/09/01 16:34:41 by rparodi ### ########.fr */ +/* Updated: 2025/09/05 16:24:23 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,14 +19,78 @@ typedef struct s_list struct s_list *next; } t_list; +/** + * @brief Give the size of the chained list + * + * @param lst the chained list + * @return the size of the list + */ int ft_lstsize(t_list *lst); + +/** + * @brief Found the last element of the chained list + * + * @param lst the chained list + * @return the last element of the chained list + */ t_list *ft_lstlast(t_list *lst); + +/** + * @brief Create an other list from an old one with a function on all element + * + * @param lst the chained list + * @param f the function to function to iterate + * @param del The function to delete the old list + * @return The list edited by the function given by f + */ t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *)); + +/** + * @brief Allocate a new list with the first element + * + * @param content the element to give on first element + * @return the new list + */ t_list *ft_lstnew(void *content); + +/** + * @brief Add the list new to the back of chained list of lst + * + * @param lst first element of the list + * @param new The element to add at the end + */ void ft_lstadd_back(t_list **lst, t_list *new); + +/** + * @brief Add the list new to the front of chained list of lst + * + * @param lst first element of the list + * @param new The element to add at the start + */ void ft_lstadd_front(t_list **lst, t_list *new); + +/** + * @brief Clear the all list with the function + * + * @param lst the start of the chained list + * @param del the function to clear the list + */ void ft_lstclear(t_list **lst, void (*del)(void *)); + +/** + * @brief Clear the element of the list with the function + * + * @param lst the element of the list to be clear + * @param del the function to clear the list + */ void ft_lstdelone(t_list *lst, void (*del)(void *)); + +/** + * @brief Apply the fstunction given in arguments at all the element of the list + * + * @param lst the chained list + * @param f the pointer to function + */ void ft_lstiter(t_list *lst, void (*f)(void *)); #endif diff --git a/list/ft_lstadd_back.c b/list/ft_lstadd_back.c index 03da61e..3e99f37 100644 --- a/list/ft_lstadd_back.c +++ b/list/ft_lstadd_back.c @@ -6,19 +6,13 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/12 11:39:56 by rparodi #+# #+# */ -/* Updated: 2025/09/01 16:35:17 by rparodi ### ########.fr */ +/* Updated: 2025/09/05 16:14:04 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ #include "list.h" #include -/** - * @brief Add the list new to the back of chained list of lst - * - * @param lst first element of the list - * @param new The element to add at the end - */ void ft_lstadd_back(t_list **lst, t_list *new) { t_list *tempo; diff --git a/list/ft_lstadd_front.c b/list/ft_lstadd_front.c index aad3a53..89cfab6 100644 --- a/list/ft_lstadd_front.c +++ b/list/ft_lstadd_front.c @@ -6,19 +6,13 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/12 11:40:16 by rparodi #+# #+# */ -/* Updated: 2025/09/01 16:35:45 by rparodi ### ########.fr */ +/* Updated: 2025/09/05 16:14:05 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ #include "list.h" #include -/** - * @brief Add the list new to the front of chained list of lst - * - * @param lst first element of the list - * @param new The element to add at the start - */ void ft_lstadd_front(t_list **lst, t_list *new) { if (*lst == NULL) diff --git a/list/ft_lstclear.c b/list/ft_lstclear.c index 77e0359..b9d571a 100644 --- a/list/ft_lstclear.c +++ b/list/ft_lstclear.c @@ -6,18 +6,12 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/12 11:40:37 by rparodi #+# #+# */ -/* Updated: 2025/09/01 16:33:31 by rparodi ### ########.fr */ +/* Updated: 2025/09/05 16:14:05 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ #include "list.h" -/** - * @brief Clear the all list with the function - * - * @param lst the start of the chained list - * @param del the function to clear the list - */ void ft_lstclear(t_list **lst, void (*del)(void *)) { t_list *tempo; diff --git a/list/ft_lstdelone.c b/list/ft_lstdelone.c index 7948114..fe42293 100644 --- a/list/ft_lstdelone.c +++ b/list/ft_lstdelone.c @@ -6,19 +6,13 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/12 11:42:11 by rparodi #+# #+# */ -/* Updated: 2025/09/01 16:36:07 by rparodi ### ########.fr */ +/* Updated: 2025/09/05 16:14:05 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ #include "list.h" #include -/** - * @brief Clear the element of the list with the function - * - * @param lst the element of the list to be clear - * @param del the function to clear the list - */ void ft_lstdelone(t_list *lst, void (*del)(void *)) { del(lst->content); diff --git a/list/ft_lstiter.c b/list/ft_lstiter.c index 0fb98c5..270fb79 100644 --- a/list/ft_lstiter.c +++ b/list/ft_lstiter.c @@ -6,19 +6,13 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/12 11:42:24 by rparodi #+# #+# */ -/* Updated: 2025/09/01 16:35:17 by rparodi ### ########.fr */ +/* Updated: 2025/09/05 16:14:05 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ #include "list.h" #include -/** - * @brief Apply the fstunction given in arguments at all the element of the list - * - * @param lst the chained list - * @param f the pointer to function - */ void ft_lstiter(t_list *lst, void (*f)(void *)) { while (lst != NULL) diff --git a/list/ft_lstlast.c b/list/ft_lstlast.c index b6e6a56..dfb3fa7 100644 --- a/list/ft_lstlast.c +++ b/list/ft_lstlast.c @@ -6,19 +6,13 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/12 11:42:54 by rparodi #+# #+# */ -/* Updated: 2025/09/01 16:36:47 by rparodi ### ########.fr */ +/* Updated: 2025/09/05 16:14:04 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ #include "list.h" #include -/** - * @brief Found the last element of the chained list - * - * @param lst the chained list - * @return the last element of the chained list - */ t_list *ft_lstlast(t_list *lst) { if (lst == NULL) diff --git a/list/ft_lstmap.c b/list/ft_lstmap.c index 0299b5d..f9bef32 100644 --- a/list/ft_lstmap.c +++ b/list/ft_lstmap.c @@ -6,21 +6,13 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/12 11:43:28 by rparodi #+# #+# */ -/* Updated: 2025/09/01 16:37:46 by rparodi ### ########.fr */ +/* Updated: 2025/09/05 16:14:05 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ #include "list.h" #include -/** - * @brief Create an other list from an old one with a function on all element - * - * @param lst the chained list - * @param f the function to function to iterate - * @param del The function to delete the old list - * @return - */ t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *)) { t_list *tempo; diff --git a/list/ft_lstnew.c b/list/ft_lstnew.c index bdef868..b9babff 100644 --- a/list/ft_lstnew.c +++ b/list/ft_lstnew.c @@ -6,19 +6,13 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/12 11:44:02 by rparodi #+# #+# */ -/* Updated: 2025/09/01 16:39:00 by rparodi ### ########.fr */ +/* Updated: 2025/09/05 16:14:05 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ #include "list.h" #include -/** - * @brief Allocate a new list with the first element - * - * @param content the element to give on first element - * @return the new list - */ t_list *ft_lstnew(void *content) { t_list *to_return; diff --git a/list/ft_lstsize.c b/list/ft_lstsize.c index e58fe3f..ae06474 100644 --- a/list/ft_lstsize.c +++ b/list/ft_lstsize.c @@ -6,19 +6,13 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/12 11:44:24 by rparodi #+# #+# */ -/* Updated: 2025/09/01 16:39:28 by rparodi ### ########.fr */ +/* Updated: 2025/09/05 16:14:04 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ #include "list.h" #include -/** - * @brief Give the size of the chained list - * - * @param lst the chained list - * @return the size of the list - */ int ft_lstsize(t_list *lst) { int count;