aboutsummaryrefslogtreecommitdiffstats
path: root/core/module.h
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-28 05:01:23 +0100
committereunhhu <[email protected]>2026-09-28 05:01:23 +0100
commit15f0114d6a7da0a4f63028db12cac62c5f9cc922 (patch)
tree0d896ddd1d2925a716c2a08a706f8a0f74f35c40 /core/module.h
parentadc4e5724c926cac4ecb8dc3a58a5f9b4d1b9b81 (diff)
downloadpure-15f0114d6a7da0a4f63028db12cac62c5f9cc922.tar.gz
pure-15f0114d6a7da0a4f63028db12cac62c5f9cc922.zip
Give an event locals
LOCAL_LOAD and LOCAL_STORE name one of an event's 64 slots, what it holds (a number, or an index of a list) and that list: slots start at 0 when an event begins, are shared by its handlers, the walks in them and the folds in those, and are never saved nor in the states' namespace. A handler uses a slot for one thing, so its type is verified as a state's is; views have no locals (IN_LOCALS: a handler's block, a walk in it, a fold in either; stores only in a handler and its walks). A fold reading a local still runs a leaf at a time (one value for every item) and a shaped fold takes one only on its key's side. The signature table's where widens to 16 bits. locals checks a handler that sums items into a local in a walk, counts in a fold the items below it, keeps an index in a local and reads it back, over 80 events against a model, and five refusals. server_rows' shop now takes stock through an index local and counts in one.
Diffstat (limited to 'core/module.h')
-rw-r--r--core/module.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/module.h b/core/module.h
index 0b20a9f..b8f8e98 100644
--- a/core/module.h
+++ b/core/module.h
@@ -39,8 +39,16 @@ typedef enum {
PURE_OP_INDEX_MOVE, PURE_OP_INDEX_FIRST, PURE_OP_INDEX_LAST, PURE_OP_INDEX_NUM, PURE_OP_ROW,
PURE_OP_PICK, PURE_OP_SLIDE, PURE_OP_FOLD, PURE_OP_TEXT_COMPARE, PURE_OP_LIST_FIND, PURE_OP_LIST_HAS,
PURE_OP_NOW, PURE_OP_FLOOR, PURE_OP_MOD, PURE_OP_SEND, PURE_OP_OUTER_ROW, PURE_OP_EACH,
+ PURE_OP_LOCAL_LOAD, PURE_OP_LOCAL_STORE,
PURE_OP_COUNT
} PureOpcode;
+/* A local: one of an event's PURE_MODULE_LOCALS slots, 0 when the event
+ * begins and never saved. LOCAL_LOAD and LOCAL_STORE name the slot (bits
+ * 0-7), what it holds (bits 8-15: 0 a number, 1 an index) and an index's
+ * list (bits 16-31); a handler uses a slot for one of them. A handler, the
+ * walks in it and the folds in those read locals; the handler and its walks
+ * store them. */
+enum { PURE_MODULE_LOCALS = 64 };
/* EACH's argument: the list state (bits 8-15) and the length of the block
* that follows (16-31), run in a handler once for every item the list had
* when it began, in order, with ROW the item; the block may change states,