Copyright (C) 1985 by Xerox Corporation. All rights reserved.
PSKMessagesImpl.mesa
Last edited by Jacks 13-Dec-85 17:24:19
DIRECTORY
ControlMessages USING [InitMessages],
MsgOps USING [DomainsFromFile, Error],
PrinterStatusMessages USING [InitMessages],
PSExecMessages USING [InitMessages],
PSKMessages,
XMessage USING [DestroyMessages, FreeMsgDomainsStorage, Handle, MsgDomains],
XString USING [Equivalent, FromSTRING, ReaderBody];
PSKMessagesImpl: PROGRAM
IMPORTS
ControlMessages, MsgOps, PrinterStatusMessages, PSExecMessages, XMessage, XString
EXPORTS PSKMessages =
BEGIN
sExecDomain: LONG STRING = "Exec Msgs"L;
sControlDomain: LONG STRING = "Control Msgs"L;
sPrinterStatusDomain: LONG STRING = "Printer Status Msgs"L;
execMsgs, controlMsgs, printerStatusMsgs: XMessage.Handle ¬ NIL;
RegisterMsgs: PROCEDURE =
BEGIN
messageFileAvailable: BOOLEAN ¬ TRUE;
execDomain: XString.ReaderBody ¬ XString.FromSTRING[sExecDomain];
controlDomain: XString.ReaderBody ¬ XString.FromSTRING[sControlDomain];
printerStatusDomain: XString.ReaderBody ¬ XString.FromSTRING[sPrinterStatusDomain];
allDomains: XMessage.MsgDomains;
allDomains ¬ MsgOps.DomainsFromFile[
file: "PrintServiceConfig.messages"L, clientData: NIL, proc: NIL
! MsgOps.Error => {messageFileAvailable ¬ FALSE; CONTINUE}];
IF messageFileAvailable THEN BEGIN
FOR i: CARDINAL IN [0..LENGTH[allDomains]) DO
IF XString.Equivalent[@allDomains[i].applicationName, @execDomain] THEN
execMsgs ¬ allDomains[i].handle;
IF XString.Equivalent[@allDomains[i].applicationName, @controlDomain] THEN
controlMsgs ¬ allDomains[i].handle;
IF XString.Equivalent[@allDomains[i].applicationName, @printerStatusDomain] THEN
printerStatusMsgs ¬ allDomains[i].handle;
ENDLOOP;
XMessage.FreeMsgDomainsStorage[allDomains];
END
ELSE BEGIN
execMsgs ¬ PSExecMessages.InitMessages[];
controlMsgs ¬ ControlMessages.InitMessages[];
printerStatusMsgs ¬ PrinterStatusMessages.InitMessages[];
END;
END; -- of RegisterMsgs
GetHandle: PUBLIC PROCEDURE [domain: PSKMessages.Domain]
RETURNS [XMessage.Handle] =
BEGIN
RETURN [SELECT domain FROM
exec => execMsgs,
control => controlMsgs,
ENDCASE => printerStatusMsgs];
END; -- of GetHandle
Name: PUBLIC PROCEDURE [domain: PSKMessages.Domain]
RETURNS [LONG STRING] =
BEGIN
RETURN [SELECT domain FROM
exec => sExecDomain,
control => sControlDomain,
ENDCASE => sPrinterStatusDomain];
END; -- of Name
DestroyMsgs: PUBLIC PROCEDURE =
BEGIN
XMessage.DestroyMessages[execMsgs];
XMessage.DestroyMessages[controlMsgs];
XMessage.DestroyMessages[printerStatusMsgs];
END; -- of DestroyMsgs
RegisterMsgs[];
END. -- of PSKMessagesImpl
LOG
6-Nov-85 12:55:58 - Jacks - Created.
13-Dec-85 17:23:50 - Jacks - ExecMessages renamed to PSExecMessages.