1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-06-26 04:00:43 +03:00

Ability to nest multiple versions

This commit is contained in:
Graham Nelson 2020-03-10 00:08:35 +00:00
parent 5a16b16e12
commit 4307af7af1
13 changed files with 68 additions and 44 deletions

View file

@ -5,3 +5,4 @@ extension: Damaged by Anonymous in directory inbuild/Tests/Zoo/Extensions/Robert
2. extension misworded: the titling line does not give both author and title
3. extension misworded: the version number '3a' is malformed
4. extension misworded: cannot read compatibility '(For Geeks Only)'
extension: New Standard Tuning by Robert Fripp v3.1-Alpha+6b34 (for Glulx version 3.1.2 or Glulx version 3.1.2 with debugging) in directory inbuild/Tests/Zoo/Extensions/Robert Fripp

View file

@ -0,0 +1,13 @@
Version 3.1-alpha+6B34 of New Standard Tuning (for Glulx only) by Robert Fripp begins here.
"The guitar's strings are assigned the notes C2-G2-D3-A3-E4-G4 (from lowest to highest); the five lowest open strings are each tuned to an interval of a perfect fifth {(C,G),(G,D),(D,A),(A,E)}; the two highest strings are a minor third apart (E,G)."
New Standard Tuning ends here.
---- DOCUMENTATION ----
NST places the guitar strings under greater tension than standard tuning.
Standard sets of guitar strings do not work well with the tuning as the lowest
strings are too loose and the highest string may snap under the increased
tension. Special sets of NST strings have been available for decades, and some
guitarists have assembled NST sets from individual strings.

View file

