Skip to content

Releases: DavidKinder/Inform6

Inform 6.42

10 Feb 22:36
Compare
Choose a tag to compare

Inform 6.42 was released on 10th February 2024.

Features added

  • 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:
      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;
      }

For backwards compatibility, the expression must be wrapped in parens, so -(1): 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:

      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
      }

Note that the to keyword does not support expressions. You cannot say (CONST) to (CONST+5): as a case. Also, case expressions only work within a switch statement. Top-level action cases must still be bare action names.

  • 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.

  • Arbitrary bytes and words can be compiled into the game, using two new statements:

      @ -> BYTE BYTE BYTE ...;
      @ --> WORD WORD WORD ...;

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.

  • A new setting exists to omit the symbol names table, $OMIT_SYMBOL_TABLE. 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 $OMIT_SYMBOL_TABLE=1 is set:

    • The symbol names table is omitted from the game file, for both Glulx and Z-code.
    • The print (property) p statement will print <number 72> (etc.) instead of the property name.
    • The runtime error for a non-existent property (obj has no property prop to read) will similarly print a number instead of the property name.
    • The runtime error for array overflow (tried to read from -->5 in the array "arr"...) will omit the array name.
    • The following system constants are not available, and trying to use one is a compile-time error: #identifiers_table, #attribute_names_array, #property_names_array, #action_names_array, #fake_action_names_array, #array_names_offset, #global_names_array, #routine_names_array, #constant_names_array.

    Note that the Inform 6 library uses #identifiers_table 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 #Ifndef OMIT_SYMBOL_TABLE; block.

  • A new setting $ZCODE_MAX_INLINE_STRING has been added to determine how long a string can be and still be compiled to a @print opcode, rather than be added to the string segment and compiled to a @print_paddr 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.

  • The Abbreviate directive now accepts abbreviations of any length.

  • The -u option, which computes abbreviations, can now generate abbreviations of any length.

  • Inform is now able to correctly set the plural flag on long dictionary words (e.g. 'directions//p'). 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 $LONG_DICT_FLAG_BUG, which defaults to 1. The new behaviour is only enabled if this setting is set to 0.

  • 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:

    • //p sets the PLURAL flag (bit 2)
    • //n sets the NOUN flag (bit 7)
    • //~p means do not set the PLURAL flag at this point
    • //~n means do not set the NOUN flag at this point

    Dictionary words used in most contexts default to //n.

  • The --trace PROPS and --trace SYMDEF options now display the line number that each property or symbol is defined at.

  • The --trace ASM=2 option now shows backpatch markers as a short descriptive string, rather than as a number.

  • The statement print "^"; now compiles to a single opcode (@new_line for Z-code, or @streamchar 10 for Glulx) rather than printing a one character string.

  • For Glulx, with strict mode turned off, print (char) X; compiles to either @streamchar X or @streamunichar X, depending on whether X is a compile-time constant less than 256, or not.

  • 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.

  • Error messages about invalid tokens are now more informative.

  • 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.

  • The output file "gametext.txt" now includes the Z-code or Glulx version being compiled to.

  • The Z-Machine opcodes added in revision 1.1 of the Z-Machine Specification Standard, set_true_colour and buffer_screen, are now supported.

Bugs fixed

  • The Glulx random(x) built-in function now follows the DM4 specification: if x is positive, the function returns the result of 1+(@random x); if zero or negative, @setrandom x is called.

  • In several places (local variable declarations, action names and the Switches directive) the compiler would accept quoted strings and then ignore the quotes. This is now an error.

  • 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.

  • An unclosed double quote at the end of a source file no longer causes the compiler to hang.

  • 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.

  • The Z-code version of the veneer function Box__Routine (which is used in the implementation of the box statement) now contains a check to prevent calling the @set_cursor opcode with negative co-ordinates.

  • The veneer functions RA__Pr(), RL__Pr() and CP__Tab() are now correct for Z-code V3.

  • 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.

  • Invalid expressions like (a++ b), (a ~b), (a++ ~b), and (a++ --b) previously caused an internal compiler error, but now produce a sensible error message.

  • When computing abbreviations, the space character is now correctly treated as only occupying one byte, not four.

  • The argument supplied to the Z-machine opcode @jump is now interpreted correctly. Previously this was only done properly for the jump statement, not the opcode.

Inform 6.41

22 Jul 06:24
Compare
Choose a tag to compare

Inform 6.41 was released on 22nd July 2022.

Features added

  • The dead code elimination logic now allows forward jumps to labels that would be otherwise unreachable, like this:
  if (condition) {
    jump MiddleLabel;
  }
  if (0) {
    while (condition) {
      ...
    .MiddleLabel;
      ...
    }
  }
  • The error that occurs when the compiler encounters a jump to an unknown label now includes the name of that label.

Inform 6.40

16 Jul 06:10
Compare
Choose a tag to compare

Inform 6.40 was released on 15th July 2022.

