PSExecDImpl.mesa
Copyright (C) Xerox Corporation 1984, 1985. All rights reserved.
Last edited by Jacks 13-Dec-85 16:45:30
Ruseli Binsol: December 12, 1986 1:58:40 pm PST
Implements Show Status and Query Target Print Service.
DIRECTORY
BootSwitch USING [Set, useTeleDebugger],
CHNameP2V0 USING [maxDomainLength, maxObjectLength, maxOrganizationLength, Name],
File USING [SystemVolume],
MiscUtilities USING [KeyForBansheeStatus, KeyForCommunicationStatus, KeyForRavenStatus],
NSExec USING [CheckForAbort, Error, ExecProc, Handle, OutputHandle, UserAServerSA],
NSString USING [AppendDecimal, AppendLongDecimal, FreeString, String],
NSVolumeControl USING [GetSpaceAttributes],
PaperTypes USING [PaperSize],
PaperTypesExtras USING [bansheeDlEnvelope],
PSActivity USING [Basic, Printer, Spooler],
PSAsyncMsg USING [Msg],
PSCommand USING [GetPrintServiceActivity, GetPrintServiceStatus],
PSExecInternal USING [ExpandKeyAndPrint, printServiceName],
PSExecMessages USING [Key],
PSInit USING [unlimitedPrintingCutOffMemSize],
PSKMessages USING [GetHandle],
PSState USING [CurrentActivity, StateHandle],
PSVolume USING [GetUserVolID],
Rope USING [ToRefText],
SpecialSpace USING [realMemorySize],
TargetPSStatus USING [Current],
XFormat USING [Blanks, Date, Handle, NSLine, NSString, NSStringObject],
XMessage USING [Compose, Get, Handle, StringArray];
PSExecDImpl: CEDAR PROGRAM
IMPORTS MiscUtilities, NSExec, NSString, PSCommand, PSExecInternal, PSKMessages, Rope, XFormat, XMessage
EXPORTS PSExecInternal
SHARES NSString = BEGIN
nsNil: NSString.String = NIL;
tab0: CARDINAL = 2;
tab1: CARDINAL = 4;
tab2: CARDINAL = 6;
tab3: CARDINAL = 8;
Message domain handle:
execMsgs: XMessage.Handle ← PSKMessages.GetHandle[exec];
DisplayPrintServiceStatus: PUBLIC NSExec.ExecProc = BEGIN
ENABLE NSExec.Error => IF type = invalidExec THEN GOTO Exit;
state: PSState.StateHandle ← PSCommand.GetPrintServiceStatus[];
activity: PSState.CurrentActivity ← PSCommand.GetPrintServiceActivity[];
showInternalState: BOOLEAN ← NSExec.UserAServerSA[exec];
DisplayBasicStatus[exec, state, showInternalState];
IF NSExec.CheckForAbort[exec] THEN GOTO Exit;
IF showInternalState THEN ShowVolumeStatus[exec, activity];
IF NSExec.CheckForAbort[exec] THEN GOTO Exit;
DisplayOptionSpecificStatus[exec, state, activity, showInternalState];
IF NSExec.CheckForAbort[exec] THEN GOTO Exit;
DisplayStats[exec, state, showInternalState];
EXITS Exit => NULL;
END; --DisplayPrintServiceStatus
QueryTargetPrintService: PUBLIC NSExec.ExecProc = TRUSTED BEGIN
ENABLE NSExec.Error => IF type = invalidExec THEN GOTO Exit;
outputHandle: XFormat.Handle ← NSExec.OutputHandle[exec];
stringArray: REF XMessage.StringArray ← NEW [XMessage.StringArray[2]];
state: PSState.StateHandle ← PSCommand.GetPrintServiceStatus[];
WITH s: state SELECT FROM
feps9700 =>
IF s.targetPSAddress = XNS.nullNetworkAddress THEN BEGIN
The target has not been set; display error msg...
stringArray[0] ← M[mTargetNotSet];
PSExecInternal.ExpandKeyAndPrint[exec, mQueryError, DESCRIPTOR[BASE[stringArray], 1]];
END
ELSE TRUSTED BEGIN --display target status and properties
freeThisString: NSString.String;
freeString: BOOLEANFALSE;
targetName: CHName.Name ← LOOPHOLE[@s.targetPSName.record];
targetActivity: TargetPSStatus.Current ← [];
targetProperties: TargetPSStatus.Properties ← [];
sNetAddress: LONG STRING ← [40];
nsNetAddress: NSString.String ← NEW[TEXT[40]];
nsNetAddressObject: XFormat.Handle ← XFormat.NSStringObject[nsNetAddress];
IF targetName.local.length # 0 THEN BEGIN
"Clearinghouse name:..."
targetNameString: NSString.String ← NSString.MakeString[bytes: CHName.maxOrganizationLength +
CHName.maxDomainLength + CHName.maxObjectLength + 5];
targetNameString ← CHName.AppendString[
s: targetNameString, name: targetName];
stringArray[0] ← targetNameString;
outputHandle.Blanks[tab3];
PSExecInternal.ExpandKeyAndPrint[exec, mCHName, stringArray];
NSString.FreeString[targetNameString];
END;
"Network address:..."
XFormat.NetworkAddress[h: nsNetAddressObject,
networkAddress: s.targetPSAddress, format: productSoftware]; --appends net address string to nsNetAddress
stringArray[0] ← nsNetAddress;
outputHandle.Blanks[tab3];
PSExecInternal.ExpandKeyAndPrint[exec, mNetAddress, stringArray];
Call PSCommand for target status...
[targetActivity, targetProperties] ← PSCommand.GetTargetPSStatus[
! PSCommand.Error => BEGIN --display error message and exit
WITH problem SELECT FROM
targetPSNotSet => stringArray[0] ← M[mTargetNotSet];
targetPS => stringArray[0] ← MGeneric[MiscUtilities.KeyForCommunicationStatus[what]];
ENDCASE => stringArray[0] ← M[mUnknownProblem];
PSExecInternal.ExpandKeyAndPrint[exec, mQueryError, stringArray];
GOTO Exit;
END
];
"Spooler:..."
stringArray[0] ← StringForSpoolerActivity[targetActivity.spooler];
outputHandle.Blanks[tab3];
PSExecInternal.ExpandKeyAndPrint[exec, mSpooler, stringArray];
"Formatter:..."
stringArray[0] ← StringForActivity[targetActivity.formatter];
outputHandle.Blanks[tab3];
PSExecInternal.ExpandKeyAndPrint[exec, mFormatter, stringArray];
"Printer:..."
stringArray[0] ← StringForPrinterActivity[targetActivity.printer];
outputHandle.Blanks[tab3];
PSExecInternal.ExpandKeyAndPrint[exec, mPrinter, stringArray];
outputHandle.CR[];
"Paper size(s):..."
stringArray[0] ← StringForPaper[targetActivity.paperSupply.size1];
If second paper size # max (target has two paper sizes)
and size one # size two, display two paper sizes...
IF targetActivity.paperSupply.size2 # max AND
targetActivity.paperSupply.size1 # targetActivity.paperSupply.size2 THEN BEGIN
stringArray[1] ← StringForPaper[targetActivity.paperSupply.size2];
freeThisString ← XMessage.Compose[M[mOneCommaTwo], stringArray];
freeString ← TRUE;
stringArray[0] ← freeThisString;
END;
outputHandle.Blanks[tab3];
PSExecInternal.ExpandKeyAndPrint[exec, mPaper, stringArray];
IF freeString THEN
NSString.FreeString[freeThisString];
"Two-sided copy:..."
stringArray[0] ← M[IF targetProperties.twoSided THEN mAvailable ELSE mUnavailable];
outputHandle.Blanks[tab3];
PSExecInternal.ExpandKeyAndPrint[exec, mTwoSidedCopy, stringArray];
"Stapling:..."
stringArray[0] ← M[IF targetProperties.staple THEN mAvailable ELSE mUnavailable];
outputHandle.Blanks[tab3];
PSExecInternal.ExpandKeyAndPrint[exec, mStapling, stringArray];
END;
ENDCASE => ERROR;
EXITS Exit => NULL;
END; --QueryTargetPrintService
*********************
Support routines:
*********************
DisplayBasicStatus: PROCEDURE [exec: NSExec.Handle,
state: PSState.StateHandle, showInternalState: BOOLEAN] = BEGIN
outputHandle: XFormat.Handle ← NSExec.OutputHandle[exec];
stringArray: REF XMessage.StringArray ← NEW [XMessage.StringArray[2]];
freeThisString: NSString.String;
freeString: BOOLEANFALSE;
sDateAndTime: STRING ← [40];
nsDateAndTime: NSString.String ← NEW[TEXT[40]];
nsDateTimeObject: XFormat.Handle ← XFormat.NSStringObject[nsDateAndTime];
sCount: NSString.String ← NEW[TEXT[20]];
"Print Service "<name>" <started|stopped|in repair mode|in diagnostic mode>"
stringArray[0] ← IF PSExecInternal.printServiceName = [NIL, NIL, NIL]
THEN nsNil ELSE Rope.ToRefText[PSExecInternal.printServiceName.object];
stringArray[1] ← M[
SELECT state.mode.current FROM
diagnostic => mDiagMode,
repair => mRepairMode,
shutDown, notStarted => mStopped,
ENDCASE => mStarted];
PSExecInternal.ExpandKeyAndPrint[exec, mStatusHerald, stringArray];
IF state.mode.current # shutDown OR state.mode.returnTo # shutDown THEN
BEGIN
"Queuing {Started|Stopped|Preempted}"
SELECT TRUE FROM
state.clientControl.spooler = enabled
AND state.internalControl.spooler = enabled => BEGIN --Queuing started
stringArray[0] ← IF state.lastUserToStartQueuing.length > 0 THEN
state.lastUserToStartQueuing ELSE nsNil;
PSExecInternal.ExpandKeyAndPrint[exec, mQueuingStartedBy, stringArray];
END;
state.clientControl.spooler # enabled => BEGIN --Queuing stopped
IF state.lastStopQueuingReason.length > 0 THEN BEGIN
stringArray[0] ← state.lastStopQueuingReason;
freeThisString ← XMessage.Compose[M[mReason], stringArray];
freeString ← TRUE;
stringArray[1] ← freeThisString;
END
ELSE stringArray[1] ← nsNil;
stringArray[0] ← IF state.lastUserToStopQueuing.length > 0 THEN
state.lastUserToStopQueuing ELSE nsNil;
PSExecInternal.ExpandKeyAndPrint[exec, mQueuingStoppedBy, stringArray];
IF freeString THEN BEGIN
NSString.FreeString[freeThisString];
freeString ← FALSE;
END;
END;
ENDCASE => --Queuing preempted
outputHandle.NSLine[M[mQueuingPreempted]];
"Printing {Started|Stopped|Preempted}"
SELECT TRUE FROM
state.clientControl.markerEnabled
AND state.internalControl.markerEnabled => BEGIN --Printing started
stringArray[0] ← IF state.lastUserToStartPrinting.length > 0 THEN
state.lastUserToStartPrinting ELSE nsNil;
PSExecInternal.ExpandKeyAndPrint[exec, mPrintingStartedBy, stringArray];
END;
NOT state.clientControl.markerEnabled => BEGIN --Printing stopped
IF state.lastStopPrintingReason.length > 0 THEN BEGIN
stringArray[0] ← state.lastStopPrintingReason;
freeThisString ← XMessage.Compose[M[mReason], stringArray];
freeString ← TRUE;
stringArray[1] ← freeThisString;
END
ELSE stringArray[1] ← nsNil;
stringArray[0] ← IF state.lastUserToStopPrinting.length > 0 THEN
state.lastUserToStopPrinting ELSE nsNil;
PSExecInternal.ExpandKeyAndPrint[exec, mPrintingStoppedBy, stringArray];
IF freeString THEN BEGIN
NSString.FreeString[freeThisString];
freeString ← FALSE;
END;
END;
ENDCASE => --Printing preempted
outputHandle.NSLine[M[mPrintingPreempted]];
END; -- state.mode # shutDown
"Installed <dateAndTime> {; Times Rebooted=n}"
IF showInternalState THEN BEGIN
nsDateAndTime.length ← 0;
XFormat.Date[nsDateTimeObject, state.lastInstallation]; --aopends date to nsDateAndTime
stringArray[0] ← nsDateAndTime;
IF state.nBoots > 0 THEN BEGIN
sCount.length ← 0;
XFormat.NSString[outputHandle, NSString.AppendLongDecimal[NIL, state.nBoots]];
stringArray[1] ← NEW[TEXT[20]];
freeThisString ← XMessage.Compose[M[mTimesRebooted], stringArray];
freeString ← TRUE;
stringArray[0] ← freeThisString;
END;
PSExecInternal.ExpandKeyAndPrint[exec, mInstalled, stringArray];
IF freeString THEN BEGIN
NSString.FreeString[freeThisString];
freeString ← FALSE;
END;
END;
"Last booted <dateAndTime>"
IF showInternalState THEN BEGIN
nsDateAndTime.length ← 0;
XFormat.Date[nsDateTimeObject, state.lastBoot]; --appends date to nsDateAndTime
stringArray[0] ← nsDateAndTime;
PSExecInternal.ExpandKeyAndPrint[exec, mServerBooted, stringArray];
END;
"Statistics Reset <dateAndTime>"
IF showInternalState THEN BEGIN
nsDateAndTime.length ← 0;
XFormat.Date[nsDateTimeObject, state.statisticsReset]; --aopends date to nsDateAndTime
stringArray[0] ← nsDateAndTime;
PSExecInternal.ExpandKeyAndPrint[exec, mStatsReset, stringArray];
END;
"Last Activity <dateAndTime>"
nsDateAndTime.length ← 0;
XFormat.Date[nsDateTimeObject, state.lastActivity]; --aopends date to nsDateAndTime
stringArray[0] ← nsDateAndTime;
PSExecInternal.ExpandKeyAndPrint[exec, mLastActivity, stringArray];
END; -- of DisplayBasicStatus
DisplayCurrentFaxRetries: PROCEDURE [exec: NSExec.Handle,
currentCount: CARDINAL,
currentDelay: LONG CARDINAL, reasonKey: PSExecMessages.Key,
showInternalState: BOOLEANTRUE] = BEGIN
outputHandle: XFormat.Handle ← NSExec.OutputHandle[exec];
sCount1: NSString.String ← NEW[TEXT[20]];
sCount2: NSString.String ← NEW[TEXT[20]];
freeThisString: NSString.String;
freeString: BOOLEANFALSE;
stringArray: REF XMessage.StringArray ← NEW[XMessage.StringArray[2]];
XFormat.NSString[outputHandle, NSString.AppendDecimal[sCount1, currentCount]];
IF currentCount > 0 AND showInternalState THEN BEGIN
stringArray[0] ← Str[sCount1];
XFormat.NSString[outputHandle, NSString.AppendDecimal[sCount2, currentDelay]];
stringArray[1] ← Str[sCount2];
freeThisString ← XMessage.Compose[M[mRetryDelay], stringArray];
freeString ← TRUE;
stringArray[1] ← freeThisString;
END
ELSE stringArray[1] ← NEW[TEXT[20]];
stringArray[0] ← M[reasonKey];
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mTransmissionRetries, stringArray];
IF freeString THEN NSString.FreeString[freeThisString];
END; --DisplayCurrentFaxRetries
DisplayOptionSpecificStatus: PROCEDURE [exec: NSExec.Handle, state: PSState.StateHandle,
activity: PSState.CurrentActivity,
showInternalState: BOOLEAN] = TRUSTED BEGIN
outputHandle: XFormat.Handle ← NSExec.OutputHandle[exec];
stringArray: REF XMessage.StringArray ← NEW[XMessage.StringArray[2]];
freeThisString: NSString.String;
freeString: BOOLEANFALSE;
"Printing option: <>{, <Raven model>}"
WITH s: state SELECT FROM
bansheeDl => stringArray[0] ← M[mBanshee];
d1 => stringArray[0] ← M[mD1];
fax295 => stringArray[0] ← M[mTC295];
fax495 => stringArray[0] ← M[mTC495];
feps9700 => stringArray[0] ← M[mFEPS];
fx3500 => stringArray[0] ← M[mFX3500];
raven => BEGIN
stringArray[0] ← M[mRaven];
stringArray[1] ← M[
SELECT s.engineBuild FROM
b1 => mRavenB1,
b2, b2TraySensing, b2XSISModified => mRavenB2,
ENDCASE => mQuestion];
freeThisString ← XMessage.Compose[M[mOneCommaTwo], stringArray];
freeString ← TRUE;
stringArray[0] ← freeThisString;
END;
ENDCASE => ERROR;
PSExecInternal.ExpandKeyAndPrint[exec, mPrintingOption, stringArray];
IF freeString THEN BEGIN
NSString.FreeString[freeThisString];
freeString ← FALSE;
END;
WITH a: activity SELECT FROM
"Printer <Idle|Busy>; Status: <status>"
bansheeDl => BEGIN
stringArray[0] ← M[IF a.marker IN [marking..paused] THEN mBusy ELSE mIdle];
stringArray[1] ← MGeneric[MiscUtilities.KeyForBansheeStatus[a.bansheeStatus]];
PSExecInternal.ExpandKeyAndPrint[exec, mPrinterStatus, stringArray];
END;
d1 => BEGIN
stringArray[0] ← M[IF a.marker IN [marking..paused] THEN mBusy ELSE mIdle];
stringArray[1] ← MGeneric[MiscUtilities.KeyForD1Status[a.d1Status]];
PSExecInternal.ExpandKeyAndPrint[exec, mPrinterStatus, stringArray];
END;
fax295, fax495 => BEGIN
stringArray[0] ← M[IF a.marker IN [marking..paused] THEN mBusy ELSE mIdle];
stringArray[1] ← MGeneric[MiscUtilities.KeyForFaxStatus[a.faxStatus]];
PSExecInternal.ExpandKeyAndPrint[exec, mPrinterStatus, stringArray];
END;
"Forwarding activity: <None|In progress>; Status = <>>
feps9700 => BEGIN
IF a.forwarder = busy THEN BEGIN
If forwarding is in progress display the lastest forwarding status...
stringArray[0] ← MGeneric[MiscUtilities.KeyForCommunicationStatus[a.forwardingStatus]];
freeThisString ← XMessage.Compose[M[mRetrying], stringArray];
freeString ← TRUE;
stringArray[0] ← freeThisString;
END
ELSE
stringArray[0] ← M[mNone];
PSExecInternal.ExpandKeyAndPrint[exec, mForwardingActivity, stringArray];
IF freeString THEN BEGIN
NSString.FreeString[freeThisString];
freeString ← FALSE;
END;
END;
fx3500 => BEGIN
stringArray[0] ← M[IF a.marker IN [marking..paused] THEN mBusy ELSE mIdle];
stringArray[1] ← MGeneric[MiscUtilities.KeyForFX3500Status[a.fx3500Status]];
PSExecInternal.ExpandKeyAndPrint[exec, mPrinterStatus, stringArray];
END;
raven => BEGIN
stringArray[0] ← M[IF a.marker IN [marking..paused] THEN mBusy ELSE mIdle];
stringArray[1] ← MGeneric[MiscUtilities.KeyForRavenStatus[a.ravenStatus]];
PSExecInternal.ExpandKeyAndPrint[exec, mPrinterStatus, stringArray];
END;
ENDCASE;
Display printing option specific status information...
WITH s: state SELECT FROM
d1 => BEGIN
"Operational Parameters: "
outputHandle.NSLine[M[mOperationalParms]];
"Paper size = <>"
stringArray[0] ← StringForPaper[s.paperSize];
IF s.trayEmpty THEN BEGIN
freeThisString ← XMessage.Compose[M[mUnknown], stringArray];
freeString ← TRUE;
stringArray[0] ← freeThisString;
END;
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mPaper, stringArray];
IF freeString THEN BEGIN
NSString.FreeString[freeThisString];
freeString ← FALSE;
END;
"Print Order = <>"
stringArray[0] ← M[
SELECT s.printOrder FROM
firstPageOutFirst => mFirstPagePrintedFirst,
ENDCASE => mLastPagePrintedFirst];
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mPrintOrder2, stringArray];
"Banner = <>"
stringArray[0] ← M[
SELECT s.banner FROM
oncePerDocument => mPerCopy,
oncePerJob => mPerSetOfCopies,
ENDCASE => mSuppressed];
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mBanner2, stringArray];
END; --d1 parms
bansheeDl => BEGIN
IF SpecialSpace.realMemorySize > PSInit.unlimitedPrintingCutOffMemSize THEN BEGIN
"Unlimited printing: <enabled|disabled>"
stringArray[0] ← IF s.enableUnlimitedPrinting THEN M[mEnabled]
ELSE M[mDisabled];
PSExecInternal.ExpandKeyAndPrint[exec, mUnlimitedPrinting, stringArray];
END;
"Paper size = <>"
stringArray[0] ← IF s.paper = PaperTypesExtras.bansheeDlEnvelope THEN
M[mEnvelope] ELSE StringForPaper[s.paper.knownSize];
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mPaper, stringArray];
"Banner = <>"
stringArray[0] ← M[
SELECT s.banner FROM
oncePerDocument => mPerCopy,
oncePerJob => mPerSetOfCopies,
ENDCASE => mSuppressed];
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mBanner2, stringArray];
END; --banshee parms
fax495 => BEGIN
"Operational Parameters: "
outputHandle.NSLine[M[mOperationalParms]];
"Transmission retries (no connection) = <>{, retry delay (minutes) = <>"
DisplayCurrentFaxRetries[exec: exec,
currentCount: s.retries[noConnection].count,
currentDelay: s.retries[noConnection].delayInSecs/60,
reasonKey: mNoConnection,
showInternalState: showInternalState];
"Transmission retries (transmit error) = <>{, retry delay (minutes) = <>"
DisplayCurrentFaxRetries[exec: exec,
currentCount: s.retries[transmitError].count,
currentDelay: s.retries[transmitError].delayInSecs/60,
reasonKey: mTransmitFailure,
showInternalState: showInternalState];
"Local banner = <>"
stringArray[0] ← M[
SELECT s.banner.local FROM
oncePerDocument => mPerCopy,
oncePerJob => mPerSetOfCopies,
ENDCASE => mSuppressed];
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mLocalBanner, stringArray];
"Remote banner = <>"
stringArray[0] ← M[
SELECT s.banner.remote FROM
oncePerDocument => mPerCopy,
oncePerJob => mPerSetOfCopies,
ENDCASE => mSuppressed];
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mRemoteBanner, stringArray];
"Local duplicate copies = <>"
stringArray[0] ← M[
IF s.multLocalCopiesAllowed THEN mAllowed
ELSE mSuppressed];
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mLocalCopies, stringArray];
"Remote duplicate copies = <>"
stringArray[0] ← M[
IF s.multRemoteCopiesAllowed THEN mAllowed
ELSE mSuppressed];
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mRemoteCopies, stringArray];
END; --fax parms
feps9700 => BEGIN
targetNameString: NSString.String ← NSString.MakeString[bytes: CHName.maxOrganizationLength + CHName.maxDomainLength + CHName.maxObjectLength + 5];
sNetAddress: LONG STRING ← [40];
nsNetAddress: NSString.String ← NEW[TEXT[40]];
nsNetAddressObject: XFormat.Handle ← XFormat.NSStringObject[nsNetAddress];
"Target Print Service: <>"
SELECT TRUE FROM
s.targetPSName.record.local.length # 0 => BEGIN
targetName: CHName.Name ← LOOPHOLE[s.targetPSName.record];
targetNameString ← NSString.AppendString[
s: targetNameString, name: targetName];
stringArray[0] ← targetNameString;
END;
s.targetPSAddress # XNS.nullNetworkAddress => BEGIN
XFormat.NetworkAddress[h: nsNetAddressObject,
networkAddress: s.targetPSAddress, format: productSoftware]; --appends net address string to nsNetAddress
stringArray[0] ← nsNetAddress;
END;
ENDCASE => BEGIN
stringArray[0] ← M[mSetTarget];
freeThisString ← XMessage.Compose[
M[mUnknown], stringArray];
freeString ← TRUE;
stringArray[0] ← freeThisString;
END;
outputHandle.Blanks[tab0];
PSExecInternal.ExpandKeyAndPrint[exec, mTargetPS, stringArray];
NSString.FreeString[targetNameString];
IF freeString THEN BEGIN
NSString.FreeString[freeThisString];
freeString ← FALSE;
END;
"Paper size = <>"
stringArray[0] ← StringForPaper[s.paperSupply.size1];
If second paper size # max (target has two paper sizes)
and size one # size two, display two paper sizes...
IF s.paperSupply.size2 # max AND
s.paperSupply.size1 # s.paperSupply.size2 THEN BEGIN
stringArray[1] ← StringForPaper[s.paperSupply.size2];
freeThisString ← XMessage.Compose[M[mOneCommaTwo], stringArray];
freeString ← TRUE;
stringArray[0] ← freeThisString;
END;
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mPaper, stringArray];
IF freeString THEN BEGIN
NSString.FreeString[freeThisString];
freeString ← FALSE;
END;
"Two-sided copy = <>"
stringArray[0] ← M[IF s.twoSidedCopy THEN mAvailable ELSE mUnavailable];
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mTwoSidedCopy, stringArray];
"Stapling = <>"
stringArray[0] ← M[IF s.stapling THEN mAvailable ELSE mUnavailable];
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mStapling, stringArray];
END; --feps9700 parms
fx3500 => BEGIN
twoPaperSizesLoaded: BOOLEAN
(s.paperSupply.size2 # s.paperSupply.size1) OR
(s.topPaperTrayEmpty # s.bottomPaperTrayEmpty);
"Operational Parameters: "
outputHandle.NSLine[M[mOperationalParms]];
"Paper Size = <>"
stringArray[0] ← StringForPaper[s.paperSupply.size2];
IF s.topPaperTrayEmpty THEN BEGIN
freeThisString ← XMessage.Compose[M[mUnknown], stringArray];
freeString ← TRUE;
stringArray[1] ← freeThisString;
END
ELSE stringArray[1] ← stringArray[0];
stringArray[0] ← M[
IF twoPaperSizesLoaded THEN mTopTray
ELSE mBothTrays];
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mPaperSize2, stringArray];
IF freeString THEN BEGIN
NSString.FreeString[freeThisString];
freeString ← FALSE;
END;
IF twoPaperSizesLoaded THEN BEGIN
stringArray[0] ← StringForPaper[s.paperSupply.size1];
IF s.bottomPaperTrayEmpty THEN BEGIN
freeThisString ← XMessage.Compose[M[mUnknown], stringArray];
freeString ← TRUE;
stringArray[1] ← freeThisString;
END
ELSE stringArray[1] ← stringArray[0];
stringArray[0] ← M[mBottomTray];
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mPaperSize2, stringArray];
IF freeString THEN BEGIN
NSString.FreeString[freeThisString];
freeString ← FALSE;
END;
END;
"Feed = <>"
stringArray[0] ←
IF twoPaperSizesLoaded THEN M[mAsAppropriate]
ELSE M[
SELECT s.paperFeed FROM
fromBottom => mFromBottom,
fromBottomBannerFromTop => mFromBottomBannerfromTopTray,
fromBottomOrTop => mFromBottomorTopTray,
fromTop => mFromTop,
ENDCASE => mAlternateBottomAndTop
];
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mPaperFeed, stringArray];
"Print Order = <>"
stringArray[0] ← M[
SELECT s.printOrder FROM
firstPageOutFirst => mFirstPagePrintedFirst,
ENDCASE => mLastPagePrintedFirst];
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mPrintOrder2, stringArray];
"Banner = <>"
stringArray[0] ← M[
SELECT s.banner FROM
oncePerDocument => mPerCopy,
oncePerJob => mPerSetOfCopies,
ENDCASE => mSuppressed];
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mBanner2, stringArray];
END; --fx3500 parms
raven => BEGIN
twoPaperSizesLoaded: BOOLEAN
s.paperSupply.size2 # s.paperSupply.size1;
IF SpecialSpace.realMemorySize > PSInit.unlimitedPrintingCutOffMemSize THEN BEGIN
"Unlimited printing: <enabled|disabled>"
stringArray[0] ← IF s.enableUnlimitedPrinting THEN M[mEnabled]
ELSE M[mDisabled];
PSExecInternal.ExpandKeyAndPrint[exec, mUnlimitedPrinting, stringArray];
END;
"Operational Parameters: "
outputHandle.NSLine[M[mOperationalParms]];
"Paper Size = <>"
stringArray[0] ← M[
IF twoPaperSizesLoaded THEN mTopTray
ELSE mBothTrays];
stringArray[1] ← StringForPaper[s.paperSupply.size2];
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mPaperSize2, stringArray];
IF twoPaperSizesLoaded THEN BEGIN
stringArray[0] ← M[mBottomTray];
stringArray[1] ← StringForPaper[s.paperSupply.size1];
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mPaperSize2, stringArray];
END;
"Feed = <>"
stringArray[0] ←
IF twoPaperSizesLoaded THEN M[mAsAppropriate]
ELSE M[
SELECT s.paperFeed FROM
fromBottomBannerFromTop => mFromBottomBannerfromTopTray,
ENDCASE => mFromBottomorTopTray];
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mPaperFeed, stringArray];
"Stacking = <>"
IF s.engineBuild > b1 THEN BEGIN --Stacking only applies to B2 or later engines.
stringArray[0] ← M[
SELECT s.paperStacking FROM
aligned => mAligned,
documentOffset => mCopyOffset,
ENDCASE --jobOffset-- => mSetOfCopiesOffset];
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mOutputStacking, stringArray];
END;
"Banner = <>"
stringArray[0] ← M[
SELECT s.banner FROM
oncePerDocument => mPerCopy,
oncePerJob => mPerSetOfCopies,
ENDCASE => mSuppressed];
outputHandle.Blanks[tab2];
PSExecInternal.ExpandKeyAndPrint[exec, mBanner2, stringArray];
END; --raven parms
ENDCASE;
END; -- of DisplayOptionSpecificStatus
DisplayStats: PROCEDURE [exec: NSExec.Handle, state: PSState.StateHandle, showInternalState: BOOLEAN] = TRUSTED BEGIN
outputHandle: XFormat.Handle ← NSExec.OutputHandle[exec];
stringArray: REF XMessage.StringArray ← NEW[XMessage.StringArray[2]];
freeThisString: NSString.String;
freeString: BOOLEANFALSE;
sCount1: NSString.String ← NEW[TEXT[20]];
sCount2: NSString.String ← NEW[TEXT[20]];
Print Stats
"Documents Printed: <> {; Total Since Installed: <>}" or
"Documents Forwarded: <>" for feps9700
sCount1.length ← sCount2.length ← 0;
XFormat.NSString[outputHandle, NSString.AppendDecimal[NIL, state.docsPrinted.total]];
IF showInternalState THEN XFormat.NSString[outputHandle, NSString.AppendLongDecimal[
NIL, state.docsPrinted.grandTotal + state.docsPrinted.total]];
IF showInternalState THEN NSString.AppendLongDecimal[
sCount2.length, state.docsPrinted.grandTotal + state.docsPrinted.total];
stringArray[0] ← NEW[TEXT[20]];
IF showInternalState THEN BEGIN -- mTotalSinceInstalled is inserted into mDocsPrinted
stringArray[1] ← NEW[TEXT[20]];
freeThisString ← XMessage.Compose[M[mTotalSinceInstalled], stringArray];
freeString ← TRUE;
stringArray[0] ← freeThisString;
END;
IF state.option = feps9700 THEN
PSExecInternal.ExpandKeyAndPrint[exec, mDocsForwarded, stringArray]
ELSE
PSExecInternal.ExpandKeyAndPrint[exec, mDocsPrinted, stringArray];
IF freeString THEN BEGIN
NSString.FreeString[freeThisString];
freeString ← FALSE;
END;
WITH s: state SELECT FROM
fax495 => BEGIN
" Documents Transmitted: <> {; Total Since Installed: <>}"
sCount1.length ← sCount2.length ← 0;
XFormat.NSString[outputHandle, NSString.AppendDecimal[NIL, s.docsTransmitted.total]];
stringArray[0] ← NEW[TEXT[20]];
IF showInternalState THEN BEGIN -- mTotalSinceInstalled is inserted into mDocsTransmitted
XFormat.NSString[outputHandle, NSString.AppendLongDecimal[
NIL, s.docsTransmitted.grandTotal + s.docsTransmitted.total]];
stringArray[1] ← NEW[TEXT[20]];
freeThisString ← XMessage.Compose[M[mTotalSinceInstalled], stringArray];
freeString ← TRUE;
stringArray[0] ← freeThisString;
END;
PSExecInternal.ExpandKeyAndPrint[exec, mDocsTransmitted, stringArray];
IF freeString THEN BEGIN
NSString.FreeString[freeThisString];
freeString ← FALSE;
END;
END;
ENDCASE;
IF showInternalState
AND (state.docsAborted.total # 0 OR state.docsAborted.grandTotal # 0) THEN BEGIN
" Documents Canceled: <1>; Total Since Installed: <2>"
sCount1.length ← sCount2.length ← 0;
XFormat.NSString[outputHandle, NSString.AppendLongDecimal[NIL, state.docsAborted.total]];
XFormat.NSString[outputHandle, NSString.AppendLongDecimal[
NIL, state.docsAborted.grandTotal + state.docsAborted.total]];
stringArray[0] ← NEW[TEXT[20]];
stringArray[1] ← NEW[TEXT[20]];
PSExecInternal.ExpandKeyAndPrint[exec, mDocsCanceledStat, stringArray];
END;
IF showInternalState
AND (state.commErrors.total # 0 OR state.commErrors.grandTotal # 0) THEN BEGIN
" Failed Communications Attempts: <1>; Total Since Installed: <2>"
sCount1.length ← sCount2.length ← 0;
XFormat.NSString[outputHandle, NSString.AppendLongDecimal[NIL, state.commErrors.total]];
XFormat.NSString[outputHandle, NSString.AppendLongDecimal[
NIL, state.commErrors.grandTotal + state.commErrors.total]];
stringArray[0] ← NEW[TEXT[20]];
stringArray[1] ← NEW[TEXT[20]];
PSExecInternal.ExpandKeyAndPrint[exec, mCommErrorsStat, stringArray];
END;
IF showInternalState
AND (state.testPatternsPrinted.total # 0 OR state.testPatternsPrinted.grandTotal # 0) THEN
BEGIN
" TestPattern Requests: <1>; Total Since Installed: <2>"
sCount1.length ← sCount2.length ← 0;
XFormat.NSString[outputHandle, NSString.AppendLongDecimal[NIL, state.testPatternsPrinted.total]];
XFormat.NSString[outputHandle, NSString.AppendLongDecimal[
NIL, state.testPatternsPrinted.grandTotal + state.testPatternsPrinted.total]];
stringArray[0] ← NEW[TEXT[20]];
stringArray[1] ← NEW[TEXT[20]];
PSExecInternal.ExpandKeyAndPrint[exec, mTPRequests, stringArray];
END;
IF showInternalState
AND (state.docsRetried.total # 0 OR state.docsRetried.grandTotal # 0) THEN BEGIN
" Recovery Retry Requests: <1>; Total Since Installed: <2>"
sCount1.length ← sCount2.length ← 0;
XFormat.NSString[outputHandle, NSString.AppendLongDecimal[NIL, state.docsRetried.total]];
XFormat.NSString[outputHandle, NSString.AppendLongDecimal[
NIL, state.docsRetried.grandTotal + state.docsRetried.total]];
stringArray[0] ← NEW[TEXT[20]];
stringArray[1] ← NEW[TEXT[20]];
PSExecInternal.ExpandKeyAndPrint[exec, mRecoveryRetryRequests, stringArray];
END;
IF showInternalState
AND (state.docsPurged.total # 0 OR state.docsPurged.grandTotal # 0) THEN BEGIN
" Docs Purged at Recovery: <1>; Total Since Installed: <2>"
sCount1.length ← sCount2.length ← 0;
XFormat.NSString[outputHandle, NSString.AppendLongDecimal[NIL, state.docsPurged.total]];
XFormat.NSString[outputHandle, NSString.AppendLongDecimal[
NIL, state.docsPurged.grandTotal + state.docsPurged.total]];
stringArray[0] ← NEW[TEXT[20]];
stringArray[1] ← NEW[TEXT[20]];
PSExecInternal.ExpandKeyAndPrint[exec, mDocsPurgedAtRecovery, stringArray];
END;
IF showInternalState AND BootSwitch.Set[BootSwitch.useTeleDebugger] THEN BEGIN
OPEN NSString;
wordsPerPage: LONG CARDINAL = 256;
outputHandle.Blanks[tab1];
outputHandle.NSLine[Str["PS Parameters (shown only if booted with 5 switch):"]];
outputHandle.Blanks[tab2];
outputHandle.String["Memory size: "];
outputHandle.Decimal[SpecialSpace.realMemorySize];
outputHandle.String[" pages = "];
outputHandle.Decimal[SpecialSpace.realMemorySize*wordsPerPage];
outputHandle.NSLine[Str[" words"]];
outputHandle.Blanks[tab2];
outputHandle.String["Boot switches: "];
FOR c: CHARACTER IN [' ..'~] DO
IF BootSwitch.Set[c] THEN outputHandle.Char[LOOPHOLE[c]];
ENDLOOP;
FOR c: CHARACTER IN [177C..377C] DO
IF BootSwitch.Set[c] THEN BEGIN
outputHandle.Char[134B]; -- '\
outputHandle.Octal[c];
outputHandle.Char[134B]; -- '\
END;
ENDLOOP;
outputHandle.CR[];
IF state.option # feps9700 THEN BEGIN --parms that don't pertain to feps
outputHandle.Blanks[tab2];
outputHandle.String["Decomposing while marking "];
outputHandle.NSLine[Str[IF state.decomposeWhileMarking THEN "ENABLED" ELSE "DISABLED"]];
outputHandle.Blanks[tab2];
outputHandle.String["Spooling while marking "];
outputHandle.NSLine[Str[IF state.spoolWhileMarking THEN "ENABLED" ELSE "DISABLED"]];
outputHandle.Blanks[tab2];
outputHandle.String["RM page limit observed by decomposer = "];
outputHandle.Decimal[state.decomposerRMPagesForMarker];
outputHandle.CR[];
outputHandle.Blanks[tab2];
outputHandle.String["Number of band buffers = "];
outputHandle.Decimal[
state.markerRMPagesForBands/MiscUtilities.pagesPerBandBuffer];
outputHandle.CR[];
END;
outputHandle.Blanks[tab2];
outputHandle.String["VM pages reserved by decomposer = "];
outputHandle.Decimal[state.decomposerVMPages]; outputHandle.CR[];
END;
END; -- of DisplayStats
ShowVolumeStatus: PROCEDURE [exec: NSExec.Handle, activity: PSState.CurrentActivity] = BEGIN
stringArray: REF XMessage.StringArray ← NEW[XMessage.StringArray[3]];
outputHandle: XFormat.Handle ← NSExec.OutputHandle[exec];
sCount1: NSString.String ← NEW[TEXT[20]];
sCount2: NSString.String ← NEW[TEXT[20]];
userVolID: File.SystemVolume ← PSVolume.GetUserVolID[];
usedPages, freePages: LONG CARDINAL;
" Total <1>volume pages = <2>; Free pages = <3>"
stringArray[0] ← nsNil;
[usedPages, freePages] ← NSVolumeControl.GetSpaceAttributes[userVolID];
XFormat.NSString[outputHandle, NSString.AppendLongDecimal[sCount1, usedPages + freePages]];
XFormat.NSString[outputHandle, NSString.AppendLongDecimal[sCount2, freePages]];
stringArray[1] ← NEW[TEXT[20]];
stringArray[2] ← NEW[TEXT[20]];
PSExecInternal.ExpandKeyAndPrint[exec, mTotalVolumePages, stringArray];
sCount1.length ← sCount2.length ← 0;
" Queue pages allocated = <1>; Font pages allocated = <2>"
XFormat.NSString[outputHandle, NSString.AppendLongDecimal[NIL, activity.queuePages]];
XFormat.NSString[outputHandle, NSString.AppendLongDecimal[NIL, activity.fontPages]];
stringArray[0] ← NEW[TEXT[20]];
stringArray[1] ← NEW[TEXT[20]];
PSExecInternal.ExpandKeyAndPrint[exec, mPagesAllocated, stringArray];
END; -- ShowVolumeStatus
StringForActivity: PROCEDURE [a: PSActivity.Basic]
RETURNS [NSString.String] = BEGIN
RETURN [M[
SELECT a FROM
available => mAvailable,
busy => mBusy,
disabled => mDisabled,
ENDCASE => mQuestion]];
END; --StringForActivity
StringForPaper: PROCEDURE [p: PaperTypes.PaperSize]
RETURNS [NSString.String] = BEGIN
This procedure is only set up to handle
a limited number of known paper sizes.
RETURN [M[
SELECT p FROM
letter => mLetter,
legal => mLegal,
a4 => mA4,
a5 => mA5,
jisB4 => mB4,
jisB5 => mB5,
fxPostcard => mPostalCard,
ENDCASE => mQuestion]
];
END; --StringForPaper
StringForPrinterActivity: PROCEDURE [p: PSActivity.Printer]
RETURNS [NSString.String] = BEGIN
RETURN [M[
SELECT p FROM
available => mAvailable,
busy => mBusy,
disabled => mDisabled,
needsAttention => mNeedsAttention,
needsKeyOperator => mNeedsKeyOperator,
ENDCASE => mQuestion]];
END; --StringForPrinterActivity
StringForSpoolerActivity: PROCEDURE [s: PSActivity.Spooler]
RETURNS [NSString.String] = BEGIN
RETURN [M[SELECT s FROM
available, spooling => mAvailable,
busy => mBusy,
disabled => mDisabled,
full => mFull,
ENDCASE => mQuestion]];
END; --StringForSpoolerActivity
Support routines:
Proc for getting NSString from XMessage key
M: PROCEDURE [key: PSExecMessages.Key] RETURNS [string: NSString.String] = {
RETURN[XMessage.Get[execMsgs, ORD[key]]]};
MGeneric: PROCEDURE [msg: PSAsyncMsg.Msg] RETURNS [string: NSString.String] = {
RETURN[XMessage.Get[msg.domain, msg.key]]};
END. --PSExecDImpl
LOG when/who/what
10-Jan-84 11:20:27 - Jacks - Split off from PSTTYExecAImpl, which was too large.
26-Jan-84 18:11:54 - Jacks - Converted to 8.0 SCS.
9-Feb-84 14:40:29 - Jacks - Updated FX3500 status msg keys; added FX3500 parameters status.
14-Feb-84 14:04:50 - Jacks - Fixed engine type and FX3500 feeding display.
17-Feb-84 18:50:04 - Jacks - mFaxAddPaper became mAddPaper.
23-Feb-84 21:14:25 - Jacks - Fixed display of queuing/printing status to show user and reason; converted to private heap.
8-Mar-84 10:34:25 - Jacks - Changed a msg key; changed stop/start printing/queuing status.
21-Mar-84 15:32:28 - Jacks - Set up to display fax retries for no connection and transmit error; made adjustments to StringForFaxStatus.
30-Mar-84 15:44:33 - Jacks - Minor output format change.
2-Apr-84 11:01:14 - Jacks - Removed NewControlMessages.
3-Apr-84 19:18:29 - Jacks - Added support for multiple execs.
6-Apr-84 17:01:01 - Jacks - Fixed storage leak.
18-Apr-84 16:30:53 - Jacks - Minor editing.
15-Sep-84 13:55:51 - Jacks - Converted to new 9.0 PS interfaces: PSState, PSCommand.
4-Oct-84 13:48:34 - Jacks - Renamed from PSTTYExecDImpl to PSExecDImpl; added calls to NSExec.CheckForAbort.
18-Oct-84 14:47:59 - Jacks - DisplayPrintServiceStatus: Made engine type and service name display for all users; got rid of "Operation Mode" line; added "Last booted" line; using new MiscUtilities I/F for KeyFor*Status procs instead of defining StringFor*Status procs in module//added QueryTargetPrintService//renamed ttyHeap to execHeap.
1-Nov-84 18:00:26 - Jacks - Added catch phrases to call to PSCommand.GetTargetPSStatus; added feps9700 stuff to DisplayPrintServiceStatus.
16-Nov-84 12:31:07 - Jacks - Updated to new PSCommand/PSState/StatusTypes interfaces; removed TTY.Rubout catch phrases.
28-Nov-84 14:18:32 - Jacks - Fixed small bug in DisplayPrintServiceStatus marker status display; don't display all '5 switch parms for feps9700.
13-Dec-84 14:58:00 - Jacks - QueryTargetPrintService and Show Status now show two sided copy and stapling attributes.
16-Jan-85 15:47:59 - Jacks - Added "ps" prefix to all new msg keys for 9.0.
28-Feb-85 15:30:37 - Jacks - Added comment.
8-Mar-85 11:23:53 - Jacks - Changed forwarding activity display.
20-Jun-85 10:31:34 - Jacks - Added copyright notice; updated to PS Euclid interfaces; turned off public error catching by SCS in development mode in all exec procs.
28-Jun-85 15:09:35 - Jacks - Added d1 code; removed SetCatching calls.
19-Jul-85 13:53:05 - Jacks - Converted to XMessage; changed ShowVolumeStatus somewhat.
7-Aug-85 18:07:36 - Jacks - Removed system volume stats from Show Status.
15-Aug-85 17:13:09 - Jacks - Slight change to optional status display.
28-Aug-85 15:51:09 - Jacks - Changed ShowVolumeStatus slightly.
26-Sep-85 9:32:44 - Jacks - Added fxPostcard to StringForPaper; added unlimited printing to status for banshee and raven.
27-Sep-85 12:17:30 - Jacks - Only display unlimited printing info if memory size is big enough.
8-Oct-85 12:57:45 - Jacks - Updated to new PSInit.
15-Oct-85 10:15:54 - Jacks - Converted to new banshee paper in PSState.
6-Nov-85 13:13:54 - Jacks - Call PSKMessages for msg handle.
7-Nov-85 17:03:14 - Jacks - Display # of band buffers not pages; split DisplayPrintServiceStatus into little procs because it got too big for compiler.
13-Dec-85 16:45:17 - Jacks - ExecMessages renamed to PSExecMessages.