RAIF FAQ > Programming IF > 4.5: What is Glk?

4.5: What is Glk?

It is a standard for text-based I/O, designed by Andrew "zarf" Plotkin. Complete information can be found at <http://www.eblong.com/zarf/glk/>.

Here is a brief description of it, plagiarized from LucFrench and Zarf's descriptions on raif:

GLK is a spec for porting Input/Output code across platforms. In order to understand why it's necessary, one must understand a bit about I/O.

A Unix machine has a different way of printing to the screen than a Mac, since one is primarily text based, and the other is a graphical windowing enviroment. As such, they have two *very* different ways of outputting data, particularly for some of the special effects that many high level IF systems need (e.g., a status line, picture, color, etc.).

So, porting the I/O can be difficult. What Glk attempts to do is specify a set of calls to the Glk system that allows for easy porting across multiple platforms.

The Glk calls are intended to be not only portable, but to be *easily* portable: abstracted in such a way that they give the interpreter maximum flexibility. This allows interpreters on different platforms to take advantage of particular UI features.

A port of Dungeon, a scripting language, interpreters for the major IF languages, and a few demos have been ported to Glk. If you are writing an IF interpreter or similar program, consider using Glk. It'll make everyone happy.


RAIF FAQ > Programming IF > 4.5: What is Glk?