bug found
found bug in parser that made link adding impossible
This commit is contained in:
parent
c35deace58
commit
fe1c85371f
@ -6,7 +6,7 @@
|
||||
/* By: mndhlovu <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/03/25 06:31:05 by mndhlovu #+# #+# */
|
||||
/* Updated: 2019/04/22 15:37:45 by mndhlovu ### ########.fr */
|
||||
/* Updated: 2019/04/24 09:44:41 by tmaze ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -58,13 +58,16 @@ static int lem_in(t_syntax *synt, t_holder *holder,
|
||||
{
|
||||
if (!(lm_parser(synt, lmdata, holder)))
|
||||
return (0);
|
||||
ft_printf("start verify\n");
|
||||
if (!(lm_verify_cmd(synt, holder, lmdata)))
|
||||
return (0);
|
||||
ft_printf("Number of nodes %d\n", lmdata->nb_nodes);
|
||||
if (!lst_indinit(lmdata))
|
||||
return (0);
|
||||
ft_printf("plap\n");
|
||||
if (!(lm_adj_parser(lmdata, holder)))
|
||||
return (0);
|
||||
ft_printf("plop\n");
|
||||
lm_clear_unv(holder);
|
||||
get_nb_paths_max(lmdata, get_node_role(lmdata, 's')->ind
|
||||
, get_node_role(lmdata, 'e')->ind);
|
||||
@ -95,7 +98,10 @@ int main(int ac, char **av)
|
||||
{
|
||||
lm_init_data(&synt, &holder, &ldata);
|
||||
if (!(lem_in(&synt, &holder, &ldata, &ret)))
|
||||
{
|
||||
lm_clean_data(&ldata);
|
||||
return (lm_error_exit());
|
||||
}
|
||||
lm_clean_data(&ldata);
|
||||
return (0);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: mndhlovu <mndhlovu@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/04/22 08:55:30 by mndhlovu #+# #+# */
|
||||
/* Updated: 2019/04/22 12:43:44 by mndhlovu ### ########.fr */
|
||||
/* Updated: 2019/04/24 09:49:38 by tmaze ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -44,7 +44,7 @@ int lm_check_forbiden_chars(char *line, int flag)
|
||||
&& (hash == NULL || (hash != NULL && line[1] != '#')))
|
||||
return (1);
|
||||
if (flag == 3 && dash != NULL
|
||||
&& (hash == NULL || (hash != NULL && line[1] != '#')))
|
||||
&& hash == NULL)
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: mndhlovu <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/04/05 06:35:40 by mndhlovu #+# #+# */
|
||||
/* Updated: 2019/04/22 15:31:10 by mndhlovu ### ########.fr */
|
||||
/* Updated: 2019/04/23 11:01:37 by tmaze ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -51,6 +51,7 @@ void lm_clean_data(t_lmdata *data)
|
||||
i = 0;
|
||||
while (i < data->nb_nodes)
|
||||
{
|
||||
if (data->adj && data->adj[i])
|
||||
lst_inddel(&(data->adj[i]));
|
||||
i++;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: mndhlovu <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/03/29 07:17:06 by mndhlovu #+# #+# */
|
||||
/* Updated: 2019/04/22 14:28:24 by mndhlovu ### ########.fr */
|
||||
/* Updated: 2019/04/24 09:43:02 by tmaze ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -32,13 +32,16 @@ int lm_adj_parser(t_lmdata *lmdata, t_holder *holder)
|
||||
{
|
||||
t_temp *data;
|
||||
|
||||
ft_printf("=== lm_adj_parser ===\nholder: %p\n\n", holder);
|
||||
if (holder != NULL)
|
||||
{
|
||||
data = holder->data;
|
||||
ft_printf("data: %p\n\n", data);
|
||||
if (data != NULL)
|
||||
{
|
||||
while (data)
|
||||
{
|
||||
ft_printf("=== link ===\nis_lin_in: %d\n\n", is_link_in(lmdata, data->src_ind, data->dest_ind));
|
||||
if (!is_link_in(lmdata, data->src_ind, data->dest_ind))
|
||||
lst_indadd_link(lmdata, data->src_ind, data->dest_ind);
|
||||
data = data->next;
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: mndhlovu <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/03/25 06:31:37 by mndhlovu #+# #+# */
|
||||
/* Updated: 2019/04/22 12:52:48 by mndhlovu ### ########.fr */
|
||||
/* Updated: 2019/04/24 09:51:14 by tmaze ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -112,7 +112,6 @@ int lm_ext_conn(t_holder *holder, t_lmdata *data, char *raw)
|
||||
dest = lm_find_index(data, tab[1]);
|
||||
if (src == -1 || dest == -1)
|
||||
{
|
||||
ft_printf("Bingo :%s\n", raw);
|
||||
ft_del_words_tables(&tab);
|
||||
return 0;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: mndhlovu <mndhlovu@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/04/20 15:24:51 by mndhlovu #+# #+# */
|
||||
/* Updated: 2019/04/22 15:31:03 by mndhlovu ### ########.fr */
|
||||
/* Updated: 2019/04/24 09:45:04 by tmaze ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -89,6 +89,7 @@ int lm_parser(t_syntax *synt, t_lmdata *ldata,
|
||||
ft_printf("%s\n", raw);
|
||||
if (!(lm_get_ant_(index, ldata, synt, raw)) && index == 0)
|
||||
{
|
||||
ft_printf("banane\n");
|
||||
ft_strdel(&raw);
|
||||
return (0);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: mndhlovu <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/04/04 09:24:45 by mndhlovu #+# #+# */
|
||||
/* Updated: 2019/04/22 15:30:39 by mndhlovu ### ########.fr */
|
||||
/* Updated: 2019/04/24 09:47:29 by tmaze ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -73,7 +73,7 @@ void lm_get_vert_link(int count, t_syntax *synt, t_lmdata *ldata
|
||||
synt->v_error = 1;
|
||||
}
|
||||
}
|
||||
if (lm_check_forbiden_chars(line, 0))
|
||||
if (lm_check_forbiden_chars(line, 3))
|
||||
{
|
||||
if (!(lm_ext_conn(holder, ldata, line)))
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/03/27 14:56:55 by tmaze #+# #+# */
|
||||
/* Updated: 2019/04/22 15:30:24 by mndhlovu ### ########.fr */
|
||||
/* Updated: 2019/04/24 09:51:38 by tmaze ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user