still working on memory stuff

This commit is contained in:
Maieul BOYER 2024-05-08 19:35:13 +02:00
parent 8e90a858ad
commit 326c9318e4
No known key found for this signature in database
18 changed files with 206 additions and 77 deletions

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/29 11:35:51 by rparodi #+# #+# */
/* Updated: 2024/05/07 13:00:21 by maiboyer ### ########.fr */
/* Updated: 2024/05/08 19:07:54 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -14,6 +14,8 @@
#include "app/env.h"
#include "me/hashmap/hashmap_env.h"
#include "me/alloc/alloc_internal.h"
void ts_parser_delete(t_first_parser *self);
void ft_free(void *ptr)
@ -46,5 +48,6 @@ void ft_exit(t_utils *maiboyerlpb, t_u8 exit_status)
{
if (maiboyerlpb != NULL)
ft_free_utils(maiboyerlpb);
print_pages_info();
me_exit(exit_status);
}

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/28 14:40:38 by rparodi #+# #+# */
/* Updated: 2024/05/08 15:36:52 by maiboyer ### ########.fr */
/* Updated: 2024/05/08 19:22:47 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -14,10 +14,16 @@
#include "app/node.h"
#include "app/signal_handler.h"
#include "gmr/symbols.h"
#include "me/alloc/alloc.h"
#include "me/string/str_len.h"
#include "minishell.h"
#include "parser/api.h"
#undef free
#undef malloc
#undef realloc
#undef calloc
t_first_parser *ts_parser_new();
void ts_tree_delete(t_first_tree *);
t_parse_node ts_tree_root_node(t_first_tree *);

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/28 18:36:40 by maiboyer #+# #+# */
/* Updated: 2024/05/07 12:51:18 by maiboyer ### ########.fr */
/* Updated: 2024/05/08 18:35:15 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -15,20 +15,21 @@
#include "me/mem/mem_alloc_array.h"
#include "me/string/str_l_copy.h"
#include "parser/api.h"
#include <stdio.h>
t_node build_node(t_parse_node current, t_const_str input);
t_node build_node(t_parse_node current, t_const_str input);
t_parse_node ts_node_child(t_parse_node parent, t_usize idx);
t_symbol ts_node_symbol(t_parse_node self);
t_const_str ts_node_type(t_parse_node self);
t_u32 ts_node_start_byte(t_parse_node self);
t_u32 ts_node_end_byte(t_parse_node self);
t_u32 ts_node_child_count(t_parse_node self);
t_symbol ts_node_symbol(t_parse_node self);
t_const_str ts_node_type(t_parse_node self);
t_u32 ts_node_start_byte(t_parse_node self);
t_u32 ts_node_end_byte(t_parse_node self);
t_u32 ts_node_child_count(t_parse_node self);
t_node *build_childs(t_parse_node parent, t_const_str input, t_usize count)
{
t_node *ret;
t_usize idx;
t_parse_node child;
t_node *ret;
t_usize idx;
t_parse_node child;
ret = mem_alloc_array(sizeof(*ret), count);
if (ret == NULL)

View file

@ -6,16 +6,16 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/02 13:22:14 by maiboyer #+# #+# */
/* Updated: 2024/05/08 15:33:52 by maiboyer ### ########.fr */
/* Updated: 2024/05/08 18:20:46 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#include "app/signal_handler.h"
#include "me/printf/printf.h"
#include "me/types.h"
#include "readline/readline.h"
#include "me/printf/printf.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
void sigint_handle(int sig, siginfo_t *info, void *ucontext)
{
@ -56,7 +56,7 @@ void sigsegv_handle(int sig, siginfo_t *info, void *ucontext)
(void)(sig);
(void)(info);
(void)(ucontext);
me_eprintf("SEGFAULT!!!\n");
me_eprintf("Abort: SEGFAULT!!!\n");
print_trace();
exit(139);
}
@ -74,9 +74,9 @@ t_error install_signal(void)
data.sa_sigaction = sigquit_handle;
if (sigaction(SIGQUIT, &data, NULL))
return (ERROR);
data.sa_sigaction = sigsegv_handle;
if (sigaction(SIGSEGV, &data, NULL))
return (ERROR);
return (NO_ERROR);
}