Change file structure of this library
authorLukas Jiriste <ljiriste@student.42prague.com>
Sat, 9 Dec 2023 12:43:15 +0000 (13:43 +0100)
committerLukas Jiriste <ljiriste@student.42prague.com>
Sat, 9 Dec 2023 12:43:15 +0000 (13:43 +0100)
Separate source files (functions) to folders by topic.
Create separate header file each folder.
Adjust Makefile and libft.h accordingly.

62 files changed:
Makefile
ft_check/ft_check.h [new file with mode: 0644]
ft_check/ft_isalnum.c [moved from ft_isalnum.c with 100% similarity]
ft_check/ft_isalpha.c [moved from ft_isalpha.c with 100% similarity]
ft_check/ft_isascii.c [moved from ft_isascii.c with 100% similarity]
ft_check/ft_isdigit.c [moved from ft_isdigit.c with 100% similarity]
ft_check/ft_islower.c [moved from ft_islower.c with 100% similarity]
ft_check/ft_isprint.c [moved from ft_isprint.c with 100% similarity]
ft_check/ft_isspace.c [moved from ft_isspace.c with 100% similarity]
ft_check/ft_isupper.c [moved from ft_isupper.c with 100% similarity]
ft_conv/ft_atoi.c [moved from ft_atoi.c with 100% similarity]
ft_conv/ft_conv.h [new file with mode: 0644]
ft_conv/ft_ctoa.c [moved from ft_ctoa.c with 100% similarity]
ft_conv/ft_itoa.c [moved from ft_itoa.c with 100% similarity]
ft_conv/ft_itoa_base.c [moved from ft_itoa_base.c with 100% similarity]
ft_conv/ft_tolower.c [moved from ft_tolower.c with 100% similarity]
ft_conv/ft_toupper.c [moved from ft_toupper.c with 100% similarity]
ft_conv/ft_uitoa_base.c [moved from ft_uitoa_base.c with 100% similarity]
ft_gen/ft_gen.h [new file with mode: 0644]
ft_gen/ft_swap.c [moved from ft_swap.c with 100% similarity]
ft_io/ft_io.h [new file with mode: 0644]
ft_io/ft_printf/conversion.c [moved from ft_printf/conversion.c with 100% similarity]
ft_io/ft_printf/formatting.c [moved from ft_printf/formatting.c with 100% similarity]
ft_io/ft_printf/ft_printf.c [moved from ft_printf/ft_printf.c with 100% similarity]
ft_io/ft_printf/ft_printf.h [moved from ft_printf/ft_printf.h with 100% similarity]
ft_io/ft_printf/padding.c [moved from ft_printf/padding.c with 100% similarity]
ft_io/ft_printf/parsing.c [moved from ft_printf/parsing.c with 100% similarity]
ft_io/ft_putchar_fd.c [moved from ft_putchar_fd.c with 100% similarity]
ft_io/ft_putendl_fd.c [moved from ft_putendl_fd.c with 100% similarity]
ft_io/ft_putnbr_fd.c [moved from ft_putnbr_fd.c with 100% similarity]
ft_io/ft_putstr_fd.c [moved from ft_putstr_fd.c with 100% similarity]
ft_io/get_next_line.c [moved from get_next_line.c with 100% similarity]
ft_io/get_next_line.h [moved from get_next_line.h with 97% similarity]
ft_lst/ft_lst.h [new file with mode: 0644]
ft_math/ft_abs.c [moved from ft_abs.c with 100% similarity]
ft_math/ft_math.h [new file with mode: 0644]
ft_mem/ft_bzero.c [moved from ft_bzero.c with 100% similarity]
ft_mem/ft_calloc.c [moved from ft_calloc.c with 100% similarity]
ft_mem/ft_mem.h [new file with mode: 0644]
ft_mem/ft_memchr.c [moved from ft_memchr.c with 100% similarity]
ft_mem/ft_memcmp.c [moved from ft_memcmp.c with 100% similarity]
ft_mem/ft_memcpy.c [moved from ft_memcpy.c with 100% similarity]
ft_mem/ft_memmove.c [moved from ft_memmove.c with 100% similarity]
ft_mem/ft_memset.c [moved from ft_memset.c with 100% similarity]
ft_str/ft_split.c [moved from ft_split.c with 100% similarity]
ft_str/ft_str.h [new file with mode: 0644]
ft_str/ft_strchr.c [moved from ft_strchr.c with 100% similarity]
ft_str/ft_strdup.c [moved from ft_strdup.c with 100% similarity]
ft_str/ft_striteri.c [moved from ft_striteri.c with 100% similarity]
ft_str/ft_strjoin.c [moved from ft_strjoin.c with 100% similarity]
ft_str/ft_strlcat.c [moved from ft_strlcat.c with 100% similarity]
ft_str/ft_strlcpy.c [moved from ft_strlcpy.c with 100% similarity]
ft_str/ft_strlen.c [moved from ft_strlen.c with 100% similarity]
ft_str/ft_strmapi.c [moved from ft_strmapi.c with 100% similarity]
ft_str/ft_strncat_alloc.c [moved from ft_strncat_alloc.c with 100% similarity]
ft_str/ft_strncmp.c [moved from ft_strncmp.c with 100% similarity]
ft_str/ft_strndup.c [moved from ft_strndup.c with 100% similarity]
ft_str/ft_strnstr.c [moved from ft_strnstr.c with 100% similarity]
ft_str/ft_strrchr.c [moved from ft_strrchr.c with 100% similarity]
ft_str/ft_strtrim.c [moved from ft_strtrim.c with 100% similarity]
ft_str/ft_substr.c [moved from ft_substr.c with 100% similarity]
libft.h

