diff --git a/src/journal.re.c b/src/journal.re.c index 3993f78..d857808 100644 --- a/src/journal.re.c +++ b/src/journal.re.c @@ -145,7 +145,7 @@ struct journal journal(const char *const dir_journal) { if(closedir(dir)) { dir = 0; goto catch; } dir = 0; /* Sort the years. */ 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)); /* Go though each year. */ diff --git a/src/scan.re.c b/src/scan.re.c index 9f4fdbd..b1ebe1f 100644 --- a/src/scan.re.c +++ b/src/scan.re.c @@ -207,12 +207,12 @@ static int scan_day(struct scan *const scan, union date32 date, "->" :=> place "--" / [^-] :=> source "::" / [^:] :=> score - "[glider]" :=> glider_type - "[flight]" :=> flight_type "[" :=> bracket /* ^"[" ... */ * { fail = "bracket unrecognized"; goto catch; } + "glider] " :=> glider_type + "flight]" :=> flight_type "document: " :=> document "rem: " :=> remark "contact: " :=> contact @@ -222,6 +222,13 @@ static int scan_day(struct scan *const scan, union date32 date, "idea: " :=> idea "vaccine: " :=> vaccine "tax: " :=> tax + /* Whatsapp messages ignored. [11-03, 04:19] Contact: massage */ + [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; + } * { fail = "document title"; goto catch; } @s0 bralabel @s1 "]" => input_text { @@ -843,12 +850,8 @@ catch: } void scan_(struct scan *const scan) { - fprintf(stderr, "fixme: ~scan should be idempotent <<\n"); // now it is? if(!scan) return; - // printing it made it so? - fprintf(stderr, "~scan kjv %s\n", kjv_tree_to_string(&scan->kjvs)); kjv_tree_(&scan->kjvs); - fprintf(stderr, "~scan finished kjv\n"); flight_tree_(&scan->flights); glider_tree_(&scan->gliders); linekvmoney_tree_(&scan->taxes); @@ -858,7 +861,6 @@ void scan_(struct scan *const scan) { linekvpair_tree_(&scan->tvs); linekvpair_tree_(&scan->books); linekvpair_tree_(&scan->contacts); - fprintf(stderr, "~scan finished linekvpair\n"); linemap_tree_(&scan->scores.dates); pair_map_table_(&scan->scores.map); @@ -879,7 +881,6 @@ void scan_(struct scan *const scan) { linemap_tree_(&scan->sources.dates); pair_map_table_(&scan->sources.map); kvpair_array_(&scan->sources.array); - fprintf(stderr, "~scan finish >>\n"); } /** @param[jrnl] Must be constant throughout the use of the returned value. */ diff --git a/src/tree.h b/src/tree.h index 6d4c30c..0675ebd 100644 --- a/src/tree.h +++ b/src/tree.h @@ -245,7 +245,7 @@ static int PB_(next)(struct PB_(iterator) *const it) { assert(it && it->root); /* 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. */ if(!it->ref.node) { @@ -292,7 +292,7 @@ static int PB_(previous)(struct PB_(iterator) *const it) { assert(it && it->root); /* 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. */ if(!it->ref.node) {