codexion / src / codexion.c 60 commits
07-07-2026
33 lines 1.3 kB
 1/* ************************************************************************** */
 2/*                                                                            */
 3/*                                                        :::      ::::::::   */
 4/*   codexion.c                                         :+:      :+:    :+:   */
 5/*                                                    +:+ +:+         +:+     */
 6/*   By: mleitao <marvin@42.fr>                     +#+  +:+       +#+        */
 7/*                                                +#+#+#+#+#+   +#+           */
 8/*   Created: 2026/06/12 19:21:40 by mleitao           #+#    #+#             */
 9/*   Updated: 2026/07/07 02:15:16 by mleitao          ###   ########.fr       */
10/*                                                                            */
11/* ************************************************************************** */
12
13#include "parser.h"
14#include "sim.h"
15#include "error.h"
16
17int	main(int argc, char **argv)
18{
19	t_sim	sim;
20	t_args	args;
21	t_err	e;
22
23	e = parse_args(argc, argv, &args);
24	if (e.code != OK)
25		return (report_error(e), 1);
26	e = init_sim(&sim, args);
27	if (e.code != OK)
28		return (report_error(e), 1);
29	if (run_sim(&sim) != 0)
30		return (free_sim(&sim), report_error(err(ERR_INIT, "", -1)), 1);
31	free_sim(&sim);
32	return (0);
33}