kjvline -> kjv

This commit is contained in:
Neil 2023-04-30 01:49:05 -07:00
parent dd7ebd4075
commit 6866fab753
2 changed files with 12 additions and 12 deletions

View File

@ -70,7 +70,7 @@ struct flight {
#include "kjv.h"
#define TREE_NAME kjvline
#define TREE_NAME kjv
#define TREE_KEY union line64
#define TREE_VALUE struct kjvrange
#define TREE_HEAD
@ -90,7 +90,7 @@ struct scan {
} scores;
struct glider_tree gliders;
struct flight_tree flights;
struct kjvline_tree kjvs;
struct kjv_tree kjvs;
};
void scan_(struct scan *);

View File

@ -80,11 +80,11 @@ static int flight_compare(const union line64 a, const union line64 b)
#include "../src/tree.h"
/* KJV tree. */
static void kjvline_to_string(const union line64 line, const struct kjvrange *u,
static void kjv_to_string(const union line64 line, const struct kjvrange *u,
char (*const a)[12]) { (void)u; date32_to_string(line.date, a); }
static int kjvline_compare(const union line64 a, const union line64 b)
static int kjv_compare(const union line64 a, const union line64 b)
{ return a.u64 > b.u64; }
#define TREE_NAME kjvline
#define TREE_NAME kjv
#define TREE_KEY union line64
#define TREE_VALUE struct kjvrange
#define TREE_COMPARE
@ -524,7 +524,7 @@ static int scan_day(struct scan *const scan, union date32 date,
{ fail = "kjv interval error"; goto catch; }
const union line64 key = {{ (uint32_t)line, date }};
struct kjvrange *value;
switch(kjvline_tree_bulk_assign(&scan->kjvs, key, &value)) {
switch(kjv_tree_bulk_assign(&scan->kjvs, key, &value)) {
case TREE_PRESENT: fail = "kjv duplicate key";
case TREE_ERROR: goto catch;
case TREE_ABSENT:
@ -592,7 +592,7 @@ struct scan scan(struct journal *const jrnl) {
|| !linemap_tree_bulk_finish(&scan.scores.dates)
|| !glider_tree_bulk_finish(&scan.gliders)
|| !flight_tree_bulk_finish(&scan.flights)
|| !kjvline_tree_bulk_finish(&scan.kjvs)) goto catch;
|| !kjv_tree_bulk_finish(&scan.kjvs)) goto catch;
goto finally;
catch:
@ -828,9 +828,9 @@ void scan_kjv_graph(struct scan *const scan) {
fprintf(stderr, "KJV count: %s.\n", kjv_count_to_string(&count));
if(!no_total) { reason = "kjv failed to load"; goto catch; }
fprintf(stderr, "KJV lines: %s.\n", kjvline_tree_to_string(&scan->kjvs));
fprintf(stderr, "KJV lines: %s.\n", kjv_tree_to_string(&scan->kjvs));
struct kjvline_tree_iterator it = kjvline_tree_iterator(&scan->kjvs);
struct kjv_tree_iterator it = kjv_tree_iterator(&scan->kjvs);
/* https://stackoverflow.com/a/12601553 */
printf("set terminal pngcairo dashed transparent truecolor"
@ -838,10 +838,10 @@ void scan_kjv_graph(struct scan *const scan) {
"set output \"kjv.png\"\n");
printf("$Data <<EOD\n"
"# date, verse, words, set / %zu, source\n", no_total);
while(kjvline_tree_next(&it)) {
while(kjv_tree_next(&it)) {
char citestr[12], datestr[12];
const union line64 line = kjvline_tree_key(&it);
const struct kjvrange *const range = kjvline_tree_value(&it);
const union line64 line = kjv_tree_key(&it);
const struct kjvrange *const range = kjv_tree_value(&it);
size_t words = 0, newwords = 0;
const struct source *src = source_lookup(scan, line);
if(!src || !src->name.a) { errno = EDOM; goto catch; }