1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-05 08:34:22 +03:00
inform7/docs/inter/M-ia.html

270 lines
21 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Inform Annotations</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
<meta name="viewport" content="width=device-width initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="en-gb">
<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">
</head>
<body class="commentary-font">
<nav role="navigation">
<h1><a href="../index.html">
<img src="../docs-assets/Inform.png" height=72">
</a></h1>
<ul><li><a href="../compiler.html">compiler tools</a></li>
<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>
</ul><h2>Compiler Webs</h2><ul>
<li><a href="../inbuild/index.html">inbuild</a></li>
<li><a href="../inform7/index.html">inform7</a></li>
<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>
<li><a href="../core-module/index.html">core</a></li>
<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>
<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>
</ul><h2>Inter Modules</h2><ul>
<li><a href="../bytecode-module/index.html">bytecode</a></li>
<li><a href="../building-module/index.html">building</a></li>
<li><a href="../pipeline-module/index.html">pipeline</a></li>
<li><a href="../final-module/index.html">final</a></li>
</ul><h2>Services</h2><ul>
<li><a href="../arch-module/index.html">arch</a></li>
<li><a href="../calculus-module/index.html">calculus</a></li>
<li><a href="../html-module/index.html">html</a></li>
<li><a href="../inflections-module/index.html">inflections</a></li>
<li><a href="../kinds-module/index.html">kinds</a></li>
<li><a href="../linguistics-module/index.html">linguistics</a></li>
<li><a href="../problems-module/index.html">problems</a></li>
<li><a href="../syntax-module/index.html">syntax</a></li>
<li><a href="../words-module/index.html">words</a></li>
<li><a href="../../../inweb/docs/foundation-module/index.html">foundation</a></li>
</ul>
</nav>
<main role="main">
<!--Weave of 'Inform Annotations' 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 Annotations</b></li></ul></div>
<p class="purpose">The standard set of symbol annotations used within Inform.</p>
<ul class="toc"><li><a href="M-ia.html#SP1">&#167;1. Status</a></li><li><a href="M-ia.html#SP2">&#167;2. Miscellaneous constants</a></li><li><a href="M-ia.html#SP13">&#167;13. Constant lists</a></li><li><a href="M-ia.html#SP21">&#167;21. Primitive names</a></li><li><a href="M-ia.html#SP23">&#167;23. Local variables</a></li><li><a href="M-ia.html#SP26">&#167;26. Global variables</a></li><li><a href="M-ia.html#SP28">&#167;28. Kinds</a></li><li><a href="M-ia.html#SP31">&#167;31. Instances</a></li><li><a href="M-ia.html#SP35">&#167;35. Properties</a></li></ul><hr class="tocbar">
<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Status. </b>The Inter specification allows for any number of annotations to be used;
none are required.
</p>
<p class="commentary">The Inform compiler, however, has a standard set of annotations used to
pass hints from the front end of the compiler to the back end; hints which
mainly do not change the meaning of the program, but cause the eventual
Inform 6 code to be generated in a particular order, or using particular
syntaxes, to be make it easier to read or more compatible with code not
generated by I7.
</p>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. Miscellaneous constants. </b></p>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b><span class="extract"><span class="extract-syntax">__hex</span></span>. Applies to <span class="extract"><span class="extract-syntax">constant</span></span>. Marks that the value of this constant
is most legible in hexadecimal rather than decimal. Inter itself uses
this when writing a textual inter fomr of the constant's declaration,
and the Inform back end uses it when compiling Inform 6, in that it will
compile to a hexadecimal literal like <span class="extract"><span class="extract-syntax">$4F02</span></span> rather than a decimal one
like <span class="extract"><span class="extract-syntax">20226</span></span>. There is no effect on the final program.
</p>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b><span class="extract"><span class="extract-syntax">__signed</span></span>. Applies to <span class="extract"><span class="extract-syntax">constant</span></span>. Marks that the value of this constant
is most legible if printed as a signed decimal literal than as an
unsigned one.
</p>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b><span class="extract"><span class="extract-syntax">__late</span></span>. Applies to <span class="extract"><span class="extract-syntax">constant</span></span>. Suggests that this should be placed late
on the final compiled code, rather than at its current place. (This clue
helps the I6 code generator to avoid not-yet-declared errors; I6 is quite
finicky about code ordering.)
</p>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. </b><span class="extract"><span class="extract-syntax">__noun_filter</span></span>. Applies to <span class="extract"><span class="extract-syntax">constant</span></span> which is a function. Marks that this
function is a noun filter in command parser grammar.
</p>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. </b><span class="extract"><span class="extract-syntax">__scope_filter</span></span>. Applies to <span class="extract"><span class="extract-syntax">constant</span></span> which is a function. Marks that this
function is a scope filter in command parser grammar.
</p>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. </b><span class="extract"><span class="extract-syntax">__action</span></span>. Applies to <span class="extract"><span class="extract-syntax">constant</span></span>. Marks it as the name of an action.
</p>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. </b><span class="extract"><span class="extract-syntax">__fake_action</span></span>. Applies to symbols already tagged <span class="extract"><span class="extract-syntax">_action</span></span>, and marks
that their actions are I6 template fake actions. (It currently contains
just four of these.)
</p>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. </b><span class="extract"><span class="extract-syntax">__assimilated</span></span>. Applies to <span class="extract"><span class="extract-syntax">constant</span></span>. Marks it as a symbol defined in
I6 template code which has been assimilated into memory inter.
</p>
<p class="commentary firstcommentary"><a id="SP11" class="paragraph-anchor"></a><b>&#167;11. </b><span class="extract"><span class="extract-syntax">__holding</span></span>. Applies to <span class="extract"><span class="extract-syntax">constant</span></span>. This is part of a convoluted system
for handling references to constants not yet defined, in the sense that
the inter to define them has not yet been generated in memory. A "holding"
constant is used to reserve a name for later definition.
</p>
<p class="commentary firstcommentary"><a id="SP12" class="paragraph-anchor"></a><b>&#167;12. </b><span class="extract"><span class="extract-syntax">__delenda_est</span></span>. Applies to <span class="extract"><span class="extract-syntax">constant</span></span>. Likewise; but marks a symbol for
later deletion rather than later definition.
</p>
<p class="commentary firstcommentary"><a id="SP13" class="paragraph-anchor"></a><b>&#167;13. Constant lists. </b></p>
<p class="commentary firstcommentary"><a id="SP14" class="paragraph-anchor"></a><b>&#167;14. </b><span class="extract"><span class="extract-syntax">__buffer_array</span></span>. Applies to <span class="extract"><span class="extract-syntax">constant</span></span> which is a literal list. Asks
this to be compiled as virtual machine command parsing buffer.
</p>
<p class="commentary firstcommentary"><a id="SP15" class="paragraph-anchor"></a><b>&#167;15. </b><span class="extract"><span class="extract-syntax">__byte_array</span></span>. Applies to <span class="extract"><span class="extract-syntax">constant</span></span> which is a literal list. Asks
this to be compiled as an array of bytes.
</p>
<p class="commentary firstcommentary"><a id="SP16" class="paragraph-anchor"></a><b>&#167;16. </b><span class="extract"><span class="extract-syntax">__string_array</span></span>. Applies to <span class="extract"><span class="extract-syntax">constant</span></span> which is a literal list. Asks this
to be compiled as an array of bytes preceded by its size.
</p>
<p class="commentary firstcommentary"><a id="SP17" class="paragraph-anchor"></a><b>&#167;17. </b><span class="extract"><span class="extract-syntax">__table_array</span></span>. Applies to <span class="extract"><span class="extract-syntax">constant</span></span> which is a literal list. Asks this
to be compiled as an array of words preceded by its size.
</p>
<p class="commentary firstcommentary"><a id="SP18" class="paragraph-anchor"></a><b>&#167;18. </b><span class="extract"><span class="extract-syntax">__inline_array</span></span>. Applies to <span class="extract"><span class="extract-syntax">constant</span></span> which is a literal list. Asks that,
if this is compiled as a property value in Inform 6, it should use the inline
syntax (as is conventional for the I6 <span class="extract"><span class="extract-syntax">name</span></span> property, for example).
</p>
<p class="commentary firstcommentary"><a id="SP19" class="paragraph-anchor"></a><b>&#167;19. </b><span class="extract"><span class="extract-syntax">__verb</span></span>. Applies to <span class="extract"><span class="extract-syntax">constant</span></span> which is a literal list. Asks this to be
compiled as Inform 6 command parser grammar.
</p>
<p class="commentary firstcommentary"><a id="SP20" class="paragraph-anchor"></a><b>&#167;20. </b><span class="extract"><span class="extract-syntax">__meta_verb</span></span>. Applies to <span class="extract"><span class="extract-syntax">constant</span></span> which is a literal list and also has
the <span class="extract"><span class="extract-syntax">__verb</span></span> annotation: means that this is a "meta-verb", and should be
compiled after the regular verbs.
</p>
<p class="commentary firstcommentary"><a id="SP21" class="paragraph-anchor"></a><b>&#167;21. Primitive names. </b></p>
<p class="commentary firstcommentary"><a id="SP22" class="paragraph-anchor"></a><b>&#167;22. </b><span class="extract"><span class="extract-syntax">__bip</span></span>. Applies to <span class="extract"><span class="extract-syntax">primitive</span></span>. This is used internally in the code
generator to match textual names such as <span class="extract"><span class="extract-syntax">!bitwisenot</span></span> with functionality:
it's essentially a cache to avoid having to parse names over and over.
(BIP stands for "built in primitive".)
</p>
<p class="commentary firstcommentary"><a id="SP23" class="paragraph-anchor"></a><b>&#167;23. Local variables. </b></p>
<p class="commentary firstcommentary"><a id="SP24" class="paragraph-anchor"></a><b>&#167;24. </b><span class="extract"><span class="extract-syntax">__call_parameter</span></span>. Applies to <span class="extract"><span class="extract-syntax">local</span></span>. Inform's front end marks
call parameters this way in case optimisation stages in the back end might
need to know; and if nothing else, it enables the code generator to print
I6 comments showing the intention.
</p>
<p class="commentary firstcommentary"><a id="SP25" class="paragraph-anchor"></a><b>&#167;25. </b><span class="extract"><span class="extract-syntax">__implied_call_parameter</span></span>. Applies to <span class="extract"><span class="extract-syntax">local</span></span>. Similarly. What
makes a call parameter "implied" is that it is not directly one of the
tokens from an Inform 7 function, but has been added for some implementation
reason. For example, a phrase option bitmap is passed as an implied call
parameter.
</p>
<p class="commentary firstcommentary"><a id="SP26" class="paragraph-anchor"></a><b>&#167;26. Global variables. </b></p>
<p class="commentary firstcommentary"><a id="SP27" class="paragraph-anchor"></a><b>&#167;27. </b><span class="extract"><span class="extract-syntax">__explicit_variable</span></span>. Applies to <span class="extract"><span class="extract-syntax">variable</span></span>. Marks this as having a name
already supplied in high-level I7 source text.
</p>
<p class="commentary firstcommentary"><a id="SP28" class="paragraph-anchor"></a><b>&#167;28. Kinds. </b></p>
<p class="commentary firstcommentary"><a id="SP29" class="paragraph-anchor"></a><b>&#167;29. </b><span class="extract"><span class="extract-syntax">__weak_ID</span></span>. Applies to <span class="extract"><span class="extract-syntax">kind</span></span>. The weak ID of a kind is a single small
non-negative integer which is unique to that kind's constructor; it can't
distinguish between lists of X and lists of Y, but in general it can
distinguish a list from a number, or a number from a text. This annotation
marks the name of a kind with the same weak ID value which will be used
at run-time for that kind.
</p>
<p class="commentary firstcommentary"><a id="SP30" class="paragraph-anchor"></a><b>&#167;30. </b><span class="extract"><span class="extract-syntax">__source_order</span></span>. Applies (undependently) to <span class="extract"><span class="extract-syntax">property</span></span> and to <span class="extract"><span class="extract-syntax">kind</span></span>:
a lower value for this annotation means that one property was defined earlier
in the Inform source text that the other, and similarly for kinds.
</p>
<p class="commentary firstcommentary"><a id="SP31" class="paragraph-anchor"></a><b>&#167;31. Instances. </b></p>
<p class="commentary firstcommentary"><a id="SP32" class="paragraph-anchor"></a><b>&#167;32. </b><span class="extract"><span class="extract-syntax">__object_kind_counter</span></span>. Applies to <span class="extract"><span class="extract-syntax">kind</span></span>. Towards the end of code
generation, it's convenient to count the subkinds of <span class="extract"><span class="extract-syntax">K_object</span></span> in order
of their creation in the original source text. That count is recorded
here: <span class="extract"><span class="extract-syntax">K1_thing</span></span> will get <span class="extract"><span class="extract-syntax">__object_kind_counter=1</span></span>, and so on.
</p>
<p class="commentary firstcommentary"><a id="SP33" class="paragraph-anchor"></a><b>&#167;33. </b><span class="extract"><span class="extract-syntax">__arrow_count</span></span>. Applies to <span class="extract"><span class="extract-syntax">instance</span></span> of objects; it's the depth in the
spatial containment tree, where 0 is the top level (usually rooms), 1 the
level for things immediately inside level-0 objects, and so on. So called
because the Inform 6 notation for containment is this many <span class="extract"><span class="extract-syntax">-&gt;</span></span> arrows in
a row. This is applied only at the final stage of code generation.
</p>
<p class="commentary firstcommentary"><a id="SP34" class="paragraph-anchor"></a><b>&#167;34. </b><span class="extract"><span class="extract-syntax">__declaration_order</span></span>. Applies to <span class="extract"><span class="extract-syntax">instance</span></span> of objects; it's the order
in which they are declared in the final Inform 6 code, with the first object
as 0, and so on. This is applied only at the final stage of code generation.
</p>
<p class="commentary firstcommentary"><a id="SP35" class="paragraph-anchor"></a><b>&#167;35. Properties. </b></p>
<p class="commentary firstcommentary"><a id="SP36" class="paragraph-anchor"></a><b>&#167;36. </b><span class="extract"><span class="extract-syntax">__either_or</span></span>. Applies to <span class="extract"><span class="extract-syntax">property</span></span>. Marks it as one which is either
held or not held.
</p>
<p class="commentary firstcommentary"><a id="SP37" class="paragraph-anchor"></a><b>&#167;37. </b><span class="extract"><span class="extract-syntax">__attribute</span></span>. Applies to <span class="extract"><span class="extract-syntax">property</span></span>, and only to those also annotated
with <span class="extract"><span class="extract-syntax">__either_or</span></span>. Asks to compile this at run-time as a virtual machine
attribute.
</p>
<p class="commentary firstcommentary"><a id="SP38" class="paragraph-anchor"></a><b>&#167;38. </b><span class="extract"><span class="extract-syntax">__explicit_attribute</span></span>. Applies to <span class="extract"><span class="extract-syntax">property</span></span>, and only to those also
annotated with <span class="extract"><span class="extract-syntax">__either_or</span></span>. Marks this as not only an attribute, but one
with a name already supplied in high-level I7 source text.
</p>
<p class="commentary firstcommentary"><a id="SP39" class="paragraph-anchor"></a><b>&#167;39. </b><span class="extract"><span class="extract-syntax">__property_name</span></span>. Applies to <span class="extract"><span class="extract-syntax">property</span></span>. Where a property name came from
I7 source text, and thus has a friendly sort of name ("carrying capacity",
for example), the Inform front end applies this annotation. The back end
then uses it only to help run-time I6 code prpduce better error messages
if the program uses the property incorrectly.
</p>
<p class="commentary firstcommentary"><a id="SP40" class="paragraph-anchor"></a><b>&#167;40. </b><span class="extract"><span class="extract-syntax">__rto</span></span>. Applies to <span class="extract"><span class="extract-syntax">property</span></span>, and marks it as a run-time only property:
that is, not one which is explicitly present in the Inform 7 source text,
but one which has been added to provide run-time support for some feature.
</p>
<p class="commentary firstcommentary"><a id="SP41" class="paragraph-anchor"></a><b>&#167;41. </b><span class="extract"><span class="extract-syntax">__source_order</span></span>. Applies (undependently) to <span class="extract"><span class="extract-syntax">property</span></span> and to <span class="extract"><span class="extract-syntax">kind</span></span>:
a lower value for this annotation means that one property was defined earlier
in the Inform source text that the other, and similarly for kinds.
</p>
<nav role="progress"><div class="progresscontainer">
<ul class="progressbar"><li class="progressprev"><a href="M-ip.html">&#10094;</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="progresscurrent">ia</li><li class="progresssection"><a href="M-io.html">io</a></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-io.html">&#10095;</a></li></ul></div>
</nav><!--End of weave-->
</main>
</body>
</html>