Well, I’m baffled. Even with the fixed version of the glkote, Quixe is indeed still crashing on the attempt to print (i.e., “gli_put_char” [should be “glk_put_char”, no?]) during line input. Zarf’s code works, but any solution that uses Glulx Entry Points fails in the same way.
This is baffling because there is no attempt to print in any of the GEP code as far as I can tell. My best guess is that something other than a straight “say” is nevertheless resulting in a put_char request. Nothing intentionally printed is causing the problem; if it were, Gargoyle–which suppresses text printed illegally–would not produce the desired output. Instead, Gargoyle’s output is identical to the Mac IDE interpreter’s, and the latter doesn’t suppress output at all. (Well, they aren’t exactly identical–the IDE interpreter doesn’t print a line break when the line event is canceled as Gargoyle does, but that is a well-known divergence from spec on the part of the IDE terp.)
For reference, I’ve pulled out the relevant code from GEP and Inline Hyperlinks–the HandleGlkEvent code (excerpted from GEP) controls the flow, and the code beneath is the sequence of rules that are being called by HandleGlkEvent. This is followed by a complete example along the lines of Zarf’s but using Inline Hyperlinks. Finally, the same example using the Basic Hyperlinks extension (which also uses GEP under the hood).
[code]Include (-
[ HandleGlkEvent ev context abortres newcmd cmdlen ;
context = 0; ! suppress ignored warning
switch (ev–>0) {
evtype_Hyperlink:
FollowRulebook( (+glulx hyperlink rules+) );
if ( FollowRulebook( (+command-counting rules +) ) && RulebookSucceeded())
{
FollowRulebook( (+input-cancelling rules+) );
FollowRulebook( (+command-showing rules+) );
if ( FollowRulebook( (+command-pasting rules+) ) ) return 2;
}
}
];
-) before “Glulx.i6t”.
A glulx hyperlink rule (this is the default inline hyperlink handling rule):
now the current hyperlink ID is the link number of the selected hyperlink;
unless the current hyperlink ID is 0:
cancel glulx hyperlink request in main window;
cancel glulx hyperlink request in status window;
follow the hyperlink processing rules;
if the status window is the hyperlink source:
request glulx hyperlink event in status window;
otherwise:
request glulx hyperlink event in main window.
A hyperlink processing rule (this is the default command replacement by hyperlinks rule):
now the glulx replacement command is entry (current hyperlink ID) of the hyperlink list;
rule succeeds.
A command-counting rule (this is the ordinary checking for content rule):
if the number of characters in the glulx replacement command is 0, rule fails;
rule succeeds.
An input-cancelling rule (this is the cancelling input in the main window rule):
cancel line input in the main window;
cancel character input in the main window;
To cancel line input in the/-- main window:
(- glk_cancel_line_event(gg_mainwin, GLK_NULL); -)
To cancel character input in the/-- main window:
(- glk_cancel_char_event(gg_mainwin); -)
A command-showing rule (this is the print text to the input prompt rule):
say input-style-for-glulx;
say Glulx replacement command;
say roman type;
A command-pasting rule (this is the glue replacement command into parse buffer rule):
change the text of the player’s command to the Glulx replacement command;
rule succeeds.
[/code]
[code]Include Inline Hyperlinks by Erik Temple.
Release along with an interpreter.
Test is a room.
Instead of jumping:
say “Are you sure? [link]YES[end link] or [link]NO[end link]”;
if the player consents:
say “Whee!”;
otherwise:
say “You maintain your dignity.”[/code]
[code]Include Basic Hyperlinks by Emily Short.
Release along with an interpreter.
Test is a room.
Instead of jumping:
say “Are you sure? [set link 1]YES[end link] or [set link 2]NO[end link]”;
if the player consents:
say “Whee!”;
otherwise:
say “You maintain your dignity.”
Table of Hyperlink Glulx Replacement Commands (continued)
linknum replacement
1 “YES”
2 “NO”[/code]
Maybe someone else can make sense of this.