~ubuntu-branches/ubuntu/vivid/inform/vivid

« back to all changes in this revision

Viewing changes to html/section5.html

  • Committer: Bazaar Package Importer
  • Author(s): Jan Christoph Nordholz
  • Date: 2008-05-26 22:09:44 UTC
  • mfrom: (2.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080526220944-ba7phz0d1k4vo7wx
Tags: 6.31.1+dfsg-1
* Remove a considerable number of files from the package
  due to unacceptable licensing terms.
* Repair library symlinks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<HTML><HEAD><TITLE>Section 5: Compiler options and memory settings</TITLE></HEAD>
2
 
<BODY BGCOLOR="#FFFFFF">
3
 
<TABLE><P>
4
 
<TR><TD Valign="top"><A HREF="contents.html">Contents</A><BR><A HREF="section4.html">Back</A><BR><A HREF="section6.html">Forward</A><TD bgcolor="#F5DEB3"><BLOCKQUOTE><H3>5. Compiler options and memory settings</H3></BLOCKQUOTE><TR><TD><TD>
5
 
It is time to give a full list of the "switches'', which are the
6
 
main way to make choices about how Inform will operate.  (This list
7
 
can always be printed out with the <TT>-h2</TT> switch.)
8
 
<PRE>
9
 
  a   trace assembly-language (without hex dumps; see -t)
10
 
  c   more concise error messages
11
 
  d   contract double spaces after full stops in text
12
 
  d2  contract double spaces after exclamation and question marks, too
13
 
  e   economy mode (slower): make use of declared abbreviations
14
 
  f   frequencies mode: show how useful abbreviations are
15
 
  g   traces calls to functions (except in the library)
16
 
  g2  traces calls to all functions
17
 
  h   print this information
18
 
  i   ignore default switches set within the file
19
 
  j   list objects as constructed
20
 
  k   output Infix debugging information to "gamedebug"
21
 
  l   list every statement run through Inform
22
 
  m   say how much memory has been allocated
23
 
  n   print numbers of properties, attributes and actions
24
 
  o   print offset addresses
25
 
  p   give percentage breakdown of story file
26
 
  q   keep quiet about obsolete usages
27
 
  r   record all the text to "gametext"
28
 
  s   give statistics
29
 
  t   trace assembly-language (with full hex dumps; see -a)
30
 
  u   work out most useful abbreviations (very very slowly)
31
 
  v3  compile to version-3 (Standard) story file
32
 
  v4  compile to version-4 (Plus) story file
33
 
  v5  compile to version-5 (Advanced) story file
34
 
  v6  compile to version-6 (graphical) story file
35
 
  v7  compile to version-7 (*) story file
36
 
  v8  compile to version-8 (*) story file
37
 
      (*) formats for very large games, requiring
38
 
          slightly modified game interpreters to play
39
 
  w   disable warning messages
40
 
  x   print # for every 100 lines compiled
41
 
  y   trace linking system
42
 
  z   print memory map of the Z-machine
43
 
  D   insert "Constant DEBUG;" automatically
44
 
  E0  Archimedes-style error messages (current setting)
45
 
  E1  Microsoft-style error messages
46
 
  E2  Macintosh MPW-style error messages
47
 
  F1  use temporary files to reduce memory consumption
48
 
  M   compile as a Module for future linking
49
 
  R0  use filetype 060 + version number for games (default)
50
 
  R1  use official Acorn filetype 11A for all games
51
 
  T   enable throwback of errors in the DDE
52
 
  U   insert "Constant USE_MODULES;" automatically
53
 
</PRE>
54
 
 
55
 
Note that the list may vary slightly from machine to machine:
56
 
<TT>R0</TT>, <TT>R1</TT> and <TT>T</TT> above are for Acorn RISC OS machines only,
57
 
for example.
58
 
<P>
59
 
 
60
 
<P><TR><TD Valign="top"><IMG SRC="icons/dbend.gif" ALT="/\"><TD bgcolor="#EEEEEE"><SMALL>
61
 
Note that these switches can also be selected by putting a <TT>Switches</TT>
62
 
directive, such as <TT>Switches xdv8s;</TT> right at the start of the source
63
 
code.
64
 
</SMALL>
65
 
<TR><TD><TD><P>
66
 
 
67
 
Only two switches have a really drastic effect:
68
 
<P>
69
 
<P>
70
 
 
71
 
 <TT>M</TT><SAMP>            </SAMP> Makes Inform compile a "module'', not a "game''.
72
 
See <A HREF="section4.html">Section 4</A>.3.
73
 
<P>
74
 
<P>
75
 
 
76
 
 <TT>v</TT><SAMP>            </SAMP> Chooses the format of the game to be compiled.
77
 
<TT>v5</TT> is the default, but if a game begins to overflow this, try <TT>v8</TT>.
78
 
(The other settings are intended mainly for maintainers of Infocom
79
 
interpreters to test their wares.)
80
 
<P>
81
 
 
82
 
<P>
83
 
 <TT>i</TT><SAMP>            </SAMP> Overrides any switches set by <TT>switches</TT> directives in
84
 
the source code; so that the game can be compiled with different options
85
 
without having to alter that source code.
86
 
<P>
87
 
<P>
88
 
 
89
 
Many of the remaining switches make Inform produce text as it runs,
90
 
without affecting the actual compilation:
91
 
<P>
92
 
<P>
93
 
 
94
 
 <TT>a l m n t y</TT><SAMP>            </SAMP> Tracing options to help with maintaining
95
 
Inform, or for debugging assembly language
96
 
programs.
97
 
 
98
 
<P>
99
 
 
100
 
 <TT>o p s z</TT><SAMP>            </SAMP> To print out information about the final game file:
101
 
the <TT>s</TT> (statistics) option is particularly useful to keep track of how
102
 
large the game is growing.
103
 
<P>
104
 
 
105
 
 <TT>c w q E T</TT><SAMP>            </SAMP> In <TT>c</TT> mode, Inform does not quote whole source lines
106
 
together with error messages; in <TT>w</TT> mode it suppresses warnings; in <TT>T</TT>
107
 
mode, which is only present on RISC OS machines, error throwback
108
 
will occur in the 'Desktop Development Environment'.  <TT>q</TT> causes
109
 
"this usage is obsolete'' warnings to be suppressed, which may
110
 
be useful when compiling very long, very old programs.  Finally, <TT>E</TT> is
111
 
provided since different error formats fit in better with debugging tools
112
 
on different machines.
113
 
<P>
114
 
 
115
 
 <TT>f</TT><SAMP>            </SAMP> Indicates roughly how many bytes the abbreviations saved.
116
 
<P>
117
 
 
118
 
 <TT>h</TT><SAMP>            </SAMP> Prints out the help information.
119
 
<P>
120
 
 
121
 
 <TT>j x</TT><SAMP>            </SAMP> Makes Inform print out steady text to prove that it's
122
 
still awake: on very slow machines this may be a convenience.
123
 
<P>
124
 
 
125
 
 <TT>k</TT><SAMP>            </SAMP> Writes a "debugging information'' file for the use of
126
 
the Infix debugger (the filename will be something suitable for
127
 
your machine).
128
 
<P>
129
 
 
130
 
 <TT>r</TT><SAMP>            </SAMP> Intended to help with proof-reading the text of a game:
131
 
transcribes all of the text in double-quotes to the given file (whose
132
 
filename will be something suitable for your machine).
133
 
<P>
134
 
 
135
 
 <TT>u</TT><SAMP>            </SAMP> Tries to work out a good set of abbreviations to
136
 
declare for your game, but <I> extremely slowly</I> (a matter of hours) and
137
 
<I> consuming very much memory</I> (perhaps a megabyte).
138
 
<P>
139
 
 
140
 
<P>
141
 
 <TT>D U</TT><SAMP>            </SAMP> When these switches are set, the constants
142
 
<TT>DEBUG</TT> (which make the Library add the debugging suite to a game)
143
 
and <TT>USE_MODULES</TT> (which speeds up compilation by linking in the Library
144
 
rather than recompiling it) are automatically defined.  This is just a
145
 
convenience: it's a nuisance to keep adding and removing source code
146
 
lines to do the same thing.
147
 
<P>
148
 
 
149
 
<P>
150
 
This leaves three more switches which actually alter the game file which
151
 
Inform would compile:
152
 
<P>
153
 
 <TT>d</TT><SAMP>            </SAMP> Converts text like
154
 
<PRE>
155
 
"...with a mango.  You applaud..."
156
 
</PRE>
157
 
 
158
 
into the same with only a single space after the full stop, which will
159
 
prevent an interpreter from displaying a spurious space at the beginning
160
 
of a line when a line break happens to occur exactly after the full stop;
161
 
this is to help typists who habitually double-space.  Stepping up to <TT>-d2</TT>
162
 
also contracts double spaces after question or exclamation
163
 
marks.
164
 
<P>
165
 
 
166
 
 <TT>e</TT><SAMP>            </SAMP> Only in 'economy' mode does Inform actually process
167
 
abbreviations, because this is seldom needed and slows the compiler by
168
 
10% or so; the game file should not play any differently if compiled
169
 
this way, but will probably be shorter, if your choice of abbreviations
170
 
was sensible.
171
 
<P>
172
 
 
173
 
 <TT>g</TT><SAMP>            </SAMP> Makes Inform automatically compile trace-printing
174
 
code on every function call; in play this will produce reams of text (several
175
 
pages between each chance to type commands) but is sometimes useful.  Note
176
 
that in Inform 5.3 or later, this can be set on an individual command by
177
 
writing <TT>*</TT> as its first local variable, without use of the <TT>g</TT>
178
 
switch.
179
 
<P>
180
 
 
181
 
<P><TR><TD Valign="top"><IMG SRC="icons/dbend.gif" ALT="/\"><TD bgcolor="#EEEEEE"><SMALL>
182
 
There are two directives for setting switches, to be used if there's
183
 
no other convenient way on your system (for example if you have a poor
184
 
windowed front end and no command line to type on).  These are:
185
 
<BLOCKQUOTE>
186
 
<TT>Switches </TT><I><B>&#60;some settings&#62;</B></I><TT>;</TT><BR>
187
 
<TT>Version </TT><I><B>&#60;number&#62;</B></I><TT>;</TT><BR>
188
 
</BLOCKQUOTE>
189
 
 
190
 
These can only be used as first lines in the program and are illegal once
191
 
other directives or routines have been given.  Note that
192
 
<PRE>
193
 
Version 6;
194
 
</PRE>
195
 
 
196
 
(for instance) is redundant, as it is equivalent to
197
 
<PRE>
198
 
Switches v6;
199
 
</PRE>
200
 
</SMALL>
201
 
<TR><TD><TD><P>
202
 
 
203
 
<P>
204
 
<P><TR><TD Valign="top"><IMG SRC="icons/dbend.gif" ALT="/\"><TD bgcolor="#EEEEEE"><SMALL>
205
 
Inform's memory management is very flexible, but sometimes needs attention
206
 
from the user, rather than being able to tinker with itself automatically.
207
 
This is unfortunate but Inform has to run in some quite hostile
208
 
environments and is obliged to be cautious.
209
 
</SMALL>
210
 
<TR><TD><TD><P>
211
 
 
212
 
<TR><TD><TD bgcolor="#EEEEEE"><SMALL>
213
 
In particular, it is unable to increase the size of any stretch of memory
214
 
once allocated, so if it runs out of anything it has to give up.  If it
215
 
does run out, it will produce an error message saying what it has run out of
216
 
and how to provide more.
217
 
<P>
218
 
 
219
 
There are three main choices: <TT>$small</TT>, <TT>$large</TT> and <TT>$huge</TT>.  (Which one is
220
 
the default depends on the computer you use.)  Even <TT>$small</TT> is large enough
221
 
to compile all the example games, including 'Advent'.  <TT>$large</TT> compiles
222
 
almost anything and <TT>$huge</TT> has been used only for 'Curses' and
223
 
'Jigsaw' in their most advanced states, and even they hardly need it.
224
 
A typical game, compiled with <TT>$large</TT>, will cause Inform to allocate about
225
 
350K of memory: and the same game about 100K less under <TT>$small</TT>.  (These
226
 
values will be rather lower if the computer Inform runs on has 16-bit
227
 
integers.)  In addition, Inform physically occupies about 210K (on my
228
 
computer).  Thus, the total memory consumption of the compiler at work
229
 
will be about 500K.
230
 
 
231
 
<P>
232
 
 
233
 
Running
234
 
<PRE>
235
 
    inform $list
236
 
</PRE>
237
 
 
238
 
 
239
 
will list the various settings which can be changed, and their current
240
 
values.  Thus one can compare small and large with:
241
 
<PRE>
242
 
    inform $small $list
243
 
    inform $large $list
244
 
</PRE>
245
 
 
246
 
If Inform runs out of allocation for something, it will generally print an
247
 
error message like:
248
 
<PRE>
249
 
   "Game", line 1320: Fatal error: The memory setting MAX_OBJECTS (which
250
 
   is 200 at present) has been exceeded.  Try running Inform again with
251
 
   $MAX_OBJECTS=&#60;some-larger-number&#62; on the command line.
252
 
</PRE>
253
 
 
254
 
and indeed
255
 
<PRE>
256
 
    inform $MAX_OBJECTS=250 game
257
 
</PRE>
258
 
 
259
 
(say) will tell Inform to try again, reserving more memory for objects this
260
 
time.  Note that settings are made from left to right, so that for instance
261
 
<PRE>
262
 
    inform $small $MAX_ACTIONS=200 ...
263
 
</PRE>
264
 
 
265
 
will work, but
266
 
<PRE>
267
 
    inform $MAX_ACTIONS=200 $small ...
268
 
</PRE>
269
 
 
270
 
will not because the <TT>$small</TT> changes <TT>MAX_ACTIONS</TT> again.
271
 
Changing some settings has hardly any effect on memory usage, whereas others
272
 
are expensive to increase.  To find out about, say, <TT>MAX_VERBS</TT>, run
273
 
<PRE>
274
 
    inform $?MAX_VERBS
275
 
</PRE>
276
 
 
277
 
(note the question mark) which will print some very brief comments.
278
 
Users of Unix, where <TT>$</TT> and <TT>?</TT> are special shell characters, will need
279
 
to type
280
 
<PRE>
281
 
    inform '$?list'         inform '$?MAX_VERBS'
282
 
</PRE>
283
 
 
284
 
and so on.
285
 
</SMALL><TR><TD><TD>
286
 
</TABLE>
287
 
<HR><A HREF="contents.html">Contents</A> / <A HREF="section4.html">Back</A> / <A HREF="section6.html">Forward</A> <BR>
288
 
<A HREF="chapter1.html">Chapter I</A> / <A HREF="chapter2.html">Chapter II</A> / <A HREF="chapter3.html">Chapter III</A> / <A HREF="chapter4.html">Chapter IV</A> / <A HREF="chapter5.html">Chapter V</A> / <A HREF="chapter6.html">Chapter VI</A> / <A HREF="chapterA.html">Appendix</A><HR><SMALL><I>Mechanically translated to HTML from third edition as revised 16 May 1997. Copyright &#169; Graham Nelson 1993, 1994, 1995, 1996, 1997: all rights reserved.</I></SMALL></BODY></HTML>