From: Lukáš Jiřiště Date: Sun, 9 Aug 2026 18:28:12 +0000 (+0200) Subject: Add rudimentary error report when load fails X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=1e8b8630b01bb154bc20fe08948de750ba440b7e;p=FET_sim.git Add rudimentary error report when load fails When load command fails to build a graph it now reports an error instead of failing silently. --- diff --git a/src/c_load.c b/src/c_load.c index 05e752e..053d3d0 100644 --- a/src/c_load.c +++ b/src/c_load.c @@ -1349,17 +1349,19 @@ int transfer_main(t_catalog *part_catalog, t_vec *nodes, t_vec *mosfets) return (0); } -int construct_new_graph(t_parse_tree_node *parse_tree, __attribute__((unused)) t_vec *nodes, __attribute__((unused)) t_vec *mosfets) +int construct_new_graph(t_parse_tree_node *parse_tree, t_vec *nodes, t_vec *mosfets) { t_catalog part_catalog; + int res; - init_catalog(&part_catalog); - extract_used_names(&part_catalog, parse_tree); - rebind_names_to_parts(&part_catalog); - build_main_graph(&part_catalog); - transfer_main(&part_catalog, nodes, mosfets); + res = 0; + res = res || (init_catalog(&part_catalog) != success); + res = res || extract_used_names(&part_catalog, parse_tree); + res = res || rebind_names_to_parts(&part_catalog); + res = res || build_main_graph(&part_catalog); + res = res || transfer_main(&part_catalog, nodes, mosfets); free_catalog(&part_catalog); - return (0); + return (res); } int rewrite_graph(t_parse_tree_node *parse_tree, t_vec *nodes, t_vec *mosfets)