Exemplo n.º 1
0
int			ft_parse(char *file, t_env *e)
{
	int		fd;
	int		obj_nb;
	int		spot_nb;
	char	*line;

	if ((fd = ft_parse_2(e, file)) < 0)
		return (-1);
	while (get_next_line(fd, &line) > 0 && (line[0] == '/' || line[0] == 0))
		;
	line = delete_spaces(line, ' ');
	if (!verif_vect(line))
		return (-1);
	e->cam_ray = ft_fill_vect(line, e->cam_ray);
	if (!ft_parse_init(&obj_nb, &spot_nb, e, fd))
		return (-1);
	if (!the_parse(fd, obj_nb, spot_nb, e))
		return (-1);
	e->spot[spot_nb] = NULL;
	e->types[obj_nb] = NULL;
	e->objects[obj_nb] = NULL;
	free(line);
	if (close(fd) == -1)
		return (-1);
	return (0);
}
Exemplo n.º 2
0
uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr,
                  const byte *record, my_bool with_alloc)
{
  FT_SEG_ITERATOR ftsi;
  DBUG_ENTER("_mi_ft_parse");

  _mi_ft_segiterator_init(info, keynr, record, &ftsi);

  ft_parse_init(parsed, info->s->keyinfo[keynr].seg->charset);
  while (_mi_ft_segiterator(&ftsi))
  {
    if (ftsi.pos)
      if (ft_parse(parsed, (byte *)ftsi.pos, ftsi.len, with_alloc))
        DBUG_RETURN(1);
  }
  DBUG_RETURN(0);
}
uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const uchar *record,
                  MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root)
{
  FT_SEG_ITERATOR ftsi;
  struct st_mysql_ftparser *parser;
  DBUG_ENTER("_mi_ft_parse");

  _mi_ft_segiterator_init(info, keynr, record, &ftsi);

  ft_parse_init(parsed, info->s->keyinfo[keynr].seg->charset);
  parser= info->s->keyinfo[keynr].parser;
  while (_mi_ft_segiterator(&ftsi))
  {
    if (ftsi.pos)
      if (ft_parse(parsed, (uchar *)ftsi.pos, ftsi.len, parser, param, mem_root))
        DBUG_RETURN(1);
  }
  DBUG_RETURN(0);
}