Section 5: Compiler options and memory settings

Contents Back Forward | ### 5. Compiler options and memory settings
| It is time to give a full list of the "switches'', which are the main way to make choices about how Inform will operate. (This list can always be printed out with the `-h2` switch.)
      a   trace assembly-language (without hex dumps; see -t)
      c   more concise error messages
      d   contract double spaces after full stops in text
      d2  contract double spaces after exclamation and question marks, too
      e   economy mode (slower): make use of declared abbreviations
      f   frequencies mode: show how useful abbreviations are
      g   traces calls to functions (except in the library)
      g2  traces calls to all functions
      h   print this information
      i   ignore default switches set within the file
      j   list objects as constructed
      k   output Infix debugging information to "gamedebug"
      l   list every statement run through Inform
      m   say how much memory has been allocated
      n   print numbers of properties, attributes and actions
      o   print offset addresses
      p   give percentage breakdown of story file
      q   keep quiet about obsolete usages
      r   record all the text to "gametext"
      s   give statistics
      t   trace assembly-language (with full hex dumps; see -a)
      u   work out most useful abbreviations (very very slowly)
      v3  compile to version-3 (Standard) story file
      v4  compile to version-4 (Plus) story file
      v5  compile to version-5 (Advanced) story file
      v6  compile to version-6 (graphical) story file
      v7  compile to version-7 (*) story file
      v8  compile to version-8 (*) story file
          (*) formats for very large games, requiring
              slightly modified game interpreters to play
      w   disable warning messages
      x   print # for every 100 lines compiled
      y   trace linking system
      z   print memory map of the Z-machine
      D   insert "Constant DEBUG;" automatically
      E0  Archimedes-style error messages (current setting)
      E1  Microsoft-style error messages
      E2  Macintosh MPW-style error messages
      F1  use temporary files to reduce memory consumption
      M   compile as a Module for future linking
      R0  use filetype 060 + version number for games (default)
      R1  use official Acorn filetype 11A for all games
      T   enable throwback of errors in the DDE
      U   insert "Constant USE_MODULES;" automatically
Note that the list may vary slightly from machine to machine: `R0`, `R1` and `T` above are for Acorn RISC OS machines only, for example.
| Note that these switches can also be selected by putting a `Switches` directive, such as `Switches xdv8s;` right at the start of the source code.
| Only two switches have a really drastic effect: `M``` Makes Inform compile a "module'', not a "game''. See Section 4.3. `v``` Chooses the format of the game to be compiled. `v5` is the default, but if a game begins to overflow this, try `v8`. (The other settings are intended mainly for maintainers of Infocom interpreters to test their wares.) `i``` Overrides any switches set by `switches` directives in the source code; so that the game can be compiled with different options without having to alter that source code. Many of the remaining switches make Inform produce text as it runs, without affecting the actual compilation: `a l m n t y``` Tracing options to help with maintaining Inform, or for debugging assembly language programs. `o p s z``` To print out information about the final game file: the `s` (statistics) option is particularly useful to keep track of how large the game is growing. `c w q E T``` In `c` mode, Inform does not quote whole source lines together with error messages; in `w` mode it suppresses warnings; in `T` mode, which is only present on RISC OS machines, error throwback will occur in the 'Desktop Development Environment'. `q` causes "this usage is obsolete'' warnings to be suppressed, which may be useful when compiling very long, very old programs. Finally, `E` is provided since different error formats fit in better with debugging tools on different machines. `f``` Indicates roughly how many bytes the abbreviations saved. `h``` Prints out the help information. `j x``` Makes Inform print out steady text to prove that it's still awake: on very slow machines this may be a convenience. `k``` Writes a "debugging information'' file for the use of the Infix debugger (the filename will be something suitable for your machine). `r``` Intended to help with proof-reading the text of a game: transcribes all of the text in double-quotes to the given file (whose filename will be something suitable for your machine). `u``` Tries to work out a good set of abbreviations to declare for your game, but extremely slowly (a matter of hours) and consuming very much memory (perhaps a megabyte). `D U``` When these switches are set, the constants `DEBUG` (which make the Library add the debugging suite to a game) and `USE_MODULES` (which speeds up compilation by linking in the Library rather than recompiling it) are automatically defined. This is just a convenience: it's a nuisance to keep adding and removing source code lines to do the same thing. This leaves three more switches which actually alter the game file which Inform would compile: `d``` Converts text like
    "...with a mango.  You applaud..."
