1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-08 10:04:21 +03:00
inform7/inter/pipeline-module/Chapter 5/Instances.w

46 lines
1.7 KiB
OpenEdge ABL
Raw Normal View History

[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.
=
2021-11-15 01:40:33 +02:00
void SynopticInstances::compile(inter_tree *I, pipeline_step *step, tree_inventory *inv) {
2022-02-03 01:35:38 +02:00
if (InterNodeList::array_len(inv->instance_nodes) > 0)
InterNodeList::array_sort(inv->instance_nodes, MakeSynopticModuleStage::module_order);
@<Define SHOWMEINSTANCEDETAILS function@>;
}
2021-05-06 11:59:32 +03:00
@<Define SHOWMEINSTANCEDETAILS function@> =
2022-01-16 01:49:25 +02:00
inter_name *iname = HierarchyLocations::iname(I, SHOWMEINSTANCEDETAILS_HL);
2021-05-06 11:59:32 +03:00
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);
2022-02-03 01:35:38 +02:00
for (int i=0; i<InterNodeList::array_len(inv->instance_nodes); i++) {
2022-03-01 02:41:22 +02:00
inter_package *pack = PackageInstruction::at_this_head(inv->instance_nodes->list[i].node);
inter_symbol *showme_s = Metadata::optional_symbol(pack, I"^showme_fn");
2021-05-06 11:59:32 +03:00
if (showme_s) {
Produce::inv_primitive(I, STORE_BIP);
Produce::down(I);
Produce::ref_symbol(I, K_value, na_s);
2022-01-22 18:44:52 +02:00
Produce::inv_call_symbol(I, showme_s);
2021-05-06 11:59:32 +03:00
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);
2021-11-15 01:40:33 +02:00
Synoptic::end_function(I, step, iname);