aboutsummaryrefslogtreecommitdiff
path: root/clectio.c
Commit message (Collapse)AuthorAgeFilesLines
* fix: EF crashed on 1246 of the 10957 dates in rangeHEADmainLukasz Kasprzak2026-08-181-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gen/liturgy_ef.h was regenerated in an earlier session without refreshing gen/verses_ef.keys.gz, which is what the Makefile actually packs the text from. The tables indexed 3584 verses; the packed text held 3248. print_day then read verse[i] past the end and dereferenced NULL. Reproduced against the fully committed tree with a plain make: 1246 of 10957 EF dates exit 139. Heavily clustered in Advent and December -- 30 of 30 years for each of 11-30, 12-03, 12-05, 12-06, 12-09, 12-10, 12-12, 12-21 through 12-25. OF swept clean, 0 of 10957. Three changes: - gen/ regenerated against lectio HEAD with keys and tables in step (3584 both), and text_ef.lz repacked from the same keys. - clectio.c records how many verses the packed text holds and prints "[verse text missing]" rather than reading past it. Missing text is a visible gap now, never a crash. Proved by rebuilding against the stale keys: 1246 crashes -> 0, placeholder shown. - upstream, lectio's clectio-gen now writes the .gz alongside the plain keys, so the two cannot drift again. The regenerated tables also carry two EF calendar corrections colitur argued from the 1962 Missal and lectio adopted: the Holy Family propers' 13-January omission of the Baptism, and RG 96(a)/97/98 transfers, which put St Joseph back on 2035-04-03 and 2046-04-03 (he was observed on no day of those years). Distinct days 656 -> 642: the ferias between Epiphany and the Sunday after it now repeat Epiphany's own Mass instead of each carrying a distinct one. Swept after the fix: EF 0 crashes, OF 0 crashes. Readings compared against lectio across 2030/2035/2046 (1095 days): no divergence beyond each project's own book abbreviations.
* reader: verse number in a left column, hang-indent wrapped textv1.0Lukasz Kasprzak2026-07-301-12/+38
| | | | | | | | putwrapped now peels the leading chap:verse token into a fixed VNUM-wide column (new config knob, default 8) and hang-indents continuation lines under the text, so the reading has a straight left margin instead of wrapping flush to column 0. Verses without a numeric prefix still wrap flush-left; the WRAP<=0 (terminal-fit) path is unchanged.
* license: relicense clectio's own code under GPL-3.0-or-laterLukasz Kasprzak2026-07-291-2/+9
| | | | | | | | | | | | | | | | | | | | Replace the ISC licence with GPL-3.0-or-later (Łukasz Kasprzak is sole copyright holder, so relicensing is unencumbered): - LICENSE: verbatim GNU GPL v3 text. - Add "Copyright (C) 2026 Łukasz Kasprzak. SPDX-License-Identifier: GPL-3.0-or-later" headers to the project-authored sources (clectio.c with the full grant, plus mktext.c and bin2h.c), replacing their old public-domain notes. - puff.c/.h keep Mark Adler's public-domain notice unchanged: third-party, not ours to relicense, and public domain is GPL-compatible. - README and man page LICENSE sections updated to GPL-3.0-or-later, noting puff's PD status; the scripture-text carve-out (Vulgate public domain, corpora under their own terms) is preserved. Code/comment change only; builds clean under -Wall -Wextra. Claude-Session: https://claude.ai/code/session_01S1CD1u3tgSS4xNu6WHfp5a
* feat: standalone calendar overrides (calendar.h) + document customizationLukasz Kasprzak2026-07-291-7/+28
| | | | | | | | | | | | | | | | | | | | Add a compile-time override table for MINOR local calendar changes, standalone (no lectio, no toolchain): edit calendar.h (copied from calendar.def.h), add a { month, day, colour, "name" } row, make. It replaces a fixed date's name and colour, every year, in both single-day and --month output. Limits (no engine): fixed dates only; name/colour only, not readings or rank/precedence; an override wins unconditionally. README gains a "Customize the calendar" section documenting both tiers with their limits: the standalone override above, and -- for readings, ranks and movable feasts -- regenerating gen/ from a lectio calendar layer via clectio-gen (-caldir/-use), then rebuilding with CORPUS= to repack any newly cited verses, with a git-checkout revert note. Both forms build clean under -Wall -Wextra; binary unchanged at 666 KB; default (empty override table) output is unchanged. Claude-Session: https://claude.ai/code/session_01S1CD1u3tgSS4xNu6WHfp5a
* feat: --month [YYYY-MM | N] month overviewLukasz Kasprzak2026-07-291-1/+66
| | | | | | | | | | | | | | List a whole month, one line per day: weekday, day, liturgical colour and celebration name. Form-aware; colours the name on a tty and prints the colour word (aligned column) always, so a piped file stays readable. Defaults to the current month; accepts YYYY-MM or a bare month number (current year). Needs no scripture text, so it never loads or decompresses the text blob. Days-in-month and weekday are computed with days_from_civil (leap-correct); a month outside the compiled range is reported, not guessed. No table/data change; OF and EF build clean under -Wall -Wextra; binary unchanged at 666 KB. Claude-Session: https://claude.ai/code/session_01S1CD1u3tgSS4xNu6WHfp5a
* feat: -a/-g runtime reading toggle and WRAP config optionLukasz Kasprzak2026-07-291-15/+85
| | | | | | | | | | | | | | | | - -a/--all and -g/--gospel override the compiled GOSPEL_ONLY default per run; the reading text for both is always embedded, so this is free. Flags may appear in any position alongside the optional date. - WRAP config.h option wraps reading text at N columns; 0 (default) fits the terminal via TIOCGWINSZ and leaves piped output one line per verse. Greedy, space-breaking, UTF-8 aware (continuation bytes do not count as columns). - Rework arg parsing into a small flag loop; expand -h usage. No table/data change; OF and EF both build clean under -Wall -Wextra. Binary grows ~4 KB (666 KB OF). Stays compile-time-first, suckless-style: the only run-time options are the reading-set toggle and -h. Claude-Session: https://claude.ai/code/session_01S1CD1u3tgSS4xNu6WHfp5a
* perf: DEFLATE (puff) + -no-pie -> OF binary 879 KB -> 662 KB (-25%)Lukasz Kasprzak2026-07-291-6/+7
| | | | | | | | | | | | | | | | | | | | | Two size wins: - Replace the home-grown LZSS (2.0x) with DEFLATE: mktext gzips the text and strips the gzip container to a raw DEFLATE stream; clectio decompresses it with puff, Mark Adler's public-domain reference inflate (~200 lines, verified byte-identical to gunzip on the OF/EF text, repetitive, random and empty inputs). Text blob 671 KB -> 492 KB (OF), 164 KB -> 132 KB (EF), 2.7x. - Build with -no-pie: clectio is a local CLI reading static embedded data with no attack surface, so it needs no PIE/ASLR. The linker then bakes the string- table pointers in at link time instead of emitting ~57 KB of runtime relocations. Net: OF 879 -> 662 KB, EF 266 -> 214 KB. Verified byte-identical to lectio. The default build still needs only a compiler + libc; a CORPUS= rebuild now also needs gzip. lz.h removed. Claude-Session: https://claude.ai/code/session_01S1CD1u3tgSS4xNu6WHfp5a
* feat: config.h GOSPEL_ONLY -- print all readings (default) or just the GospelLukasz Kasprzak2026-07-281-6/+11
| | | | | | | | | | | Add a compile-time toggle in config.h: GOSPEL_ONLY=0 (default) prints every reading; GOSPEL_ONLY=1 prints only the Gospel. The Gospel is matched by its part label, so it works for both forms. Help and the compiled-settings line report the mode. Also tidy print_day's header underline to match the width of the "<form> for <date>" line instead of the reading count. No data change; strict -Wsign-conversion clean in both modes. Claude-Session: https://claude.ai/code/session_01S1CD1u3tgSS4xNu6WHfp5a
* clean: silence strict -Wsign-conversion / -Wunused-functionLukasz Kasprzak2026-07-281-1/+1
| | | | | | | | | | | Make the build clean under -Wconversion -Wsign-conversion and -Wunused-function (beyond the Makefile's -Wall -Wextra), so it compiles warning-free on stricter setups and other compilers: size_t for the verse-index counters in load_text, a cast in the LZSS matcher, and lz_unpack marked inline (it is unused in the packer-only mktext translation unit). No behaviour change; packed output is byte-identical. Claude-Session: https://claude.ai/code/session_01S1CD1u3tgSS4xNu6WHfp5a
* clectio: tiny suckless C daily readings, all readings compiled inlectio2026-07-281-0/+127
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