Esempio n. 1
0
void	check_file(char *new_name)
{
  int	fd;
  char	*file;

  if ((fd = open(new_name, O_RDONLY)) == -1)
    {
      my_putstr(RED_BOLD);
      my_error("[ERROR] ", 0);
      my_putstr(INIT);
      my_error("file :", 0);
      my_error(new_name, 0);
      free(new_name);
      my_error(" not accessible.\n", 0);
      return;
    }
  file = read_fd(fd);
  close(fd);
  my_putstr(CYAN_BOLD);
  my_putstr("Compiling :");
  my_putstr(INIT);
  my_putstr(new_name);
  my_putchar('\n');
  my_parsing(file, new_name);
  free(new_name);
}
Esempio n. 2
0
int		main()
{
  t_wolf	*wolf;

  if ((wolf = malloc(sizeof(t_wolf))) == NULL)
    my_error("Error with a memory allocation");
  my_init(wolf);
  my_parsing(wolf->ptr);
  my_hook(wolf);
  return (0);
}
Esempio n. 3
0
int		before_manif(char **str, char ***mav)
{
  (*str) = my_parsing((*str));
  if ((*str) != NULL)
    {
      (*mav) = my_str_to_wordtab((*str));
      return (1);
    }
  else
    return (0);
}
Esempio n. 4
0
int		main(int argc, char **argv)
{
  t_vm		*vm;
  int		i;

  if ((vm = malloc(sizeof(t_vm))) == NULL)
    my_print_error("Error with a memory allocation\n");
  if ((vm->arena = malloc(sizeof(t_vm))) == NULL)
    my_print_error("Error with a memory allocation\n");
  init_arena(vm->arena->arena, MEM_SIZE);
  check_arg(argc);
  i = check_dump(vm, argv);
  check_champ(vm, argc, argv, i);
  init_champs(vm);
  my_parsing(vm, argc, argv, i);
  init_mlx(vm);
  aff_grid(vm);
  my_hook(vm);
  corewar(vm);
  return (0);
}