From c915489dd7938676d516ba236cdf14838de09ec5 Mon Sep 17 00:00:00 2001 From: Dmitrii Vasilev Date: Sun, 18 Oct 2026 09:36:12 +0700 Subject: [PATCH] specs/t27mcp: examples.t27 uses find and has from check_hints.t27 The two string helpers were copied between the specs, which the duplicate-bodies gate rejects. examples.t27 now has 'use t27mcp::check_hints;' and keeps no copy; t27c gen-c inlines the imported bodies, so the wasm still comes from one C file and answers identically (748 topic_code and pick cases, 0 differences). Co-Authored-By: Claude Opus 5.5 --- specs/t27mcp/examples.t27 | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/specs/t27mcp/examples.t27 b/specs/t27mcp/examples.t27 index 5de96306b6..df9d556dc2 100644 --- a/specs/t27mcp/examples.t27 +++ b/specs/t27mcp/examples.t27 @@ -22,6 +22,8 @@ module T27mcpExamples; +use t27mcp::check_hints; + /// The commit of gHashTag/t27 every row points into. pub const PIN : str = "a18d7ee14a9994ef9dc84dac10e1a2944367d4c5"; @@ -47,7 +49,6 @@ pub const TOPICS : [8]str = [ ]; pub const NO_ROW : u32 = 4294967295; -pub const NO_POS : u32 = 4294967295; pub const MAX_LINES : u32 = 40; pub const ROWS : u32 = 10; @@ -82,31 +83,6 @@ pub const EX_WHY : [10]str = [ "The header states that nothing here is reset: the counters start from their var initialisers." ]; -/// Byte offset of the first occurrence of `needle` in `hay`, or NO_POS. -pub fn find(hay: string, needle: string) -> u32 { - var hn : u32 = (hay.len as u32); - var nn : u32 = (needle.len as u32); - if (nn > hn) { return NO_POS; } - var i : u32 = 0; - while (i <= hn - nn) { - var j : u32 = 0; - var same : u32 = 1; - while (j < nn) { - if ((hay[i + j] as u32) != (needle[j] as u32)) { same = 0; } - j = j + 1; - } - if (same == 1) { return i; } - i = i + 1; - } - return NO_POS; -} - -/// 1 when `needle` occurs in `hay`. -pub fn has(hay: string, needle: string) -> u32 { - if (find(hay, needle) == NO_POS) { return 0; } - return 1; -} - /// The topic a lower-case question is about, or T_NONE. pub fn topic_code(q: string) -> u32 { if (has(q, "reset") == 1) {