loop_del
This commit is contained in:
parent
73b4cc3060
commit
b0dececf1f
15 changed files with 47 additions and 20 deletions
|
|
@ -1 +0,0 @@
|
||||||
/Users/ariard/Projects/42sh
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/27 20:29:56 by jhalford #+# #+# */
|
/* Created: 2016/11/27 20:29:56 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/01/31 19:34:10 by ariard ### ########.fr */
|
/* Updated: 2017/01/31 22:38:56 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -106,5 +106,6 @@ void set_exitstatus(int status);
|
||||||
void ast_free(void *data, size_t content_size);
|
void ast_free(void *data, size_t content_size);
|
||||||
|
|
||||||
int loop_exec(t_list *list_ast);
|
int loop_exec(t_list *list_ast);
|
||||||
|
int loop_del(t_list *list_ast);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/01 12:15:50 by jhalford #+# #+# */
|
/* Created: 2016/12/01 12:15:50 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/01/31 21:55:48 by ariard ### ########.fr */
|
/* Updated: 2017/01/31 22:14:11 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/05 11:50:51 by jhalford #+# #+# */
|
/* Created: 2016/12/05 11:50:51 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/01/31 18:49:37 by ariard ### ########.fr */
|
/* Updated: 2017/01/31 22:35:31 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/30 17:33:53 by ariard #+# #+# */
|
/* Created: 2017/01/30 17:33:53 by ariard #+# #+# */
|
||||||
/* Updated: 2017/01/31 20:45:41 by ariard ### ########.fr */
|
/* Updated: 2017/01/31 22:52:11 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -23,7 +23,6 @@ int exec_while(t_btree **ast)
|
||||||
node = ((*ast)->left)->item;
|
node = ((*ast)->left)->item;
|
||||||
DG("test command data '%s'", node->data.str);
|
DG("test command data '%s'", node->data.str);
|
||||||
test_commands = shell_get_ast(node->data.str);
|
test_commands = shell_get_ast(node->data.str);
|
||||||
// ft_print_all_ast(*test_commands);
|
|
||||||
node = ((*ast)->right)->item;
|
node = ((*ast)->right)->item;
|
||||||
|
|
||||||
DG("consequent command data '%s'", node->data.str);
|
DG("consequent command data '%s'", node->data.str);
|
||||||
|
|
@ -32,15 +31,13 @@ int exec_while(t_btree **ast)
|
||||||
p = &data_singleton()->exec.process;
|
p = &data_singleton()->exec.process;
|
||||||
p->script |= SCRIPT_LOOP;
|
p->script |= SCRIPT_LOOP;
|
||||||
|
|
||||||
// ft_print_all_ast(consequent_commands);
|
|
||||||
|
|
||||||
test = 10;
|
test = 10;
|
||||||
while (test--)
|
while (test--)
|
||||||
loop_exec(*consequent_commands);
|
loop_exec(*consequent_commands);
|
||||||
// del tree (test_commands);
|
loop_del(*consequent_commands);
|
||||||
// del tree (test_commands);
|
p->script &= 0;
|
||||||
p->script &= 0;
|
|
||||||
|
|
||||||
btree_delone(ast, &ast_free);
|
btree_delone(ast, &ast_free);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
27
42sh/src/exec/loop_del.c
Normal file
27
42sh/src/exec/loop_del.c
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* loop_del.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2017/01/31 22:39:20 by ariard #+# #+# */
|
||||||
|
/* Updated: 2017/01/31 22:51:56 by ariard ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "exec.h"
|
||||||
|
|
||||||
|
int loop_del(t_list *list_ast)
|
||||||
|
{
|
||||||
|
t_list *temp;
|
||||||
|
|
||||||
|
while (list_ast)
|
||||||
|
{
|
||||||
|
btree_del((t_btree **)list_ast->content, &ast_free);
|
||||||
|
temp = list_ast;
|
||||||
|
list_ast = list_ast->next;
|
||||||
|
ft_lstdelone(&temp, NULL);
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/10 13:37:11 by jhalford #+# #+# */
|
/* Created: 2016/11/10 13:37:11 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/01/31 21:08:54 by ariard ### ########.fr */
|
/* Updated: 2017/01/31 22:52:22 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/26 00:48:48 by ariard #+# #+# */
|
/* Created: 2017/01/26 00:48:48 by ariard #+# #+# */
|
||||||
/* Updated: 2017/01/31 21:57:33 by ariard ### ########.fr */
|
/* Updated: 2017/01/31 22:14:26 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/31 20:49:09 by ariard #+# #+# */
|
/* Created: 2017/01/31 20:49:09 by ariard #+# #+# */
|
||||||
/* Updated: 2017/01/31 21:57:46 by ariard ### ########.fr */
|
/* Updated: 2017/01/31 22:14:28 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/26 00:55:33 by ariard #+# #+# */
|
/* Created: 2017/01/26 00:55:33 by ariard #+# #+# */
|
||||||
/* Updated: 2017/01/31 22:05:36 by ariard ### ########.fr */
|
/* Updated: 2017/01/31 22:14:23 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/30 19:23:49 by ariard #+# #+# */
|
/* Created: 2017/01/30 19:23:49 by ariard #+# #+# */
|
||||||
/* Updated: 2017/01/30 22:11:21 by ariard ### ########.fr */
|
/* Updated: 2017/01/31 22:52:06 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -20,8 +20,11 @@ void ft_print_all_ast(t_list *lst_ast)
|
||||||
tmp = lst_ast;
|
tmp = lst_ast;
|
||||||
while (tmp)
|
while (tmp)
|
||||||
{
|
{
|
||||||
ast = tmp->content;
|
if (tmp->content)
|
||||||
btree_print(STDBUG, *ast, &ft_putast);
|
{
|
||||||
|
ast = tmp->content;
|
||||||
|
btree_print(STDBUG, *ast, &ft_putast);
|
||||||
|
}
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/22 23:06:34 by ariard #+# #+# */
|
/* Created: 2017/01/22 23:06:34 by ariard #+# #+# */
|
||||||
/* Updated: 2017/01/31 21:55:11 by ariard ### ########.fr */
|
/* Updated: 2017/01/31 22:21:14 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
BIN
42sh/src/parser/.ft_parse.c.swn
Normal file
BIN
42sh/src/parser/.ft_parse.c.swn
Normal file
Binary file not shown.
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/30 17:14:58 by jhalford #+# #+# */
|
/* Created: 2016/11/30 17:14:58 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/01/31 18:38:01 by ariard ### ########.fr */
|
/* Updated: 2017/01/31 22:15:59 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue