Make Libft C++ aware and compilable
authorLukas Jiriste <ljiriste@student.42prague.com>
Wed, 26 Mar 2025 19:55:47 +0000 (20:55 +0100)
committerLukas Jiriste <ljiriste@student.42prague.com>
Wed, 26 Mar 2025 20:08:24 +0000 (21:08 +0100)
Though compilation is only possible with the -fpermissive flag.
It is not a great idea to use everything (or even most things) in C++,
but it is better to be consistent and it also makes it easier to migrate
a project using Libft from C to C++.

24 files changed:
ft_io/ft_printf/ft_printf.h
ft_lst/ft_lst_find.c
ft_lst/ft_lst_foreach_if.c
ft_lst/ft_lst_remove_if.c
ft_lst/ft_lst_sort.c
ft_lst/ft_lst_sorted_insert.c
ft_lst/ft_lst_sorted_merge.c
ft_lst/ft_lstadd_back.c
ft_lst/ft_lstadd_front.c
ft_parse/parsing_table_constructor/lookahead.c
ft_parse/parsing_table_constructor/pt_constructor.h
inc/ft_arr.h
inc/ft_check.h
inc/ft_conv.h
inc/ft_gen.h
inc/ft_io.h
inc/ft_lst.h
inc/ft_math.h
inc/ft_mem.h
inc/ft_parse.h
inc/ft_stat.h
inc/ft_str.h
inc/ft_struct.h
inc/libft.h

index cf636968d49522983bd0b01aaf5a87f77e5a9170..1af785cdb9d49a5421b6a9274b8cd9e99e70adfd 100644 (file)
@@ -6,13 +6,17 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2023/09/05 12:00:16 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/03/05 09:15:29 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:44:18 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #ifndef FT_PRINTF_H
 # define FT_PRINTF_H
 
+# ifdef __cplusplus
+extern "C" {
+# endif // __cplusplus
+
 # include <stdarg.h>
 
 typedef struct s_flags
@@ -50,4 +54,8 @@ t_to_print    formatting(char **str, t_conv conv);
 t_conv         parse_format(const char **format, va_list *args);
 void           create_padding(t_to_print *tp, t_conv conv);
 
+# ifdef __cplusplus
+}
+# endif // __cplusplus
+
 #endif
