]> www.ljiriste.work Git - FET_sim.git/commitdiff
Add rudimentary error report when load fails
authorLukáš Jiřiště <redacted>
Sun, 9 Aug 2026 18:28:12 +0000 (20:28 +0200)
committerLukáš Jiřiště <redacted>
Sun, 9 Aug 2026 18:28:12 +0000 (20:28 +0200)
When load command fails to build a graph it now reports an error instead
of failing silently.

src/c_load.c

index 05e752e5ffbf98b19feb258ed0a71af992f226bf..053d3d0fc925f7bcb5ffaede7e843027ff2afe73 100644 (file)
@@ -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)