index 3f7e3e8b6df8e2a9c0e8308633cbe1162921011a..e92ca752010054afd73006c607b1f872fc22d9ff 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,80 +4,86 @@ AR := ar
 
 RM := rm -f
 
-SRCDIR := .
-INCLUDE := $(addprefix -I, $(SRCDIR))
-SOURCES :=     ft_strndup.c                    \
-                       ft_putstr_fd.c                  \
-                       ft_putendl_fd.c                 \
-                       ft_atoi.c                               \
-                       ft_strtrim.c                    \
-                       ft_itoa.c                               \
-                       ft_strnstr.c                    \
-                       ft_memmove.c                    \
-                       ft_putnbr_fd.c                  \
-                       ft_memchr.c                             \
-                       ft_strrchr.c                    \
+SRCDIR := ft_gen ft_math ft_str ft_mem ft_io ft_check ft_conv ft_lst
+INCLUDE := $(addprefix -I, $(SRCDIR) .)
+
+SRCgen :=      ft_swap.c                               \
+
+SRCmath :=     ft_abs.c                                \
+
+SRCstr :=      ft_strncat_alloc.c              \
+                       ft_strncmp.c                    \
+                       ft_strndup.c                    \
                        ft_strchr.c                             \
-                       ft_strdup.c                             \
-                       ft_memcmp.c                             \
-                       ft_substr.c                             \
-                       ft_tolower.c                    \
-                       ft_isalnum.c                    \
+                       ft_strtrim.c                    \
                        ft_strlen.c                             \
-                       ft_isspace.c                    \
-                       ft_isdigit.c                    \
-                       ft_calloc.c                             \
-                       ft_strjoin.c                    \
-                       ft_isprint.c                    \
+                       ft_strdup.c                             \
+                       ft_strlcpy.c                    \
+                       ft_strnstr.c                    \
+                       ft_striteri.c                   \
                        ft_strmapi.c                    \
+                       ft_strjoin.c                    \
                        ft_split.c                              \
-                       ft_toupper.c                    \
+                       ft_substr.c                             \
                        ft_strlcat.c                    \
-                       ft_strncat_alloc.c              \
-                       ft_bzero.c                              \
-                       ft_abs.c                                \
-                       ft_isalpha.c                    \
+                       ft_strrchr.c                    \
+
+SRCmem :=      ft_calloc.c                             \
+                       ft_memchr.c                             \
+                       ft_memcmp.c                             \
                        ft_memset.c                             \
-                       ft_striteri.c                   \
-                       ft_isupper.c                    \
-                       ft_isascii.c                    \
-                       ft_islower.c                    \
-                       ft_strlcpy.c                    \
+                       ft_memmove.c                    \
                        ft_memcpy.c                             \
