Added some descriptions to documentation so Gtk-doc doesn't complain
[rodin/chimara.git] / libchimara / doc.c
index c9c6e33c936f59fb483142f6fb2bd77a8639d819..9014870371bfb2931fd505daefb57eea079d67b9 100644 (file)
  * This is how you deal with opaque objects from a C program. If you are using
  * Glk through a virtual machine, matters will probably be different. Opaque
  * objects may be represented as integers, or as VM objects of some sort.
- * </para></note>
+ * </para></note></para>
  * <refsect2 id="chimara-Rocks"><!-- Indeed it does. -->
  * <title>Rocks</title>
  * <para>
  * For each class of opaque objects, there is an iterate function, which you can
  * use to obtain a list of all existing objects of that class. It takes the form
  * |[
- * <replaceable>CLASS</replaceable>id_t glk_<replaceable>CLASS</replaceable>_iterate(<replaceable>CLASS</replaceable>id_t <parameter>obj</parameter>, #glui32 *<parameter>rockptr</parameter>);
+ * CLASSid_t glk_CLASS_iterate(CLASSid_t obj, glui32 *rockptr);
  * ]|
  * ...where <code><replaceable>CLASS</replaceable></code> represents one of the
  * opaque object classes. 
  * <para>
  * You usually use this as follows:
  * |[
- * obj = glk_<replaceable>CLASS</replaceable>_iterate(NULL, NULL);
+ * obj = glk_CLASS_iterate(NULL, NULL);
  * while (obj) {
  *    /* ...do something with obj... *<!-- -->/
- *    obj = glk_<replaceable>CLASS</replaceable>_iterate(obj, NULL);
+ *    obj = glk_CLASS_iterate(obj, NULL);
  * }
  * ]|
  * </para>
  * and Unicode input; see %gestalt_Unicode.
  */
 
+/**
+ * SECTION:glk-mouse-events
+ * @short_description: Events representing a mouse click
+ * @include: libchimara/glk.h
+ *
+ * On some platforms, Glk can recognize when the mouse (or other pointer) is 
+ * used to select a spot in a window. You can request mouse input only in text 
+ * grid windows and graphics windows.
+ * 
+ * A window can have mouse input and character/line input pending at the same
+ * time.
+ * 
+ * If the player clicks in a window which has a mouse input event pending,
+ * glk_select() will return an event whose type is %evtype_MouseInput. Again,
+ * once this happens, the request is complete, and you must request another if
+ * you want further mouse input.
+ * 
+ * In the event structure, @win tells what window the event came from.
+ * 
+ * In a text grid window, the @val1 and @val2 fields are the x and y coordinates
+ * of the character that was clicked on. 
+ * <note><para>So @val1 is the column, and @val2 is the row.</para></note>
+ * The top leftmost character is considered to be (0,0).
+ * 
+ * In a graphics window, they are the x and y coordinates of the pixel that was
+ * clicked on. Again, the top left corner of the window is (0,0).
+ * 
+ * <note><para>
+ *   Most mouse-based idioms define standard functions for mouse hits in text
+ *   windows &mdash; typically selecting or copying text. It is up to the
+ *   library to separate this from Glk mouse input. The library may choose to
+ *   select text when it is clicked normally, and cause Glk mouse events when
+ *   text is control-clicked. Or the other way around. Or it may be the
+ *   difference between clicking and double-clicking. Or the library may
+ *   reserve a particular mouse button, on a multi-button mouse. It may even
+ *   specify a keyboard key to be the "mouse button", referring to wherever the
+ *   mouse cursor is when the key is hit. Or some even more esoteric positioning
+ *   system. You need only know that the user can do it, or not.
+ * </para></note> 
+ * <note><para>
+ *   However, since different platforms will handle this issue differently, you
+ *   should be careful how you instruct the player in your program. Do not tell
+ *   the player to <quote>double-click</quote>, <quote>right-click</quote>, or
+ *   <quote>control-click</quote> in a window. The preferred term is <quote>to
+ *   touch the window</quote>, or a spot in the window.
+ * </para></note>
+ * <note><para>
+ *   Goofy, but preferred.
+ * </para></note>
+ */
+
 /**
  * SECTION:glk-timer-events
  * @short_description: Events sent at fixed intervals
  * </para></note> 
  */
 
+/**
+ * SECTION:glk-style-measure
+ * @short_description: Finding out how the library displays your style hints
+ * @include: libchimara/glk.h
+ *
+ * You can suggest the appearance of a window's style before the window is
+ * created; after the window is created, you can test the style's actual
+ * appearance. These functions do not test the style hints; they test the
+ * attribute of the style as it appears to the player.
+ *
+ * Note that although you cannot change the appearance of a window's styles
+ * after the window is created, the library can. A platform may support dynamic
+ * preferences, which allow the player to change text formatting while your
+ * program is running.
+ * <note><para>
+ *   Changes that affect window size (such as font size changes) will be
+ *   signalled by an %evtype_Arrange event. However, more subtle changes (such
+ *   as text color differences) are not signalled. If you test the appearance of
+ *   styles at the beginning of your program, you must keep in mind the
+ *   possibility that the player will change them later.
+ * </para></note>
+ */
+
 /**
  * SECTION:glk-stream-types
  * @short_description: Window, memory, and file streams
  * else.
  */
 
+/**
+ * SECTION:glk-image-resources
+ * @short_description: Graphics in Glk
+ * @include: libchimara/glk.h
+ *
+ * In accordance with this modern age, Glk provides for a modicum of graphical
+ * flair. It does not attempt to be a complete graphical toolkit. Those already
+ * exist. Glk strikes the usual uncomfortable balance between power, 
+ * portability, and ease of implementation: commands for arranging pre-supplied
+ * images on the screen and intermixed with text.
+ * 
+ * Graphics is an optional capability in Glk; not all libraries support 
+ * graphics. This should not be a surprise.
+ * 
+ * Most of the graphics commands in Glk deal with image resources. Your program
+ * does not have to worry about how images are stored. Everything is a resource,
+ * and a resource is referred to by an integer identifier. You may, for example,
+ * call a function to display image number 17. The format, loading, and 
+ * displaying of that image is entirely up to the Glk library for the platform
+ * in question.
+ * 
+ * Of course, it is also desirable to have a platform-independent way to store
+ * sounds and images. Blorb is the official resource-storage format of Glk. A
+ * Glk library does not have to understand Blorb, but it is more likely to
+ * understand Blorb than any other format.
+ *
+ * <note><para>
+ *   Glk does not specify the exact format of images, but Blorb does. Images in 
+ *   a Blorb archive must be PNG or JPEG files. More formats may be added if 
+ *   real-world experience shows it to be desirable. However, that is in the 
+ *   domain of the Blorb specification. The Glk spec, and Glk programming, will
+ *   not change.
+ * </para></note>
+ * 
+ * At present, images can only be drawn in graphics windows and text buffer 
+ * windows. In fact, a library may not implement both of these possibilities.
+ * You should test each with the %gestalt_DrawImage selector if you plan to use
+ * it. See <link linkend="chimara-Testing-for-Graphics-Capabilities">Testing for
+ * Graphics Capabilities</link>. 
+ */
+
+/**
+ * SECTION:glk-graphics-windows
+ * @short_description: Drawing graphics in graphics windows
+ * @include: libchimara/glk.h
+ *
+ * A graphics window is a rectangular canvas of pixels, upon which you can draw
+ * images. The contents are entirely under your control. You can draw as many
+ * images as you like, at any positions &mdash; overlapping if you like. If the
+ * window is resized, you are responsible for redrawing everything. See <link
+ * linkend="wintype-Graphics">Graphics Windows</link>.
+ * 
+ * <note><para>
+ *   Note that graphics windows do not support a full set of object-drawing 
+ *   commands, nor can you draw text in them. That may be available in a future 
+ *   Glk extension. For now, it seems reasonable to limit the task to a single 
+ *   primitive, the drawing of a raster image. And then there's the ability to
+ *   fill a rectangle with a solid color &mdash; a small extension, and 
+ *   hopefully no additional work for the library, since it can already clear 
+ *   with arbitrary background colors. In fact, if glk_window_fill_rect() did 
+ *   not exist, an author could invent it &mdash; by briefly setting the
+ *   background color, erasing a rectangle, and restoring.
+ * </para></note>
+ * 
+ * If you call glk_image_draw() or glk_image_draw_scaled() in a graphics window,
+ * @val1 and @val2 are interpreted as X and Y coordinates. The image will be 
+ * drawn with its upper left corner at this position.
+ * 
+ * It is legitimate for part of the image to fall outside the window; the excess
+ * is not drawn. Note that these are signed arguments, so you can draw an image
+ * which falls outside the left or top edge of the window, as well as the right
+ * or bottom.
+ * 
+ * There are a few other commands which apply to graphics windows.
+ */
+
+/**
+ * SECTION:glk-graphics-text
+ * @short_description: Drawing graphics inside or beside text
+ * @include: libchimara/glk.h
+ *
+ * A text buffer is a linear text stream. You can draw images in-line with this
+ * text. If you are familiar with HTML, you already understand this model. You
+ * draw images with flags indicating alignment. The library takes care of
+ * scrolling, resizing, and reformatting text buffer windows.
+ *
+ * If you call glk_image_draw() or glk_image_draw_scaled() in a text buffer
+ * window, @val1 gives the image alignment. The @val2 argument is currently
+ * unused, and should always be zero.
+ *
+ * The two <quote>margin</quote> alignments require some care. To allow proper 
+ * positioning, images using %imagealign_MarginLeft and %imagealign_MarginRight 
+ * must be placed at the beginning of a line. That is, you may only call 
+ * glk_image_draw() (with these two alignments) in a window, if you have just 
+ * printed a newline to the window's stream, or if the window is entirely empty.
+ * If you margin-align an image in a line where text has already appeared, no 
+ * image will appear at all.
+ * 
+ * Inline-aligned images count as <quote>text</quote> for the purpose of this 
+ * rule.
+ * 
+ * You may have images in both margins at the same time.
+ * 
+ * It is also legal to have more than one image in the same margin (left or 
+ * right.) However, this is not recommended. It is difficult to predict how text
+ * will wrap in that situation, and libraries may err on the side of 
+ * conservatism. 
+ */
+
+/**
+ * SECTION:glk-graphics-testing
+ * @short_description: Checking whether the library supports graphics
+ * @include: libchimara/glk.h
+ *
+ * Before calling Glk graphics functions, you should use the gestalt selector
+ * %gestalt_Graphics. To test for additional capabilities, you can also use the
+ * %gestalt_DrawImage and %gestalt_GraphicsTransparency selectors.
+ */
+
+/**
+ * SECTION:glk-sound-channels
+ * @short_description: Creating new sound channels and closing them
+ * @include: libchimara/glk.h
+ *
+ * Sounds in Glk are played through sound channels. Sound channels are another
+ * type of opaque object, like windows, streams, and file references.
+ */
+
+/**
+ * SECTION:glk-playing-sounds
+ * @short_description: Producing noise
+ * @include: libchimara/glk.h
+ *
+ * These functions play the actual sounds through the sound channels.
+ */
+
+/**
+ * SECTION:glk-sound-other
+ * @short_description: Miscellaneous functions for sound channels
+ * @include: libchimara/glk.h
+ *
+ * This section includes functions for sound channels that don't fit anywhere
+ * else.
+ */
+
+/**
+ * SECTION:glk-sound-testing
+ * @short_description: Checking whether the library supports sound
+ * @include: libchimara/glk.h
+ *
+ * Before calling Glk sound functions, you should use the %gestalt_Sound
+ * selector. To test for additional capabilities, you can use the 
+ * %gestalt_SoundMusic, %gestalt_SoundVolume, and %gestalt_SoundNotify 
+ * selectors.
+ */
+
+/**
+ * SECTION:glk-creating-hyperlinks
+ * @short_description: Printing text as a hyperlink
+ * @include: libchimara/glk.h
+ *
+ * Some games may wish to mark up text in their windows with hyperlinks, which
+ * can be selected by the player &mdash; most likely by mouse click. Glk allows
+ * this in a manner similar to the way text styles are set.
+ *
+ * Hyperlinks are an optional capability in Glk.
+ */
+
+/**
+ * SECTION:glk-accepting-hyperlinks
+ * @short_description: Generating and catching hyperlink navigation events
+ * @include: libchimara/glk.h
+ *
+ * When you request a hyperlink event in a window, you will receive a hyperlink
+ * event when the player clicks on a hyperlink.
+ */
+
+/**
+ * SECTION:glk-hyperlinks-testing
+ * @short_description: Checking whether the library supports hyperlinks
+ * @include: libchimara/glk.h
+ *
+ * Before calling Glk hyperlink functions, you should use the gestalt selectors
+ * %gestalt_Hyperlinks and %gestalt_HyperlinkInput.
+ */
+/**
+ * SECTION:dispatch-interrogating
+ * @short_description: Finding out what functions the Glk library exports
+ * @include: libchimara/glk.h, libchimara/gi_dispa.h
+ *
+ * These are the ancilliary functions that let you enumerate.
+ */
+/**
+ * SECTION:dispatch-dispatching
+ * @short_description: Dispatching the call to the Glk library
+ * @include: libchimara/glk.h, libchimara/gi_dispa.h
+ *
+ * The function gidispatch_call() invokes a function from the Glk library.
+ */
+/**
+ * SECTION:dispatch-prototypes
+ * @short_description: Querying Glk function prototypes
+ * @include: libchimara/glk.h, libchimara/gi_dispa.h
+ *
+ * There are many possible ways to set up a #gluniversal_t array, and it's
+ * illegal to call gidispatch_call() with an array which doesn't match the
+ * function. Furthermore, some references are passed in, some passed out, and
+ * some both. How do you know how to handle the argument list?
+ * 
+ * One possibility is to recognize each function selector, and set up the
+ * arguments appropriately. However, this entails writing special code for each
+ * Glk function; which is exactly what we don't want to do.
+ * 
+ * Instead, you can call gidispatch_prototype(). 
+ */
+
+/**
+ * SECTION:dispatch-library-functions
+ * @short_description: Platform-dependent dispatch layer functions
+ * @include: libchimara/glk.h, libchimara/gi_dispa.h
+ *
+ * Ideally, the three layers &mdash; program, dispatch layer, Glk library
+ * &mdash; would be completely modular; each would refer only to the layers
+ * beneath it. Sadly, there are a few places where the library must notify the
+ * program that something has happened. Worse, these situations are only
+ * relevant to programs which use the dispatch layer, and then only some of
+ * those.
+ * 
+ * Since C is uncomfortable with the concept of calling functions which may not
+ * exist, Glk handles this with call-back function pointers. The program can
+ * pass callbacks in to the library; if it does, the library will call them, and
+ * if not, the library doesn't try.
+ * 
+ * These callbacks are optional, in the sense that the program may or may not
+ * set them. However, any library which wants to interoperate with the dispatch
+ * layer must <emphasis>allow</emphasis> the program to set them; it is the
+ * program's choice. The library does this by implementing
+ * <code>set_registry functions</code> &mdash; the functions to which the
+ * program passes its callbacks.
+ * 
+ * <note><para>
+ *   Even though these callbacks and the functions to set them are declared in
+ *   <filename class="headerfile">gi_dispa.h</filename>, they are not defined in
+ *   <filename>gi_dispa.c</filename>. The dispatch layer merely coordinates
+ *   them. The program defines the callback functions; the library calls them.
+ * </para></note>
+ */
+
 /** 
  * SECTION:blorb-program
  * @short_description: How to use the Blorb layer in your program
  * GlkTerm. 
  *
  * When you compile a Glk program, you may define a function called 
- * glkunix_startup_code(), and an array <code>glkunix_arguments[]</code>. These
- * set up various Unix-specific options used by the Glk library. There is a
- * sample <quote><filename>glkstart.c</filename></quote> file included in this 
- * package; you should modify it to your needs.
+ * <function>glkunix_startup_code&lpar;&rpar;</function>, and an array 
+ * <code>glkunix_arguments[]</code>. These set up various Unix-specific options
+ * used by the Glk library. There is a sample 
+ * <quote><filename>glkstart.c</filename></quote> file included in this package;
+ * you should modify it to your needs.
  * 
- * |[ extern #glkunix_argumentlist_t glkunix_arguments[]; ]|
+ * |[ extern glkunix_argumentlist_t glkunix_arguments[]; ]|
  *  
  * The <code>glkunix_arguments[]</code> array is a list of command-line 
  * arguments that your program can accept. The library will sort these out of 
  * generally be limited to finding and opening data files. There are a few Unix
  * Glk library functions which are convenient for this purpose.
  */
+
+/**
+ * SECTION:glkext-garglk
+ * @short_description: Gargoyle extensions to Glk
+ * @include: libchimara/glk.h, libchimara/garglk.h
+ *
+ * This section describes various extensions to Glk that were written for the
+ * popular interpreter <ulink 
+ * url="http://www.ccxvii.net/gargoyle/">Gargoyle</ulink> by Tor Andersson (now 
+ * maintained by Ben Cressey).
+ *
+ * These functions mostly serve to close the gap between Glk's input/output
+ * capabilities and what some interpreters expect. For example, 
+ * garglk_set_zcolors() displays the colors defined in the Z-machine standard,
+ * and garglk_set_story_name() can be used to give the host program a hint
+ * about what to display in the title bar of its window.
+ */ 
  
 /*---------------- TYPES AND CONSTANTS FROM GLK.H ----------------------------*/
 
  * constants (see %gestalt_Unicode). If not, not.
  */
 
+/**
+ * GLK_MODULE_IMAGE:
+ *
+ * If you are writing a C program, there is an additional complication. A
+ * library which does not support graphics may not implement the graphics
+ * functions at all. Even if you put gestalt tests around your graphics calls,
+ * you may get link-time errors. If the <filename
+ * class="headerfile">glk.h</filename> file is so old that it does not declare
+ * the graphics functions and constants, you may even get compile-time errors.
+ *
+ * To avoid this, you can perform a preprocessor test for the existence of
+ * %GLK_MODULE_IMAGE. If this is defined, so are all the functions and constants
+ * described in this section. If not, not.
+ *
+ * <note><para>
+ *   To be extremely specific, there are two ways this can happen. If the 
+ *   <filename class="headerfile">glk.h</filename> file that comes with the
+ *   library is too old to have the graphics declarations in it, it will of
+ *   course lack %GLK_MODULE_IMAGE as well. If the <filename 
+ *   class="headerfile">glk.h</filename> file is recent, but the library is old,
+ *   the definition of %GLK_MODULE_IMAGE should be removed from <filename 
+ *   class="headerfile">glk.h</filename>, to avoid link errors. This is not a
+ *   great solution. A better one is for the library to implement the graphics
+ *   functions as stubs that do nothing (or cause run-time errors). Since no
+ *   program will call the stubs without testing %gestalt_Graphics, this is
+ *   sufficient.
+ * </para></note>
+ */
+
+/**
+ * GLK_MODULE_SOUND:
+ *
+ * If you are writing a C program, there is an additional complication. A 
+ * library which does not support sound may not implement the sound functions at
+ * all. Even if you put gestalt tests around your sound calls, you may get 
+ * link-time errors. If the <filename class="headerfile">glk.h</filename> file 
+ * is so old that it does not declare the sound functions and constants, you may
+ * even get compile-time errors.
+ * 
+ * To avoid this, you can perform a preprocessor test for the existence of
+ * %GLK_MODULE_SOUND. If this is defined, so are all the functions and constants
+ * described in this section. If not, not.
+ */ 
+/**
+ * GLK_MODULE_HYPERLINKS:
+ * 
+ * If you are writing a C program, you can perform a preprocessor test for the
+ * existence of %GLK_MODULE_HYPERLINKS. If this is defined, so are all the
+ * functions and constants described in this section. If not, not.
+ */
+
 /**
  * winid_t:
  *
  * members.
  */
 
+/**
+ * schanid_t:
+ * 
+ * Opaque structure representing a sound channel. It has no user-accessible
+ * members.
+ */
+  
 /**
  * gestalt_Version:
  *
  * For an example of the gestalt mechanism, consider the selector
  * %gestalt_Version. If you do
  * |[
- * #glui32 res;
- * res = #glk_gestalt(#gestalt_Version, 0);
+ * glui32 res;
+ * res = glk_gestalt(gestalt_Version, 0);
  * ]|
  * <code>res</code> will be set to a 32-bit number which encodes the version of
  * the Glk spec which the library implements. The upper 16 bits stores the major
  * 0x00000700.
  *
  * |[
- * #glui32 res;
- * res = #glk_gestalt_ext(#gestalt_Version, 0, NULL, 0);
+ * glui32 res;
+ * res = glk_gestalt_ext(gestalt_Version, 0, NULL, 0);
  * ]|
  * does exactly the same thing. Note that, in either case, the second argument 
  * is not used; so you should always pass 0 to avoid future surprises.
  * If you set <code>ch</code> to a character code, or a special code (from
  * 0xFFFFFFFF down), and call
  * |[
- * #glui32 res;
- * res = #glk_gestalt(#gestalt_CharInput, ch);
+ * glui32 res;
+ * res = glk_gestalt(gestalt_CharInput, ch);
  * ]|
  * then <code>res</code> will be %TRUE (1) if that character can be typed by
  * the player in character input, and %FALSE (0) if not. See <link
  *
  * If you set <code>ch</code> to a character code, and call
  * |[
- * #glui32 res;
- * res = #glk_gestalt(#gestalt_LineInput, ch);
+ * glui32 res;
+ * res = glk_gestalt(gestalt_LineInput, ch);
  * ]|
  * then <code>res</code> will be %TRUE (1) if that character can be typed by the
  * player in line input, and %FALSE (0) if not. Note that if <code>ch</code> is 
  *
  * If you set <code>ch</code> to a character code (Latin-1 or higher), and call
  * |[
- * #glui32 res, len;
- * res = #glk_gestalt_ext(#gestalt_CharOutput, ch, &amp;len, 1);
+ * glui32 res, len;
+ * res = glk_gestalt_ext(gestalt_CharOutput, ch, &amp;len, 1);
  * ]|
  * then <code>res</code> will be one of %gestalt_CharOutput_CannotPrint,
  * %gestalt_CharOutput_ExactPrint, or %gestalt_CharOutput_ApproxPrint (see 
  *   Make sure you do not get confused by signed byte values. If you set a
  *   <quote><type>char</type></quote> variable <code>ch</code> to 0xFE, the 
  *   small-thorn character (&thorn;), and then call
- *   |[ res = #glk_gestalt(#gestalt_CharOutput, ch); ]|
+ *   |[ res = glk_gestalt(gestalt_CharOutput, ch); ]|
  *   then (by the definition of C/C++) <code>ch</code> will be sign-extended to
  *   0xFFFFFFFE, which is not a legitimate character, even in Unicode. You 
  *   should write
- *   |[ res = #glk_gestalt(#gestalt_CharOutput, (unsigned char)ch); ]|
+ *   |[ res = glk_gestalt(gestalt_CharOutput, (unsigned char)ch); ]|
  *   instead.
  * </para></note>
  * <note><para>
  * character will be printed exactly as defined.
  */
 
+/**
+ * gestalt_MouseInput:
+ *
+ * You can test whether mouse input is supported with the %gestalt_MouseInput 
+ * selector.
+ * |[ res = glk_gestalt(gestalt_MouseInput, windowtype); ]|
+ * This will return %TRUE (1) if windows of the given type support mouse input.
+ * If this returns %FALSE (0), it is still legal to call
+ * glk_request_mouse_event(), but it will have no effect, and you will never get
+ * mouse events.
+ */ 
+/**
+ * gestalt_Timer:
+ *
+ * You can test whether the library supports timer events:
+ * |[ res = glk_gestalt(gestalt_Timer, 0); ]|
+ * This returns 1 if timer events are supported, and 0 if they are not.
+ */
+
+/**
+ * gestalt_Graphics:
+ * 
+ * Before calling Glk graphics functions, you should use the following gestalt
+ * selector:
+ * |[
+ * glui32 res;
+ * res = glk_gestalt(gestalt_Graphics, 0);
+ * ]|
+ * This returns 1 if the overall suite of graphics functions is available. This
+ * includes glk_image_draw(), glk_image_draw_scaled(), glk_image_get_info(),
+ * glk_window_erase_rect(), glk_window_fill_rect(),
+ * glk_window_set_background_color(), and glk_window_flow_break(). It also
+ * includes the capability to create graphics windows.
+ * 
+ * If this selector returns 0, you should not try to call these functions. They
+ * may have no effect, or they may cause a run-time error. If you try to create
+ * a graphics window, you will get %NULL. 
+ */
+
+/**
+ * gestalt_DrawImage:
+ * 
+ * This selector returns 1 if images can be drawn in windows of the given type. 
+ * If it returns 0, glk_image_draw() will fail and return %FALSE. You should 
+ * test %wintype_Graphics and %wintype_TextBuffer separately, since libraries 
+ * may implement both, neither, or only one.  
+ */
+
+/**
+ * gestalt_Sound:
+ *
+ * You can test whether the library supports sound: 
+ * |[
+ * glui32 res;
+ * res = glk_gestalt(gestalt_Sound, 0);
+ * ]|
+ * This returns 1 if the overall suite of sound functions is available. This 
+ * includes glk_schannel_create(), glk_schannel_destroy(), 
+ * glk_schannel_iterate(), glk_schannel_get_rock(), glk_schannel_play(),
+ * glk_schannel_play_ext(), glk_schannel_stop(), glk_schannel_set_volume(), and
+ * glk_sound_load_hint().
+ *
+ * If this selector returns 0, you should not try to call these functions. They 
+ * may have no effect, or they may cause a run-time error. 
+ */
+
+/**
+ * gestalt_SoundVolume:
+ *
+ * You can test whether the library supports setting the volume of sound 
+ * channels: 
+ * |[
+ * glui32 res;
+ * res = glk_gestalt(gestalt_SoundVolume, 0);
+ * ]|
+ * This selector returns 1 if the glk_schannel_set_volume() function works. If 
+ * it returns zero, glk_schannel_set_volume() has no effect.     
+ */
+
+/**
+ * gestalt_SoundNotify:
+ *
+ * You can test whether the library supports sound notification events:
+ * |[
+ * glui32 res;
+ * res = glk_gestalt(gestalt_SoundNotify, 0);
+ * ]| 
+ * This selector returns 1 if the library supports sound notification events. If
+ * it returns zero, you will never get such events. 
+ */
+
+/**
+ * gestalt_Hyperlinks:
+ *
+ * You can test whether the library supports hyperlinks:
+ * |[ 
+ * glui32 res;
+ * res = glk_gestalt(gestalt_Hyperlinks, 0); 
+ * ]|
+ * This returns 1 if the overall suite of hyperlinks functions is available.
+ * This includes glk_set_hyperlink(), glk_set_hyperlink_stream(),
+ * glk_request_hyperlink_event(), glk_cancel_hyperlink_event().
+ *
+ * If this selector returns 0, you should not try to call these functions. They
+ * may have no effect, or they may cause a run-time error.
+ */
+
+/**
+ * gestalt_HyperlinkInput:
+ *
+ * You can test whether hyperlinks are supported with the 
+ * %gestalt_HyperlinkInput selector:
+ * |[ res = glk_gestalt(gestalt_HyperlinkInput, windowtype); ]|
+ * This will return %TRUE (1) if windows of the given type support hyperlinks.
+ * If this returns %FALSE (0), it is still legal to call glk_set_hyperlink() and
+ * glk_request_hyperlink_event(), but they will have no effect, and you will
+ * never get hyperlink events.
+ */
+
+/** 
+ * gestalt_SoundMusic:
+ *
+ * You can test whether music resources are supported:
+ * |[ res = glk_gestalt(gestalt_SoundMusic, 0); ]|
+ * This returns 1 if the library is capable of playing music sound resources. If 
+ * it returns 0, only sampled sounds can be played.
+ * <note><para>
+ *   <quote>Music sound resources</quote> means MOD songs &mdash; the only music
+ *   format that Blorb currently supports. The presence of this selector is, of 
+ *   course, an ugly hack. It is a concession to the current state of the Glk 
+ *   libraries, some of which can handle AIFF but not MOD sounds.
+ * </para></note>
+ */ 
+  
+/**
+ * gestalt_GraphicsTransparency:
+ *
+ * This returns 1 if images with alpha channels can actually be drawn with the
+ * appropriate degree of transparency. If it returns 0, the alpha channel is
+ * ignored; fully transparent areas will be drawn in an implementation-defined
+ * color.
+ * <note><para>
+ *   The JPEG format does not support transparency or alpha channels; the PNG 
+ *   format does.
+ * </para></note>
+ */
+
 /**
  * gestalt_Unicode:
  *
  * the following gestalt selector:
  * |[
  * glui32 res;
- * res = #glk_gestalt(#gestalt_Unicode, 0);
+ * res = glk_gestalt(gestalt_Unicode, 0);
  * ]|
  * 
  * This returns 1 if the Unicode functions are available. If it returns 0, you
  * To avoid this, you can perform a preprocessor test for the existence of
  * #GLK_MODULE_UNICODE. 
  */
-
-/**
- * gestalt_Timer:
- *
- * You can test whether the library supports timer events:
- * |[ res = #glk_gestalt(#gestalt_Timer, 0); ]|
- * This returns 1 if timer events are supported, and 0 if they are not.
- */
  
 /**
  * evtype_None:
  * events, this is platform-dependent. See %evtype_Arrange.
  *
  * For more about redraw events and how they affect graphics windows, see <link
- * linkend="chimara-Graphics-Windows">Graphics Windows</link>.
+ * linkend="wintype-Graphics">Graphics Windows</link>.
  */
 
 /**
  * Represents the <keycap>F12</keycap> key.
  */
 
-/**
- * keycode_MAXVAL:
- *
- * This value is equal to the number of special keycodes. The last keycode is
- * always 
- * <inlineequation>
- *   <alt>(0x100000000 - <keysym>keycode_MAXVAL</keysym>)</alt>
- *   <mathphrase>(0x100000000 - <keysym>keycode_MAXVAL</keysym>)</mathphrase>
- * </inlineequation>
- * .
- */
-
 /**
  * style_Normal: 
  *
  *
  * Another style available for your use. 
  */
-/**
- * style_NUMSTYLES:
- * 
- * The number of styles defined in this library.
- */
 
 /**
  * stream_result_t:
  * When calling glk_window_open() with this @method, the new window will be 
  * below the old one which was split.
  */
-
-/**
- * winmethod_DirMask:
- *
- * Bitwise AND this value with a window splitting method argument to find
- * whether the split is %winmethod_Left, %winmethod_Right, %winmethod_Above, or
- * %winmethod_Below.
- */
  
 /**
  * winmethod_Fixed:
  * a given proportion of the old window's size. (See glk_window_open()).
  */
  
-/**
- * winmethod_DivisionMask:
- *
- * Bitwise AND this value with a window splitting method argument to find
- * whether the new window has %winmethod_Fixed or %winmethod_Proportional.
- */
 /** 
  * fileusage_Data: 
  *
  *  others may support both, or neither.
  * </para></note>
  */
-
-/**
- * stylehint_NUMHINTS:
- *
- * The number of style hints defined in this library.
- */ 
  
 /**
  * stylehint_just_LeftFlush:
  * A value for %stylehint_Justification representing right-justified text.
  */
 
+/**
+ * imagealign_InlineUp:
+ *
+ * The image appears at the current point in the text, sticking up. That is, the
+ * bottom edge of the image is aligned with the baseline of the line of text.
+ */
+
+/**
+ * imagealign_InlineDown:
+ *
+ * The image appears at the current point, and the top edge is aligned with the
+ * top of the line of text.
+ */
+
+/**
+ * imagealign_InlineCenter:
+ *
+ * The image appears at the current point, and it is centered between the top
+ * and baseline of the line of text. If the image is taller than the line of
+ * text, it will stick up and down equally.
+ */
+
+/**
+ * imagealign_MarginLeft:
+ * 
+ * The image appears in the left margin. Subsequent text will be displayed to
+ * the right of the image, and will flow around it &mdash; that is, it will be
+ * left-indented for as many lines as it takes to pass the image.
+ *
+ * <warning><para>Margin images are not implemented yet.</para></warning>
+ */
+
+/**
+ * imagealign_MarginRight:
+ *
+ * The image appears in the right margin, and subsequent text will flow around
+ * it on the left.
+ *
+ * <warning><para>Margin images are not implemented yet.</para></warning>
+ */
+/*---------- TYPES, FUNCTIONS AND CONSTANTS FROM GI_DISPA.H ------------------*/
+
+/**
+ * gidispatch_count_classes:
+ * 
+ * Returns the number of opaque object classes used by the library. You will
+ * need to know this if you want to keep track of opaque objects as they are
+ * created; see <link linkend="gidispatch-set-object-registry">Opaque Object
+ * Registry</link>.
+ * 
+ * As of Glk API 0.7.0, there are four classes: windows, streams, filerefs, and
+ * sound channels (numbered 0, 1, 2, and 3 respectively.)
+ *
+ * Returns: Number of opaque object classes used by the library.
+ */
+/**
+ * gidispatch_count_intconst:
+ *
+ * Returns the number of integer constants exported by the library.
+ *
+ * Returns: Number of integer constants exported by the library.
+ */
+/**
+ * gidispatch_get_intconst:
+ * @index: Unique integer index of the integer constant.
+ *
+ * Returns a structure describing an integer constant which the library exports.
+ * These are, roughly, all the constants defined in the <filename
+ * class="headerfile">glk.h</filename> file. @index can range from 0 to
+ * <inlineequation><mathphrase>N - 1</mathphrase><alt>N - 
+ * 1</alt></inlineequation>, where N is the value returned by 
+ * gidispatch_count_intconst().
+ *
+ * Returns: A #gidispatch_intconst_t structure describing the integer constant.
+ */
+
+/**
+ * gidispatch_intconst_t:
+ * @name: Symbolic name of the integer constant.
+ * @val: Value of the integer constant.
+ *
+ * This structure simply contains a string and a value. The string is a
+ * symbolic name of the value, and can be re-exported to anyone interested in
+ * using Glk constants.
+ */
+/**
+ * gidispatch_count_functions:
+ *
+ * Returns the number of functions exported by the library.
+ *
+ * Returns: Number of functions exported by the library.
+ */
+/**
+ * gidispatch_get_function:
+ * @index: Unique integer index of the function.
+ *
+ * Returns a structure describing a Glk function. @index can range from 0 to
+ * <inlineequation><mathphrase>N - 1</mathphrase><alt>N - 
+ * 1</alt></inlineequation>, where N is the value returned by 
+ * gidispatch_count_functions().
+ *
+ * Returns: A #gidispatch_function_t structure describing the function.
+ */
+/**
+ * gidispatch_function_t:
+ * @id: Dispatch selector of the function.
+ * @fnptr: Pointer to the function.
+ * @name: Name of the function, without the <code>glk_</code> prefix.
+ *
+ * The @id field is a selector &mdash; a numeric constant used to refer to the
+ * function in question. @name is the function name, as it is given in the
+ * <filename class="headerfile">glk.h</filename> file, but without the 
+ * <quote><code>glk_</code></quote> prefix. And @fnptr is the address of the
+ * function itself.
+ *
+ * <note><para>
+ *   This is included because it might be useful, but it is not recommended. To
+ *   call an arbitrary Glk function, you should use gidispatch_call().
+ * </para></note>
+ *
+ * See <link linkend="chimara-Table-of-Selectors">Table of Selectors</link> for
+ * the selector definitions. See <link 
+ * linkend="chimara-Dispatching">Dispatching</link> for more about calling Glk
+ * functions by selector.
+ */
+/**
+ * gidispatch_get_function_by_id:
+ * @id: A selector.
+ *
+ * Returns a structure describing the Glk function with selector @id. If there 
+ * is no such function in the library, this returns %NULL.
+ *
+ * Returns: a #gidispatch_function_t structure, or %NULL.
+ */
+/**
+ * gidispatch_call:
+ * @funcnum: Selector of the function to call.
+ * @numargs: Length of @arglist.
+ * @arglist: List of arguments to pass to the function.
+ *
+ * @funcnum is the function number to invoke; see <link 
+ * linkend="chimara-Table-of-Selectors">Table of Selectors</link>. @arglist is
+ * the list of arguments, and @numargs is the length of the list.
+ * 
+ * The arguments are all stored as #gluniversal_t objects. 
+ * </para><refsect3 id="chimara-Basic-Types"><title>Basic Types</title><para>
+ * Numeric arguments are passed in the obvious way &mdash; one argument per
+ * #gluniversal_t, with the @uint or @sint field set to the numeric value.
+ * Characters and strings are also passed in this way &mdash; #char<!---->s in
+ * the @uch, @sch, or @ch fields (depending on whether the #char is signed) and
+ * strings in the @charstr field. Opaque objects (windows, streams, etc) are
+ * passed in the @opaqueref field (which is <code>void*</code>, in order to
+ * handle all opaque pointer types.)
+ * 
+ * However, pointers (other than C strings), arrays, and structures complicate
+ * life. So do return values.
+ * </para></refsect3>
+ * <refsect3 id="chimara-References"><title>References</title><para>
+ * A reference to a numeric type or object reference &mdash; that is,
+ * <code>#glui32*</code>, <code>#winid_t*</code>, and so on &mdash; takes
+ * <emphasis>one or two</emphasis> #gluniversal_t objects. The first is a flag
+ * indicating whether the reference argument is %NULL or not. The @ptrflag field
+ * of this #gluniversal_t should be %FALSE if the reference is %NULL, and %TRUE
+ * otherwise. If %FALSE, that is the end of the argument; you should not use a
+ * #gluniversal_t to explicitly store the %NULL reference. If the flag is %TRUE,
+ * you must then put a #gluniversal_t storing the base type of the reference.
+ *
+ * For example, consider a hypothetical function, with selector 
+ * <code>0xABCD</code>:
+ * |[ 
+ * void glk_glomp(glui32 num, winid_t win, glui32 *numref, strid_t *strref);
+ * ]|
+ * ...and the calls:
+ * |[
+ * glui32 value;
+ * winid_t mainwin;
+ * strid_t gamefile;
+ * glk_glomp(5, mainwin, &value, &gamefile);
+ * ]|
+ *
+ * To perform this through gidispatch_call(), you would do the following:
+ * |[
+ * gluniversal_t arglist[6];
+ * arglist[0].uint = 5;
+ * arglist[1].opaqueref = mainwin;
+ * arglist[2].ptrflag = TRUE;
+ * arglist[3].uint = value;
+ * arglist[4].ptrflag = TRUE;
+ * arglist[5].opaqueref = gamefile;
+ * gidispatch_call(0xABCD, 6, arglist);
+ * value = arglist[3].uint;
+ * gamefile = arglist[5].opaqueref;
+ * ]|
+ * 
+ * Note that you copy the value of the reference arguments into and out of
+ * @arglist. Of course, it may be that 
+ * <function>glk_glomp&lpar;&rpar;</function> only uses these as pass-out
+ * references or pass-in references; if so, you could skip copying in or out.
+ *
+ * For further examples:
+ * |[
+ * glk_glomp(7, mainwin, NULL, NULL);
+ * ...or...
+ * gluniversal_t arglist[4];
+ * arglist[0].uint = 7;
+ * arglist[1].opaqueref = mainwin;
+ * arglist[2].ptrflag = FALSE;
+ * arglist[3].ptrflag = FALSE;
+ * gidispatch_call(0xABCD, 4, arglist);
+ * ]|
+ *
+ * |[
+ * glk_glomp(13, NULL, NULL, &gamefile);
+ * ...or...
+ * gluniversal_t arglist[5];
+ * arglist[0].uint = 13;
+ * arglist[1].opaqueref = NULL;
+ * arglist[2].ptrflag = FALSE;
+ * arglist[3].ptrflag = TRUE;
+ * arglist[4].opaqueref = gamefile;
+ * gidispatch_call(0xABCD, 5, arglist);
+ * gamefile = arglist[4].opaqueref;
+ * ]|
+ *
+ * |[
+ * glk_glomp(17, NULL, &value, NULL);
+ * ...or...
+ * gluniversal_t arglist[5];
+ * arglist[0].uint = 17;
+ * arglist[1].opaqueref = NULL;
+ * arglist[2].ptrflag = TRUE;
+ * arglist[3].uint = value;
+ * arglist[4].ptrflag = FALSE;
+ * gidispatch_call(0xABCD, 5, arglist);
+ * value = arglist[3].uint;
+ * ]|
+ * 
+ * As you see, the length of @arglist depends on how many of the reference
+ * arguments are %NULL.
+ * </para></refsect3>
+ * <refsect3 id="chimara-Structures"><title>Structures</title><para>
+ * A structure pointer is represented by a single @ptrflag, possibly followed by
+ * a sequence of #gluniversal_t objects (one for each field of the structure.)
+ * Again, if the structure pointer is non-%NULL, the @ptrflag should be %TRUE
+ * and be followed by values; if not, the @ptrflag should be %NULL and stands
+ * alone.
+ * 
+ * For example, the function glk_select() can be invoked as follows:
+ * |[
+ * event_t ev;
+ * gluniversal_t arglist[5];
+ * arglist[0].ptrflag = TRUE;
+ * gidispatch_call(0x00C0, 5, arglist);
+ * ev.type = arglist[1].uint;
+ * ev.win = arglist[2].opaqueref;
+ * ev.val1 = arglist[3].uint;
+ * ev.val2 = arglist[4].uint;
+ * ]|
+ * 
+ * Since the structure passed to glk_select() is a pass-out reference (the entry
+ * values are ignored), you don't need to fill in <code>arglist[1..4]</code>
+ * before calling gidispatch_call().
+ * 
+ * <note><para>
+ *   Theoretically, you would invoke <code>#glk_select(%NULL)</code> by setting'
+ *   <code>arglist[0].ptrflag</code> to %FALSE, and using a one-element @arglist
+ *   instead of five-element. But it's illegal to pass %NULL to glk_select(). So
+ *   you cannot actually do this.
+ * </para></note></para></refsect3>
+ * <refsect3 id="chimara-Arrays"><title>Arrays</title><para>
+ * In the Glk API, an array argument is always followed by a numeric argument
+ * giving the array's length. These two C arguments are a single logical
+ * argument, which is represented by <emphasis>one or three</emphasis>
+ * #gluniversal_t objects. The first is a @ptrflag, indicating whether the
+ * argument is %NULL or not. The second is a pointer, stored in the @array
+ * field. The third is the array length, stored in the @uint field. And again,
+ * if the @ptrflag is %NULL, the following two are omitted.
+ * 
+ * For example, the function glk_put_buffer() can be invoked as follows:
+ * |[
+ * char buf[64];
+ * glui32 len = 64;
+ * glk_put_buffer(buf, len);
+ * ...or...
+ * gluniversal_t arglist[3];
+ * arglist[0].ptrflag = TRUE;
+ * arglist[1].array = buf;
+ * arglist[2].uint = len;
+ * gidispatch_call(0x0084, 3, arglist);
+ * ]|
+ * 
+ * Since you are passing a C char array to gidispatch_call(), the contents will
+ * be read directly from that. There is no need to copy data into @arglist, as
+ * you would for a basic type.
+ * 
+ * If you are implementing a VM whose native representation of char arrays is
+ * more complex, you will have to do more work. You should allocate a C char
+ * array, copy your characters into it, make the call, and then free the array.
+ *
+ * <note><para>
+ *   glk_put_buffer() does not modify the array passed to it, so there is no
+ *   need to copy the characters out.
+ * </para></note></para></refsect3>
+ * <refsect3 id="chimara-Return-Values"><title>Return Values</title><para>
+ * The return value of a function is not treated specially. It is simply
+ * considered to be a pass-out reference argument which may not be %NULL. It
+ * comes after all the other arguments of the function.
+ * 
+ * For example, the function glk_window_get_rock() can be invoked as follows:
+ * |[
+ * glui32 rock;
+ * winid_t win;
+ * rock = glk_window_get_rock(win);
+ * ...or...
+ * gluniversal_t arglist[3];
+ * arglist[0].opaqueref = win;
+ * arglist[1].ptrflag = TRUE;
+ * gidispatch_call(0x0021, 3, arglist);
+ * rock = arglist[2].uint;
+ * ]|
+ * </para></refsect3><para>
+ */
+
+/**
+ * gluniversal_t:
+ * @uint: Stores a #glui32.
+ * @sint: Stores a #glsi32.
+ * @opaqueref: Stores a #winid_t, #strid_t, #frefid_t, or #schanid_t.
+ * @uch: Stores an #unsigned #char.
+ * @sch: Stores a #signed #char.
+ * @ch: Stores a #char with the default signedness.
+ * @charstr: Stores a null-terminated string.
+ * @unicharstr: Stores a zero-terminated string of #glui32 values representing
+ * Unicode characters.
+ * @array: Stores a pointer to an array, and should be followed by another 
+ * #gluniversal_t with the array length stored in the @uint member.
+ * @ptrflag: If %FALSE, represents an opaque reference or array that is %NULL,
+ * in which case it represents the entire argument. If %TRUE, should be followed
+ * by another #gluniversal_t with the pointer in its @opaqueref or @array field.
+ *
+ * This is a union, encompassing all the types that can be passed to Glk
+ * functions.
+ */
+/**
+ * gidispatch_prototype:
+ * @funcnum: A selector for the function to be queried.
+ *
+ * This returns a string which encodes the proper argument list for the given
+ * function. If there is no such function in the library, this returns %NULL.
+ * 
+ * The prototype string for the <function>glk_glomp&lpar;&rpar;</function> 
+ * function described above would be: <code>"4IuQa&amp;Iu&amp;Qb:"</code>. The 
+ * <code>"4"</code> is the number of arguments (including the return value, if 
+ * there is one, which in this case there isn't.) <code>"Iu"</code> denotes an 
+ * unsigned integer; <code>"Qa"</code> is an opaque object of class 0 (window).
+ * <code>"&amp;Iu"</code> is a <emphasis>reference</emphasis> to an unsigned
+ * integer, and <code>"&amp;Qb"</code> is a reference to a stream. The colon at
+ * the end terminates the argument list; the return value would follow it, if
+ * there was one.
+ * 
+ * Note that the initial number (<code>"4"</code> in this case) is the number of
+ * logical arguments, not the number of #gluniversal_t objects which will be
+ * passed to gidispatch_call(). The <function>glk_glomp&lpar;&rpar;</function> 
+ * call uses anywhere from four to six #gluniversal_t objects, as demonstrated 
+ * above.
+ * 
+ * The basic type codes:
+ * <variablelist>
+ * <varlistentry>
+ *   <term><code>Iu, Is</code></term>
+ *   <listitem><para>Unsigned and signed 32-bit integer.</para></listitem>
+ * </varlistentry>
+ * <varlistentry>
+ *   <term><code>Cn, Cu, Cs</code></term>
+ *   <listitem><para>Character, #unsigned #char, and #signed #char.</para>
+ *     <note><para>Of course <code>Cn</code> will be the same as either 
+ *     <code>Cu</code> or <code>Cs</code>, depending on the platform. For this
+ *     reason, Glk avoids using it, but it is included here for completeness.
+ *     </para></note>
+ *   </listitem>
+ * </varlistentry>
+ * <varlistentry>
+ *   <term><code>S</code></term>
+ *   <listitem><para>A C-style string (null-terminated array of #char). In Glk,
+ *   strings are always treated as read-only and used immediately; the library
+ *   does not retain a reference to a string between Glk calls. A Glk call that
+ *   wants to use writable char arrays will use an array type 
+ *   (<code>"&num;C"</code>), not string (<code>"S"</code>).</para></listitem>
+ * </varlistentry>
+ * <varlistentry>
+ *   <term><code>U</code></term>
+ *   <listitem><para>A zero-terminated array of 32-bit integers. This is
+ *   primarily intended as a Unicode equivalent of <code>"S"</code>. Like 
+ *   <code>"S"</code> strings, <code>"U"</code> strings are read-only and used
+ *   immediately. A Glk call that wants to use writable Unicode arrays will use
+ *   an array type (<code>"&num;Iu"</code>) instead of <code>"U"</code>.</para>
+ *   </listitem>
+ * </varlistentry>
+ * <varlistentry>
+ *   <term><code>F</code></term>
+ *   <listitem><para>A floating-point value. Glk does not currently use
+ *   floating-point values, but we might as well define a code for them.</para>
+ *   </listitem>
+ * </varlistentry>
+ * <varlistentry>
+ *   <term><code>Qa, Qb, Qc...</code></term>
+ *   <listitem><para>A reference to an opaque object. The second letter
+ *   determines which class is involved. (The number of classes can be gleaned
+ *   from gidispatch_count_classes(); see <link 
+ *   linkend="chimara-Interrogating-the-Interface">Interrogating the
+ *   Interface</link>).</para>
+ *   <note><para>
+ *     If Glk expands to have more than 26 classes, we'll think of something.
+ *   </para></note></listitem>
+ * </varlistentry>
+ * </variablelist>
+ * Any type code can be prefixed with one or more of the following characters
+ * (order does not matter):
+ * <variablelist>
+ * <varlistentry>
+ *   <term><code>&amp;</code></term>
+ *   <listitem><para>A reference to the type; or, if you like, a variable passed
+ *   by reference. The reference is passed both in and out, so you must copy the
+ *   value in before calling gidispatch_call() and copy it out afterward.</para>
+ *   </listitem>
+ * </varlistentry>
+ * <varlistentry>
+ *   <term><code>&lt;</code></term>
+ *   <listitem><para>A reference which is pass-out only. The initial value is
+ *   ignored, so you only need copy out the value after the call.</para>
+ *   </listitem>
+ * </varlistentry>
+ * <varlistentry>
+ *   <term><code>&gt;</code></term>
+ *   <listitem><para>A reference which is pass-in only.</para>
+ *   <note><para>
+ *     This is not generally used for simple types, but is useful for structures
+ *     and arrays.
+ *   </para></note></listitem>
+ * </varlistentry>
+ * <varlistentry>
+ *   <term><code>+</code></term>
+ *   <listitem><para>Combined with <code>"&"</code>, <code>"&lt;"</code>, or 
+ *   <code>"&gt;"</code>, indicates that a valid reference is mandatory; %NULL
+ *   cannot be passed.</para>
+ *   <note><para>
+ *     Note that even though the @ptrflag #gluniversal_t for a <code>"+"</code>
+ *     reference is always %TRUE, it cannot be omitted.
+ *   </para></note></listitem>
+ * </varlistentry>
+ * <varlistentry>
+ *   <term><code>:</code></term>
+ *   <listitem><para>The colon separates the arguments from the return value, or
+ *   terminates the string if there is no return value. Since return values are
+ *   always non-%NULL pass-out references, you may treat <code>":"</code> as
+ *   equivalent to <code>"&lt;+"</code>. The colon is never combined with any
+ *   other prefix character.</para></listitem>
+ * </varlistentry>
+ * <varlistentry>
+ *   <term><code>[...]</code></term>
+ *   <listitem><para>Combined with <code>"&amp;"</code>, <code>"&lt;"</code>, or 
+ *   <code>"&gt;"</code>, indicates a structure reference. Between the brackets
+ *   is a complete argument list encoding string, including the number of
+ *   arguments.</para>
+ *   <note><para>
+ *     For example, the prototype string for glk_select() is
+ *     <code>"1&lt;+[4IuQaIuIu]:"</code> &mdash; one argument, which is a
+ *     pass-out non-%NULL reference to a structure, which contains four
+ *     arguments.
+ *   </para></note>
+ *   <para>Currently, structures in Glk contain only basic types.</para>
+ *   </listitem>
+ * </varlistentry>
+ * <varlistentry>
+ *   <term><code>&num;</code></term>
+ *   <listitem><para>Combined with <code>"&amp;"</code>, <code>"&lt;"</code>, or 
+ *   <code>"&gt;"</code>, indicates an array reference. As described above, this
+ *   encompasses up to three #gluniversal_t objects &mdash; @ptrflag, pointer,
+ *   and integer length.</para>
+ *   <note><para>
+ *     Depending on the design of your program, you may wish to pass a pointer
+ *     directly to your program's memory, or allocate an array and copy the
+ *     contents in and out. See <link linkend="chimara-Arrays">Arrays</link>.
+ *   </para></note></listitem>
+ * </varlistentry>
+ * <varlistentry>
+ *   <term><code>!</code></term>
+ *   <listitem><para>Combined with <code>"&num;"</code>, indicates that the
+ *   array is retained by the library. The library will keep a reference to the
+ *   array; the contents are undefined until further notice. You should not use
+ *   or copy the contents of the array out after the call, even for 
+ *   <code>"&amp;&num;!"</code> or <code>"&lt;&num;!"</code> arrays. Instead, do
+ *   it when the library releases the array.</para>
+ *   <note><para>
+ *     For example, glk_stream_open_memory() retains the array that you pass it,
+ *     and releases it when the stream is closed. The library can notify you
+ *     automatically when arrays are retained and released; see <link
+ *     linkend="gidispatch-set-retained-registry">Retained Array
+ *     Registry</link>.
+ *   </para></note></listitem>
+ * </varlistentry>
+ * </variablelist>
+ *
+ * Returns: A string which encodes the prototype of the specified Glk function.
+ */
+
+/**
+ * gidisp_Class_Window:
+ *
+ * Represents a #winid_t opaque object.
+ */
+/**
+ * gidisp_Class_Stream:
+ *
+ * Represents a #strid_t opaque object.
+ */
+/**
+ * gidisp_Class_Fileref:
+ *
+ * Represents a #frefid_t opaque object.
+ */
+
+/**
+ * gidisp_Class_Schannel:
+ * 
+ * Represents a #schanid_t opaque object.
+ */
+
+/**
+ * gidispatch_rock_t:
+ * @num: Space for storing an integer.
+ * @ptr: Space for storing a pointer.
+ *
+ * You can store any value you want in this object; return it from your object
+ * registry and retained array registry callbacks, and the library will stash it
+ * away. You can retrieve it with gidispatch_get_objrock().
+ */ 
+
 /*---------- TYPES, FUNCTIONS AND CONSTANTS FROM GI_BLORB.H ------------------*/
  
 /**
  */
 
 /**
- * giblorb_method_DontLoad:
+ * giblorb_method_FilePos:
  *
  * Pass this to giblorb_load_chunk_by_type(), giblorb_load_chunk_by_number(), or
  * giblorb_load_resource() to get the position in the Blorb file at which the
  
 /**
  * giblorb_result_t:
+ * @chunknum: The chunk number (for use in giblorb_unload_chunk(), etc.)
+ * @data: A union containing a pointer to the data @ptr (if you used 
+ * %giblorb_method_Memory) and the position in the file @startpos (if you used 
+ * %giblorb_method_FilePos)
+ * @length: The length of the data
+ * @chunktype: The type of the chunk.
  *
  * Holds information about a chunk loaded from a Blorb file, and the method of
  * accessing the chunk data. See giblorb_load_chunk_by_type() and
 
 /**
  * glkunix_argumentlist_t:
- * 
- * In each entry, name is the option as it would appear on the command line
- * (including the leading dash, if any.) The desc is a description of the
- * argument; this is used when the library is printing a list of options. And
- * argtype is one of the following constants:
+ * @name: the option as it would appear on the command line (including the 
+ * leading dash, if any.) 
+ * @desc: a description of the argument; this is used when the library is 
+ * printing a list of options.
+ * @argtype: one of the <code>glkunix_arg_</code> constants.
  * 
  * <variablelist>
  * <varlistentry>
  * If you don't care about command-line arguments, you must still define an
  * empty arguments list, as follows:
  * |[
- * #glkunix_argumentlist_t glkunix_arguments[] = {
- *  { NULL, #glkunix_arg_End, NULL }
+ * glkunix_argumentlist_t glkunix_arguments[] = {
+ *     { NULL, glkunix_arg_End, NULL }
  * };
  * ]|
  * 
  * Here is a more complete sample list:
  * |[
- * #glkunix_argumentlist_t glkunix_arguments[] = {
- *  { "", #glkunix_arg_ValueFollows, "filename: The game file to load." },
- *  { "-hum", #glkunix_arg_ValueFollows, "-hum NUM: Hum some NUM." },
- *  { "-bom", #glkunix_arg_ValueCanFollow, "-bom [ NUM ]: Do a bom (on
- *   the NUM, if given)." },
- *  { "-goo", #glkunix_arg_NoValue, "-goo: Find goo." },
- *  { "-wob", #glkunix_arg_NumberValue, "-wob NUM: Wob NUM times." },
- *  { NULL, #glkunix_arg_End, NULL }
+ * glkunix_argumentlist_t glkunix_arguments[] = {
+ *     { "", glkunix_arg_ValueFollows, "filename: The game file to load." },
+ *     { "-hum", glkunix_arg_ValueFollows, "-hum NUM: Hum some NUM." },
+ *     { "-bom", glkunix_arg_ValueCanFollow, "-bom [ NUM ]: Do a bom (on
+ *       the NUM, if given)." },
+ *     { "-goo", glkunix_arg_NoValue, "-goo: Find goo." },
+ *     { "-wob", glkunix_arg_NumberValue, "-wob NUM: Wob NUM times." },
+ *     { NULL, glkunix_arg_End, NULL }
  * };
  * ]|
  * This would match the arguments <quote><code>thingfile -goo -wob8 -bom -hum 
  * After the library parses the command line, it does various occult rituals of
  * initialization, and then calls glkunix_startup_code().
  *
- * |[ int glkunix_startup_code(#glkunix_startup_t *data); ]|
+ * |[ int glkunix_startup_code(glkunix_startup_t *data); ]|
  *
  * This should return %TRUE if everything initializes properly. If it returns
  * %FALSE, the library will shut down without ever calling your glk_main() 
 
 /**
  * glkunix_startup_t: 
+ * @argc: The number of arguments in @argv.
+ * @argv: Strings representing command line arguments.
  * 
  * The fields are a standard Unix <code>(argc, argv)</code> list, which contain
  * the arguments you requested from the command line. In deference to custom,