2023-04-21 23:11:57 -04:00
|
|
|
/** @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"
|
2023-04-23 03:20:50 -04:00
|
|
|
#include "scan.h"
|
2023-04-21 23:11:57 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
int main(void) {
|
2023-04-21 23:49:36 -04:00
|
|
|
const char *intent = "start";
|
2023-04-21 23:11:57 -04:00
|
|
|
struct journal jrnl = {0};
|
2023-04-23 03:20:50 -04:00
|
|
|
struct scan scn = {0};
|
2023-04-21 23:11:57 -04:00
|
|
|
errno = 0;
|
|
|
|
|
2023-04-22 03:37:44 -04:00
|
|
|
intent = "../journal";
|
|
|
|
jrnl = journal(intent);
|
2023-04-21 23:11:57 -04:00
|
|
|
fprintf(stderr, "Journal: %s.\n", journal_to_string(&jrnl));
|
|
|
|
if(errno) goto catch;
|
|
|
|
|
2023-04-23 01:05:54 -04:00
|
|
|
intent = "parse";
|
2023-04-23 03:20:50 -04:00
|
|
|
scn = scan(&jrnl);
|
2023-04-26 03:59:14 -04:00
|
|
|
//fprintf(stderr, "Scan: %s.\n", scan_to_string(&scrs));
|
|
|
|
// <- Not sure what that would do.
|
2023-04-23 03:20:50 -04:00
|
|
|
if(errno) goto catch;
|
|
|
|
|
2023-04-26 03:59:14 -04:00
|
|
|
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);
|
2023-04-23 01:05:54 -04:00
|
|
|
|
2023-04-28 16:40:11 -04:00
|
|
|
intent = "derived/flight.gnu";
|
|
|
|
if(!freopen(intent, "w", stdout)) goto catch;
|
|
|
|
scan_flight_graph(&scn);
|
|
|
|
|
2023-04-28 19:18:58 -04:00
|
|
|
intent = "derived/kjv.gnu";
|
|
|
|
if(!freopen(intent, "w", stdout)) goto catch;
|
|
|
|
scan_kjv_graph(&scn);
|
|
|
|
|
2023-04-23 01:05:54 -04:00
|
|
|
intent = 0;
|
2023-04-21 23:11:57 -04:00
|
|
|
goto finally;
|
|
|
|
catch:
|
2023-04-21 23:49:36 -04:00
|
|
|
perror(intent);
|
2023-04-21 23:11:57 -04:00
|
|
|
finally:
|
2023-04-23 03:20:50 -04:00
|
|
|
scan_(&scn);
|
2023-04-21 23:11:57 -04:00
|
|
|
journal_(&jrnl);
|
2023-04-21 23:49:36 -04:00
|
|
|
return intent ? EXIT_FAILURE : EXIT_SUCCESS;
|
2023-04-21 23:11:57 -04:00
|
|
|
}
|