-                       ft_itoa_base.c                  \
-                       ft_putchar_fd.c                 \
-                       ft_ctoa.c                               \
-                       ft_uitoa_base.c                 \
-                       ft_strncmp.c                    \
-                       ft_swap.c                               \
-                       \
-                       get_next_line.c                 \
-                       \
-                       ft_lst/ft_lstnew.c                              \
-                       ft_lst/ft_lstiter.c                             \
-                       ft_lst/ft_lstmap.c                              \
-                       ft_lst/ft_lstclear.c                    \
-                       ft_lst/ft_lstlast.c                             \
-                       ft_lst/ft_lstsize.c                             \
-                       ft_lst/ft_lstadd_front.c                \
-                       ft_lst/ft_lstadd_back.c                 \
-                       ft_lst/ft_lstdelone.c                   \
-                       ft_lst/ft_lst_at.c                              \
-                       ft_lst/ft_lst_find.c                    \
-                       ft_lst/ft_lst_foreach_if.c              \
-                       ft_lst/ft_lst_merge.c                   \
-                       ft_lst/ft_lst_remove_if.c               \
-                       ft_lst/ft_lst_reverse.c                 \
-                       ft_lst/ft_lst_sort.c                    \
-                       ft_lst/ft_lst_sorted_insert.c   \
-                       ft_lst/ft_lst_sorted_merge.c    \
-                       \
+                       ft_bzero.c                              \
+
+SRCio :=       ft_putendl_fd.c                 \
+                       ft_putnbr_fd.c                  \
                        ft_printf/conversion.c  \
-                       ft_printf/formatting.c  \
                        ft_printf/ft_printf.c   \
                        ft_printf/padding.c             \
                        ft_printf/parsing.c             \
-       
+                       ft_printf/formatting.c  \
+                       ft_putchar_fd.c                 \
+                       get_next_line.c                 \
+                       ft_putstr_fd.c                  \
+
+SRCcheck :=    ft_isalnum.c                    \
+                       ft_isspace.c                    \
+                       ft_isdigit.c                    \
+                       ft_isascii.c                    \
+                       ft_isalpha.c                    \
+                       ft_islower.c                    \
+                       ft_isupper.c                    \
+                       ft_isprint.c                    \
+
+SRCconv :=     ft_itoa_base.c                  \
+                       ft_tolower.c                    \
+                       ft_toupper.c                    \
+                       ft_atoi.c                               \
+                       ft_ctoa.c                               \
+                       ft_itoa.c                               \
+                       ft_uitoa_base.c                 \
+
+SRClst :=      ft_lst_reverse.c                \
+                       ft_lstdelone.c                  \
+                       ft_lst_foreach_if.c             \
+                       ft_lstlast.c                    \
+                       ft_lstclear.c                   \
+                       ft_lst_at.c                             \
+                       ft_lst_sorted_merge.c   \
+                       ft_lst_find.c                   \
+                       ft_lstmap.c                             \
+                       ft_lst_remove_if.c              \
+                       ft_lstnew.c                             \
+                       ft_lst_merge.c                  \
+                       ft_lstsize.c                    \
+                       ft_lstadd_front.c               \
+                       ft_lstadd_back.c                \
+                       ft_lstiter.c                    \
+                       ft_lst_sort.c                   \
+                       ft_lst_sorted_insert.c  \
+
+SOURCES := $(foreach dir, $(SRCDIR), $(addprefix $(dir)/, $($(dir:ft_%=SRC%))))
 OBJECTS := $(SOURCES:.c=.o)
 
 NAME = libft.a