@ -30,6 +30,20 @@ void Editions::write(OUTPUT_STREAM, inbuild_edition *E) {
}
}
void Editions::write_canonical_leaf(OUTPUT_STREAM, inbuild_edition *E) {
WRITE("%S", E->work->title);
if (VersionNumbers::is_null(E->version) == FALSE) {
TEMPORARY_TEXT(vn);
WRITE_TO(vn, "-v%v", &(E->version));
LOOP_THROUGH_TEXT(pos, vn)
if (Str::get(pos) == '.')
PUT('_');
else
PUT(Str::get(pos));
DISCARD_TEXT(vn);
}
}
void Editions::inspect(OUTPUT_STREAM, inbuild_edition *E) {
Editions::write(OUT, E);
if (Compatibility::universal(E->compatibility) == FALSE) {

View file

@ -263,7 +263,7 @@ int Graphs::build_r(OUTPUT_STREAM, int gb, build_vertex *V, build_methodology *m
else if ((V->type == GHOST_VERTEX) && (*changes > changes_so_far)) needs_building = TRUE;
else @<Decide based on timestamps@>;
if (needs_building) {
if ((needs_building) && (BuildScripts::script_length(V->script) > 0)) {
if (trace_ibg) { WRITE_TO(STDOUT, "Build: "); Graphs::describe(STDOUT, V, FALSE); }
(*changes)++;
rv = BuildScripts::execute(V, V->script, meth);

View file

@ -17,6 +17,11 @@ build_script *BuildScripts::new(void) {
return BS;
}
int BuildScripts::script_length(build_script *BS) {
if (BS == NULL) return 0;
return LinkedLists::len(BS->steps);
}
void BuildScripts::add_step(build_script *BS, build_step *S) {
ADD_TO_LINKED_LIST(S, build_step, BS->steps);
}

View file

@ -62,6 +62,7 @@ build_step *BuildSteps::attach(build_vertex *vertex, build_skill *to_do, linked_
}
int BuildSteps::execute(build_vertex *V, build_step *S, build_methodology *meth) {
// PRINT("Exec %S %d\n", S->what_to_do->name, meth->methodology);
int rv = TRUE;
TEMPORARY_TEXT(command);
VMETHOD_CALL(S->what_to_do, BUILD_SKILL_COMMAND_MTID, S, command, meth);

View file

@ -104,9 +104,7 @@ requirements.
For efficiency's sake, since the nest could contain many hundreds of
extensions, we narrow down to the author's subfolder if a specific
author is required, and to the specific extension file if title is
also known. (In particular, this happens when the Inform compiler is
using us to search for, say, Locksmith by Emily Short.)
author is required.
Nobody should any longer be storing extension files without the file
extension |.i7x|, but this was allowed in the early days of Inform 7,
@ -119,18 +117,7 @@ void ExtensionManager::search_nest_for(inbuild_genre *gen, inbuild_nest *N,
pathname *P = ExtensionManager::path_within_nest(N);
if (Str::len(req->work->author_name) > 0) {
pathname *Q = Pathnames::subfolder(P, req->work->author_name);
if (Str::len(req->work->title) > 0) {
for (int i7x_flag = 1; i7x_flag >= 0; i7x_flag--) {
TEMPORARY_TEXT(leaf);
if (i7x_flag) WRITE_TO(leaf, "%S.i7x", req->work->title);
else WRITE_TO(leaf, "%S", req->work->title);
filename *F = Filenames::in_folder(Q, leaf);
ExtensionManager::search_nest_for_single_file(F, N, req, search_results);
DISCARD_TEXT(leaf);
}
} else {
ExtensionManager::search_nest_for_r(Q, N, req, search_results);
}
ExtensionManager::search_nest_for_r(Q, N, req, search_results);
} else {
ExtensionManager::search_nest_for_r(P, N, req, search_results);
}
@ -171,21 +158,12 @@ Now the task is to copy an extension into place in a nest. This is easy,
since an extension is a single file; to sync, we just overwrite.
=
filename *ExtensionManager::filename_in_nest(inbuild_nest *N,
text_stream *title, text_stream *author) {
pathname *E = ExtensionManager::path_within_nest(N);
TEMPORARY_TEXT(leaf);
WRITE_TO(leaf, "%S.i7x", title);
filename *F = Filenames::in_folder(Pathnames::subfolder(E, author), leaf);
DISCARD_TEXT(leaf);
return F;
}
void ExtensionManager::copy_to_nest(inbuild_genre *gen, inbuild_copy *C, inbuild_nest *N,
int syncing, build_methodology *meth) {
pathname *E = ExtensionManager::path_within_nest(N);
TEMPORARY_TEXT(leaf);
WRITE_TO(leaf, "%S.i7x", C->edition->work->title);
Editions::write_canonical_leaf(leaf, C->edition);
WRITE_TO(leaf, ".i7x");
filename *F = Filenames::in_folder(
Pathnames::subfolder(E, C->edition->work->author_name), leaf);
DISCARD_TEXT(leaf);

View file

@ -126,13 +126,17 @@ Now the task is to copy a kit into place in a nest. Since a kit is a folder,
we need to |rsync| it.
=
pathname *KitManager::pathname_in_nest(inbuild_nest *N, inbuild_work *W) {
return Pathnames::subfolder(KitManager::path_within_nest(N), W->title);
pathname *KitManager::pathname_in_nest(inbuild_nest *N, inbuild_edition *E) {
TEMPORARY_TEXT(leaf);
Editions::write_canonical_leaf(leaf, E);
pathname *P = Pathnames::subfolder(KitManager::path_within_nest(N), leaf);
DISCARD_TEXT(leaf);
return P;
}
void KitManager::copy_to_nest(inbuild_genre *gen, inbuild_copy *C, inbuild_nest *N,
int syncing, build_methodology *meth) {
pathname *dest_kit = KitManager::pathname_in_nest(N, C->edition->work);
pathname *dest_kit = KitManager::pathname_in_nest(N, C->edition);
filename *dest_kit_metadata = Filenames::in_folder(dest_kit, I"kit_metadata.txt");
if (TextFiles::exists(dest_kit_metadata)) {
if (syncing == FALSE) { Nests::overwrite_error(N, C); return; }

View file

@ -130,13 +130,17 @@ Now the task is to copy a language into place in a nest. Since a language is a f
we need to |rsync| it.
=
pathname *LanguageManager::pathname_in_nest(inbuild_nest *N, inbuild_work *W) {
return Pathnames::subfolder(LanguageManager::path_within_nest(N), W->title);
pathname *LanguageManager::pathname_in_nest(inbuild_nest *N, inbuild_edition *E) {
TEMPORARY_TEXT(leaf);
Editions::write_canonical_leaf(leaf, E);
pathname *P = Pathnames::subfolder(LanguageManager::path_within_nest(N), leaf);
DISCARD_TEXT(leaf);
return P;
}
void LanguageManager::copy_to_nest(inbuild_genre *gen, inbuild_copy *C, inbuild_nest *N,
int syncing, build_methodology *meth) {
pathname *dest_language = LanguageManager::pathname_in_nest(N, C->edition->work);
pathname *dest_language = LanguageManager::pathname_in_nest(N, C->edition);
filename *dest_language_metadata = Filenames::in_folder(dest_language, I"about.txt");
if (TextFiles::exists(dest_language_metadata)) {
if (syncing == FALSE) { Nests::overwrite_error(N, C); return; }

View file

@ -109,18 +109,18 @@ Now the task is to copy a pipeline into place in a nest. This is easy,
since a pipeline is a single file; to sync, we just overwrite.
=
filename *PipelineManager::filename_in_nest(inbuild_nest *N, text_stream *title) {
pathname *E = PipelineManager::path_within_nest(N);
filename *PipelineManager::filename_in_nest(inbuild_nest *N, inbuild_edition *E) {
TEMPORARY_TEXT(leaf);
WRITE_TO(leaf, "%S.interpipeline", title);
filename *F = Filenames::in_folder(E, leaf);
Editions::write_canonical_leaf(leaf, E);
WRITE_TO(leaf, ".interpipeline");
filename *F = Filenames::in_folder(PipelineManager::path_within_nest(N), leaf);
DISCARD_TEXT(leaf);
return F;
}
void PipelineManager::copy_to_nest(inbuild_genre *gen, inbuild_copy *C, inbuild_nest *N,
int syncing, build_methodology *meth) {
filename *F = PipelineManager::filename_in_nest(N, C->edition->work->title);
filename *F = PipelineManager::filename_in_nest(N, C->edition);
if (TextFiles::exists(F)) {
if (syncing == FALSE) { Nests::overwrite_error(N, C); return; }

View file

@ -107,13 +107,17 @@ Now the task is to copy a template into place in a nest. Since a template is
a folder, we need to |rsync| it.
=
pathname *TemplateManager::pathname_in_nest(inbuild_nest *N, inbuild_work *W) {
return Pathnames::subfolder(TemplateManager::path_within_nest(N), W->title);
pathname *TemplateManager::pathname_in_nest(inbuild_nest *N, inbuild_edition *E) {
TEMPORARY_TEXT(leaf);
Editions::write_canonical_leaf(leaf, E);
pathname *P = Pathnames::subfolder(TemplateManager::path_within_nest(N), leaf);
DISCARD_TEXT(leaf);
return P;
}
void TemplateManager::copy_to_nest(inbuild_genre *gen, inbuild_copy *C, inbuild_nest *N,
int syncing, build_methodology *meth) {
pathname *P = TemplateManager::pathname_in_nest(N, C->edition->work);
pathname *P = TemplateManager::pathname_in_nest(N, C->edition);
filename *canary1 = Filenames::in_folder(P, I"(manifest).txt");
filename *canary2 = Filenames::in_folder(P, I"index.html");
if ((TextFiles::exists(canary1)) || (TextFiles::exists(canary2))) {

View file

@ -268,13 +268,14 @@ pathname *Projects::build_pathname(inform_project *project) {
void Projects::construct_build_target(inform_project *project, target_vm *VM,
int releasing, int compile_only) {
pathname *build_folder = Projects::build_pathname(project);
filename *inf_F = Filenames::in_folder(build_folder, I"auto.inf");
build_vertex *inter_V = Graphs::ghost_vertex(I"binary inter in memory");
// build_vertex *inter_V = Graphs::ghost_vertex(I"binary inter in memory");
build_vertex *inter_V = Graphs::file_vertex(inf_F);
Graphs::need_this_to_build(inter_V, project->as_copy->vertex);
BuildSteps::attach(inter_V, compile_using_inform7_skill,
Inbuild::nest_list(), releasing, VM, NULL, project->as_copy);
filename *inf_F = Filenames::in_folder(build_folder, I"auto.inf");
build_vertex *inf_V = Graphs::file_vertex(inf_F);
Graphs::need_this_to_build(inf_V, inter_V);
BuildSteps::attach(inf_V, code_generate_using_inter_skill,

View file

@ -1,4 +1,3 @@
version: 1.0.2
priority: 0
extension: Basic Inform by Graham Nelson
extension: English Language by Graham Nelson