Inform 7: The Program

Inform 7

Build 5Z71

Graham Nelson

Inform 7 PDF
(450pp, 1024KB)

The core compiler in a natural-language design system for interactive fiction.

Artistic License 2.0




Appendix B: The Template Layer  (450pp, 1024KB)  

PDF  

The template organises the I6 code generated by Inform, fleshes it out with a large amount of standard material (similar to the content of the traditional I6 library, which I7 doesn't use), and also controls the sequence of operations followed during compilation.

Introduction.i6t  (B/introt: 5pp, 81KB)

File (227 lines) 

PDF (5pp, 81KB) 

A short introduction to the template and its organisation.

Main.i6t  (B/maint: 5pp, 67KB)

File (191 lines) 

PDF (5pp, 67KB) 

The top-level logic of NI: the sequence of operations followed by NI up to the point where the output file is opened, resuming after it is closed again.

Types.i6t  (B/typet: 14pp, 73KB)

File (702 lines) 

PDF (14pp, 73KB) 

To set up the atomic kinds of value (the base data types, in other words) within NI.

Output.i6t  (B/outt: 12pp, 103KB)

File (753 lines) 

PDF (12pp, 103KB) 

This is the superstructure of the file of I6 code output by NI: from ICL commands at the top down to the signing-off comments at the bottom.

Definitions.i6t  (B/defnt: 14pp, 118KB)

File (795 lines) 

PDF (14pp, 118KB) 

Miscellaneous constant definitions, usually providing symbolic names for otherwise inscrutable numbers, which are used throughout the template layer.

OrderOfPlay.i6t  (B/ordt: 11pp, 111KB)

File (689 lines) 

PDF (11pp, 111KB) 

The sequence of events in play: the Main routine which runs the startup rulebook, the turn sequence rulebook and the shutdown rulebook; and most of the I6 definitions of primitive rules in those rulebooks.

Actions.i6t  (B/actt: 14pp, 96KB)

File (769 lines) 

PDF (14pp, 96KB) 

To try actions by people in the model world, processing the necessary rulebooks.

Activities.i6t  (B/acvt: 3pp, 58KB)

File (168 lines) 

PDF (3pp, 58KB) 

To run the necessary rulebooks to carry out an activity.

Rulebooks.i6t  (B/rbt: 8pp, 88KB)

File (475 lines) 

PDF (8pp, 88KB) 

To work through the rules in a rulebook until a decision is made.

Parser.i6t  (B/parst: 68pp, 210KB)

File (3892 lines) 

PDF (68pp, 210KB) 

The parser for turning the text of the typed command into a proposed action by the player.

ListWriter.i6t  (B/lwt: 15pp, 117KB)

File (875 lines) 

PDF (15pp, 117KB) 

A flexible object-lister taking care of plurals, inventory information, various formats and so on.

OutOfWorld.i6t  (B/oowt: 3pp, 53KB)

File (137 lines) 

PDF (3pp, 53KB) 

To implement some of the out of world actions.

WorldModel.i6t  (B/wmt: 12pp, 94KB)

File (667 lines) 

PDF (12pp, 94KB) 

Testing and changing the fundamental spatial relations.

Light.i6t  (B/light: 7pp, 76KB)

File (350 lines) 

PDF (7pp, 76KB) 

The determination of light, visibility and physical access.

Tests.i6t  (B/testt: 9pp, 73KB)

File (467 lines) 

PDF (9pp, 73KB) 

The command grammar and I6 implementation for testing commands such as TEST, ACTIONS and PURLOIN.

Language.i6t  (B/langt: 18pp, 89KB)

File (971 lines) 

PDF (18pp, 89KB) 

The fundamental definitions needed by the parser and the verb library in order to specify the language of play -- that is, the language used for communications between the story file and the player.

MStack.i6t  (B/stackt: 5pp, 72KB)

File (216 lines) 

PDF (5pp, 72KB) 

To allocate space on the memory stack for frames of variables to be used by rulebooks, activities and actions.

Chronology.i6t  (B/chrt: 5pp, 76KB)

File (287 lines) 

PDF (5pp, 76KB) 

To record information now which will be needed later, when a condition phrased in the perfect tense is tested.

Printing.i6t  (B/print: 13pp, 101KB)

File (755 lines) 

PDF (13pp, 101KB) 

To manage the line skips which space paragraphs out, and to handle the printing of names of objects, pieces of text and numbers.

RTP.i6t  (B/rtpt: 8pp, 80KB)

File (417 lines) 

PDF (8pp, 80KB) 

To issue run-time problem messages, and to perform some run-time type checking which may issue such messages.

Utilities.i6t  (B/utilt: 3pp, 71KB)

File (176 lines) 

PDF (3pp, 71KB) 

Miscellaneous utility routines for some fundamental I6 needs.

Number.i6t  (B/numt: 2pp, 51KB)

File (80 lines) 

PDF (2pp, 51KB) 

Support for parsing integers.

Time.i6t  (B/timet: 5pp, 69KB)

File (251 lines) 

PDF (5pp, 69KB) 

Support for parsing and printing times of day.

Tables.i6t  (B/tabt: 16pp, 104KB)

File (900 lines) 

PDF (16pp, 104KB) 

To read, write, search and allocate rows in the Table data structure.

Sort.i6t  (B/sortt: 4pp, 67KB)

File (234 lines) 

PDF (4pp, 67KB) 

To sort arrays.

Relations.i6t  (B/relt: 17pp, 124KB)

File (962 lines) 

PDF (17pp, 124KB) 

To manage run-time storage for relations between objects, and to find routes through relations and the map.

Figures.i6t  (B/figst: 1pp, 47KB)

File (41 lines) 

PDF (1pp, 47KB) 

To display figures and play sound effects.

IndexedText.i6t  (B/inxt: 16pp, 96KB)

File (845 lines) 

PDF (16pp, 96KB) 

Code to support the indexed text kind of value.

RegExp.i6t  (B/regxt: 32pp, 126KB)

File (1788 lines) 

PDF (32pp, 126KB) 

Code to match and replace on regular expressions against indexed text strings.

Char.i6t  (B/chart: 3pp, 52KB)

File (141 lines) 

PDF (3pp, 52KB) 

To decide whether letters are upper or lower case, and convert between the two.

UnicodeData.i6t  (B/unict: 3pp, 56KB)

File (160 lines) 

PDF (3pp, 56KB) 

To tabulate casings in the character set.

StoredAction.i6t  (B/stact: 6pp, 74KB)

File (309 lines) 

PDF (6pp, 74KB) 

Code to support the stored action kind of value.

Lists.i6t  (B/listt: 14pp, 97KB)

File (774 lines) 

PDF (14pp, 97KB) 

Code to support the list of... kind of value constructor.

BlockValues.i6t  (B/blkvt: 6pp, 81KB)

File (369 lines) 

PDF (6pp, 81KB) 

Routines for copying, comparing, creating and destroying block values, and for reading and writing them as if they were arrays.

Flex.i6t  (B/flext: 12pp, 109KB)

File (696 lines) 

PDF (12pp, 109KB) 

To allocate flexible-sized blocks of memory as needed to hold arbitrary-length strings of text, stored actions or other block values.

ZMachine.i6t  (B/zmt: 15pp, 101KB)

File (826 lines) 

PDF (15pp, 101KB) 

To provide routines handling low-level Z-machine facilities.

Glulx.i6t  (B/glut: 38pp, 133KB)

File (2129 lines) 

PDF (38pp, 133KB) 

To start up the Glk interface for the Glulx virtual machine, and provide Glulx-specific printing functions.

FileIO.i6t  (B/iot: 7pp, 75KB)

File (378 lines) 

PDF (7pp, 75KB) 

Reading and writing external files, in the Glulx virtual machine only.


This is a "web", a term invented by Donald Knuth in the early 1980s for a program written according to the heavily annotated literate programming dogma. For more on "inweb", visit the Inform 7 project.