Guest User

Glulx Definitions

a guest
Apr 4th, 2025
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.26 KB | None | 0 0
  1. Version 1/160919 of Glulx Definitions (for Glulx only) by Dannii Willis begins here.
  2.  
  3. "Core definitions which other Glulx/Glk extensions depend on"
  4.  
  5. Use authorial modesty.
  6.  
  7.  
  8.  
  9. Chapter - Testing interpreter features (gestalts)
  10.  
  11. Include (-
  12.  
  13. [ GD_GlulxGestalt sel arg res;
  14. @gestalt sel arg res;
  15. return res;
  16. ];
  17. -).
  18.  
  19. To decide what number is the glulx version:
  20. (- GD_GlulxGestalt( 0 ) -).
  21.  
  22. To decide what number is the interpreter version:
  23. (- GD_GlulxGestalt( 1 ) -).
  24.  
  25. To decide whether glulx memory resizing is supported:
  26. (- GD_GlulxGestalt( 2 ) -).
  27.  
  28. To decide whether glulx undo is supported:
  29. (- GD_GlulxGestalt( 3 ) -).
  30.  
  31. To decide whether glulx memory copying is supported:
  32. (- GD_GlulxGestalt( 6 ) -).
  33.  
  34. To decide whether glulx malloc is supported:
  35. (- GD_GlulxGestalt( 7 ) -).
  36.  
  37. To decide whether glulx function acceleration is supported:
  38. (- GD_GlulxGestalt( 9 ) -).
  39.  
  40. To decide whether glulx real numbers are supported:
  41. (- GD_GlulxGestalt( 11 ) -).
  42.  
  43.  
  44.  
  45. To decide what number is the glk version:
  46. (- glk_gestalt( gestalt_Version, 0 ) -).
  47.  
  48. To decide whether glk/glulx character input is supported:
  49. (- glk_gestalt( gestalt_CharInput, 0 ) -).
  50.  
  51. To decide whether glk/glulx line input is supported:
  52. (- glk_gestalt( gestalt_LineInput, 0 ) -).
  53.  
  54. To decide whether glk/glulx mouse input is supported:
  55. (- glk_gestalt( gestalt_MouseInput, 0 ) -).
  56.  
  57. To decide whether glk/glulx graphic-window mouse input is supported:
  58. (- glk_gestalt( gestalt_MouseInput, winType_Graphics ) -).
  59.  
  60. To decide whether glk/glulx text-grid mouse input is supported:
  61. (- glk_gestalt( gestalt_MouseInput, winType_TextGrid ) -).
  62.  
  63. To decide whether glk/glulx timekeeping is supported:
  64. (- glk_gestalt( gestalt_Timer, 0 ) -).
  65.  
  66. To decide whether glk/glulx graphics are/is supported:
  67. (- glk_gestalt( gestalt_Graphics, 0 ) -).
  68.  
  69. To decide whether glk/glulx text-buffer graphics are/is supported:
  70. (- glk_gestalt( gestalt_DrawImage, winType_TextBuffer ) -).
  71.  
  72. To decide whether glk/glulx graphic-window graphics are/is supported:
  73. (- glk_gestalt( gestalt_DrawImage, winType_Graphics ) -).
  74.  
  75. To decide whether glk/glulx basic/-- sounds/sound are/is supported:
  76. (- glk_gestalt( gestalt_Sound, 0 ) -).
  77.  
  78. To decide whether glk/glulx sound volume is supported:
  79. (- glk_gestalt( gestalt_SoundVolume, 0 ) -).
  80.  
  81. To decide whether glk/glulx sound notification is supported:
  82. (- glk_gestalt( gestalt_SoundNotify, 0 ) -).
  83.  
  84. To decide whether glk/glulx hyperlinks are supported:
  85. (- glk_gestalt( gestalt_Hyperlinks, 0 ) -).
  86.  
  87. To decide whether glk/glulx hyperlink input is supported:
  88. (- glk_gestalt( gestalt_HyperlinkInput, 0 ) -).
  89.  
  90. To decide whether glk/glulx mod sound is supported:
  91. (- glk_gestalt( gestalt_SoundMusic, 0 ) -).
  92.  
  93. To decide whether glk/glulx PNG transparency is supported:
  94. (- glk_gestalt( gestalt_GraphicsTransparency, 0 ) -).
  95.  
  96. To decide whether glk/glulx unicode is supported:
  97. (- glk_gestalt( gestalt_Unicode, 0 ) -).
  98.  
  99. To decide whether glk/glulx unicode normalization is supported:
  100. (- glk_gestalt( gestalt_UnicodeNorm, 0 ) -).
  101.  
  102. To decide whether glk/glulx line input echo suppression is supported:
  103. (- glk_gestalt( gestalt_LineInputEcho, 0 ) -).
  104.  
  105. To decide whether glk/glulx line input terminators are supported:
  106. (- glk_gestalt( gestalt_LineTerminators, 0 ) -).
  107.  
  108. To decide whether the/-- glk/glulx system clock is supported:
  109. (- glk_gestalt( gestalt_DateTime, 0 ) -).
  110.  
  111. To decide whether glk/glulx sounds are fully supported:
  112. (- glk_gestalt( gestalt_Sound2, 0 ) -).
  113.  
  114. To decide whether glk/glulx resource streams are supported:
  115. (- glk_gestalt( gestalt_ResourceStream, 0 ) -).
  116.  
  117. To decide whether glk/glulx graphics window character input is supported:
  118. (- glk_gestalt( gestalt_GraphicsCharInput, 0 ) -).
  119.  
  120.  
  121.  
  122. Chapter - Glulx and Glk kinds
  123.  
  124. Section - Events
  125.  
  126. A g-event is a kind of value.
  127. The specification of a g-event is "The interpreter sends player actions as events".
  128. The g-events are timer-event,
  129. char-event,
  130. line-event,
  131. mouse-event,
  132. arrange-event,
  133. redraw-event,
  134. sound-notify-event,
  135. hyperlink-event,
  136. volume-event.
  137.  
  138. [ Events which occur due to player actions are dependent on the player; all others are independent ]
  139. Definition: a g-event is dependent on the player rather than independent of the player if
  140. it is char-event or
  141. it is line-event or
  142. it is mouse-event or
  143. it is hyperlink-event.
  144.  
  145. To decide which g-event is null-event:
  146. (- 0 -).
  147.  
  148.  
  149.  
  150. Glulx Definitions ends here.
  151.  
  152.  
  153.  
  154. ---- Documentation ----
  155.  
  156. This extension is a low level utility library containing core defintions for the Glulx and Glk systems.
  157.  
  158. 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>.
  159.  
  160.  
  161.  
  162. Chapter: Testing interpreter features (gestalts)
  163.  
  164. We can test whether the player's interpreter supports various multimedia features using the following phrases:
  165.  
  166. Table of interpreter functions
  167. the glulx version (a number) the version of the Glulx standard the interpreter implements
  168. the glk version (a number) the version of the Glk standard the interpreter implements
  169. the interpreter version (a number) the interpreter's own version number
  170. if glulx memory resizing is supported
  171. if glulx undo is supported
  172. if glulx memory copying is supported
  173. if glulx malloc is supported
  174. if glulx function acceleration is supported
  175. if glulx real numbers are supported
  176. if glk/glulx character input is supported
  177. if glk/glulx line input is supported
  178. if glk/glulx mouse input is supported whether any clicks at all can be detected
  179. if glk/glulx graphic-window mouse input is supported
  180. if glk/glulx text-grid mouse input is supported
  181. if glk/glulx timekeeping is supported whether the Glk timer can be set for one-off or periodic events
  182. if glk/glulx graphics are/is supported whether any graphics at all are supported
  183. if glk/glulx text-buffer graphics are/is supported
  184. if glk/glulx graphic-window graphics are/is supported
  185. if glk/glulx basic sounds are supported whether any sounds can be played
  186. if glk/glulx sound volume is supported whether the volume can be controlled
  187. if glk/glulx sound notification is supported whether an event will be raised when a sound finishes playing
  188. if glk/glulx hyperlinks are supported
  189. if glk/glulx hyperlink input is supported
  190. if glk/glulx mod sound is supported whether mod sounds can be played
  191. if glk/glulx PNG transparency is supported whether it is possible to layer PNG images with transparent alpha channels
  192. if glk/glulx unicode is supported
  193. if glk/glulx unicode normalization is supported
  194. if glk/glulx line input echo suppression is supported
  195. if glk/glulx line input terminators are supported
  196. if the glk/glulx system clock is supported whether the current time can be obtained
  197. if glk/glulx sounds are fully supported
  198. if glk/glulx resource streams are supported
  199. if glk/glulx graphics window character input is supported whether character input is supported in graphics windows
  200.  
  201. 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.
Advertisement
Add Comment
Please, Sign In to add comment