1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-05 08:34:22 +03:00
inform7/inform6/Inform6/ReleaseNotes.html

334 lines
20 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Inform Release Notes</title>
</head>
<body>
<h1>Inform 6.4 Release Notes</h1>
<h2>Introduction</h2>
This is a maintenance release of the Inform 6 compiler for creating interactive fiction. Although just about
all known bugs are fixed, the approach to enhancing Inform is more conservative. The selection of suggestions
to implement has been governed by two factors:
<ul>
<li><p>Avoidance of changes which might cause existing games to misbehave; and
<li><p>Minimisation of features which would require updates to the <i>Inform Designer&rsquo;s Manual</i>.
</ul>
Older release notes (Inform 6.30 through 6.36) are <a href="https://inform-fiction.org/manual/ReleaseNotes-6.3x.html">archived here</a>.
<p>Since the first release of the Inform 6.3 compiler, the Inform 6 library has been split into a separate project,
maintained at <a href="https://gitlab.com/DavidGriffith/inform6lib">https://gitlab.com/DavidGriffith/inform6lib</a>.
<h2>Acknowledgements</h2>
Far too many people contributed towards this release &mdash; reporting and resolving bugs, making helpful
suggestions, providing support and facilities, testing, and so on &mdash; for their names to be individually
listed. So instead, this is a general thank-you to everybody who has made this release happen, and
specific ones to Graham Nelson for permitting it in the first place, and to Andrew Plotkin, who is responsible
for most of the actual changes to the compiler code.
<h2>Inform 6.43</h2>
These are the changes delivered in version 6.42 of the Inform compiler.
<h3>Features added</h3>
<ul>
<li><p>A new dictionary flag has been introduced, "singular", which is set for any non that is not a plural.
This can be explicitly set or not set in a dictionary word with the <tt>'//s'</tt> syntax, i.e. <tt>'word//s'</tt> to set it,
or <tt>'word//~s'</tt> to not set it.
</ul>
<h3>Bugs fixed</h3>
<ul>
<li><p>Dictionary flags were being set incorrectly when <tt>$DICT_WORD_SIZE</tt> was set sufficiently large.
</ul>
<h2>Inform 6.42</h2>
These are the changes delivered in version 6.42 of the Inform compiler.
<h3>Features added</h3>
<ul>
<li><p>The compiler can now handle switch cases which are expressions, rather than just looking for bare literals
and symbols. The expression must still evaluate to a constant, but now parentheses and constant-folded arithmetic
are handled:
<pre>
Constant CONST = 5;
! These have always worked.
switch (x) {
0: return 0;
1: return 1;
-2: return -2;
}
! These now also work.
switch (x) {
(0): return 0;
(-(1)): return -1;
(CONST): return 5;
(CONST+1): return 6;
}
</pre>
For backwards compatibility, the expression must be wrapped in parens, so <tt>-(1):</tt> is not a valid case. Lists
of expressions are also supported. Expression parsing applies as long as the first value is wrapped in parens.
Wrapping the entire list in parens also works:
<pre>
switch (x) {
1, 2, 3: return 0; ! old style
(4), (CONST), (CONST+1): return 1; ! new style
(10), CONST+6, CONST+7: return 2; ! this also works
(20, CONST+16, CONST+17): return 3; ! as does this
}
</pre>
Note that the <tt>to</tt> keyword does not support expressions. You cannot say <tt>(CONST) to (CONST+5):</tt>
as a case. Also, case expressions only work within a switch statement. Top-level action cases must still be bare
action names.
<li><p>Inform identifiers can now be any length, and the entire identifier is significant. Dictionary words can also
be any length. The DICT_WORD_SIZE limit still applies, but now dictionary words are silently trimmed to DICT_WORD_SIZE.
For Glulx, DICT_WORD_SIZE can now be increased without limit.
<li><p>Arbitrary bytes and words can be compiled into the game, using two new statements:
<pre>
@ -> BYTE BYTE BYTE ...;
@ --> WORD WORD WORD ...;
</pre>
The given bytes or words are directly copied out into the function. (Words are two bytes in Z-code, and four bytes in
Glulx.) The compiler assumes that the data forms valid opcodes, but does nothing to verify this. Bytes must be numeric
constants, while words are either numeric constants or symbols, such as the name of a function.
<li><p>A new setting exists to omit the symbol names table, <tt>$OMIT_SYMBOL_TABLE</tt>. The symbol names table
contains the names of all properties, attributes, fake actions, and arrays as strings, and is generally only used by
debug library code and debug veneer error messages. When <tt>$OMIT_SYMBOL_TABLE=1</tt> is set:
<ul>
<li>The symbol names table is omitted from the game file, for both Glulx and Z-code.
<li>The <tt>print (property) p</tt> statement will print <tt>&lt;number 72&gt;</tt> (etc.) instead of the property name.
<li>The runtime error for a non-existent property <tt>(obj has no property prop to read)</tt> will similarly print
a number instead of the property name.
<li>The runtime error for array overflow <tt>(tried to read from -->5 in the array "arr"...)</tt> will omit the
array name.
<li>The following system constants are not available, and trying to use one is a compile-time error:
<tt>#identifiers_table</tt>, <tt>#attribute_names_array</tt>, <tt>#property_names_array</tt>, <tt>#action_names_array</tt>,
<tt>#fake_action_names_array</tt>, <tt>#array_names_offset</tt>, <tt>#global_names_array</tt>, <tt>#routine_names_array</tt>,
<tt>#constant_names_array</tt>.
</ul><br>
Note that the Inform 6 library uses <tt>#identifiers_table</tt> for some debugging verbs, and the Infix library
extension uses all the affected constants. To update such code, the relevant logic that uses these symbol names and
constants would be put in a <tt>#Ifndef OMIT_SYMBOL_TABLE;</tt> block.
<li><p>A new setting <tt>$ZCODE_MAX_INLINE_STRING</tt> has been added to determine how long a string can be and still
be compiled to a <tt>@print</tt> opcode, rather than be added to the string segment and compiled to a <tt>@print_paddr</tt>
opcode. This setting has a default value of 32, which matches the previous behaviour of the compiler, where this limit
was hard-coded at 32 characters.
<li><p>The <tt>Abbreviate</tt> directive now accepts abbreviations of any length.
<li><p>The <tt>-u</tt> option, which computes abbreviations, can now generate abbreviations of any length.
<li><p>Inform is now able to correctly set the plural flag on long dictionary words (e.g. <tt>'directions//p'</tt>).
However, due to the way Inform 7 has defined plural kind names in the past, fixing this will affect the parsing of
Inform 7 games if the output Inform 6 code is then compiled with a version of Inform 6 that fixes this issue. As a result,
there is a new setting <tt>$LONG_DICT_FLAG_BUG</tt>, which defaults to 1. The new behaviour is only enabled if this setting
is set to 0.
<li><p>Flags for dictionary words now include setting the NOUN flag, and also provides a way to explicitly not set a
flag. The possible choices are:
<ul>
<li><tt>//p</tt> sets the PLURAL flag (bit 2)
<li><tt>//n</tt> sets the NOUN flag (bit 7)
<li><tt>//~p</tt> means do not set the PLURAL flag at this point
<li><tt>//~n</tt> means do not set the NOUN flag at this point
</ul>
<br>Dictionary words used in most contexts default to <tt>//n</tt>.
<li><p>The <tt>--trace PROPS</tt> and <tt>--trace SYMDEF</tt> options now display the line number that each property
or symbol is defined at.
<li><p>The <tt>--trace ASM=2</tt> option now shows backpatch markers as a short descriptive string, rather than as a
number.
<li><p>The statement <tt>print "^";</tt> now compiles to a single opcode (<tt>@new_line</tt> for Z-code, or
<tt>@streamchar 10</tt> for Glulx) rather than printing a one character string.
<li><p>For Glulx, with strict mode turned off, <tt>print (char) X;</tt> compiles to either <tt>@streamchar X</tt> or
<tt>@streamunichar X</tt>, depending on whether X is a compile-time constant less than 256, or not.
<li><p>Grammar table lines entries which have no verb are now omitted. When this occurs a warning is printed, as this
most likely indicates an oversight in the game's source code.
<li><p>Error messages about invalid tokens are now more informative.
<li><p>Inform now handles line breaks itself, rather than relying on the C standard library. This gives consistent
handling of Windows and Unix style line breaks on all platforms.
<li><p>The output file "gametext.txt" now includes the Z-code or Glulx version being compiled to.
<li><p>The Z-Machine opcodes added in revision 1.1 of the Z-Machine Specification Standard, <tt>set_true_colour</tt>
and <tt>buffer_screen</tt>, are now supported.
</ul>
<h3>Bugs fixed</h3>
<ul>
<li><p>The Glulx <b>random(x)</b> built-in function now follows the DM4 specification: if <b>x</b>
is positive, the function returns the result of <tt>1+(@random x)</tt>; if zero or negative, <tt>@setrandom x</tt> is called.
<li><p>In several places (local variable declarations, action names and the <tt>Switches</tt> directive) the compiler would
accept quoted strings and then ignore the quotes. This is now an error.
<li><p>The case of a property having too many entries is now always an error, and is checked correctly in the case
of compiling to Z-code V3.
<li><p>An unclosed double quote at the end of a source file no longer causes the compiler to hang.
<li><p>A number of issues relating to error messages giving incorrect information have been fixed by improving how the
compiler handles backtracking through parsed symbols in some tricky cases.
<li><p>The Z-code version of the veneer function <tt>Box__Routine</tt> (which is used in the implementation of the
<tt>box</tt> statement) now contains a check to prevent calling the <tt>@set_cursor</tt> opcode with negative
co-ordinates.
<li><p>The veneer functions <tt>RA__Pr()</tt>, <tt>RL__Pr()</tt> and <tt>CP__Tab()</tt> are now correct for Z-code V3.
<li><p>Errors in the declaration of arrays could sometimes cause the compiler to emit a large number of error messages,
this is now fixed so that only the initial error is printed.
<li><p>Invalid expressions like <tt>(a++ b)</tt>, <tt>(a ~b)</tt>, <tt>(a++ ~b)</tt>, and <tt>(a++ --b)</tt> previously
caused an internal compiler error, but now produce a sensible error message.
<li><p>When computing abbreviations, the space character is now correctly treated as only occupying one byte, not four.
<li><p>The argument supplied to the Z-machine opcode <tt>@jump</tt> is now interpreted correctly. Previously this was
only done properly for the <tt>jump</tt> statement, not the opcode.
</ul>
<h2>Inform 6.41</h2>
These are the changes delivered in version 6.41 of the Inform compiler.
<h3>Features added</h3>
<ul>
<li><p>The dead code elimination logic now allows forward jumps to labels that would be otherwise unreachable, like this:
<pre>
if (condition) {
jump MiddleLabel;
}
if (0) {
while (condition) {
...
.MiddleLabel;
...
}
}
</pre>
<li><p>The error that occurs when the compiler encounters a jump to an unknown label now includes the name of that label.
</ul>
<h2>Inform 6.40</h2>
These are the changes delivered in version 6.40 of the Inform compiler.
<h3>Features added</h3>
<ul>
<li><p>The various command line arguments that produce tracing or statistical information have been consolidated in a new
argument: <tt>$!TRACEOPT</tt> or <tt>$!TRACEOPT=N</tt>. The Unix-style equivalent is <tt>--trace TRACEOPT</tt> or
<tt>--trace TRACEOPT=N</tt>. You can also use <tt>$!</tt> by itself (or <tt>--helptrace</tt>) to list all available trace options.
Trace option names are case-insensitive.
<p>
The optional <tt>N</tt> is always an integer. 0 always means off, 1 is the base level, 2 or more may increase verbosity.
As a general rule, setting <tt>N</tt> to a high number is not an error; it just does the same thing as the highest supported
number for that option. (This lets us add more verbosity levels to any option without worrying about compatibility errors.)
<p>
Four trace settings can be changed in mid-compile with the <tt>Trace</tt> directive. (This has always been true but now it is handled
consistently.) <tt>Trace assembly</tt>, <tt>Trace expressions</tt>, <tt>Trace tokens</tt> and <tt>Trace linker</tt> are
equivalent to <tt>--trace asm</tt>, <tt>--trace expr</tt>, <tt>--trace tokens</tt> and <tt>--trace linker</tt>, respectively.
As with the command-line versions, you can optionally specify 0 to turn off that setting or 2 or more for more verbosity.
<p>
Four more trace directives do an immediate information dump: <tt>Trace dictionary</tt>, <tt>Trace objects</tt>,
<tt>Trace symbols</tt> and <tt>Trace verbs</tt>. The command-line equivalents <tt>--trace dict</tt>, <tt>--trace objects</tt>,
<tt>--trace symbols</tt> and <tt>--trace verbs</tt> do the same at the end of compilation.
<p>
The following single-letter options have been removed and replaced with trace options:
<ul>
<li><tt>-j</tt>: Replaced by <tt>--trace OBJECTS</tt>
<li><tt>-m</tt>: Replaced by <tt>--trace MEM</tt>
<li><tt>-n</tt>: Replaced by <tt>--trace PROPS</tt> (for property information) and <tt>--trace ACTIONS</tt> (for action numbers)
<li><tt>-p</tt>: Replaced by <tt>--trace MAP=2</tt>
<li><tt>-t</tt>: Replaced by <tt>--trace ASM=2</tt>
<li><tt>-y</tt>: Replaced by <tt>--trace LINKER</tt>
</ul><br>
The following single-letter options still exist, but are now aliases for trace options:
<ul><br>
<li><tt>-a</tt>: Same as <tt>--trace ASM</tt>
<li><tt>-f</tt>: Same as <tt>--trace FREQ</tt>
<li><tt>-g</tt>: Same as <tt>--trace RUNTIME</tt>
<li><tt>-s</tt>: Same as <tt>--trace STATS</tt>
<li><tt>-z</tt>: Same as <tt>--trace MAP</tt>
</ul><br>
The following single-letter options have been removed entirely:
<ul><br>
<li><tt>-b</tt>: Has not done anything since at least Inform 5.
<li><tt>-l</tt>: Was supposed to list all statements compiled, but it was never implemented.
<li><tt>-o</tt>: Showed the same information as <tt>-z</tt> or <tt>--trace MAP</tt>.
</ul><br>
The <tt>-l</tt> option did show include files being opened; this is now a separate trace setting, <tt>--trace FILES</tt>.
<p>
Some of the information that used to be under <tt>-a4</tt> is now a separate trace setting, <tt>--trace BPATCH</tt>.
<li><p>The <tt>-u</tt> option now just outputs computed abbreviations. If you want the verbose calculation information that
it used to print, use <tt>--trace FINDABBREVS</tt> or <tt>--trace FINDABBREVS=2</tt>.
<li><p>The compiler is now capable of dead code elimination, allowing it to:
<ul>
<li>Discard unreachable opcodes and strings.
<li>Minimize generated code for dead branches (<tt>if (0)</tt>, <tt>if (1)</tt>).
<li>Detect <tt>if</tt> and <tt>switch</tt> statements where every branch returns.
<li>Detect loops that never exit (or always return).
<li>Discard <tt>@jz constant</tt> opcodes where the constant is non-zero.
<li>Convert <tt>@jz 0</tt> to an unconditional <tt>@jump</tt>.
<li>Discard a <tt>@jump</tt> to the very next instruction.
<li>Discard store opcodes when computing a logical expression as a value, if one case (0 or 1) is impossible.
<li>Fold expressions like <tt>(0 && expr)</tt> and <tt>(1 || expr)</tt>, even when <tt>expr</tt> is not a constant.
</ul><br>
When statements that can never be reached are eliminated, a warning is produced, where appropriate.
<p>
Dead code elimination does mean that theoretically possible (though very odd) valid code will now
result in a compilation error. For example,
<pre>
if (DOSTUFF) {
while (condition) {
...
.MiddleLabel;
...
}
}
jump MiddleLabel; ! error
</pre>
This will fail with a compilation error if <tt>DOSTUFF</tt> is defined as a constant zero. This optimization
can be turned off by setting the compiler setting <tt>$STRIP_UNREACHABLE_LABELS</tt> to zero (its default is one).
<li><p>There are now further warnings if the compiler detects that the type used in certain expressions is not correct:
<ul>
<li><tt>X()</tt>, <tt>indirect(X)</tt>: X must be a routine
<li><tt>X.Y</tt>, <tt>X.&Y</tt>, <tt>X.#Y</tt>: X must be a class or an object; Y must be a property (the Y checks already existed)
<li><tt>X.Y()</tt>: X must be a class, object, string or routine; Y must be a property
<li><tt>X.Y++</tt>, <tt>X.Y--</tt>, <tt>++X.Y</tt>, <tt>--X.Y</tt>: X must be a class or an object; Y must be a property
</ul>
<li><p>There is a new syntax for dynamic-string interpolations: <tt>"@(N)"</tt>. The original syntax was <tt>"@NN"</tt>,
which is still supported. In the new syntax <tt>"N"</tt> can be a number, or an already defined numeric constant.
As a result of this, under Glulx the limit on <tt>$MAX_DYNAMIC_STRINGS</tt> being less than 100 has been removed.
<li><p>The constants <tt>#dictionary_table</tt> and <tt>#grammar_table</tt> are now available when compiling to
Z-code, as well as Glulx.
<li><p>The command line switch to display percentages (<tt>-p</tt>) now works with Glulx, and acts as an
extension to the <tt>-z</tt> switch.
<li><p>The double precision floating point related opcodes added to the Glulx 3.1.3 specification (that is,
<tt>@numtod</tt>, <tt>@dtonumz</tt>, <tt>@dtonumn</tt>, <tt>@ftod</tt>, <tt>@dtof</tt>, <tt>@dceil</tt>, <tt>@dfloor</tt>,
<tt>@dadd</tt>, <tt>@dsub</tt>, <tt>@dmul</tt>, <tt>@ddiv</tt>, <tt>@dmodr</tt>, <tt>@dmodq</tt>, <tt>@dsqrt</tt>,
<tt>@dexp</tt>, <tt>@dlog</tt>, <tt>@dpow</tt>, <tt>@dsin</tt>, <tt>@dcos</tt>, <tt>@dtan</tt>, <tt>@dasin</tt>,
<tt>@dacos</tt>, <tt>@datan</tt>, <tt>@datan2</tt>, <tt>@jdeq</tt>, <tt>@jdne</tt>, <tt>@jdlt</tt>, <tt>@jdle</tt>,
<tt>@jdgt</tt>, <tt>@jdge</tt>, <tt>@jdisnan</tt>, <tt>@jdisinf</tt>) are now supported. In addition there are also
two new macros <tt>@dload</tt> and <tt>@dstore</tt>, to load and store double precision floating point values.
<li><p>The undo related opcodes added to the Glulx 3.1.3 specification (that is, <tt>@hasundo</tt> and <tt>@discardundo</tt>)
are now supported.
<li><p>The <tt>Version</tt> and <tt>Switches</tt> directives are now deprecated, and produce a warning if used. The recommended way to
set the Z-code version and any other switches is to use the command line, or <tt>!%</tt> comments at the top of the source file.
<li><p>The ability to compile Inform source code as modules, and then later link it, has been removed. This functionality always had
significant restrictions and was never widely used. The <tt>-M</tt> and <tt>-U</tt> command line options have been removed, along with
the <tt>+module_path</tt> option. The <tt>Link</tt> and <tt>Import</tt> directives now just produce errors.
<li><p>The ability to use temporary files for internal storage (the <tt>-F</tt> switch and the <tt>+temporary_path</tt> option)
have been removed.
<li><p>The <tt>=</tt> sign in the <tt>Global</tt> directive is now optional, just as it is in the <tt>Constant</tt> directive. So all
of these are now legal:
<pre>
Constant c1 11;
Constant c2 = 22;
Global g1 33;
Global g2 = 44;
</pre>
<li><p>The long deprecated forms of the <tt>Global</tt> directive that could define arrays have been removed. All these are now no
longer legal:
<pre>
Global array --> size;
Global array data ...;
Global array initial ...;
Global array initstr ...;
</pre>
</ul>
<h3>Bugs fixed</h3>
<ul>
<li><p><tt>Abbreviation</tt> directives now only add abbreviations to the output file if economy mode (<tt>-e</tt>) is set.
<li><p>An array overrun when the <tt>$ZCODE_LESS_DICT_DATA</tt> setting is enabled has been fixed.
<li><p>The logic that allows a test for the compiler version of the form <tt>#IfDef VN_1640</tt> now requires what follows
the "VN_" to be a number.
</ul>
</body>
</html>