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 05:05:54 +00:00
|
|
|
#include "scores.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 05:05:54 +00:00
|
|
|
struct scores scrs = {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;
|
|
|
|
|
2023-04-23 05:05:54 +00:00
|
|
|
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;
|
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 05:05:54 +00:00
|
|
|
scores_(&scrs);
|
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
|
|
|
}
|