From: Lukas Jiriste Date: Wed, 26 Mar 2025 19:55:47 +0000 (+0100) Subject: Make Libft C++ aware and compilable X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=85f202f2f76c0339d9e0b5b98b566e832a5b2e76;p=Libft.git Make Libft C++ aware and compilable 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++. --- diff --git a/ft_io/ft_printf/ft_printf.h b/ft_io/ft_printf/ft_printf.h index cf63696..1af785c 100644 --- a/ft_io/ft_printf/ft_printf.h +++ b/ft_io/ft_printf/ft_printf.h @@ -6,13 +6,17 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 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 diff --git a/ft_lst/ft_lst_find.c b/ft_lst/ft_lst_find.c index 86a8ca0..704cea4 100644 --- a/ft_lst/ft_lst_find.c +++ b/ft_lst/ft_lst_find.c @@ -6,14 +6,14 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 #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) { diff --git a/ft_lst/ft_lst_foreach_if.c b/ft_lst/ft_lst_foreach_if.c index d333fe2..dd8a83d 100644 --- a/ft_lst/ft_lst_foreach_if.c +++ b/ft_lst/ft_lst_foreach_if.c @@ -6,14 +6,14 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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) { diff --git a/ft_lst/ft_lst_remove_if.c b/ft_lst/ft_lst_remove_if.c index 64bd2bd..8b5ae6e 100644 --- a/ft_lst/ft_lst_remove_if.c +++ b/ft_lst/ft_lst_remove_if.c @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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; diff --git a/ft_lst/ft_lst_sort.c b/ft_lst/ft_lst_sort.c index 40f3499..f00610f 100644 --- a/ft_lst/ft_lst_sort.c +++ b/ft_lst/ft_lst_sort.c @@ -6,14 +6,14 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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; diff --git a/ft_lst/ft_lst_sorted_insert.c b/ft_lst/ft_lst_sorted_insert.c index 5705a3f..02c34e1 100644 --- a/ft_lst/ft_lst_sorted_insert.c +++ b/ft_lst/ft_lst_sorted_insert.c @@ -6,46 +6,46 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 #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 ; } diff --git a/ft_lst/ft_lst_sorted_merge.c b/ft_lst/ft_lst_sorted_merge.c index f80caa7..29bac15 100644 --- a/ft_lst/ft_lst_sorted_merge.c +++ b/ft_lst/ft_lst_sorted_merge.c @@ -6,14 +6,14 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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; diff --git a/ft_lst/ft_lstadd_back.c b/ft_lst/ft_lstadd_back.c index f127224..d0e8a96 100644 --- a/ft_lst/ft_lstadd_back.c +++ b/ft_lst/ft_lstadd_back.c @@ -6,22 +6,22 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 #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 ; } diff --git a/ft_lst/ft_lstadd_front.c b/ft_lst/ft_lstadd_front.c index 55ca676..2cd8484 100644 --- a/ft_lst/ft_lstadd_front.c +++ b/ft_lst/ft_lstadd_front.c @@ -6,17 +6,17 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 ; } diff --git a/ft_parse/parsing_table_constructor/lookahead.c b/ft_parse/parsing_table_constructor/lookahead.c index 4770014..73cad9b 100644 --- a/ft_parse/parsing_table_constructor/lookahead.c +++ b/ft_parse/parsing_table_constructor/lookahead.c @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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); } diff --git a/ft_parse/parsing_table_constructor/pt_constructor.h b/ft_parse/parsing_table_constructor/pt_constructor.h index 9f99a34..f861157 100644 --- a/ft_parse/parsing_table_constructor/pt_constructor.h +++ b/ft_parse/parsing_table_constructor/pt_constructor.h @@ -6,13 +6,17 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 diff --git a/inc/ft_arr.h b/inc/ft_arr.h index ce46e15..fc88514 100644 --- a/inc/ft_arr.h +++ b/inc/ft_arr.h @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 */ /* */ /* ************************************************************************** */ @@ -20,6 +20,10 @@ # 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 diff --git a/inc/ft_check.h b/inc/ft_check.h index e640d93..2830f0d 100644 --- a/inc/ft_check.h +++ b/inc/ft_check.h @@ -6,13 +6,17 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 diff --git a/inc/ft_conv.h b/inc/ft_conv.h index 421b1f0..69828b1 100644 --- a/inc/ft_conv.h +++ b/inc/ft_conv.h @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 */ /* */ /* ************************************************************************** */ @@ -15,6 +15,10 @@ # include +# 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 diff --git a/inc/ft_gen.h b/inc/ft_gen.h index 0781078..7ce99b2 100644 --- a/inc/ft_gen.h +++ b/inc/ft_gen.h @@ -6,14 +6,22 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 diff --git a/inc/ft_io.h b/inc/ft_io.h index 7542179..8084848 100644 --- a/inc/ft_io.h +++ b/inc/ft_io.h @@ -6,13 +6,17 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 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 diff --git a/inc/ft_lst.h b/inc/ft_lst.h index 7143526..34117aa 100644 --- a/inc/ft_lst.h +++ b/inc/ft_lst.h @@ -6,13 +6,17 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 diff --git a/inc/ft_math.h b/inc/ft_math.h index 6c272f4..a996ea2 100644 --- a/inc/ft_math.h +++ b/inc/ft_math.h @@ -6,13 +6,17 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 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 diff --git a/inc/ft_mem.h b/inc/ft_mem.h index 073d9af..44e70a1 100644 --- a/inc/ft_mem.h +++ b/inc/ft_mem.h @@ -6,13 +6,17 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 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 diff --git a/inc/ft_parse.h b/inc/ft_parse.h index bb1706c..12648f4 100644 --- a/inc/ft_parse.h +++ b/inc/ft_parse.h @@ -6,13 +6,17 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 @@ -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 diff --git a/inc/ft_stat.h b/inc/ft_stat.h index bf78c89..cb29b9a 100644 --- a/inc/ft_stat.h +++ b/inc/ft_stat.h @@ -6,13 +6,17 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 diff --git a/inc/ft_str.h b/inc/ft_str.h index 56d743b..8de46d5 100644 --- a/inc/ft_str.h +++ b/inc/ft_str.h @@ -6,13 +6,17 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 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 diff --git a/inc/ft_struct.h b/inc/ft_struct.h index bbcc14f..55ae3ed 100644 --- a/inc/ft_struct.h +++ b/inc/ft_struct.h @@ -6,13 +6,17 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 @@ -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 diff --git a/inc/libft.h b/inc/libft.h index 283f702..79b3817 100644 --- a/inc/libft.h +++ b/inc/libft.h @@ -6,13 +6,17 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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