Introduces watch/, a real Pebble watchapp (built via pebble build) that
build / build (push) Successful in 30s

shows the daily tarot/astrology reading on-device: persistence, reading
computation, and UI screens, driven by the existing engine/interpreter
code linked in unchanged where possible.

Required engine-side changes to make that linking work:
- A compact low-precision ephemeris (lowprec_ephemeris.c) replacing the
  vendored ~127KB Astronomy Engine, which doesn't fit the watch's ~64KB
  app budget.
- Hand-rolled sqrt/atan2/sin/cos replacements for that ephemeris and
  astro.c's Ascendant calculation - Pebble's statically-linked libm
  hard-faults on real hardware under this app's -fPIE link for all four.
- narrative.c/guidance.c refactored from FILE*/fprintf onto snprintf-
  based buffers, since Pebble's SDK blocks fprintf at compile time.
This commit is contained in:
ml
2026-07-14 17:10:22 +02:00
parent d9b6e2889b
commit 1a654da3e9
44 changed files with 1920 additions and 182 deletions
+20 -7
View File
@@ -1,7 +1,7 @@
#ifndef DECK_GUIDANCE_H
#define DECK_GUIDANCE_H
#include <stdio.h>
#include <stddef.h>
/* Header-only dependency on the engine for struct/enum *definitions*,
* same policy as narrative.h/significance.h - see their comments for
@@ -14,6 +14,13 @@
#include "../../engine/src/tarot.h"
#include "significance.h"
/* Generous upper bound on guidance_write()'s output (intro/stance line
* + Attitude line + Outcome line, each ending in a newline, including
* the longest tarot_card_meaning() strings) across every language this
* project ships a translation for - see narrative.h's NARRATIVE_TEXT_MAX
* for the same reasoning. */
#define GUIDANCE_TEXT_MAX 1024
/* Ties the day's single most significant transit
* (interp->top_items[0]) to the Celtic Cross spread, and prints a short
* paragraph of concrete guidance on how to meet the day - the "combined
@@ -49,12 +56,18 @@
* strings) is looked up via i18n_get() under "guidance.*" keys
* (engine/i18n's .lang files) before falling back to the English text baked
* into guidance.c, so it respects whatever --lang the caller loaded
* with i18n_load() (main.c does so before calling this). The German
* guidance.intro.* templates are deliberately phrased so the planet
* name placeholder is always the sentence's grammatical subject
* (nominative case) across all four day levels - see guidance.c's own
* comment on k_intro_fallback. */
void guidance_print(FILE *out, const char *indent, const DailyInterpretation *interp,
* with i18n_load()/i18n_load_table() (main.c does so before calling
* this). The German guidance.intro.* templates are deliberately phrased
* so the planet name placeholder is always the sentence's grammatical
* subject (nominative case) across all four day levels - see
* guidance.c's own comment on k_intro_fallback.
*
* Writes into `buf` (a caller-supplied buffer of `buf_size` bytes,
* always left null-terminated - GUIDANCE_TEXT_MAX is a safe size)
* instead of a FILE*, using only snprintf() internally (never
* fprintf/sprintf/vsnprintf, all of which Pebble's SDK blocks at compile
* time), so this function links into the watch app unchanged. */
void guidance_write(char *buf, size_t buf_size, const char *indent, const DailyInterpretation *interp,
const CelticCrossSpread *spread);
#endif