mirror of
https://github.com/ganelson/inform.git
synced 2024-07-16 22:14:23 +03:00
50 lines
1.7 KiB
OpenEdge ABL
50 lines
1.7 KiB
OpenEdge ABL
[CodeGen::LinkInstructions::] Link Instructions.
|
|
|
|
Inter often needs to assimilate or otherwise deal with architecture-neutral
|
|
kits of linkable material, and this is where such requirements are noted.
|
|
|
|
@h
|
|
|
|
=
|
|
typedef struct link_instruction {
|
|
struct pathname *location;
|
|
struct text_stream *attachment_point;
|
|
CLASS_DEFINITION
|
|
} link_instruction;
|
|
|
|
link_instruction *CodeGen::LinkInstructions::new(pathname *P, text_stream *attach) {
|
|
link_instruction *link = CREATE(link_instruction);
|
|
link->location = P;
|
|
link->attachment_point = Str::duplicate(attach);
|
|
return link;
|
|
}
|
|
|
|
@h Link stage.
|
|
|
|
=
|
|
void CodeGen::LinkInstructions::create_pipeline_stage(void) {
|
|
CodeGen::Stage::new(I"link", CodeGen::LinkInstructions::run_link_stage, NO_STAGE_ARG, FALSE);
|
|
}
|
|
|
|
int CodeGen::LinkInstructions::run_link_stage(pipeline_step *step) {
|
|
link_instruction *req;
|
|
LOOP_OVER_LINKED_LIST(req, link_instruction, step->requirements_list) {
|
|
inter_architecture *A = CodeGen::Architecture::current();
|
|
if (A == NULL) Errors::fatal("no -architecture given");
|
|
filename *arch_file = Architectures::canonical_binary(req->location, A);
|
|
if (TextFiles::exists(arch_file) == FALSE) internal_error("no arch file for requirement");
|
|
|
|
inter_tree *sidecar = InterTree::new();
|
|
if (Inter::Binary::test_file(arch_file)) Inter::Binary::read(sidecar, arch_file);
|
|
else Inter::Textual::read(sidecar, arch_file);
|
|
|
|
inter_package *pack = Inter::Packages::by_url(sidecar, req->attachment_point);
|
|
if (pack == NULL) {
|
|
WRITE_TO(STDERR, "sought attachment material at: %S in %f\n", req->attachment_point, arch_file);
|
|
internal_error("unable to find attachment point package");
|
|
}
|
|
Inter::Transmigration::move(pack, Site::main_package(step->repository), FALSE);
|
|
}
|
|
return TRUE;
|
|
}
|