diff --git a/ft_check/ft_check.h b/ft_check/ft_check.h
new file mode 100644 (file)
index 0000000..b00f69b
--- /dev/null
@@ -0,0 +1,25 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_check.h                                         :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2023/12/09 11:55:15 by ljiriste          #+#    #+#             */
+/*   Updated: 2023/12/09 11:56:31 by ljiriste         ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef FT_CHECK_H
+# define FT_CHECK_H
+
+int            ft_isalnum(int c);
+int            ft_isalpha(int c);
+int            ft_isdigit(int c);
+int            ft_islower(int c);
+int            ft_isprint(int c);
+int            ft_isspace(int c);
+int            ft_isupper(int c);
+int            ft_isascii(int c);
+
+#endif
similarity index 100%
rename from ft_isalnum.c
rename to ft_check/ft_isalnum.c
similarity index 100%
rename from ft_isalpha.c
rename to ft_check/ft_isalpha.c
similarity index 100%
rename from ft_isascii.c
rename to ft_check/ft_isascii.c
similarity index 100%
rename from ft_isdigit.c
rename to ft_check/ft_isdigit.c
similarity index 100%
rename from ft_islower.c
rename to ft_check/ft_islower.c
similarity index 100%
rename from ft_isprint.c
rename to ft_check/ft_isprint.c
similarity index 100%
rename from ft_isspace.c
rename to ft_check/ft_isspace.c
similarity index 100%
rename from ft_isupper.c
rename to ft_check/ft_isupper.c
similarity index 100%
rename from ft_atoi.c
rename to ft_conv/ft_atoi.c
diff --git a/ft_conv/ft_conv.h b/ft_conv/ft_conv.h
new file mode 100644 (file)
index 0000000..bf0dc27
--- /dev/null
@@ -0,0 +1,29 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_conv.h                                          :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2023/12/09 11:53:15 by ljiriste          #+#    #+#             */
+/*   Updated: 2023/12/09 11:54:31 by ljiriste         ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef FT_CONV_H
+# define FT_CONV_H
+
+# include <stdint.h>
+
+int                    ft_toupper(int c);
+int                    ft_tolower(int c);
+
+int                    ft_atoi(const char *nptr);
+long           ft_atol(const char *nptr);
+long long      ft_atoll(const char *nptr);
+char           *ft_itoa(int n);
+char           *ft_itoa_base(intmax_t n, const char *base);
+char           *ft_uitoa_base(uintmax_t n, const char *base);
+char           *ft_ctoa(char c);
+
+#endif
similarity index 100%
rename from ft_ctoa.c
rename to ft_conv/ft_ctoa.c
similarity index 100%
rename from ft_itoa.c
rename to ft_conv/ft_itoa.c
similarity index 100%
rename from ft_itoa_base.c
rename to ft_conv/ft_itoa_base.c
similarity index 100%
rename from ft_tolower.c
rename to ft_conv/ft_tolower.c
similarity index 100%
rename from ft_toupper.c
rename to ft_conv/ft_toupper.c
similarity index 100%
rename from ft_uitoa_base.c
rename to ft_conv/ft_uitoa_base.c
diff --git a/ft_gen/ft_gen.h b/ft_gen/ft_gen.h
new file mode 100644 (file)
index 0000000..8e22787
--- /dev/null
@@ -0,0 +1,18 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_gen.h                                           :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2023/12/09 12:21:15 by ljiriste          #+#    #+#             */
+/*   Updated: 2023/12/09 11:22:31 by ljiriste         ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef FT_GEN_H
+# define FT_GEN_H
+
+void   ft_swap(void **a, void **b);
+
+#endif
similarity index 100%
rename from ft_swap.c
rename to ft_gen/ft_swap.c
diff --git a/ft_io/ft_io.h b/ft_io/ft_io.h
new file mode 100644 (file)
index 0000000..1f69b32
--- /dev/null
@@ -0,0 +1,23 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_io.h                                            :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2023/12/09 11:38:28 by ljiriste          #+#    #+#             */
+/*   Updated: 2023/12/09 11:40:06 by ljiriste         ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef FT_IO_H
+# define FT_IO_H
+
+void   ft_putchar_fd(char c, int fd);
+void   ft_putstr_fd(char *s, int fd);
+void   ft_putendl_fd(char *s, int fd);
+void   ft_putnbr_fd(int n, int fd);
+int            ft_printf(const char *format, ...);
+char   *get_next_line(int fd);
+
+#endif
similarity index 100%
rename from ft_putchar_fd.c
rename to ft_io/ft_putchar_fd.c
similarity index 100%
rename from ft_putendl_fd.c
rename to ft_io/ft_putendl_fd.c
similarity index 100%
rename from ft_putnbr_fd.c
rename to ft_io/ft_putnbr_fd.c
similarity index 100%
rename from ft_putstr_fd.c
rename to ft_io/ft_putstr_fd.c
similarity index 100%
rename from get_next_line.c
rename to ft_io/get_next_line.c
similarity index 97%
rename from get_next_line.h
rename to ft_io/get_next_line.h
index 0b0f615a6de4ed6d5edfe624b6e8fd8ff2d5e6e8..5a1063cfd78752ff5b4dc30cdf491b2f4936843c 100644 (file)
@@ -25,6 +25,4 @@ typedef struct s_file_thread
        char    *buffer;
 }                      t_ft;
 
-char   *get_next_line(int fd);
-
 #endif
diff --git a/ft_lst/ft_lst.h b/ft_lst/ft_lst.h
new file mode 100644 (file)
index 0000000..ad1294c
--- /dev/null
@@ -0,0 +1,43 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_lst.h                                           :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2023/12/09 11:42:15 by ljiriste          #+#    #+#             */
+/*   Updated: 2023/11/03 11:43:31 by ljiriste         ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef FT_LST_H
+# define FT_LST_H
+
+typedef struct s_list
+{
+       struct s_list   *next;
+       void                    *content;
+}                                      t_list;
+
+t_list *ft_lstnew(void *content);
+void   ft_lstadd_front(t_list **lst, t_list *new);
+int            ft_lstsize(t_list *lst);
+t_list *ft_lstlast(t_list *lst);
+void   ft_lstadd_back(t_list **lst, t_list *new);
+void   ft_lstdelone(t_list *lst, void (*del)(void *));
+void   ft_lstclear(t_list **lst, void (*del)(void *));
+void   ft_lstiter(t_list *lst, void (*f)(void *));
+t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *));
+t_list *ft_lst_at(t_list *lst, unsigned int i);
+t_list *ft_lst_find(t_list *lst, void *content_red, int (*cmp)());
+void   ft_lst_foreach_if(t_list *lst, void (*f)(void *),
+                       void *content_ref, int (*cmp)());
+void   ft_lst_merge(t_list **lst1, t_list *lst2);
+void   ft_lst_remove_if(t_list **lst, void *content_ref,
+                       int (*cmp)(), void (*free_fct)(void *));
+void   ft_lst_reverse(t_list **lst);
+void   ft_lst_sort(t_list **lst, int (*cmp)());
+void   ft_lst_sorted_insert(t_list **lst, t_list *new, int (*cmp)());
+void   ft_lst_sorted_merge(t_list **lst1, t_list *lst2, int (*cmp)());
+
+#endif
similarity index 100%
rename from ft_abs.c
rename to ft_math/ft_abs.c
diff --git a/ft_math/ft_math.h b/ft_math/ft_math.h
new file mode 100644 (file)
index 0000000..a3e29e2
--- /dev/null
@@ -0,0 +1,18 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_math.h                                          :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2023/12/09 12:19:15 by ljiriste          #+#    #+#             */
+/*   Updated: 2023/12/09 12:20:31 by ljiriste         ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef FT_MATH_H
+# define FT_MATH_H
+
+int            ft_abs(int n);
+
+#endif
similarity index 100%
rename from ft_bzero.c
rename to ft_mem/ft_bzero.c
similarity index 100%
rename from ft_calloc.c
rename to ft_mem/ft_calloc.c
diff --git a/ft_mem/ft_mem.h b/ft_mem/ft_mem.h
new file mode 100644 (file)
index 0000000..fe2d8cf
--- /dev/null
@@ -0,0 +1,26 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_mem.h                                           :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2023/12/09 12:45:15 by ljiriste          #+#    #+#             */
+/*   Updated: 2023/12/09 12:46:31 by ljiriste         ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef FT_MEM_H
+# define FT_MEM_H
+
+# include <stddef.h>
+
+void   *ft_memset(void *s, int c, size_t n);
+void   *ft_memcpy(void *dest, const void *src, size_t n);
+void   *ft_memmove(void *dest, const void *src, size_t n);
+void   *ft_memchr(const void *s, int c, size_t n);
+void   *ft_calloc(size_t nmemb, size_t size);
+void   ft_bzero(void *s, size_t n);
+int            ft_memcmp(const void *s1, const void *s2, size_t n);
+
+#endif
similarity index 100%
rename from ft_memchr.c
rename to ft_mem/ft_memchr.c
similarity index 100%
rename from ft_memcmp.c
rename to ft_mem/ft_memcmp.c
similarity index 100%
rename from ft_memcpy.c
rename to ft_mem/ft_memcpy.c
similarity index 100%
rename from ft_memmove.c
rename to ft_mem/ft_memmove.c
similarity index 100%
rename from ft_memset.c
rename to ft_mem/ft_memset.c
similarity index 100%
rename from ft_split.c
rename to ft_str/ft_split.c
diff --git a/ft_str/ft_str.h b/ft_str/ft_str.h
new file mode 100644 (file)
index 0000000..6ea0807
--- /dev/null
@@ -0,0 +1,35 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_str.h                                           :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2023/12/09 11:50:15 by ljiriste          #+#    #+#             */
+/*   Updated: 2023/12/09 11:51:31 by ljiriste         ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef FT_STR_H
+# define FT_STR_H
+
+# include <stddef.h>
+
+size_t ft_strlen(const char *s);
+size_t ft_strlcpy(char *dst, const char *src, size_t size);
+size_t ft_strlcat(char *dst, const char *src, size_t size);
+char   *ft_strncat_alloc(char **dest, const char *src, size_t n);
+int            ft_strncmp(const char *s1, const char *s2, size_t n);
+char   *ft_strchr(const char *s, int c);
+char   *ft_strrchr(const char *s, int c);
+char   *ft_strnstr(const char *big, const char *little, size_t len);
+char   *ft_strdup(const char *s);
+char   *ft_strndup(const char *s, size_t n);
+char   *ft_substr(const char *s, unsigned int start, size_t len);
+char   *ft_strjoin(const char *s1, const char *s2);
+char   *ft_strtrim(const char *s1, const char *set);
+char   **ft_split(const char *s, char c);
+char   *ft_strmapi(const char *s, char (*f)(unsigned int, char));
+void   ft_striteri(char *s, void (*f)(unsigned int, char *));
+
+#endif
similarity index 100%
rename from ft_strchr.c
rename to ft_str/ft_strchr.c
similarity index 100%
rename from ft_strdup.c
rename to ft_str/ft_strdup.c
similarity index 100%
rename from ft_striteri.c
rename to ft_str/ft_striteri.c
similarity index 100%
rename from ft_strjoin.c
rename to ft_str/ft_strjoin.c
similarity index 100%
rename from ft_strlcat.c
rename to ft_str/ft_strlcat.c
similarity index 100%
rename from ft_strlcpy.c
rename to ft_str/ft_strlcpy.c
similarity index 100%
rename from ft_strlen.c
rename to ft_str/ft_strlen.c
similarity index 100%
rename from ft_strmapi.c
rename to ft_str/ft_strmapi.c
similarity index 100%
rename from ft_strncat_alloc.c
rename to ft_str/ft_strncat_alloc.c
similarity index 100%
rename from ft_strncmp.c
rename to ft_str/ft_strncmp.c
similarity index 100%
rename from ft_strndup.c
rename to ft_str/ft_strndup.c
similarity index 100%
rename from ft_strnstr.c
rename to ft_str/ft_strnstr.c
similarity index 100%
rename from ft_strrchr.c
rename to ft_str/ft_strrchr.c
similarity index 100%
rename from ft_strtrim.c
rename to ft_str/ft_strtrim.c
similarity index 100%
rename from ft_substr.c
rename to ft_str/ft_substr.c
diff --git a/libft.h b/libft.h
index bc40688908907af2233c208e5d3b5d05636eee07..3e18641db9a1de6970a16327fad648e69b7042eb 100644 (file)
--- a/libft.h
+++ b/libft.h
 /*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2023/08/15 12:58:15 by ljiriste          #+#    #+#             */
