This commit is contained in:
Antoine Riard 2017-03-22 19:35:02 +01:00
parent 0f299d4b7e
commit 16e23e8a63
7 changed files with 12 additions and 18 deletions

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/21 20:18:34 by ariard #+# #+# */
/* Updated: 2017/03/21 20:53:45 by ariard ### ########.fr */
/* Updated: 2017/03/22 19:25:38 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
@ -14,7 +14,6 @@
int pfree_func(t_process *p)
{
ft_putstr("hello");
btree_del(&p->data.function.content, &ast_free);
return (0);
}

View file

@ -6,13 +6,13 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/08 03:23:59 by wescande #+# #+# */
/* Updated: 2017/03/22 16:22:34 by gwojda ### ########.fr */
/* Updated: 2017/03/22 19:30:50 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
#define FUNCERR_0 SHELL_NAME ":maximum nested function level reached\n"
#define FUNCERR_0 SHELL_NAME ":maximum nested function level reached"
int plaunch_function(t_process *p)
{
@ -36,6 +36,6 @@ int plaunch_function(t_process *p)
builtin_setenv("setenv", (char *[]){"env", "FUNC_LVL",
ft_itoa(value), 0}, NULL);
ft_exec(&p->data.function.content);
DG();
builtin_setenv("setenv", (char *[]){"env", "FUNC_LVL", "0", 0}, NULL);
return (ft_atoi(ft_getenv(data_singleton()->env, "?")));
}

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/20 14:45:40 by gwojda #+# #+# */
/* Updated: 2017/03/22 17:44:44 by jhalford ### ########.fr */
/* Updated: 2017/03/22 19:00:39 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
@ -43,7 +43,6 @@ static int handle_instruction(t_list **token, t_btree **ast)
return (ret);
if (do_lexer_routine(token, stream) > 0)
continue ;
token_print(*token);
if ((ret = do_parser_routine(token, ast)) == 1
&& SH_NO_INTERACTIVE(data->opts))
return (ret);

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/24 23:43:07 by ariard #+# #+# */
/* Updated: 2017/03/22 16:52:57 by gwojda ### ########.fr */
/* Updated: 2017/03/22 19:21:58 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
@ -100,7 +100,7 @@ t_list *is_already_func(t_btree **new)
ret = (new_name && new_name[0] && old_name && old_name[0]
&& !ft_strcmp(new_name[0], old_name[0])) ? 0 : 1;
ft_tabdel(&old_name);
tmp = tmp->next;
tmp = (ret) ? tmp->next : tmp;
}
ft_tabdel(&new_name);
if (!ret)
@ -116,8 +116,10 @@ int add_one_func(t_btree **ast, t_list **lst)
(void)lst;
func_ast = btree_map(*ast, &node_copy);
if ((old_func = is_already_func(&func_ast)))
{
ft_lst_delif(&data_singleton()->lst_func,
old_func->content, &ft_addrcmp, &tree_func_free);
}
ft_lsteadd(&data_singleton()->lst_func, ft_lstnew(&func_ast, sizeof(*ast)));
return (0);
}

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/11 15:58:38 by ariard #+# #+# */
/* Updated: 2017/03/22 18:13:04 by ariard ### ########.fr */
/* Updated: 2017/03/22 19:00:06 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
@ -381,20 +381,15 @@ int aggregate_sym(t_list **stack, t_sym *new_sym, t_parstate *state)
return (1);
i = -1;
head = (*stack)->content;
DG("aggregate head %s && sym %s",
read_state(*head), read_state(*new_sym));
while (g_aggrematch[++i].top)
if (*new_sym == g_aggrematch[i].top
&& MATCH_STACK(*head, g_aggrematch[i].under))
{
DG("MATCH : %s", read_state(g_aggrematch[i].new_sym));
*new_sym = g_aggrematch[i].new_sym;
if (g_aggrematch[i].erase_sym)
{
pop_stack(stack, g_aggrematch[i].erase_sym);
head = (*stack)->content;
DG("stack after pop: %s", read_state(*head));
}
if (eval_sym(stack, *new_sym) && !(*state = ERROR))
return (1);

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/11 16:11:21 by ariard #+# #+# */
/* Updated: 2017/03/22 18:14:39 by ariard ### ########.fr */
/* Updated: 2017/03/22 19:00:15 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
@ -1272,7 +1272,6 @@ int eval_sym(t_list **stack, t_sym new_sym)
return (1);
head = (*stack)->content;
i = 0;
DG("eval head %s && sym %s", read_state(*head), read_state(new_sym));
while (g_stackmatch[i].top)
{
if (new_sym == g_stackmatch[i].top && *head == g_stackmatch[i].under)

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/09 17:58:34 by ariard #+# #+# */
/* Updated: 2017/03/22 18:15:08 by ariard ### ########.fr */
/* Updated: 2017/03/22 19:26:03 by ariard ### ########.fr */
/* */
/* ************************************************************************** */