Moved journal to ../journal.

This commit is contained in:
Neil 2023-03-16 19:26:09 -07:00
parent 80c95adfe6
commit 26be3e1afb
2 changed files with 13 additions and 6 deletions

View File

@ -118,7 +118,7 @@ void journal_(struct journal *const j) {
/** @return A completed journal out of "journal". Any reading errors and /** @return A completed journal out of "journal". Any reading errors and
`errno` will be set, it will be idle. */ `errno` will be set, it will be idle. */
struct journal journal(void) { struct journal journal(void) {
const char *const dir_journal = "journal"; const char *const dir_journal = "../journal";
struct journal j = {0}; struct journal j = {0};
char *intent = 0; char *intent = 0;
DIR *dir = 0; DIR *dir = 0;

View File

@ -248,23 +248,27 @@ int main(void) {
int success = EXIT_SUCCESS; int success = EXIT_SUCCESS;
const char *reason = 0; const char *reason = 0;
errno = 0; errno = 0;
struct kjvcount count = {0};
struct journal jrnl = {0};
struct sources srcs = {0};
struct kjvline_tree lines = {0};
struct kjvcount count = kjvcount(); count = kjvcount();
fprintf(stderr, "KJV count: %s.\n", kjvcount_to_string(&count)); fprintf(stderr, "KJV count: %s.\n", kjvcount_to_string(&count));
if(kjvcount_is_empty(&count)) if(kjvcount_is_empty(&count))
{ reason = "kjv failed to load"; goto catch; } { reason = "kjv failed to load"; goto catch; }
struct journal jrnl = journal(); jrnl = journal();
fprintf(stderr, "Journal: %s.\n", journal_to_string(&jrnl)); fprintf(stderr, "Journal: %s.\n", journal_to_string(&jrnl));
if(journal_is_empty(&jrnl)) if(journal_is_empty(&jrnl))
{ reason = "journal failed to load"; goto catch; } { reason = "journal failed to load"; goto catch; }
struct sources srcs = sources(&jrnl); srcs = sources(&jrnl);
//fprintf(stderr, "Sources: %s.\n", sources_to_string(&srcs)); //fprintf(stderr, "Sources: %s.\n", sources_to_string(&srcs));
if(sources_is_empty(&srcs)) if(sources_is_empty(&srcs))
{ reason = "sources failed to parse"; goto catch; } { reason = "sources failed to parse"; goto catch; }
struct kjvline_tree lines = kjv_line(&jrnl); lines = kjv_line(&jrnl);
fprintf(stderr, "KJV lines: %s.\n", kjv_line_to_string(&lines)); fprintf(stderr, "KJV lines: %s.\n", kjv_line_to_string(&lines));
if(kjv_line_is_empty(&lines)) if(kjv_line_is_empty(&lines))
{ reason = "KJV lines parsing failed"; goto catch; } { reason = "KJV lines parsing failed"; goto catch; }
@ -282,13 +286,16 @@ int main(void) {
const struct source *src = source_lookup(&srcs, line); const struct source *src = source_lookup(&srcs, line);
if(!src || !src->name.a) { errno = EDOM; goto catch; } if(!src || !src->name.a) { errno = EDOM; goto catch; }
kjvcite_to_string(range->start, &citestr); kjvcite_to_string(range->start, &citestr);
date32_to_string(line.date, &datestr);
printf("# %s", citestr);
if(range->verse_end) printf("-%" PRIu32, range->verse_end);
printf("\n");
#if 0 #if 0
//fixme //fixme
for( ; ; cite.verse++) { for( ; ; cite.verse++) {
if(!kjv_add(kj, cite)) return 0; if(!kjv_add(kj, cite)) return 0;
if(!verse_end || verse_end <= cite.verse) break; if(!verse_end || verse_end <= cite.verse) break;
} }
date32_to_string(date, &datestr);
printf("%s\t%zu\t%zu\t%zu\t# ", printf("%s\t%zu\t%zu\t%zu\t# ",
datestr, kj->words.verse, kj->words.set, kj->words.cumulative); datestr, kj->words.verse, kj->words.set, kj->words.cumulative);
if(verse_end) { if(verse_end) {