Glk Input Suspending by Gavin Lambert


This is an extremely-low-level extension intended only for people messing with Glk input events.

According to the Glk spec, it is illegal for anything to be printed to a window that is currently waiting for line or character input, However, there are certain other kinds of event (such as mouse and hyperlink events) which are very likely to occur while otherwise waiting for input (usually line input); ordinarily this means that rules that handle these events cannot print anything, on pain of getting a fatal error (or simply ignored, depending on the interpreter).

Unfortunately, that can at times be quite inconvenient, for example if you're trying to debug these rules by printing things, or if Inform randomly decides that it wants to output a paragraph break for reasons known only to itself.

This extension monitors line and character input events, allowing you to detect if they're in progress. It also allows you to cancel an event, do something else (such as printing text), and then resume the event.

(It does not presently intercept the Unicode-specific input events, but then currently the Inform library does not make use of these anyway.)

This is not invisible to the player (so do it sparingly) and outside of specific circumstances you can get the VM into trouble, so use with caution.

This extension also introduces an alternative method to replace the player's command from a Glk event than the one provided by Glulx Entry Points. This method should be preferred as the latter has been broken at some point and doesn't actually work anyway.

Further documentation is not provided; read the source. If you can't understand the source, you shouldn't be using this extension directly.

Example: * Compilation Check

This is just here to verify that this extension compiles without additional dependencies.

"Compilation Check"

Include Glk Input Suspending by Gavin Lambert.

There is a room.