Пример #1
0
int			parser(char **argv, t_cloud *data)
{
	FT_INIT(char *, line, NULL);
	FT_INIT(double, pos_y, 0);
	FT_INIT(int, fd, 0);
	FT_INIT(int, verif, 1);
	FT_INIT(t_node*, list, NULL);
	if ((fd = open(argv[1], O_RDONLY)) == -1)
		error_fdf("Error open file");
	while (verif)
	{
		if (!(verif = get_next_line(fd, &line)))
			break ;
		if (!list)
			MULTI(data->start_node, list, build_list(pos_y, data, line));
		else
		{
			list->next  = build_list(pos_y, data, line);
			list = list->next;
		}
		while (list && list->next)
			list = list->next;
		if (line)
			ft_strdel(&line);
		pos_y++;
	}
	return (0);
}
Пример #2
0
int		adresse_part2(t_docker *data, uintmax_t result, int base, uint8_t flag)
{
	FT_INIT(int, prec, 0);
	FT_INIT(int, length, data->less == 0 && data->width > 0 ? 1 : 0);
	FT_INIT(int, len_nb, len_base(result, base));
	if (data->dot == 1)
	{
		data->len += ftp_putstr((uint8_t *)"0x");
		if (!result && !data->precision)
			return (0);
		data->len += (length == 0) ? len_nb : 0;
		MULTI(length, prec, data->precision - len_nb);
		data->len = ft_add_spaces(length, data->len, '0');
	}
	if (data->less == 1)
	{
		data->len += !data->dot ? ftp_putstr((uint8_t *)"0x") : 0;
		length = data->width - len_nb - (!result ? 2 : 6);
		length -= prec != 0 ? (data->len - prec) : 0;
		data->len += prec != 0 ? 0 : len_nb;
		ftp_putbase_long(result, base, flag, data);
		data->len = ft_add_spaces(length, data->len, ' ');
		return (0);
	}
	if (data->less == 0 && data->dot == 0 && data->width == 0)
		data->len += len_nb;
	return (1);
}
Пример #3
0
int				check_lemin(char *line, t_check *check, t_cells **cells)
{
	FT_INIT(int, nb_args, check_nb_args(line));
	if (!line)
		return (find_way(check));
	if (ft_strchr(line, '#') &&
	(ft_strcmp(line, "##start") && ft_strcmp(line, "##end")))
		return (1);
	if (!check->ants && nb_args == 1 && nb_ants(line, check, 1))
		return (1);
	if (check->ants && start_end_min(line, check))
		return (nb_args == 1 ? 1 : 0);
	if (check->ants && nb_args == 3
	&& (check->start || check->end || !(*cells)))
	{
		build_list(cells, check, line);
		if (check->start)
			check->start_cell = ft_strdup((*cells)->name);
		else if (check->end)
			check->end_cell = ft_strdup((*cells)->name);
		MULTI(check->start, check->end, 0);
		return (1);
	}
	if (check->ants && check->start_list
	&& nb_args <= 3 && !build_list(cells, check, line))
		return (0);
	return (1);
}
Пример #4
0
t_file			*sort_list(t_file *files, t_store *store)
{
	FT_INIT(t_file*, after, files);
	FT_INIT(t_file*, before, files);
	FT_INIT(t_file*, tmp, NULL);
	while (after && after->next)
	{
		if (compare(after, after->next, store->flags) > 0)
		{
			files = (after == files) ? after->next : files;
			before->next = after->next;
			tmp = (after->next)->next;
			(after->next)->next = after;
			after->next = tmp;
			MULTI(after, before, files);
		}
		else
		{
			before = after;
			after = after->next;
		}
	}
	return (files);
}
Пример #5
0
 * return the multi expression
 *
 *	[A1 C A2] -> [B1 D B2]
 *
 * We first insert input dimensions to obtain
 *
 *	[A1 C A2] -> [B1 B2]
 *
 * and
 *
 *	[A1 C A2] -> [D]
 *
 * and then apply range_splice.
 */
__isl_give MULTI(BASE) *FN(MULTI(BASE),splice)(
	__isl_take MULTI(BASE) *multi1, unsigned in_pos, unsigned out_pos,
	__isl_take MULTI(BASE) *multi2)
{
	isl_size n_in1;
	isl_size n_in2;

	n_in1 = FN(MULTI(BASE),dim)(multi1, isl_dim_in);
	n_in2 = FN(MULTI(BASE),dim)(multi2, isl_dim_in);
	if (n_in1 < 0 || n_in2 < 0)
		goto error;

	if (FN(MULTI(BASE),check_range)(multi1, isl_dim_in, in_pos, 0) < 0)
		goto error;

	multi1 = FN(MULTI(BASE),insert_dims)(multi1, isl_dim_in, in_pos, n_in2);
	multi2 = FN(MULTI(BASE),insert_dims)(multi2, isl_dim_in, n_in2,
Пример #6
0
 *
 * Use of this software is governed by the MIT license
 *
 * Written by Sven Verdoolaege,
 * Ecole Normale Superieure, 45 rue d’Ulm, 75230 Paris, France
 */

#include <isl_multi_macro.h>

/* Transform the elements of "multi" by applying "fn" to them
 * with extra argument "set".
 *
 * The parameters of "multi" and "set" are assumed to have been aligned.
 */
__isl_give MULTI(BASE) *FN(FN(MULTI(BASE),apply_aligned),APPLY_DOMBASE)(
	__isl_take MULTI(BASE) *multi, __isl_take APPLY_DOM *set,
	__isl_give EL *(*fn)(EL *el, __isl_take APPLY_DOM *set))
{
	int i;

	if (!multi || !set)
		goto error;

	if (multi->n == 0) {
		FN(APPLY_DOM,free)(set);
		return multi;
	}

	multi = FN(MULTI(BASE),cow)(multi);
	if (!multi)
		goto error;
Пример #7
0
 * Written by Sven Verdoolaege.
 */

/* These versions of the explicit domain functions are used
 * when the multi expression cannot have an explicit domain.
 */

#include <isl/space.h>

#include <isl_multi_macro.h>

/* Does "multi" have an explicit domain?
 *
 * No.
 */
static int FN(MULTI(BASE),has_explicit_domain)(__isl_keep MULTI(BASE) *multi)
{
	return 0;
}

/* Initialize the explicit domain of "multi".
 * "multi" cannot have an explicit domain, so this function is never called.
 */
static __isl_give MULTI(BASE) *FN(MULTI(BASE),init_explicit_domain)(
	__isl_take MULTI(BASE) *multi)
{
	return multi;
}

/* Intersect the domain of "dst" with the explicit domain of "src".
 * "src" cannot have an explicit domain, so this function is never called.
Пример #8
0
 *
 * Use of this software is governed by the MIT license
 *
 * Written by Sven Verdoolaege,
 * Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
 */

#include <isl_multi_macro.h>

/* Coalesce the elements of "multi".
 *
 * Note that such coalescing does not change the meaning of "multi"
 * so there is no need to cow.  We do need to be careful not to
 * destroy any other copies of "multi" in case of failure.
 */
__isl_give MULTI(BASE) *FN(MULTI(BASE),coalesce)(__isl_take MULTI(BASE) *multi)
{
	int i;

	if (!multi)
		return NULL;

	for (i = 0; i < multi->n; ++i) {
		EL *el = FN(EL,copy)(multi->u.p[i]);
		el = FN(EL,coalesce)(el);
		if (!el)
			return FN(MULTI(BASE),free)(multi);
		FN(EL,free)(multi->u.p[i]);
		multi->u.p[i] = el;
	}