Massive clean up

cleaned up unused code
normalised push_ants
libft is no longer a submodule
still need to normalise lem_in
This commit is contained in:
Tanguy MAZE
2019-04-10 14:34:59 +02:00
parent fb66233265
commit 5d094ebcaf
127 changed files with 180 additions and 5112 deletions

View File

@@ -6,65 +6,19 @@
/* By: mndhlovu <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/25 06:31:05 by mndhlovu #+# #+# */
/* Updated: 2019/04/09 19:08:36 by tmaze ### ########.fr */
/* Updated: 2019/04/10 14:26:07 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
#include "lem_in.h"
int lm_error_exit(void)
int lm_error_exit(void)
{
ft_putendl_fd("ERROR", 2);
return (1);
}
void ft_print_graph(t_graph *graph)
{
int v;
t_ind *crawl;
v = -1;
while (++v < graph->v)
{
crawl = graph->array[v].head;
printf("\n Adjacency list of vertex %d\n head", v);
while (crawl)
{
printf("->%d",crawl->index);
crawl = crawl->next;
}
printf("\n");
}
}
void lm_print_report(t_lmdata *ldata, t_syntax *synt, t_holder *holder)
{
t_node *nodes;
t_temp *data;
if (ldata != NULL)
{
nodes = ldata->nodes_data;
while (nodes)
{
ft_printf("name: %s x: %d y: %d index: %d role: %c\n", nodes->name, nodes->x, nodes->y, nodes->ind, nodes->role);
nodes = nodes->next;
}
}
if (holder != NULL)
{
data = holder->data;
while (data)
{
ft_printf("src: %d - dest: %d\n", data->src_ind, data->dest_ind);
data = data->next;
}
}
ft_printf("nb_state: %d\n s_cmd: %d\n e_cmd: %d\n s_error: %d\n e_rror: %d\n v_error: %d\n l_error: %d\n",
synt->nb_state, synt->s_cmd, synt->e_cmd, synt->s_error, synt->e_error, synt->v_error, synt->l_error);
}
static int lem_in(t_syntax *synt, t_holder *holder,
static int lem_in(t_syntax *synt, t_holder *holder,
t_lmdata *lmdata)
{
if (!(lm_parser(synt, lmdata, holder)))
@@ -76,7 +30,7 @@ static int lem_in(t_syntax *synt, t_holder *holder,
return (1);
}
int main(int ac, char **av)
int main(int ac, char **av)
{
t_syntax synt;
t_lmdata ldata;
@@ -85,7 +39,6 @@ int main(int ac, char **av)
t_node *it;
t_node *start;
t_node *end;
t_ind *it2;
int i;
(void)av;
@@ -106,24 +59,8 @@ int main(int ac, char **av)
end = it;
it = it->next;
}
ft_printf("data->adj: %p\n", ldata.adj);
if ((!start) || (ret = edmunds_karp(&ldata, start->ind, end->ind)) == NULL)
return (lm_error_exit());
if (ret != NULL)
{
i = 0;
while (ret[i])
{
it2 = ret[i];
while (it2)
{
ft_printf(" %d -> ", it2->index);
it2 = it2->next;
}
ft_putchar('\n');
i++;
}
}
push_ants(&ldata, ret, i);
tablst_inddel(ret);
i = 0;