Esempio n. 1
0
void							ft_byte(unsigned short int bite)
{
	static t_list				*list;
	static unsigned short int	targ;
	static char					*byte;
	unsigned char				dup;

	if (!byte && !(targ = 0))
		{
			list = ft_memalloc((0x02) * sizeof(t_list));
			byte = ft_memalloc((0x08) * sizeof(char));
			byte[0x08] = 0x00;
		}
	byte[targ] = bite;
	if (++targ == 0x08 && !(targ = 0))
		{
			dup = ft_bintodec(byte);
			if (!dup)
				(void) ft_lst_client(list);
			else
				(void) ft_lst_add(list, (void *) ft_chardup(dup));
		}
	return ;
}
Esempio n. 2
0
t_lst			*ft_lst_init(char *tab)
{
	t_lst	*begin_lst;
	int		cursor;
	int		col;

	col = -1;
	if (!(begin_lst = (t_lst *)malloc(sizeof(t_lst))))
		return (NULL);
	if (ft_strlen(tab) >= 440)
		cursor = ft_strlen(tab) / 20;
	else
		cursor = ft_strlen(tab) / 20 + 1;
	begin_lst->next = NULL;
	begin_lst->id = cursor - 1;
	begin_lst->used = FALSE;
	begin_lst->shape = (char *)malloc(sizeof(char) * 21);
	begin_lst->shp = (char **)malloc(sizeof(char *) * 4);
	while (++col < 4)
		begin_lst->shp[col] = (char *)malloc(sizeof(char) * 4 + 1);
	while (--cursor)
		begin_lst = ft_lst_add(begin_lst, cursor);
	return (begin_lst);
}