From 41e8d49142998fca1751ef6c30e4ce4fe8bc027c Mon Sep 17 00:00:00 2001 From: Aleteoryx Date: Tue, 16 Sep 2025 01:45:42 -0400 Subject: [PATCH] BITAP --- grep.tal | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/grep.tal b/grep.tal index 141017771e594cfc0c9f81c36eed6ea21dcb4b2b..cebae3a45a33eabc1a67d47b1cb390aecc294e18 100644 --- a/grep.tal +++ b/grep.tal @@ -1,7 +1,7 @@ ( grep.tal by aleteoryx, all rights released - an implementation of the bezza-yates-gonet "shift-or" bitlap + an implementation of the bezza-yates-gonet "shift-or" bitap search algorithm, for fixed search patterns up to 16 bytes ) @@ -25,7 +25,7 @@ "grep.rom 0a "aleteoryx, 20 "all 20 "rights 20 "released 0a0a - "bezza-yates-gonet 20 ""bitlap" 20 "text 20 "search 0a00 + "bezza-yates-gonet 20 ""bitap" 20 "text 20 "search 0a00 @args ( -> ) #17 DEI @@ -37,10 +37,10 @@ ( we need to shift state up 10 - lut/len bits before orring it with match, this is where that's calculated. ) ;lut/len LDA2 SUB ( the high byte will be 00 ) - ;bitlap/sft STA + ;bitap/sft STA - ;bitlap/in #10 DEO2 - [ LITr 80 ] #ffff ( prep the stack for bitlap/in ) + ;bitap/in #10 DEO2 + [ LITr 80 ] #ffff ( prep the stack for bitap/in ) BRK @@ -62,7 +62,7 @@ ( --- check for a match --- ) -@bitlap/in ( state* `match -> state* `match ) +@bitap/in ( state* `match -> state* `match ) ( handle the line buffer ) #0a12 DEI DUP ( get char, save a byte later ) [ LIT2 &ptr =/line ] ( line pointer ) @@ -80,7 +80,7 @@ DUP2 [ LIT &sft $1 ] SFT2 POP STH ANDr BRK -@bitlap/newline ( state* `match -> state* `match ) +@bitap/newline ( state* `match -> state* `match ) ;/line ,/ptr STR2 ( reset line ptr ) POP2 #ffff ( reset state ) STHr [ LITr 80 ] ( reset match ) @@ -121,4 +121,4 @@ @lut ( ... ) $200 ( ... ) @lut/end -@bitlap/line ( the incoming line gets written here ) +@bitap/line ( the incoming line gets written here )