Glulx Definitions by Dannii Willis

(For Glulx Only)   Version 1.2

Core definitions which other Glulx/Glk extensions depend on


Chapter 1: Testing interpreter features (gestalts)


This extension is a low level utility library containing core defintions for the Glulx and Glk systems.

This extension is released under the Creative Commons Attribution licence. Bug reports, feature requests or questions should be made at <https://github.com/i7/extensions/issues>.

Chapter 1: Testing interpreter features (gestalts)

We can test whether the player's interpreter supports various multimedia features using the following phrases:

Table of interpreter functions
the glulx version     (a number) the version of the Glulx standard the interpreter implements
the glk version     (a number) the version of the Glk standard the interpreter implements
the interpreter version     (a number) the interpreter's own version number
if glulx memory resizing is supported
if glulx undo is supported
if glulx memory copying is supported
if glulx malloc is supported
if glulx function acceleration is supported
if glulx real numbers are supported
if glk/glulx character input is supported
if glk/glulx line input is supported
if glk/glulx mouse input is supported     whether any clicks at all can be detected
if glk/glulx graphic-window mouse input is supported
if glk/glulx text-grid mouse input is supported
if glk/glulx timekeeping is supported     whether the Glk timer can be set for one-off or periodic events
if glk/glulx graphics are/is supported     whether any graphics at all are supported
if glk/glulx text-buffer graphics are/is supported
if glk/glulx graphic-window graphics are/is supported
if glk/glulx basic sounds are supported     whether any sounds can be played
if glk/glulx sound volume is supported     whether the volume can be controlled
if glk/glulx sound notification is supported     whether an event will be raised when a sound finishes playing
if glk/glulx hyperlinks are supported
if glk/glulx hyperlink input is supported
if glk/glulx mod sound is supported     whether mod sounds can be played
if glk/glulx PNG transparency is supported     whether it is possible to layer PNG images with transparent alpha channels
if glk/glulx unicode is supported
if glk/glulx unicode normalization is supported
if glk/glulx line input echo suppression is supported
if glk/glulx line input terminators are supported
if the glk/glulx system clock is supported     whether the current time can be obtained
if glk/glulx sounds are fully supported
if glk/glulx resource streams are supported
if glk/glulx graphics window character input is supported     whether character input is supported in graphics windows

You can test these at the start of play to warn the player if their interpreter does not support something your story uses. It is highly recommended that you also test them each time you use one of these features, because the player may have restored a savefile in a different interpreter, and what used to be supported may not be any longer.