MsgOpsImpl.mesa
Copyright (C) 1985, 1986 by Xerox Corporation. All rights reserved.
Last revised by McManis on: 17-Oct-85 15:19:20
Tim Diebert: December 3, 1986 8:46:28 am PST
DIRECTORY
FS USING [Error, FileInfo],
MsgOps USING [ErrorType],
NSExec USING [WorkingDirectory],
NSString USING [EqualString],
Rope USING [ROPE, ToRefText],
XMessage USING [ClientData, DestroyMessages, DestroyMsgsProc, FreeMsgDomainsStorage, Handle, MessagesFromReference, MsgDomains, Object];
MsgOpsImpl: CEDAR PROGRAM
IMPORTS
FS, NSExec, NSString, Rope, XMessage
EXPORTS MsgOps = BEGIN
ROPE: TYPE ~ Rope.ROPE;
Error: PUBLIC ERROR [type: MsgOps.ErrorType] = CODE;
DomainsFromFile: PUBLIC PROCEDURE [file: ROPE, clientData: XMessage.ClientData,
proc: XMessage.DestroyMsgsProc] RETURNS [domains: REF XMessage.MsgDomains] = BEGIN
fileNotFound: BOOLEANFALSE;
msgFile: ROPE;
msgFile ← FS.FileInfo[name: file, wDir: NSExec.WorkingDirectory[]
! FS.Error => {fileNotFound ← TRUE; CONTINUE}].fullFName;
IF fileNotFound THEN ERROR Error[fileNotFound];
domains ← XMessage.MessagesFromReference[
msgFile, clientData, proc];
END; -- DomainsFromFile
HandleFromFile: PUBLIC PROCEDURE [file, domainName: ROPE, clientData: XMessage.ClientData,
proc: XMessage.DestroyMsgsProc] RETURNS [h: XMessage.Handle] = BEGIN
domains: REF XMessage.MsgDomains ← DomainsFromFile[file, clientData, proc];
FOR i: CARDINAL IN [0..domains.length) DO
IF NSString.EqualString[domains.data[i].applicationName, Rope.ToRefText[domainName]] THEN {
h ← domains.data[i].handle; EXIT};
REPEAT
FINISHED => {
FOR i: CARDINAL IN [0..domains.length) DO
XMessage.DestroyMessages[domains.data[i].handle]; ENDLOOP;
XMessage.FreeMsgDomainsStorage[domains];
ERROR Error[noSuchDomain]};
ENDLOOP;
destroy all of the "unused" messages
FOR i: CARDINAL IN [0..domains.length) DO
IF domains.data[i].handle # h THEN
XMessage.DestroyMessages[domains.data[i].handle];
ENDLOOP;
XMessage.FreeMsgDomainsStorage[domains];
END; -- HandleFromFile
END.
Log [Time - Person - Action]
10-Jun-85 13:29:43 - McManis - Created for testing. Actual impls will be filled in later.
14-Jun-85 9:42:19 - McManis - Added actual impls for DomainsFromFile, HandleFromFile, Compose, and ComposeOne.
27-Jun-85 23:20:22 - McManis - Added TotalTimeMsg and ElapsedTimeMsg (impls were taken from IRSUtilityImpl GetTotalTimeString and GetTimeDifferenceString)
1-Jul-85 9:52:44 - McManis - Moved ServiceNameFromFile to NSExecEImpl because it depended on installation.
26-Jul-85 14:21:06 - McManis - Renamed StubErrors to MsgOpsMsgs per change to SCSMsgs.
17-Oct-85 15:19:16 - McManis - Fix cleanup code in HandleFromFile to destroy messages before raising error, or to destroy "unused" messages.