1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-03 07:24:58 +03:00
inform7/inter/pipeline-module/Chapter 5/Instances.w
2022-03-01 00:41:22 +00:00

46 lines
1.7 KiB
OpenEdge ABL

[SynopticInstances::] Instances.
To compile the main/synoptic/instances submodule.
@ Our inventory |inv| already contains a list |inv->instance_nodes| of all packages
in the tree with type |_instance|.
For the moment, at least, it seems too ambitious to dynamically renumber instances
in the linking stage. Until then, this section is something of a placeholder,
making only a debugging function.
=
void SynopticInstances::compile(inter_tree *I, pipeline_step *step, tree_inventory *inv) {
if (InterNodeList::array_len(inv->instance_nodes) > 0)
InterNodeList::array_sort(inv->instance_nodes, MakeSynopticModuleStage::module_order);
@<Define SHOWMEINSTANCEDETAILS function@>;
}
@<Define SHOWMEINSTANCEDETAILS function@> =
inter_name *iname = HierarchyLocations::iname(I, SHOWMEINSTANCEDETAILS_HL);
Synoptic::begin_function(I, iname);
inter_symbol *which_s = Synoptic::local(I, I"which", NULL);
inter_symbol *na_s = Synoptic::local(I, I"na", NULL);
inter_symbol *t_0_s = Synoptic::local(I, I"t_0", NULL);
for (int i=0; i<InterNodeList::array_len(inv->instance_nodes); i++) {
inter_package *pack = PackageInstruction::at_this_head(inv->instance_nodes->list[i].node);
inter_symbol *showme_s = Metadata::optional_symbol(pack, I"^showme_fn");
if (showme_s) {
Produce::inv_primitive(I, STORE_BIP);
Produce::down(I);
Produce::ref_symbol(I, K_value, na_s);
Produce::inv_call_symbol(I, showme_s);
Produce::down(I);
Produce::val_symbol(I, K_value, which_s);
Produce::val_symbol(I, K_value, na_s);
Produce::val_symbol(I, K_value, t_0_s);
Produce::up(I);
Produce::up(I);
}
}
Produce::inv_primitive(I, RETURN_BIP);
Produce::down(I);
Produce::val_symbol(I, K_value, na_s);
Produce::up(I);
Synoptic::end_function(I, step, iname);