mirror of
https://github.com/ganelson/inform.git
synced 2024-06-29 05:24:57 +03:00
Made inform7, inbuild and inter command lines more consistent
This commit is contained in:
parent
064b44d9f2
commit
557028ce63
|
@ -40,7 +40,7 @@
|
|||
<ul class="toc"><li><a href="#SP1">§1. Paragraph Control</a></li><li><a href="#SP2">§2. State</a></li><li><a href="#SP3">§3. Say Number</a></li><li><a href="#SP4">§4. Print English Number</a></li></ul><hr class="tocbar">
|
||||
|
||||
<p class="inwebparagraph"><a id="SP1"></a><b>§1. Paragraph Control. </b>Ah, yes: the paragraph breaking algorithm. In TeX: The Program,
|
||||
Donald Knuth writes at \S 768: "It's sort of a miracle whenever <code class="display"><span class="extract">\halign</span></code>
|
||||
Donald Knuth writes at section 768: "It's sort of a miracle whenever <code class="display"><span class="extract">\halign</span></code>
|
||||
and <code class="display"><span class="extract">\valign</span></code> work, because they cut across so many of the control structures
|
||||
of TeX." It's sort of a miracle whenever Inform 7's paragraph breaking
|
||||
system works, too. Most users probably imagine that it's implemented by
|
||||
|
|
|
@ -310,7 +310,7 @@ compiler via Delia scripts in <code class="display"><span class="extract">intest
|
|||
<pre class="displaydefn">
|
||||
<span class="identifier">CommandLine::begin_group</span><span class="plain">(</span><span class="constant">INFORM_TESTING_CLSG</span><span class="plain">, </span><span class="identifier">I</span><span class="string">"for testing and debugging inform7"</span><span class="plain">);</span>
|
||||
<span class="identifier">CommandLine::declare_boolean_switch</span><span class="plain">(</span><span class="constant">CRASHALL_CLSW</span><span class="plain">, </span><span class="identifier">L</span><span class="string">"crash-all"</span><span class="plain">, 1,</span>
|
||||
<span class="identifier">L</span><span class="string">"intentionally crash on Problem messages, for debugger backtracing"</span><span class="plain">, </span><span class="identifier">FALSE</span><span class="plain">);</span>
|
||||
<span class="identifier">L</span><span class="string">"intentionally crash on Problem messages, for backtracing"</span><span class="plain">, </span><span class="identifier">FALSE</span><span class="plain">);</span>
|
||||
<span class="identifier">CommandLine::declare_boolean_switch</span><span class="plain">(</span><span class="constant">INDEX_CLSW</span><span class="plain">, </span><span class="identifier">L</span><span class="string">"index"</span><span class="plain">, 1,</span>
|
||||
<span class="identifier">L</span><span class="string">"produce an Index"</span><span class="plain">, </span><span class="identifier">TRUE</span><span class="plain">);</span>
|
||||
<span class="identifier">CommandLine::declare_boolean_switch</span><span class="plain">(</span><span class="constant">PROGRESS_CLSW</span><span class="plain">, </span><span class="identifier">L</span><span class="string">"progress"</span><span class="plain">, 1,</span>
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
-verbose print running notes on what's happening (default is -no-verbose)
|
||||
|
||||
-at X specify that this tool is installed at X
|
||||
-crash intentionally crash on internal errors, for debugger backtracing (default is -no-crash)
|
||||
-crash intentionally crash on internal errors, for backtracing (default is -no-crash)
|
||||
-fixtime pretend the time is 11 a.m. on 28 March 2016 for testing (default is -no-fixtime)
|
||||
-help print this help information
|
||||
-log X write the debugging log to include diagnostics on X
|
||||
|
|
|
@ -162,9 +162,9 @@ to add and process command line switches handled by inbuild:
|
|||
<span class="identifier">CommandLine::declare_switch</span><span class="plain">(</span><span class="constant">KIT_CLSW</span><span class="plain">, </span><span class="identifier">L</span><span class="string">"kit"</span><span class="plain">, 2,</span>
|
||||
<span class="identifier">L</span><span class="string">"include Inter code from the kit called X"</span><span class="plain">);</span>
|
||||
<span class="identifier">CommandLine::declare_switch</span><span class="plain">(</span><span class="constant">PIPELINE_CLSW</span><span class="plain">, </span><span class="identifier">L</span><span class="string">"pipeline"</span><span class="plain">, 2,</span>
|
||||
<span class="identifier">L</span><span class="string">"specify code-generation pipeline"</span><span class="plain">);</span>
|
||||
<span class="identifier">L</span><span class="string">"specify code-generation pipeline by name (default is \</span><span class="plain">"</span><span class="string">compile\</span><span class="plain">"</span><span class="string">)"</span><span class="plain">);</span>
|
||||
<span class="identifier">CommandLine::declare_switch</span><span class="plain">(</span><span class="constant">PIPELINE_FILE_CLSW</span><span class="plain">, </span><span class="identifier">L</span><span class="string">"pipeline-file"</span><span class="plain">, 2,</span>
|
||||
<span class="identifier">L</span><span class="string">"specify code-generation pipeline from file X"</span><span class="plain">);</span>
|
||||
<span class="identifier">L</span><span class="string">"specify code-generation pipeline as file X"</span><span class="plain">);</span>
|
||||
<span class="identifier">CommandLine::declare_switch</span><span class="plain">(</span><span class="constant">PIPELINE_VARIABLE_CLSW</span><span class="plain">, </span><span class="identifier">L</span><span class="string">"variable"</span><span class="plain">, 2,</span>
|
||||
<span class="identifier">L</span><span class="string">"set pipeline variable X (in form name=value)"</span><span class="plain">);</span>
|
||||
<span class="identifier">CommandLine::end_group</span><span class="plain">();</span>
|
||||
|
@ -172,8 +172,8 @@ to add and process command line switches handled by inbuild:
|
|||
<span class="functiontext">Inbuild::set_defaults</span><span class="plain">();</span>
|
||||
<span class="plain">}</span>
|
||||
|
||||
<span class="identifier">text_stream</span><span class="plain"> *</span><span class="identifier">inter_processing_file</span><span class="plain"> = </span><span class="identifier">NULL</span><span class="plain">;</span>
|
||||
<span class="identifier">text_stream</span><span class="plain"> *</span><span class="identifier">inter_processing_pipeline</span><span class="plain"> = </span><span class="identifier">NULL</span><span class="plain">;</span>
|
||||
<span class="identifier">filename</span><span class="plain"> *</span><span class="identifier">inter_pipeline_file</span><span class="plain"> = </span><span class="identifier">NULL</span><span class="plain">;</span>
|
||||
<span class="identifier">text_stream</span><span class="plain"> *</span><span class="identifier">inter_pipeline_name</span><span class="plain"> = </span><span class="identifier">NULL</span><span class="plain">;</span>
|
||||
<span class="identifier">dictionary</span><span class="plain"> *</span><span class="identifier">pipeline_vars</span><span class="plain"> = </span><span class="identifier">NULL</span><span class="plain">;</span>
|
||||
<span class="identifier">pathname</span><span class="plain"> *</span><span class="identifier">shared_transient_resources</span><span class="plain"> = </span><span class="identifier">NULL</span><span class="plain">;</span>
|
||||
<span class="reserved">int</span><span class="plain"> </span><span class="identifier">this_is_a_debug_compile</span><span class="plain"> = </span><span class="identifier">FALSE</span><span class="plain">; </span> <span class="comment">Destined to be compiled with debug features</span>
|
||||
|
@ -183,16 +183,16 @@ to add and process command line switches handled by inbuild:
|
|||
<span class="reserved">int</span><span class="plain"> </span><span class="identifier">rng_seed_at_start_of_play</span><span class="plain"> = 0; </span> <span class="comment">The seed value, or 0 if not seeded</span>
|
||||
|
||||
<span class="reserved">void</span><span class="plain"> </span><span class="functiontext">Inbuild::set_defaults</span><span class="plain">(</span><span class="reserved">void</span><span class="plain">) {</span>
|
||||
<span class="identifier">inter_processing_pipeline</span><span class="plain"> = </span><span class="identifier">Str::new</span><span class="plain">();</span>
|
||||
<span class="identifier">inter_processing_file</span><span class="plain"> = </span><span class="identifier">I</span><span class="string">"compile"</span><span class="plain">;</span>
|
||||
<span class="identifier">inter_pipeline_name</span><span class="plain"> = </span><span class="identifier">Str::new</span><span class="plain">(); </span><span class="identifier">WRITE_TO</span><span class="plain">(</span><span class="identifier">inter_pipeline_name</span><span class="plain">, </span><span class="string">"compile"</span><span class="plain">);</span>
|
||||
<span class="identifier">inter_pipeline_file</span><span class="plain"> = </span><span class="identifier">NULL</span><span class="plain">;</span>
|
||||
<span class="plain">}</span>
|
||||
|
||||
<span class="reserved">void</span><span class="plain"> </span><span class="functiontext">Inbuild::set_inter_pipeline</span><span class="plain">(</span><span class="identifier">wording</span><span class="plain"> </span><span class="identifier">W</span><span class="plain">) {</span>
|
||||
<span class="identifier">inter_processing_pipeline</span><span class="plain"> = </span><span class="identifier">Str::new</span><span class="plain">();</span>
|
||||
<span class="identifier">WRITE_TO</span><span class="plain">(</span><span class="identifier">inter_processing_pipeline</span><span class="plain">, </span><span class="string">"%W"</span><span class="plain">, </span><span class="identifier">W</span><span class="plain">);</span>
|
||||
<span class="identifier">Str::delete_first_character</span><span class="plain">(</span><span class="identifier">inter_processing_pipeline</span><span class="plain">);</span>
|
||||
<span class="identifier">Str::delete_last_character</span><span class="plain">(</span><span class="identifier">inter_processing_pipeline</span><span class="plain">);</span>
|
||||
<span class="identifier">LOG</span><span class="plain">(</span><span class="string">"Setting pipeline %S\</span><span class="plain">n</span><span class="string">"</span><span class="plain">, </span><span class="identifier">inter_processing_pipeline</span><span class="plain">);</span>
|
||||
<span class="identifier">inter_pipeline_name</span><span class="plain"> = </span><span class="identifier">Str::new</span><span class="plain">();</span>
|
||||
<span class="identifier">WRITE_TO</span><span class="plain">(</span><span class="identifier">inter_pipeline_name</span><span class="plain">, </span><span class="string">"%W"</span><span class="plain">, </span><span class="identifier">W</span><span class="plain">);</span>
|
||||
<span class="identifier">Str::delete_first_character</span><span class="plain">(</span><span class="identifier">inter_pipeline_name</span><span class="plain">);</span>
|
||||
<span class="identifier">Str::delete_last_character</span><span class="plain">(</span><span class="identifier">inter_pipeline_name</span><span class="plain">);</span>
|
||||
<span class="identifier">LOG</span><span class="plain">(</span><span class="string">"Setting pipeline %S\</span><span class="plain">n</span><span class="string">"</span><span class="plain">, </span><span class="identifier">inter_pipeline_name</span><span class="plain">);</span>
|
||||
<span class="plain">}</span>
|
||||
|
||||
<span class="reserved">void</span><span class="plain"> </span><span class="functiontext">Inbuild::option</span><span class="plain">(</span><span class="reserved">int</span><span class="plain"> </span><span class="identifier">id</span><span class="plain">, </span><span class="reserved">int</span><span class="plain"> </span><span class="identifier">val</span><span class="plain">, </span><span class="identifier">text_stream</span><span class="plain"> *</span><span class="identifier">arg</span><span class="plain">, </span><span class="reserved">void</span><span class="plain"> *</span><span class="identifier">state</span><span class="plain">) {</span>
|
||||
|
@ -215,8 +215,8 @@ to add and process command line switches handled by inbuild:
|
|||
<span class="identifier">Errors::fatal_with_text</span><span class="plain">(</span><span class="string">"can't specify the source file twice: '%S'"</span><span class="plain">, </span><span class="identifier">arg</span><span class="plain">);</span>
|
||||
<span class="reserved">break</span><span class="plain">;</span>
|
||||
<span class="reserved">case</span><span class="plain"> </span><span class="constant">CENSUS_CLSW</span><span class="plain">: </span><span class="identifier">census_mode</span><span class="plain"> = </span><span class="identifier">val</span><span class="plain">; </span><span class="reserved">break</span><span class="plain">;</span>
|
||||
<span class="reserved">case</span><span class="plain"> </span><span class="constant">PIPELINE_CLSW</span><span class="plain">: </span><span class="identifier">inter_processing_pipeline</span><span class="plain"> = </span><span class="identifier">Str::duplicate</span><span class="plain">(</span><span class="identifier">arg</span><span class="plain">); </span><span class="reserved">break</span><span class="plain">;</span>
|
||||
<span class="reserved">case</span><span class="plain"> </span><span class="constant">PIPELINE_FILE_CLSW</span><span class="plain">: </span><span class="identifier">inter_processing_file</span><span class="plain"> = </span><span class="identifier">Str::duplicate</span><span class="plain">(</span><span class="identifier">arg</span><span class="plain">); </span><span class="reserved">break</span><span class="plain">;</span>
|
||||
<span class="reserved">case</span><span class="plain"> </span><span class="constant">PIPELINE_CLSW</span><span class="plain">: </span><span class="identifier">inter_pipeline_name</span><span class="plain"> = </span><span class="identifier">Str::duplicate</span><span class="plain">(</span><span class="identifier">arg</span><span class="plain">); </span><span class="reserved">break</span><span class="plain">;</span>
|
||||
<span class="reserved">case</span><span class="plain"> </span><span class="constant">PIPELINE_FILE_CLSW</span><span class="plain">: </span><span class="identifier">inter_pipeline_file</span><span class="plain"> = </span><span class="identifier">Filenames::from_text</span><span class="plain">(</span><span class="identifier">arg</span><span class="plain">); </span><span class="reserved">break</span><span class="plain">;</span>
|
||||
<span class="reserved">case</span><span class="plain"> </span><span class="constant">PIPELINE_VARIABLE_CLSW</span><span class="plain">: {</span>
|
||||
<span class="identifier">match_results</span><span class="plain"> </span><span class="identifier">mr</span><span class="plain"> = </span><span class="identifier">Regexp::create_mr</span><span class="plain">();</span>
|
||||
<span class="reserved">if</span><span class="plain"> (</span><span class="identifier">Regexp::match</span><span class="plain">(&</span><span class="identifier">mr</span><span class="plain">, </span><span class="identifier">arg</span><span class="plain">, </span><span class="identifier">L</span><span class="string">"(%c+)=(%c+)"</span><span class="plain">)) {</span>
|
||||
|
|
|
@ -138,30 +138,22 @@
|
|||
<span class="identifier">Str::copy</span><span class="plain">(</span><span class="identifier">Dictionaries::create_text</span><span class="plain">(</span><span class="identifier">pipeline_vars</span><span class="plain">, </span><span class="identifier">I</span><span class="string">"*out"</span><span class="plain">),</span>
|
||||
<span class="identifier">Filenames::get_leafname</span><span class="plain">(</span><span class="identifier">S</span><span class="plain">-</span><span class="element">>vertex</span><span class="plain">-</span><span class="element">>buildable_if_internal_file</span><span class="plain">));</span>
|
||||
|
||||
<span class="identifier">codegen_pipeline</span><span class="plain"> *</span><span class="identifier">SS</span><span class="plain"> = </span><span class="identifier">NULL</span><span class="plain">;</span>
|
||||
<span class="reserved">if</span><span class="plain"> (</span><span class="identifier">Str::len</span><span class="plain">(</span><span class="identifier">inter_processing_pipeline</span><span class="plain">) > 0) {</span>
|
||||
<span class="identifier">SS</span><span class="plain"> = </span><span class="identifier">CodeGen::Pipeline::parse</span><span class="plain">(</span><span class="identifier">inter_processing_pipeline</span><span class="plain">, </span><span class="identifier">pipeline_vars</span><span class="plain">);</span>
|
||||
<span class="reserved">if</span><span class="plain"> (</span><span class="identifier">SS</span><span class="plain"> == </span><span class="identifier">NULL</span><span class="plain">) {</span>
|
||||
<span class="identifier">Errors::nowhere</span><span class="plain">(</span><span class="string">"inter pipeline text could not be parsed"</span><span class="plain">);</span>
|
||||
<span class="reserved">return</span><span class="plain"> </span><span class="identifier">FALSE</span><span class="plain">;</span>
|
||||
<span class="plain">}</span>
|
||||
<span class="plain">} </span><span class="reserved">else</span><span class="plain"> {</span>
|
||||
<span class="identifier">filename</span><span class="plain"> *</span><span class="identifier">F</span><span class="plain"> = </span><span class="identifier">inter_pipeline_file</span><span class="plain">;</span>
|
||||
<span class="reserved">if</span><span class="plain"> (</span><span class="identifier">F</span><span class="plain"> == </span><span class="identifier">NULL</span><span class="plain">) {</span>
|
||||
<span class="reserved">inbuild_requirement</span><span class="plain"> *</span><span class="identifier">req</span><span class="plain"> =</span>
|
||||
<span class="functiontext">Requirements::any_version_of</span><span class="plain">(</span><span class="functiontext">Works::new</span><span class="plain">(</span><span class="identifier">pipeline_genre</span><span class="plain">, </span><span class="identifier">inter_processing_file</span><span class="plain">, </span><span class="identifier">NULL</span><span class="plain">));</span>
|
||||
<span class="functiontext">Requirements::any_version_of</span><span class="plain">(</span><span class="functiontext">Works::new</span><span class="plain">(</span><span class="identifier">pipeline_genre</span><span class="plain">, </span><span class="identifier">inter_pipeline_name</span><span class="plain">, </span><span class="identifier">NULL</span><span class="plain">));</span>
|
||||
<span class="reserved">inbuild_search_result</span><span class="plain"> *</span><span class="identifier">R</span><span class="plain"> = </span><span class="functiontext">Nests::first_found</span><span class="plain">(</span><span class="identifier">req</span><span class="plain">, </span><span class="functiontext">Inbuild::nest_list</span><span class="plain">());</span>
|
||||
<span class="reserved">if</span><span class="plain"> (</span><span class="identifier">R</span><span class="plain"> == </span><span class="identifier">NULL</span><span class="plain">) {</span>
|
||||
<span class="identifier">WRITE_TO</span><span class="plain">(</span><span class="identifier">STDERR</span><span class="plain">, </span><span class="string">"Sought pipeline '%S'\</span><span class="plain">n</span><span class="string">"</span><span class="plain">, </span><span class="identifier">inter_processing_file</span><span class="plain">);</span>
|
||||
<span class="identifier">Errors::nowhere</span><span class="plain">(</span><span class="string">"inter pipeline file could not be found"</span><span class="plain">);</span>
|
||||
<span class="identifier">Errors::with_text</span><span class="plain">(</span><span class="string">"inter pipeline '%S' could not be found"</span><span class="plain">, </span><span class="identifier">inter_pipeline_name</span><span class="plain">);</span>
|
||||
<span class="reserved">return</span><span class="plain"> </span><span class="identifier">FALSE</span><span class="plain">;</span>
|
||||
<span class="plain">}</span>
|
||||
<span class="reserved">inbuild_copy</span><span class="plain"> *</span><span class="identifier">C</span><span class="plain"> = </span><span class="identifier">R</span><span class="plain">-</span><span class="element">>copy</span><span class="plain">;</span>
|
||||
<span class="identifier">filename</span><span class="plain"> *</span><span class="identifier">F</span><span class="plain"> = </span><span class="identifier">C</span><span class="plain">-</span><span class="element">>location_if_file</span><span class="plain">;</span>
|
||||
<span class="identifier">SS</span><span class="plain"> = </span><span class="identifier">CodeGen::Pipeline::parse_from_file</span><span class="plain">(</span><span class="identifier">F</span><span class="plain">, </span><span class="identifier">pipeline_vars</span><span class="plain">);</span>
|
||||
<span class="identifier">F</span><span class="plain"> = </span><span class="identifier">R</span><span class="plain">-</span><span class="element">>copy</span><span class="plain">-</span><span class="element">>location_if_file</span><span class="plain">;</span>
|
||||
<span class="plain">}</span>
|
||||
<span class="identifier">codegen_pipeline</span><span class="plain"> *</span><span class="identifier">SS</span><span class="plain"> = </span><span class="identifier">CodeGen::Pipeline::parse_from_file</span><span class="plain">(</span><span class="identifier">F</span><span class="plain">, </span><span class="identifier">pipeline_vars</span><span class="plain">);</span>
|
||||
<span class="reserved">if</span><span class="plain"> (</span><span class="identifier">SS</span><span class="plain"> == </span><span class="identifier">NULL</span><span class="plain">) {</span>
|
||||
<span class="identifier">Errors::nowhere</span><span class="plain">(</span><span class="string">"inter pipeline file could not be parsed"</span><span class="plain">);</span>
|
||||
<span class="reserved">return</span><span class="plain"> </span><span class="identifier">FALSE</span><span class="plain">;</span>
|
||||
<span class="plain">}</span>
|
||||
<span class="plain">}</span>
|
||||
<span class="identifier">CodeGen::Pipeline::set_repository</span><span class="plain">(</span><span class="identifier">SS</span><span class="plain">, </span><span class="identifier">Emit::tree</span><span class="plain">());</span>
|
||||
<span class="identifier">CodeGen::Pipeline::run</span><span class="plain">(</span><span class="identifier">Filenames::get_path_to</span><span class="plain">(</span><span class="identifier">S</span><span class="plain">-</span><span class="element">>vertex</span><span class="plain">-</span><span class="element">>buildable_if_internal_file</span><span class="plain">),</span>
|
||||
<span class="identifier">SS</span><span class="plain">, </span><span class="functiontext">Kits::inter_paths</span><span class="plain">(), </span><span class="functiontext">Projects::list_of_inter_libraries</span><span class="plain">(</span><span class="functiontext">Inbuild::project</span><span class="plain">()));</span>
|
||||
|
|
|
@ -106,12 +106,12 @@ and those not documented in this manual are covered in that one.
|
|||
|
||||
for tweaking code generation from Inter:
|
||||
-kit X include Inter code from the kit called X
|
||||
-pipeline X specify code-generation pipeline
|
||||
-pipeline-file X specify code-generation pipeline from file X
|
||||
-pipeline X specify code-generation pipeline by name (default is "compile")
|
||||
-pipeline-file X specify code-generation pipeline as file X
|
||||
-variable X set pipeline variable X (in form name=value)
|
||||
|
||||
-at X specify that this tool is installed at X
|
||||
-crash intentionally crash on internal errors, for debugger backtracing (default is -no-crash)
|
||||
-crash intentionally crash on internal errors, for backtracing (default is -no-crash)
|
||||
-fixtime pretend the time is 11 a.m. on 28 March 2016 for testing (default is -no-fixtime)
|
||||
-help print this help information
|
||||
-log X write the debugging log to include diagnostics on X
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
-xrefs X write a file of documentation cross-references to filename X
|
||||
|
||||
-at X specify that this tool is installed at X
|
||||
-crash intentionally crash on internal errors, for debugger backtracing (default is -no-crash)
|
||||
-crash intentionally crash on internal errors, for backtracing (default is -no-crash)
|
||||
-fixtime pretend the time is 11 a.m. on 28 March 2016 for testing (default is -no-fixtime)
|
||||
-help print this help information
|
||||
-log X write the debugging log to include diagnostics on X
|
||||
|
|
|
@ -86,19 +86,19 @@
|
|||
|
||||
for tweaking code generation from Inter:
|
||||
-kit X include Inter code from the kit called X
|
||||
-pipeline X specify code-generation pipeline
|
||||
-pipeline-file X specify code-generation pipeline from file X
|
||||
-pipeline X specify code-generation pipeline by name (default is "compile")
|
||||
-pipeline-file X specify code-generation pipeline as file X
|
||||
-variable X set pipeline variable X (in form name=value)
|
||||
|
||||
for testing and debugging inform7:
|
||||
-crash-all intentionally crash on Problem messages, for debugger backtracing (default is -no-crash-all)
|
||||
-crash-all intentionally crash on Problem messages, for backtracing (default is -no-crash-all)
|
||||
-no-index don't produce an Index (default is -index)
|
||||
-no-progress don't display progress percentages (default is -progress)
|
||||
-require-problem X return 0 unless exactly this Problem message is generated
|
||||
-sigils print Problem message sigils (default is -no-sigils)
|
||||
|
||||
-at X specify that this tool is installed at X
|
||||
-crash intentionally crash on internal errors, for debugger backtracing (default is -no-crash)
|
||||
-crash intentionally crash on internal errors, for backtracing (default is -no-crash)
|
||||
-fixtime pretend the time is 11 a.m. on 28 March 2016 for testing (default is -no-fixtime)
|
||||
-help print this help information
|
||||
-log X write the debugging log to include diagnostics on X
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
-verbose explain what inpolicy is doing (default is -no-verbose)
|
||||
|
||||
-at X specify that this tool is installed at X
|
||||
-crash intentionally crash on internal errors, for debugger backtracing (default is -no-crash)
|
||||
-crash intentionally crash on internal errors, for backtracing (default is -no-crash)
|
||||
-fixtime pretend the time is 11 a.m. on 28 March 2016 for testing (default is -no-fixtime)
|
||||
-help print this help information
|
||||
-log X write the debugging log to include diagnostics on X
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
-no-font don't explicitly set sans-serif fonts by name (default is -font)
|
||||
|
||||
-at X specify that this tool is installed at X
|
||||
-crash intentionally crash on internal errors, for debugger backtracing (default is -no-crash)
|
||||
-crash intentionally crash on internal errors, for backtracing (default is -no-crash)
|
||||
-fixtime pretend the time is 11 a.m. on 28 March 2016 for testing (default is -no-fixtime)
|
||||
-help print this help information
|
||||
-log X write the debugging log to include diagnostics on X
|
||||
|
|
|
@ -71,7 +71,6 @@
|
|||
<span class="definitionkeyword">enum</span> <span class="constant">PIPELINE_FILE_CLSW</span>
|
||||
<span class="definitionkeyword">enum</span> <span class="constant">PIPELINE_VARIABLE_CLSW</span>
|
||||
<span class="definitionkeyword">enum</span> <span class="constant">DOMAIN_CLSW</span>
|
||||
<span class="definitionkeyword">enum</span> <span class="constant">TEMPLATE_CLSW</span>
|
||||
<span class="definitionkeyword">enum</span> <span class="constant">TEST_CLSW</span>
|
||||
<span class="definitionkeyword">enum</span> <span class="constant">ARCHITECTURE_CLSW</span>
|
||||
<span class="definitionkeyword">enum</span> <span class="constant">ASSIMILATE_CLSW</span>
|
||||
|
@ -80,7 +79,7 @@
|
|||
<pre class="display">
|
||||
<span class="reserved">pathname</span><span class="plain"> *</span><span class="identifier">path_to_inter</span><span class="plain"> = </span><span class="identifier">NULL</span><span class="plain">;</span>
|
||||
<span class="reserved">pathname</span><span class="plain"> *</span><span class="identifier">path_to_pipelines</span><span class="plain"> = </span><span class="identifier">NULL</span><span class="plain">;</span>
|
||||
<span class="reserved">pathname</span><span class="plain"> *</span><span class="identifier">template_path</span><span class="plain"> = </span><span class="identifier">NULL</span><span class="plain">;</span>
|
||||
<span class="reserved">pathname</span><span class="plain"> *</span><span class="identifier">kit_path</span><span class="plain"> = </span><span class="identifier">NULL</span><span class="plain">;</span>
|
||||
<span class="reserved">int</span><span class="plain"> </span><span class="identifier">template_action</span><span class="plain"> = -1;</span>
|
||||
<span class="reserved">pathname</span><span class="plain"> *</span><span class="identifier">domain_path</span><span class="plain"> = </span><span class="identifier">NULL</span><span class="plain">;</span>
|
||||
<span class="reserved">filename</span><span class="plain"> *</span><span class="identifier">output_textually</span><span class="plain"> = </span><span class="identifier">NULL</span><span class="plain">;</span>
|
||||
|
@ -110,22 +109,20 @@
|
|||
<span class="identifier">L</span><span class="string">"write to file X in textual format"</span><span class="plain">);</span>
|
||||
<span class="functiontext">CommandLine::declare_switch</span><span class="plain">(</span><span class="constant">BINARY_CLSW</span><span class="plain">, </span><span class="identifier">L</span><span class="string">"binary"</span><span class="plain">, 2,</span>
|
||||
<span class="identifier">L</span><span class="string">"write to file X in binary format"</span><span class="plain">);</span>
|
||||
<span class="functiontext">CommandLine::declare_switch</span><span class="plain">(</span><span class="constant">PIPELINE_CLSW</span><span class="plain">, </span><span class="identifier">L</span><span class="string">"pipeline"</span><span class="plain">, 2,</span>
|
||||
<span class="identifier">L</span><span class="string">"specify pipeline textually"</span><span class="plain">);</span>
|
||||
<span class="functiontext">CommandLine::declare_switch</span><span class="plain">(</span><span class="constant">PIPELINE_CLSW</span><span class="plain">, </span><span class="identifier">L</span><span class="string">"pipeline-text"</span><span class="plain">, 2,</span>
|
||||
<span class="identifier">L</span><span class="string">"specify pipeline textually, with X being a comma-separated list of stages"</span><span class="plain">);</span>
|
||||
<span class="functiontext">CommandLine::declare_switch</span><span class="plain">(</span><span class="constant">PIPELINE_FILE_CLSW</span><span class="plain">, </span><span class="identifier">L</span><span class="string">"pipeline-file"</span><span class="plain">, 2,</span>
|
||||
<span class="identifier">L</span><span class="string">"specify pipeline from file X"</span><span class="plain">);</span>
|
||||
<span class="identifier">L</span><span class="string">"specify pipeline as file X"</span><span class="plain">);</span>
|
||||
<span class="functiontext">CommandLine::declare_switch</span><span class="plain">(</span><span class="constant">PIPELINE_VARIABLE_CLSW</span><span class="plain">, </span><span class="identifier">L</span><span class="string">"variable"</span><span class="plain">, 2,</span>
|
||||
<span class="identifier">L</span><span class="string">"set pipeline variable X (in form name=value)"</span><span class="plain">);</span>
|
||||
<span class="functiontext">CommandLine::declare_switch</span><span class="plain">(</span><span class="constant">TEMPLATE_CLSW</span><span class="plain">, </span><span class="identifier">L</span><span class="string">"template"</span><span class="plain">, 2,</span>
|
||||
<span class="identifier">L</span><span class="string">"specify folder holding i6t template files"</span><span class="plain">);</span>
|
||||
<span class="functiontext">CommandLine::declare_switch</span><span class="plain">(</span><span class="constant">TEST_CLSW</span><span class="plain">, </span><span class="identifier">L</span><span class="string">"test"</span><span class="plain">, 2,</span>
|
||||
<span class="identifier">L</span><span class="string">"perform unit tests from file X"</span><span class="plain">);</span>
|
||||
<span class="functiontext">CommandLine::declare_switch</span><span class="plain">(</span><span class="constant">DOMAIN_CLSW</span><span class="plain">, </span><span class="identifier">L</span><span class="string">"domain"</span><span class="plain">, 2,</span>
|
||||
<span class="identifier">L</span><span class="string">"specify folder to read/write inter files from/to"</span><span class="plain">);</span>
|
||||
<span class="functiontext">CommandLine::declare_switch</span><span class="plain">(</span><span class="constant">ARCHITECTURE_CLSW</span><span class="plain">, </span><span class="identifier">L</span><span class="string">"architecture"</span><span class="plain">, 2,</span>
|
||||
<span class="identifier">L</span><span class="string">"generate inter with architecture X"</span><span class="plain">);</span>
|
||||
<span class="identifier">L</span><span class="string">"generate Inter with architecture X"</span><span class="plain">);</span>
|
||||
<span class="functiontext">CommandLine::declare_switch</span><span class="plain">(</span><span class="constant">ASSIMILATE_CLSW</span><span class="plain">, </span><span class="identifier">L</span><span class="string">"assimilate"</span><span class="plain">, 2,</span>
|
||||
<span class="identifier">L</span><span class="string">"assimilate I6T code into inter inside template X"</span><span class="plain">);</span>
|
||||
<span class="identifier">L</span><span class="string">"assimilate (i.e., build) Inter kit X for the current architecture"</span><span class="plain">);</span>
|
||||
|
||||
<span class="identifier">pipeline_vars</span><span class="plain"> = </span><span class="functiontext">CodeGen::Pipeline::basic_dictionary</span><span class="plain">(</span><span class="identifier">I</span><span class="string">"output.i6"</span><span class="plain">);</span>
|
||||
|
||||
|
@ -134,8 +131,8 @@
|
|||
<span class="reserved">if</span><span class="plain"> (</span><span class="identifier">template_action</span><span class="plain"> == </span><span class="constant">ASSIMILATE_CLSW</span><span class="plain">) {</span>
|
||||
<span class="reserved">inter_architecture</span><span class="plain"> *</span><span class="identifier">A</span><span class="plain"> = </span><span class="functiontext">CodeGen::Architecture::current</span><span class="plain">();</span>
|
||||
<span class="reserved">if</span><span class="plain"> (</span><span class="identifier">A</span><span class="plain"> == </span><span class="identifier">NULL</span><span class="plain">) </span><span class="functiontext">Errors::fatal</span><span class="plain">(</span><span class="string">"no -architecture given"</span><span class="plain">);</span>
|
||||
<span class="reserved">filename</span><span class="plain"> *</span><span class="identifier">assim</span><span class="plain"> = </span><span class="functiontext">Architectures::canonical_binary</span><span class="plain">(</span><span class="identifier">template_path</span><span class="plain">, </span><span class="identifier">A</span><span class="plain">);</span>
|
||||
<span class="reserved">filename</span><span class="plain"> *</span><span class="identifier">assim_t</span><span class="plain"> = </span><span class="functiontext">Architectures::canonical_textual</span><span class="plain">(</span><span class="identifier">template_path</span><span class="plain">, </span><span class="identifier">A</span><span class="plain">);</span>
|
||||
<span class="reserved">filename</span><span class="plain"> *</span><span class="identifier">assim</span><span class="plain"> = </span><span class="functiontext">Architectures::canonical_binary</span><span class="plain">(</span><span class="identifier">kit_path</span><span class="plain">, </span><span class="identifier">A</span><span class="plain">);</span>
|
||||
<span class="reserved">filename</span><span class="plain"> *</span><span class="identifier">assim_t</span><span class="plain"> = </span><span class="functiontext">Architectures::canonical_textual</span><span class="plain">(</span><span class="identifier">kit_path</span><span class="plain">, </span><span class="identifier">A</span><span class="plain">);</span>
|
||||
<span class="identifier">pipeline_as_file</span><span class="plain"> = </span><span class="functiontext">Filenames::in_folder</span><span class="plain">(</span><span class="identifier">path_to_pipelines</span><span class="plain">, </span><span class="identifier">I</span><span class="string">"assimilate.interpipeline"</span><span class="plain">);</span>
|
||||
<span class="identifier">TEMPORARY_TEXT</span><span class="plain">(</span><span class="identifier">fullname</span><span class="plain">);</span>
|
||||
<span class="identifier">WRITE_TO</span><span class="plain">(</span><span class="identifier">fullname</span><span class="plain">, </span><span class="string">"%f"</span><span class="plain">, </span><span class="identifier">assim</span><span class="plain">);</span>
|
||||
|
@ -144,7 +141,7 @@
|
|||
<span class="identifier">WRITE_TO</span><span class="plain">(</span><span class="identifier">fullname</span><span class="plain">, </span><span class="string">"%f"</span><span class="plain">, </span><span class="identifier">assim_t</span><span class="plain">);</span>
|
||||
<span class="functiontext">Str::copy</span><span class="plain">(</span><span class="functiontext">Dictionaries::create_text</span><span class="plain">(</span><span class="identifier">pipeline_vars</span><span class="plain">, </span><span class="identifier">I</span><span class="string">"*outt"</span><span class="plain">), </span><span class="identifier">fullname</span><span class="plain">);</span>
|
||||
<span class="identifier">DISCARD_TEXT</span><span class="plain">(</span><span class="identifier">fullname</span><span class="plain">);</span>
|
||||
<span class="functiontext">Str::copy</span><span class="plain">(</span><span class="functiontext">Dictionaries::create_text</span><span class="plain">(</span><span class="identifier">pipeline_vars</span><span class="plain">, </span><span class="identifier">I</span><span class="string">"*attach"</span><span class="plain">), </span><span class="functiontext">Pathnames::directory_name</span><span class="plain">(</span><span class="identifier">template_path</span><span class="plain">));</span>
|
||||
<span class="functiontext">Str::copy</span><span class="plain">(</span><span class="functiontext">Dictionaries::create_text</span><span class="plain">(</span><span class="identifier">pipeline_vars</span><span class="plain">, </span><span class="identifier">I</span><span class="string">"*attach"</span><span class="plain">), </span><span class="functiontext">Pathnames::directory_name</span><span class="plain">(</span><span class="identifier">kit_path</span><span class="plain">));</span>
|
||||
<span class="plain">}</span>
|
||||
|
||||
<span class="functiontext">Main::act</span><span class="plain">();</span>
|
||||
|
@ -189,8 +186,7 @@
|
|||
<span class="reserved">break</span><span class="plain">;</span>
|
||||
<span class="plain">}</span>
|
||||
<span class="reserved">case</span><span class="plain"> </span><span class="constant">DOMAIN_CLSW</span><span class="plain">: </span><span class="identifier">domain_path</span><span class="plain"> = </span><span class="functiontext">Pathnames::from_text</span><span class="plain">(</span><span class="identifier">arg</span><span class="plain">); </span><span class="identifier">pipeline_as_text</span><span class="plain"> = </span><span class="identifier">NULL</span><span class="plain">; </span><span class="reserved">break</span><span class="plain">;</span>
|
||||
<span class="reserved">case</span><span class="plain"> </span><span class="constant">TEMPLATE_CLSW</span><span class="plain">: </span><span class="identifier">template_path</span><span class="plain"> = </span><span class="functiontext">Pathnames::from_text</span><span class="plain">(</span><span class="identifier">arg</span><span class="plain">); </span><span class="identifier">pipeline_as_text</span><span class="plain"> = </span><span class="identifier">NULL</span><span class="plain">; </span><span class="reserved">break</span><span class="plain">;</span>
|
||||
<span class="reserved">case</span><span class="plain"> </span><span class="constant">ASSIMILATE_CLSW</span><span class="plain">: </span><span class="identifier">template_path</span><span class="plain"> = </span><span class="functiontext">Pathnames::from_text</span><span class="plain">(</span><span class="identifier">arg</span><span class="plain">);</span>
|
||||
<span class="reserved">case</span><span class="plain"> </span><span class="constant">ASSIMILATE_CLSW</span><span class="plain">: </span><span class="identifier">kit_path</span><span class="plain"> = </span><span class="functiontext">Pathnames::from_text</span><span class="plain">(</span><span class="identifier">arg</span><span class="plain">);</span>
|
||||
<span class="identifier">pipeline_as_text</span><span class="plain"> = </span><span class="identifier">NULL</span><span class="plain">; </span><span class="identifier">template_action</span><span class="plain"> = </span><span class="identifier">id</span><span class="plain">; </span><span class="reserved">break</span><span class="plain">;</span>
|
||||
<span class="reserved">case</span><span class="plain"> </span><span class="constant">TEST_CLSW</span><span class="plain">: </span><span class="identifier">unit_test_file</span><span class="plain"> = </span><span class="functiontext">Filenames::from_text</span><span class="plain">(</span><span class="identifier">arg</span><span class="plain">); </span><span class="reserved">break</span><span class="plain">;</span>
|
||||
<span class="reserved">case</span><span class="plain"> </span><span class="constant">ARCHITECTURE_CLSW</span><span class="plain">:</span>
|
||||
|
@ -233,9 +229,9 @@
|
|||
<span class="reserved">void</span><span class="plain"> </span><span class="functiontext">Main::act</span><span class="plain">(</span><span class="reserved">void</span><span class="plain">) {</span>
|
||||
<span class="reserved">if</span><span class="plain"> ((</span><span class="identifier">pipeline_as_file</span><span class="plain">) || (</span><span class="identifier">pipeline_as_text</span><span class="plain">)) {</span>
|
||||
<span class="reserved">if</span><span class="plain"> (</span><span class="identifier">NUMBER_CREATED</span><span class="plain">(</span><span class="reserved">inter_file</span><span class="plain">) > 0)</span>
|
||||
<span class="functiontext">Errors::fatal</span><span class="plain">(</span><span class="string">"-pipeline and -pipeline-file cannot be combined with inter file parameters"</span><span class="plain">);</span>
|
||||
<span class="functiontext">Errors::fatal</span><span class="plain">(</span><span class="string">"-pipeline-text and -pipeline-file cannot be combined with inter file parameters"</span><span class="plain">);</span>
|
||||
<span class="reserved">linked_list</span><span class="plain"> *</span><span class="identifier">inter_paths</span><span class="plain"> = </span><span class="identifier">NEW_LINKED_LIST</span><span class="plain">(</span><span class="reserved">pathname</span><span class="plain">);</span>
|
||||
<span class="identifier">ADD_TO_LINKED_LIST</span><span class="plain">(</span><span class="identifier">template_path</span><span class="plain">, </span><span class="reserved">pathname</span><span class="plain">, </span><span class="identifier">inter_paths</span><span class="plain">);</span>
|
||||
<span class="identifier">ADD_TO_LINKED_LIST</span><span class="plain">(</span><span class="identifier">kit_path</span><span class="plain">, </span><span class="reserved">pathname</span><span class="plain">, </span><span class="identifier">inter_paths</span><span class="plain">);</span>
|
||||
<span class="reserved">codegen_pipeline</span><span class="plain"> *</span><span class="identifier">SS</span><span class="plain">;</span>
|
||||
<span class="reserved">if</span><span class="plain"> (</span><span class="identifier">pipeline_as_file</span><span class="plain">) </span><span class="identifier">SS</span><span class="plain"> = </span><span class="functiontext">CodeGen::Pipeline::parse_from_file</span><span class="plain">(</span><span class="identifier">pipeline_as_file</span><span class="plain">, </span><span class="identifier">pipeline_vars</span><span class="plain">);</span>
|
||||
<span class="reserved">else</span><span class="plain"> </span><span class="identifier">SS</span><span class="plain"> = </span><span class="functiontext">CodeGen::Pipeline::parse</span><span class="plain">(</span><span class="identifier">pipeline_as_text</span><span class="plain">, </span><span class="identifier">pipeline_vars</span><span class="plain">);</span>
|
||||
|
|
|
@ -84,11 +84,21 @@ out textually on the command line, then commas are used to divide the stages:
|
|||
|
||||
|
||||
<pre class="display">
|
||||
<span class="plain">$ inter/Tangled/inter -pipeline 'plugh, xyzzy, plover'</span>
|
||||
<span class="plain">$ inter/Tangled/inter -pipeline-text 'plugh, xyzzy, plover'</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph">If the pipeline is in an external file, then one stage should appear on
|
||||
each line, and the comma is not needed:
|
||||
<p class="inwebparagraph">If the pipeline is in an external file, we would instead write:
|
||||
</p>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
|
||||
<pre class="display">
|
||||
<span class="plain">$ inter/Tangled/inter -pipeline-file mypl.interpipeline</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph">and the file <code class="display"><span class="extract">mypl.interpipeline</span></code> would have one stage listed on each line,
|
||||
so that the commas are not needed:
|
||||
</p>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
@ -161,10 +171,7 @@ For example,
|
|||
<span class="plain">generate inventory -> *log</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph">Template filenames are a little different: those are searched for inside
|
||||
a path of possible directories. By default there's no such path, but using
|
||||
<code class="display"><span class="extract">-template T</span></code> at the Inter command line gives a path of just one directory.
|
||||
</p>
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
<p class="inwebparagraph"><a id="SP3"></a><b>§3. Pipelines run by Inform. </b>As the above implies, Inter pipelines normally begin with a clean slate:
|
||||
no repositories, no variables.
|
||||
|
@ -187,63 +194,76 @@ effect is that any useful pipeline for Inform will begin and end thus:
|
|||
</pre>
|
||||
|
||||
<p class="inwebparagraph">In addition, the "domain" is set to the directory containing the <code class="display"><span class="extract">*out</span></code>
|
||||
file, and the template search path is set to the one used in Inform, that is,
|
||||
the template file <code class="display"><span class="extract">Whatever.i6t</span></code> would be looked for first in the project's
|
||||
<code class="display"><span class="extract">X.materials/I6T</span></code> directory, then in the user's <code class="display"><span class="extract">I6T</span></code> directory, and failing
|
||||
that in Inform's built-in one.
|
||||
file.
|
||||
</p>
|
||||
|
||||
<p class="inwebparagraph">The pipeline is itself looked for in the same way. If you have a project
|
||||
called <code class="display"><span class="extract">Strange.inform</span></code>, then Inform first looks for
|
||||
<p class="inwebparagraph">To Inbuild and Inform, pipelines are resources in their own right, rather
|
||||
like extensions or kits. So, for example, the standard distribution includes
|
||||
</p>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
|
||||
<pre class="display">
|
||||
<span class="plain">Strange.materials/Inter/default.interpipeline</span>
|
||||
<span class="plain">inform7/Internal/Pipelines/compile.interpipeline</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph">If it can't find this file, it next looks for <code class="display"><span class="extract">default.interpipeline</span></code> in
|
||||
the user's folder, and then in Inform's built-in one. If you're curious to
|
||||
read the pipeline normally used by a shipping version of Inform, the file
|
||||
can be found here in the Github repository for Inform:
|
||||
<p class="inwebparagraph">which is the one used for standard compilation runs. A projects Materials
|
||||
folder is free to provide a replacement:
|
||||
</p>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
|
||||
<pre class="display">
|
||||
<span class="plain">inform7/Internal/Inter/default.interpipeline</span>
|
||||
<span class="plain">Strange.materials/Pipelines/compile.interpipeline</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph">The best way to change the pipeline, then, is to put a new file in the
|
||||
project's Materials folder. But there are also two other ways.
|
||||
<p class="inwebparagraph">...and then this will be used instead when compiling <code class="display"><span class="extract">Strange.inform</span></code>.
|
||||
</p>
|
||||
|
||||
<p class="inwebparagraph">1. This sentence:
|
||||
<p class="inwebparagraph">1. This sentence in Inform source text:
|
||||
</p>
|
||||
|
||||
<blockquote>
|
||||
<p>Use inter pipeline "PIPELINE".</p>
|
||||
<p>Use inter pipeline "NAME".</p>
|
||||
|
||||
</blockquote>
|
||||
|
||||
<p class="inwebparagraph">replaces the pipeline normally used for code generation with the one supplied.
|
||||
(That may very well cause the compiler not to produce viable code, of course.)
|
||||
The default Inter pipeline is called <code class="display"><span class="extract">compile</span></code>, and comes built-in. Named
|
||||
pipelines are stored alongside named extensions and other resources used by
|
||||
Inform; so for example you could write:
|
||||
</p>
|
||||
|
||||
<p class="inwebparagraph">2. A replacement pipeline can be specified at the Inform 7 command line:
|
||||
<blockquote>
|
||||
<p>Use inter pipeline "mypipeline".</p>
|
||||
|
||||
</blockquote>
|
||||
|
||||
<p class="inwebparagraph">And then store the actual pipeline file as:
|
||||
</p>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
|
||||
<pre class="display">
|
||||
<span class="plain">$ inform7/Tangled/inform7 ... -pipeline 'PIPELINE'</span>
|
||||
<span class="plain">Example Work.materials/Pipelines/mypipeline.interpipeline</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph">Exactly as with Inter, Inform 7 also responds to <code class="display"><span class="extract">-pipeline-file</span></code>:
|
||||
<p class="inwebparagraph">2. You don't need the Use... sentence, though, if you're willing to choose
|
||||
on the command line instead:
|
||||
</p>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
|
||||
<pre class="display">
|
||||
<span class="plain">$ inform7/Tangled/inform7 ... -pipeline NAME</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph">Or, if you want to name a file explicitly, not have it looked for by name:
|
||||
</p>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
@ -253,8 +273,22 @@ project's Materials folder. But there are also two other ways.
|
|||
<span class="plain">$ inform7/Tangled/inform7 ... -pipeline-file FILE</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph">3. Finally, you can also give Inform 7 an explicit pipeline in textual form:
|
||||
</p>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
|
||||
<pre class="display">
|
||||
<span class="plain">$ inform7/Tangled/inform7 ... -pipeline-text 'PIPELINE'</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph">Note that Inbuild and Inform 7 respond to all three of <code class="display"><span class="extract">-pipeline</span></code>,
|
||||
<code class="display"><span class="extract">-pipeline-file</span></code> and <code class="display"><span class="extract">-pipeline-text</span></code>, whereas Inter responds only to the
|
||||
last two. (It can't find pipelines by name because it doesn't contain the
|
||||
complex code for sorting out resources.)
|
||||
</p>
|
||||
|
||||
<p class="inwebparagraph"><a id="SP4"></a><b>§4. Stage descriptions. </b>There are three sorts of stage description: those involving material coming
|
||||
in, denoted by a left arrow, those involving some external file being written
|
||||
out, denoted by a right arrow, and those which just process what we have.
|
||||
|
|
|
@ -67,19 +67,18 @@
|
|||
|
||||
usage: inter file1 file2 ... [options]
|
||||
|
||||
-architecture X generate inter with architecture X
|
||||
-assimilate X assimilate I6T code into inter inside template X
|
||||
-architecture X generate Inter with architecture X
|
||||
-assimilate X assimilate (i.e., build) Inter kit X for the current architecture
|
||||
-binary X write to file X in binary format
|
||||
-domain X specify folder to read/write inter files from/to
|
||||
-pipeline X specify pipeline textually
|
||||
-pipeline-file X specify pipeline from file X
|
||||
-template X specify folder holding i6t template files
|
||||
-pipeline-file X specify pipeline as file X
|
||||
-pipeline-text X specify pipeline textually, with X being a comma-separated list of stages
|
||||
-test X perform unit tests from file X
|
||||
-textual X write to file X in textual format
|
||||
-variable X set pipeline variable X (in form name=value)
|
||||
|
||||
-at X specify that this tool is installed at X
|
||||
-crash intentionally crash on internal errors, for debugger backtracing (default is -no-crash)
|
||||
-crash intentionally crash on internal errors, for backtracing (default is -no-crash)
|
||||
-fixtime pretend the time is 11 a.m. on 28 March 2016 for testing (default is -no-fixtime)
|
||||
-help print this help information
|
||||
-log X write the debugging log to include diagnostics on X
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
<!--Weave of 'M/ui' generated by 7-->
|
||||
<ul class="crumbs"><li><a href="../webs.html">Source</a></li><li><a href="../compiler.html">Compiler Tools</a></li><li><a href="index.html">inter</a></li><li><a href="index.html#M">Manual</a></li><li><b>Using Inter</b></li></ul><p class="purpose">Using Inter at the command line.</p>
|
||||
|
||||
<ul class="toc"><li><a href="#SP1">§1. What Inter does</a></li><li><a href="#SP2">§2. Command-line usage</a></li></ul><hr class="tocbar">
|
||||
<ul class="toc"><li><a href="#SP1">§1. What Inter does</a></li><li><a href="#SP2">§2. Command-line usage</a></li><li><a href="#SP5">§5. Assimilation</a></li></ul><hr class="tocbar">
|
||||
|
||||
<p class="inwebparagraph"><a id="SP1"></a><b>§1. What Inter does. </b>The command-line executable Inter packages up the back end of the Inform 7
|
||||
compiler into a stand-alone tool, and enables that back end to be used more
|
||||
|
@ -146,7 +146,7 @@ one stage, can be quite elaborate (see later), but for example:
|
|||
|
||||
|
||||
<pre class="display">
|
||||
<span class="plain">$ inter/Tangled/inter -pipeline 'PIPELINE'</span>
|
||||
<span class="plain">$ inter/Tangled/inter -pipeline-text 'PIPELINE'</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph">where <code class="display"><span class="extract">PIPELINE</span></code> is a textual description like the one above. In practice,
|
||||
|
@ -182,14 +182,55 @@ line with e.g.:
|
|||
<span class="plain">-domain D</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph">Finally, we can tell Inter where to find I6T template files:
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
<p class="inwebparagraph"><a id="SP5"></a><b>§5. Assimilation. </b>Inform makes use of what are called "kits" of pre-compiled Inter code:
|
||||
for example, <code class="display"><span class="extract">CommandParserKit</span></code> contains code for the traditional interactive
|
||||
fiction command parser. For speed, Inter loads these as binary Inter, but
|
||||
that means they have to be compiled from time to time. This is called
|
||||
"assimilation".
|
||||
</p>
|
||||
|
||||
<p class="inwebparagraph">The source code for these could in priniple be textual Inter, but that's too
|
||||
verbose to write comfortably. In practice we use Inform 6 code as a notation,
|
||||
and therefore assimilation is really a cross-compilation from I6 to Inter.
|
||||
</p>
|
||||
|
||||
<p class="inwebparagraph">Kits are like so-called "fat binaries", in that they contain binary Inter
|
||||
for each different architecture with which they are compatible. Inter can
|
||||
assimilate for only one architecture at a time, so a command must specify
|
||||
which is wanted. For example:
|
||||
</p>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
|
||||
<pre class="display">
|
||||
<span class="plain">-template T</span>
|
||||
<span class="plain">$ inter/Tangled/inter -architecture 16 -assimilate K</span>
|
||||
<span class="plain">$ inter/Tangled/inter -architecture 32d -assimilate K</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph">Incrementally assimilating kits as needed could be done with something like
|
||||
the Unix tool <code class="display"><span class="extract">make</span></code>, but in fact Inbuild has this ability: the command
|
||||
</p>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
|
||||
<pre class="display">
|
||||
<span class="plain">$ inbuild/Tangled/inbuild -build K</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph">looks at the kit, works out which architectures need re-assimilation, and
|
||||
then issues commands like the above to instruct <code class="display"><span class="extract">inter</span></code> to do so. Indeed,
|
||||
multiple kits can be managed with a single command:
|
||||
</p>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
|
||||
<pre class="display">
|
||||
<span class="plain">$ inbuild/Tangled/inbuild -build -contents-of inform7/Internal/Inter</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
|
|
@ -6,7 +6,7 @@ usage: inblorb [-options] [blurbfile [blorbfile]]
|
|||
-verbose print running notes on what's happening (default is -no-verbose)
|
||||
|
||||
-at X specify that this tool is installed at X
|
||||
-crash intentionally crash on internal errors, for debugger backtracing (default is -no-crash)
|
||||
-crash intentionally crash on internal errors, for backtracing (default is -no-crash)
|
||||
-fixtime pretend the time is 11 a.m. on 28 March 2016 for testing (default is -no-fixtime)
|
||||
-help print this help information
|
||||
-log X write the debugging log to include diagnostics on X
|
||||
|
|
|
@ -39,12 +39,12 @@ for locating resources in the file system:
|
|||
|
||||
for tweaking code generation from Inter:
|
||||
-kit X include Inter code from the kit called X
|
||||
-pipeline X specify code-generation pipeline
|
||||
-pipeline-file X specify code-generation pipeline from file X
|
||||
-pipeline X specify code-generation pipeline by name (default is "compile")
|
||||
-pipeline-file X specify code-generation pipeline as file X
|
||||
-variable X set pipeline variable X (in form name=value)
|
||||
|
||||
-at X specify that this tool is installed at X
|
||||
-crash intentionally crash on internal errors, for debugger backtracing (default is -no-crash)
|
||||
-crash intentionally crash on internal errors, for backtracing (default is -no-crash)
|
||||
-fixtime pretend the time is 11 a.m. on 28 March 2016 for testing (default is -no-fixtime)
|
||||
-help print this help information
|
||||
-log X write the debugging log to include diagnostics on X
|
||||
|
|
|
@ -93,9 +93,9 @@ void Inbuild::declare_options(void) {
|
|||
CommandLine::declare_switch(KIT_CLSW, L"kit", 2,
|
||||
L"include Inter code from the kit called X");
|
||||
CommandLine::declare_switch(PIPELINE_CLSW, L"pipeline", 2,
|
||||
L"specify code-generation pipeline");
|
||||
L"specify code-generation pipeline by name (default is \"compile\")");
|
||||
CommandLine::declare_switch(PIPELINE_FILE_CLSW, L"pipeline-file", 2,
|
||||
L"specify code-generation pipeline from file X");
|
||||
L"specify code-generation pipeline as file X");
|
||||
CommandLine::declare_switch(PIPELINE_VARIABLE_CLSW, L"variable", 2,
|
||||
L"set pipeline variable X (in form name=value)");
|
||||
CommandLine::end_group();
|
||||
|
@ -103,8 +103,8 @@ void Inbuild::declare_options(void) {
|
|||
Inbuild::set_defaults();
|
||||
}
|
||||
|
||||
text_stream *inter_processing_file = NULL;
|
||||
text_stream *inter_processing_pipeline = NULL;
|
||||
filename *inter_pipeline_file = NULL;
|
||||
text_stream *inter_pipeline_name = NULL;
|
||||
dictionary *pipeline_vars = NULL;
|
||||
pathname *shared_transient_resources = NULL;
|
||||
int this_is_a_debug_compile = FALSE; /* Destined to be compiled with debug features */
|
||||
|
@ -114,16 +114,16 @@ int census_mode = FALSE; /* Running only to update extension documentation */
|
|||
int rng_seed_at_start_of_play = 0; /* The seed value, or 0 if not seeded */
|
||||
|
||||
void Inbuild::set_defaults(void) {
|
||||
inter_processing_pipeline = Str::new();
|
||||
inter_processing_file = I"compile";
|
||||
inter_pipeline_name = Str::new(); WRITE_TO(inter_pipeline_name, "compile");
|
||||
inter_pipeline_file = NULL;
|
||||
}
|
||||
|
||||
void Inbuild::set_inter_pipeline(wording W) {
|
||||
inter_processing_pipeline = Str::new();
|
||||
WRITE_TO(inter_processing_pipeline, "%W", W);
|
||||
Str::delete_first_character(inter_processing_pipeline);
|
||||
Str::delete_last_character(inter_processing_pipeline);
|
||||
LOG("Setting pipeline %S\n", inter_processing_pipeline);
|
||||
inter_pipeline_name = Str::new();
|
||||
WRITE_TO(inter_pipeline_name, "%W", W);
|
||||
Str::delete_first_character(inter_pipeline_name);
|
||||
Str::delete_last_character(inter_pipeline_name);
|
||||
LOG("Setting pipeline %S\n", inter_pipeline_name);
|
||||
}
|
||||
|
||||
void Inbuild::option(int id, int val, text_stream *arg, void *state) {
|
||||
|
@ -146,8 +146,8 @@ void Inbuild::option(int id, int val, text_stream *arg, void *state) {
|
|||
Errors::fatal_with_text("can't specify the source file twice: '%S'", arg);
|
||||
break;
|
||||
case CENSUS_CLSW: census_mode = val; break;
|
||||
case PIPELINE_CLSW: inter_processing_pipeline = Str::duplicate(arg); break;
|
||||
case PIPELINE_FILE_CLSW: inter_processing_file = Str::duplicate(arg); break;
|
||||
case PIPELINE_CLSW: inter_pipeline_name = Str::duplicate(arg); break;
|
||||
case PIPELINE_FILE_CLSW: inter_pipeline_file = Filenames::from_text(arg); break;
|
||||
case PIPELINE_VARIABLE_CLSW: {
|
||||
match_results mr = Regexp::create_mr();
|
||||
if (Regexp::match(&mr, arg, L"(%c+)=(%c+)")) {
|
||||
|
|
|
@ -78,30 +78,22 @@ int InterSkill::code_generate_internally(build_skill *skill, build_step *S, buil
|
|||
Str::copy(Dictionaries::create_text(pipeline_vars, I"*out"),
|
||||
Filenames::get_leafname(S->vertex->buildable_if_internal_file));
|
||||
|
||||
codegen_pipeline *SS = NULL;
|
||||
if (Str::len(inter_processing_pipeline) > 0) {
|
||||
SS = CodeGen::Pipeline::parse(inter_processing_pipeline, pipeline_vars);
|
||||
if (SS == NULL) {
|
||||
Errors::nowhere("inter pipeline text could not be parsed");
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
filename *F = inter_pipeline_file;
|
||||
if (F == NULL) {
|
||||
inbuild_requirement *req =
|
||||
Requirements::any_version_of(Works::new(pipeline_genre, inter_processing_file, NULL));
|
||||
Requirements::any_version_of(Works::new(pipeline_genre, inter_pipeline_name, NULL));
|
||||
inbuild_search_result *R = Nests::first_found(req, Inbuild::nest_list());
|
||||
if (R == NULL) {
|
||||
WRITE_TO(STDERR, "Sought pipeline '%S'\n", inter_processing_file);
|
||||
Errors::nowhere("inter pipeline file could not be found");
|
||||
Errors::with_text("inter pipeline '%S' could not be found", inter_pipeline_name);
|
||||
return FALSE;
|
||||
}
|
||||
inbuild_copy *C = R->copy;
|
||||
filename *F = C->location_if_file;
|
||||
SS = CodeGen::Pipeline::parse_from_file(F, pipeline_vars);
|
||||
F = R->copy->location_if_file;
|
||||
}
|
||||
codegen_pipeline *SS = CodeGen::Pipeline::parse_from_file(F, pipeline_vars);
|
||||
if (SS == NULL) {
|
||||
Errors::nowhere("inter pipeline file could not be parsed");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
CodeGen::Pipeline::set_repository(SS, Emit::tree());
|
||||
CodeGen::Pipeline::run(Filenames::get_path_to(S->vertex->buildable_if_internal_file),
|
||||
SS, Kits::inter_paths(), Projects::list_of_inter_libraries(Inbuild::project()));
|
||||
|
|
|
@ -13,7 +13,7 @@ where TARGET must be one of those set up in the instructions.
|
|||
-xrefs X write a file of documentation cross-references to filename X
|
||||
|
||||
-at X specify that this tool is installed at X
|
||||
-crash intentionally crash on internal errors, for debugger backtracing (default is -no-crash)
|
||||
-crash intentionally crash on internal errors, for backtracing (default is -no-crash)
|
||||
-fixtime pretend the time is 11 a.m. on 28 March 2016 for testing (default is -no-fixtime)
|
||||
-help print this help information
|
||||
-log X write the debugging log to include diagnostics on X
|
||||
|
|
|
@ -21,19 +21,19 @@ for locating resources in the file system:
|
|||
|
||||
for tweaking code generation from Inter:
|
||||
-kit X include Inter code from the kit called X
|
||||
-pipeline X specify code-generation pipeline
|
||||
-pipeline-file X specify code-generation pipeline from file X
|
||||
-pipeline X specify code-generation pipeline by name (default is "compile")
|
||||
-pipeline-file X specify code-generation pipeline as file X
|
||||
-variable X set pipeline variable X (in form name=value)
|
||||
|
||||
for testing and debugging inform7:
|
||||
-crash-all intentionally crash on Problem messages, for debugger backtracing (default is -no-crash-all)
|
||||
-crash-all intentionally crash on Problem messages, for backtracing (default is -no-crash-all)
|
||||
-no-index don't produce an Index (default is -index)
|
||||
-no-progress don't display progress percentages (default is -progress)
|
||||
-require-problem X return 0 unless exactly this Problem message is generated
|
||||
-sigils print Problem message sigils (default is -no-sigils)
|
||||
|
||||
-at X specify that this tool is installed at X
|
||||
-crash intentionally crash on internal errors, for debugger backtracing (default is -no-crash)
|
||||
-crash intentionally crash on internal errors, for backtracing (default is -no-crash)
|
||||
-fixtime pretend the time is 11 a.m. on 28 March 2016 for testing (default is -no-fixtime)
|
||||
-help print this help information
|
||||
-log X write the debugging log to include diagnostics on X
|
||||
|
|
|
@ -4,7 +4,7 @@ To manage the line skips which space paragraphs out.
|
|||
|
||||
@h Paragraph Control.
|
||||
Ah, yes: the paragraph breaking algorithm. In {\it \TeX: The Program},
|
||||
Donald Knuth writes at $\S 768$: "It's sort of a miracle whenever |\halign|
|
||||
Donald Knuth writes at section 768: "It's sort of a miracle whenever |\halign|
|
||||
and |\valign| work, because they cut across so many of the control structures
|
||||
of \TeX." It's sort of a miracle whenever Inform 7's paragraph breaking
|
||||
system works, too. Most users probably imagine that it's implemented by
|
||||
|
|
|
@ -162,7 +162,7 @@ compiler via Delia scripts in |intest|.
|
|||
@<Register command-line arguments@> =
|
||||
CommandLine::begin_group(INFORM_TESTING_CLSG, I"for testing and debugging inform7");
|
||||
CommandLine::declare_boolean_switch(CRASHALL_CLSW, L"crash-all", 1,
|
||||
L"intentionally crash on Problem messages, for debugger backtracing", FALSE);
|
||||
L"intentionally crash on Problem messages, for backtracing", FALSE);
|
||||
CommandLine::declare_boolean_switch(INDEX_CLSW, L"index", 1,
|
||||
L"produce an Index", TRUE);
|
||||
CommandLine::declare_boolean_switch(PROGRESS_CLSW, L"progress", 1,
|
||||
|
|
|
@ -7,7 +7,7 @@ usage: inpolicy [options]
|
|||
-verbose explain what inpolicy is doing (default is -no-verbose)
|
||||
|
||||
-at X specify that this tool is installed at X
|
||||
-crash intentionally crash on internal errors, for debugger backtracing (default is -no-crash)
|
||||
-crash intentionally crash on internal errors, for backtracing (default is -no-crash)
|
||||
-fixtime pretend the time is 11 a.m. on 28 March 2016 for testing (default is -no-fixtime)
|
||||
-help print this help information
|
||||
-log X write the debugging log to include diagnostics on X
|
||||
|
|
|
@ -5,7 +5,7 @@ usage: inrtps from-folder to-folder [options]
|
|||
-no-font don't explicitly set sans-serif fonts by name (default is -font)
|
||||
|
||||
-at X specify that this tool is installed at X
|
||||
-crash intentionally crash on internal errors, for debugger backtracing (default is -no-crash)
|
||||
-crash intentionally crash on internal errors, for backtracing (default is -no-crash)
|
||||
-fixtime pretend the time is 11 a.m. on 28 March 2016 for testing (default is -no-fixtime)
|
||||
-help print this help information
|
||||
-log X write the debugging log to include diagnostics on X
|
||||
|
|
|
@ -11,7 +11,6 @@ this plan out.
|
|||
@e PIPELINE_FILE_CLSW
|
||||
@e PIPELINE_VARIABLE_CLSW
|
||||
@e DOMAIN_CLSW
|
||||
@e TEMPLATE_CLSW
|
||||
@e TEST_CLSW
|
||||
@e ARCHITECTURE_CLSW
|
||||
@e ASSIMILATE_CLSW
|
||||
|
@ -19,7 +18,7 @@ this plan out.
|
|||
=
|
||||
pathname *path_to_inter = NULL;
|
||||
pathname *path_to_pipelines = NULL;
|
||||
pathname *template_path = NULL;
|
||||
pathname *kit_path = NULL;
|
||||
int template_action = -1;
|
||||
pathname *domain_path = NULL;
|
||||
filename *output_textually = NULL;
|
||||
|
@ -49,22 +48,20 @@ int main(int argc, char **argv) {
|
|||
L"write to file X in textual format");
|
||||
CommandLine::declare_switch(BINARY_CLSW, L"binary", 2,
|
||||
L"write to file X in binary format");
|
||||
CommandLine::declare_switch(PIPELINE_CLSW, L"pipeline", 2,
|
||||
L"specify pipeline textually");
|
||||
CommandLine::declare_switch(PIPELINE_CLSW, L"pipeline-text", 2,
|
||||
L"specify pipeline textually, with X being a comma-separated list of stages");
|
||||
CommandLine::declare_switch(PIPELINE_FILE_CLSW, L"pipeline-file", 2,
|
||||
L"specify pipeline from file X");
|
||||
L"specify pipeline as file X");
|
||||
CommandLine::declare_switch(PIPELINE_VARIABLE_CLSW, L"variable", 2,
|
||||
L"set pipeline variable X (in form name=value)");
|
||||
CommandLine::declare_switch(TEMPLATE_CLSW, L"template", 2,
|
||||
L"specify folder holding i6t template files");
|
||||
CommandLine::declare_switch(TEST_CLSW, L"test", 2,
|
||||
L"perform unit tests from file X");
|
||||
CommandLine::declare_switch(DOMAIN_CLSW, L"domain", 2,
|
||||
L"specify folder to read/write inter files from/to");
|
||||
CommandLine::declare_switch(ARCHITECTURE_CLSW, L"architecture", 2,
|
||||
L"generate inter with architecture X");
|
||||
L"generate Inter with architecture X");
|
||||
CommandLine::declare_switch(ASSIMILATE_CLSW, L"assimilate", 2,
|
||||
L"assimilate I6T code into inter inside template X");
|
||||
L"assimilate (i.e., build) Inter kit X for the current architecture");
|
||||
|
||||
pipeline_vars = CodeGen::Pipeline::basic_dictionary(I"output.i6");
|
||||
|
||||
|
@ -73,8 +70,8 @@ int main(int argc, char **argv) {
|
|||
if (template_action == ASSIMILATE_CLSW) {
|
||||
inter_architecture *A = CodeGen::Architecture::current();
|
||||
if (A == NULL) Errors::fatal("no -architecture given");
|
||||
filename *assim = Architectures::canonical_binary(template_path, A);
|
||||
filename *assim_t = Architectures::canonical_textual(template_path, A);
|
||||
filename *assim = Architectures::canonical_binary(kit_path, A);
|
||||
filename *assim_t = Architectures::canonical_textual(kit_path, A);
|
||||
pipeline_as_file = Filenames::in_folder(path_to_pipelines, I"assimilate.interpipeline");
|
||||
TEMPORARY_TEXT(fullname);
|
||||
WRITE_TO(fullname, "%f", assim);
|
||||
|
@ -83,7 +80,7 @@ int main(int argc, char **argv) {
|
|||
WRITE_TO(fullname, "%f", assim_t);
|
||||
Str::copy(Dictionaries::create_text(pipeline_vars, I"*outt"), fullname);
|
||||
DISCARD_TEXT(fullname);
|
||||
Str::copy(Dictionaries::create_text(pipeline_vars, I"*attach"), Pathnames::directory_name(template_path));
|
||||
Str::copy(Dictionaries::create_text(pipeline_vars, I"*attach"), Pathnames::directory_name(kit_path));
|
||||
}
|
||||
|
||||
Main::act();
|
||||
|
@ -120,8 +117,7 @@ void Main::respond(int id, int val, text_stream *arg, void *state) {
|
|||
break;
|
||||
}
|
||||
case DOMAIN_CLSW: domain_path = Pathnames::from_text(arg); pipeline_as_text = NULL; break;
|
||||
case TEMPLATE_CLSW: template_path = Pathnames::from_text(arg); pipeline_as_text = NULL; break;
|
||||
case ASSIMILATE_CLSW: template_path = Pathnames::from_text(arg);
|
||||
case ASSIMILATE_CLSW: kit_path = Pathnames::from_text(arg);
|
||||
pipeline_as_text = NULL; template_action = id; break;
|
||||
case TEST_CLSW: unit_test_file = Filenames::from_text(arg); break;
|
||||
case ARCHITECTURE_CLSW:
|
||||
|
@ -146,9 +142,9 @@ void Main::add_file(int id, text_stream *arg, void *state) {
|
|||
void Main::act(void) {
|
||||
if ((pipeline_as_file) || (pipeline_as_text)) {
|
||||
if (NUMBER_CREATED(inter_file) > 0)
|
||||
Errors::fatal("-pipeline and -pipeline-file cannot be combined with inter file parameters");
|
||||
Errors::fatal("-pipeline-text and -pipeline-file cannot be combined with inter file parameters");
|
||||
linked_list *inter_paths = NEW_LINKED_LIST(pathname);
|
||||
ADD_TO_LINKED_LIST(template_path, pathname, inter_paths);
|
||||
ADD_TO_LINKED_LIST(kit_path, pathname, inter_paths);
|
||||
codegen_pipeline *SS;
|
||||
if (pipeline_as_file) SS = CodeGen::Pipeline::parse_from_file(pipeline_as_file, pipeline_vars);
|
||||
else SS = CodeGen::Pipeline::parse(pipeline_as_text, pipeline_vars);
|
||||
|
|
|
@ -2,19 +2,18 @@ For handling intermediate Inform code.
|
|||
|
||||
usage: inter file1 file2 ... [options]
|
||||
|
||||
-architecture X generate inter with architecture X
|
||||
-assimilate X assimilate I6T code into inter inside template X
|
||||
-architecture X generate Inter with architecture X
|
||||
-assimilate X assimilate (i.e., build) Inter kit X for the current architecture
|
||||
-binary X write to file X in binary format
|
||||
-domain X specify folder to read/write inter files from/to
|
||||
-pipeline X specify pipeline textually
|
||||
-pipeline-file X specify pipeline from file X
|
||||
-template X specify folder holding i6t template files
|
||||
-pipeline-file X specify pipeline as file X
|
||||
-pipeline-text X specify pipeline textually, with X being a comma-separated list of stages
|
||||
-test X perform unit tests from file X
|
||||
-textual X write to file X in textual format
|
||||
-variable X set pipeline variable X (in form name=value)
|
||||
|
||||
-at X specify that this tool is installed at X
|
||||
-crash intentionally crash on internal errors, for debugger backtracing (default is -no-crash)
|
||||
-crash intentionally crash on internal errors, for backtracing (default is -no-crash)
|
||||
-fixtime pretend the time is 11 a.m. on 28 March 2016 for testing (default is -no-fixtime)
|
||||
-help print this help information
|
||||
-log X write the debugging log to include diagnostics on X
|
||||
|
|
|
@ -18,10 +18,14 @@ is a valid stage description.
|
|||
A "pipeline" is a list of stage descriptions. If the pipeline is spelled
|
||||
out textually on the command line, then commas are used to divide the stages:
|
||||
|
||||
|$ inter/Tangled/inter -pipeline 'plugh, xyzzy, plover'|
|
||||
|$ inter/Tangled/inter -pipeline-text 'plugh, xyzzy, plover'|
|
||||
|
||||
If the pipeline is in an external file, then one stage should appear on
|
||||
each line, and the comma is not needed:
|
||||
If the pipeline is in an external file, we would instead write:
|
||||
|
||||
|$ inter/Tangled/inter -pipeline-file mypl.interpipeline|
|
||||
|
||||
and the file |mypl.interpipeline| would have one stage listed on each line,
|
||||
so that the commas are not needed:
|
||||
|
||||
|plugh|
|
||||
|xyzzy|
|
||||
|
@ -59,10 +63,6 @@ For example,
|
|||
|
||||
|generate inventory -> *log|
|
||||
|
||||
Template filenames are a little different: those are searched for inside
|
||||
a path of possible directories. By default there's no such path, but using
|
||||
|-template T| at the Inter command line gives a path of just one directory.
|
||||
|
||||
@h Pipelines run by Inform.
|
||||
As the above implies, Inter pipelines normally begin with a clean slate:
|
||||
no repositories, no variables.
|
||||
|
@ -78,41 +78,54 @@ effect is that any useful pipeline for Inform will begin and end thus:
|
|||
|generate inform6 -> *out|
|
||||
|
||||
In addition, the "domain" is set to the directory containing the |*out|
|
||||
file, and the template search path is set to the one used in Inform, that is,
|
||||
the template file |Whatever.i6t| would be looked for first in the project's
|
||||
|X.materials/I6T| directory, then in the user's |I6T| directory, and failing
|
||||
that in Inform's built-in one.
|
||||
file.
|
||||
|
||||
The pipeline is itself looked for in the same way. If you have a project
|
||||
called |Strange.inform|, then Inform first looks for
|
||||
To Inbuild and Inform, pipelines are resources in their own right, rather
|
||||
like extensions or kits. So, for example, the standard distribution includes
|
||||
|
||||
|Strange.materials/Inter/default.interpipeline|
|
||||
|inform7/Internal/Pipelines/compile.interpipeline|
|
||||
|
||||
If it can't find this file, it next looks for |default.interpipeline| in
|
||||
the user's folder, and then in Inform's built-in one. If you're curious to
|
||||
read the pipeline normally used by a shipping version of Inform, the file
|
||||
can be found here in the Github repository for Inform:
|
||||
which is the one used for standard compilation runs. A projects Materials
|
||||
folder is free to provide a replacement:
|
||||
|
||||
|inform7/Internal/Inter/default.interpipeline|
|
||||
|Strange.materials/Pipelines/compile.interpipeline|
|
||||
|
||||
The best way to change the pipeline, then, is to put a new file in the
|
||||
project's Materials folder. But there are also two other ways.
|
||||
...and then this will be used instead when compiling |Strange.inform|.
|
||||
|
||||
1. This sentence:
|
||||
1. This sentence in Inform source text:
|
||||
|
||||
>> Use inter pipeline "PIPELINE".
|
||||
>> Use inter pipeline "NAME".
|
||||
|
||||
replaces the pipeline normally used for code generation with the one supplied.
|
||||
(That may very well cause the compiler not to produce viable code, of course.)
|
||||
The default Inter pipeline is called |compile|, and comes built-in. Named
|
||||
pipelines are stored alongside named extensions and other resources used by
|
||||
Inform; so for example you could write:
|
||||
|
||||
2. A replacement pipeline can be specified at the Inform 7 command line:
|
||||
>> Use inter pipeline "mypipeline".
|
||||
|
||||
|$ inform7/Tangled/inform7 ... -pipeline 'PIPELINE'|
|
||||
And then store the actual pipeline file as:
|
||||
|
||||
Exactly as with Inter, Inform 7 also responds to |-pipeline-file|:
|
||||
|Example Work.materials/Pipelines/mypipeline.interpipeline|
|
||||
|
||||
2. You don't need the Use... sentence, though, if you're willing to choose
|
||||
on the command line instead:
|
||||
|
||||
|$ inform7/Tangled/inform7 ... -pipeline NAME|
|
||||
|
||||
Or, if you want to name a file explicitly, not have it looked for by name:
|
||||
|
||||
|$ inform7/Tangled/inform7 ... -pipeline-file FILE|
|
||||
|
||||
3. Finally, you can also give Inform 7 an explicit pipeline in textual form:
|
||||
|
||||
|$ inform7/Tangled/inform7 ... -pipeline-text 'PIPELINE'|
|
||||
|
||||
Note that Inbuild and Inform 7 respond to all three of |-pipeline|,
|
||||
|-pipeline-file| and |-pipeline-text|, whereas Inter responds only to the
|
||||
last two. (It can't find pipelines by name because it doesn't contain the
|
||||
complex code for sorting out resources.)
|
||||
|
||||
@h Stage descriptions.
|
||||
There are three sorts of stage description: those involving material coming
|
||||
in, denoted by a left arrow, those involving some external file being written
|
||||
|
|
|
@ -53,7 +53,7 @@ one stage, can be quite elaborate (see later), but for example:
|
|||
|
||||
is a valid three-stage pipeline. The command to do this is then:
|
||||
|
||||
|$ inter/Tangled/inter -pipeline 'PIPELINE'|
|
||||
|$ inter/Tangled/inter -pipeline-text 'PIPELINE'|
|
||||
|
||||
where |PIPELINE| is a textual description like the one above. In practice,
|
||||
it may not be convenient to spell the pipeline out on the command line, so
|
||||
|
@ -70,6 +70,32 @@ It is also possible to set the default directory for reading and writing files:
|
|||
|
||||
|-domain D|
|
||||
|
||||
Finally, we can tell Inter where to find I6T template files:
|
||||
@h Assimilation.
|
||||
Inform makes use of what are called "kits" of pre-compiled Inter code:
|
||||
for example, |CommandParserKit| contains code for the traditional interactive
|
||||
fiction command parser. For speed, Inter loads these as binary Inter, but
|
||||
that means they have to be compiled from time to time. This is called
|
||||
"assimilation".
|
||||
|
||||
|-template T|
|
||||
The source code for these could in priniple be textual Inter, but that's too
|
||||
verbose to write comfortably. In practice we use Inform 6 code as a notation,
|
||||
and therefore assimilation is really a cross-compilation from I6 to Inter.
|
||||
|
||||
Kits are like so-called "fat binaries", in that they contain binary Inter
|
||||
for each different architecture with which they are compatible. Inter can
|
||||
assimilate for only one architecture at a time, so a command must specify
|
||||
which is wanted. For example:
|
||||
|
||||
|$ inter/Tangled/inter -architecture 16 -assimilate K|
|
||||
|$ inter/Tangled/inter -architecture 32d -assimilate K|
|
||||
|
||||
Incrementally assimilating kits as needed could be done with something like
|
||||
the Unix tool |make|, but in fact Inbuild has this ability: the command
|
||||
|
||||
|$ inbuild/Tangled/inbuild -build K|
|
||||
|
||||
looks at the kit, works out which architectures need re-assimilation, and
|
||||
then issues commands like the above to instruct |inter| to do so. Indeed,
|
||||
multiple kits can be managed with a single command:
|
||||
|
||||
|$ inbuild/Tangled/inbuild -build -contents-of inform7/Internal/Inter|
|
||||
|
|
Loading…
Reference in a new issue