code cleaning done on 80 percent of the parser functions, whats left is to re structure the syntax struct and do furthure tests to eliminate level 0 errors

This commit is contained in:
Mthandazo Ndhlovu
2019-04-29 12:47:14 +02:00
parent 6ad8cd2d95
commit a51c8ad81d
17 changed files with 389 additions and 355 deletions

View File

@@ -6,15 +6,44 @@
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/23 17:43:34 by tmaze #+# #+# */
/* Updated: 2019/04/22 12:44:00 by mndhlovu ### ########.fr */
/* Updated: 2019/04/29 12:08:36 by mndhlovu ### ########.fr */
/* */
/* ************************************************************************** */
#include "lem_in.h"
void lm_initdata(t_lmdata *data)
void lm_initdata(t_lmdata *data)
{
data->nbants = 0;
data->nodes_data = NULL;
data->adj = NULL;
}
int lm_init_src_dest(int *src, int *dest, t_lmdata *data
, char *raw)
{
int s;
int d;
char **tab;
if (raw != NULL)
{
tab = ft_strsplit(raw, '-');
if (tab != NULL)
{
s = lm_find_index(data, tab[0]);
d = lm_find_index(data, tab[1]);
if (s == -1 || d == -1)
{
ft_del_words_tables(&tab);
return (0);
}
*src = s;
*dest = d;
ft_del_words_tables(&tab);
return (1);
}
}
ft_del_words_tables(&tab);
return (0);
}