62 lines
1.4 KiB
C
62 lines
1.4 KiB
C
/** @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 <stdio.h>
|
|
#include <errno.h>
|
|
#include <assert.h>
|
|
|
|
int main(void) {
|
|
const char *intent = "start";
|
|
struct journal jrnl = {0};
|
|
struct scan scn = {0};
|
|
errno = 0;
|
|
|
|
intent = "journal (cwd)";
|
|
jrnl = journal();
|
|
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 = "derived/kjv.gnu";
|
|
if(!freopen(intent, "w", stdout)) goto catch;
|
|
scan_kjv_graph(&scn);
|
|
|
|
intent = "derived/dream.gnu";
|
|
if(!freopen(intent, "w", stdout)) goto catch;
|
|
scan_dream_graph(&scn);
|
|
|
|
intent = 0;
|
|
goto finally;
|
|
catch:
|
|
perror(intent);
|
|
finally:
|
|
/* fixme: ~scan should be idempotent but it's not on disabling ASLR, which
|
|
debug mode is in. */
|
|
scan_(&scn);
|
|
journal_(&jrnl);
|
|
return intent ? EXIT_FAILURE : EXIT_SUCCESS;
|
|
}
|