예제 #1
0
파일: parser.c 프로젝트: vlehuger/lem-in
void			parser(t_lem *p)
{
    char			*str;
    static t_state	state = ANT;

    while (get_next_line(0, &str) > 0)
    {
        if (state == END)
            list(p, str, 1);
        else
            list(p, str, 0);
        if (str[0] != '#' || (str[0] == '#' && str[1] == '#'))
        {
            if (state == ANT)
                state = get_ant(p, str);
            else if (state == ROOM)
                state = get_room(p, str);
            else if (state == LINK)
                state = get_link(p, str);
            free(str);
        }
    }
}
예제 #2
0
void		run(t_list *list, int ant)
{
	int	tot;

	tot = 1;
	ant = get_ant();
	while (tot <= ant)
	{
		add_simple(tot, list);
		ft_putchar('\n');
		move_simple(list);
		clean_last(list);
		clean_useless(list);
		tot++;
	}
	while (som_in(list) == 1)
	{
		ft_putchar('\n');
		move_simple(list);
		clean_last(list);
		clean_useless(list);
	}
	ft_putchar('\n');
}