<commit_before>#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include "rtv1.h"

static void	line_to_struct(char const *line, t_env *env)
{
	char	**array;

	array = ft_strxsplit(line, ft_isspace);
	atom_to_struct(atom_fill((char const *const *const)array), env);
	ft_freesplit((void **)array);
}

int			scene_to_struct(char const *path, t_env *env)
{
	char	*line;
	int		fd;
	int		ret;

	if ((fd = open(path, O_RDONLY)) < 0)
	{
		ft_putendl_fd("Error while trying to open the scene", 2);
		return (fd);
	}
	while ((ret = get_next_line(fd, &line)) > 0)
	{
		line_to_struct(line, env);
		free(line);
	}
	free(line);
	close(fd);
	return (ret);
}<commit_msg>displaying current line being parsed to ease debuging of scene file<commit_after>#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include "rtv1.h"

static void	line_to_struct(char const *line, t_env *env)
{
	char	**array;

	array = ft_strxsplit(line, ft_isspace);
	atom_to_struct(atom_fill((char const *const *const)array), env);
	ft_freesplit((void **)array);
}

int			scene_to_struct(char const *path, t_env *env)
{
	char	*line;
	int		fd;
	int		ret;

	if ((fd = open(path, O_RDONLY)) < 0)
	{
		ft_putendl_fd("Error while trying to open the scene", 2);
		return (fd);
	}
	while ((ret = get_next_line(fd, &line)) > 0)
	{
		ft_putendl(line);
		line_to_struct(line, env);
		free(line);
	}
	free(line);
	close(fd);
	return (ret);
}
{'fraction_non_alphanumeric': 0.15883190883190884, 'fraction_numerical': 0.005698005698005698, 'mean_word_length': 4.805785123966942, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6857253', 'n_tokens_mistral': 623, 'n_tokens_neox': 598, 'n_words': 143}