-/*   Updated: 2023/11/03 16:57:31 by ljiriste         ###   ########.fr       */
+/*   Updated: 2023/12/09 12:23:31 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #ifndef LIBFT_H
 # define LIBFT_H
 
-# include <sys/types.h>
-# include <stdint.h>
-
-int            ft_isalnum(int c);
-int            ft_isalpha(int c);
-int            ft_isdigit(int c);
-int            ft_islower(int c);
-int            ft_isprint(int c);
-int            ft_isspace(int c);
-int            ft_isupper(int c);
-int            ft_isascii(int c);
-
-int            ft_abs(int n);
-
-void   *ft_memset(void *s, int c, size_t n);
-void   *ft_memcpy(void *dest, const void *src, size_t n);
-void   *ft_memmove(void *dest, const void *src, size_t n);
-void   *ft_memchr(const void *s, int c, size_t n);
-void   *ft_calloc(size_t nmemb, size_t size);
-void   ft_bzero(void *s, size_t n);
-int            ft_memcmp(const void *s1, const void *s2, size_t n);
-
-size_t ft_strlen(const char *s);
-size_t ft_strlcpy(char *dst, const char *src, size_t size);
-size_t ft_strlcat(char *dst, const char *src, size_t size);
-char   *ft_strncat_alloc(char **dest, const char *src, size_t n);
-int            ft_strncmp(const char *s1, const char *s2, size_t n);
-char   *ft_strchr(const char *s, int c);
-char   *ft_strrchr(const char *s, int c);
-char   *ft_strnstr(const char *big, const char *little, size_t len);
-char   *ft_strdup(const char *s);
-char   *ft_strndup(const char *s, size_t n);
-
-int            ft_toupper(int c);
-int            ft_tolower(int c);
-
-int            ft_atoi(const char *nptr);
-long   ft_atol(const char *nptr);
-long long      ft_atoll(const char *nptr);
-
-char   *ft_substr(const char *s, unsigned int start, size_t len);
-char   *ft_strjoin(const char *s1, const char *s2);
-char   *ft_strtrim(const char *s1, const char *set);
-char   **ft_split(const char *s, char c);
-
-char   *ft_itoa(int n);
-char   *ft_itoa_base(intmax_t n, const char *base);
-char   *ft_uitoa_base(uintmax_t n, const char *base);
-char   *ft_ctoa(char c);
-
-char   *ft_strmapi(const char *s, char (*f)(unsigned int, char));
-void   ft_striteri(char *s, void (*f)(unsigned int, char *));
-
-void   ft_putchar_fd(char c, int fd);
-void   ft_putstr_fd(char *s, int fd);
-void   ft_putendl_fd(char *s, int fd);
-void   ft_putnbr_fd(int n, int fd);
-int            ft_printf(const char *format, ...);
-
-void   ft_swap(void **a, void **b);
-
-char   *get_next_line(int fd);
-
-typedef struct s_list
-{
-       struct s_list   *next;
-       void                    *content;
-}                                      t_list;
-
-t_list *ft_lstnew(void *content);
-void   ft_lstadd_front(t_list **lst, t_list *new);
-int            ft_lstsize(t_list *lst);
-t_list *ft_lstlast(t_list *lst);
-void   ft_lstadd_back(t_list **lst, t_list *new);
-void   ft_lstdelone(t_list *lst, void (*del)(void *));
-void   ft_lstclear(t_list **lst, void (*del)(void *));
-void   ft_lstiter(t_list *lst, void (*f)(void *));
-t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *));
-t_list *ft_lst_at(t_list *lst, unsigned int i);
-t_list *ft_lst_find(t_list *lst, void *content_red, int (*cmp)());
-void   ft_lst_foreach_if(t_list *lst, void (*f)(void *),
-               void *content_ref, int (*cmp)());
-void   ft_lst_merge(t_list **lst1, t_list *lst2);
-void   ft_lst_remove_if(t_list **lst, void *content_ref,
-               int (*cmp)(), void (*free_fct)(void *));
-void   ft_lst_reverse(t_list **lst);
-void   ft_lst_sort(t_list **lst, int (*cmp)());
-void   ft_lst_sorted_insert(t_list **lst, t_list *new, int (*cmp)());
-void   ft_lst_sorted_merge(t_list **lst1, t_list *lst2, int (*cmp)());
+# include "ft_gen.h"
+# include "ft_math.h"
+# include "ft_check.h"
+# include "ft_conv.h"
+# include "ft_str.h"
+# include "ft_mem.h"
+# include "ft_io.h"
+# include "ft_lst.h"
 
 #endif