示例#1
0
文件: parsing.c 项目: sganon/FdF
static int		get_map(char **tab, t_env *env)
{
	int		**map;
	char	**tmp;
	int		i;
	int		j;

	if (check_for_char(env) == 0)
		return (0);
	get_max_x(env->tab, env);
	map = (int **)malloc(sizeof(int *) * env->y);
	i = -1;
	while (tab[++i])
	{
		j = -1;
		map[i] = (int *)malloc(sizeof(int) * env->x);
		tmp = ft_strsplit(tab[i], ' ');
		while (tmp[++j])
			map[i][j] = ft_atoi(tmp[j]);
		while (j < env->x)
		{
			map[i][j] = 0;
			j++;
		}
	}
	env->map = map;
	return (0);
}
bool emstream::hex_receiver_loop (void)
{
	// If the receiver has been set up and there are characters ready to read...
	if (p_hex_receiver != NULL)
	{
		// ...get each character and have the hex receiver decode it
		while (check_for_char ())
		{
			uint16_t char_in = getchar ();

			if (p_hex_receiver->decode (char_in))
			{
				// This call tells the receiver object for one specific data item that
				// good data has arrived and should be transferred from the receiving
				// buffer into the output buffer
				p_hex_receiver->p_map->p_rcvr->transfer ();

				return (true);
			}
		}
	}
	return (false);
}