No matching definitions.

ecs/sized-world

src/ecs/sized-world.tur

sized-defworld macro for bounded-capacity worlds.

Since: E2c slice 3 -- see docs/upcoming/ecs-sized-world-plan.md.

defopaque

WorldState

(WorldState)

opaque handle to a sized world's malloc'd control block

Since: RE0

defn

sized-state-new

(sized-state-new [k : int] :)

allocate a state cell with capacity k.

defn

sized-state-free

(sized-state-free [s : WorldState] :)

release a state cell.

defn

sized-live

(sized-live [s : WorldState])

read the world's current live count from the

defn

sized-cap

(sized-cap [s : WorldState])

read the world's static capacity from the state cell.

defn

sized-state-copy-into

(sized-state-copy-into [src : WorldState dst : WorldState] :)

copy `src`'s generation array + counters

Since: E2c slice 11

defn

sized-spawn!

(sized-spawn! [s : WorldState] :)

allocate a fresh `Entity` and return its packed

Since: E2c slice 4 (panicking spawn over bare slot int);

defn

sized-slot-generation

(sized-slot-generation [s : WorldState slot : Slot])

read the current generation counter

Since: E2c slice 4c

defn

sized-alive?

(sized-alive? [s : WorldState e : Entity])

is the Entity handle `e` still valid against

Since: E2c slice 4c

defopaque

WorldFull

(WorldFull)

the err-arm marker for `sized-spawn`. A payload-less

Since: E2c slice 12

defn

sized-spawn

(sized-spawn [s : WorldState] :)

fallible counterpart of `sized-spawn!`. Allocates a

Since: E2c slice 12

defn

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);

defmacro

sized-defworld-mono

(sized-defworld-mono [name cap-expr comps])

declare a bounded-capacity world type with

Since: E2c slice 10

defmacro

sized-defcomponent-accessors-mono

(sized-defcomponent-accessors-mono [world-name comp-name])

emit cap-gated

Since: E2c slice 10

defmacro

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)

defmacro

sized-defworld-copy-into

(sized-defworld-copy-into [name comps])

emit a per-world slot-preserving copy

Since: E2c slice 11

defmacro

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);

defmacro

sized-defcomponent-accessors

(sized-defcomponent-accessors [world-name comp-name])

emit cap-gated

Since: E2c slice 7

defmacro

sized-defsystem

(sized-defsystem [name world-name reads-vec writes-vec body])

declare a typed sized-world system body with

Since: E2c slice 8

defmacro

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` and
sized-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-raw
sized-world-fields-- expand a component vector into the flat
sized-ctor-args-- expand a component vector into the per-component
sized-mono-world-fields-- like `sized-world-fields` but emits
sized-mono-ctor-args-- the monomorphic counterpart of
sized-copy-component-body-- recursive helper for