Files
fpc-msgbase/tests/tools/verify_hudson_sample.pas
Ken Johnson 0fe57b846d Rename ma.* -> mb.* namespace (cosmetic, breaking)
Across-the-board rename so the unit prefix matches the repo
name (mb = msgbase).  Brings naming into line with
fpc-ftn-transport's tt.* prefix and avoids the historical
"ma" abbreviation that meant nothing to new readers.

Files renamed via git mv:
  src/ma.{api,events,kludge,lock,paths,types}.pas
    -> src/mb.{...}.pas
  src/formats/ma.fmt.{jam,squish,hudson,msg,pcboard,ezycom,
                      goldbase,wildcat,wcutil}{,.uni}.pas
    -> src/formats/mb.fmt.*.pas

All `unit ma.X` declarations and `uses ma.X` clauses rewritten
to `mb.X` across src/, examples/, tests/.

Suite: 47/47 (read 7, hwm 11, lock 4, pack 4, write 5,
wildcat 5, consumer_round1 5, batch's gone w/ PKT relocation,
plus testutil).

Consumer impact: anyone with `uses ma.api;` etc. needs to
update to `uses mb.api;`. No semantic changes; a search/replace
on the consumer's source tree is the only migration step.
NR's notes (~/.MSGAPI_MSGS.md round 3) align this against
their already-pinned 8130b40; the next NR pin bump rolls in
both this rename and any further work in one step.
2026-04-18 13:19:15 -07:00

89 lines
2.3 KiB
ObjectPascal

{
verify_hudson_sample.pas - read back the Hudson sample base
generated by make_hudson_sample.pas and verify per-board counts
match the CONFERENCES.TXT manifest.
Usage: ./verify_hudson_sample (reads /tmp/ma_hudson_sample)
}
program verify_hudson_sample;
{$mode objfpc}{$H+}
uses
SysUtils, Classes,
mb.types, mb.events, mb.api,
mb.fmt.hudson, mb.fmt.hudson.uni;
const
HUDSON_DIR = '/tmp/ma_hudson_sample';
var
hudson: TMessageBase;
adapter: THudsonMessageBase;
msg: TUniMessage;
i, total: longint;
boardCounts: array[0..200] of longint;
b: integer;
manifest: TStringList;
begin
if not FileExists(HUDSON_DIR + '/CONFERENCES.TXT') then begin
WriteLn('error: ', HUDSON_DIR, '/CONFERENCES.TXT not found.');
WriteLn('Run make_hudson_sample first.');
Halt(1);
end;
hudson := MessageBaseOpen(mbfHudson, HUDSON_DIR, momReadOnly);
adapter := hudson as THudsonMessageBase;
try
if not hudson.Open then begin
WriteLn('error: Open failed');
Halt(1);
end;
total := hudson.MessageCount;
WriteLn('Hudson base at ', HUDSON_DIR);
WriteLn(' total messages: ', total);
WriteLn(' MSGINFO.HighMsg: ', adapter.Native.Info.HighMsg);
WriteLn;
for b := 0 to 200 do boardCounts[b] := 0;
for i := 0 to total - 1 do begin
if hudson.ReadMessage(i, msg) then begin
if msg.Board <= 200 then
Inc(boardCounts[msg.Board]);
end;
end;
WriteLn('Per-board breakdown:');
WriteLn(' board count first message subject');
for b := 1 to 20 do begin
if boardCounts[b] = 0 then continue;
{ Find first message on this board and print its subject. }
for i := 0 to total - 1 do
if hudson.ReadMessage(i, msg) then
if msg.Board = b then begin
WriteLn(SysUtils.Format(' %5d %5d %s',
[b, boardCounts[b], Copy(msg.Subject, 1, 55)]));
break;
end;
end;
WriteLn;
WriteLn('Manifest says:');
manifest := TStringList.Create;
try
manifest.LoadFromFile(HUDSON_DIR + '/CONFERENCES.TXT');
for i := 0 to manifest.Count - 1 do
if (manifest[i] <> '') and (manifest[i][1] <> '#') then
WriteLn(' ', manifest[i]);
finally
manifest.Free;
end;
finally
hudson.Close;
hudson.Free;
end;
end.