interpret/src/driver.c

41 lines
824 B
C
Raw Normal View History

2023-04-22 03:11:57 +00: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 07:20:50 +00:00
#include "scan.h"
2023-04-22 03:11:57 +00:00
#include <stdio.h>
#include <errno.h>
#include <assert.h>
int main(void) {
2023-04-22 03:49:36 +00:00
const char *intent = "start";
2023-04-22 03:11:57 +00:00
struct journal jrnl = {0};
2023-04-23 07:20:50 +00:00
struct scan scn = {0};
2023-04-22 03:11:57 +00:00
errno = 0;
2023-04-22 07:37:44 +00:00
intent = "../journal";
jrnl = journal(intent);
2023-04-22 03:11:57 +00:00
fprintf(stderr, "Journal: %s.\n", journal_to_string(&jrnl));
if(errno) goto catch;
intent = "parse";
2023-04-23 07:20:50 +00:00
scn = scan(&jrnl);
//fprintf(stderr, "Scores: %s.\n", scores_to_string(&scrs));
if(errno) goto catch;
if(!scan_scores_graph(&scn)) goto catch;
intent = 0;
2023-04-22 03:11:57 +00:00
goto finally;
catch:
2023-04-22 03:49:36 +00:00
perror(intent);
2023-04-22 03:11:57 +00:00
finally:
2023-04-23 07:20:50 +00:00
scan_(&scn);
2023-04-22 03:11:57 +00:00
journal_(&jrnl);
2023-04-22 03:49:36 +00:00
return intent ? EXIT_FAILURE : EXIT_SUCCESS;
2023-04-22 03:11:57 +00:00
}