/** @license 2023 Neil Edelman, distributed under the terms of the [MIT License](https://opensource.org/licenses/MIT). Scan source files for meanings. @std C99 */ #include "journal.h" #include "scan.h" #include #include #include int main(void) { const char *intent = "start"; struct journal jrnl = {0}; struct scan scn = {0}; errno = 0; intent = "../journal"; jrnl = journal(intent); fprintf(stderr, "Journal: %s.\n", journal_to_string(&jrnl)); if(errno) goto catch; intent = "parse"; scn = scan(&jrnl); //fprintf(stderr, "Scan: %s.\n", scan_to_string(&scrs)); // <- Not sure what that would do. if(errno) goto catch; intent = "derived/score.gnu"; if(!freopen(intent, "w", stdout)) goto catch; scan_score_graph(&scn); intent = "derived/glider.gnu"; if(!freopen(intent, "w", stdout)) goto catch; scan_glider_graph(&scn); intent = "derived/flight.gnu"; if(!freopen(intent, "w", stdout)) goto catch; scan_flight_graph(&scn); intent = 0; goto finally; catch: perror(intent); finally: scan_(&scn); journal_(&jrnl); return intent ? EXIT_FAILURE : EXIT_SUCCESS; }