skip to content
==> include/mesh/place_spec.h <==
1/* @ajax/mesh-place-spec: what a placeable program's manifest declares (manifest.rs Place): its
2 * `place` capability, the shared state regions, the frame number's offset, the output regions
3 * (part b of a frame is the b-th of `fanout` equal pieces of each) and the show region. The manifest
4 * parser fills one of these; placement (mesh-placer) moves exactly these bytes. */
5#ifndef MESH_PLACE_SPEC_H
6#define MESH_PLACE_SPEC_H
7
8#include <stddef.h>
9#include <stdint.h>
10
11/* (view offset, bytes) */
12typedef struct {
13    uint32_t off, len;
14} mps_region;
15
16typedef struct {
17    uint32_t cap;          /* PLACE_CAP_PIN / PLACE_CAP_SPLIT */
18    mps_region *state;     /* the shared state, each 4-aligned */
19    size_t nstate;
20    uint32_t frame;        /* the u32 frame number's view offset (inside a state region) */
21    mps_region *out;       /* the output regions */
22    size_t nout;
23    uint32_t show;         /* the show region's view offset (SH_*) */
24    uint32_t fanout;
25} mps_spec;
26
27mps_spec mps_new(uint32_t cap, const mps_region *state, size_t nstate, uint32_t frame, const mps_region *out, size_t nout, uint32_t show, uint32_t fanout);
28mps_spec mps_clone(const mps_spec *s);
29void mps_free(mps_spec *s);
30size_t mps_state_bytes(const mps_spec *s);
31uint32_t mps_out_bytes(const mps_spec *s);
32size_t mps_part_bytes(const mps_spec *s);
33/* Part b's (view offset, bytes) in each output region: out[0..nout). */
34void mps_part(const mps_spec *s, uint32_t b, mps_region *out);
35/* Part b's (offset, bytes) pieces within a show buffer (the output regions concatenated). */
36void mps_part_in_buffer(const mps_spec *s, uint32_t b, mps_region *out);
37
38#endif