2020-02-24 01:49:56 +02:00
|
|
|
[Inform7Skill::] Inform7 Skill.
|
|
|
|
|
2020-03-30 14:23:06 +03:00
|
|
|
The skill of turning source text into Inter code.
|
2020-02-24 01:49:56 +02:00
|
|
|
|
2020-03-30 14:23:06 +03:00
|
|
|
@ This skill can be performed externally with a shell command to |inform7|, or,
|
|
|
|
if we are running inside |inform7| anyway, internally with a function call.
|
|
|
|
|
|
|
|
=
|
2020-02-24 01:49:56 +02:00
|
|
|
build_skill *compile_using_inform7_skill = NULL;
|
|
|
|
|
|
|
|
void Inform7Skill::create(void) {
|
2020-03-30 14:23:06 +03:00
|
|
|
compile_using_inform7_skill =
|
|
|
|
BuildSteps::new_skill(I"compile using inform7");
|
|
|
|
METHOD_ADD(compile_using_inform7_skill, BUILD_SKILL_COMMAND_MTID,
|
|
|
|
Inform7Skill::inform7_via_shell);
|
|
|
|
METHOD_ADD(compile_using_inform7_skill, BUILD_SKILL_INTERNAL_MTID,
|
|
|
|
Inform7Skill::inform7_internally);
|
2020-02-24 01:49:56 +02:00
|
|
|
}
|
|
|
|
|
2020-03-30 14:23:06 +03:00
|
|
|
int Inform7Skill::inform7_via_shell(build_skill *skill, build_step *S,
|
2020-05-05 23:59:02 +03:00
|
|
|
text_stream *command, build_methodology *BM, linked_list *search_list) {
|
2022-12-08 01:28:26 +02:00
|
|
|
inform_project *project = Projects::from_copy(S->associated_copy);
|
2020-02-24 01:49:56 +02:00
|
|
|
if (project == NULL) internal_error("no project");
|
|
|
|
|
2020-03-30 14:23:06 +03:00
|
|
|
Shell::quote_file(command, BM->to_inform7);
|
2020-02-24 01:49:56 +02:00
|
|
|
|
2021-09-11 16:36:26 +03:00
|
|
|
WRITE_TO(command, "-format=%S ", TargetVMs::get_full_format_text(S->for_vm));
|
2020-02-24 01:49:56 +02:00
|
|
|
|
|
|
|
inbuild_nest *N;
|
2020-05-05 23:59:02 +03:00
|
|
|
linked_list *L = Projects::nest_list(project);
|
|
|
|
LOOP_OVER_LINKED_LIST(N, inbuild_nest, L) {
|
2020-02-24 01:49:56 +02:00
|
|
|
switch (Nests::get_tag(N)) {
|
|
|
|
case MATERIALS_NEST_TAG: continue;
|
2023-02-03 01:16:53 +02:00
|
|
|
case EXTENSION_NEST_TAG: continue;
|
2023-06-07 11:55:36 +03:00
|
|
|
case EXTERNAL_NEST_TAG:
|
|
|
|
if (Nests::is_deprecated(N)) WRITE_TO(command, "-deprecated-external ");
|
|
|
|
else WRITE_TO(command, "-external ");
|
|
|
|
break;
|
2020-02-24 01:49:56 +02:00
|
|
|
case GENERIC_NEST_TAG: WRITE_TO(command, "-nest "); break;
|
|
|
|
case INTERNAL_NEST_TAG: WRITE_TO(command, "-internal "); break;
|
|
|
|
default: internal_error("mystery nest");
|
|
|
|
}
|
|
|
|
Shell::quote_path(command, N->location);
|
|
|
|
}
|
|
|
|
|
|
|
|
WRITE_TO(command, "-project ");
|
|
|
|
Shell::quote_path(command, S->associated_copy->location_if_path);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2020-05-05 23:59:02 +03:00
|
|
|
@ Note that we create the Materials folder in the file system if it doesn't
|
|
|
|
already exist, but only for projects in bundles. (If we did this for projects
|
|
|
|
in single files, the result would be that batch-testing Inform via //intest//
|
|
|
|
would create thousands of unwanted folders. Still, it's a slightly arbitrary
|
|
|
|
way to do things. The UI apps for Inform tend to create missing Materials
|
|
|
|
folders anyway; maybe we should leave well be.)
|
|
|
|
|
|
|
|
=
|
|
|
|
int Inform7Skill::inform7_internally(build_skill *skill, build_step *S,
|
|
|
|
build_methodology *BM, linked_list *search_list) {
|
2022-12-08 01:28:26 +02:00
|
|
|
inform_project *project = Projects::from_copy(S->associated_copy);
|
2020-05-05 23:59:02 +03:00
|
|
|
if (project == NULL) internal_error("no project");
|
2022-10-31 01:05:55 +02:00
|
|
|
|
2020-05-05 23:59:02 +03:00
|
|
|
if (S->associated_copy->edition->work->genre == project_bundle_genre)
|
|
|
|
Pathnames::create_in_file_system(Projects::materials_path(project));
|
2020-02-24 01:49:56 +02:00
|
|
|
#ifdef CORE_MODULE
|
2020-03-07 10:46:43 +02:00
|
|
|
return Task::carry_out(S);
|
2020-02-24 01:49:56 +02:00
|
|
|
#endif
|
2020-03-07 10:46:43 +02:00
|
|
|
#ifndef CORE_MODULE
|
2020-02-24 01:49:56 +02:00
|
|
|
return FALSE;
|
2020-03-07 10:46:43 +02:00
|
|
|
#endif
|
2020-02-24 01:49:56 +02:00
|
|
|
}
|