#ifndef DECK_READING_IO_H #define DECK_READING_IO_H #include #include /* Header-only dependency on the engine, same policy as significance.h - * see its comment for why. */ #include "../../engine/src/reading.h" /* Parses deck-engine's `--format json` output (text, null-terminated at * text[length]) and fills *out with just enough of a DailyReading for * interpret_daily_reading() to work on, for reporting sign/house context * around each significant event, and for guidance_print()'s tarot * framing: out->transits.aspects[]/aspect_count (used for scoring - see * significance.c), out->natal.bodies[]/out->transits.bodies[] (sign + * house per body, used only for display), out->spread.positions[] * (card + reversed per Celtic Cross position, used only by * guidance.c), out->utc_moment (the top-level "date" field, parsed * back to midnight UTC of that date - used only for display, e.g. main.c * printing which day a reading is for), and out->gender (the top-level * "gender" field - used only for the Celtic Cross position text's * pronouns, e.g. tarot_position_name()/tarot_position_description()). * out->natal.ascendant_longitude/houses[] are left zeroed - nothing * reads them yet. * * Returns false on malformed JSON, or if "transits"."aspects" isn't * present as an array (an empty array is fine - that's a real "no * aspects today" reading, not an error). A missing/unrecognized entry in * "natal"."bodies"/"transits"."bodies"/"spread"."positions", or a * missing "spread" key entirely, is not an error - see parse_bodies()/ * parse_spread() in reading_io.c. */ bool reading_load_json(const char *text, size_t length, DailyReading *out); #endif