Files
fpc-msgbase/tests
Ken Johnson 57a6c1d854 Milestone 0.3.1 (partial): HWM for Squish
Adds Squish HWM via the .SQL lastread file (CRC32-keyed by
lowercased username, identical layout to JAM's .JLR per
Squish.doc).

src/formats/ma.fmt.squish.pas:
- New SqLastRead record type matching the Squish.doc spec.
- TSquishBase gains FSqlStream (lazy) + EnsureSqlStream +
  GetLastRead/GetHighRead/SetLastRead methods, mirroring JAM's
  .JLR pattern.
- Close releases the lastread stream alongside .SQD/.SQI.

src/formats/ma.fmt.squish.uni.pas:
- TSquishMessageBase wires DoGetHWMByName / DoSetHWMByName,
  reusing TJamBase.CalcUserCRC for the (shared) CRC32 algorithm.
- DoSetHWMByName preserves HighReadMsg monotonicity.

src/ma.lock.pas:
- TMessageLock gains optional APreserveSentinel constructor flag.
- Release no longer unlinks the sentinel when the flag is set.
- Required for Squish because the .SQL file is BOTH the lock
  sentinel and the lastread store; deleting it on lock release
  would wipe HWM data on every Open/Close cycle.

src/ma.api.pas:
- TMessageBase.Create passes APreserveSentinel = (Format = mbfSquish).

src/formats/ma.fmt.squish.pas (low-level open):
- EnsureSqlStream uses fpOpen directly on Unix instead of FPC's
  FileOpen wrapper. FileOpen defaults to a fpflock that conflicts
  with ma.lock's existing advisory lock on the same file (EAGAIN
  on every attempt). fpOpen bypasses the auto-flock; cross-process
  safety lives in ma.lock and doesn't need duplicating here.

tests/test_hwm.pas:
- New SeedSquish helper.
- TestSquishCapability + TestSquishSetGetPersistence verify
  capability flag, set/get round-trip, multi-user independence,
  and persistence across Open/Close.

Hudson, GoldBase and EzyCom were originally scoped for this
milestone but their per-(user, board) lastread layout needs more
design work (the LASTREAD.BBS format is shared across all 200
boards in a single per-user record, and TMessageBase doesn't
carry a "board" context). Deferred to a follow-up milestone.
Wildcat (SDK call) coming in 0.3.2.

Suite: 38/38 across 9 programs (test_hwm now 9/9 with Squish
coverage).
2026-04-17 16:01:38 -07:00
..