Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
b9cb570691 | |||
1f6f226943 | |||
7f8937db55 | |||
81fc10966d |
@ -1 +1 @@
|
|||||||
../../journal/
|
../../../Documents/journal/
|
||||||
|
12
src/driver.c
12
src/driver.c
@ -46,6 +46,10 @@ int main(void) {
|
|||||||
}
|
}
|
||||||
showhelp = 0;
|
showhelp = 0;
|
||||||
|
|
||||||
|
intent = "interesting";
|
||||||
|
perror("errno");
|
||||||
|
if(errno) goto catch;
|
||||||
|
|
||||||
intent = "journal";
|
intent = "journal";
|
||||||
jrnl = journal();
|
jrnl = journal();
|
||||||
fprintf(stderr, "Journal: %s.\n", journal_to_string(&jrnl));
|
fprintf(stderr, "Journal: %s.\n", journal_to_string(&jrnl));
|
||||||
@ -64,6 +68,10 @@ int main(void) {
|
|||||||
if(!freopen(intent, "w", stdout)) goto catch;
|
if(!freopen(intent, "w", stdout)) goto catch;
|
||||||
scan_score_graph(&scn);
|
scan_score_graph(&scn);
|
||||||
|
|
||||||
|
intent = "labs.csv";
|
||||||
|
if(!freopen(intent, "w", stdout)) goto catch;
|
||||||
|
scan_labs_graph(&scn);
|
||||||
|
|
||||||
intent = "glider.gnu";
|
intent = "glider.gnu";
|
||||||
if(!freopen(intent, "w", stdout)) goto catch;
|
if(!freopen(intent, "w", stdout)) goto catch;
|
||||||
scan_glider_graph(&scn);
|
scan_glider_graph(&scn);
|
||||||
@ -84,6 +92,10 @@ int main(void) {
|
|||||||
goto finally;
|
goto finally;
|
||||||
catch:
|
catch:
|
||||||
perror(intent);
|
perror(intent);
|
||||||
|
/* Don't know if that will give real insight into the problem… */
|
||||||
|
if(freopen("error.txt", "w", stdout)) {
|
||||||
|
printf("Journal: %s.\n", journal_to_string(&jrnl));
|
||||||
|
}
|
||||||
finally:
|
finally:
|
||||||
/* fixme: ~scan should be idempotent but it's not on disabling ASLR, which
|
/* fixme: ~scan should be idempotent but it's not on disabling ASLR, which
|
||||||
debug mode is in. */
|
debug mode is in. */
|
||||||
|
@ -147,7 +147,7 @@ struct scan {
|
|||||||
} edits;
|
} edits;
|
||||||
struct linepair_tree dreams;
|
struct linepair_tree dreams;
|
||||||
struct linekvpair_tree contacts, books, tvs, movies, ideas,
|
struct linekvpair_tree contacts, books, tvs, movies, ideas,
|
||||||
vaccines, medications, mails, couches;
|
vaccines, medications, labs, mails, couches;
|
||||||
struct linekvdate_tree froms;
|
struct linekvdate_tree froms;
|
||||||
struct linekvmoney_tree taxes, incomes;
|
struct linekvmoney_tree taxes, incomes;
|
||||||
struct glider_tree gliders;
|
struct glider_tree gliders;
|
||||||
@ -159,6 +159,7 @@ void scan_(struct scan *);
|
|||||||
struct scan scan(struct journal *);
|
struct scan scan(struct journal *);
|
||||||
const struct kvpair *scan_source_lookup(struct scan *, const union line64);
|
const struct kvpair *scan_source_lookup(struct scan *, const union line64);
|
||||||
void scan_score_graph(struct scan *);
|
void scan_score_graph(struct scan *);
|
||||||
|
void scan_labs_graph(struct scan *);
|
||||||
void scan_glider_graph(struct scan *);
|
void scan_glider_graph(struct scan *);
|
||||||
void scan_flight_graph(struct scan *);
|
void scan_flight_graph(struct scan *);
|
||||||
void scan_kjv_graph(struct scan *);
|
void scan_kjv_graph(struct scan *);
|
||||||
|
@ -256,6 +256,7 @@ static int scan_day(struct scan *const scan, union date32 date,
|
|||||||
<bracket> "idea: " :=> idea
|
<bracket> "idea: " :=> idea
|
||||||
<bracket> "vaccine: " :=> vaccine
|
<bracket> "vaccine: " :=> vaccine
|
||||||
<bracket> "medication: " :=> medication
|
<bracket> "medication: " :=> medication
|
||||||
|
<bracket> "lab: " :=> lab
|
||||||
<bracket> "tax: " :=> tax
|
<bracket> "tax: " :=> tax
|
||||||
<bracket> "in: " :=> income
|
<bracket> "in: " :=> income
|
||||||
<bracket> "mail: " :=> mail
|
<bracket> "mail: " :=> mail
|
||||||
@ -436,6 +437,22 @@ static int scan_day(struct scan *const scan, union date32 date,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<lab> * { fail = "lab unrecognized"; goto catch; }
|
||||||
|
<lab> @s0 bralabel @s1 "]" => input_text {
|
||||||
|
const union line64 key = { { (uint32_t)line, date } };
|
||||||
|
struct kvpair *pair;
|
||||||
|
switch(linekvpair_tree_bulk_assign(&scan->labs, key, &pair)) {
|
||||||
|
case TREE_PRESENT: fail = "duplicate"; case TREE_ERROR: goto catch;
|
||||||
|
case TREE_ABSENT: break;
|
||||||
|
}
|
||||||
|
pair->key.a = s0, pair->key.b = s1;
|
||||||
|
pair->value.a = pair->value.b = 0;
|
||||||
|
input.future = yycnewline, input.pair = &pair->value;
|
||||||
|
fprintf(stderr, "%s:%zu: new lab <<%.*s>>.\n",
|
||||||
|
datestr, line, (int)(s1 - s0), s0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
<tax> * { fail = "tax unrecognized"; goto catch; }
|
<tax> * { fail = "tax unrecognized"; goto catch; }
|
||||||
<tax> @s0 bralabel @s1 "]" => input_money {
|
<tax> @s0 bralabel @s1 "]" => input_money {
|
||||||
const union line64 key = { { (uint32_t)line, date } };
|
const union line64 key = { { (uint32_t)line, date } };
|
||||||
@ -989,6 +1006,7 @@ void scan_(struct scan *const scan) {
|
|||||||
linekvmoney_tree_(&scan->taxes);
|
linekvmoney_tree_(&scan->taxes);
|
||||||
linekvdate_tree_(&scan->froms);
|
linekvdate_tree_(&scan->froms);
|
||||||
linekvpair_tree_(&scan->couches);
|
linekvpair_tree_(&scan->couches);
|
||||||
|
linekvpair_tree_(&scan->labs);
|
||||||
linekvpair_tree_(&scan->medications);
|
linekvpair_tree_(&scan->medications);
|
||||||
linekvpair_tree_(&scan->vaccines);
|
linekvpair_tree_(&scan->vaccines);
|
||||||
linekvpair_tree_(&scan->ideas);
|
linekvpair_tree_(&scan->ideas);
|
||||||
@ -1070,6 +1088,7 @@ struct scan scan(struct journal *const jrnl) {
|
|||||||
|| !linekvpair_tree_bulk_finish(&scan.ideas)
|
|| !linekvpair_tree_bulk_finish(&scan.ideas)
|
||||||
|| !linekvpair_tree_bulk_finish(&scan.vaccines)
|
|| !linekvpair_tree_bulk_finish(&scan.vaccines)
|
||||||
|| !linekvpair_tree_bulk_finish(&scan.medications)
|
|| !linekvpair_tree_bulk_finish(&scan.medications)
|
||||||
|
|| !linekvpair_tree_bulk_finish(&scan.labs)
|
||||||
|| !linekvpair_tree_bulk_finish(&scan.couches)
|
|| !linekvpair_tree_bulk_finish(&scan.couches)
|
||||||
|| !linekvdate_tree_bulk_finish(&scan.froms)
|
|| !linekvdate_tree_bulk_finish(&scan.froms)
|
||||||
|| !linekvmoney_tree_bulk_finish(&scan.taxes)
|
|| !linekvmoney_tree_bulk_finish(&scan.taxes)
|
||||||
@ -1193,6 +1212,27 @@ void scan_score_graph(struct scan *const scan) {
|
|||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void scan_labs_graph(struct scan *const scan) {
|
||||||
|
struct linekvpair_tree_iterator it
|
||||||
|
= linekvpair_tree_iterator(&scan->labs);
|
||||||
|
union line64 line;
|
||||||
|
struct kvpair *kv;
|
||||||
|
assert(scan);
|
||||||
|
|
||||||
|
fprintf(stderr, "*** Labs graph %s.\n",
|
||||||
|
linekvpair_tree_to_string(&scan->labs));
|
||||||
|
while(linekvpair_tree_next(&it)) {
|
||||||
|
char datestr[12];
|
||||||
|
line = linekvpair_tree_key(&it);
|
||||||
|
kv = linekvpair_tree_value(&it);
|
||||||
|
date32_to_string(line.date, &datestr);
|
||||||
|
printf("%s, \"%.*s\", \"%.*s\"\n",
|
||||||
|
datestr, (int)(kv->key.b - kv->key.a), kv->key.a,
|
||||||
|
(int)(kv->value.b - kv->value.a), kv->value.a);
|
||||||
|
}
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
void scan_glider_graph(struct scan *const scan) {
|
void scan_glider_graph(struct scan *const scan) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user