From f3472f40165e95cedd048994c750777ac5c0330b Mon Sep 17 00:00:00 2001 From: Dannii Willis Date: Sat, 3 Jan 2026 17:00:22 +1000 Subject: [PATCH 1/5] Minor Glk related changes --- .../Inter/Architecture32Kit/Sections/Glk.i6t | 12 ++++++------ .../Source/Sections/Glulx and Glk.w | 4 ++-- .../Source/Sections/Phrase Definitions.w | 3 +++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/Glk.i6t b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/Glk.i6t index f846e7f3b..bad1df6e2 100644 --- a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/Glk.i6t +++ b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/Glk.i6t @@ -500,7 +500,7 @@ the event struct. event_struct-->3 = ev-->GLK_EVENT_VALUE2_SF; ]; -@ |GLK_EVENT_TY_Handle_Instead| applies a glk event onto the current glk event, and +@ |GLK_EVENT_TY_Replace_Current| applies a glk event onto the current glk event, and tells glk_select to re-run the glk event handling rules. It also ensures that if there are any pending keyboard input requests they will be cancelled if the new event is a keyboard event. @@ -508,12 +508,12 @@ new event is a keyboard event. = Array current_glk_event --> [ BLK_BVBITMAP_SBONLY; GLK_EVENT_TY; 0; 0; 0; 0; 0; 0; 0; ]; -Constant GLK_EVENT_HANDLING_INACTIVE 0; -Constant GLK_EVENT_HANDLING_ACTIVE 1; -Constant GLK_EVENT_HANDLING_REHANDLING 2; +Constant GLK_EVENT_HANDLING_INACTIVE 0; +Constant GLK_EVENT_HANDLING_ACTIVE 1; +Constant GLK_EVENT_HANDLING_REPLACED 2; Global glk_event_handling_status = GLK_EVENT_HANDLING_INACTIVE; -[ GLK_EVENT_TY_Handle_Instead ev evtype win_obj; +[ GLK_EVENT_TY_Replace_Current ev evtype win_obj; if (glk_event_handling_status == GLK_EVENT_HANDLING_INACTIVE) { IssueRTP("EventHandledWhileInactive", "Cannot handle new event while not handling events.", Architecture32KitRTPs); RulebookSucceeds(); @@ -550,7 +550,7 @@ Global glk_event_handling_status = GLK_EVENT_HANDLING_INACTIVE; current_glk_event-->GLK_EVENT_VALUE2_SF = ev-->GLK_EVENT_VALUE2_SF; RulebookSucceeds(); - glk_event_handling_status = GLK_EVENT_HANDLING_REHANDLING; + glk_event_handling_status = GLK_EVENT_HANDLING_REPLACED; ]; @ To handle events we intercept the |glk_select| function. This allows us to handle diff --git a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Glulx and Glk.w b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Glulx and Glk.w index c93638e02..f592331af 100644 --- a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Glulx and Glk.w +++ b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Glulx and Glk.w @@ -189,8 +189,8 @@ Very first glk event handling rule for a glk event type (this is the set glk event processing variables rule): now the event is the current glk event initialiser. -To handle (ev - glk event): - (- GLK_EVENT_TY_Handle_Instead({ev}); rtrue; -). +To replace current event with (ev - glk event): + (- GLK_EVENT_TY_Replace_Current({ev}); rtrue; -). Glk event handling rule for a screen resize event (this is the redraw the status line rule): redraw the status window; diff --git a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Phrase Definitions.w b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Phrase Definitions.w index 52fe6be4d..cad9f94cd 100644 --- a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Phrase Definitions.w +++ b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Phrase Definitions.w @@ -1845,6 +1845,9 @@ To say (C - RGB colour) letters: To set the background colour/color/-- to (C - RGB colour): (- VM_SetWindowColours(BASIC_COLOUR_CURRENT, {C}); -). +To decide what RGB colour is (C - basic colour) as a RGB colour: + (- {C} -). + @ Some basic window phrases, which are supported by both the Z-Machine and Glulx. (See the Glk Foundations for Glk-specific phrases.) From f39980c3a850193ddb879abeb31c64a07eff4153 Mon Sep 17 00:00:00 2001 From: Dannii Willis Date: Thu, 25 Jul 2024 08:00:11 +1000 Subject: [PATCH 2/5] Begun working on a hyperlinks framework - supports rules and keypresses --- .editorconfig | 11 ++-- .../Inter/Architecture32Kit/Sections/Glk.i6t | 57 +++++++++++++++++++ .../Architecture32Kit/Sections/Startup.i6t | 6 ++ .../Source/Sections/Glulx and Glk.w | 51 +++++++++++++++++ .../Sections/Miscellaneous Definitions.w | 5 +- .../Source/Sections/Phrase Definitions.w | 2 +- .../Materials/Languages/English/Index.txt | 1 + .../Chapter 3/Standards Element.w | 2 + 8 files changed, 126 insertions(+), 9 deletions(-) diff --git a/.editorconfig b/.editorconfig index 3b02053a5..c3bd687a7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,12 +12,9 @@ insert_final_newline = false [*.{i6t,i7,i7x,neptune,ni,txt,w}] indent_style = tab +[*.{i6t,w}] +insert_final_newline = true + [*.json] indent_style = space -indent_size = 4 - -[inform7/Tests/Test Cases/*.txt] -indent_style = tab - -[resources/Documentation/**.txt] -indent_style = tab +indent_size = 4 \ No newline at end of file diff --git a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/Glk.i6t b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/Glk.i6t index bad1df6e2..d8c9eaade 100644 --- a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/Glk.i6t +++ b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/Glk.i6t @@ -740,6 +740,63 @@ requested. return 0; ]; +@h Hyperlinks. +A simple framework for handling hyperlinks in an interoperable manner. +We combine a hyperlink tag with a payload in one 32-bit value. The tag is stored +in the lowest bits, and the payload above it. + += +Global hyperlink_payload_mask; +Global hyperlink_tag_mask; +Global hyperlink_tag_width; +Global hyperlink_value; + +[ CALCULATE_HYPERLINK_TAG_WIDTH_R; + if (ICOUNT_HYPERLINK_TAG < 8) { + hyperlink_tag_mask = $07; + hyperlink_tag_width = 3; + } + else if (ICOUNT_HYPERLINK_TAG < 16) { + hyperlink_tag_mask = $0F; + hyperlink_tag_width = 4; + } + else { + ! Enough for 31 tags, which better be enough! + hyperlink_tag_mask = $1F; + hyperlink_tag_width = 5; + } + hyperlink_payload_mask = ~hyperlink_tag_mask; + rfalse; +]; + +[ MakeTaggedHyperlink tag val; + if (Cached_Glk_Gestalts-->gestalt_Hyperlinks) { + if (val > 0) { + @shiftl val hyperlink_tag_width val; + } + else { + val = val & hyperlink_payload_mask; + } + glk_set_hyperlink(tag | val); + } +]; + +[ HANDLE_HYPERLINK_R val; + if (current_glk_event-->GLK_EVENT_TYPE_SF == evtype_Hyperlink) { + val = current_glk_event-->GLK_EVENT_VALUE1_SF; + glk_request_hyperlink_event((current_glk_event-->GLK_EVENT_WINDOW_SF).glk_ref); + hyperlink_value = val & hyperlink_payload_mask; + if (hyperlink_value < 0) { + hyperlink_value = hyperlink_value | hyperlink_tag_mask; + } + else { + @ushiftr hyperlink_value hyperlink_tag_width hyperlink_value; + } + FollowRulebook(HYPERLINK_HANDLING_RB, val & hyperlink_tag_mask, true); + } + rfalse; +]; + @h Suspending and resuming text input. These functions allow the author to suspend and then resume a window's text input requests. diff --git a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/Startup.i6t b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/Startup.i6t index 902b76b0e..3cecc6360 100644 --- a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/Startup.i6t +++ b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/Startup.i6t @@ -113,6 +113,9 @@ Global Pre_Startup_Text_Capture_Stream; if (BasicInformKit`MANUAL_INPUT_ECHOING_CFGF && Cached_Glk_Gestalts-->gestalt_LineInputEcho) { glk_set_echo_line_event(gg_mainwin, 0); } + if (Cached_Glk_Gestalts-->gestalt_Hyperlinks) { + glk_request_hyperlink_event(gg_mainwin); + } } else { ! There was already a story window. We should erase it. glk_window_clear(gg_mainwin); @@ -124,6 +127,9 @@ Global Pre_Startup_Text_Capture_Stream; gg_statuswin = glk_window_open(gg_mainwin, winmethod_Fixed + winmethod_Above, statuswin_cursize, wintype_TextGrid, GG_STATUSWIN_ROCK); + if (Cached_Glk_Gestalts-->gestalt_Hyperlinks) { + glk_request_hyperlink_event(gg_statuswin); + } } } else if (gg_statuswin) { diff --git a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Glulx and Glk.w b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Glulx and Glk.w index f592331af..df9a7dc64 100644 --- a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Glulx and Glk.w +++ b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Glulx and Glk.w @@ -195,6 +195,57 @@ To replace current event with (ev - glk event): Glk event handling rule for a screen resize event (this is the redraw the status line rule): redraw the status window; +@h Hyperlinks. +A simple framework for handling hyperlinks in an interoperable manner. + += +Chapter - Hyperlinks + +A hyperlink tag is a kind of value. + +The hyperlink value is a number variable. +The hyperlink value variable is defined by Inter as "hyperlink_value". + +The hyperlink handling rules is a hyperlink tag based rulebook. +The hyperlink handling rules is accessible to Inter as "HYPERLINK_HANDLING_RB". + +The handle hyperlinks rule is listed in the glk event handling rules. +The handle hyperlinks rule is defined by Inter as "HANDLE_HYPERLINK_R". + +To say end link: + (- if (Cached_Glk_Gestalts-->gestalt_Hyperlinks) { glk_set_hyperlink(0); } -). + +@ And some built-in hyperlink tags: + +- A rule hyperlink runs a rule when clicked; that in turn allows you to run any other code you like. +- A keypress hyperlink converts a hyperlink event into a character event, for the specified unicode character. + += + +Rule hyperlink is a hyperlink tag. + +To say link (R - rule): + (- MakeTaggedHyperlink((+ rule hyperlink +), {R}); -). + +Hyperlink handling rule for a rule hyperlink (this is the rule hyperlink rule): + run rule at address hyperlink value; + +Keypress hyperlink is a hyperlink tag. + +To say link (C - unicode character): + (- MakeTaggedHyperlink((+ keypress hyperlink +), {C}); -). + +Hyperlink handling rule for a keypress hyperlink (this is the keypress hyperlink rule): + process a character event for (hyperlink value of the current glk event as a unicode character) in (window of the current glk event); + +Section - unindexed + +To run rule at address (R - number): + (- ({R})(); -). + +To decide what unicode character is (N - number) as a unicode character: + (- ({N}) -). + @h Suspending input. These properties and phrases allow the author to suspend and resume input requests. diff --git a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Miscellaneous Definitions.w b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Miscellaneous Definitions.w index b10cfa947..d13984280 100644 --- a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Miscellaneous Definitions.w +++ b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Miscellaneous Definitions.w @@ -154,10 +154,13 @@ Section - Startup C (for Glulx only) The start capturing startup text rule is listed first in the before starting the virtual machine rules. [1st] The start capturing startup text rule translates into Inter as "CAPTURE_STARTUP_TEXT_R". +The calculate hyperlink tag width rule is listed in the before starting the virtual machine rules. [6th] +The calculate hyperlink tag width rule translates into Inter as "CALCULATE_HYPERLINK_TAG_WIDTH_R". + @ These rules now set up the built in sound channels and windows. = -The set default stylehints rule is listed in the before starting the virtual machine rules. [6th] +The set default stylehints rule is listed in the before starting the virtual machine rules. [7th] The set default stylehints rule translates into Inter as "SET_DEFAULT_STYLEHINTS_R". The sound channel initialisation rule is listed in the for starting the virtual machine rules. diff --git a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Phrase Definitions.w b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Phrase Definitions.w index cad9f94cd..ad2554740 100644 --- a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Phrase Definitions.w +++ b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Phrase Definitions.w @@ -2046,4 +2046,4 @@ Chapter 11 - Use Options Section 1 - Numerical Value To decide what number is the numerical value of (U - a use option): - (- USE_OPTION_VALUES-->({U}) -). + (- USE_OPTION_VALUES-->({U}) -). \ No newline at end of file diff --git a/inform7/Internal/Extensions/Graham Nelson/English Language.i7xd/Materials/Languages/English/Index.txt b/inform7/Internal/Extensions/Graham Nelson/English Language.i7xd/Materials/Languages/English/Index.txt index 15f78fa26..c866bf37a 100644 --- a/inform7/Internal/Extensions/Graham Nelson/English Language.i7xd/Materials/Languages/English/Index.txt +++ b/inform7/Internal/Extensions/Graham Nelson/English Language.i7xd/Materials/Languages/English/Index.txt @@ -314,6 +314,7 @@ %Index.Elements.St.IdentifySchannelsRules = Identify glk sound channels rules %Index.Elements.St.GlkObjectUpdatingRules = Glk object updating rules %Index.Elements.St.GlkEventHandlingRules = Glk event handling rules +%Index.Elements.St.HyperlinkHandlingRules = Hyperlink handling rules %Index.Elements.St.CheckRules = Check rules are tied to specific actions, and there are too many to index here. diff --git a/inter/index-module/Chapter 3/Standards Element.w b/inter/index-module/Chapter 3/Standards Element.w index c272c25d3..b539ab9d0 100644 --- a/inter/index-module/Chapter 3/Standards Element.w +++ b/inter/index-module/Chapter 3/Standards Element.w @@ -57,6 +57,8 @@ void StandardsElement::render(OUTPUT_STREAM, index_session *session) { IndexRules::find_rulebook(inv, I"GLK_OBJECT_UPDATING_RB"), NULL, 1, TRUE, session); IndexRules::rulebook_box(OUT, inv, I"Index.Elements.St.GlkEventHandlingRules", NULL, IndexRules::find_rulebook(inv, I"GLK_EVENT_HANDLING_RB"), NULL, 1, TRUE, session); + IndexRules::rulebook_box(OUT, inv, I"Index.Elements.St.HyperlinkHandlingRules", NULL, + IndexRules::find_rulebook(inv, I"HYPERLINK_HANDLING_RB"), NULL, 1, TRUE, session); @ = StandardsElement::subhead(OUT, LD, From 4151e0c26132267d9843f661d050a63debd1e79b Mon Sep 17 00:00:00 2001 From: Dannii Willis Date: Sat, 27 Jul 2024 13:54:30 +1000 Subject: [PATCH 3/5] Add some type safety to the hyperlink framework --- .../Inter/Architecture32Kit/Sections/Glk.i6t | 28 ++++++++++++++++++- .../Source/Sections/Glulx and Glk.w | 28 +++++++++---------- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/Glk.i6t b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/Glk.i6t index d8c9eaade..b5899ff0a 100644 --- a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/Glk.i6t +++ b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/Glk.i6t @@ -745,6 +745,10 @@ A simple framework for handling hyperlinks in an interoperable manner. We combine a hyperlink tag with a payload in one 32-bit value. The tag is stored in the lowest bits, and the payload above it. +|CALCULATE_HYPERLINK_TAG_WIDTH_R| is a |before starting the virtual machine| rule, +which gets the number of options in the hyperlink tag enum and sets the tag/payload +masks and widths accordingly. + = Global hyperlink_payload_mask; Global hyperlink_tag_mask; @@ -769,8 +773,30 @@ Global hyperlink_value; rfalse; ]; -[ MakeTaggedHyperlink tag val; +@ |MakeTaggedHyperlink| combines the tag and value into one 32 bit hyperlink ID, +checking that the value is not a pointer to ephemeral data (on the stack). + +|HANDLE_HYPERLINK_R| then extracts tag and value from an ID, expanding the value +back to 32 bits. + += + +[ MakeTaggedHyperlink tag val kind; if (Cached_Glk_Gestalts-->gestalt_Hyperlinks) { + #Ifdef DEBUG; + if (val >= blockv_stack && val < (blockv_stack + BLOCKV_STACK_SIZE * WORDSIZE)) { + if (kind) { + if (KindConformsTo_POINTER_VALUE_TY(kind)) { + ! Break up the message so that Inform doesn't think it's an Inter invocation + print "Error: cannot make hyperlink from ephemeral value; try creating with {", "-by-reference:V}^"; + return; + } + } + else { + print "Warning: hyperlink value might be ephemeral; try creating with explicit kind^"; + } + } + #Endif; ! DEBUG if (val > 0) { @shiftl val hyperlink_tag_width val; } diff --git a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Glulx and Glk.w b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Glulx and Glk.w index df9a7dc64..b67e0f3ce 100644 --- a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Glulx and Glk.w +++ b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Glulx and Glk.w @@ -203,18 +203,24 @@ Chapter - Hyperlinks A hyperlink tag is a kind of value. -The hyperlink value is a number variable. -The hyperlink value variable is defined by Inter as "hyperlink_value". - The hyperlink handling rules is a hyperlink tag based rulebook. The hyperlink handling rules is accessible to Inter as "HYPERLINK_HANDLING_RB". The handle hyperlinks rule is listed in the glk event handling rules. The handle hyperlinks rule is defined by Inter as "HANDLE_HYPERLINK_R". +To say link (T - hyperlink tag): + (- MakeTaggedHyperlink({T}); -). + +To say link (T - hyperlink tag) of (V - value of kind K): + (- MakeTaggedHyperlink({T}, {-by-reference:V}, {-strong-kind:K}); -). + To say end link: (- if (Cached_Glk_Gestalts-->gestalt_Hyperlinks) { glk_set_hyperlink(0); } -). +To decide what K is hyperlink value as a/an (name of kind of value K): + (- (hyperlink_value) -). + @ And some built-in hyperlink tags: - A rule hyperlink runs a rule when clicked; that in turn allows you to run any other code you like. @@ -225,26 +231,18 @@ To say end link: Rule hyperlink is a hyperlink tag. To say link (R - rule): - (- MakeTaggedHyperlink((+ rule hyperlink +), {R}); -). + (- MakeTaggedHyperlink((+ rule hyperlink +), {-by-reference:R}, RULE_TY); -). Hyperlink handling rule for a rule hyperlink (this is the rule hyperlink rule): - run rule at address hyperlink value; + follow hyperlink value as a rule; Keypress hyperlink is a hyperlink tag. To say link (C - unicode character): - (- MakeTaggedHyperlink((+ keypress hyperlink +), {C}); -). + (- MakeTaggedHyperlink((+ keypress hyperlink +), {-by-reference:C}, UNICODE_CHARACTER_TY); -). Hyperlink handling rule for a keypress hyperlink (this is the keypress hyperlink rule): - process a character event for (hyperlink value of the current glk event as a unicode character) in (window of the current glk event); - -Section - unindexed - -To run rule at address (R - number): - (- ({R})(); -). - -To decide what unicode character is (N - number) as a unicode character: - (- ({N}) -). + process a character event for (hyperlink value as a unicode character) in (window of the current glk event); @h Suspending input. These properties and phrases allow the author to suspend and resume input requests. From ffe5a43c59b2d7c787066b20e57167191d8b6a86 Mon Sep 17 00:00:00 2001 From: Dannii Willis Date: Sun, 11 Aug 2024 17:40:17 +1000 Subject: [PATCH 4/5] If we're always requesting hyperlinks then we don't have to track it --- .../Inter/Architecture32Kit/Sections/Glk.i6t | 23 +------------------ .../Architecture32Kit/Sections/InfGlk.i6t | 22 +++++++++--------- .../Source/Sections/Glulx and Glk.w | 4 +--- 3 files changed, 13 insertions(+), 36 deletions(-) diff --git a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/Glk.i6t b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/Glk.i6t index b5899ff0a..08f077bf9 100644 --- a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/Glk.i6t +++ b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/Glk.i6t @@ -479,7 +479,7 @@ be used by |glk_select|. It also handles a few event maintenance tasks. evtype_MouseInput: win_obj.requesting_mouse = false; evtype_Hyperlink: - win_obj.requesting_hyperlink = false; + glk_request_hyperlink_event(win_obj.glk_ref); } return ev; ]; @@ -633,16 +633,6 @@ requested. return 0; ]; -[ glk_cancel_hyperlink_event win win_obj; - @push win; - @glk 259 1 0; - win_obj = FindGlkWindowFromRefNum(win); - if (win_obj) { - win_obj.requesting_hyperlink = false; - } - return 0; -]; - [ glk_cancel_line_event win event_struct win_obj; if (event_struct == 0) { event_struct = gg_arguments; @@ -688,16 +678,6 @@ requested. return 0; ]; -[ glk_request_hyperlink_event win win_obj; - @push win; - @glk 258 1 0; - win_obj = FindGlkWindowFromRefNum(win); - if (win_obj) { - win_obj.requesting_hyperlink = true; - } - return 0; -]; - [ glk_request_line_event win buf maxlen initlen win_obj; @push initlen; @push maxlen; @@ -810,7 +790,6 @@ back to 32 bits. [ HANDLE_HYPERLINK_R val; if (current_glk_event-->GLK_EVENT_TYPE_SF == evtype_Hyperlink) { val = current_glk_event-->GLK_EVENT_VALUE1_SF; - glk_request_hyperlink_event((current_glk_event-->GLK_EVENT_WINDOW_SF).glk_ref); hyperlink_value = val & hyperlink_payload_mask; if (hyperlink_value < 0) { hyperlink_value = hyperlink_value | hyperlink_tag_mask; diff --git a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/InfGlk.i6t b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/InfGlk.i6t index 011d5af3b..5bb7d391a 100644 --- a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/InfGlk.i6t +++ b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Materials/Inter/Architecture32Kit/Sections/InfGlk.i6t @@ -690,17 +690,17 @@ Constant wintype_TextGrid = 4; return 0; ]; -![ glk_request_hyperlink_event _vararg_count; -! ! glk_request_hyperlink_event(window) -! @glk 258 _vararg_count 0; -! return 0; -!]; +[ glk_request_hyperlink_event _vararg_count; + ! glk_request_hyperlink_event(window) + @glk 258 _vararg_count 0; + return 0; +]; -![ glk_cancel_hyperlink_event _vararg_count; -! ! glk_cancel_hyperlink_event(window) -! @glk 259 _vararg_count 0; -! return 0; -!]; +[ glk_cancel_hyperlink_event _vararg_count; + ! glk_cancel_hyperlink_event(window) + @glk 259 _vararg_count 0; + return 0; +]; [ glk_buffer_to_lower_case_uni _vararg_count ret; ! glk_buffer_to_lower_case_uni(uintarray, arraylen, uint) => uint @@ -921,4 +921,4 @@ Constant zcolor_Current = -2; ! garglk_set_reversevideo_stream(str, reverse) @glk $1103 _vararg_count 0; return 0; -]; \ No newline at end of file +]; diff --git a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Glulx and Glk.w b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Glulx and Glk.w index b67e0f3ce..37416f24e 100644 --- a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Glulx and Glk.w +++ b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Glulx and Glk.w @@ -212,7 +212,7 @@ The handle hyperlinks rule is defined by Inter as "HANDLE_HYPERLINK_R". To say link (T - hyperlink tag): (- MakeTaggedHyperlink({T}); -). -To say link (T - hyperlink tag) of (V - value of kind K): +To say link (T - hyperlink tag) for/of/with (V - value of kind K): (- MakeTaggedHyperlink({T}, {-by-reference:V}, {-strong-kind:K}); -). To say end link: @@ -252,8 +252,6 @@ Chapter - Suspending and resuming input A glk window has a text input status. The text input status property translates into Inter as "text_input_status". -A glk window can be requesting hyperlink input. -The requesting hyperlink input property translates into Inter as "requesting_hyperlink". A glk window can be requesting mouse input. The requesting mouse input property translates into Inter as "requesting_mouse". From 68548384d190ba76e5f1db4764fa7cd0ce538ef7 Mon Sep 17 00:00:00 2001 From: Dannii Willis Date: Sat, 3 Jan 2026 17:42:31 +1000 Subject: [PATCH 5/5] Minor updates for changes to Inform --- .editorconfig | 8 +++++++- .../Basic Inform.i7xd/Source/Sections/Glulx and Glk.w | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index c3bd687a7..f246a51a4 100644 --- a/.editorconfig +++ b/.editorconfig @@ -17,4 +17,10 @@ insert_final_newline = true [*.json] indent_style = space -indent_size = 4 \ No newline at end of file +indent_size = 4 + +[inform7/Tests/Test Cases/*.txt] +indent_style = tab + +[resources/Documentation/**.txt] +indent_style = tab \ No newline at end of file diff --git a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Glulx and Glk.w b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Glulx and Glk.w index 37416f24e..d17348632 100644 --- a/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Glulx and Glk.w +++ b/inform7/Internal/Extensions/Graham Nelson/Basic Inform.i7xd/Source/Sections/Glulx and Glk.w @@ -242,7 +242,7 @@ To say link (C - unicode character): (- MakeTaggedHyperlink((+ keypress hyperlink +), {-by-reference:C}, UNICODE_CHARACTER_TY); -). Hyperlink handling rule for a keypress hyperlink (this is the keypress hyperlink rule): - process a character event for (hyperlink value as a unicode character) in (window of the current glk event); + replace current event with a character event with (hyperlink value as a unicode character) in (window of the current glk event initialiser); @h Suspending input. These properties and phrases allow the author to suspend and resume input requests.