Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repair command replacement in Glulx Entry Points #66

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Dannii Willis/Glk Events.i7x
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,15 @@ The glk event value 2 variable translates into I6 as "GE_Event_Struct_val2".

Section - The glulx input handling rules

[Event handling without any bells or whistles]
The glk event processing rules are a g-event based rulebook.

[This rulebook was originally part of Glulx Entry Points.]
The glulx input handling rules are a g-event based rulebook.

[If Glulx Entry Points is not included, treat input handling rules as event processing rules.]
A glk event processing rule for a g-event (called the event) (this is the glk event compatibility rule):
abide by the glulx input handling rules for the event.


Section - Intercepting glk_select()
Expand All @@ -59,7 +66,7 @@ Include (-
! Run the glulx input handling rules (but disable rules debugging because it crashes if keyboard input events are pending)
@push debug_rules; @push say__p; @push say__pc;
debug_rules = false; ClearParagraphing(1);
FollowRulebook( (+ the glulx input handling rules +), GE_Event_Struct_type, true );
FollowRulebook( (+ the glk event processing rules +), GE_Event_Struct_type, true );
@pull say__pc; @pull say__p; @pull debug_rules;

! Copy back to the original event structure
Expand Down
21 changes: 17 additions & 4 deletions Emily Short/Glulx Entry Points.i7x
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,35 @@ To decide what number is the value returned by glk event handling (this is the h
follow the command-showing rules;
follow the command-pasting rules;
if the [command-pasting] rule succeeded:
decide on GEP internal input replacement.
decide on GEP internal input replacement;
decide on GEP internal input continuation.

GEP internal glk event result is a number that varies.
GEP internal glk event result is initially 0.

[Take over handling of glulx events]
The glk event compatibility rule is not listed in the glk event processing rules.

A glk event processing rule (this is the glulx event handling rule):
Now GEP internal glk event result is the value returned by glk event handling.


Section - HandleGlkEvent routine

Include (- Array evGlobal --> 4; -) before "Glulx.i6t".

[Include (-
To decide what number is the value returned by glk event result recalling (this is the unstash glk event rule):
decide on GEP internal glk event result.

Include (-

[ HandleGlkEvent ev context abortres newcmd cmdlen i ;
for (i=0:i<3:i++) evGlobal-->i = ev-->i;
(+ library input context +) = context;
return (+ value returned by glk event handling +) ;
return (+ value returned by glk event result recalling +) ;
];

-) before "Glulx.i6t".]
-) before "Glulx.i6t".


Section - Useful function wrappers
Expand Down