index 86a8ca079413b617d694d11adade8a24f9efc6ea..704cea42f612c19e1dd2c27396a5b3f3abea2699 100644 (file)
@@ -6,14 +6,14 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2023/06/28 14:47:42 by ljiriste          #+#    #+#             */
-/*   Updated: 2023/12/09 15:22:53 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:47:04 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #include <stddef.h>
 #include "ft_lst.h"
 
-t_list *ft_lst_find(t_list *lst, void *content_ref, int (*cmp)())
+t_list *ft_lst_find(t_list *lst, void *content_ref, int (*cmp)(void *, void *))
 {
        while (lst)
        {
index d333fe2a45591013597b7a18e7aad7901be46b52..dd8a83d7312ca740373f2b72c1e2cb38247246bc 100644 (file)
@@ -6,14 +6,14 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2023/06/28 14:42:33 by ljiriste          #+#    #+#             */
-/*   Updated: 2023/12/09 15:22:53 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:45:50 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #include "ft_lst.h"
 
 void   ft_lst_foreach_if(t_list *lst, void (*f)(void *),
-                       void *content_ref, int (*cmp)())
+                       void *content_ref, int (*cmp)(void *, void *))
 {
        while (lst)
        {
index 64bd2bda87ff1989be76d2a377b6bdacb2ef197b..8b5ae6e739be03bd579e93640108d0ca40707947 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2023/06/28 14:49:53 by ljiriste          #+#    #+#             */
-/*   Updated: 2023/12/09 15:22:53 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:50:14 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -23,7 +23,7 @@ static void   remove_next_el(t_list *prev, t_list **cur, void (*free_fct)(void *))
 }
 
 void   ft_lst_remove_if(t_list **lst, void *content_ref,
-                       int (*cmp)(), void (*free_fct)(void *))
+                       int (*cmp)(void *, void *), void (*free_fct)(void *))
 {
        t_list  *prev;
 
index 40f3499af89b646bfed7a387e63cca6d651dfb14..f00610fdab3a2ac8d21231552c1c6d91e618f038 100644 (file)
@@ -6,14 +6,14 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2023/06/28 15:13:29 by ljiriste          #+#    #+#             */
-/*   Updated: 2023/12/09 15:55:45 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:51:49 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #include "ft_lst.h"
 #include "libft.h"
 
-static void    ft_max_to_end(t_list *lst, int (*cmp)(), int size)
+static void    ft_max_to_end(t_list *lst, int (*cmp)(void *, void *), int size)
 {
        int     i;
 
@@ -28,7 +28,7 @@ static void   ft_max_to_end(t_list *lst, int (*cmp)(), int size)
 }
 
 // Bubble sort
-void   ft_lst_sort(t_list **lst, int (*cmp)())
+void   ft_lst_sort(t_list **lst, int (*cmp)(void *, void *))
 {
        int     size;
        int     i;
index 5705a3f4bc1f8a54b2b3427b8492e16e4b404a31..02c34e1bff04bc11b91384e570c05a0d613e30ac 100644 (file)
@@ -6,46 +6,46 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2023/06/28 15:53:26 by ljiriste          #+#    #+#             */
-/*   Updated: 2023/12/09 15:22:53 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:52:23 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #include <stdlib.h>
 #include "ft_lst.h"
 
-static void    insert_after(t_list *prev, t_list *new)
+static void    insert_after(t_list *prev, t_list *new_el)
 {
-       if (!new)
+       if (!new_el)
                return ;
-       new->next = prev->next;
-       prev->next = new;
+       new_el->next = prev->next;
+       prev->next = new_el;
        return ;
 }
 
-void   ft_lst_sorted_insert(t_list **lst, t_list *new, int (*cmp)())
+void   ft_lst_sorted_insert(t_list **lst, t_list *new_el, int (*cmp)(void *, void *))
 {
        t_list  *prev;
        t_list  *cur;
 
-       if (!lst || !new)
+       if (!lst || !new_el)
                return ;
        if (!*lst)
        {
-               *lst = new;
+               *lst = new_el;
                return ;
        }
        prev = NULL;
        cur = *lst;
        while (cur)
        {
-               if (cmp(new->content, cur->content) <= 0)
+               if (cmp(new_el->content, cur->content) <= 0)
                        break ;
                prev = cur;
                cur = cur->next;
        }
        if (prev)
-               insert_after(prev, new);
+               insert_after(prev, new_el);
        else
-               ft_lstadd_front(lst, new);
+               ft_lstadd_front(lst, new_el);
        return ;
 }
index f80caa7085c0b849f15d01e10737427b0d8e1da1..29bac1550b0476b191201cc06241ac29adbada7d 100644 (file)
@@ -6,14 +6,14 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2023/06/28 17:13:15 by ljiriste          #+#    #+#             */
-/*   Updated: 2023/12/09 15:55:15 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:46:36 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #include "ft_lst.h"
 #include "libft.h"
 
-void   ft_lst_sorted_merge(t_list **lst1, t_list *lst2, int (*cmp)())
+void   ft_lst_sorted_merge(t_list **lst1, t_list *lst2, int (*cmp)(void *, void *))
 {
        t_list  *main;
 
index f1272240a5e796ac488d6db7c762fb7717eef353..d0e8a961930b38b732214c10aeb3a98c836382f2 100644 (file)
@@ -6,22 +6,22 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2023/08/16 13:33:28 by ljiriste          #+#    #+#             */
-/*   Updated: 2023/12/09 15:22:53 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:51:05 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #include <stddef.h>
 #include "ft_lst.h"
 
-void   ft_lstadd_back(t_list **lst, t_list *new)
+void   ft_lstadd_back(t_list **lst, t_list *new_el)
 {
-       if (!new)
+       if (!new_el)
                return ;
        if (*lst == NULL)
        {
-               *lst = new;
+               *lst = new_el;
                return ;
        }
-       ft_lstlast(*lst)->next = new;
+       ft_lstlast(*lst)->next = new_el;
        return ;
 }
index 55ca6766bb361099ea88d1c435cda214c1c05182..2cd84842d1fd4547e3290ff6a5b41009d8e957bf 100644 (file)
@@ -6,17 +6,17 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2023/08/16 13:26:20 by ljiriste          #+#    #+#             */
-/*   Updated: 2023/12/09 15:22:53 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:50:53 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #include "ft_lst.h"
 
-void   ft_lstadd_front(t_list **lst, t_list *new)
+void   ft_lstadd_front(t_list **lst, t_list *new_el)
 {
-       if (!new)
+       if (!new_el)
                return ;
-       new->next = *lst;
-       *lst = new;
+       new_el->next = *lst;
+       *lst = new_el;
        return ;
 }
index 4770014667420fd85f4663ea7d8adad6de296308..73cad9b532dff4f7cea1b2b0399d13b9f44dc921 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/11/26 16:48:32 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/11/28 11:13:14 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:54:48 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -58,27 +58,27 @@ static void remove_nonterminals(t_vec *lookahead, const t_vec *tokens)
        return ;
 }
 
-t_ft_stat      add_lookahead(t_lr1_item *new, t_lr1_item *item,
+t_ft_stat      add_lookahead(t_lr1_item *new_item, t_lr1_item *item,
                                const t_vec *rules, const t_vec *tokens)
 {
        t_ft_stat       res;
 
-       res = ft_vec_init(&new->lookahead, sizeof(t_token));
+       res = ft_vec_init(&new_item->lookahead, sizeof(t_token));
        if (res != success)
                return (res);
        ++item->core.position;
-       res = expand_lookahead(&new->lookahead, &item->core, rules, tokens);
-       remove_nonterminals(&new->lookahead, tokens);
+       res = expand_lookahead(&new_item->lookahead, &item->core, rules, tokens);
+       remove_nonterminals(&new_item->lookahead, tokens);
        --item->core.position;
        if (res != success)
        {
-               ft_vec_free(&new->lookahead, ft_free_token);
+               ft_vec_free(&new_item->lookahead, ft_free_token);
                return (res);
        }
-       if (ft_vec_contains(&new->lookahead, &g_empty_token, void_cmp_token_type))
+       if (ft_vec_contains(&new_item->lookahead, &g_empty_token, void_cmp_token_type))
        {
-               remove_token(&new->lookahead, &g_empty_token);
-               res = add_to_lookahead(&item->lookahead, &new->lookahead);
+               remove_token(&new_item->lookahead, &g_empty_token);
+               res = add_to_lookahead(&item->lookahead, &new_item->lookahead);
        }
        return (res);
 }
index 9f99a34a3e7703db4f7065e74565c3cfb35eb9e7..f861157299178a01e34f808fea8df557383dc20a 100644 (file)
@@ -6,13 +6,17 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/11/26 16:57:15 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/11/28 12:07:50 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:54:02 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #ifndef PT_CONSTRUCTOR_H
 # define PT_CONSTRUCTOR_H
 
+# ifdef __cplusplus
+extern "C" {
+# endif // __cplusplus
+
 # include "libft.h"
 
 typedef struct s_marked_grammar_rule
@@ -70,7 +74,7 @@ int                           is_terminal_token(const t_token *token, const t_vec *tokens);
 size_t                 get_token_position(const t_token *token, const t_vec *tokens);
 size_t                 get_rule_index(const t_grammar_rule *rule, const t_vec *rules);
 
-t_ft_stat              add_lookahead(t_lr1_item *new, t_lr1_item *item,
+t_ft_stat              add_lookahead(t_lr1_item *new_item, t_lr1_item *item,
                                        const t_vec *rules, const t_vec *tokens);
 t_ft_stat              expand_lookahead(
                                        t_vec *lookahead, const t_marked_grammar_rule *rule,
@@ -95,4 +99,8 @@ t_ft_stat             convert_to_table(t_parsing_table *table, const t_vec *states);
 
 void                   remove_zeroth_rule(t_vec *rules);
 
+# ifdef __cplusplus
+}
+# endif // __cplusplus
+
 #endif // PT_CONSTRUCTOR_H
index ce46e151e282b0bf11e821cb7d07e524bb4086a0..fc88514f64dbec7dad0d3a2541a79b9db56cabad 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2023/12/09 13:58:15 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/12/17 20:34:11 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:34:00 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #  define V_DEFAULT_CAPACITY 8
 # endif
 
+# ifdef __cplusplus
+extern "C" {
+# endif // __cplusplus
+
 typedef t_ft_stat      t_arr_stat;
 
 // It should be possible to remove el_size with the use of macros?
@@ -113,4 +117,8 @@ void                *ft_mat_access(t_mat *mat, size_t row, size_t col);
 t_arr_stat     ft_mat_zeros(t_mat *matrix, size_t rows, size_t cols);
 t_arr_stat     ft_mat_fill(t_mat *mat, void *filler);
 
+# ifdef __cplusplus
+}
+# endif // __cplusplus
+
 #endif
index e640d931216cf4f71bcedb47680c505ed3f7a174..2830f0d08ac4b0ecf6903fc82c80a6d1914d40a3 100644 (file)
@@ -6,13 +6,17 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2023/12/09 11:55:15 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/04/10 12:54:40 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:34:58 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #ifndef FT_CHECK_H
 # define FT_CHECK_H
 
+# ifdef __cplusplus
+extern "C" {
+# endif // __cplusplus
+
 int            ft_isalnum(int c);
 int            ft_isalpha(int c);
 int            ft_isdigit(int c);
@@ -23,4 +27,8 @@ int           ft_isupper(int c);
 int            ft_isascii(int c);
 int            ft_isint(const char *str);
 
+# ifdef __cplusplus
+}
+# endif // __cplusplus
+
 #endif
index 421b1f0baf856be5262c1c0ae902ae2166f7f913..69828b11cf097b5dbdd59d4f2215c9fc0c85257d 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2023/12/09 11:53:15 by ljiriste          #+#    #+#             */
-/*   Updated: 2023/12/09 15:13:41 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:35:22 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 
 # include <stdint.h>
 
+# ifdef __cplusplus
+extern "C" {
+# endif // __cplusplus
+
 int                    ft_toupper(int c);
 int                    ft_tolower(int c);
 
@@ -26,4 +30,8 @@ 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);
 
+# ifdef __cplusplus
+}
+# endif // __cplusplus
+
 #endif
index 078107819cc496b418be9292d64c7f873e07fcf8..7ce99b2c260a39be5dc380269ce5be8b69535f25 100644 (file)
@@ -6,14 +6,22 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2023/12/09 12:21:15 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/07/21 21:36:48 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:35:37 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #ifndef FT_GEN_H
 # define FT_GEN_H
 
+# ifdef __cplusplus
+extern "C" {
+# endif // __cplusplus
+
 void   ft_swap_int(int *a, int *b);
 void   ft_swap(void **a, void **b);
 
+# ifdef __cplusplus
+}
+# endif // __cplusplus
+
 #endif
index 754217929a034a243b7b1a9028c5808d71efce4b..8084848e7a273e41f0939901ebca6e7bb8ef1dd3 100644 (file)
@@ -6,13 +6,17 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2023/12/09 11:38:28 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/03/09 00:00:58 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:35:54 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #ifndef FT_IO_H
 # define FT_IO_H
 
+# ifdef __cplusplus
+extern "C" {
+# endif // __cplusplus
+
 # include <stdarg.h>
 
 void   ft_putchar_fd(char c, int fd);
@@ -24,4 +28,8 @@ int           ft_dprintf(int fd, const char *format, ...);
 int            ft_vdprintf(int fd, const char *format, va_list *args);
 char   *get_next_line(int fd);
 
+# ifdef __cplusplus
+}
+# endif // __cplusplus
+
 #endif
index 714352689da8b61688c966b28ef67fbbaf6c21fd..34117aadcbb58561a0d652e665395e6cfc625678 100644 (file)
@@ -6,13 +6,17 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2023/12/09 11:42:15 by ljiriste          #+#    #+#             */
-/*   Updated: 2023/12/09 15:13:44 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:37:34 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #ifndef FT_LST_H
 # define FT_LST_H
 
+# ifdef __cplusplus
+extern "C" {
+# endif // __cplusplus
+
 typedef struct s_list
 {
        struct s_list   *next;
@@ -20,10 +24,10 @@ typedef struct s_list
 }                                      t_list;
 
 t_list *ft_lstnew(void *content);
-void   ft_lstadd_front(t_list **lst, t_list *new);
+void   ft_lstadd_front(t_list **lst, t_list *new_el);
 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_lstadd_back(t_list **lst, t_list *new_el);
 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 *));
@@ -37,7 +41,11 @@ 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_insert(t_list **lst, t_list *new_el, int (*cmp)());
 void   ft_lst_sorted_merge(t_list **lst1, t_list *lst2, int (*cmp)());
 
+# ifdef __cplusplus
+}
+# endif // __cplusplus
+
 #endif
index 6c272f48aa50e938ac8da3c2256e210567d32ff2..a996ea2e376e02f36a7e5b6ded47fe3078b36097 100644 (file)
@@ -6,13 +6,17 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2023/12/09 12:19:15 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/02/23 09:01:20 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:37:45 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #ifndef FT_MATH_H
 # define FT_MATH_H
 
+# ifdef __cplusplus
+extern "C" {
+# endif // __cplusplus
+
 # include <stddef.h>
 
 int            ft_abs(int n);
@@ -24,4 +28,8 @@ size_t        ft_maxs(size_t a, size_t b);
 int            ft_min(int a, int b);
 size_t ft_mins(size_t a, size_t b);
 
+# ifdef __cplusplus
+}
+# endif // __cplusplus
+
 #endif
index 073d9af037e5f55809ad4451bbf3c058cab97c3a..44e70a1dd09462042c0a1dd4561b8df1d00ce31a 100644 (file)
@@ -6,13 +6,17 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2023/12/09 12:45:15 by ljiriste          #+#    #+#             */
-/*   Updated: 2023/12/09 15:13:44 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:37:59 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #ifndef FT_MEM_H
 # define FT_MEM_H
 
+# ifdef __cplusplus
+extern "C" {
+# endif // __cplusplus
+
 # include <stddef.h>
 
 void   *ft_memset(void *s, int c, size_t n);
@@ -23,4 +27,8 @@ 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);
 
+# ifdef __cplusplus
+}
+# endif // __cplusplus
+
 #endif
index bb1706cf8802977af08e13922b4b59de7cda4403..12648f403b4ddaf3df1718bb37bb9c63d809d949 100644 (file)
@@ -6,13 +6,17 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/05/27 21:21:54 by ljiriste          #+#    #+#             */
-/*   Updated: 2025/01/13 19:47:16 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 21:07:08 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #ifndef FT_PARSE_H
 # define FT_PARSE_H
 
+# ifdef __cplusplus
+extern "C" {
+# endif // __cplusplus
+
 # include "ft_arr.h"
 # include <sys/types.h>
 
@@ -118,4 +122,8 @@ const t_parse_tree_node     *ft_cget_node_child(
 void                                   ft_parse_tree_free(void *node);
 void                                   ft_parsing_table_free(t_parsing_table *table);
 
+# ifdef __cplusplus
+}
+# endif // __cplusplus
+
 #endif // FT_PARSE_H
index bf78c890c784879cde2f80f77ddea6370768ac00..cb29b9a20a56ac7fc17718483a26a924d6d2d15b 100644 (file)
@@ -6,13 +6,17 @@
 /*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/06/20 12:40:28 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/07/04 10:14:10 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:38:27 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #ifndef FT_STAT_H
 # define FT_STAT_H
 
+# ifdef __cplusplus
+extern "C" {
+# endif // __cplusplus
+
 typedef enum e_ft_stat
 {
        success,
@@ -24,4 +28,8 @@ typedef enum e_ft_stat
        non_specific_failure,
 }      t_ft_stat;
 
+# ifdef __cplusplus
+}
+# endif // __cplusplus
+
 #endif //FT_STAT_H
index 56d743b06701a3a791881812e9a76897d16d26fd..8de46d50396f6ee9aaafb58e43e18a6e060c7cfc 100644 (file)
@@ -6,13 +6,17 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2023/12/09 11:50:15 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/08/02 14:02:44 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:38:41 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #ifndef FT_STR_H
 # define FT_STR_H
 
+# ifdef __cplusplus
+extern "C" {
+# endif // __cplusplus
+
 # include <stddef.h>
 
 size_t ft_strlen(const char *s);
@@ -36,4 +40,8 @@ void  ft_free_split(char **split);
 char   *ft_strmapi(const char *s, char (*f)(unsigned int, char));
 void   ft_striteri(char *s, void (*f)(unsigned int, char *));
 
+# ifdef __cplusplus
+}
+# endif // __cplusplus
+
 #endif
index bbcc14f4fe935ee934730dc493fc95ee0923e664..55ae3ed65e7ccb5f561eb268fcd2af3fb1e0934c 100644 (file)
@@ -6,13 +6,17 @@
 /*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/06/20 16:59:43 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/06/21 15:24:34 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:38:56 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #ifndef FT_STRUCT_H
 # define FT_STRUCT_H
 
+# ifdef __cplusplus
+extern "C" {
+# endif // __cplusplus
+
 # include "ft_arr.h"
 # include <sys/types.h>
 
@@ -28,4 +32,8 @@ void          *ft_stack_pop(t_stack *stack, void (*free_el)(void *));
 void           *ft_stack_pop_forget(t_stack *stack);
 void           ft_stack_free(t_stack *stack, void (*free_el)(void *));
 
+# ifdef __cplusplus
+}
+# endif // __cplusplus
+
 #endif //FT_STRUCT_H
index 283f70211b230b3f5d507bbcbbdf381e2aacc6e8..79b38174711fd0f9731685b66eaa05304a6cac46 100644 (file)
@@ -6,13 +6,17 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2023/08/15 12:58:15 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/06/20 17:21:06 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/03/26 20:39:11 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #ifndef LIBFT_H
 # define LIBFT_H
 
+# ifdef __cplusplus
+extern "C" {
+# endif // __cplusplus
+
 # include "ft_gen.h"
 # include "ft_math.h"
 # include "ft_check.h"
@@ -27,4 +31,8 @@
 
 # include "ft_stat.h"
 
+# ifdef __cplusplus
+}
+# endif // __cplusplus
+
 #endif