Features added

  • The various command line arguments that produce tracing or statistical information have been consolidated in a new argument: $!TRACEOPT or $!TRACEOPT=N. The Unix-style equivalent is --trace TRACEOPT or --trace TRACEOPT=N. You can also use $! by itself (or --helptrace) to list all available trace options. Trace option names are case-insensitive.

    The optional N is always an integer. 0 always means off, 1 is the base level, 2 or more may increase verbosity. As a general rule, setting N 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.)

    Four trace settings can be changed in mid-compile with the Trace directive. (This has always been true but now it is handled consistently.) Trace assembly, Trace expressions, Trace tokens and Trace linker are equivalent to --trace asm, --trace expr, --trace tokens and --trace linker, respectively. As with the command-line versions, you can optionally specify 0 to turn off that setting or 2 or more for more verbosity.

    Four more trace directives do an immediate information dump: Trace dictionary, Trace objects, Trace symbols and Trace verbs. The command-line equivalents --trace dict, --trace objects, --trace symbols and --trace verbs do the same at the end of compilation.

    The following single-letter options have been removed and replaced with trace options:

    • -j: Replaced by --trace OBJECTS
    • -m: Replaced by --trace MEM
    • -n: Replaced by --trace PROPS (for property information) and --trace ACTIONS (for action numbers)
    • -p: Replaced by --trace MAP=2
    • -t: Replaced by --trace ASM=2
    • -y: Replaced by --trace LINKER

    The following single-letter options still exist, but are now aliases for trace options:

    • -a: Same as --trace ASM
    • -f: Same as --trace FREQ
    • -g: Same as --trace RUNTIME
    • -s: Same as --trace STATS
    • -z: Same as --trace MAP

    The following single-letter options have been removed entirely:

    • -b: Has not done anything since at least Inform 5.
    • -l: Was supposed to list all statements compiled, but it was never implemented.
    • -o: Showed the same information as -z or --trace MAP.

    The -l option did show include files being opened; this is now a separate trace setting, --trace FILES.

    Some of the information that used to be under -a4 is now a separate trace setting, --trace BPATCH.

  • The -u option now just outputs computed abbreviations. If you want the verbose calculation information that it used to print, use --trace FINDABBREVS or --trace FINDABBREVS=2.

  • The compiler is now capable of dead code elimination, allowing it to:

    • Discard unreachable opcodes and strings.
    • Minimize generated code for dead branches (if (0), if (1)).
    • Detect if and switch statements where every branch returns.
    • Detect loops that never exit (or always return).
    • Discard @jz constant opcodes where the constant is non-zero.
    • Convert @jz 0 to an unconditional @jump.
    • Discard a @jump to the very next instruction.
    • Discard store opcodes when computing a logical expression as a value, if one case (0 or 1) is impossible.
    • Fold expressions like (0 && expr) and (1 || expr), even when expr is not a constant.

    When statements that can never be reached are eliminated, a warning is produced, where appropriate.

    Dead code elimination does mean that theoretically possible (though very odd) valid code will now result in a compilation error. For example,

  if (DOSTUFF) {
    while (condition) {
      ...
    .MiddleLabel;
      ...
    }
  }
  jump MiddleLabel; ! error

This will fail with a compilation error if DOSTUFF is defined as a constant zero. This optimization can be turned off by setting the compiler setting $STRIP_UNREACHABLE_LABELS to zero (its default is one).

  • There are now further warnings if the compiler detects that the type used in certain expressions is not correct:

    • X(), indirect(X): X must be a routine
    • X.Y, X.&Y, X.#Y: X must be a class or an object; Y must be a property (the Y checks already existed)
    • X.Y(): X must be a class, object, string or routine; Y must be a property
    • X.Y++, X.Y--, ++X.Y, --X.Y: X must be a class or an object; Y must be a property
  • There is a new syntax for dynamic-string interpolations: "@(N)". The original syntax was "@NN", which is still supported. In the new syntax "N" can be a number, or an already defined numeric constant. As a result of this, under Glulx the limit on $MAX_DYNAMIC_STRINGS being less than 100 has been removed.

  • The constants #dictionary_table and #grammar_table are now available when compiling to Z-code, as well as Glulx.

  • The command line switch to display percentages (-p) now works with Glulx, and acts as an extension to the -z switch.

  • The double precision floating point related opcodes added to the Glulx 3.1.3 specification (that is, @numtod, @dtonumz, @dtonumn, @ftod, @dtof, @dceil, @dfloor, @dadd, @dsub, @dmul, @ddiv, @dmodr, @dmodq, @dsqrt, @dexp, @dlog, @dpow, @dsin, @dcos, @dtan, @dasin, @dacos, @datan, @datan2, @jdeq, @jdne, @jdlt, @jdle, @jdgt, @jdge, @jdisnan, @jdisinf) are now supported. In addition there are also two new macros @dload and @dstore, to load and store double precision floating point values.

  • The undo related opcodes added to the Glulx 3.1.3 specification (that is, @hasundo and @discardundo) are now supported.

  • The Version and Switches 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 !% comments at the top of the source file.

  • 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 -M and -U command line options have been removed, along with the +module_path option. The Link and Import directives now just produce errors.

  • The ability to use temporary files for internal storage (the -F switch and the +temporary_path option) have been removed.

  • The = sign in the Global directive is now optional, just as it is in the Constant directive. So all of these are now legal:

  Constant c1 11;
  Constant c2 = 22;
  Global g1 33;
  Global g2 = 44;
  • The long deprecated forms of the Global directive that could define arrays have been removed. All these are now no longer legal:
  Global array --> size;
  Global array data ...;
  Global array initial ...;
  Global array initstr ...;

