scan faults.
This commit is contained in:
parent
78ff7dca30
commit
d6c1b22b5d
3
Makefile
3
Makefile
|
@ -30,7 +30,7 @@ else
|
||||||
CF += -g
|
CF += -g
|
||||||
endif
|
endif
|
||||||
|
|
||||||
projects := bin/test-text bin/test-journal bin/test-source bin/test-kjv bin/kjv bin/flight bin/score
|
projects := bin/test-text bin/test-journal bin/test-source bin/test-kjv bin/kjv bin/flight bin/score bin/scan
|
||||||
#docs := $(patsubst test/test_%.c, doc/%.md, $(wildcard test/test_*.c))
|
#docs := $(patsubst test/test_%.c, doc/%.md, $(wildcard test/test_*.c))
|
||||||
|
|
||||||
default: $(projects)
|
default: $(projects)
|
||||||
|
@ -43,6 +43,7 @@ bin/test-kjv: build/text.o build/pair.o build/kjvcite.o build/test_kjv.o
|
||||||
bin/kjv: build/text.o build/pair.o build/journal.o build/kjvcite.o build/kjv.o build/source.o
|
bin/kjv: build/text.o build/pair.o build/journal.o build/kjvcite.o build/kjv.o build/source.o
|
||||||
bin/flight: build/text.o build/pair.o build/journal.o build/source.o build/flights.o build/flighthours.o
|
bin/flight: build/text.o build/pair.o build/journal.o build/source.o build/flights.o build/flighthours.o
|
||||||
bin/score: build/text.o build/pair.o build/journal.o build/scores.o
|
bin/score: build/text.o build/pair.o build/journal.o build/scores.o
|
||||||
|
bin/scan: build/text.o build/journal.o build/pair.o build/driver.o
|
||||||
|
|
||||||
bin/%:
|
bin/%:
|
||||||
@echo "\033[1;36mlinking $@\033[0m"
|
@echo "\033[1;36mlinking $@\033[0m"
|
||||||
|
|
37
language.txt
37
language.txt
|
@ -1,15 +1,10 @@
|
||||||
!checked off
|
__lines__
|
||||||
^crossed off
|
|
||||||
1. Numbered list
|
|
||||||
* Unordered list
|
|
||||||
--label: string
|
--label: string
|
||||||
--label
|
--label
|
||||||
# heading
|
|
||||||
->(#,#) label
|
->(#,#) label
|
||||||
->label
|
->label
|
||||||
[ed: date] string
|
[ed: date] string
|
||||||
[contact: label] string
|
[contact: label] string
|
||||||
[medical]
|
|
||||||
[book: title] string
|
[book: title] string
|
||||||
[tv: label] string
|
[tv: label] string
|
||||||
[movie: label] string
|
[movie: label] string
|
||||||
|
@ -17,22 +12,20 @@
|
||||||
[vaccine: label] string
|
[vaccine: label] string
|
||||||
[in: amount] string
|
[in: amount] string
|
||||||
[flight] type; regn; apt1 -- apt2; pic1; pic2; dual; solo; ; ;
|
[flight] type; regn; apt1 -- apt2; pic1; pic2; dual; solo; ; ;
|
||||||
|
[gliding] ...
|
||||||
[cra: line] amount
|
[cra: line] amount
|
||||||
[idea: string] string
|
[idea: string] string
|
||||||
|
[document: label] string
|
||||||
Whatsapp:
|
[mail: string] string
|
||||||
[DD-DD, DD:DD] name: message
|
|
||||||
|
|
||||||
string <<
|
|
||||||
free
|
|
||||||
>>
|
|
||||||
|
|
||||||
[document: label] <<
|
|
||||||
free
|
|
||||||
>>
|
|
||||||
|
|
||||||
[mail: string] <<
|
|
||||||
free
|
|
||||||
>>
|
|
||||||
|
|
||||||
Bible 1:1 -- ignored
|
Bible 1:1 -- ignored
|
||||||
|
[DD-DD, DD:DD] name: message (Whatsapp)
|
||||||
|
!checked off
|
||||||
|
^crossed off
|
||||||
|
<-[[Y-]MM-]DD
|
||||||
|
[[Y-]MM-]DD->
|
||||||
|
1. Numbered list
|
||||||
|
* Unordered list
|
||||||
|
# Heading
|
||||||
|
|
||||||
|
__tags__
|
||||||
|
...<medical>...
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
/** @license 2023 Neil Edelman, distributed under the terms of the
|
||||||
|
[MIT License](https://opensource.org/licenses/MIT).
|
||||||
|
|
||||||
|
Scan source files for meanings.
|
||||||
|
|
||||||
|
@std C99 */
|
||||||
|
|
||||||
|
#include "journal.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
const char *fail = 0;
|
||||||
|
struct journal jrnl = {0};
|
||||||
|
errno = 0;
|
||||||
|
|
||||||
|
jrnl = journal("../journal");
|
||||||
|
fprintf(stderr, "Journal: %s.\n", journal_to_string(&jrnl));
|
||||||
|
if(errno) goto catch;
|
||||||
|
|
||||||
|
goto finally;
|
||||||
|
catch:
|
||||||
|
if(!fail) fail = "scan";
|
||||||
|
perror(fail);
|
||||||
|
finally:
|
||||||
|
journal_(&jrnl);
|
||||||
|
return fail ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||||
|
}
|
|
@ -44,8 +44,10 @@ static void int_to_string(const int *const n, char (*const a)[12])
|
||||||
#define ARRAY_TYPE int
|
#define ARRAY_TYPE int
|
||||||
#define ARRAY_TO_STRING
|
#define ARRAY_TO_STRING
|
||||||
#include "../src/array.h"
|
#include "../src/array.h"
|
||||||
|
/** Comparator of `a`, `b`. */
|
||||||
static int int_cmp(const int *const a, const int *const b)
|
static int int_cmp(const int *const a, const int *const b)
|
||||||
{ return (*b < *a) - (*a < *b); }
|
{ return (*b < *a) - (*a < *b); }
|
||||||
|
/** For `qsort`. */
|
||||||
static int void_int_cmp(const void *const a, const void *const b)
|
static int void_int_cmp(const void *const a, const void *const b)
|
||||||
{ return int_cmp(a, b); }
|
{ return int_cmp(a, b); }
|
||||||
|
|
||||||
|
@ -211,14 +213,8 @@ struct journal journal(const char *const dir_journal) {
|
||||||
/* Structure is now stable because we aren't going to move it;
|
/* Structure is now stable because we aren't going to move it;
|
||||||
convert all of offsets back to pointers. */
|
convert all of offsets back to pointers. */
|
||||||
it = day_tree_iterator(&j.days);
|
it = day_tree_iterator(&j.days);
|
||||||
while(day_tree_next(&it)) {
|
while(day_tree_next(&it))
|
||||||
v.text = day_tree_value(&it);
|
*(v.text = day_tree_value(&it)) = j.backing.data + *v.offset;
|
||||||
/*printf("[%zu]...", *v.offset);*/
|
|
||||||
*v.text = j.backing.data + *v.offset;
|
|
||||||
/*printf("<%.32s>\n", *v.text);*/
|
|
||||||
}
|
|
||||||
/*fprintf(stderr, "Journal has entries: %s\n",
|
|
||||||
day_tree_to_string(&j.days));*/
|
|
||||||
goto finally;
|
goto finally;
|
||||||
catch:
|
catch:
|
||||||
fprintf(stderr, "On date: %s/%d-%.2d-%.2d.\n",
|
fprintf(stderr, "On date: %s/%d-%.2d-%.2d.\n",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @license 2023 Neil Edelman, distributed under the terms of the
|
/** @license 2023 Neil Edelman, distributed under the terms of the
|
||||||
[MIT License](https://opensource.org/licenses/MIT).
|
[MIT License](https://opensource.org/licenses/MIT).
|
||||||
|
|
||||||
A `pair` is `[a, b)` pair of pointers to char.
|
A `pair` is `[a, b)` pair of pointers to char. Used in most string parsing.
|
||||||
|
|
||||||
@std C99 */
|
@std C99 */
|
||||||
|
|
||||||
|
@ -10,9 +10,10 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
/** @return Constructs `a` and `b` as a pair. */
|
/** @return Constructs `a` and `b` as a pair [or else (0,0)?]. */
|
||||||
struct pair pair(const char *const a, const char *const b) {
|
struct pair pair(const char *const a, const char *const b) {
|
||||||
struct pair p;
|
struct pair p;
|
||||||
|
assert(a && a <= b);
|
||||||
p.a = a, p.b = b;
|
p.a = a, p.b = b;
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue