PSExecInitBImpl.mesa
Copyright (C) Xerox Corporation 1986. All rights reserved.
Last edited by Jacks 21-May-86 12:24:27
Ruseli Binsol: November 7, 1986 1:46:20 pm PST
Client procs proviced to Services Executive by NSExec.CreateClient in PSExecControlImpl (except for Initialize which is in PSExecInitAImpl).
DIRECTORY
NetMgtServiceSupport USING [UnRegisterService],
NSExec USING [ClientID, ClientStatus, DestroyClient, Error, ExecProc, GetTTY, Handle, StopMode, SystemFilingSession, WorkingDirectory],
NSFile USING [Handle, Session],
NSString USING [nullString, String],
PSCommand USING [GetPrintServiceStatus, Start, Stop],
PSCommandExtras USING [ServiceState],
PSExec USING [GetClientID],
PSExecInternal USING [DeleteServiceFromClearinghouse, printServiceName],
PSExecMessages USING [Key],
PSInit USING [ExpungePrintService],
PSKMessages USING [DestroyMsgs, GetHandle],
TextInput USING [Confirm, GetTimedYesNo],
TTY USING [Rubout],
XMessage USING [Get, Handle],
XString USING [ReaderBody];
PSExecInitBImpl: CEDAR PROGRAM
IMPORTS NetMgtServiceSupport, NSExec, PSCommand, PSCommandExtras, PSExec, PSExecInternal, PSInit, PSKMessages, TextInput, TTY, XMessage
EXPORTS PSExecInternal
SHARES XString = BEGIN
Message domain handle:
execMsgs: XMessage.Handle ← PSKMessages.GetHandle[exec];
Start: PUBLIC NSExec.ExecProc = {PSCommand.Start[]};
Stop: PUBLIC PROCEDURE [exec: NSExec.Handle, stopMode: NSExec.StopMode] = BEGIN
If not a cold quit and we are in repair mode, the user is prompted to confirm stopping the print service. If for some reason no one can provide confirmation at the TTY window, stopping is aborted.
ENABLE BEGIN
TTY.Rubout => GOTO Exit;
NSExec.Error => IF type = invalidExec THEN GOTO Exit;
END;
IF stopMode = quiesce AND
(PSCommand.GetPrintServiceStatus[].mode.current = repair) THEN
IF TextInput.GetTimedYesNo [
tty: NSExec.GetTTY[exec], prompt: M[mPrintServerinRepairMode],
timeAllotted: 60--seconds--, valueIfTimedOut: no] = no
THEN RETURN;
PSCommand.Stop[];
EXITS Exit => NULL;
END; --Stop
Expunge: PUBLIC NSExec.ExecProc = BEGIN
psClientID: NSExec.ClientID ← PSExec.GetClientID[];
servicesWorkDir: NSFile.Handle ← NSExec.WorkingDirectory[];
servicesSession: NSFile.Session ← NSExec.SystemFilingSession[];
IF TextInput.Confirm[NSExec.GetTTY[exec], M[mExpungeWarning]] THEN BEGIN
[] ← PSExecInternal.DeleteServiceFromClearinghouse[exec];
PSInit.ExpungePrintService[deleteFonts: TRUE];
PSKMessages.DestroyMsgs[];
NetMgtServiceSupport.UnRegisterService[psClientID];
NSExec.DestroyClient[psClientID];
END
ELSE ERROR NSExec.Error[cannotExpunge];
END; --Expunge
Name: PUBLIC PROCEDURE [nameProc: PROCEDURE [clientName: NSString.String]] = BEGIN
IF PSExecInternal.printServiceName # NIL THEN
nameProc[PSExecInternal.printServiceName.local]
ELSE nameProc[M[mNull]];
END; --Name
Status: PUBLIC PROCEDURE [
statusProc: PROCEDURE [status: NSExec.ClientStatus, comment: NSString.String]] = BEGIN
statusProc[status: SELECT PSCommandExtras.ServiceState[] FROM
starting => starting, stopped => stopped,
stopping => stopping, ENDCASE => started,
comment: NSString.nullString];
END; --Status
PrintServiceCommand: PUBLIC NSExec.ExecProc = BEGIN
called whenever "Print Service" command is entered
END;
Proc for getting NSString from XMessage key
M: PROCEDURE [key: PSExecMessages.Key]
RETURNS [string: NSString.String] = {
r: XString.ReaderBody ← XMessage.Get[execMsgs, ORD[key]];
string ← [bytes: LOOPHOLE[r.bytes], length: r.limit, maxlength: r.limit]};
END. -- of PSExecInitBImpl
LOG
21-May-86 12:18:25 - Jacks - Created (split up PSExecInitImpl).