ecs/sized-world
sized-defworld macro for bounded-capacity worlds.
Since: E2c slice 3 -- see docs/upcoming/ecs-sized-world-plan.md.
WorldState
(WorldState)
opaque handle to a sized world's malloc'd control block
Since: RE0
sized-state-new
(sized-state-new [k : int] :)
allocate a state cell with capacity k.
sized-state-free
(sized-state-free [s : WorldState] :)
release a state cell.
sized-live
(sized-live [s : WorldState])
read the world's current live count from the
sized-cap
(sized-cap [s : WorldState])
read the world's static capacity from the state cell.
sized-state-copy-into
(sized-state-copy-into [src : WorldState dst : WorldState] :)
copy `src`'s generation array + counters
Since: E2c slice 11
sized-spawn!
(sized-spawn! [s : WorldState] :)
allocate a fresh `Entity` and return its packed
Since: E2c slice 4 (panicking spawn over bare slot int);
sized-slot-generation
(sized-slot-generation [s : WorldState slot : Slot])
read the current generation counter
Since: E2c slice 4c
sized-alive?
(sized-alive? [s : WorldState e : Entity])
is the Entity handle `e` still valid against
Since: E2c slice 4c
WorldFull
(WorldFull)
the err-arm marker for `sized-spawn`. A payload-less
Since: E2c slice 12
sized-spawn
(sized-spawn [s : WorldState] :)
fallible counterpart of `sized-spawn!`. Allocates a
Since: E2c slice 12
sized-despawn
(sized-despawn [s : WorldState e : Entity] :)
free the slot named by Entity `e` for reuse,
Since: E2c slice 4 (signature-only); slice 4b (free-list reuse);
sized-defworld-mono
(sized-defworld-mono [name cap-expr comps])
declare a bounded-capacity world type with
Since: E2c slice 10
sized-defcomponent-accessors-mono
(sized-defcomponent-accessors-mono [world-name comp-name])
emit cap-gated
Since: E2c slice 10
sized-defworld
(sized-defworld [name comps])
declare a bounded-capacity world type `(Name n)`.
Since: E2c slice 3 (1..4 components); slice 3b (variadic, uncapped arity)
sized-defworld-copy-into
(sized-defworld-copy-into [name comps])
emit a per-world slot-preserving copy
Since: E2c slice 11
sized-defworld-world-resize
(sized-defworld-world-resize [name])
emit a per-world `world-resize-<Name>`
Since: E2c slice 11 follow-up (world-resize existential wrapper);
sized-defcomponent-accessors
(sized-defcomponent-accessors [world-name comp-name])
emit cap-gated
Since: E2c slice 7
sized-defsystem
(sized-defsystem [name world-name reads-vec writes-vec body])
declare a typed sized-world system body with
Since: E2c slice 8
sized-defsystem-scheduled
(sized-defsystem-scheduled [name world-name reads-vec writes-vec body])
declare a monomorphic sized-world
(sized-defworld-mono GameWorld (Static 8) [Pos Hp])
(sized-defcomponent-accessors-mono GameWorld Pos)
;; box-GameWorld / load-GameWorld / free-GameWorld-box defined here ...
(def Pos-cid 0)
(sized-defsystem-scheduled physics GameWorld [Pos] [Pos]
(set-Pos! Pos-write-cap w 0 (:: 42 :Pos)))
;; ... stage-add! stage physics ...
Since: E2c sized-scheduler wiring (direction 1)
Internal definitions
worldstate->int-- recover the raw carrier behind a `WorldState`, for__sized-state-new-raw__sized-state-free-raw__sized-state-try-spawn-raw__sized-state-copy-into-raw-- Copy the gens / next / live counters from `src` into `dst` andsized-gen-of-- read the current generation counter for `slot` out of__sized-state-copy-abort-raw__sized-spawn-bang-abort-raw__sized-spawn-ok__sized-spawn-err__sized-despawn-rawsized-world-fields-- expand a component vector into the flatsized-ctor-args-- expand a component vector into the per-componentsized-mono-world-fields-- like `sized-world-fields` but emitssized-mono-ctor-args-- the monomorphic counterpart ofsized-copy-component-body-- recursive helper for