diff options
| author | lectio <lukasz@arcofasiagroup.com> | 2026-07-28 22:07:21 +0200 |
|---|---|---|
| committer | lectio <lukasz@arcofasiagroup.com> | 2026-07-28 22:07:45 +0200 |
| commit | 42fd9a69fa2bc9ef11c65c169a58ff40c9cb0fa1 (patch) | |
| tree | eb135eae4d3374973c08b27956a6e067a95e56bc /bin2h.c | |
| download | clectio-42fd9a69fa2bc9ef11c65c169a58ff40c9cb0fa1.tar.gz clectio-42fd9a69fa2bc9ef11c65c169a58ff40c9cb0fa1.zip | |
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
Diffstat (limited to 'bin2h.c')
| -rw-r--r-- | bin2h.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -0,0 +1,22 @@ +/* bin2h -- embed a binary file as the C array clectio compiles in. + * usage: bin2h <file> > text.lz.h (public domain) */ +#include <stdio.h> + +int main(int argc, char **argv) { + FILE *f; + int c, n = 0; + if (argc != 2 || !(f = fopen(argv[1], "rb"))) { + fprintf(stderr, "usage: bin2h <file> > 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; +} |
