interpret/src/driver.c

40 lines
845 B
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 "scores.h"
#include <stdio.h>
#include <errno.h>
#include <assert.h>
int main(void) {
const char *intent = "start";
struct journal jrnl = {0};
struct scores scrs = {0};
errno = 0;
intent = "../journal";
jrnl = journal(intent);
fprintf(stderr, "Journal: %s.\n", journal_to_string(&jrnl));
if(errno) goto catch;
intent = "parse";
scrs = scores(&jrnl);
fprintf(stderr, "Scores: %s.\n", scores_to_string(&scrs));
if(scores_is_empty(&scrs)) goto catch;
if(!scores_graph(&scrs)) goto catch;
intent = 0;
goto finally;
catch:
perror(intent);
finally:
scores_(&scrs);
journal_(&jrnl);
return intent ? EXIT_FAILURE : EXIT_SUCCESS;
}