From 42fd9a69fa2bc9ef11c65c169a58ff40c9cb0fa1 Mon Sep 17 00:00:00 2001 From: lectio Date: Tue, 28 Jul 2026 22:07:21 +0200 Subject: clectio: tiny suckless C daily readings, all readings compiled in clectio prints the Catholic liturgical day and its Mass readings for a date with a single table lookup -- no computation, config file, network, or deps beyond libc. The calendar, reading citations and scripture text are all compiled in; the whole shipped package fits on a 1.44 MB floppy (~1.29 MiB) and the binary is ~0.9 MB (OF) / ~0.3 MB (EF). - suckless config.h: FORM_OF/FORM_EF, SIGLA_ENGLISH/SIGLA_LATIN, COLOR. - Bring your own Bible: `make CORPUS=mybible.tsv` recompiles with any Vulgate-numbered 6-column TSV; only the ~12k cited verses are embedded. - The hard liturgical logic stays in lectio (Go, oracle-validated); its clectio-gen emits the corpus-independent tables in gen/. The scripture text is LZSS-packed (lz.h) to fit; mktext/bin2h resolve+embed it at build time. - Verified byte-identical to lectio's readings; day names match 157/157 over a 3-year sample. Default text: public-domain Latin Vulgate. ISC-licensed. Claude-Session: https://claude.ai/code/session_01S1CD1u3tgSS4xNu6WHfp5a --- bin2h.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 bin2h.c (limited to 'bin2h.c') diff --git a/bin2h.c b/bin2h.c new file mode 100644 index 0000000..dbbfa42 --- /dev/null +++ b/bin2h.c @@ -0,0 +1,22 @@ +/* bin2h -- embed a binary file as the C array clectio compiles in. + * usage: bin2h > text.lz.h (public domain) */ +#include + +int main(int argc, char **argv) { + FILE *f; + int c, n = 0; + if (argc != 2 || !(f = fopen(argv[1], "rb"))) { + fprintf(stderr, "usage: bin2h > out.h\n"); + return 1; + } + printf("static const unsigned char text_lz[] = {"); + while ((c = fgetc(f)) != EOF) { + if (n % 20 == 0) + printf("\n\t"); + printf("%d,", c); + n++; + } + printf("\n};\nstatic const unsigned text_lz_len = %d;\n", n); + fclose(f); + return 0; +} -- cgit v1.3