Skip to content

Replace 3-arg BoolToStr with StrUtils.IfThen in auth status - #13

Merged
FMXExpress merged 1 commit into
mainfrom
claude/pr13-cmd-auth-types
May 27, 2026
Merged

FMXExpress merged 1 commit into
mainfrom
claude/pr13-cmd-auth-types

Conversation

@FMXExpress

Copy link
Copy Markdown
Owner

Summary

Fixes [dcc64 Error] PasClaw.Cmd.Auth.pas(34): E2010 Incompatible types: 'Boolean' and 'string'.

Delphi's BoolToStr only has two overloads: (B: Boolean) and (B: Boolean; UseBoolStrs: Boolean). FPC additionally has BoolToStr(B: Boolean; const TrueS, FalseS: string), which is what DoStatus was relying on. Delphi tries to match against the 2-arg overload and fails on the string args.

Swap to StrUtils.IfThen(Condition, TrueStr, FalseStr) — same signature on both compilers, same result.

Test plan

  • Build under Delphi Win64/Linux64: no E2010 on Cmd.Auth.pas
  • Build under FPC 3.2+: still compiles
  • pasclaw auth status prints present / missing per provider

https://claude.ai/code/session_01TBcLtmpj7dqA5tyFbGnQon


Generated by Claude Code

Delphi's BoolToStr only takes (Boolean) or (Boolean, Boolean) — there
is no 3-arg form with custom true/false strings. FPC has one, which is
why the original line compiled under FPC. StrUtils.IfThen has the same
signature on both compilers, so swap to that.

https://claude.ai/code/session_01TBcLtmpj7dqA5tyFbGnQon
@FMXExpress
FMXExpress merged commit 4f95ff4 into main May 27, 2026
FMXExpress pushed a commit that referenced this pull request Jun 12, 2026
Two more cheap wins for fs_grep on top of the tier-1-4 filters
(deferred-hash / blocked-dirs / NUL-sniff / size-cap), this time
in the inner per-file path.

Tier 5 -- walk bytes, not lines. The old ScanFile did:
  - StringReplace(Body, #13, '', [rfReplaceAll])  -- whole-body copy
  - Lines := TStringList.Create / Lines.Text := ... -- one alloc per line
  - LowerCase(Lines[j])                            -- one per match-candidate

None of that's needed. The new walker splits on #10 in place, trims
trailing #13 inline for CRLF, and only Copy()s the line bytes on
lines that actually matched. ~3-5x faster on the per-file path for
typical source files.

Tier 6 -- Boyer-Moore-Horspool substring search. The old Pos(PatLower,
Cmp) advanced one byte at a time. BMH precomputes a 256-entry shift
table once at Tool_FSGrep startup and on a failed alignment slides
the pattern by up to m bytes instead of 1. For the patterns the model
actually queries (TODO, function, class, FIXME, def, return) this
hits ~3-10x fewer text-byte reads than Pos.

Case-insensitive is handled by folding text bytes through a 256-entry
ASCII lower table (built once per call) -- one branch instead of
the old per-line LowerCase(). Pattern is pre-lowered into PatLower
the same way as before.

Output is byte-identical to the old path except:
  - CRLF lines no longer carry a stray #13 in the emitted line text
    (the old StringReplace pass had hidden this; the byte walker
    now trims trailing #13 explicitly).
  - Lone mid-line #13 bytes (extremely rare; old Mac line endings)
    are no longer stripped from output. ripgrep treats them the same
    way -- they're not a line terminator in modern conventions.

Both behaviours are pinned by src/tests/fs_grep_tier5_6_tests.pas
(10 cases): line numbers exact across the walker, CRLF trimming
correct, files without trailing newline still produce a final-line
match, one hashline header per matched file, ignore_case round-trip
through the byte-fold table, BMH overlapping/partial/embedded
patterns, m=1 degenerate case, m > n early exit, empty / newline-
only bodies don't crash, and the hashline ¶path#hash header still
emits in the same shape so fs_edit_hashline downstream still parses
the output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants