2019-03-25 11:21:34 +02:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
< html >
< head >
2020-04-14 19:56:54 +03:00
< title > Inform Organisation< / title >
2020-05-03 03:20:55 +03:00
< link href = "../docs-assets/Breadcrumbs.css" rel = "stylesheet" rev = "stylesheet" type = "text/css" >
2020-03-19 02:11:25 +02:00
< meta name = "viewport" content = "width=device-width initial-scale=1" >
2019-03-25 11:21:34 +02:00
< meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" >
< meta http-equiv = "Content-Language" content = "en-gb" >
2020-05-03 03:01:21 +03:00
2020-05-03 03:20:55 +03:00
< link href = "../docs-assets/Contents.css" rel = "stylesheet" rev = "stylesheet" type = "text/css" >
< link href = "../docs-assets/Progress.css" rel = "stylesheet" rev = "stylesheet" type = "text/css" >
< link href = "../docs-assets/Navigation.css" rel = "stylesheet" rev = "stylesheet" type = "text/css" >
< link href = "../docs-assets/Fonts.css" rel = "stylesheet" rev = "stylesheet" type = "text/css" >
< link href = "../docs-assets/Base.css" rel = "stylesheet" rev = "stylesheet" type = "text/css" >
< link href = "../docs-assets/Colours.css" rel = "stylesheet" rev = "stylesheet" type = "text/css" >
2020-04-14 19:56:54 +03:00
2019-03-25 11:21:34 +02:00
< / head >
2020-05-03 03:01:21 +03:00
< body class = "commentary-font" >
2020-03-19 02:11:25 +02:00
< nav role = "navigation" >
2020-04-14 19:56:54 +03:00
< h1 > < a href = "../index.html" >
2020-05-03 18:34:53 +03:00
< img src = "../docs-assets/Inform.png" height = 72" >
2020-04-14 19:56:54 +03:00
< / a > < / h1 >
< ul > < li > < a href = "../compiler.html" > compiler tools< / a > < / li >
2020-03-19 02:11:25 +02:00
< li > < a href = "../other.html" > other tools< / a > < / li >
< li > < a href = "../extensions.html" > extensions and kits< / a > < / li >
< li > < a href = "../units.html" > unit test tools< / a > < / li >
2020-04-14 19:56:54 +03:00
< / ul > < h2 > Compiler Webs< / h2 > < ul >
2020-03-19 02:11:25 +02:00
< li > < a href = "../inbuild/index.html" > inbuild< / a > < / li >
< li > < a href = "../inform7/index.html" > inform7< / a > < / li >
2020-04-14 19:56:54 +03:00
< li > < a href = "index.html" > < span class = "selectedlink" > inter< / span > < / a > < / li >
< / ul > < h2 > Inbuild Modules< / h2 > < ul >
< li > < a href = "../supervisor-module/index.html" > supervisor< / a > < / li >
< / ul > < h2 > Inform7 Modules< / h2 > < ul >
2020-03-19 02:11:25 +02:00
< li > < a href = "../core-module/index.html" > core< / a > < / li >
2020-08-27 17:50:24 +03:00
< li > < a href = "../assertions-module/index.html" > assertions< / a > < / li >
< li > < a href = "../values-module/index.html" > values< / a > < / li >
< li > < a href = "../knowledge-module/index.html" > knowledge< / a > < / li >
< li > < a href = "../imperative-module/index.html" > imperative< / a > < / li >
< li > < a href = "../runtime-module/index.html" > runtime< / a > < / li >
2020-03-19 02:11:25 +02:00
< li > < a href = "../if-module/index.html" > if< / a > < / li >
< li > < a href = "../multimedia-module/index.html" > multimedia< / a > < / li >
< li > < a href = "../index-module/index.html" > index< / a > < / li >
2020-04-14 19:56:54 +03:00
< / ul > < h2 > Inter Modules< / h2 > < ul >
< li > < a href = "../bytecode-module/index.html" > bytecode< / a > < / li >
2020-03-19 02:11:25 +02:00
< li > < a href = "../building-module/index.html" > building< / a > < / li >
2021-08-10 13:01:03 +03:00
< li > < a href = "../pipeline-module/index.html" > pipeline< / a > < / li >
< li > < a href = "../final-module/index.html" > final< / a > < / li >
2020-05-20 02:02:28 +03:00
< / ul > < h2 > Services< / h2 > < ul >
2020-04-14 19:56:54 +03:00
< li > < a href = "../arch-module/index.html" > arch< / a > < / li >
2020-08-27 17:50:24 +03:00
< li > < a href = "../calculus-module/index.html" > calculus< / a > < / li >
2020-04-14 19:56:54 +03:00
< li > < a href = "../html-module/index.html" > html< / a > < / li >
2020-05-20 02:02:28 +03:00
< li > < a href = "../inflections-module/index.html" > inflections< / a > < / li >
2020-08-27 17:50:24 +03:00
< li > < a href = "../kinds-module/index.html" > kinds< / a > < / li >
2020-05-20 02:02:28 +03:00
< li > < a href = "../linguistics-module/index.html" > linguistics< / a > < / li >
< li > < a href = "../problems-module/index.html" > problems< / a > < / li >
2020-08-27 17:50:24 +03:00
< li > < a href = "../syntax-module/index.html" > syntax< / a > < / li >
< li > < a href = "../words-module/index.html" > words< / a > < / li >
2020-03-19 02:11:25 +02:00
< li > < a href = "../../../inweb/docs/foundation-module/index.html" > foundation< / a > < / li >
2020-04-14 19:56:54 +03:00
< / ul >
2020-03-19 02:11:25 +02:00
< / nav >
< main role = "main" >
2020-05-03 03:01:21 +03:00
<!-- Weave of 'Inform Organisation' generated by Inweb -->
< div class = "breadcrumbs" >
< ul class = "crumbs" > < li > < a href = "../index.html" > Home< / 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 > Inform Organisation< / b > < / li > < / ul > < / div >
< p class = "purpose" > The standard hierarchy of inter code generated by Inform.< / p >
2019-03-25 11:21:34 +02:00
2020-04-16 01:49:59 +03:00
< ul class = "toc" > < li > < a href = "M-io.html#SP1" > § 1. Status< / a > < / li > < li > < a href = "M-io.html#SP2" > § 2. Global area and main< / a > < / li > < li > < a href = "M-io.html#SP3" > § 3. Compilation modules< / a > < / li > < li > < a href = "M-io.html#SP5" > § 5. Function packages< / a > < / li > < / ul > < hr class = "tocbar" >
2019-03-25 11:21:34 +02:00
2020-08-27 17:50:24 +03:00
< p class = "commentary firstcommentary" > < a id = "SP1" class = "paragraph-anchor" > < / a > < b > § 1. Status. < / b > The Inter specification allows great flexibility in how packages are used
2019-03-25 11:21:34 +02:00
to structure a program, and requires very little.
< / p >
2020-05-03 03:01:21 +03:00
< p class = "commentary" > The Inform compiler, however, uses this flexibility in a systematic way,
2019-03-25 11:21:34 +02:00
as follows.
< / p >
2020-08-27 17:50:24 +03:00
< p class = "commentary firstcommentary" > < a id = "SP2" class = "paragraph-anchor" > < / a > < b > § 2. Global area and main. < / b > Inform opens with a version number, then declares package types (as needed
2019-03-25 11:21:34 +02:00
below), issues pragmas for I6 compiler memory settings, then declares
primitives for the standard Inform set: it always declares the same set
of primitives on every run.
< / p >
2020-05-03 03:01:21 +03:00
< p class = "commentary" > As required, the rest of the program is in the < span class = "extract" > < span class = "extract-syntax" > main< / span > < / span > package, which has
type < span class = "extract" > < span class = "extract-syntax" > _plain< / span > < / span > .
2019-03-25 11:21:34 +02:00
< / p >
2020-08-27 17:50:24 +03:00
< p class = "commentary firstcommentary" > < a id = "SP3" class = "paragraph-anchor" > < / a > < b > § 3. Compilation modules. < / b > Inform divides up its material into compilation modules, as follows. Each
2020-05-03 03:01:21 +03:00
one becomes an inter package of type < span class = "extract" > < span class = "extract-syntax" > _module< / span > < / span > , and is a subpackage of < span class = "extract" > < span class = "extract-syntax" > main< / span > < / span > .
2019-03-25 11:21:34 +02:00
< / p >
< ul class = "items" > < li > (a) The "generic module" contains built-in definitions of kinds, and the like.
No source text directly leads to this, and indeed, it can entirely be defined
without having seen any source text: it will be the same on every run. The
2020-05-03 03:01:21 +03:00
package is < span class = "extract" > < span class = "extract-syntax" > /main/generic< / span > < / span > .
< / li > < li > (b) Material from the Inform 6 template is assimilated into inter code in
the "template module", which is < span class = "extract" > < span class = "extract-syntax" > /main/template< / span > < / span > .
< / li > < li > (c) Each extension is a compilation module, including of course the Standard
Rules, which is < span class = "extract" > < span class = "extract-syntax" > /main/standard_rules< / span > < / span > . Subsequent extensions have
longer names, such as < span class = "extract" > < span class = "extract-syntax" > /main/locksmith_by_emily_short< / span > < / span > .
< / li > < li > (d) Material in the main source text is a single compilation module, and
goes into < span class = "extract" > < span class = "extract-syntax" > /main/source_text< / span > < / span > .
< / li > < li > (e) The "synoptic module" contains material which was synthesised from all
2019-03-25 11:21:34 +02:00
of the source material in the other modules, and which can't meaningfully
be localised. For example, a function at run-time which returns the default
value for a kind given its weak kind ID has to be synoptic, because its
definition will include references to every kind defined in the program.
Such a function doesn't belong to any one block of source text. The
2020-05-03 03:01:21 +03:00
package is < span class = "extract" > < span class = "extract-syntax" > /main/synoptic< / span > < / span > .
2019-03-25 11:21:34 +02:00
< / li > < / ul >
2020-08-27 17:50:24 +03:00
< p class = "commentary firstcommentary" > < a id = "SP4" class = "paragraph-anchor" > < / a > < b > § 4. < / b > Except for the template module, which is necessarily more free-form,
2019-03-25 11:24:20 +02:00
each module package then contains some or all of a standard set of
2020-05-03 03:01:21 +03:00
subpackages (and nothing else). Suppose the module name is < span class = "extract" > < span class = "extract-syntax" > M< / span > < / span > . The
2019-03-25 11:21:34 +02:00
range of possible subpackages is:
< / p >
2020-05-03 03:01:21 +03:00
< pre class = "displayed-code all-displayed-code code-font" >
< span class = "plain-syntax" > /main/M/actions< / span >
< span class = "plain-syntax" > /main/M/activities< / span >
< span class = "plain-syntax" > /main/M/adjectives< / span >
< span class = "plain-syntax" > /main/M/chronology< / span >
< span class = "plain-syntax" > /main/M/conjugations< / span >
< span class = "plain-syntax" > /main/M/equations< / span >
< span class = "plain-syntax" > /main/M/extensions< / span >
< span class = "plain-syntax" > /main/M/functions< / span >
< span class = "plain-syntax" > /main/M/grammar< / span >
< span class = "plain-syntax" > /main/M/instances< / span >
< span class = "plain-syntax" > /main/M/kinds< / span >
< span class = "plain-syntax" > /main/M/listing< / span >
< span class = "plain-syntax" > /main/M/phrases< / span >
< span class = "plain-syntax" > /main/M/properties< / span >
< span class = "plain-syntax" > /main/M/relations< / span >
< span class = "plain-syntax" > /main/M/rulebooks< / span >
< span class = "plain-syntax" > /main/M/rules< / span >
< span class = "plain-syntax" > /main/M/tables< / span >
< span class = "plain-syntax" > /main/M/variables< / span >
2019-03-25 11:21:34 +02:00
< / pre >
2020-08-27 17:50:24 +03:00
< p class = "commentary firstcommentary" > < a id = "SP5" class = "paragraph-anchor" > < / a > < b > § 5. Function packages. < / b > All functions compiled by Inform 7 are expressed in inter code by packages
2020-05-03 03:01:21 +03:00
of type < span class = "extract" > < span class = "extract-syntax" > _function< / span > < / span > . The only externally visible symbol is < span class = "extract" > < span class = "extract-syntax" > call< / span > < / span > , which is
2019-03-31 00:26:48 +02:00
what is invoked. For example:
< / p >
2020-05-03 03:01:21 +03:00
< pre class = "displayed-code all-displayed-code code-font" >
< span class = "plain-syntax" > < / span > < span class = "reserved-syntax" > symbol< / span > < span class = "plain-syntax" > X < / span > < span class = "reserved-syntax" > --> < / span > < span class = "plain-syntax" > /main/kinds/kind_6/gpr_fn/call< / span >
< span class = "plain-syntax" > ...< / span >
< span class = "plain-syntax" > < / span > < span class = "reserved-syntax" > inv< / span > < span class = "plain-syntax" > X< / span >
2019-03-31 00:26:48 +02:00
< / pre >
2020-05-03 03:01:21 +03:00
< p class = "commentary" > invokes the function defined by the package:
2019-03-31 00:26:48 +02:00
< / p >
2020-05-03 03:01:21 +03:00
< pre class = "displayed-code all-displayed-code code-font" >
< span class = "plain-syntax" > /main/kinds/kind_6/gpr_fn< / span >
2019-03-31 00:26:48 +02:00
< / pre >
2020-05-03 03:01:21 +03:00
< p class = "commentary" > (Inform conventionally uses names ending in < span class = "extract" > < span class = "extract-syntax" > _fn< / span > < / span > for function packages.)
2019-07-14 20:11:41 +03:00
Functions assimilated from template files are almost exactly similar,
2020-05-03 03:01:21 +03:00
except that rather than < span class = "extract" > < span class = "extract-syntax" > call< / span > < / span > the call symbol has the name of the original
template function. For example, < span class = "extract" > < span class = "extract-syntax" > RELATION_TY_Distinguish< / span > < / span > is assimilated as:
2019-03-31 00:26:48 +02:00
< / p >
2020-05-03 03:01:21 +03:00
< pre class = "displayed-code all-displayed-code code-font" >
< span class = "plain-syntax" > /template/functions/RELATION_TY_Distinguish_fn/RELATION_TY_Distinguish< / span >
2019-07-14 20:11:41 +03:00
< / pre >
2020-05-03 03:01:21 +03:00
< p class = "commentary" > It is possible for function packages to avoid defining any actual code, by
defining < span class = "extract" > < span class = "extract-syntax" > call< / span > < / span > as an alias for a routine which we'll simply have to assume
2019-03-31 00:26:48 +02:00
will be present at eventual compile time. For example:
< / p >
2020-05-03 03:01:21 +03:00
< pre class = "displayed-code all-displayed-code code-font" >
< span class = "plain-syntax" > < / span > < span class = "reserved-syntax" > package< / span > < span class = "plain-syntax" > print_fn _function< / span >
< span class = "plain-syntax" > < / span > < span class = "reserved-syntax" > symbol< / span > < span class = "plain-syntax" > < / span > < span class = "reserved-syntax" > public< / span > < span class = "plain-syntax" > < / span > < span class = "reserved-syntax" > misc< / span > < span class = "plain-syntax" > call < / span > < span class = "element-syntax" > `REAL_NUMBER_TY_Say< / span > < span class = "plain-syntax" > `< / span >
2019-03-31 00:26:48 +02:00
< / pre >
2020-05-03 03:01:21 +03:00
< p class = "commentary" > More often, however, and always for functions derived from Inform 7 source
text, the package contains a code subpackage, and then defines < span class = "extract" > < span class = "extract-syntax" > call< / span > < / span > to
2019-03-31 00:26:48 +02:00
be that code package:
< / p >
2020-05-03 03:01:21 +03:00
< pre class = "displayed-code all-displayed-code code-font" >
< span class = "plain-syntax" > < / span > < span class = "reserved-syntax" > package< / span > < span class = "plain-syntax" > gpr_fn _function< / span >
< span class = "plain-syntax" > < / span > < span class = "reserved-syntax" > package< / span > < span class = "plain-syntax" > code_block_1 _code< / span >
< span class = "plain-syntax" > ...< / span >
< span class = "plain-syntax" > < / span > < span class = "reserved-syntax" > constant< / span > < span class = "plain-syntax" > call < / span > < span class = "identifier-syntax" > K_phrase_nothing____nothing< / span > < span class = "plain-syntax" > = code_block_1< / span >
2019-03-31 00:26:48 +02:00
< / pre >
2020-05-03 03:01:21 +03:00
< p class = "commentary" > In fact, though, the package can be much more elaborate. If the code needs
2019-03-31 00:26:48 +02:00
to manipulate or refer to data not expressible in single words, such as
lists or texts, then it will probably need to create and subsequently destroy
a stack frame. The mechanism will then be:
< / p >
2020-05-03 03:01:21 +03:00
< pre class = "displayed-code all-displayed-code code-font" >
< span class = "plain-syntax" > < / span > < span class = "reserved-syntax" > package< / span > < span class = "plain-syntax" > gpr_fn _function< / span >
< span class = "plain-syntax" > < / span > < span class = "reserved-syntax" > package< / span > < span class = "plain-syntax" > code_block_1 _code< / span >
< span class = "plain-syntax" > ...< / span >
< span class = "plain-syntax" > < / span > < span class = "reserved-syntax" > constant< / span > < span class = "plain-syntax" > kernel < / span > < span class = "identifier-syntax" > K_phrase_nothing____nothing< / span > < span class = "plain-syntax" > = code_block_1< / span >
< span class = "plain-syntax" > < / span > < span class = "reserved-syntax" > package< / span > < span class = "plain-syntax" > code_block_2 _code< / span >
< span class = "plain-syntax" > ...< / span >
< span class = "plain-syntax" > < / span > < span class = "reserved-syntax" > constant< / span > < span class = "plain-syntax" > call < / span > < span class = "identifier-syntax" > K_phrase_nothing____nothing< / span > < span class = "plain-syntax" > = code_block_2< / span >
2019-03-31 00:26:48 +02:00
< / pre >
2020-05-03 03:01:21 +03:00
< p class = "commentary" > The "shell" routine of code, the one receiving the < span class = "extract" > < span class = "extract-syntax" > call< / span > < / span > , creates a stack
2019-03-31 00:26:48 +02:00
fram and then calls the "kernel" routine, which does the actual work; when
that returns to the "shell", the stack frame is disposed of again.
< / p >
2020-05-03 03:01:21 +03:00
< p class = "commentary" > Function packages will also contain definitions of any static data they
2019-03-31 00:26:48 +02:00
need: for example, if an Inform 7 phrase contains a reference to the
2020-05-03 03:01:21 +03:00
constant < span class = "extract" > < span class = "extract-syntax" > { 1 , 2 , 3 }< / span > < / span > then a function package for it will define a
constant with a name such as < span class = "extract" > < span class = "extract-syntax" > block_constant_1< / span > < / span > . In short, as far as
2019-03-31 00:26:48 +02:00
possible, function packages are self-contained.
< / p >
2020-05-03 03:01:21 +03:00
< nav role = "progress" > < div class = "progresscontainer" >
< ul class = "progressbar" > < li class = "progressprev" > < a href = "M-ia.html" > ❮ < / a > < / li > < li class = "progresscurrentchapter" > M< / li > < li class = "progresssection" > < a href = "M-ui.html" > ui< / a > < / li > < li class = "progresssection" > < a href = "M-ti.html" > ti< / a > < / li > < li class = "progresssection" > < a href = "M-dpiti.html" > dpiti< / a > < / li > < li class = "progresssection" > < a href = "M-cpiti.html" > cpiti< / a > < / li > < li class = "progresssection" > < a href = "M-ip.html" > ip< / a > < / li > < li class = "progresssection" > < a href = "M-ia.html" > ia< / a > < / li > < li class = "progresscurrent" > io< / li > < li class = "progresssection" > < a href = "M-pas.html" > pas< / a > < / li > < li class = "progresssection" > < a href = "M-rc.html" > rc< / a > < / li > < li class = "progresschapter" > < a href = "1-mn.html" > 1< / a > < / li > < li class = "progressnext" > < a href = "M-pas.html" > ❯ < / a > < / li > < / ul > < / div >
< / nav > <!-- End of weave -->
2019-03-31 00:26:48 +02:00
2020-03-19 02:11:25 +02:00
< / main >
2019-03-25 11:21:34 +02:00
< / body >
< / html >