kjvline -> kjv
This commit is contained in:
parent
dd7ebd4075
commit
6866fab753
@ -70,7 +70,7 @@ struct flight {
|
|||||||
|
|
||||||
|
|
||||||
#include "kjv.h"
|
#include "kjv.h"
|
||||||
#define TREE_NAME kjvline
|
#define TREE_NAME kjv
|
||||||
#define TREE_KEY union line64
|
#define TREE_KEY union line64
|
||||||
#define TREE_VALUE struct kjvrange
|
#define TREE_VALUE struct kjvrange
|
||||||
#define TREE_HEAD
|
#define TREE_HEAD
|
||||||
@ -90,7 +90,7 @@ struct scan {
|
|||||||
} scores;
|
} scores;
|
||||||
struct glider_tree gliders;
|
struct glider_tree gliders;
|
||||||
struct flight_tree flights;
|
struct flight_tree flights;
|
||||||
struct kjvline_tree kjvs;
|
struct kjv_tree kjvs;
|
||||||
};
|
};
|
||||||
|
|
||||||
void scan_(struct scan *);
|
void scan_(struct scan *);
|
||||||
|
@ -80,11 +80,11 @@ static int flight_compare(const union line64 a, const union line64 b)
|
|||||||
#include "../src/tree.h"
|
#include "../src/tree.h"
|
||||||
|
|
||||||
/* KJV tree. */
|
/* 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); }
|
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; }
|
{ return a.u64 > b.u64; }
|
||||||
#define TREE_NAME kjvline
|
#define TREE_NAME kjv
|
||||||
#define TREE_KEY union line64
|
#define TREE_KEY union line64
|
||||||
#define TREE_VALUE struct kjvrange
|
#define TREE_VALUE struct kjvrange
|
||||||
#define TREE_COMPARE
|
#define TREE_COMPARE
|
||||||
@ -524,7 +524,7 @@ static int scan_day(struct scan *const scan, union date32 date,
|
|||||||
{ fail = "kjv interval error"; goto catch; }
|
{ fail = "kjv interval error"; goto catch; }
|
||||||
const union line64 key = {{ (uint32_t)line, date }};
|
const union line64 key = {{ (uint32_t)line, date }};
|
||||||
struct kjvrange *value;
|
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_PRESENT: fail = "kjv duplicate key";
|
||||||
case TREE_ERROR: goto catch;
|
case TREE_ERROR: goto catch;
|
||||||
case TREE_ABSENT:
|
case TREE_ABSENT:
|
||||||
@ -592,7 +592,7 @@ struct scan scan(struct journal *const jrnl) {
|
|||||||
|| !linemap_tree_bulk_finish(&scan.scores.dates)
|
|| !linemap_tree_bulk_finish(&scan.scores.dates)
|
||||||
|| !glider_tree_bulk_finish(&scan.gliders)
|
|| !glider_tree_bulk_finish(&scan.gliders)
|
||||||
|| !flight_tree_bulk_finish(&scan.flights)
|
|| !flight_tree_bulk_finish(&scan.flights)
|
||||||
|| !kjvline_tree_bulk_finish(&scan.kjvs)) goto catch;
|
|| !kjv_tree_bulk_finish(&scan.kjvs)) goto catch;
|
||||||
|
|
||||||
goto finally;
|
goto finally;
|
||||||
catch:
|
catch:
|
||||||
@ -828,9 +828,9 @@ void scan_kjv_graph(struct scan *const scan) {
|
|||||||
fprintf(stderr, "KJV count: %s.\n", kjv_count_to_string(&count));
|
fprintf(stderr, "KJV count: %s.\n", kjv_count_to_string(&count));
|
||||||
if(!no_total) { reason = "kjv failed to load"; goto catch; }
|
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 */
|
/* https://stackoverflow.com/a/12601553 */
|
||||||
printf("set terminal pngcairo dashed transparent truecolor"
|
printf("set terminal pngcairo dashed transparent truecolor"
|
||||||
@ -838,10 +838,10 @@ void scan_kjv_graph(struct scan *const scan) {
|
|||||||
"set output \"kjv.png\"\n");
|
"set output \"kjv.png\"\n");
|
||||||
printf("$Data <<EOD\n"
|
printf("$Data <<EOD\n"
|
||||||
"# date, verse, words, set / %zu, source\n", no_total);
|
"# date, verse, words, set / %zu, source\n", no_total);
|
||||||
while(kjvline_tree_next(&it)) {
|
while(kjv_tree_next(&it)) {
|
||||||
char citestr[12], datestr[12];
|
char citestr[12], datestr[12];
|
||||||
const union line64 line = kjvline_tree_key(&it);
|
const union line64 line = kjv_tree_key(&it);
|
||||||
const struct kjvrange *const range = kjvline_tree_value(&it);
|
const struct kjvrange *const range = kjv_tree_value(&it);
|
||||||
size_t words = 0, newwords = 0;
|
size_t words = 0, newwords = 0;
|
||||||
const struct source *src = source_lookup(scan, line);
|
const struct source *src = source_lookup(scan, line);
|
||||||
if(!src || !src->name.a) { errno = EDOM; goto catch; }
|
if(!src || !src->name.a) { errno = EDOM; goto catch; }
|
||||||
|
Loading…
Reference in New Issue
Block a user