示例#1
0
文件: filler.c 项目: zisson/filler_v2
int	main(void)
{
	t_filler	f;
	char		*line;

	line = NULL;
	if (!init_map(&f, &line))
		return (free_filler(&f, &line));
	if (!my_compute(&f))
		return (free_filler(&f, &line));
	free_grid(&f.form);
	while (1)
	{
		if (!read_grid(&f.grid, &line))
			return (free_filler(&f, &line));
		if (!init_grid(&f.form, &line, PIECE))
			return (free_filler(&f, &line));
		if (!my_compute(&f))
			return (free_filler(&f, &line));
		free_grid(&f.form);
	}
	return (free_filler(&f, &line));
}
示例#2
0
int     my_str_to_nbr(const char *str)
{
  int   result;
  int   len;
  int   mul;

  result = 0;
  mul = 1;
  len = my_strlen(str) - 1;
  while (len + 1 > 0)
    {
      my_compute(len, str, &mul, &result);
      len -= 1;
    }
  if (str[0] == '-')
    result = -result;
  return (result);
}