Fixed tree iterating idle.
This commit is contained in:
parent
3e5acec91a
commit
b670e7f822
|
@ -145,7 +145,7 @@ struct journal journal(const char *const dir_journal) {
|
||||||
if(closedir(dir)) { dir = 0; goto catch; } dir = 0;
|
if(closedir(dir)) { dir = 0; goto catch; } dir = 0;
|
||||||
/* Sort the years. */
|
/* Sort the years. */
|
||||||
qsort(years.data, years.size, sizeof *years.data, &void_int_cmp);
|
qsort(years.data, years.size, sizeof *years.data, &void_int_cmp);
|
||||||
fprintf(stderr, "Years in <<%s>>: %s.\n",
|
fprintf(stderr, "Loading years in <<%s>>: %s.\n",
|
||||||
dir_journal, int_array_to_string(&years));
|
dir_journal, int_array_to_string(&years));
|
||||||
|
|
||||||
/* Go though each year. */
|
/* Go though each year. */
|
||||||
|
|
|
@ -207,12 +207,12 @@ static int scan_day(struct scan *const scan, union date32 date,
|
||||||
<line> "->" :=> place
|
<line> "->" :=> place
|
||||||
<line> "--" / [^-] :=> source
|
<line> "--" / [^-] :=> source
|
||||||
<line> "::" / [^:] :=> score
|
<line> "::" / [^:] :=> score
|
||||||
<line> "[glider]" :=> glider_type
|
|
||||||
<line> "[flight]" :=> flight_type
|
|
||||||
<line> "[" :=> bracket
|
<line> "[" :=> bracket
|
||||||
|
|
||||||
/* ^"[" ... */
|
/* ^"[" ... */
|
||||||
<bracket> * { fail = "bracket unrecognized"; goto catch; }
|
<bracket> * { fail = "bracket unrecognized"; goto catch; }
|
||||||
|
<bracket> "glider] " :=> glider_type
|
||||||
|
<bracket> "flight]" :=> flight_type
|
||||||
<bracket> "document: " :=> document
|
<bracket> "document: " :=> document
|
||||||
<bracket> "rem: " :=> remark
|
<bracket> "rem: " :=> remark
|
||||||
<bracket> "contact: " :=> contact
|
<bracket> "contact: " :=> contact
|
||||||
|
@ -222,6 +222,13 @@ static int scan_day(struct scan *const scan, union date32 date,
|
||||||
<bracket> "idea: " :=> idea
|
<bracket> "idea: " :=> idea
|
||||||
<bracket> "vaccine: " :=> vaccine
|
<bracket> "vaccine: " :=> vaccine
|
||||||
<bracket> "tax: " :=> tax
|
<bracket> "tax: " :=> tax
|
||||||
|
/* Whatsapp messages ignored. [11-03, 04:19] Contact: massage */
|
||||||
|
<bracket> [0-1][0-9] "-" [0-3][0-9] ", " [0-2][0-9] ":" [0-5][0-9] "] "
|
||||||
|
@s0 [^\x00\n:] @s1 ": " [^\x00\n] "\n" => line {
|
||||||
|
fprintf(stderr, "Whatsapp message from %.*s ignored.\n",
|
||||||
|
(int)(s1 - s0), s0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
<document> * { fail = "document title"; goto catch; }
|
<document> * { fail = "document title"; goto catch; }
|
||||||
<document> @s0 bralabel @s1 "]" => input_text {
|
<document> @s0 bralabel @s1 "]" => input_text {
|
||||||
|
@ -843,12 +850,8 @@ catch:
|
||||||
}
|
}
|
||||||
|
|
||||||
void scan_(struct scan *const scan) {
|
void scan_(struct scan *const scan) {
|
||||||
fprintf(stderr, "fixme: ~scan should be idempotent <<\n"); // now it is?
|
|
||||||
if(!scan) return;
|
if(!scan) return;
|
||||||
// printing it made it so?
|
|
||||||
fprintf(stderr, "~scan kjv %s\n", kjv_tree_to_string(&scan->kjvs));
|
|
||||||
kjv_tree_(&scan->kjvs);
|
kjv_tree_(&scan->kjvs);
|
||||||
fprintf(stderr, "~scan finished kjv\n");
|
|
||||||
flight_tree_(&scan->flights);
|
flight_tree_(&scan->flights);
|
||||||
glider_tree_(&scan->gliders);
|
glider_tree_(&scan->gliders);
|
||||||
linekvmoney_tree_(&scan->taxes);
|
linekvmoney_tree_(&scan->taxes);
|
||||||
|
@ -858,7 +861,6 @@ void scan_(struct scan *const scan) {
|
||||||
linekvpair_tree_(&scan->tvs);
|
linekvpair_tree_(&scan->tvs);
|
||||||
linekvpair_tree_(&scan->books);
|
linekvpair_tree_(&scan->books);
|
||||||
linekvpair_tree_(&scan->contacts);
|
linekvpair_tree_(&scan->contacts);
|
||||||
fprintf(stderr, "~scan finished linekvpair\n");
|
|
||||||
|
|
||||||
linemap_tree_(&scan->scores.dates);
|
linemap_tree_(&scan->scores.dates);
|
||||||
pair_map_table_(&scan->scores.map);
|
pair_map_table_(&scan->scores.map);
|
||||||
|
@ -879,7 +881,6 @@ void scan_(struct scan *const scan) {
|
||||||
linemap_tree_(&scan->sources.dates);
|
linemap_tree_(&scan->sources.dates);
|
||||||
pair_map_table_(&scan->sources.map);
|
pair_map_table_(&scan->sources.map);
|
||||||
kvpair_array_(&scan->sources.array);
|
kvpair_array_(&scan->sources.array);
|
||||||
fprintf(stderr, "~scan finish >>\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param[jrnl] Must be constant throughout the use of the returned value. */
|
/** @param[jrnl] Must be constant throughout the use of the returned value. */
|
||||||
|
|
|
@ -245,7 +245,7 @@ static int PB_(next)(struct PB_(iterator) *const it) {
|
||||||
assert(it && it->root);
|
assert(it && it->root);
|
||||||
|
|
||||||
/* Tree empty. */
|
/* Tree empty. */
|
||||||
if(!it->root->node || it->root->height == UINT_MAX) return 0;
|
if(!it->root || !it->root->node || it->root->height == UINT_MAX) return 0;
|
||||||
|
|
||||||
/* Iterator empty; tree non-empty; point at first. */
|
/* Iterator empty; tree non-empty; point at first. */
|
||||||
if(!it->ref.node) {
|
if(!it->ref.node) {
|
||||||
|
@ -292,7 +292,7 @@ static int PB_(previous)(struct PB_(iterator) *const it) {
|
||||||
assert(it && it->root);
|
assert(it && it->root);
|
||||||
|
|
||||||
/* Tree empty. */
|
/* Tree empty. */
|
||||||
if(!it->root->node || it->root->height == UINT_MAX) return 0;
|
if(!it->root || !it->root->node || it->root->height == UINT_MAX) return 0;
|
||||||
|
|
||||||
/* Iterator empty; tree non-empty; point at last. */
|
/* Iterator empty; tree non-empty; point at last. */
|
||||||
if(!it->ref.node) {
|
if(!it->ref.node) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user