diff options
| author | eunhhu <[email protected]> | 2026-09-30 16:16:08 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-30 16:16:08 +0100 |
| commit | 46c303a41e9dd9cd0e6bd50511e8d7253a0ef438 (patch) | |
| tree | 7564bf80ac43ff0964c64acd6a15f7299fa48997 /core/module-save.h | |
| parent | e02bfc916743a0327d76144b32b6ec6381e5907f (diff) | |
| download | pure-46c303a41e9dd9cd0e6bd50511e8d7253a0ef438.tar.gz pure-46c303a41e9dd9cd0e6bd50511e8d7253a0ef438.zip | |
Give i64 its own type in modules, lists, stores and the host (016 stage 2)
An i64 is an int64_t in a value's 8 bytes, its own stack type: CONST and
NUM_TEXT take argument 2 for one, eleven opcodes are appended (ADD, SUB
and MUL fail as overflow past its range, DIV and MOD floor and fail as
divide by zero, NEG, COMPARE with a relation, MIN, MAX, and I64_FROM and
NUM_FROM, which convert only where the value fits and else fail as
limit), and moves (LOAD, STORE, locals, items, FIELD, SEND) copy it as
they copy a number. Type codes: state 6, record field 3, message field 7
(8 bytes), view 4, local 3. v6 stays: all of it is added.
- Folds with PURE_FOLD_INTEGER sum (overflow fails), keep the most or
least of, or count the different i64s; distinct's set keeps an i64's
-1 apart from its free mark. Blocks with an i64 run item by item.
- A list's kinds are its stored header's (number, text, bytes, bool,
integer): integer columns are int64_t, ordered as integers as keys
(found without guide keys for now), stored in 8 bytes and logged as
zigzag varints of any size. Records name their fields' type in one
array (record_field_type) in place of text and bool flags.
- A number, a bool and an i64 carry over each other by one rule,
pure_cell_as, wherever one becomes another: a module replaced, a stored
value or item read by another module, a waiting send recast. A u32
field delivers to an i64 one.
- The host reads i64 fields from JSON, rows and queries as integer digits
in range and nothing else, and shows every digit in views, tables,
deliveries and pure-run. Faults are named by one function,
pure_fault_name, in place of three tables; overflow is new.
test-module: 28 arithmetic cases at the range's ends, relations,
conversions both ways, 14 refusals, a keyed i64 list app (order, a sum
that overflows, a failed add undone, messages and sends of 8 bytes, every
digit as text), recasts, replacement between numbers, bools and i64s, and
three stored runs against memory with restarts (46 images written).
Diffstat (limited to 'core/module-save.h')
| -rw-r--r-- | core/module-save.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/core/module-save.h b/core/module-save.h index 991c498..5c81504 100644 --- a/core/module-save.h +++ b/core/module-save.h @@ -74,14 +74,12 @@ uint32_t pure_fields_lay_out(PureField *fields, uint32_t count); PureResult pure_send_recast(const PureField *from, uint32_t from_count, const PureField *to, uint32_t to_count, PureSpan payload, unsigned char **out, size_t *size); -/* A record field's kind as a stored list names it: 0 a number, 1 a text, 3 - * a bool (2 is a runtime list's bytes); a list holds a bool as a number. */ -enum { PURE_RECORD_BOOL = 3 }; +/* A record field's kind in a list, as a stored list names it too (PURE_CELL_...). */ uint8_t pure_record_kind(const PureModule *, uint32_t field); /* A list with record's fields, taking from `from` (its fields' names and - * kinds) each field of the same name and kind, or a number and a bool from - * each other (0 and 1 are false and true; a bool's other numbers take the - * default), and giving the others their defaults (module.c). */ + * kinds) each field of the same name and kind, or a number, a bool and an + * i64 from each other when the value fits (pure_cell_as), and giving the + * others their defaults (module.c). */ PureResult pure_list_migrate(PureList **out, const PureList *from, const char *const *names, const uint8_t *kinds, unsigned count, const PureModule *m, uint32_t record); #endif |
