brink_format/story.rs
1use crate::definition::{
2 AddressDef, AddressPath, ContainerDef, ExternalFnDef, GlobalVarDef, ListDef, ListItemDef,
3 ScopeLineTable,
4};
5use crate::value::ListValue;
6
7/// The top-level compiled story: everything the runtime needs to execute.
8#[derive(Debug, Clone, PartialEq)]
9pub struct StoryData {
10 pub containers: Vec<ContainerDef>,
11 /// Per-scope line tables. Each scope (root, knot, stitch) gets one table
12 /// shared by all containers within that scope.
13 pub line_tables: Vec<ScopeLineTable>,
14 pub variables: Vec<GlobalVarDef>,
15 pub list_defs: Vec<ListDef>,
16 pub list_items: Vec<ListItemDef>,
17 pub externals: Vec<ExternalFnDef>,
18 /// Address definitions mapping IDs to byte offsets within containers.
19 pub addresses: Vec<AddressDef>,
20 /// Qualified-path → address-target table. The single source of truth for
21 /// [`Program::find_address`](../../brink_runtime/struct.Program.html#method.find_address);
22 /// empty for legacy/converter output (the linker then falls back to
23 /// deriving scope paths from container names).
24 pub address_paths: Vec<AddressPath>,
25 /// Interned name strings, indexed by [`NameId`](crate::id::NameId).
26 pub name_table: Vec<String>,
27 /// List literal values referenced by `PushList(idx)` opcodes.
28 pub list_literals: Vec<ListValue>,
29 /// CRC-32 checksum from the `.inkb` header, used for locale validation.
30 /// Zero for stories not loaded from `.inkb`.
31 pub source_checksum: u32,
32}