mirror of
https://github.com/ganelson/inform.git
synced 2024-06-29 05:24:57 +03:00
Rewrote handling of per-project pathnames and filenames
This commit is contained in:
parent
badeae86b5
commit
edc97dcf9c
|
@ -203,13 +203,10 @@ void HTMLFiles::outcome_image_tail(OUTPUT_STREAM) {
|
|||
void HTMLFiles::html_header(OUTPUT_STREAM, text_stream *title) {
|
||||
HTML::declare_as_HTML(OUT, FALSE);
|
||||
HTML::begin_head(OUT, NULL);
|
||||
pathname *models = Extensions::Census::doc_models();
|
||||
if (models) {
|
||||
HTML::incorporate_CSS(OUT,
|
||||
Filenames::in_folder(models, I"main.css"));
|
||||
Inbuild::file_from_installation(CSS_FOR_STANDARD_PAGES_IRES));
|
||||
HTML::incorporate_javascript(OUT, TRUE,
|
||||
Filenames::in_folder(models, I"main.js"));
|
||||
}
|
||||
Inbuild::file_from_installation(JAVASCRIPT_FOR_STANDARD_PAGES_IRES));
|
||||
#ifdef INDEX_MODULE
|
||||
Index::scripting(OUT);
|
||||
#endif
|
||||
|
|
|
@ -177,6 +177,7 @@ inbuild_copy *Inbuild::optioneering_complete(inbuild_copy *C, int compile_only)
|
|||
inbuild_phase = TINKERING_INBUILD_PHASE;
|
||||
Inbuild::sort_nest_list();
|
||||
inbuild_phase = NESTED_INBUILD_PHASE;
|
||||
if (project) Projects::set_to_English(project);
|
||||
Inbuild::pass_kit_requests();
|
||||
inbuild_phase = PROJECTED_INBUILD_PHASE;
|
||||
|
||||
|
@ -484,4 +485,44 @@ void Inbuild::pass_kit_requests(void) {
|
|||
}
|
||||
}
|
||||
|
||||
@h Installation.
|
||||
Inform and its associated tools need to be able to see certain files stored
|
||||
in the internal nest: if they aren't there, then Inform is not properly
|
||||
installed on disc.
|
||||
|
||||
@e CBLORB_REPORT_MODEL_IRES from 1
|
||||
@e DOCUMENTATION_SNIPPETS_IRES
|
||||
@e INTRO_BOOKLET_IRES
|
||||
@e INTRO_POSTCARD_IRES
|
||||
@e LARGE_DEFAULT_COVER_ART_IRES
|
||||
@e SMALL_DEFAULT_COVER_ART_IRES
|
||||
@e DOCUMENTATION_XREFS_IRES
|
||||
@e JAVASCRIPT_FOR_STANDARD_PAGES_IRES
|
||||
@e JAVASCRIPT_FOR_EXTENSIONS_IRES
|
||||
@e JAVASCRIPT_FOR_ONE_EXTENSION_IRES
|
||||
@e CSS_FOR_STANDARD_PAGES_IRES
|
||||
@e EXTENSION_DOCUMENTATION_MODEL_IRES
|
||||
|
||||
=
|
||||
filename *Inbuild::file_from_installation(int ires) {
|
||||
inbuild_nest *I = Inbuild::internal();
|
||||
if (I == NULL) Errors::fatal("Did not set -internal when calling");
|
||||
pathname *misc = Pathnames::subfolder(I->location, I"Miscellany");
|
||||
pathname *models = Pathnames::subfolder(I->location, I"HTML");
|
||||
switch (ires) {
|
||||
case CBLORB_REPORT_MODEL_IRES: return Filenames::in_folder(models, I"CblorbModel.html");
|
||||
case DOCUMENTATION_SNIPPETS_IRES: return Filenames::in_folder(misc, I"definitions.html");
|
||||
case INTRO_BOOKLET_IRES: return Filenames::in_folder(misc, I"IntroductionToIF.pdf");
|
||||
case INTRO_POSTCARD_IRES: return Filenames::in_folder(misc, I"Postcard.pdf");
|
||||
case LARGE_DEFAULT_COVER_ART_IRES: return Filenames::in_folder(misc, I"Cover.jpg");
|
||||
case SMALL_DEFAULT_COVER_ART_IRES: return Filenames::in_folder(misc, I"Small Cover.jpg");
|
||||
case DOCUMENTATION_XREFS_IRES: return Filenames::in_folder(models, I"xrefs.txt");
|
||||
case JAVASCRIPT_FOR_STANDARD_PAGES_IRES: return Filenames::in_folder(models, I"main.js");
|
||||
case JAVASCRIPT_FOR_EXTENSIONS_IRES: return Filenames::in_folder(models, I"extensions.js");
|
||||
case JAVASCRIPT_FOR_ONE_EXTENSION_IRES: return Filenames::in_folder(models, I"extensionfile.js");
|
||||
case CSS_FOR_STANDARD_PAGES_IRES: return Filenames::in_folder(models, I"main.css");
|
||||
case EXTENSION_DOCUMENTATION_MODEL_IRES: return Filenames::in_folder(models, I"extensionfile.html");
|
||||
}
|
||||
internal_error("unknown installation resource file");
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -817,18 +817,12 @@ pathname *Extensions::Census::doc_pathname(void) {
|
|||
if (Pathnames::create_in_file_system(P) == 0) return NULL;
|
||||
return P;
|
||||
}
|
||||
pathname *Extensions::Census::doc_models(void) {
|
||||
inbuild_nest *I = Inbuild::internal(); if (I == NULL) return NULL;
|
||||
return Pathnames::subfolder(I->location, I"HTML");
|
||||
}
|
||||
|
||||
void Extensions::Census::write_top_level_extensions_page(text_stream *leaf, int content, extension_census *C) {
|
||||
pathname *P = Extensions::Census::doc_pathname();
|
||||
if (P == NULL) return;
|
||||
filename *F = Filenames::in_folder(P, leaf);
|
||||
|
||||
pathname *models = Extensions::Census::doc_models();
|
||||
if (models == NULL) return;
|
||||
|
||||
text_stream HOMEPAGE_struct;
|
||||
text_stream *OUT = &HOMEPAGE_struct;
|
||||
if (STREAM_OPEN_TO_FILE(OUT, F, UTF8_ENC) == FALSE) {
|
||||
|
@ -846,9 +840,9 @@ void Extensions::Census::write_top_level_extensions_page(text_stream *leaf, int
|
|||
HTML::begin_head(OUT, NULL);
|
||||
HTML::title(OUT, I"Extensions");
|
||||
HTML::incorporate_javascript(OUT, TRUE,
|
||||
Filenames::in_folder(models, I"extensions.js"));
|
||||
Inbuild::file_from_installation(JAVASCRIPT_FOR_EXTENSIONS_IRES));
|
||||
HTML::incorporate_CSS(OUT,
|
||||
Filenames::in_folder(models, I"main.css"));
|
||||
Inbuild::file_from_installation(CSS_FOR_STANDARD_PAGES_IRES));
|
||||
HTML::end_head(OUT);
|
||||
|
||||
HTML::begin_body(OUT, NULL);
|
||||
|
|
|
@ -144,25 +144,20 @@ exercise as when generating the home pages for extensions, though with a
|
|||
different template:
|
||||
|
||||
@<Write the actual extension documentation page to DOCF@> =
|
||||
pathname *models = Extensions::Census::doc_models();
|
||||
if (models) {
|
||||
text_stream *OUT = DOCF;
|
||||
HTML::declare_as_HTML(OUT, FALSE);
|
||||
|
||||
HTML::begin_head(OUT, NULL);
|
||||
HTML::title(OUT, I"Extension");
|
||||
HTML::incorporate_javascript(OUT, TRUE,
|
||||
Filenames::in_folder(models, I"extensionfile.js"));
|
||||
HTML::incorporate_CSS(OUT,
|
||||
Filenames::in_folder(models, I"main.css"));
|
||||
Inbuild::file_from_installation(JAVASCRIPT_FOR_ONE_EXTENSION_IRES));
|
||||
HTML::incorporate_CSS(OUT, Inbuild::file_from_installation(CSS_FOR_STANDARD_PAGES_IRES));
|
||||
HTML::end_head(OUT);
|
||||
|
||||
HTML::begin_body(OUT, NULL);
|
||||
HTML::incorporate_HTML(OUT,
|
||||
Filenames::in_folder(models, I"extensionfile.html"));
|
||||
HTML::incorporate_HTML(OUT, Inbuild::file_from_installation(EXTENSION_DOCUMENTATION_MODEL_IRES));
|
||||
@<Write documentation for a specific extension into the page@>;
|
||||
HTML::end_body(OUT);
|
||||
}
|
||||
|
||||
@ And this is the body:
|
||||
|
||||
|
|
|
@ -12,8 +12,9 @@ typedef struct inform_project {
|
|||
struct inform_language *language_of_play;
|
||||
struct inform_language *language_of_syntax;
|
||||
struct inform_language *language_of_index;
|
||||
struct build_vertex *unblorbed_vertex;
|
||||
struct build_vertex *blorbed_vertex;
|
||||
struct build_vertex *chosen_build_target;
|
||||
int next_resource_number;
|
||||
MEMORY_MANAGEMENT
|
||||
} inform_project;
|
||||
|
||||
|
@ -27,11 +28,27 @@ inform_project *Projects::new_ip(text_stream *name, filename *F, pathname *P) {
|
|||
project->language_of_play = NULL;
|
||||
project->language_of_syntax = NULL;
|
||||
project->language_of_index = NULL;
|
||||
project->next_resource_number = 3;
|
||||
project->chosen_build_target = NULL;
|
||||
project->unblorbed_vertex = NULL;
|
||||
project->blorbed_vertex = NULL;
|
||||
return project;
|
||||
}
|
||||
|
||||
void Projects::set_to_English(inform_project *proj) {
|
||||
if (proj == NULL) internal_error("no project");
|
||||
inform_language *E = NULL;
|
||||
inbuild_requirement *req = Requirements::any_version_of(Works::new(language_genre, I"English", I""));
|
||||
linked_list *L = NEW_LINKED_LIST(inbuild_search_result);
|
||||
Nests::search_for(req, Inbuild::nest_list(), L);
|
||||
inbuild_search_result *R;
|
||||
LOOP_OVER_LINKED_LIST(R, inbuild_search_result, L)
|
||||
if (E == NULL)
|
||||
E = LanguageManager::from_copy(R->copy);
|
||||
proj->language_of_play = E;
|
||||
proj->language_of_syntax = E;
|
||||
proj->language_of_index = E;
|
||||
}
|
||||
|
||||
void Projects::set_language_of_play(inform_project *proj, inform_language *L) {
|
||||
if (proj == NULL) internal_error("no project");
|
||||
proj->language_of_play = L;
|
||||
|
@ -66,22 +83,6 @@ void Projects::not_necessarily_parser_IF(inform_project *project) {
|
|||
project->assumed_to_be_parser_IF = FALSE;
|
||||
}
|
||||
|
||||
@ Resources in a Blorb file have unique ID numbers which are positive integers,
|
||||
but these are not required to start from 1, nor to be contiguous. For Inform,
|
||||
ID number 1 is reserved for the cover image (whether or not any cover image
|
||||
is provided: it is legal for there to be figures but no cover, and vice versa).
|
||||
Other figures, and sound effects, then mix freely as needed from ID number 3
|
||||
on upwards. We skip 2 so that it can be guaranteed that no sound resource
|
||||
has ID 1 or 2: this is to help people trying to play sounds in the Z-machine,
|
||||
where operand 1 or 2 in the |@sound| opcode signifies not a sound resource
|
||||
number but a long or short beep. If a genuine sound effect had resource ID
|
||||
1 or 2, therefore, it would be unplayable on the Z-machine.
|
||||
|
||||
=
|
||||
int Projects::get_next_free_blorb_resource_ID(inform_project *project) {
|
||||
return project->next_resource_number++;
|
||||
}
|
||||
|
||||
void Projects::set_source_filename(inform_project *project, pathname *P, filename *F) {
|
||||
if (P) {
|
||||
filename *manifest = Filenames::in_folder(P, I"Contents.txt");
|
||||
|
@ -270,26 +271,25 @@ void Projects::construct_build_target(inform_project *project, target_vm *VM,
|
|||
WRITE_TO(story_file_leafname, "output.%S", TargetVMs::get_unblorbed_extension(VM));
|
||||
filename *unblorbed_F = Filenames::in_folder(build_folder, story_file_leafname);
|
||||
DISCARD_TEXT(story_file_leafname);
|
||||
build_vertex *unblorbed_V = Graphs::file_vertex(unblorbed_F);
|
||||
Graphs::need_this_to_build(unblorbed_V, inf_V);
|
||||
BuildSteps::attach(unblorbed_V, compile_using_inform6_skill,
|
||||
project->unblorbed_vertex = Graphs::file_vertex(unblorbed_F);
|
||||
Graphs::need_this_to_build(project->unblorbed_vertex, inf_V);
|
||||
BuildSteps::attach(project->unblorbed_vertex, compile_using_inform6_skill,
|
||||
Inbuild::nest_list(), releasing, VM, NULL, project->as_copy);
|
||||
|
||||
if (releasing) {
|
||||
TEMPORARY_TEXT(story_file_leafname);
|
||||
WRITE_TO(story_file_leafname, "output.%S", TargetVMs::get_blorbed_extension(VM));
|
||||
filename *blorbed_F = Filenames::in_folder(build_folder, story_file_leafname);
|
||||
DISCARD_TEXT(story_file_leafname);
|
||||
build_vertex *blorbed_V = Graphs::file_vertex(blorbed_F);
|
||||
Graphs::need_this_to_build(unblorbed_V, inf_V);
|
||||
BuildSteps::attach(blorbed_V, package_using_inblorb_skill,
|
||||
TEMPORARY_TEXT(story_file_leafname2);
|
||||
WRITE_TO(story_file_leafname2, "output.%S", TargetVMs::get_blorbed_extension(VM));
|
||||
filename *blorbed_F = Filenames::in_folder(build_folder, story_file_leafname2);
|
||||
DISCARD_TEXT(story_file_leafname2);
|
||||
project->blorbed_vertex = Graphs::file_vertex(blorbed_F);
|
||||
Graphs::need_this_to_build(project->blorbed_vertex, project->unblorbed_vertex);
|
||||
BuildSteps::attach(project->blorbed_vertex, package_using_inblorb_skill,
|
||||
Inbuild::nest_list(), releasing, VM, NULL, project->as_copy);
|
||||
project->chosen_build_target = blorbed_V;
|
||||
} else project->chosen_build_target = unblorbed_V;
|
||||
|
||||
if (compile_only) {
|
||||
project->chosen_build_target = inf_V;
|
||||
inf_V->force_this = TRUE;
|
||||
}
|
||||
} else if (releasing) project->chosen_build_target = project->blorbed_vertex;
|
||||
else project->chosen_build_target = project->unblorbed_vertex;
|
||||
}
|
||||
|
||||
void Projects::construct_graph(inform_project *project) {
|
||||
|
@ -331,7 +331,9 @@ void Projects::read_source_text_for(inform_project *project) {
|
|||
if (Str::len(early) > 0) Feeds::feed_stream(early);
|
||||
DISCARD_TEXT(early);
|
||||
#ifdef CORE_MODULE
|
||||
SourceFiles::read_further_mandatory_text();
|
||||
inbuild_nest *E = Inbuild::external();
|
||||
if (E) SourceFiles::read_further_mandatory_text(
|
||||
Filenames::in_folder(E->location, I"Options.txt"));
|
||||
#endif
|
||||
linked_list *L = Projects::source(project);
|
||||
if (L) {
|
||||
|
|
|
@ -41,6 +41,7 @@ int CoreMain::main(int argc, char *argv[]) {
|
|||
int proceed = CoreMain::read_command_line(argc, argv);
|
||||
if (proceed) {
|
||||
@<Open the debugging log and the problems report@>;
|
||||
@<Open the telemetry@>;
|
||||
inform_project *project = Inbuild::go_operational();
|
||||
if (project)
|
||||
Copies::build(STDOUT, project->as_copy,
|
||||
|
@ -83,6 +84,20 @@ int CoreMain::main(int argc, char *argv[]) {
|
|||
|
||||
Problems::Issue::start_problems_report(PF);
|
||||
|
||||
@<Open the telemetry@> =
|
||||
pathname *P = Pathnames::subfolder(Inbuild::transient(), I"Telemetry");
|
||||
if (Pathnames::create_in_file_system(P)) {
|
||||
TEMPORARY_TEXT(leafname_of_telemetry);
|
||||
int this_month = the_present->tm_mon + 1;
|
||||
int this_day = the_present->tm_mday;
|
||||
int this_year = the_present->tm_year + 1900;
|
||||
WRITE_TO(leafname_of_telemetry,
|
||||
"Telemetry %04d-%02d-%02d.txt", this_year, this_month, this_day);
|
||||
filename *F = Filenames::in_folder(P, leafname_of_telemetry);
|
||||
Telemetry::locate_telemetry_file(F);
|
||||
DISCARD_TEXT(leafname_of_telemetry);
|
||||
}
|
||||
|
||||
@<Post mortem logging@> =
|
||||
if (problem_count == 0) {
|
||||
TemplateReader::report_unacted_upon_interventions();
|
||||
|
|
|
@ -1,14 +1,42 @@
|
|||
[Task::] What To Compile.
|
||||
|
||||
To configure the many locations used in the host filing system.
|
||||
To receive an instruction to compile something from Inbuild, and then to
|
||||
sort out the many locations then used in the host filing system.
|
||||
|
||||
@ =
|
||||
@h Task data.
|
||||
When Inbuild (a copy of which is included in the Inform 7 executable) decides
|
||||
that an Inform source text must be compiled, it calls |Task::carry_out|. By
|
||||
this point Inbuild will have set up an |inform_project| structure to
|
||||
represent the program we have to compile; but we will need additional data
|
||||
about that compilation, and it's stored in the following.
|
||||
|
||||
=
|
||||
typedef struct compile_task_data {
|
||||
struct build_step *task;
|
||||
struct inform_project *project;
|
||||
|
||||
struct pathname *path;
|
||||
struct pathname *materials;
|
||||
struct pathname *build;
|
||||
struct filename *existing_storyfile;
|
||||
|
||||
int next_resource_number;
|
||||
|
||||
MEMORY_MANAGEMENT
|
||||
} compile_task_data;
|
||||
|
||||
@ An early and perhaps arguable design decision for inform7 was that it would
|
||||
compile just one source text in its lifetime as a process: and because of that,
|
||||
|Task::carry_out| can only in fact be called once, and Inbuild only does so
|
||||
once. But the following routine allows in principle for multiple calls,
|
||||
against the day when we change our minds about all this.
|
||||
|
||||
Something we will never do is attempt to make |inform7| thread-safe in the
|
||||
sense of being able to compile two source texts simultaneously. The global
|
||||
|inform7_task| is null when nothing is being compiled, or set to the unique
|
||||
thing which is being compiled when it is.
|
||||
|
||||
=
|
||||
compile_task_data *inform7_task = NULL;
|
||||
|
||||
int Task::carry_out(build_step *S) {
|
||||
|
@ -20,16 +48,28 @@ int Task::carry_out(build_step *S) {
|
|||
inform7_task = CREATE(compile_task_data);
|
||||
inform7_task->task = S;
|
||||
inform7_task->project = project;
|
||||
inform7_task->path = S->associated_copy->location_if_path;
|
||||
inform7_task->build = Inbuild::transient();
|
||||
if (inform7_task->path)
|
||||
inform7_task->build = Pathnames::subfolder(inform7_task->path, I"Build");
|
||||
if (Pathnames::create_in_file_system(inform7_task->build) == 0) return FALSE;
|
||||
inform7_task->materials = Inbuild::materials();
|
||||
Task::set_existing_storyfile(NULL);
|
||||
inform7_task->next_resource_number = 3;
|
||||
|
||||
NaturalLanguages::default_to_English();
|
||||
Task::set_more_defaults();
|
||||
inform_language *E = NaturalLanguages::English();
|
||||
Projects::set_language_of_syntax(project, E);
|
||||
Projects::set_language_of_index(project, E);
|
||||
Projects::set_language_of_play(project, E);
|
||||
|
||||
int rv = Sequence::carry_out(inform7_task);
|
||||
inform7_task = NULL;
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ =
|
||||
@ The current project and the virtual machine we want to compile it for:
|
||||
|
||||
=
|
||||
inform_project *Task::project(void) {
|
||||
if (inform7_task == NULL) internal_error("there is no current task");
|
||||
return inform7_task->project;
|
||||
|
@ -40,50 +80,138 @@ target_vm *Task::vm(void) {
|
|||
return inform7_task->task->for_vm;
|
||||
}
|
||||
|
||||
@h Definitions.
|
||||
@ Resources in a Blorb file have unique ID numbers which are positive integers,
|
||||
but these are not required to start from 1, nor to be contiguous. For Inform,
|
||||
ID number 1 is reserved for the cover image (whether or not any cover image
|
||||
is provided: it is legal for there to be figures but no cover, and vice versa).
|
||||
Other figures, and sound effects, then mix freely as needed from ID number 3
|
||||
on upwards. We skip 2 so that it can be guaranteed that no sound resource
|
||||
has ID 1 or 2: this is to help people trying to play sounds in the Z-machine,
|
||||
where operand 1 or 2 in the |@sound| opcode signifies not a sound resource
|
||||
number but a long or short beep. If a genuine sound effect had resource ID
|
||||
1 or 2, therefore, it would be unplayable on the Z-machine.
|
||||
|
||||
@ This section of the Inform source is intended to give a single description
|
||||
of where everything lives in the filing system. Very early in Inform's run,
|
||||
it works out the filenames of everything it will ever need to refer to, and
|
||||
these are stored in the following globals. Explanations are given below,
|
||||
not here.
|
||||
=
|
||||
int Task::get_next_free_blorb_resource_ID(void) {
|
||||
if (inform7_task == NULL) internal_error("there is no current task");
|
||||
return inform7_task->next_resource_number++;
|
||||
}
|
||||
|
||||
= (early code)
|
||||
pathname *pathname_of_materials_figures = NULL;
|
||||
pathname *pathname_of_materials_release = NULL;
|
||||
pathname *pathname_of_materials_sounds = NULL;
|
||||
pathname *pathname_of_project_index_details_folder = NULL;
|
||||
pathname *pathname_of_project_index_folder = NULL;
|
||||
pathname *pathname_of_released_figures = NULL;
|
||||
pathname *pathname_of_released_interpreter = NULL;
|
||||
pathname *pathname_of_released_sounds = NULL;
|
||||
@h Project-related files and file paths.
|
||||
|
||||
@ And secondly, the files:
|
||||
=
|
||||
filename *Task::uuid_file(void) {
|
||||
if (inform7_task == NULL) internal_error("there is no current task");
|
||||
return Filenames::in_folder(inform7_task->path, I"uuid.txt");
|
||||
}
|
||||
filename *Task::ifiction_record_file(void) {
|
||||
if (inform7_task == NULL) internal_error("there is no current task");
|
||||
return Filenames::in_folder(inform7_task->path, I"Metadata.iFiction");
|
||||
}
|
||||
filename *Task::manifest_file(void) {
|
||||
if (inform7_task == NULL) internal_error("there is no current task");
|
||||
return Filenames::in_folder(inform7_task->path, I"manifest.plist");
|
||||
}
|
||||
filename *Task::blurb_file(void) {
|
||||
if (inform7_task == NULL) internal_error("there is no current task");
|
||||
return Filenames::in_folder(inform7_task->path, I"Release.blurb");
|
||||
}
|
||||
|
||||
= (early code)
|
||||
filename *filename_of_blurb = NULL;
|
||||
filename *filename_of_cblorb_report = NULL;
|
||||
filename *filename_of_cblorb_report_model = NULL;
|
||||
filename *filename_of_documentation_snippets = NULL;
|
||||
filename *filename_of_epsfile = NULL;
|
||||
filename *filename_of_existing_story_file = NULL;
|
||||
filename *filename_of_headings = NULL;
|
||||
filename *filename_of_ifiction_record = NULL;
|
||||
filename *filename_of_intro_booklet = NULL;
|
||||
filename *filename_of_intro_postcard = NULL;
|
||||
filename *filename_of_large_cover_art_jpeg = NULL;
|
||||
filename *filename_of_large_cover_art_png = NULL;
|
||||
filename *filename_of_large_default_cover_art = NULL;
|
||||
filename *filename_of_manifest = NULL;
|
||||
filename *filename_of_options = NULL;
|
||||
filename *filename_of_parse_tree = NULL;
|
||||
filename *filename_of_small_cover_art_jpeg = NULL;
|
||||
filename *filename_of_small_cover_art_png = NULL;
|
||||
filename *filename_of_small_default_cover_art = NULL;
|
||||
filename *filename_of_story_file = NULL;
|
||||
filename *filename_of_telemetry = NULL;
|
||||
filename *filename_of_uuid = NULL;
|
||||
filename *filename_of_xrefs = NULL;
|
||||
filename *Task::cblorb_report_file(void) {
|
||||
if (inform7_task == NULL) internal_error("there is no current task");
|
||||
return Filenames::in_folder(inform7_task->build, I"StatusCblorb.html");
|
||||
}
|
||||
filename *Task::parse_tree_file(void) {
|
||||
if (inform7_task == NULL) internal_error("there is no current task");
|
||||
return Filenames::in_folder(inform7_task->build, I"Parse tree.txt");
|
||||
}
|
||||
filename *Task::storyfile_file(void) {
|
||||
if (inform7_task == NULL) internal_error("there is no current task");
|
||||
build_vertex *V = inform7_task->project->unblorbed_vertex;
|
||||
if (V == NULL) internal_error("project graph not ready");
|
||||
return V->buildable_if_internal_file;
|
||||
}
|
||||
|
||||
@ Location of index files.
|
||||
Filenames within the |Index| subfolder. Filenames in |Details| have the form
|
||||
|N_S| where |N| is the integer supplied and |S| the leafname; for instance,
|
||||
|21_A.html| provides details page number 21 about actions, derived from the
|
||||
leafname |A.html|.
|
||||
|
||||
=
|
||||
pathname *Task::index_path(void) {
|
||||
if (inform7_task == NULL) internal_error("there is no current task");
|
||||
pathname *P = Pathnames::subfolder(inform7_task->build, I"Index");
|
||||
if (Pathnames::create_in_file_system(P)) return P;
|
||||
return NULL;
|
||||
}
|
||||
pathname *Task::index_details_path(void) {
|
||||
pathname *P = Pathnames::subfolder(Task::index_path(), I"Details");
|
||||
if (Pathnames::create_in_file_system(P)) return P;
|
||||
return NULL;
|
||||
}
|
||||
filename *Task::xml_headings_file(void) {
|
||||
return Filenames::in_folder(Task::index_path(), I"Headings.xml");
|
||||
}
|
||||
filename *Task::index_file(text_stream *leafname, int sub) {
|
||||
if (sub >= 0) {
|
||||
TEMPORARY_TEXT(full_leafname);
|
||||
WRITE_TO(full_leafname, "%d_%S", sub, leafname);
|
||||
filename *F = Filenames::in_folder(Task::index_details_path(), full_leafname);
|
||||
DISCARD_TEXT(full_leafname);
|
||||
return F;
|
||||
} else {
|
||||
return Filenames::in_folder(Task::index_path(), leafname);
|
||||
}
|
||||
}
|
||||
|
||||
void Task::set_existing_storyfile(text_stream *name) {
|
||||
if (inform7_task == NULL) internal_error("there is no current task");
|
||||
if (name == NULL) {
|
||||
TEMPORARY_TEXT(leaf);
|
||||
WRITE_TO(leaf, "story.%S", TargetVMs::get_unblorbed_extension(Task::vm()));
|
||||
inform7_task->existing_storyfile = Filenames::in_folder(inform7_task->materials, leaf);
|
||||
DISCARD_TEXT(leaf);
|
||||
} else {
|
||||
inform7_task->existing_storyfile = Filenames::in_folder(inform7_task->materials, name);
|
||||
}
|
||||
}
|
||||
filename *Task::existing_storyfile_file(void) {
|
||||
if (inform7_task == NULL) internal_error("there is no current task");
|
||||
return inform7_task->existing_storyfile;
|
||||
}
|
||||
filename *Task::large_cover_art_file(int JPEG) {
|
||||
if (inform7_task == NULL) internal_error("there is no current task");
|
||||
if (JPEG) return Filenames::in_folder(inform7_task->materials, I"Cover.jpg");
|
||||
return Filenames::in_folder(inform7_task->materials, I"Cover.png");
|
||||
}
|
||||
filename *Task::epsmap_file(void) {
|
||||
if (inform7_task == NULL) internal_error("there is no current task");
|
||||
return Filenames::in_folder(inform7_task->materials, I"Inform Map.eps");
|
||||
}
|
||||
|
||||
pathname *Task::figures_path(void) {
|
||||
if (inform7_task == NULL) internal_error("there is no current task");
|
||||
return Pathnames::subfolder(inform7_task->materials, I"Figures");
|
||||
}
|
||||
pathname *Task::sounds_path(void) {
|
||||
if (inform7_task == NULL) internal_error("there is no current task");
|
||||
return Pathnames::subfolder(inform7_task->materials, I"Sounds");
|
||||
}
|
||||
|
||||
pathname *Task::release_path(void) {
|
||||
if (inform7_task == NULL) internal_error("there is no current task");
|
||||
return Pathnames::subfolder(inform7_task->materials, I"Release");
|
||||
}
|
||||
pathname *Task::released_figures_path(void) {
|
||||
return Pathnames::subfolder(Task::release_path(), I"Figures");
|
||||
}
|
||||
pathname *Task::released_sounds_path(void) {
|
||||
return Pathnames::subfolder(Task::release_path(), I"Sounds");
|
||||
}
|
||||
pathname *Task::released_interpreter_path(void) {
|
||||
return Pathnames::subfolder(Task::release_path(), I"interpreter");
|
||||
}
|
||||
|
||||
@h Establishing the defaults.
|
||||
Inform's file access happens inside four different areas: the internal
|
||||
|
@ -92,9 +220,6 @@ area, which is where the user (or the application acting on the user's behalf)
|
|||
installs extensions; the project bundle, say |Example.inform|; and, alongside
|
||||
that, the materials folder, |Example.materials|.
|
||||
|
||||
Inform can run in two modes: regular mode, when it's compiling source text,
|
||||
and census mode, when it's scanning the file system for extensions.
|
||||
|
||||
=
|
||||
int Task::set_more_defaults(void) {
|
||||
@<Internal resources@>;
|
||||
|
@ -119,9 +244,6 @@ Inform therefore requires on every run that it be told via the |-internal|
|
|||
switch where the internal resources folder is.
|
||||
|
||||
@<Internal resources@> =
|
||||
inbuild_nest *I = Inbuild::internal();
|
||||
if (I == NULL) Problems::Fatal::issue("Did not set -internal when calling");
|
||||
pathname *pathname_of_internal_folder = I->location;
|
||||
|
||||
@<Miscellaneous other stuff@>;
|
||||
|
||||
|
@ -135,19 +257,7 @@ brief specifications of phrases, extracted from the manual "Writing with
|
|||
Inform". This is used to generate the Phrasebook index.
|
||||
|
||||
@<Miscellaneous other stuff@> =
|
||||
pathname *misc = Pathnames::subfolder(pathname_of_internal_folder, I"Miscellany");
|
||||
|
||||
filename_of_large_default_cover_art = Filenames::in_folder(misc, I"Cover.jpg");
|
||||
filename_of_small_default_cover_art = Filenames::in_folder(misc, I"Small Cover.jpg");
|
||||
filename_of_intro_postcard = Filenames::in_folder(misc, I"Postcard.pdf");
|
||||
filename_of_intro_booklet = Filenames::in_folder(misc, I"IntroductionToIF.pdf");
|
||||
|
||||
pathname *models = Pathnames::subfolder(pathname_of_internal_folder, I"HTML");
|
||||
filename_of_cblorb_report_model = Filenames::in_folder(models, I"CblorbModel.html");
|
||||
|
||||
filename_of_xrefs = Filenames::in_folder(models, I"xrefs.txt");
|
||||
|
||||
filename_of_documentation_snippets = Filenames::in_folder(misc, I"definitions.html");
|
||||
;
|
||||
|
||||
@h External resources.
|
||||
This is where the user can install downloaded extensions, new interpreters,
|
||||
|
@ -170,13 +280,6 @@ If |-transient| is not specified, it's the same folder, i.e., Inform does
|
|||
not distinguish between permanent and transient external resources.
|
||||
|
||||
@<External resources@> =
|
||||
inbuild_nest *E = Inbuild::external();
|
||||
pathname *pathname_of_external_folder = E->location;
|
||||
filename_of_options =
|
||||
Filenames::in_folder(pathname_of_external_folder, I"Options.txt");
|
||||
|
||||
pathname *pathname_of_transient_external_resources = Inbuild::transient();
|
||||
if (Pathnames::create_in_file_system(pathname_of_transient_external_resources) == 0) return FALSE;
|
||||
@<Transient telemetry@>;
|
||||
|
||||
@ Telemetry is not as sinister as it sounds: the app isn't sending data out
|
||||
|
@ -185,19 +288,7 @@ This was provided for classroom use, so that teachers can see what their
|
|||
students have been getting stuck on.
|
||||
|
||||
@<Transient telemetry@> =
|
||||
pathname *pathname_of_telemetry_data =
|
||||
Pathnames::subfolder(pathname_of_transient_external_resources, I"Telemetry");
|
||||
if (Pathnames::create_in_file_system(pathname_of_telemetry_data) == 0) return FALSE;
|
||||
TEMPORARY_TEXT(leafname_of_telemetry);
|
||||
int this_month = the_present->tm_mon + 1;
|
||||
int this_day = the_present->tm_mday;
|
||||
int this_year = the_present->tm_year + 1900;
|
||||
WRITE_TO(leafname_of_telemetry,
|
||||
"Telemetry %04d-%02d-%02d.txt", this_year, this_month, this_day);
|
||||
filename_of_telemetry =
|
||||
Filenames::in_folder(pathname_of_telemetry_data, leafname_of_telemetry);
|
||||
Telemetry::locate_telemetry_file(filename_of_telemetry);
|
||||
DISCARD_TEXT(leafname_of_telemetry);
|
||||
;
|
||||
|
||||
@h Project resources.
|
||||
Although on some platforms it may look like a single file, an Inform project
|
||||
|
@ -213,15 +304,9 @@ have no purpose unless Inform is in a release run (with |-release| set on
|
|||
the command line), but they take no time to generate so we make them anyway.
|
||||
|
||||
@<Project resources@> =
|
||||
pathname *proj = Projects::path(Task::project());
|
||||
@<The Build folder within the project@>;
|
||||
@<The Index folder within the project@>;
|
||||
|
||||
filename_of_uuid = Filenames::in_folder(proj, I"uuid.txt");
|
||||
|
||||
filename_of_ifiction_record = Filenames::in_folder(proj, I"Metadata.iFiction");
|
||||
filename_of_manifest = Filenames::in_folder(proj, I"manifest.plist");
|
||||
filename_of_blurb = Filenames::in_folder(proj, I"Release.blurb");
|
||||
|
||||
@ The build folder for a project contains all of the working files created
|
||||
during the compilation process. The opening part here may be a surprise:
|
||||
|
@ -239,17 +324,7 @@ called; and similarly for the report which the releasing tool Inblorb
|
|||
will produce if this is a Release run.
|
||||
|
||||
@<The Build folder within the project@> =
|
||||
pathname *build_folder = Pathnames::subfolder(proj, I"Build");
|
||||
if (Pathnames::create_in_file_system(build_folder) == 0) return FALSE;
|
||||
|
||||
filename_of_parse_tree = Filenames::in_folder(build_folder, I"Parse tree.txt");
|
||||
|
||||
TEMPORARY_TEXT(story_file_leafname);
|
||||
WRITE_TO(story_file_leafname, "output.%S", TargetVMs::get_unblorbed_extension(Task::vm()));
|
||||
filename_of_story_file = Filenames::in_folder(build_folder, story_file_leafname);
|
||||
DISCARD_TEXT(story_file_leafname);
|
||||
|
||||
filename_of_cblorb_report = Filenames::in_folder(build_folder, I"StatusCblorb.html");
|
||||
;
|
||||
|
||||
@ We're going to write into the Index folder, so we must ensure it exists.
|
||||
The main index files (|Phrasebook.html| and so on) live at the top level,
|
||||
|
@ -261,17 +336,7 @@ application, if it wants it, but is not linked to or used by the HTML of
|
|||
the index as seen by the user.
|
||||
|
||||
@<The Index folder within the project@> =
|
||||
pathname_of_project_index_folder =
|
||||
Pathnames::subfolder(proj, I"Index");
|
||||
pathname_of_project_index_details_folder =
|
||||
Pathnames::subfolder(pathname_of_project_index_folder, I"Details");
|
||||
|
||||
if ((Pathnames::create_in_file_system(pathname_of_project_index_folder) == 0) ||
|
||||
(Pathnames::create_in_file_system(pathname_of_project_index_details_folder) == 0))
|
||||
return FALSE;
|
||||
|
||||
filename_of_headings =
|
||||
Filenames::in_folder(pathname_of_project_index_folder, I"Headings.xml");
|
||||
;
|
||||
|
||||
@h Materials resources.
|
||||
|
||||
|
@ -290,17 +355,7 @@ This is also where the originals (not the released copies) of the Figures
|
|||
and Sounds, if any, live: in their own subfolders.
|
||||
|
||||
@<Figures and sounds@> =
|
||||
pathname *M = Inbuild::materials();
|
||||
|
||||
pathname_of_materials_figures = Pathnames::subfolder(M, I"Figures");
|
||||
pathname_of_materials_sounds = Pathnames::subfolder(M, I"Sounds");
|
||||
|
||||
filename_of_large_cover_art_jpeg = Filenames::in_folder(M, I"Cover.jpg");
|
||||
filename_of_large_cover_art_png = Filenames::in_folder(M, I"Cover.png");
|
||||
filename_of_small_cover_art_jpeg = Filenames::in_folder(M, I"Small Cover.jpg");
|
||||
filename_of_small_cover_art_png = Filenames::in_folder(M, I"Small Cover.png");
|
||||
|
||||
filename_of_epsfile = Filenames::in_folder(M, I"Inform Map.eps");
|
||||
;
|
||||
|
||||
@ On a release run, Inblorb will populate the Release subfolder of Materials;
|
||||
figures and sounds will be copied into the relevant subfolders. The principle
|
||||
|
@ -308,13 +363,7 @@ is that everything in Release can always be thrown away without loss, because
|
|||
it can all be generated again.
|
||||
|
||||
@<The Release folder@> =
|
||||
pathname *M = Inbuild::materials();
|
||||
|
||||
pathname_of_materials_release = Pathnames::subfolder(M, I"Release");
|
||||
|
||||
pathname_of_released_interpreter = Pathnames::subfolder(pathname_of_materials_release, I"interpreter");
|
||||
pathname_of_released_figures = Pathnames::subfolder(pathname_of_materials_release, I"Figures");
|
||||
pathname_of_released_sounds = Pathnames::subfolder(pathname_of_materials_release, I"Sounds");
|
||||
;
|
||||
|
||||
@ Inform is occasionally run in a mode where it performs a release on an
|
||||
existing story file (for example a 1980s Infocom one) rather than on one
|
||||
|
@ -322,29 +371,4 @@ that it has newly generated. This is the filename such a story file would
|
|||
have by default, if so.
|
||||
|
||||
@<Existing story file@> =
|
||||
TEMPORARY_TEXT(leaf);
|
||||
WRITE_TO(leaf, "story.%S", TargetVMs::get_unblorbed_extension(Task::vm()));
|
||||
filename_of_existing_story_file =
|
||||
Filenames::in_folder(Inbuild::materials(), leaf);
|
||||
DISCARD_TEXT(leaf);
|
||||
|
||||
@h Location of index files.
|
||||
Filenames within the |Index| subfolder. Filenames in |Details| have the form
|
||||
|N_S| where |N| is the integer supplied and |S| the leafname; for instance,
|
||||
|21_A.html| provides details page number 21 about actions, derived from the
|
||||
leafname |A.html|.
|
||||
|
||||
=
|
||||
filename *Task::location_in_index(text_stream *leafname, int sub) {
|
||||
pathname *proj = Projects::path(Task::project());
|
||||
if (proj == NULL) return Filenames::in_folder(NULL, leafname);
|
||||
if (sub >= 0) {
|
||||
TEMPORARY_TEXT(full_leafname);
|
||||
WRITE_TO(full_leafname, "%d_%S", sub, leafname);
|
||||
filename *F = Filenames::in_folder(pathname_of_project_index_details_folder, full_leafname);
|
||||
DISCARD_TEXT(full_leafname);
|
||||
return F;
|
||||
} else {
|
||||
return Filenames::in_folder(pathname_of_project_index_folder, leafname);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
|
|
@ -29,14 +29,6 @@ void NaturalLanguages::scan(void) {
|
|||
@h Language of play.
|
||||
|
||||
=
|
||||
void NaturalLanguages::default_to_English(void) {
|
||||
inform_language *E = NaturalLanguages::English();
|
||||
inform_project *proj = Task::project();
|
||||
Projects::set_language_of_syntax(proj, E);
|
||||
Projects::set_language_of_index(proj, E);
|
||||
Projects::set_language_of_play(proj, E);
|
||||
}
|
||||
|
||||
inform_language *NaturalLanguages::English(void) {
|
||||
NaturalLanguages::scan();
|
||||
inform_language *L = Languages::from_name(I"english");
|
||||
|
|
|
@ -161,9 +161,9 @@ this has been created, producing no problem message if it hasn't.
|
|||
|
||||
=
|
||||
wording options_file_wording = EMPTY_WORDING_INIT;
|
||||
void SourceFiles::read_further_mandatory_text(void) {
|
||||
void SourceFiles::read_further_mandatory_text(filename *F) {
|
||||
feed_t id = Feeds::begin();
|
||||
TextFiles::read(filename_of_options, TRUE,
|
||||
TextFiles::read(F, TRUE,
|
||||
NULL, FALSE, SourceFiles::read_further_mandatory_text_helper, NULL, NULL);
|
||||
options_file_wording = Feeds::end(id);
|
||||
}
|
||||
|
|
|
@ -1186,8 +1186,9 @@ Version", contains the Inform build number in its usual form: "4Q34", for instan
|
|||
=
|
||||
void Sentences::Headings::write_as_xml(void) {
|
||||
text_stream xf_struct; text_stream *xf = &xf_struct;
|
||||
if (STREAM_OPEN_TO_FILE(xf, filename_of_headings, UTF8_ENC) == FALSE)
|
||||
Problems::Fatal::filename_related("Can't open headings file", filename_of_headings);
|
||||
filename *F = Task::xml_headings_file();
|
||||
if (STREAM_OPEN_TO_FILE(xf, F, UTF8_ENC) == FALSE)
|
||||
Problems::Fatal::filename_related("Can't open headings file", F);
|
||||
Sentences::Headings::write_headings_as_xml_inner(xf);
|
||||
STREAM_CLOSE(xf);
|
||||
}
|
||||
|
|
|
@ -730,7 +730,7 @@ void ParseTreeUsage::log_node(OUTPUT_STREAM, parse_node *pn) {
|
|||
|
||||
@ =
|
||||
void ParseTreeUsage::write_to_file(void) {
|
||||
ParseTree::write_to_file(filename_of_parse_tree);
|
||||
ParseTree::write_to_file(Task::parse_tree_file());
|
||||
}
|
||||
void ParseTreeUsage::plant_parse_tree(void) {
|
||||
ParseTree::plant_parse_tree();
|
||||
|
|
|
@ -24,7 +24,7 @@ text_stream *PL::Bibliographic::IFID::read_uuid(void) {
|
|||
if (uuid_read >= 0) return uuid_text;
|
||||
uuid_text = Str::new();
|
||||
uuid_read = 0;
|
||||
FILE *xf = Filenames::fopen(filename_of_uuid, "r");
|
||||
FILE *xf = Filenames::fopen(Task::uuid_file(), "r");
|
||||
if (xf == NULL) return uuid_text; /* the UUID is the empty string if the file is missing */
|
||||
int c;
|
||||
while (((c = fgetc(xf)) != EOF) /* the UUID file is plain text, not Unicode */
|
||||
|
|
|
@ -208,8 +208,7 @@ void PL::Bibliographic::Release::handle_release_declaration_inner(parse_node *p)
|
|||
Word::dequote(Wordings::first_wn(SW));
|
||||
TEMPORARY_TEXT(leaf);
|
||||
WRITE_TO(leaf, "%N", Wordings::first_wn(SW));
|
||||
filename_of_existing_story_file =
|
||||
Filenames::in_folder(Inbuild::materials(), leaf);
|
||||
Task::set_existing_storyfile(leaf);
|
||||
DISCARD_TEXT(leaf);
|
||||
}
|
||||
existing_story_file = TRUE;
|
||||
|
@ -224,7 +223,7 @@ void PL::Bibliographic::Release::handle_release_declaration_inner(parse_node *p)
|
|||
filename *A = Filenames::in_folder(Inbuild::materials(), leaf);
|
||||
DISCARD_TEXT(leaf);
|
||||
PL::Bibliographic::Release::create_aux_file(A,
|
||||
pathname_of_materials_release,
|
||||
Task::release_path(),
|
||||
Lexer::word_text(Wordings::first_wn(DW)),
|
||||
payload);
|
||||
break;
|
||||
|
@ -237,7 +236,7 @@ void PL::Bibliographic::Release::handle_release_declaration_inner(parse_node *p)
|
|||
filename *A = Filenames::in_folder(Inbuild::materials(), leaf);
|
||||
DISCARD_TEXT(leaf);
|
||||
PL::Bibliographic::Release::create_aux_file(A,
|
||||
pathname_of_materials_release,
|
||||
Task::release_path(),
|
||||
L"--",
|
||||
payload);
|
||||
break;
|
||||
|
@ -253,7 +252,7 @@ void PL::Bibliographic::Release::handle_release_declaration_inner(parse_node *p)
|
|||
DISCARD_TEXT(leaf);
|
||||
TEMPORARY_TEXT(folder);
|
||||
WRITE_TO(folder, "%N", Wordings::first_wn(FW));
|
||||
pathname *P = Pathnames::subfolder(pathname_of_materials_release, folder);
|
||||
pathname *P = Pathnames::subfolder(Task::release_path(), folder);
|
||||
DISCARD_TEXT(folder);
|
||||
PL::Bibliographic::Release::create_aux_file(A, P, L"--", payload);
|
||||
break;
|
||||
|
@ -364,13 +363,13 @@ application sandboxing in Mac OS X in 2012 may force us to revisit this.
|
|||
}
|
||||
|
||||
@<Create the Release subfolder if not already present@> =
|
||||
if (Pathnames::create_in_file_system(pathname_of_materials_release) == FALSE) {
|
||||
if (Pathnames::create_in_file_system(Task::release_path()) == FALSE) {
|
||||
Problems::Issue::release_problem_path(_p_(Untestable),
|
||||
"In order to release the story file along with other "
|
||||
"resources, I tried to create a folder alongside this "
|
||||
"Inform project, but was unable to do so. The folder "
|
||||
"was to have been called",
|
||||
pathname_of_materials_release);
|
||||
Task::release_path());
|
||||
return;
|
||||
}
|
||||
auxiliary_file *af;
|
||||
|
@ -386,13 +385,13 @@ application sandboxing in Mac OS X in 2012 may force us to revisit this.
|
|||
}
|
||||
|
||||
@<Create the Interpreter subfolder if not already present@> =
|
||||
if (Pathnames::create_in_file_system(pathname_of_released_interpreter) == FALSE) {
|
||||
if (Pathnames::create_in_file_system(Task::released_interpreter_path()) == FALSE) {
|
||||
Problems::Issue::release_problem_path(_p_(Untestable),
|
||||
"In order to release the story file along with an "
|
||||
"interpreter, I tried to create a folder alongside this "
|
||||
"Inform project, but was unable to do so. The folder "
|
||||
"was to have been called",
|
||||
pathname_of_released_interpreter);
|
||||
Task::released_interpreter_path());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -403,11 +402,11 @@ art and see that its dimensions conform to Treaty of Babel requirements.
|
|||
if (release_cover) {
|
||||
current_sentence = cover_filename_sentence;
|
||||
cover_art_format = "";
|
||||
filename *cover_filename = filename_of_large_cover_art_jpeg;
|
||||
filename *cover_filename = Task::large_cover_art_file(TRUE);
|
||||
FILE *COVER_FILE = Filenames::fopen(cover_filename, "rb" );
|
||||
if (COVER_FILE) @<The cover seems to be a JPEG@>
|
||||
else {
|
||||
cover_filename = filename_of_large_cover_art_png;
|
||||
cover_filename = Task::large_cover_art_file(FALSE);
|
||||
COVER_FILE = Filenames::fopen(cover_filename, "rb" );
|
||||
if (COVER_FILE) @<The cover seems to be a PNG@>
|
||||
else @<There seems to be no cover at all@>;
|
||||
|
@ -465,14 +464,14 @@ art and see that its dimensions conform to Treaty of Babel requirements.
|
|||
@<Read header of existing story file if present@> =
|
||||
if (Inbuild::currently_releasing() == FALSE)
|
||||
@<Issue a problem if this isn't a Release run@>;
|
||||
FILE *STORYF = Filenames::fopen(filename_of_existing_story_file, "rb");
|
||||
FILE *STORYF = Filenames::fopen(Task::existing_storyfile_file(), "rb");
|
||||
if (STORYF == NULL) {
|
||||
Problems::Issue::unlocated_problem_on_file(
|
||||
_p_(BelievedImpossible), /* i.e., not testable by intest */
|
||||
"The instruction 'Release along with an existing story file' "
|
||||
"means that I need to bind up a story file called '%1', in "
|
||||
"the .materials folder for this project. But it doesn't seem "
|
||||
"to be there.", filename_of_existing_story_file);
|
||||
"to be there.", Task::existing_storyfile_file());
|
||||
return;
|
||||
}
|
||||
int i;
|
||||
|
@ -506,8 +505,9 @@ art and see that its dimensions conform to Treaty of Babel requirements.
|
|||
|
||||
@<Write iFiction record@> =
|
||||
text_stream xf_struct; text_stream *xf = &xf_struct;
|
||||
if (STREAM_OPEN_TO_FILE(xf, filename_of_ifiction_record, UTF8_ENC) == FALSE)
|
||||
Problems::Fatal::filename_related("Can't open metadata file", filename_of_ifiction_record);
|
||||
filename *F = Task::ifiction_record_file();
|
||||
if (STREAM_OPEN_TO_FILE(xf, F, UTF8_ENC) == FALSE)
|
||||
Problems::Fatal::filename_related("Can't open metadata file", F);
|
||||
BEGIN_COMPILATION_MODE;
|
||||
COMPILATION_MODE_ENTER(COMPILE_TEXT_TO_XML_CMODE);
|
||||
PL::Bibliographic::Release::write_ifiction_record(xf, header, cover_picture_number, cover_art_format, height, width);
|
||||
|
@ -515,16 +515,18 @@ art and see that its dimensions conform to Treaty of Babel requirements.
|
|||
STREAM_CLOSE(xf);
|
||||
|
||||
@<Write release blurb@> =
|
||||
filename *F = Task::blurb_file();
|
||||
text_stream xf_struct; text_stream *xf = &xf_struct;
|
||||
if (STREAM_OPEN_TO_FILE(xf, filename_of_blurb, UTF8_ENC) == FALSE)
|
||||
Problems::Fatal::filename_related("Can't open blurb file", filename_of_blurb);
|
||||
if (STREAM_OPEN_TO_FILE(xf, F, UTF8_ENC) == FALSE)
|
||||
Problems::Fatal::filename_related("Can't open blurb file", F);
|
||||
PL::Bibliographic::Release::write_release_blurb(xf, cover_picture_number, cover_art_format);
|
||||
STREAM_CLOSE(xf);
|
||||
|
||||
@<Write manifest file@> =
|
||||
filename *F = Task::manifest_file();
|
||||
text_stream xf_struct; text_stream *xf = &xf_struct;
|
||||
if (STREAM_OPEN_TO_FILE(xf, filename_of_manifest, UTF8_ENC) == FALSE)
|
||||
Problems::Fatal::filename_related("Can't open manifest file", filename_of_manifest);
|
||||
if (STREAM_OPEN_TO_FILE(xf, F, UTF8_ENC) == FALSE)
|
||||
Problems::Fatal::filename_related("Can't open manifest file", F);
|
||||
PL::Figures::write_picture_manifest(xf, release_cover, cover_art_format);
|
||||
STREAM_CLOSE(xf);
|
||||
|
||||
|
@ -863,21 +865,21 @@ the Blorb-file's filename won't be too long for the file system.
|
|||
|
||||
@<Tell Inblorb where to write its report to@> =
|
||||
WRITE("status \"%f\" \"%f\"\n\n",
|
||||
filename_of_cblorb_report_model,
|
||||
filename_of_cblorb_report);
|
||||
Inbuild::file_from_installation(CBLORB_REPORT_MODEL_IRES),
|
||||
Task::cblorb_report_file());
|
||||
|
||||
@<Tell Inblorb where the project and release folders are@> =
|
||||
WRITE("project folder \"%p\"\n", Projects::path(Task::project()));
|
||||
if (create_Materials)
|
||||
WRITE("release to \"%p\"\n", pathname_of_materials_release);
|
||||
WRITE("release to \"%p\"\n", Task::release_path());
|
||||
|
||||
@<Tell Inblorb where the story file and iFiction files are@> =
|
||||
WRITE("storyfile leafname \""); STREAM_COPY(OUT, TEMP); WRITE("\"\n");
|
||||
if (existing_story_file)
|
||||
WRITE("storyfile \"%f\" include\n", filename_of_existing_story_file);
|
||||
WRITE("storyfile \"%f\" include\n", Task::existing_storyfile_file());
|
||||
else
|
||||
WRITE("storyfile \"%f\" include\n", filename_of_story_file);
|
||||
WRITE("ifiction \"%f\" include\n", filename_of_ifiction_record);
|
||||
WRITE("storyfile \"%f\" include\n", Task::storyfile_file());
|
||||
WRITE("ifiction \"%f\" include\n", Task::ifiction_record_file());
|
||||
|
||||
@ A controversial point here is that if the author supplies no cover art, we
|
||||
supply it for him, and if necessary copy a suitable image into any website
|
||||
|
@ -887,17 +889,17 @@ released along with the work.
|
|||
if (release_cover) {
|
||||
filename *large = NULL;
|
||||
if (strcmp(cover_art_format, "jpg") == 0)
|
||||
large = filename_of_large_cover_art_jpeg;
|
||||
large = Task::large_cover_art_file(TRUE);
|
||||
else
|
||||
large = filename_of_large_cover_art_png;
|
||||
large = Task::large_cover_art_file(FALSE);
|
||||
WRITE("cover \"%f\"\n", large);
|
||||
WRITE("picture %d \"%f\"\n", cover_picture_number, large);
|
||||
} else {
|
||||
WRITE("cover \"%f\"\n", filename_of_large_default_cover_art);
|
||||
WRITE("picture %d \"%f\"\n", 1, filename_of_large_default_cover_art);
|
||||
WRITE("cover \"%f\"\n", Inbuild::file_from_installation(LARGE_DEFAULT_COVER_ART_IRES));
|
||||
WRITE("picture %d \"%f\"\n", 1, Inbuild::file_from_installation(LARGE_DEFAULT_COVER_ART_IRES));
|
||||
if (release_website) {
|
||||
WRITE("release file \"%f\"\n", filename_of_large_default_cover_art);
|
||||
WRITE("release file \"%f\"\n", filename_of_small_default_cover_art);
|
||||
WRITE("release file \"%f\"\n", Inbuild::file_from_installation(LARGE_DEFAULT_COVER_ART_IRES));
|
||||
WRITE("release file \"%f\"\n", Inbuild::file_from_installation(SMALL_DEFAULT_COVER_ART_IRES));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -967,7 +969,7 @@ own credits.
|
|||
auxiliary_file *af;
|
||||
LOOP_OVER(af, auxiliary_file) {
|
||||
TEMPORARY_TEXT(rel);
|
||||
Pathnames::to_text_relative(rel, af->folder_to_release_to, pathname_of_materials_release);
|
||||
Pathnames::to_text_relative(rel, af->folder_to_release_to, Task::release_path());
|
||||
WRITE("auxiliary \"%f\" \"%S\" \"%S\"\n",
|
||||
af->name_of_original_file,
|
||||
(Str::len(af->brief_description) > 0)?(af->brief_description):I"--",
|
||||
|
@ -975,10 +977,10 @@ own credits.
|
|||
DISCARD_TEXT(rel);
|
||||
}
|
||||
if (release_booklet) {
|
||||
WRITE("auxiliary \"%f\" \"Introduction to IF\" \"--\"\n", filename_of_intro_booklet);
|
||||
WRITE("auxiliary \"%f\" \"Introduction to IF\" \"--\"\n", Inbuild::file_from_installation(INTRO_BOOKLET_IRES));
|
||||
}
|
||||
if (release_postcard) {
|
||||
WRITE("auxiliary \"%f\" \"IF Postcard\" \"--\"\n", filename_of_intro_postcard);
|
||||
WRITE("auxiliary \"%f\" \"IF Postcard\" \"--\"\n", Inbuild::file_from_installation(INTRO_POSTCARD_IRES));
|
||||
WRITE("placeholder [OTHERCREDITS] = \"The postcard was written by Andrew Plotkin "
|
||||
"and designed by Lea Albaugh.\"\n");
|
||||
}
|
||||
|
@ -1015,7 +1017,7 @@ file online.
|
|||
WRITE("\"\n");
|
||||
WRITE("interpreter \"%S\" \"%c\"\n", interpreter_template_leafname, Str::get_first_char(ext));
|
||||
WRITE("base64 \"%f\" to \"%p%c",
|
||||
filename_of_story_file, pathname_of_released_interpreter, FOLDER_SEPARATOR);
|
||||
Task::storyfile_file(), Task::released_interpreter_path(), FOLDER_SEPARATOR);
|
||||
STREAM_COPY(OUT, TEMP);
|
||||
WRITE(".js\"\n");
|
||||
|
||||
|
|
|
@ -845,9 +845,10 @@ void PL::EPSMap::render_map_as_EPS(void) {
|
|||
PF_I(map, R)->world_index_colour);
|
||||
|
||||
@<Open a stream and write the EPS map to it@> =
|
||||
filename *F = Task::epsmap_file();
|
||||
text_stream EPS_struct; text_stream *EPS = &EPS_struct;
|
||||
if (STREAM_OPEN_TO_FILE(EPS, filename_of_epsfile, ISO_ENC) == FALSE)
|
||||
Problems::Fatal::filename_related("Can't open EPS map file", filename_of_epsfile);
|
||||
if (STREAM_OPEN_TO_FILE(EPS, F, ISO_ENC) == FALSE)
|
||||
Problems::Fatal::filename_related("Can't open EPS map file", F);
|
||||
PL::EPSMap::EPS_compile_map(EPS);
|
||||
STREAM_CLOSE(EPS);
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ int xrefs_read = FALSE;
|
|||
void Index::DocReferences::read_xrefs(void) {
|
||||
if (xrefs_read == FALSE) {
|
||||
xrefs_read = TRUE;
|
||||
TextFiles::read(filename_of_xrefs, TRUE,
|
||||
TextFiles::read(Inbuild::file_from_installation(DOCUMENTATION_XREFS_IRES), TRUE,
|
||||
NULL, FALSE, Index::DocReferences::read_xrefs_helper, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ void Index::DocReferences::doc_fragment_to(OUTPUT_STREAM, text_stream *fn) {
|
|||
@d MAX_EXTENT_OF_FRAGMENTS 256*1024
|
||||
|
||||
@<Load in the documentation fragments file@> =
|
||||
FILE *FRAGMENTS = Filenames::fopen(filename_of_documentation_snippets, "r");
|
||||
FILE *FRAGMENTS = Filenames::fopen(Inbuild::file_from_installation(DOCUMENTATION_SNIPPETS_IRES), "r");
|
||||
if (FRAGMENTS) {
|
||||
char *p = Memory::I7_malloc(MAX_EXTENT_OF_FRAGMENTS, DOC_FRAGMENT_MREASON);
|
||||
@<Scan the file into memory, translating from UTF-8@>;
|
||||
|
|
|
@ -68,7 +68,7 @@ int index_file_counter = 0;
|
|||
text_stream *ifl = NULL; /* Current destination of index text */
|
||||
text_stream index_file_struct; /* The current index file being written */
|
||||
text_stream *Index::open_file(text_stream *index_leaf, text_stream *title, int sub, text_stream *explanation) {
|
||||
filename *F = Task::location_in_index(index_leaf, sub);
|
||||
filename *F = Task::index_file(index_leaf, sub);
|
||||
if (ifl) Index::close_index_file();
|
||||
if (STREAM_OPEN_TO_FILE(&index_file_struct, F, UTF8_ENC) == FALSE)
|
||||
Problems::Fatal::filename_related("Can't open index file", F);
|
||||
|
|
|
@ -160,10 +160,10 @@ void PL::Figures::register_figure(wording F, wording FN) {
|
|||
|
||||
bf->name = F;
|
||||
if (wn >= 0) {
|
||||
bf->figure_number = Projects::get_next_free_blorb_resource_ID(Task::project());
|
||||
bf->figure_number = Task::get_next_free_blorb_resource_ID();
|
||||
TEMPORARY_TEXT(leaf);
|
||||
WRITE_TO(leaf, "%N", wn);
|
||||
bf->filename_of_image_file = Filenames::in_folder(pathname_of_materials_figures, leaf);
|
||||
bf->filename_of_image_file = Filenames::in_folder(Task::figures_path(), leaf);
|
||||
DISCARD_TEXT(leaf);
|
||||
bf->alt_description = <<alttext>>;
|
||||
} else {
|
||||
|
@ -202,9 +202,9 @@ void PL::Figures::write_picture_manifest(OUTPUT_STREAM, int include_cover,
|
|||
WRITE("<key>1</key>\n");
|
||||
filename *large = NULL;
|
||||
if (strcmp(cover_art_format, "jpg") == 0)
|
||||
large = filename_of_large_cover_art_jpeg;
|
||||
large = Task::large_cover_art_file(TRUE);
|
||||
else
|
||||
large = filename_of_large_cover_art_png;
|
||||
large = Task::large_cover_art_file(FALSE);
|
||||
WRITE("<string>%f</string>\n", large);
|
||||
}
|
||||
LOOP_OVER(bf, blorb_figure)
|
||||
|
@ -249,7 +249,7 @@ void PL::Figures::write_copy_commands(void) {
|
|||
LOOP_OVER(bf, blorb_figure)
|
||||
if (bf->figure_number > 1)
|
||||
PL::Bibliographic::Release::create_aux_file(bf->filename_of_image_file,
|
||||
pathname_of_released_figures, L"--", SEPARATE_FIGURES_PAYLOAD);
|
||||
Task::released_figures_path(), L"--", SEPARATE_FIGURES_PAYLOAD);
|
||||
}
|
||||
|
||||
@ =
|
||||
|
|
|
@ -147,11 +147,11 @@ void PL::Sounds::register_sound(wording F, wording FN) {
|
|||
|
||||
TEMPORARY_TEXT(leaf);
|
||||
WRITE_TO(leaf, "%N", wn);
|
||||
bs->filename_of_sound_file = Filenames::in_folder(pathname_of_materials_sounds, leaf);
|
||||
bs->filename_of_sound_file = Filenames::in_folder(Task::sounds_path(), leaf);
|
||||
DISCARD_TEXT(leaf);
|
||||
|
||||
bs->name = F;
|
||||
bs->sound_number = Projects::get_next_free_blorb_resource_ID(Task::project());
|
||||
bs->sound_number = Task::get_next_free_blorb_resource_ID();
|
||||
bs->alt_description = <<alttext>>;
|
||||
|
||||
LOGIF(FIGURE_CREATIONS,
|
||||
|
@ -209,7 +209,7 @@ void PL::Sounds::write_copy_commands(void) {
|
|||
LOOP_OVER(bs, blorb_sound)
|
||||
PL::Bibliographic::Release::create_aux_file(
|
||||
bs->filename_of_sound_file,
|
||||
pathname_of_released_sounds,
|
||||
Task::released_sounds_path(),
|
||||
L"--",
|
||||
SEPARATE_SOUNDS_PAYLOAD);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue