IF WalnutWindowImpl.walnut =
NIL
THEN
startPos← WalnutLog.InitializeLog[WalnutWindow.walnutLogName] -- set up WalnutDB & log
ELSE {
WalnutExtras.InternalChangeMenu[WalnutWindow.workingMenu];
WalnutLog.MarkWalnutTransaction[]; -- get in a good state
startPos← WalnutLog.LogLength[TRUE];
};
WHILE mfp #
NIL
DO
fName: ROPE ← mfp.first;
fullFName: ROPE;
cp: FS.ComponentPositions;
msName: ROPE;
defaultPrefix: ROPE;
peanutFile: TextNode.Ref;
[fullFName, cp] ← FS.ExpandName[fName];
msName ← fullFName.Substr[cp.base.start, cp.base.length];
defaultPrefix ← Rope.Cat["Categories: ", msName, "\n"];
peanutFile ← PutGet.FromFile[fileName: fName];
WalnutWindow.Report["\nReading Peanut messages from ", fName, "... "];
IF ~ReadMessages[peanutFile, defaultPrefix]
THEN {
WalnutWindow.Report["There were problems reading ", fName];
WalnutWindow.Report["Bug Confirm to keep messages successfully read, Deny to throw them away"];
IF ~WalnutWindow.UserConfirmed[]
THEN {
WalnutLog.ResetLogToExpectedLength[]; RETURN};
};
numNew ← WalnutExtrasImpl.GetMessagesFromLog[startPos];
IF numNew = 0
THEN
WalnutWindow.Report[" No messages in ", fName, " were new"]
ELSE WalnutWindow.Report[
IO.PutFR[
"%g new messages from %g were added to database", IO.int[numNew], IO.rope[fName]]];
startPos ← WalnutLog.LogLength[doFlush: TRUE];
WalnutLog.MarkWalnutTransaction[];
mfp ← mfp.rest;
ENDLOOP;