into the same with only a single space after the full stop, which will prevent an interpreter from displaying a spurious space at the beginning of a line when a line break happens to occur exactly after the full stop; this is to help typists who habitually double-space. Stepping up to `-d2` also contracts double spaces after question or exclamation marks. `e``` Only in 'economy' mode does Inform actually process abbreviations, because this is seldom needed and slows the compiler by 10% or so; the game file should not play any differently if compiled this way, but will probably be shorter, if your choice of abbreviations was sensible. `g``` Makes Inform automatically compile trace-printing code on every function call; in play this will produce reams of text (several pages between each chance to type commands) but is sometimes useful. Note that in Inform 5.3 or later, this can be set on an individual command by writing `*` as its first local variable, without use of the `g` switch.
| There are two directives for setting switches, to be used if there's no other convenient way on your system (for example if you have a poor windowed front end and no command line to type on). These are: `Switches` <some settings>`;` `Version` <number>`;` These can only be used as first lines in the program and are illegal once other directives or routines have been given. Note that
    Version 6;
(for instance) is redundant, as it is equivalent to
    Switches v6;
| Inform's memory management is very flexible, but sometimes needs attention from the user, rather than being able to tinker with itself automatically. This is unfortunate but Inform has to run in some quite hostile environments and is obliged to be cautious.
| In particular, it is unable to increase the size of any stretch of memory once allocated, so if it runs out of anything it has to give up. If it does run out, it will produce an error message saying what it has run out of and how to provide more. There are three main choices: `$small`, `$large` and `$huge`. (Which one is the default depends on the computer you use.) Even `$small` is large enough to compile all the example games, including 'Advent'. `$large` compiles almost anything and `$huge` has been used only for 'Curses' and 'Jigsaw' in their most advanced states, and even they hardly need it. A typical game, compiled with `$large`, will cause Inform to allocate about 350K of memory: and the same game about 100K less under `$small`. (These values will be rather lower if the computer Inform runs on has 16-bit integers.) In addition, Inform physically occupies about 210K (on my computer). Thus, the total memory consumption of the compiler at work will be about 500K. Running
        inform $list
will list the various settings which can be changed, and their current values. Thus one can compare small and large with:
        inform $small $list
        inform $large $list
If Inform runs out of allocation for something, it will generally print an error message like:
       "Game", line 1320: Fatal error: The memory setting MAX_OBJECTS (which
       is 200 at present) has been exceeded.  Try running Inform again with
       $MAX_OBJECTS=<some-larger-number> on the command line.
and indeed
        inform $MAX_OBJECTS=250 game
(say) will tell Inform to try again, reserving more memory for objects this time. Note that settings are made from left to right, so that for instance
        inform $small $MAX_ACTIONS=200 ...
will work, but
        inform $MAX_ACTIONS=200 $small ...
will not because the `$small` changes `MAX_ACTIONS` again. Changing some settings has hardly any effect on memory usage, whereas others are expensive to increase. To find out about, say, `MAX_VERBS`, run
        inform $?MAX_VERBS
(note the question mark) which will print some very brief comments. Users of Unix, where `$` and `?` are special shell characters, will need to type
        inform '$?list'         inform '$?MAX_VERBS'
and so on.

Contents / Back / Forward
Chapter I / Chapter II / Chapter III / Chapter IV / Chapter V / Chapter VI / Appendix

Mechanically translated to HTML from third edition as revised 16 May 1997. Copyright © Graham Nelson 1993, 1994, 1995, 1996, 1997: all rights reserved.