Bugs fixed

  • Abbreviation directives now only add abbreviations to the output file if economy mode (-e) is set.

  • An array overrun when the $ZCODE_LESS_DICT_DATA setting is enabled has been fixed.

  • The logic that allows a test for the compiler version of the form #IfDef VN_1640 now requires what follows the "VN_" to be a number.

Inform 6.36

25 Jan 09:49
Compare
Choose a tag to compare

Inform 6.36 was released on 25th January 2022.

Features added

  • The algorithm used to apply abbreviations for Z-code has been replaced with a more efficient dynamic programming algorithm, based on the paper by R.A. Wagner "Common phrases and minimum-space text storage", Communications of the ACM, 16 (3) (1973).

  • Inform has been refactored to use dynamic memory allocation rather than fixed size buffers. As a result, the following settings are now removed: if the available space is filled, Inform will allocate more memory without requiring user intervention.

    • ALLOC_CHUNK_SIZE
    • SYMBOLS_CHUNK_SIZE
    • MAX_ABBREVS (removed only for Glulx)
    • MAX_ACTIONS
    • MAX_ADJECTIVES
    • MAX_ARRAYS
    • MAX_CLASSES
    • MAX_DICT_ENTRIES
    • MAX_EXPRESSION_NODES
    • MAX_GLOBAL_VARIABLES
    • MAX_INCLUSION_DEPTH
    • MAX_INDIV_PROP_TABLE_SIZE
    • MAX_LABELS
    • MAX_LINESPACE
    • MAX_LINK_DATA_SIZE
    • MAX_LOCAL_VARIABLES (now a constant)
    • MAX_LOW_STRINGS
    • MAX_NUM_STATIC_STRINGS
    • MAX_OBJ_PROP_COUNT
    • MAX_OBJ_PROP_TABLE_SIZE
    • MAX_OBJECTS
    • MAX_PROP_TABLE_SIZE
    • MAX_QTEXT_SIZE
    • MAX_SOURCE_FILES
    • MAX_STATIC_DATA
    • MAX_STATIC_STRINGS
    • MAX_SYMBOLS
    • MAX_TRANSCRIPT_SIZE
    • MAX_UNICODE_CHARS
    • MAX_VERBS
    • MAX_VERBSPACE
    • MAX_ZCODE_SIZE

    As a result of this, the memory size command line arguments ($SMALL, $LARGE and $HUGE) are now redundant, and have been removed.

  • It is now possible to declare an individual property with the Property directive:

    Property individual propname;
    
  • A new setting $ZCODE_LESS_DICT_DATA has been introduced. When set to a non-zero value, this tells the compiler to omit the last byte of Z-code dictionary entries (which can be referred as #dict_par3), as this is commonly unused.

  • There are now warnings if the compiler detects that the type used in certain expressions is not correct. This only checks expressions that contain defined symbols, and does not change the generated code. The checks are:

    • remove O: O is an object
    • move O to P: O is an object; P is an object or a class
    • give O A: O is an object; A is an attribute
    • O has/hasnt A: O is an object; A is an attribute
    • O in/notin P: O is an object; P is an object or a class
    • X ofclass C: C is a class
    • X provides P: P is a property
    • X.P, X.P(), X.&P, X.#P: P is a property
  • Assembly output (-a mode) now shows symbolic information for each assembly operand, if possible.

  • The -u switch now generates $MAX_ABBREVS possible abbreviations.

  • The Trace verbs directive now prints out the entire grammar table.

  • Using the -D switch when the game or library does not support debug_flag now produces an explanatory warning:

    DEBUG mode is on, but this story or library does not appear to support it
    
  • Expressions of the form (x <= y or z) or (x >= y or z) now produce a warning message: while their effect is documented, well defined, and is not being changed, it is not necessarily what a user might expect.

  • The check for whether an abbreviation actually reduces the size of the Z-code output file has been made more accurate, and the message if an abbreviation does not reduce the size is now a warning, rather than an error.

Bugs fixed

  • For Glulx, stub functions (and the veneer function Symb__Tab()) are now always compiled as local-argument functions (with a type byte of 0xC1). Previously, they were in some cases compiled as stack-argument functions (with a type byte of 0xC0).

  • Counts of properties in errors and in the statistics report (output with the -s switch) are now consistent, and reflect how many properties the user can define.

  • The check that there are not too many common properties defined now correctly excludes individual and alias properties.

  • Inform will now report an error if the "class" line of a class definition mentions the class being defined.

  • A crash when compiling a malformed array declaration has been fixed.

Inform 6.35

22 May 06:14
Compare
Choose a tag to compare

Inform 6.35 was released on 22th May 2021.

Features added

  • Some Unix-style command line options are now supported, primarily to avoid the use of $ in command lines (although the old syntax is still supported). The new syntax for these options is:

    --help
    --path PATH=dir
    --addpath PATH=dir
    --list
    --size huge, --size large, --size small
    --helpopt SETTING
    --opt SETTING=number
    --config filename
    
  • Numeric constants can be declared as command line options, either like a setting:

    $#SYMBOL
    $#SYMBOL=NUM
    

    Or as a new Unix-style command line option:

    --define SYMBOL
    --define SYMBOL=NUM
    

    This defines SYMBOL as a constant, just like the Constant directive. Like that directive, if no value is supplied, it defaults to zero.

  • The settings $MAX_ABBREVS and MAX_DYNAMIC_STRINGS control the number of abbreviations and the number of dynamic strings, respectively. When compiling to Z-code these settings are linked, as they both use the same 96 Z-code abbreviations that are available.

  • The setting $TRANSCRIPT_FORMAT controls the output format of the -r option. The default is still the same format as before, (and can be explicitly selected with $TRANSCRIPT_FORMAT=0), but $TRANSCRIPT_FORMAT=1 enables the new, more informative and machine-readable format.

  • The Origsource directive, added in version 6.34, is now used in error reporting, regardless of the error format selected. (Previously it only appeared with the default error message format, E0.)

  • If an attempt is made to redefine an existing symbol, there is now a clearer error message, explaining what the error is and where the symbol was previously defined.

  • -g3 is now a valid option: it enables tracing for all routines, including the veneer. This functionality was added back in Inform 6.21, but the code to check the actual option was omitted.

  • Using the option -k (which turns on the generation of debugging information) no longer implies -D (which turns on debug mode).

Bugs fixed

  • Only the following directives are now allowed in a function or object definition: all others give an error:

    #ifv3
    #ifv5
    #ifdef
    #ifndef
    #iftrue
    #iffalse
    #ifnot
    #endif
    #message
    #origsource
    #trace
    
  • An #ifdef statement at the start of a switch block now compiles correctly, and no longer gives a spurious error.

  • The following, incorrect forms of array declaration now generate an error:

    Array foo --> 'dictword';
    Array foo --> FunctionName;
    Array foo --> [];
    
  • If a common property array overflows when compiling to Z-code version 3, the object is no longer corrupted.

  • The incorrect code

    Object foo with name 'x';
    

    now correctly causes the warning

    'name' property should only contain dictionary words
    

    when compiled to either Glulx or Z-code: previously the warning only appeared when compiling to Z-code.

  • The compiler now correctly handles #If directives around if and else clauses.

  • Forward declared properties (that is, properties that are used before they are defined in the game source code) now work correctly.

  • Where directives allow a constant to be used (Release, Version, Dictionary, Iftrue and Iffalse), the compiler now reports an error if the constant is not defined.

  • When compiling to Z-code version 3, dictionary words are now correctly truncated at 6 Z-characters (instead of 9).

  • When compiling to Z-code version 3, two dictionary words that differed only in Z-characters 7-9 would lead to two identical dictionary entries: now there will only be one entry.

Inform 6.34

25 May 13:26
Compare
Choose a tag to compare

Inform 6.34 was released on 25th May 2020.

Features added

  • The following system constants are now supported for Glulx: #highest_class_number, #highest_object_number, #lowest_attribute_number, #lowest_action_number, #lowest_routine_number, #lowest_array_number, #lowest_constant_number, #lowest_class_number, #lowest_object_number, and #lowest_property_number.

  • Unicode characters can now be included in Glulx word arrays as literals, e.g.

    Array text1 table "A @{1c4} A";
    Array text2 --> "A @oef A";
    
  • For Glulx, high-plane Unicode characters in the range $100000 to $10FFFF are supported in UTF-8 source code, and in @{...} sequences, which can now contain up to six hex digits.

  • The new command line switch -V simply prints the version and date of the compiler and then exits.

  • The new setting $SERIAL sets the six digit serial number written into the header of the game, e.g.

    $SERIAL=160305
    
  • It has always been possible to replace the paths used by the compiler with a command line option of the form +include_path=foo. It is now possible to add to an existing path without replacing it by using an additional '+' character, like so: ++include_path=foo.

  • The Replace directive can now be applied to routines in any file, whether it has the System_file directive or not. Replace also now works on recursive functions, which it previously did not. Its behavior can now be described this way:

    Replace Func;
    Replace Func OriginalFunc;
    
  • Multiple definitions of Func() may follow this directive. Func will refer to the last-defined version, except that definitions in normal files are preferred over definitions in System_file files or the veneer. With the two-symbol form (introduced in 6.33), the latter symbol will refer to the first-defined version of the function.

  • A new Origsource directive has been added to allow a record of the location of the relevant in a higher-level language that has been converted to Inform 6. (In practice, this will very likely be the location in an Inform 7 source.) The syntax is

    Origsource <file>
    Origsource <file> <line>
    Origsource <file> <line> <char>
    Origsource
    

    The first three forms declare that all following lines are derived from the named Inform 7 source file (with an optional line number and character number). This will be reported in error messages and in debug output. The declaration holds through the next Origsource directive (but does not apply to included files). The fourth form, with no arguments, clears the declaration. Unlike the Include directive, Origsource does not open the named file or even verify that it exists. The filename is treated as an opaque string.

  • The constant $INDIV_PROP_START is now a setting that can be changed for Glulx.

  • Arrays that are never modified can be declared as "static": in Z-code, this places the array at the end of readable memory (after the dictionary and before the beginning of code storage); in Glulx, it places the array at the end of ROM (after string storage). The syntax is

    Array arrayname static --> 1 3 5 7 9 11 13 15;
    

Bugs fixed

  • It is no longer possible to cause values to be pushed onto the stack but not then pulled by evaluating a logical expression but not assigning or using the result of that expression.

  • Replacing a recursive function now works correctly.

  • The output for the $list command line argument now includes the value of the $MAX_ARRAYS setting.

  • Memory settings can no longer overflow if set to very large values. These values are limited to a maximum of 999999999: setting them higher just results in a warning.

  • The debugging output file now contains the correct function addresses even when the compiler has been told to omit unused functions.

  • Invalid statements with empty parentheses (like return ();) now generate a sensible error.

  • Crashes caused by over-long identifiers have been fixed. Note that as a result, the previously allowed (although undocumented) use of strings or dictionary words in an action-based (implicit) switch statement now causes an error.

  • The object table is now always generated at an even Z-Machine address, as the logic in the veneer routine RA__Pr() requires this.

  • The F and u options are now explicitly disallowed with the Switches directive.

  • Assigning values to system functions now leads to an error message, rather than a crash.

  • Crashes due to over-long abbreviations have been fixed.

  • Representing the at symbol '@' by @{0040} now works when compiling to Glulx.

  • The USE_TEMPORARY_FILES option no longer has a bug that led to files being closed more than once.

  • The platform-specific definitions in header.h for Unix have been cleaned up: "UNIX64" has been removed, since it was identical to "UNIX"; and "UNIX" no longer implies "USE_TEMPORARY_FILES".

  • The platform-specific definitions in header.h for the Macintosh have been cleaned up: "MACINTOSH" is now "MAC_CLASSIC"; "OSX" is now "MACOS", and "MACOS" now uses "HUGE_SIZE" for the default array sizes.

  • The maximum length of a verb is now limited to 120 (which can be changed in the source code). Previously very long verbs would crash the compiler.

  • Compiling to Z-code version 3 has shown a number of regressions since Inform 6.15:

    • Diverted actions, of the form <<ACTION>>, are fixed.
    • The veneer routine RA__Pr() can be used.

Inform 6.33

01 Oct 05:04
Compare
Choose a tag to compare

Inform 6.33 was released on 13th May 2014.

Features added

  • Unused routines can now be detected and omitted from the compiled game, through two new settings. If $WARN_UNUSED_ROUTINES is set to 1, unused routines (other than those in the Inform library) are reported during compilation; if it is set to 2, unused routines anywhere, even in the library, are reported. If $OMIT_UNUSED_ROUTINES is set to 1, unused routines are omitted.

  • A new command line switch -Cu can be used to specify that the source file character set is UTF-8, allowing source files to contain Unicode characters beyond those defined in ISO 8859-1 to 8859-9.

  • A new #Undef directive will cause a previously defined constant to become undefined.

  • #Ifdef directives are now allowed within an object declaration.

  • Action statements can have an optional extra ‘actor’ argument, allowing action statements of the form

    <Take pie, orc>; ! simple form
    <<Look, floyd>>; ! auto-returning form
    

    Note that this also requires a library change to be useful.

  • A previously declared routine can be renamed with a new form of the Replace directive. For example, if a source file contained

    Replace Banner OriginalBanner;
    

    It could then (after including the library) contain this definion of a function:

    [ Banner;
      OriginalBanner();
      print "Extra version info!^";
    ];
    

    The library's banner code would then be in OriginalBanner().

  • The previously deprecated Dictionary directive can now have the following forms:

    Dictionary 'word';
    Dictionary 'word' val1;
    Dictionary 'word' val1 val3;
    

    The first of these forms just adds the word to the dictionary, with all flags set to zero, if it is not already in the dictionary. The second form also sets the dict_par1 flag to the given value, or bitwise-or’s the value in if the word already exists. The third form also sets the dict_par3 in the same way as for dict_par1.

    The values can be numeric literals or constants. They can be 0-255 for Z-code, or 0-65535 for Glulx.

  • The “font on” and “font off” statements now call the @set_font opcode for Z-code V5 and higher.

  • The Glulx version of the Unsigned__Compare() veneer routine has been changed to a more efficient implementation, using Glulx’s unsigned comparison opcodes.

  • The debugging output file, generated when the -k is used, has been changed to a new, XML-based format.

  • Two new Z-code settings have been added to support the extra words in the header extension table specified in section 11.1.7 of the Z-Machine Standards Document version 1.1. $ZCODE_HEADER_EXT_WORDS specifies how many extra words to add (so for all three words defined in the 1.1 standard, this would be set to 3). $ZCODE_HEADER_FLAGS_3 specifies the value to put in the first of these three words, which is the "flags3" field.

  • A new Glulx setting $GLULX_OBJECT_EXT_BYTES has been added, which specifies an amount of additional space to add to each object record. The default is 0.

Bugs fixed

  • Function calls of the form f(g)(h) (that is, where f() returns the address of a function that is called with h as its argument) are now compiled correctly: previously, such calls were compiled as if the code was f(g(h)).

  • The bounds checking related to internal arrays that are are sized from various compiler settings has been improved, so that it should not be possible to crash the compiler if these settings are too small. In addition, a start has been made on allowing the compiler to grow its internal buffers, rather than relying on these settings to specify sufficient buffer sizes.

  • The error message shown when too many global variables are declared now tells the user to increase the $MAX_GLOBAL_VARIABLES setting.

  • The setting $MAX_CLASS_TABLE_SIZE, which was not used anywhere, has been removed.

  • The compiler no longer crashes if run with the -k switch and passed a source file containing no routines at all.

  • Floating-point constants in “#Ifdef TARGET_GLULX;” sections do not now cause an error when compiling to Z-code.

  • The error message produced if an action routine is not found for an action name has been improved to include the action name, and a sensible line number.

  • The compiler is now better at not producing spurious additional errors after it has encountered a directive that contains an error.

  • The compiler no longer crashes when reporting errors after line 65,535 in long Inform 6 source files.

  • The compiler now reports a meaningful text compression rate when outputting statistics for Glulx with the -Gs switches.

  • An error is now reported if a source file ends with an unterminated object definition.

  • The three argument form of the read statement no longer assumes that the routine passed as the third argument to the statement will not change the global variable that the statement uses internally.

  • The 'Abbreviate' statement now works with words containing non-English characters.

  • Attempting to use @pop opcode for V5 or higher no longer results in a crash.

  • The Glulx setting $NUM_ATTR_BYTES, which determines the number of bytes in an object set aside for attribute flags, now works correctly. Note that this has required a change to the veneer routines that conflicts with the definition of FUNC_2_CP__Tab() in the ‘Accelerated Functions’ section of the Glulx 3.1.2 specification. If you change this setting, you should take great care if you also use the Glulx accelerated functions feature (as Inform 7 does by default).

  • The syntax of declaring a function so that it prints its name and arguments:

    [ Whatever * x y;
      ! Whatever function logic ...
    ];
    

    is now supported for Glulx.

  • The statistics produced by the -s compiler switch are now correct for Glulx.

Inform 6.32

01 Oct 05:27
Compare
Choose a tag to compare

Inform 6.32 was released on 24th December 2010.

Features added

  • The Z-machine opcodes for pushing and pulling values from the stack are @push and @pull, used like this:

    @push x;
    @pull x;
    

    However for Glulx the opcode syntax is different: instead the @copy opcode is used:

    @copy x sp;
    @copy sp x;
    

    The compiler now supports the @push and @pull syntax under Glulx as an alias for @copy, allowing the same code to be used for both the Z-machine and Glulx.

  • Custom Glulx opcodes (such as opcodes that post-date the compiler) can now be specified with the custom opcode syntax. The format of this syntax is

    @"FlagsCount:Code"
    

    Flags (which are optional) can include “S” for store, “SS” for two stores, “B” for branch format, or “R” if execution never continues after the opcode. Count is the number of arguments (currently limited to 0-9), and Code is a decimal integer representing the opcode number.

    For example, @"S3:123" is the syntax for a three-argument opcode (load, load, store) whose opcode number in decimal is 123, and @"2:234" is the syntax for a two-argument opcode (load, load) whose number is 234.

  • When compiling to Glulx, the Glulx format version number of the resulting story file is usually determined by which Glulx opcodes are used in the source code. This version number can now be over-ridden by providing a -v command line argument after the -G switch to select Glulx mode. For example, the arguments -G -v3.1.0 set the Glulx version number to “3.1.0”.

  • The Unicode related opcode added to the Glulx 3.0.0 specification, @streamunichar, is now supported.

  • When compiling to Glulx, characters outside of the ISO 8859-1 range can now be used in strings. The maximum number of such characters allowed is determined by a new memory setting, $MAX_UNICODE_CHARS.

  • When compiling to Glulx, the syntax

    print (char) value;
    

    now works for values greater than 255, printing the appropriate Unicode character. (For such values @streamunichar is used; for those less than or equal to 255, @streamchar is used as before.)

  • The memory heap related opcodes added to the Glulx 3.1.0 specification (that is, @mzero, @mcopy, @malloc and @mfree) are now supported.

  • The acceleration related opcodes added to the Glulx 3.1.1 specification (that is, @accelfunc and @accelparam) are now supported. There is also a new syntax to get the address of a global variable var, with the expression “#g$var”: this is provided so that such addresses can be provided to the @accelparam opcode.

  • The floating point related opcodes added to the Glulx 3.1.2 specification (that is, @numtof, @ftonumz, @ftonumn, @ceil, @floor, @fadd, @fsub, @fmul, @fdiv, @fmod, @sqrt, @exp, @log, @pow, @sin, @cos, @tan, @asin, @acos, @atan, @atan2, @jfeq, @jfne, @jflt, @jfle, @jfgt, @jfge, @jisnan and @jisinf) are now supported.

  • Floating point constants can be used in the Inform source code. Thes constants are expressed in the form “$+1.0e+1”: that is, a dollar sign, followed by a plus or minus sign, followed by a floating point number, and then optionally a positive or negative integer exponent. Inform does not attempt anything other than converting these constants to their 32-bit integer representation: there is no constant folding as there is with integers, so the expression “$+1.0 + $+1.0” is not meaningful, and does not produce the floating point value “2.0”.

    As an example of the use of these constants, the following adds together 100 and 123.45:

    @fadd $+100 $+1.2345e+2 result;
    

    The compiler also defines the constants “FLOAT_INFINITY”, “FLOAT_NINFINITY” and “FLOAT_NAN” for positive infinity, negative infinity and “not a number”, respectively.

  • Glulx has a simple memory extension feature, where the game’s header declares the memory space to be larger than the game file. The extra space is filled out with zeroes when the game starts. This is now supported by a new option $MEMORY_MAP_EXTENSION. This defaults to 0: if it is redefined to a larger value then the size of the game’s memory space is extended by that amount.

  • The number of verbs allowed by the compiler when compiling to Glulx is no longer limited to fewer than 256. As part of producing the game file, the compiler creates a dictionary table that contains verb numbers. However, despite in Glulx there being space for a verb number between 0 and 65535 in this table, only one byte of it (that is, values between 0 and 255) was used. This has been fixed.

    However, this also requires library changes to be useful, as the library makes use of this dictionary table. The library used by Inform 7 has been adjusted to take advantage of this, but the Inform 6/11 library has not.

  • The dictionary of Glulx games can now contain characters outside of ISO 8859-1. There is a new memory setting, $DICT_CHAR_SIZE: by default this is 1, but setting it to 4 causes the compiler to create a dictionary containing 32-bit Unicode characters.

    However, this also requires library changes to be useful, as the library makes use of this dictionary table.

Bugs fixed

  • Strict mode is no longer enabled by default when generating V3 and V4 Z-code files, as strict mode makes use of opcodes that are V5+ only.

  • The base unit of Inform’s internal memory allocation for various structures (for example the buffer used to hold the generated code) is no longer fixed: it is now controlled by a setting $ALLOC_CHUNK_SIZE. This allows, for example, the maximum Glulx code size to be greater than 640Kb.

  • When compiling to Glulx, the stack size of the resulting story file is no longer fixed at 4096: it can be changed by the setting $MAX_STACK_SIZE.

  • The compiler could crash if the size of the grammar table exceeded the size of the Z-machine readable memory: this is now fixed.

  • Creating a Z-code game file with precisely 64Kb of readable memory produced an invalid file. This is now prevented, so that the largest readable memory size is 64Kb minus 2 bytes.

  • Previously, under Glulx the print_to_array() function could be called with either two arguments, specifying both the array to print to and its length, or just one argument, the later matching what is allowed when compiling to Z-code. This one argument form has now been withdrawn under Glulx as a security hole, and a source to problems with writing beyond the end of the array: now the array length must be specified. (See also Features available only in Glulx.)

  • Veneer routines are no longer excluded from Inform’s assembly output (which is accessed with the -a command line switch).

  • For Linux and other Unix variants the default memory settings have been increased, which should remove the need to change the compiler settings when building large projects on these platforms.

  • For Mac OS X, the maximum length of a file path is now 8192 characters, which should prevent any further problems with long paths on this platform.

Inform 6.31

03 Oct 05:22
Compare
Choose a tag to compare

Inform 6.31 was released on 10th February 2006.

Bugs fixed

  • When individual properties are read (successfully), there is no longer a futile attempt to look up the property index in the common property table.

  • Complex if statements, of the form if (x == 1 or 3 or 5 ... or 99), now don’t crash the compiler.

  • The compiler is better at handling lengthy path names.

  • Backpatching and other strange errors no longer occur if the code size of a V8 game exceeds 256K.

  • An Object or Class definition with more than 32 common property values now doesn’t cause an internal compiler error.

Inform 6.30

03 Oct 05:14
Compare
Choose a tag to compare

Inform 6.30 was released on 28th February 2004.

Features added

  • The compiler automatically defines a WORDSIZE constant, whose value is 2 when compiling for the Z-machine, and 4 when the target is Glulx. The constant specifies the number of bytes in a VM word, and we recommend that you use it in the small number of circumstances where this value is significant. The compiler also defines a constant TARGET_GLULX if you supply the -G switch, or TARGET_ZCODE otherwise; in both cases the constant value is 0. For more information on the use of these constants, see Support for Glulx.

  • The Switches directive, which enables certain compiler switches to be set from within the source file rather than on the compiler command line, has been superseded by a more powerful mechanism. The special comment characters “!%”, occurring on the very first line or lines of the source file, enable you to specify Inform Command Language (ICL) commands to control the compilation. For example:

    !% -E1G                                    ! Glulx, 'Microsoft' errors 
    !% -~S                                     ! disable Strict mode 
    !% +include_path=./test,./,../lib/contrib  ! look in 'test' library 
    !% $MAX_STATIC_MEMORY=20000 
    Constant STORY "RUINS"; 
    ...
    
  • ICL is described in §39 of the Inform Designer’s Manual. In brief: each line specifies a single command, starting with “-” to define one or more switches, “+” to define a path variable, or “$” to define a memory setting. Comments are introduced by “!”. The ICL command “compile” is not permitted at the head of a source file.

  • Two new ICL memory settings are available; both of these could previously be changed only by rebuilding the compiler. $MAX_SOURCE_FILES has a default of 256, and $MAX_INCLUSION_DEPTH has a default value of 5.

  • A new directive, similar to Array ... string and Array ... table, is provided:

    Array array buffer N; 
    Array array buffer expr1 expr2 ... exprN; 
    Array array buffer "string";
    

    This creates a hybrid array of the form used by string.print_to_array() and the new library routine PrintToBuffer(), in which the first word array-->0 contains N and the following N bytes array->WORDSIZE, array->(WORDSIZE+1) ... array->(WORDSIZE+N-1) contain the specified expression values or string characters.

  • A new (A) print rule — similar to the existing (The) — prints an object’s indirect article with its first letter capitalised. The printed article is “A” or “An” by default, or else taken from the object’s article property.

  • The minimum size of the Z-code header extension table can be set using the command line switch -Wn. For example, -W6 makes the table at least six words long.

  • Source code in character sets other than ISO 8859-1 to 8859-9 is now supported, provided that the character set can be mapped onto one of the ISO 8859 sets.

    A mapping file is used to define how the source code is to be processed. This file consists of a directive indicating the ISO 8859 set to be mapped to, followed by 256 numbers giving the mapping. As an example, under Microsoft Windows, Russian text is encoded with the character set defined as Microsoft code page 1251. The following text defines a mapping to the ISO 8859-5 set:

    ! Windows Cyrillic (code page 1251) to ISO 8859-5
    C5
      0, 63, 63, 63, 63, 63, 63, 63, 63, 32, 10, 63, 10, 10, 63, 63 
     63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63 
     32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47 
     48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63 
     64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79 
     80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95 
     96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111 
    112,113,114,115,116,117,118,119,120,121,122,123,124,125,126, 63 
    162,163, 44,243, 34, 46, 63, 63, 63, 63,169, 60,170,172,171,175 
    242, 39, 39, 34, 34, 46, 45, 45,152, 84,249, 62,250,252,251,255 
     32,174,254,168, 36, 63,124,253,161, 67,164, 60, 63, 45, 82,167 
     63, 63,166,246, 63, 63, 63, 46,241,240,244, 62,248,165,245,247 
    176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191 
    192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207 
    208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223 
    224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239 
    

    Lines starting with “!” are treated as comments. The next line, beginning with “C”, defines the ISO set to map to in the same way as the -Cn command line switch.

    To use the mapping, Inform treats each character in the source file as a number between 0 and 255, and uses that number as an index into the mapping table. For example, suppose that the character read in from a Russian Windows text file is the Cyrillic small letter “ya”.This character is represented in the Russian Windows character set by the number 255. Inform takes the 255th entry in the mapping, which is 239. Therefore the character is regarded as being 239 in ISO 8859-5.

    The name of the mapping file is specified by a new compiler path variable +charset_map. If the above mapping is held in a text file win1251.map, a Russian game could be compiled with a command line of the form:

    inform +charset_map=win1251.map +language_name=Russian mygame.inf
    
  • The @check_unicode and @print_unicode opcodes, introduced in the Z-Machine Standards Document version 1.0, can now be called by name rather than by using the clumsier generic syntax @"EXT:11S" and @"EXT:12S". For example:

    @print_unicode $0401; ! Cyrillic capital letter IO
    
  • Strict mode (which compiles run-time integrity checks into your game) has been decoupled from Debug mode (which defines debugging verbs like TRACE and SHOWOBJ). This means that it’s no longer necessary to turn off Strict checking (in order to disable the Debug verbs) before releasing a game, though of course you can do so if you wish to save space and increase performance. By default, Strict mode is enabled (turn it off with -~S) and Debug mode is disabled (turn it on with -D).

  • The compiler now issues a warning if you use array->n on an array of words, or array-->n on an array of bytes. Use the new Array ... buffer directive to create a hybrid array which can be accessed without these warnings.

  • The compiler also issues a warning if you refer to an unqualified property name within a routine, for example by typing (number==0) when you intended (self.number==0).

  • Another new warning appears if you include something other than a dictionary word in an object’s name property. This is most commonly triggered if you try to add a single-letter word by typing name 'g' 'string' when you intended name 'g//' 'string'.

Bugs fixed

  • A problem with multiple assignment involving pointer arithmetic in Strict mode giving the wrong answer has been fixed.

  • After using Extend only to separate off an element of an existing Verb definition, new synonyms for the separated verb now work correctly; previously they were applied to the residue of the original definition.

  • Strict mode now tests for the use of @put_prop or @get_prop opcodes when a common property is longer than two bytes — the Z-Machine Standards Document says that this is illegal, and that the result is unspecified. The error message is of the form “[** Programming error: obj (object number N) has a property prop, but it is longer than 2 bytes so you cannot use "." to read **]”. This means that you have used the obj.prop construct in the situation where prop is a common property containing two or more values; typically prop is being explicitly used as an array, or it’s an additive property and both obj and its parent class have defined values for it. The problem does not occur if prop is an individual property.

  • Handling of European quotes is (finally) correct: the “«” symbol is produced by any of @<<, @@163 and @{00AB}, while any of @>>, @@162 and @{00BB} produce the matching “»”. Note, however, that this problem originated in an error in the previous version of the Z-Machine Standards Document, and therefore older interpreters written to that specification, or more recent ones adjusted to work with the incorrect fix introduced at Inform 6.12, may still not give the correct results.

  • The “no such constant” compilation error message now quotes the number of the appropriate source line.

  • The metaclass() and ZRoutine() routines no longer report large unsigned values — above the game’s Static memory area — as of type String. More usefully, the constant NULL (-1) is not reported as a String.

  • Complex expressions combining a routine call and the ofclass and or operators no longer generate incorrect code.

  • Negative constants in assembly operations — for example, @set_colour 4 (-1); — no longer cause the compiler to report an unexpected expression.

  • Various problems with handling ISO 8859 characters in the range 128-255, and also in the use of @@ escape sequences, have been resolved.

  • An Abbreviate directive containing a substring of “” may crash the compiler; hopefully, no more.

  • The 320Kb size limit placed by Inform on v6 and v7 games has been raised to 512Kb.

  • Following a Zcharacter directive replacing the entire alphabet table, dictionary entries are no longer corrupted.

  • The compiler now generates conditional branches spanning up to 63 bytes, lifting the previous unnecessary limit of a 31-byte span and leading to slightly shorter code.

  • Putting an object in itself doesn’t now loop indefinitely.

  • Various problems with the @store, @inc_chk, @dec_chk, @not and @je opcodes have been resolved.

  • Problems with nested conditional compilation directives #...

Read more