PSExecInitAImpl.mesa
Copyright (C) Xerox Corporation 1984, 1985, 1986. All rights reserved.
Last edited by Jacks 29-Jul-86 17:19:10
Ruseli Binsol: November 7, 1986 1:43:47 pm PST
Initialization code for Services Executive interface to the Print Service. Initialize proc is passed to Services Executive in PSExecControlImpl call to NSExec.CreateClient.
DIRECTORY
BootSwitch USING [promptForInitializationParameters, Set],
Environment USING [PageCount],
Heap USING [Create, FreeNode, MakeNode],
Message USING [Expand, StringArray],
MiscUtilities USING [CalcPagesForBandBuffers, CalcRMPagesForMarker, pagesPerBandBuffer],
NSExec USING [AddClientCommands, BroadcastAsyncMessage, ClientID, Command, Error, ExecProc, GetTTY, Handle, localExec, OutputHandle, Predicate, Run, SystemFilingSession, UserAServerSA, UserLoggedOn, UserName, WorkingDirectory],
NSFile USING [Attributes, AttributesProc, DeleteByName, Error, GetAttributesByName, GetAttributesRecord, Handle, List, noSelections, ReleaseAttributesRecord, Selections, Session],
NSName USING [Name, NameRecord, nullNameRecord],
NSString USING [EquivalentStrings, FreeString, String, StringFromMesaString],
PaperTypes USING [PaperMMDimension],
PrintingTypes USING [Option, RavenBuild],
ProductFactoring USING [Enabled],
PS USING [bansheeConfigName, d1ConfigName, displayMemStatus, faxConfigName, fepsConfigName, fx3500ConfigName, ravenConfigName],
PSAsyncMsg USING [nullInsertArray, nullMsg, Proc],
PSCommand USING [GetPrintServiceActivity, GetPrintServiceStatus, RegisterAsyncMessageProc, StopPrinting, StopQueuing],
PSCommandExtras USING [ServiceState],
PSExec USING [GetClientID],
PSExecInternal,
PSExecMessages USING [Key],
PSInit USING [calculateDefaultBBAllocation, calculateDefaultRMAllocation, ExpungePrintService, InitializePrintService, InitializeState, OptionalParms, RequiredParms, unlimitedPrintingCutOffMemSize],
PSKMessages USING [GetHandle],
PSState USING [CurrentActivity, StateHandle],
Runtime USING [VersionMismatch],
ServicesError USING [Catch, Caught, SetCatching],
ServicesPFOptions USING [psFax, psLowSpeed],
ServicesPFOptionsExtrasExtras USING [psFormatting, psLaserCP],
SpecialSpace USING [realMemorySize],
String USING [AppendLongDecimal],
TextInput USING [ChoiceIndex, Chosen, Confirm, GetChoice, GetChoices, GetLongDecimal, GetTimedYesNo, nilChoice, nilDecimal, nilLongDecimal, nilYesNo],
Time USING [Unpack, Unpacked],
TTY USING [Handle, Rubout],
XFormat USING [Blanks, Handle, NSLine, NSString],
XMessage USING [Get, Handle, MsgKey],
XString USING [ReaderBody];
PSExecInitAImpl: CEDAR PROGRAM
IMPORTS BootSwitch, Heap, Message, MiscUtilities, NSExec, NSFile, NSString, ProductFactoring, PS, PSCommand, PSCommandExtras, PSExec, PSExecInternal, PSInit, PSKMessages, Runtime, ServicesError, String, SpecialSpace, TextInput, Time, TTY, XFormat, XMessage
EXPORTS PSExecInternal
SHARES XString = BEGIN
execHeap: PUBLIC UNCOUNTED ZONE ← Heap.Create[initial: 4]; --Heap used by PSExec*Impls for miscellaneous strings, etc; exported by PSExecInternal.
developmentMode: PUBLIC BOOLEAN
BootSwitch.Set[BootSwitch.promptForInitializationParameters];
boot switch determines if we're in development mode
psClientID: NSExec.ClientID ← PSExec.GetClientID[];
Non-normal init options:
configure, stopQandP, deleteBackingFiles: BOOLEANFALSE;
Message domain handle:
execMsgs: XMessage.Handle ← PSKMessages.GetHandle[exec];
************************************************
SERVICES EXECUTIVE INITIALIZATION PROCEDURES:
These procedures are exported by the PSExec
interface and used in the PSExecControlImpl module
in the call to NSExec.CreateClient.
************************************************
Initialize: PUBLIC PROCEDURE [exec: NSExec.Handle, normal: BOOLEAN] = BEGIN
engineFakerName: NSString.String = Str["EngineFakerConfig.bcd"L];
This is the name of the module that fakes the engine drivers when we run the PS in Tajo.
runningInTajo: BOOLEAN ← NSString.EquivalentStrings[PS.ravenConfigName, engineFakerName];
outputHandle: XFormat.Handle ← NSExec.OutputHandle[exec];
printingOption, oldPrintingOption: PrintingTypes.Option ← unknown;
state: PSState.StateHandle ← NIL;
newOptionChosen: BOOLEANFALSE;
printServiceName: NSName.Name ← NIL;
requiredParms: PSInit.RequiredParms ← [printingOptionParms: unknown[]];
optionalParms: PSInit.OptionalParms ← [printingOptionParms: unknown[]];
DevelopmentModeInit: PROCEDURE = BEGIN
Sets optional init parameters.
If the user has already selected a new printing option, all the optional parameters
are defaulted to their normal values. If the user has NOT selected a new printing option, all the optional parameters are defaulted to their current values, as found in the state record.
defaultVMPagesForDecomposer: LONG CARDINAL
IF newOptionChosen THEN 6000 ELSE state.decomposerVMPages;
defaultDecomposerRMPageLimit: LONG CARDINAL
IF newOptionChosen THEN PSInit.calculateDefaultRMAllocation
ELSE state.decomposerRMPagesForMarker;
The defaultDecomposerRMPageLimit must be calculated after
we prompt for the number of band buffers!
defaultSpoolWhileMarking: BOOLEAN
IF newOptionChosen THEN TRUE ELSE state.spoolWhileMarking;
defaultBandBufferPages: LONG CARDINAL
IF newOptionChosen THEN PSInit.calculateDefaultBBAllocation
ELSE state.markerRMPagesForBands;
defaultDecomposeWhileMarking: BOOLEAN
IF newOptionChosen THEN TRUE ELSE state.decomposeWhileMarking;
IF NOT configure THEN
For NORMAL STARTUP IN DEVELOPMENT MODE the user is not prompted to enter optional parameters. It is not usually possible to change the printing option during a normal startup, but if the product factoring has changed, such that the current printing option is no longer enabled, the user will be forced to choose another option. Therefore, the optional parameters are usually set to the current values from the state record or to certain known defaults for this mode--but if a new printing option HAS been chosen, the optional parameters are defaulted to the normal values for the new printing options.
SELECT printingOption FROM
bansheeDl => optionalParms ← [
vmPagesForDecomposer: defaultVMPagesForDecomposer,
bandBufferPages: defaultBandBufferPages,
decomposerRMPageLimit: defaultDecomposerRMPageLimit,
deleteIncompatibleFontsandTPs: TRUE,
printingOptionParms: bansheeDl[
spoolWhileMarking: defaultSpoolWhileMarking,
decomposeWhileMarking: defaultDecomposeWhileMarking]
];
d1 => optionalParms ← [
vmPagesForDecomposer: defaultVMPagesForDecomposer,
bandBufferPages: defaultBandBufferPages,
decomposerRMPageLimit: defaultDecomposerRMPageLimit,
deleteIncompatibleFontsandTPs: TRUE,
printingOptionParms: d1[
spoolWhileMarking: defaultSpoolWhileMarking,
decomposeWhileMarking: defaultDecomposeWhileMarking]
];
fax295 => optionalParms ← [
vmPagesForDecomposer: defaultVMPagesForDecomposer,
bandBufferPages: defaultBandBufferPages,
decomposerRMPageLimit: defaultDecomposerRMPageLimit,
deleteIncompatibleFontsandTPs: TRUE,
printingOptionParms: fax295[
spoolWhileMarking: defaultSpoolWhileMarking,
decomposeWhileMarking: defaultDecomposeWhileMarking]
];
fax495 => optionalParms ← [
vmPagesForDecomposer: defaultVMPagesForDecomposer,
bandBufferPages: defaultBandBufferPages,
decomposerRMPageLimit: defaultDecomposerRMPageLimit,
deleteIncompatibleFontsandTPs: TRUE,
printingOptionParms: fax495[
spoolWhileMarking: defaultSpoolWhileMarking,
decomposeWhileMarking: defaultDecomposeWhileMarking]
];
feps9700 => optionalParms ← [
vmPagesForDecomposer: defaultVMPagesForDecomposer,
bandBufferPages: defaultBandBufferPages,
decomposerRMPageLimit: defaultDecomposerRMPageLimit,
deleteIncompatibleFontsandTPs: TRUE,
printingOptionParms: feps9700[]];
fx3500 => optionalParms ← [
vmPagesForDecomposer: defaultVMPagesForDecomposer,
bandBufferPages: defaultBandBufferPages,
decomposerRMPageLimit: defaultDecomposerRMPageLimit,
deleteIncompatibleFontsandTPs: TRUE,
printingOptionParms: fx3500[
spoolWhileMarking: defaultSpoolWhileMarking,
decomposeWhileMarking: defaultDecomposeWhileMarking]
];
raven => optionalParms ← [
vmPagesForDecomposer: defaultVMPagesForDecomposer,
bandBufferPages: defaultBandBufferPages,
decomposerRMPageLimit: defaultDecomposerRMPageLimit,
deleteIncompatibleFontsandTPs: TRUE,
printingOptionParms: raven[
spoolWhileMarking: defaultSpoolWhileMarking,
decomposeWhileMarking: defaultDecomposeWhileMarking]
];
ENDCASE => ERROR
ELSE BEGIN
For NON-NORMAL STARTUP IN DEVELOPMENT MODE where the user has selected to change the configuration, he is prompted the enter values for optional parameters.
SELECT printingOption FROM
bansheeDl => optionalParms ←
GetOptionalBansheeInitParms[
exec, requiredParms, defaultVMPagesForDecomposer,
defaultDecomposerRMPageLimit, defaultSpoolWhileMarking,
defaultDecomposeWhileMarking, defaultBandBufferPages];
d1 => optionalParms ←
GetOptionalD1InitParms[exec, defaultVMPagesForDecomposer,
defaultDecomposerRMPageLimit, defaultSpoolWhileMarking,
defaultDecomposeWhileMarking, defaultBandBufferPages];
fax295 => optionalParms ←
GetOptionalFax295InitParms[exec, defaultVMPagesForDecomposer,
defaultDecomposerRMPageLimit, defaultSpoolWhileMarking,
defaultDecomposeWhileMarking, defaultBandBufferPages];
fax495 => optionalParms ←
GetOptionalFax495InitParms[exec, defaultVMPagesForDecomposer,
defaultDecomposerRMPageLimit, defaultSpoolWhileMarking,
defaultDecomposeWhileMarking, defaultBandBufferPages];
feps9700 => optionalParms ←
GetOptionalFEPS9700InitParms[
exec, defaultVMPagesForDecomposer,
defaultDecomposerRMPageLimit, defaultBandBufferPages];
fx3500 => optionalParms ←
GetOptionalFX3500InitParms[exec, defaultVMPagesForDecomposer,
defaultDecomposerRMPageLimit, defaultSpoolWhileMarking,
defaultDecomposeWhileMarking, defaultBandBufferPages];
raven => optionalParms ←
GetOptionalRavenInitParms[
exec, requiredParms, defaultVMPagesForDecomposer,
defaultDecomposerRMPageLimit, defaultSpoolWhileMarking,
defaultDecomposeWhileMarking, defaultBandBufferPages];
ENDCASE => ERROR;
END;
END; --DevelopmentModeInit
*********** MAINLINE OF INITIALIZE ************--
IF ~ProductFactoring.Enabled[ServicesPFOptions.psLowSpeed] AND
~ProductFactoring.Enabled[ServicesPFOptions.psFax] AND
~ProductFactoring.Enabled[ServicesPFOptionsExtrasExtras.psFormatting] AND
~ProductFactoring.Enabled[ServicesPFOptionsExtrasExtras.psLaserCP] THEN
BEGIN
outputHandle.NSLine[M[mCannotRunPS]];
outputHandle.NSLine[M[mPSNotProductFactored]];
ERROR NSExec.Error[cannotInitialize];
END;
Check status of display bank memory. If it was not reserved for
Print Service (by PrintSDFImpl), then PS cannot run.
SELECT PS.displayMemStatus FROM
reservedForCaller => NULL;
reservedForOtherClient => BEGIN
outputHandle.NSLine[M[mCannotRunPS]];
outputHandle.NSLine[M[mMemoryInUse]];
ERROR NSExec.Error[cannotInitialize];
END;
alreadyFreed => BEGIN
outputHandle.NSLine[M[mCannotRunPS]];
outputHandle.NSLine[M[mMemoryNotAvailable]];
outputHandle.NSLine[M[mActivate]];
ERROR NSExec.Error[cannotInitialize];
END;
ENDCASE => BEGIN
outputHandle.NSLine[M[mCannotRunPS]];
outputHandle.NSLine[M[mMemoryNotAvailable]];
ERROR NSExec.Error[cannotInitialize];
END;
IF NOT normal THEN BEGIN
SetNonNormalInitOptions[exec]; --prompt for global init option booleans
IF deleteBackingFiles THEN BEGIN
outputHandle.Blanks[8];
outputHandle.NSString[M[mDeletingFiles]];
PSInit.ExpungePrintService[deleteFonts: FALSE];
outputHandle.NSLine[M[mFloppyDone]];
END;
END;
PSInit.InitializeState[];
state ← PSCommand.GetPrintServiceStatus[];
oldPrintingOption ← state.option;
If it's a normal init in development mode, we provide a special
prompt to determine if it should really be a normal init:
IF normal AND developmentMode THEN
configure ← NOT (TextInput.GetTimedYesNo[
tty: NSExec.GetTTY[exec], prompt: M[mRetainParameters],
timeAllotted: 10 --seconds--, valueIfTimedOut: yes] = yes);
****** NOTE: Remove this code in a later release ******
DeleteObsoleteBcds[workingDir: NSExec.WorkingDirectory[],
session: NSExec.SystemFilingSession[]];
printingOption ← GetPrintingOption[exec, state, runningInTajo];
IF NOT runningInTajo THEN
IF NOT LoadAndRunPrintingOptionBcd[exec, printingOption] THEN
ERROR NSExec.Error[cannotInitialize];
newOptionChosen ← printingOption # oldPrintingOption;
requiredParms ← SELECT printingOption FROM
bansheeDl => GetRequiredBansheeInitParms[exec, state, newOptionChosen],
d1 => [printingOptionParms: d1[]], --no required parms for d1
fax295 => GetRequiredFax295InitParms[exec, state, newOptionChosen],
fax495 => GetRequiredFax495InitParms[exec, state, newOptionChosen],
feps9700 => [printingOptionParms: feps9700[]], --no required parms for feps9700
fx3500 => [printingOptionParms: fx3500[]], --no required parms for fx3500
ENDCASE => GetRequiredRavenInitParms[exec, state, newOptionChosen];
requiredParms.catalogFontsAtInit ← IF stopQandP THEN FALSE ELSE TRUE;
IF newOptionChosen THEN requiredParms.newParametersSpecified ← TRUE;
The stmt above must follow the previous calls to "GetRequiredXXXInitParms",
because those procs default newParametersSpecified to FALSE.
IF developmentMode THEN DevelopmentModeInit[]; --this proc sets the optional parameters
[, printServiceName] ← PSExecInternal.RegisterServiceAtClearinghouse[exec];
PSCommand.RegisterAsyncMessageProc[PutAsyncMessage]; --This is called before calling Initialize, since Initialize may generate some asynchronous messages.
PSInit.InitializePrintService[normal, printServiceName, requiredParms, optionalParms];
RegisterCommands[];
If there's a new printing option, may need to stop printing and remind the user to install fonts or set target print service:
IF newOptionChosen THEN SetInitialState[oldOption: oldPrintingOption, newOption: printingOption];
Queuing and printing should be stopped if it's a non-normal PS startup:
IF stopQandP THEN StopQueuingAndPrintingAbnormal[exec];
PSExecInternal.Start[exec]; --Call start proc.
END; --Initialize
================================================
Actual Print Service Initialization Routines:
================================================
**** ENGINE TYPE ****
GetPrintingOption: PROCEDURE [exec: NSExec.Handle,
state: PSState.StateHandle, runningInTajo: BOOLEAN]
RETURNS [option: PrintingTypes.Option] =
Option choices are currently: raven, d1, fx3500, bansheeDl, fax495 and feps9700.
Code for fax295 has been included, but it is not enabled.
BEGIN OPEN S: NSString;
ENABLE {TTY.Rubout => RETRY};
outputHandle: XFormat.Handle ← NSExec.OutputHandle[exec];
optionBcdCount: CARDINAL ← 0; --set to number of printing option bcds installed on working directory
printingOptionCount: CARDINAL ← 0; --set to number of options currently available (bcd installed and product factored)
availablePrintingOptions: LONG DESCRIPTOR FOR ARRAY OF PrintingTypes.Option ← DESCRIPTOR[NIL, 0]; --array of options which are installed and product factored
pfEnabled: ARRAY PrintingTypes.Option OF BOOLEANALL[FALSE]; --each options may or may not be product factoring enabled
bcdInstalled: ARRAY PrintingTypes.Option OF BOOLEANALL[FALSE]; --each option may or may not have its bcd installed
FindPrintingOptionBcds: PROCEDURE = BEGIN
Proc looks for printing option configs installed on the working directory.
selections: NSFile.Selections ← NSFile.noSelections;
CompareBcdNames: NSFile.AttributesProc =
BEGIN
IF NSString.EquivalentStrings[attributes.name, PS.ravenConfigName] THEN
{bcdInstalled[raven] ← TRUE; optionBcdCount ← optionBcdCount + 1} ELSE
IF NSString.EquivalentStrings[attributes.name, PS.bansheeConfigName] THEN
{bcdInstalled[bansheeDl] ← TRUE; optionBcdCount ← optionBcdCount + 1} ELSE
IF NSString.EquivalentStrings[attributes.name, PS.faxConfigName] THEN
{bcdInstalled[fax495] ← TRUE; optionBcdCount ← optionBcdCount + 1} ELSE
IF NSString.EquivalentStrings[attributes.name, PS.fepsConfigName] THEN
{bcdInstalled[feps9700] ← TRUE; optionBcdCount ← optionBcdCount + 1} ELSE
IF NSString.EquivalentStrings[attributes.name, PS.fx3500ConfigName] THEN
{bcdInstalled[fx3500] ← TRUE; optionBcdCount ← optionBcdCount + 1} ELSE
IF NSString.EquivalentStrings[attributes.name, PS.d1ConfigName] THEN
{bcdInstalled[d1] ← TRUE; optionBcdCount ← optionBcdCount + 1};
END;
IF runningInTajo THEN
BEGIN --If we are running in Tajo, we don't
need to check for option configs on the working directory.
bcdInstalled ← ALL[TRUE];
optionBcdCount ← 6; --UPDATE this number when adding options!
END
ELSE BEGIN
selections.interpreted[name] ← TRUE;
NSFile.List[
directory: NSExec.WorkingDirectory[], proc: CompareBcdNames,
selections: selections, session: NSExec.SystemFilingSession[]];
END;
END; -- of FindPrintingOptionBcds
FillProductFactoringArray: PROCEDURE = BEGIN
Proc checks product factoring for all printing options.
pfEnabled[d1] ← pfEnabled[fx3500] ← pfEnabled[raven] ←
ProductFactoring.Enabled[ServicesPFOptions.psLowSpeed];
pfEnabled[bansheeDl] ← ProductFactoring.Enabled[
ServicesPFOptionsExtrasExtras.psLaserCP];
pfEnabled[fax495] ← ProductFactoring.Enabled[ServicesPFOptions.psFax];
pfEnabled[feps9700] ← ProductFactoring.Enabled[
ServicesPFOptionsExtrasExtras.psFormatting];
END; -- of FillProductFactoringArray
FillPrintingOptionArray: PROCEDURE = BEGIN
optionUnused: PACKED ARRAY PrintingTypes.Option OF BOOLEANALL[TRUE]; --array element for a given option becomes false when option is put into the array
availablePrintingOptions ← DESCRIPTOR[Heap.MakeNode[
execHeap, SIZE[PrintingTypes.Option] * printingOptionCount], printingOptionCount];
FOR i: CARDINAL IN [0..printingOptionCount) DO
SELECT TRUE FROM
These select arms are in the specific order that the user will see the options displayed:
pfEnabled[raven] AND bcdInstalled[raven] AND optionUnused[raven] => availablePrintingOptions[i] ← raven;
pfEnabled[bansheeDl] AND bcdInstalled[bansheeDl] AND optionUnused[bansheeDl] => availablePrintingOptions[i] ← bansheeDl;
pfEnabled[fx3500] AND bcdInstalled[fx3500] AND optionUnused[fx3500] => availablePrintingOptions[i] ← fx3500;
pfEnabled[d1] AND bcdInstalled[d1] AND optionUnused[d1] => availablePrintingOptions[i] ← d1;
pfEnabled[fax295] AND bcdInstalled[fax295] AND optionUnused[fax295] => availablePrintingOptions[i] ← fax295;
pfEnabled[fax495] AND bcdInstalled[fax495] AND optionUnused[fax495] => availablePrintingOptions[i] ← fax495;
pfEnabled[feps9700] AND bcdInstalled[feps9700] AND optionUnused[feps9700] => availablePrintingOptions[i] ← feps9700;
ENDCASE => ERROR; --something's very wrong
optionUnused[availablePrintingOptions[i]] ← FALSE;
ENDLOOP;
END; -- of FillPrintingOptionArray
Mainline code for GetPrintingOption:
BEGIN
FillProductFactoringArray[]; --see which options are product factored
FindPrintingOptionBcds[]; --see which options are installed
IF optionBcdCount = 0 THEN BEGIN
outputHandle.NSLine[M[mCannotRunPS]];
outputHandle.NSLine[M[mNoPrintingOptionSoftware]];
GOTO cannotInitialize;
END;
FOR option: PrintingTypes.Option IN PrintingTypes.Option DO
IF pfEnabled[option] AND bcdInstalled[option] THEN
printingOptionCount ← printingOptionCount + 1;
ENDLOOP;
IF printingOptionCount = 0 THEN BEGIN
outputHandle.NSLine[M[mCannotRunPS]];
outputHandle.NSLine[M[mOptionsNotProductFactored]];
GOTO cannotInitialize;
END;
FillPrintingOptionArray[]; --Stores printing options currently enabled into availablePrintingOptions array.
IF configure OR state.option = unknown OR
NOT pfEnabled[state.option] OR
NOT bcdInstalled[state.option] THEN
option ← PromptForPrintingOption[
exec: exec,
currentOption: state.option,
optionCount: printingOptionCount,
optionChoices: availablePrintingOptions
]
ELSE option ← state.option;
Heap.FreeNode[execHeap, BASE[availablePrintingOptions]];
EXITS cannotInitialize => BEGIN
Heap.FreeNode[execHeap, BASE[availablePrintingOptions]];
ERROR NSExec.Error[cannotInitialize];
END;
END;
END; --GetPrintingOption
**** REQUIRED ENGINE INITIALIZATION PARAMETERS ****
GetRequiredBansheeInitParms: PROCEDURE [exec: NSExec.Handle,
state: PSState.StateHandle, newOptionChosen: BOOLEAN]
RETURNS [bansheeParms: bansheeDl PSInit.RequiredParms] = BEGIN
bansheeParms.invertingPaperTrayAttached ← FALSE; --not currently used
SELECT TRUE FROM
newOptionChosen => BEGIN
bansheeParms.enableUnlimitedPrinting ←
IF SpecialSpace.realMemorySize > PSInit.unlimitedPrintingCutOffMemSize THEN
PromptAboutUnlimitedPrinting[exec: exec, useDefault: FALSE]
ELSE FALSE;
bansheeParms.newParametersSpecified ← TRUE;
END;
configure => WITH s: state SELECT FROM
bansheeDl => BEGIN
bansheeParms.enableUnlimitedPrinting ←
IF SpecialSpace.realMemorySize > PSInit.unlimitedPrintingCutOffMemSize THEN
PromptAboutUnlimitedPrinting[
exec: exec, useDefault: TRUE,
defaultToTrue: s.enableUnlimitedPrinting]
ELSE FALSE;
bansheeParms.newParametersSpecified ← TRUE; --set true whether the version really changed or not
END;
ENDCASE => ERROR;
ENDCASE => WITH s: state SELECT FROM
bansheeDl =>
IF SpecialSpace.realMemorySize > PSInit.unlimitedPrintingCutOffMemSize THEN
bansheeParms.enableUnlimitedPrinting ← s.enableUnlimitedPrinting
ELSE BEGIN
IF s.enableUnlimitedPrinting THEN
mem size changed; unlimited printing no longer available
bansheeParms.newParametersSpecified ← TRUE;
bansheeParms.enableUnlimitedPrinting ← FALSE;
END;
ENDCASE => ERROR;
END; --GetRequiredBansheeInitParms
GetRequiredFax295InitParms: PROCEDURE [exec: NSExec.Handle,
state: PSState.StateHandle, newOptionChosen: BOOLEAN]
RETURNS [fax295Parms: fax295 PSInit.RequiredParms] = BEGIN
SELECT TRUE FROM
newOptionChosen => BEGIN
fax295Parms.paperWidth ← PromptForFaxPaperWidth[
exec: exec, useDefault: FALSE];
fax295Parms.newParametersSpecified ← TRUE;
END;
configure => WITH s: state SELECT FROM
fax295 => BEGIN
fax295Parms.paperWidth ← PromptForFaxPaperWidth[
exec: exec, useDefault: TRUE, defaultWidth: s.paperWidth];
fax295Parms.newParametersSpecified ← TRUE; --set true whether the version really changed or not
END;
ENDCASE => ERROR;
ENDCASE => WITH s: state SELECT FROM
fax295 => fax295Parms.paperWidth ← s.paperWidth; --keep same value as before
ENDCASE => ERROR;
END; --GetRequiredFax295InitParms
GetRequiredFax495InitParms: PROCEDURE [exec: NSExec.Handle,
state: PSState.StateHandle, newOptionChosen: BOOLEAN]
RETURNS [fax495Parms: fax495 PSInit.RequiredParms] = BEGIN
SELECT TRUE FROM
newOptionChosen => BEGIN
fax495Parms.paperWidth ← PromptForFaxPaperWidth[
exec: exec, useDefault: FALSE];
fax495Parms.supportFineResolution ← PromptForFaxTransmissionResolution[
exec: exec, useDefault: FALSE];
fax495Parms.newParametersSpecified ← TRUE;
END;
configure => WITH s: state SELECT FROM
fax495 => BEGIN
fax495Parms.paperWidth ← PromptForFaxPaperWidth[
exec: exec, useDefault: TRUE, defaultWidth: s.paperWidth];
fax495Parms.supportFineResolution ← PromptForFaxTransmissionResolution[
exec: exec, useDefault: TRUE, defaultToFine: s.fineResolutionSupported];
fax495Parms.newParametersSpecified ← TRUE; --set true whether the version really changed or not
END;
ENDCASE => ERROR;
ENDCASE => WITH s: state SELECT FROM
fax495 => BEGIN --keep same values as before
fax495Parms.paperWidth ← s.paperWidth;
fax495Parms.supportFineResolution ← s.fineResolutionSupported;
END;
ENDCASE => ERROR;
END; --GetRequiredFax295InitParms
GetRequiredRavenInitParms: PROCEDURE [exec: NSExec.Handle,
state: PSState.StateHandle, newOptionChosen: BOOLEAN]
RETURNS [ravenParms: raven PSInit.RequiredParms] = BEGIN
SELECT TRUE FROM
newOptionChosen => BEGIN
ravenParms.version ←
PromptForRavenVersion[exec: exec, useDefault: FALSE];
ravenParms.enableUnlimitedPrinting ←
IF SpecialSpace.realMemorySize > PSInit.unlimitedPrintingCutOffMemSize THEN
PromptAboutUnlimitedPrinting[exec: exec, useDefault: FALSE]
ELSE FALSE;
ravenParms.newParametersSpecified ← TRUE;
END;
configure => WITH s: state SELECT FROM
raven => BEGIN
ravenParms.version ←
PromptForRavenVersion[exec: exec, useDefault: TRUE, defaultVersion: s.engineBuild];
ravenParms.enableUnlimitedPrinting ←
IF SpecialSpace.realMemorySize > PSInit.unlimitedPrintingCutOffMemSize THEN
PromptAboutUnlimitedPrinting[
exec: exec, useDefault: TRUE, defaultToTrue: s.enableUnlimitedPrinting]
ELSE FALSE;
ravenParms.newParametersSpecified ← TRUE; --set true whether the version really changed or not
END;
ENDCASE => ERROR;
ENDCASE => WITH s: state SELECT FROM
raven => BEGIN --keep same values as before
ravenParms.version ← s.engineBuild;
IF SpecialSpace.realMemorySize > PSInit.unlimitedPrintingCutOffMemSize THEN
ravenParms.enableUnlimitedPrinting ← s.enableUnlimitedPrinting
ELSE BEGIN
IF s.enableUnlimitedPrinting THEN
mem size changed; unlimited printing no longer available
ravenParms.newParametersSpecified ← TRUE;
ravenParms.enableUnlimitedPrinting ← FALSE;
END;
END;
ENDCASE => ERROR;
END; --GetRequiredRavenInitParms
**** OPTIONAL ENGINE INITIALIZATION PARAMETERS ****
GetOptionalBansheeInitParms: PROCEDURE [
exec: NSExec.Handle,
requiredParms: PSInit.RequiredParms,
defaultVMPagesForDecomposer: LONG CARDINAL,
defaultDecomposerRMPageLimit: LONG CARDINAL,
defaultSpoolWhileMarking: BOOLEAN,
defaultDecomposeWhileMarking: BOOLEAN,
defaultBBPages: LONG CARDINAL]
RETURNS [bansheeParms: bansheeDl PSInit.OptionalParms] = BEGIN
normalBBPages, normalRMPageLimit: LONG CARDINAL ← 0;
bansheeParms.vmPagesForDecomposer ← PromptForVMPagesForDecomposer[
exec: exec, useDefault: TRUE, defaultValue: defaultVMPagesForDecomposer];
bansheeParms.deleteIncompatibleFontsandTPs ← PromptWithFontDeletionQuestion[
exec: exec, useDefault: TRUE, defaultToTrue: TRUE];
bansheeParms.spoolWhileMarking ← PromptForSpoolWhileMarking[
exec: exec, useDefault: TRUE, defaultToTrue: defaultSpoolWhileMarking];
bansheeParms.decomposeWhileMarking ← PromptForDecomposeWhileMarking[
exec: exec, useDefault: TRUE, defaultToTrue: defaultDecomposeWhileMarking];
WITH r: requiredParms SELECT FROM
bansheeDl => BEGIN
normalBBPages ← MiscUtilities.CalcPagesForBandBuffers[
bansheeDl, r.enableUnlimitedPrinting];
bansheeParms.bandBufferPages ← PromptForBandBufferPages[
exec: exec, useDefault: TRUE, normalValue: normalBBPages,
minValue: 3, maxValue: 7,
defaultValue: IF defaultBBPages = PSInit.calculateDefaultBBAllocation
THEN normalBBPages ELSE defaultBBPages];
END;
ENDCASE => ERROR;
Must prompt for RM page limit after prompting for band buffer pages, since the number of band buffer pages is a parameter for calculating the RM limit:
normalRMPageLimit ← MiscUtilities.CalcRMPagesForMarker[bansheeParms.bandBufferPages];
bansheeParms.decomposerRMPageLimit ← PromptForRMAllocation[
exec: exec, useDefault: TRUE, normalValue: normalRMPageLimit,
defaultValue:
IF defaultDecomposerRMPageLimit = PSInit.calculateDefaultRMAllocation
THEN normalRMPageLimit ELSE defaultDecomposerRMPageLimit
];
END; --GetOptionalBansheeInitParms
GetOptionalD1InitParms: PROCEDURE [
exec: NSExec.Handle,
defaultVMPagesForDecomposer: LONG CARDINAL,
defaultDecomposerRMPageLimit: LONG CARDINAL,
defaultSpoolWhileMarking: BOOLEAN,
defaultDecomposeWhileMarking: BOOLEAN,
defaultBBPages: LONG CARDINAL]
RETURNS [d1Parms: d1 PSInit.OptionalParms] = BEGIN
normalBBPages, normalRMPageLimit: LONG CARDINAL ← 0;
d1Parms.vmPagesForDecomposer ← PromptForVMPagesForDecomposer[
exec: exec, useDefault: TRUE, defaultValue: defaultVMPagesForDecomposer];
d1Parms.deleteIncompatibleFontsandTPs ← PromptWithFontDeletionQuestion[
exec: exec, useDefault: TRUE, defaultToTrue: TRUE];
d1Parms.spoolWhileMarking ← PromptForSpoolWhileMarking[
exec: exec, useDefault: TRUE, defaultToTrue: defaultSpoolWhileMarking];
d1Parms.decomposeWhileMarking ← PromptForDecomposeWhileMarking[
exec: exec, useDefault: TRUE, defaultToTrue: defaultDecomposeWhileMarking];
normalBBPages ← MiscUtilities.CalcPagesForBandBuffers[d1];
d1Parms.bandBufferPages ← PromptForBandBufferPages[
exec: exec, useDefault: TRUE, normalValue: normalBBPages,
minValue: 3, maxValue: 8,
defaultValue: IF defaultBBPages = PSInit.calculateDefaultBBAllocation
THEN normalBBPages ELSE defaultBBPages];
Must prompt for RM page limit after prompting for band buffer pages, since the number of band buffer pages is a parameter for calculating the RM limit:
normalRMPageLimit ← MiscUtilities.CalcRMPagesForMarker[d1Parms.bandBufferPages];
d1Parms.decomposerRMPageLimit ← PromptForRMAllocation[
exec: exec, useDefault: TRUE, normalValue: normalRMPageLimit,
defaultValue:
IF defaultDecomposerRMPageLimit = PSInit.calculateDefaultRMAllocation
THEN normalRMPageLimit ELSE defaultDecomposerRMPageLimit];
END; --GetOptionalD1InitParms
GetOptionalFax295InitParms: PROCEDURE [
exec: NSExec.Handle,
defaultVMPagesForDecomposer: LONG CARDINAL,
defaultDecomposerRMPageLimit: LONG CARDINAL,
defaultSpoolWhileMarking: BOOLEAN,
defaultDecomposeWhileMarking: BOOLEAN,
defaultBBPages: LONG CARDINAL]
RETURNS [fax295Parms: fax295 PSInit.OptionalParms] = BEGIN
normalBBPages, normalRMPageLimit: LONG CARDINAL ← 0;
fax295Parms.vmPagesForDecomposer ← PromptForVMPagesForDecomposer[
exec: exec, useDefault: TRUE, defaultValue: defaultVMPagesForDecomposer];
fax295Parms.deleteIncompatibleFontsandTPs ← PromptWithFontDeletionQuestion[
exec: exec, useDefault: TRUE, defaultToTrue: TRUE];
fax295Parms.spoolWhileMarking ← PromptForSpoolWhileMarking[
exec: exec, useDefault: TRUE, defaultToTrue: defaultSpoolWhileMarking];
fax295Parms.decomposeWhileMarking ← PromptForDecomposeWhileMarking[
exec: exec, useDefault: TRUE, defaultToTrue: defaultDecomposeWhileMarking];
normalBBPages ← MiscUtilities.CalcPagesForBandBuffers[fax295];
fax295Parms.bandBufferPages ← PromptForBandBufferPages[
exec: exec, useDefault: TRUE, normalValue: normalBBPages,
minValue: 3, maxValue: 7,
defaultValue: IF defaultBBPages = PSInit.calculateDefaultBBAllocation
THEN normalBBPages ELSE defaultBBPages];
Must prompt for RM page limit after prompting for band buffer pages, since the number of band buffer pages is a parameter for calculating the RM limit:
normalRMPageLimit ← MiscUtilities.CalcRMPagesForMarker[fax295Parms.bandBufferPages];
fax295Parms.decomposerRMPageLimit ← PromptForRMAllocation[
exec: exec, useDefault: TRUE, normalValue: normalRMPageLimit,
defaultValue:
IF defaultDecomposerRMPageLimit = PSInit.calculateDefaultRMAllocation
THEN normalRMPageLimit ELSE defaultDecomposerRMPageLimit];
END; --GetOptionalFax295InitParms
GetOptionalFax495InitParms: PROCEDURE [
exec: NSExec.Handle,
defaultVMPagesForDecomposer: LONG CARDINAL,
defaultDecomposerRMPageLimit: LONG CARDINAL,
defaultSpoolWhileMarking: BOOLEAN,
defaultDecomposeWhileMarking: BOOLEAN,
defaultBBPages: LONG CARDINAL]
RETURNS [fax495Parms: fax495 PSInit.OptionalParms] = BEGIN
normalBBPages, normalRMPageLimit: LONG CARDINAL ← 0;
fax495Parms.vmPagesForDecomposer ← PromptForVMPagesForDecomposer[
exec: exec, useDefault: TRUE, defaultValue: defaultVMPagesForDecomposer];
fax495Parms.deleteIncompatibleFontsandTPs ← PromptWithFontDeletionQuestion[
exec: exec, useDefault: TRUE, defaultToTrue: TRUE];
fax495Parms.spoolWhileMarking ← PromptForSpoolWhileMarking[
exec: exec, useDefault: TRUE, defaultToTrue: defaultSpoolWhileMarking];
fax495Parms.decomposeWhileMarking ← PromptForDecomposeWhileMarking[
exec: exec, useDefault: TRUE, defaultToTrue: defaultDecomposeWhileMarking];
normalBBPages ← MiscUtilities.CalcPagesForBandBuffers[fax495];
fax495Parms.bandBufferPages ← PromptForBandBufferPages[
exec: exec, useDefault: TRUE, normalValue: normalBBPages,
minValue: 3, maxValue: 7,
defaultValue: IF defaultBBPages = PSInit.calculateDefaultBBAllocation
THEN normalBBPages ELSE defaultBBPages];
Must prompt for RM page limit after prompting for band buffer pages, since the number of band buffer pages is a parameter for calculating the RM limit:
normalRMPageLimit ← MiscUtilities.CalcRMPagesForMarker[fax495Parms.bandBufferPages];
fax495Parms.decomposerRMPageLimit ← PromptForRMAllocation[
exec: exec, useDefault: TRUE, normalValue: normalRMPageLimit,
defaultValue:
IF defaultDecomposerRMPageLimit = PSInit.calculateDefaultRMAllocation
THEN normalRMPageLimit ELSE defaultDecomposerRMPageLimit];
END; --GetOptionalFax495InitParms
GetOptionalFEPS9700InitParms: PROCEDURE [
exec: NSExec.Handle,
defaultVMPagesForDecomposer: LONG CARDINAL,
defaultDecomposerRMPageLimit: LONG CARDINAL,
defaultBBPages: LONG CARDINAL]
RETURNS [feps9700Parms: feps9700 PSInit.OptionalParms] = BEGIN
normalRMPageLimit: LONG CARDINAL ← 0;
feps9700Parms.vmPagesForDecomposer ← PromptForVMPagesForDecomposer[
exec: exec, useDefault: TRUE, defaultValue: defaultVMPagesForDecomposer];
feps9700Parms.deleteIncompatibleFontsandTPs ← PromptWithFontDeletionQuestion[
exec: exec, useDefault: TRUE, defaultToTrue: TRUE];
feps9700Parms.bandBufferPages ← MiscUtilities.CalcPagesForBandBuffers[feps9700];
Must prompt for RM page limit after prompting for band buffer pages, since the number of band buffer pages is a parameter for calculating the RM limit:
normalRMPageLimit ← MiscUtilities.CalcRMPagesForMarker[feps9700Parms.bandBufferPages];
feps9700Parms.decomposerRMPageLimit ← PromptForRMAllocation[
exec: exec, useDefault: TRUE, normalValue: normalRMPageLimit,
defaultValue:
IF defaultDecomposerRMPageLimit = PSInit.calculateDefaultRMAllocation
THEN normalRMPageLimit ELSE defaultDecomposerRMPageLimit];
END; --GetOptionalFEPS9700Parms
GetOptionalFX3500InitParms: PROCEDURE [
exec: NSExec.Handle,
defaultVMPagesForDecomposer: LONG CARDINAL,
defaultDecomposerRMPageLimit: LONG CARDINAL,
defaultSpoolWhileMarking: BOOLEAN,
defaultDecomposeWhileMarking: BOOLEAN,
defaultBBPages: LONG CARDINAL]
RETURNS [fx3500Parms: fx3500 PSInit.OptionalParms] = BEGIN
normalBBPages, normalRMPageLimit: LONG CARDINAL ← 0;
fx3500Parms.vmPagesForDecomposer ← PromptForVMPagesForDecomposer[
exec: exec, useDefault: TRUE, defaultValue: defaultVMPagesForDecomposer];
fx3500Parms.deleteIncompatibleFontsandTPs ← PromptWithFontDeletionQuestion[
exec: exec, useDefault: TRUE, defaultToTrue: TRUE];
fx3500Parms.spoolWhileMarking ← PromptForSpoolWhileMarking[
exec: exec, useDefault: TRUE, defaultToTrue: defaultSpoolWhileMarking];
fx3500Parms.decomposeWhileMarking ← PromptForDecomposeWhileMarking[
exec: exec, useDefault: TRUE, defaultToTrue: defaultDecomposeWhileMarking];
normalBBPages ← MiscUtilities.CalcPagesForBandBuffers[fx3500];
fx3500Parms.bandBufferPages ← PromptForBandBufferPages[
exec: exec, useDefault: TRUE, normalValue: normalBBPages,
minValue: 3, maxValue: 7,
defaultValue: IF defaultBBPages = PSInit.calculateDefaultBBAllocation
THEN normalBBPages ELSE defaultBBPages];
Must prompt for RM page limit after prompting for band buffer pages, since the number of band buffer pages is a parameter for calculating the RM limit:
normalRMPageLimit ← MiscUtilities.CalcRMPagesForMarker[fx3500Parms.bandBufferPages];
fx3500Parms.decomposerRMPageLimit ← PromptForRMAllocation[
exec: exec, useDefault: TRUE, normalValue: normalRMPageLimit,
defaultValue:
IF defaultDecomposerRMPageLimit = PSInit.calculateDefaultRMAllocation
THEN normalRMPageLimit ELSE defaultDecomposerRMPageLimit];
END; --GetOptionalFX3500InitParms
GetOptionalRavenInitParms: PROCEDURE [
exec: NSExec.Handle,
requiredParms: PSInit.RequiredParms,
defaultVMPagesForDecomposer: LONG CARDINAL,
defaultDecomposerRMPageLimit: LONG CARDINAL,
defaultSpoolWhileMarking: BOOLEAN,
defaultDecomposeWhileMarking: BOOLEAN,
defaultBBPages: LONG CARDINAL]
RETURNS [ravenParms: raven PSInit.OptionalParms] = BEGIN
normalBBPages, normalRMPageLimit: LONG CARDINAL ← 0;
ravenParms.vmPagesForDecomposer ← PromptForVMPagesForDecomposer[
exec: exec, useDefault: TRUE, defaultValue: defaultVMPagesForDecomposer];
ravenParms.deleteIncompatibleFontsandTPs ← PromptWithFontDeletionQuestion[
exec: exec, useDefault: TRUE, defaultToTrue: TRUE];
ravenParms.spoolWhileMarking ← PromptForSpoolWhileMarking[
exec: exec, useDefault: TRUE, defaultToTrue: defaultSpoolWhileMarking];
ravenParms.decomposeWhileMarking ← PromptForDecomposeWhileMarking[
exec: exec, useDefault: TRUE, defaultToTrue: defaultDecomposeWhileMarking];
WITH r: requiredParms SELECT FROM
raven => BEGIN
normalBBPages ← MiscUtilities.CalcPagesForBandBuffers[
raven, r.enableUnlimitedPrinting];
ravenParms.bandBufferPages ← PromptForBandBufferPages[
exec: exec, useDefault: TRUE, normalValue: normalBBPages,
minValue: 3, maxValue: 7,
defaultValue: IF defaultBBPages = PSInit.calculateDefaultBBAllocation
THEN normalBBPages ELSE defaultBBPages];
END;
ENDCASE => ERROR;
normalRMPageLimit ← MiscUtilities.CalcRMPagesForMarker[ravenParms.bandBufferPages];
ravenParms.decomposerRMPageLimit ← PromptForRMAllocation[
exec: exec, useDefault: TRUE, normalValue: normalRMPageLimit,
defaultValue:
IF defaultDecomposerRMPageLimit = PSInit.calculateDefaultRMAllocation
THEN normalRMPageLimit ELSE defaultDecomposerRMPageLimit];
END; --GetOptionalRavenInitParms
**** NON NORMAL INIT TYPE ****
SetNonNormalInitOptions: PROCEDURE [exec: NSExec.Handle] = BEGIN
choices: CARDINAL = 3;
optionMsgKeys: ARRAY [0..choices) OF PSExecMessages.Key ← [
mConfigure, mStopAll, mDeleteBackingFiles];
optionChoices: ARRAY [0..choices) OF NSString.String;
optionsChosen: TextInput.Chosen;
PSExecInternal.GetList[choices, DESCRIPTOR[optionMsgKeys], DESCRIPTOR[optionChoices]];
DO
optionsChosen ← TextInput.GetChoices[tty: NSExec.GetTTY[exec],
prompt: M[mSpecifyNonNormalOption],
choices: DESCRIPTOR[optionChoices], default: 0];
Get confirmation and set global init option booleans:
IF deleteBackingFiles ← optionsChosen[2] THEN
IF NOT TextInput.Confirm[
NSExec.GetTTY[exec], M[mConfirmDeleteBackingFiles]] THEN LOOP;
configure ← optionsChosen[0];
stopQandP ← optionsChosen[1];
EXIT;
ENDLOOP;
END; -- SetNonNormalInitOptions
==============================
SUPPORT ROUTINES
==============================
DeleteObsoleteBcds: PROCEDURE [
workingDir: NSFile.Handle, session: NSFile.Session] =
Deletes obsolete bcds from the working directory. This proc is currently backwards compatible to Services 8.0. NOTE: Update or delete the proc in a later release.
BEGIN
Delete the old loadable engine config used for Print Service 8 and 9, but obsolete in 10.0.
oldEngineConfigName: NSString.String = Str["PSEngineConfig.bcd"L];
NSFile.DeleteByName[workingDir, oldEngineConfigName, session
! NSFile.Error => GOTO NoEngineConfig];
If engine config isn't there, don't bother looking for RS232CCommon.
BEGIN
Delete RS232CCommon.bcd, used for Print Service 8 and 9, but obsolete in 10.0. Must check create date of file, so we don't delete it if it is a current version that may be used by other services.
rs232CCommonName: NSString.String = Str["RS232CCommon.bcd"L];
selections: NSFile.Selections ← NSFile.noSelections;
attribute: NSFile.Attributes ← NSFile.GetAttributesRecord[];
fileDate: Time.Unpacked;
BEGIN
selections.interpreted[createdOn] ← TRUE;
NSFile.GetAttributesByName[workingDir, rs232CCommonName, selections,
attribute, session ! NSFile.Error => GOTO NoRS232CCommon];
fileDate ← Time.Unpack[attribute.createdOn];
IF fileDate.year = 1984 THEN
NSFile.DeleteByName[workingDir, rs232CCommonName, session];
NSFile.ReleaseAttributesRecord[attribute];
EXITS NoRS232CCommon => NSFile.ReleaseAttributesRecord[attribute];
END;
END;
EXITS NoEngineConfig => NULL;
END; -- of DeleteObsoleteBcds
LoadAndRunPrintingOptionBcd: PROCEDURE [
exec: NSExec.Handle, option: PrintingTypes.Option]
RETURNS [success: BOOLEAN] = BEGIN
runFailed: BOOLEANFALSE;
bcdToRun: NSString.String ← SELECT option FROM
bansheeDl => PS.bansheeConfigName,
d1 => PS.d1ConfigName,
fax295, fax495 => PS.faxConfigName,
feps9700 => PS.fepsConfigName,
fx3500 => PS.fx3500ConfigName,
ENDCASE => PS.ravenConfigName;
VersionMismatchError: PROCEDURE RETURNS [resume: BOOLEANFALSE] = BEGIN
stringArray: ARRAY [0..1) OF NSString.String ← [bcdToRun];
freeThisString: NSString.String ← Message.Expand[
M[mContinueToRun], DESCRIPTOR[stringArray], execHeap];
resume ← TextInput.Confirm[NSExec.GetTTY[exec], freeThisString];
NSString.FreeString[execHeap, freeThisString];
IF NOT resume THEN BEGIN
outputHandle: XFormat.Handle ← NSExec.OutputHandle[exec];
stringArray[0] ← bcdToRun;
freeThisString ← Message.Expand[
M[mNotRun], DESCRIPTOR[stringArray], execHeap];
outputHandle.Blanks[8];
outputHandle.NSLine[freeThisString];
NSString.FreeString[execHeap, freeThisString];
runFailed ← TRUE;
END;
END; --VersionMismatchError
Run: PROCEDURE = BEGIN
resume: BOOLEANFALSE;
ServicesError.SetCatching[on: TRUE];
NSExec.Run[bcdToRun, exec, --codeLinks: -- TRUE!
ServicesError.Caught => {
IF (resume ← VersionMismatchError[]) THEN {
ServicesError.SetCatching[on: FALSE]; RETRY}
ELSE CONTINUE};
Runtime.VersionMismatch =>
IF resume THEN {
resume ← FALSE; -- allows subsequent version mismatches to be flagged to the user
ServicesError.SetCatching[on: TRUE];
RESUME}
ELSE REJECT];
END; -- Run
ServicesError.Catch[Run, LOOPHOLE[exec]];
RETURN [success ← NOT runFailed];
END; -- of LoadAndRunPrintingOptionBcd
PromptAboutUnlimitedPrinting: PROCEDURE [
exec: NSExec.Handle, useDefault: BOOLEAN, defaultToTrue: BOOLEANTRUE]
RETURNS [enableUnlimitedPrinting: BOOLEAN] = BEGIN
enableUnlimitedPrinting ← TextInput.Confirm[
tty: NSExec.GetTTY[exec], prompt: M[mUnlimitedPrintingPrompt],
default: IF useDefault THEN
IF defaultToTrue THEN yes ELSE no
ELSE TextInput.nilYesNo];
END; --PromptAboutUnlimitedPrinting
PromptForBandBufferPages: PROCEDURE [
exec: NSExec.Handle, useDefault: BOOLEAN,
normalValue, minValue, maxValue: LONG CARDINAL,
defaultValue: LONG CARDINAL ← 0] RETURNS [bandBufferPages: LONG CARDINAL] = BEGIN
NOTE: See MiscUtilitiesImpl.mesa for detailed explanation of band buffer allocation, including the min, max and normal values.
normalCount: LONG CARDINAL ← normalValue/MiscUtilities.pagesPerBandBuffer;
bandBuffers: LONG CARDINAL ← 0;
sNormalCount: LONG STRING ← [10];
sBBPages: LONG STRING ← [10];
freeThisString: NSString.String;
stringArray: ARRAY [0..2) OF NSString.String;
String.AppendLongDecimal[sNormalCount, normalCount];
stringArray[0] ← Str[sNormalCount];
String.AppendLongDecimal[sBBPages, MiscUtilities.pagesPerBandBuffer];
stringArray[1] ← Str[sBBPages];
freeThisString ← Message.Expand[
M[mBandBuffersPrompt], DESCRIPTOR[stringArray], execHeap];
bandBuffers ← TextInput.GetLongDecimal[
tty: NSExec.GetTTY[exec], prompt: freeThisString,
min: minValue, max: maxValue,
default: IF useDefault THEN defaultValue/MiscUtilities.pagesPerBandBuffer ELSE TextInput.nilDecimal];
bandBufferPages ← bandBuffers * MiscUtilities.pagesPerBandBuffer;
NSString.FreeString[execHeap, freeThisString];
END; --PromptForBandBufferPages
PromptForDecomposeWhileMarking: PROCEDURE [exec: NSExec.Handle, useDefault: BOOLEAN,
defaultToTrue: BOOLEAN] RETURNS [decomposeWhileMarking: BOOLEAN] = BEGIN
decomposeWhileMarking ← TextInput.Confirm[
tty: NSExec.GetTTY[exec], prompt: M[mDecomposeWhileMarkingPrompt],
default: IF useDefault THEN
IF defaultToTrue THEN yes ELSE no
ELSE TextInput.nilYesNo];
END; --PromptForDecomposeWhileMarking
PromptForPrintingOption: PROCEDURE [exec: NSExec.Handle,
currentOption: PrintingTypes.Option,
optionCount: CARDINAL,
optionChoices: LONG DESCRIPTOR FOR ARRAY OF PrintingTypes.Option]
RETURNS [option: PrintingTypes.Option] = BEGIN
tty: TTY.Handle ← NSExec.GetTTY[exec];
outputHandle: XFormat.Handle ← NSExec.OutputHandle[exec];
optionMsgKeys: PSExecInternal.KeyList ← DESCRIPTOR[NIL, 0];
optionStrings: Message.StringArray ← DESCRIPTOR[NIL, 0];
bansheeChoiceIndex, d1ChoiceIndex, --index for each printing option in optionStrings array,
fax295ChoiceIndex, fax495ChoiceIndex, --which is passed to TextInput.GetChoice
feps9700ChoiceIndex, fx3500ChoiceIndex, ravenChoiceIndex,
defaultOption: TextInput.ChoiceIndex ← TextInput.nilChoice;
freeThisString: NSString.String;
stringArray: ARRAY [0..1) OF NSString.String;
ConfirmOptionChange: PROCEDURE [newOption: PrintingTypes.Option]
RETURNS [confirmed: BOOLEAN] = BEGIN
BEGIN
Check if there are fonts installed from the previous printing option and, if so, display a warning that they will be deleted, if appropriate.
SELECT currentOption FROM
bansheeDl => SELECT newOption FROM
bansheeDl, d1 => GOTO noFontMsgNecessary;
Even though font floppies cannot be shared between banshee and d1, fonts already loaded and rotated for banshee may be used for d1. Unrotated banshee fonts will be deleted if option is changed to d1.
ENDCASE;
d1 => SELECT newOption FROM
bansheeDl, d1 => GOTO noFontMsgNecessary;
ENDCASE;
fax295, fax495 => SELECT newOption FROM
fax295, fax495 => GOTO noFontMsgNecessary;
ENDCASE;
feps9700, fx3500, raven => SELECT newOption FROM
bansheeDl, feps9700, fx3500, raven =>
GOTO noFontMsgNecessary; --Raven, fx3500 and feps9700 use same fonts. These fonts are rotated for banshee.
ENDCASE;
ENDCASE => --unknown-- GOTO noFontMsgNecessary;
stringArray[0] ← M[SELECT currentOption FROM
bansheeDl => mBanshee,
d1 => mD1,
fax295 => mTC295,
fax495 => mTC495,
feps9700 => mFEPS,
fx3500 => mFX3500,
ENDCASE => mRaven];
outputHandle.Blanks[8];
freeThisString ← Message.Expand[
M[mDeleteOldFonts], DESCRIPTOR[stringArray], execHeap];
outputHandle.NSLine[freeThisString];
NSString.FreeString[execHeap, freeThisString];
EXITS
noFontMsgNecessary => NULL;
END;
stringArray[0] ← M[SELECT newOption FROM
bansheeDl => mShortBanshee,
d1 => mD1,
fax295 => mTC295,
fax495 => mTC495,
feps9700 => mFEPS,
fx3500 => mFX3500,
ENDCASE => mRaven];
freeThisString ← Message.Expand[
M[mConfirmOption], DESCRIPTOR[stringArray], execHeap];
confirmed ← TextInput.Confirm[tty: tty, prompt: freeThisString];
NSString.FreeString[execHeap, freeThisString];
END; --ConfirmOptionChange
Mainline of PromptForPrintingOption:
optionMsgKeys ← DESCRIPTOR[Heap.MakeNode[
execHeap, SIZE[PSExecMessages.Key] * optionCount], optionCount];
optionStrings ← DESCRIPTOR[Heap.MakeNode[
execHeap, SIZE[NSString.String] * optionCount], optionCount];
Store appropriate values in optionMsgKeys array and set indices. If a certain printing option is not among the current choices, its index will remain nil.
FOR i: CARDINAL IN [0..optionCount) DO
SELECT optionChoices[i] FROM
bansheeDl => BEGIN
optionMsgKeys[i] ← mBanshee;
bansheeChoiceIndex ← i;
END;
d1 => BEGIN
optionMsgKeys[i] ← mD1;
d1ChoiceIndex ← i;
END;
fax295 => BEGIN
optionMsgKeys[i] ← mTC295;
fax295ChoiceIndex ← i;
END;
fax495 => BEGIN
optionMsgKeys[i] ← mTC495;
fax495ChoiceIndex ← i;
END;
feps9700 => BEGIN
optionMsgKeys[i] ← mFEPS;
feps9700ChoiceIndex ← i;
END;
fx3500 => BEGIN
optionMsgKeys[i] ← mFX3500;
fx3500ChoiceIndex ← i;
END;
raven => BEGIN
optionMsgKeys[i] ← mRaven;
ravenChoiceIndex ← i;
END;
ENDCASE => ERROR;
ENDLOOP;
PSExecInternal.GetList[LENGTH[optionMsgKeys], optionMsgKeys, optionStrings];
IF currentOption # unknown THEN --use current printing option as default when prompting for option
defaultOption ← SELECT currentOption FROM --defaultOption will be nilChoice, if current printing option is unknown
bansheeDl => bansheeChoiceIndex, d1 => d1ChoiceIndex,
fax295 => fax295ChoiceIndex, fax495 => fax495ChoiceIndex,
feps9700 => feps9700ChoiceIndex, fx3500 => fx3500ChoiceIndex,
ENDCASE => ravenChoiceIndex;
DO --Loop until a printing option is selected and confirmed...
SELECT TextInput.GetChoice[tty: tty,
prompt: M[mSpecifyOption],
choices: optionStrings, default: defaultOption] FROM
bansheeChoiceIndex => option ← bansheeDl;
d1ChoiceIndex => option ← d1;
fax295ChoiceIndex => option ← fax295;
fax495ChoiceIndex => option ← fax495;
feps9700ChoiceIndex => option ← feps9700;
fx3500ChoiceIndex => option ← fx3500;
ravenChoiceIndex => option ← raven;
ENDCASE => ERROR;
If a new printing option is selected, confirm the change:
SELECT currentOption FROM
option, unknown => EXIT;
ENDCASE => IF ConfirmOptionChange[option] THEN EXIT;
If option change isn't confirmed, loop and display the selections again.
ENDLOOP;
Heap.FreeNode[execHeap, BASE[optionMsgKeys]];
Heap.FreeNode[execHeap, BASE[optionStrings]];
END; --PromptForPrintingOption
PromptForFaxPaperWidth: PROCEDURE [exec: NSExec.Handle, useDefault: BOOLEAN,
defaultWidth: CARDINAL ← 0] RETURNS [width: CARDINAL] = BEGIN
choices: CARDINAL = 2;
widthMsgKeys: ARRAY [0..choices) OF PSExecMessages.Key ← [
mLetterLegalWidth, mA4Width];
widthChoices: ARRAY [0..choices) OF NSString.String;
defaultChoice: TextInput.ChoiceIndex ← IF useDefault THEN
SELECT defaultWidth FROM
PaperTypes.PaperMMDimension[a4].short => 1,
ENDCASE --letter/legal-- => 0
ELSE TextInput.nilChoice;
PSExecInternal.GetList[choices, DESCRIPTOR[widthMsgKeys], DESCRIPTOR[widthChoices]];
RETURN [
SELECT TextInput.GetChoice[
tty: NSExec.GetTTY[exec], prompt: M[mSpecifyFaxPaperWidth],
choices: DESCRIPTOR[widthChoices],
default: defaultChoice] FROM
0 => PaperTypes.PaperMMDimension[letter].short,
ENDCASE => PaperTypes.PaperMMDimension[a4].short];
END; --PromptForFaxPaperWidth
PromptForFaxTransmissionResolution: PROCEDURE [exec: NSExec.Handle,
useDefault: BOOLEAN, defaultToFine: BOOLEANTRUE]
RETURNS [supportFineResolution: BOOLEAN] = BEGIN
choices: CARDINAL = 2;
resolutionMsgKeys: ARRAY [0..choices) OF PSExecMessages.Key ← [
mStandard, mFine];
resolutionChoices: ARRAY [0..choices) OF NSString.String;
defaultChoice: TextInput.ChoiceIndex ← IF useDefault THEN
IF defaultToFine THEN 1 ELSE 0
ELSE TextInput.nilChoice;
PSExecInternal.GetList[choices, DESCRIPTOR[resolutionMsgKeys], DESCRIPTOR[resolutionChoices]];
RETURN [
SELECT TextInput.GetChoice[
tty: NSExec.GetTTY[exec], prompt: M[mSpecifyFaxResolution],
choices: DESCRIPTOR[resolutionChoices],
default: defaultChoice] FROM
0 => FALSE,
ENDCASE => TRUE];
END; --PromptForFaxTransmissionResolution
PromptForRavenVersion: PROCEDURE [exec: NSExec.Handle, useDefault: BOOLEAN,
defaultVersion: PrintingTypes.RavenBuild ← b1]
RETURNS [version: PrintingTypes.RavenBuild] = BEGIN
choices: CARDINAL = 2;
ravenMsgKeys: ARRAY [0..choices) OF PSExecMessages.Key ← [
mRavenB1, mRavenB2];
ravenChoices: ARRAY [0..choices) OF NSString.String;
defaultChoice: TextInput.ChoiceIndex ← IF useDefault THEN
SELECT defaultVersion FROM
b2 => 1, ENDCASE --b1-- => 0
ELSE TextInput.nilChoice;
PSExecInternal.GetList[choices, DESCRIPTOR[ravenMsgKeys], DESCRIPTOR[ravenChoices]];
RETURN [
SELECT TextInput.GetChoice[
tty: NSExec.GetTTY[exec], prompt: M[mSpecifyRavenBuild],
choices: DESCRIPTOR[ravenChoices],
default: defaultChoice] FROM
0 => b1,
ENDCASE => b2];
END; --PromptForRavenVersion
PromptForRMAllocation: PROCEDURE [exec: NSExec.Handle, useDefault: BOOLEAN,
normalValue: LONG CARDINAL, defaultValue: LONG CARDINAL ← 0]
RETURNS [rmAllocation: LONG CARDINAL] = BEGIN
outputHandle: XFormat.Handle ← NSExec.OutputHandle[exec];
rmAllocation ← TextInput.GetLongDecimal[
tty: NSExec.GetTTY[exec], prompt: M[mRMLimitPrompt],
min: 100, max: normalValue,
default: IF useDefault THEN defaultValue ELSE TextInput.nilLongDecimal];
END; --PromptForRMAllocation
PromptForSpoolWhileMarking: PROCEDURE [exec: NSExec.Handle, useDefault: BOOLEAN,
defaultToTrue: BOOLEAN] RETURNS [spoolWhileMarking: BOOLEAN] = BEGIN
spoolWhileMarking ← TextInput.Confirm[
tty: NSExec.GetTTY[exec], prompt: M[mSpoolWhileMarkingPrompt],
default: IF useDefault THEN
IF defaultToTrue THEN yes ELSE no
ELSE TextInput.nilYesNo];
END; --PromptForSpoolWhileMarking
PromptForVMPagesForDecomposer: PROCEDURE [exec: NSExec.Handle,
useDefault: BOOLEAN,
defaultValue: LONG CARDINAL ← 0] RETURNS
[vmPagesForDecomposer: LONG CARDINAL] = BEGIN
vmPagesForDecomposer ← TextInput.GetLongDecimal[
tty: NSExec.GetTTY[exec], prompt: M[mVMLimitPrompt],
min: 100, max: 12000,
default: IF useDefault THEN defaultValue ELSE TextInput.nilLongDecimal];
END; --PromptForVMPagesForDecomposer
PromptWithFontDeletionQuestion: PROCEDURE [exec: NSExec.Handle,
useDefault: BOOLEAN,
defaultToTrue: BOOLEAN] RETURNS
[deleteIncompatibleFontsandTPs: BOOLEAN] = BEGIN
deleteIncompatibleFontsandTPs ← TextInput.Confirm[
tty: NSExec.GetTTY[exec], prompt: M[mDeleteObsoleteFonts],
default: IF useDefault THEN
IF defaultToTrue THEN yes ELSE no
ELSE TextInput.nilYesNo];
END; --PromptWithFontDeletionQuestion
PutAsyncMessage: PSAsyncMsg.Proc
[msg: PSAsyncMsg.Message,
--insertArray: PSAsyncMsg.InsertArray ← PSAsyncMsg.nullInsertArray]-- = BEGIN
Get: PROCEDURE [domain: XMessage.Handle, key: XMessage.MsgKey]
RETURNS [string: NSString.String] = {
r: XString.ReaderBody ← XMessage.Get[domain, key];
string ← [bytes: LOOPHOLE[r.bytes], length: r.limit, maxlength: r.limit]};
IF insertArray = PSAsyncMsg.nullInsertArray THEN
NSExec.BroadcastAsyncMessage[Get[msg.domain, msg.key], psClientID] --output msg to all active execs
ELSE BEGIN
stringCount: CARDINALLENGTH[insertArray];
freeThisStringArray: Message.StringArray ←
DESCRIPTOR[Heap.MakeNode[execHeap, SIZE[NSString.String] * stringCount], stringCount];
FOR i: CARDINAL IN [0..stringCount) DO
IF insertArray[i].m # PSAsyncMsg.nullMsg THEN
freeThisStringArray[i] ← Get[
insertArray[i].m.domain, insertArray[i].m.key]
ELSE freeThisStringArray[i] ← insertArray[i].s;
ENDLOOP;
PSExecInternal.ExpandArrayAndPrintAsync[
Get[msg.domain, msg.key], freeThisStringArray];
Heap.FreeNode[execHeap, BASE[freeThisStringArray]];
END;
END; --PutAsyncMessage
SetInitialState: PROCEDURE [oldOption, newOption: PrintingTypes.Option] = BEGIN
This procedure compares the old printing option to the new printing option. If different fonts are required for the new printing option, printing is stopped with the message to check that fonts have been installed. Or, if the new printing option is the feps9700, the message is that the target print service should be set.
StopMessage: TYPE = {checkFonts, setTargetPS, setTargetPSAndCheckFonts};
StopPrinting: PROCEDURE [message: StopMessage] = TRUSTED BEGIN
systemName: NSName.NameRecord ← NSName.nullNameRecord;
systemName.local ← M[mSystemControl];
PSCommand.StopPrinting[user: @systemName, reason: M[
SELECT message FROM
setTargetPS => mSetTarget,
setTargetPSAndCheckFonts => mSetTargetAndCheckFonts,
ENDCASE => mCheckFonts]
];
END; --StopPrinting
SELECT oldOption FROM
bansheeDl, d1 => SELECT newOption FROM
bansheeDl, d1 => NULL;
fax295, fax495, fx3500, raven => StopPrinting[checkFonts]; --banshee fonts cannot be rotated back for raven or fx3500
feps9700 => StopPrinting[setTargetPSAndCheckFonts];
ENDCASE => ERROR;
fax295, fax495 => SELECT newOption FROM
raven, fx3500, bansheeDl, d1 => StopPrinting[checkFonts];
fax295, fax495 => NULL;
feps9700 => StopPrinting[setTargetPSAndCheckFonts];
ENDCASE => ERROR;
feps9700 => SELECT newOption FROM
raven, fx3500, bansheeDl, d1, fax295, fax495 => StopPrinting[checkFonts];
feps9700 => NULL;
ENDCASE => ERROR;
fx3500, raven => SELECT newOption FROM
raven, fx3500, bansheeDl => NULL; --fx3500/raven fonts are rotated for banshee
d1, fax295, fax495 => StopPrinting[checkFonts];
feps9700 => StopPrinting[setTargetPS];
ENDCASE => ERROR;
unknown => SELECT newOption FROM
raven, d1, fx3500, bansheeDl, fax295, fax495 => StopPrinting[checkFonts];
feps9700 => StopPrinting[setTargetPSAndCheckFonts];
ENDCASE => ERROR;
ENDCASE => ERROR;
END; --SetInitialState
StopQueuingAndPrintingAbnormal: PROCEDURE [exec: NSExec.Handle] = TRUSTED BEGIN
name: NSName.Name ← NSExec.UserName[exec
! NSExec.Error => GOTO noUser];
PSCommand.StopQueuing[user: name, reason: M[mAbnormalStartup]];
PSCommand.StopPrinting[user: name, reason: M[mAbnormalStartup]];
EXITS noUser => BEGIN
systemName: NSName.NameRecord ← NSName.nullNameRecord;
systemName.local ← M[mSystemControl];
PSCommand.StopQueuing[user: @systemName, reason: M[mAbnormalStartup]];
PSCommand.StopPrinting[user: @systemName, reason: M[mAbnormalStartup]];
END;
END; --StopQueuingAndPrintingAbnormal
=====================================================
RegisterCommands: PROCEDURE =
=====================================================
BEGIN
commands: ARRAY [0..27) OF NSExec.Command ← [
Command Phrase, Command Processor, Activity Check & Help Proc
for each command:
--List Documents:-- [
M[mListDocs], PSExecInternal.DisplayDocuments],
--Cancel Documents:-- [
M[mCancelDoc], PSExecInternal.CancelDocuments, AllowCancelDocuments],
--List Fonts:-- [
M[mListFonts], PSExecInternal.DisplayFonts],
--List Test Patterns:-- [
M[mListTPs], PSExecInternal.DisplayTestPatterns],
--Delete Fonts:-- [
M[mDeleteFonts], PSExecInternal.DeleteFonts, AllowDeleteFonts],
--Delete Test Patterns:-- [
M[mDeleteTPs], PSExecInternal.DeleteTestPatterns, AllowDeleteTestPatterns],
--Install From Floppy (Fonts & Test Patterns):-- [
M[mInstallFonts], PSExecInternal.InstallFromFloppy, AllowInstallFromFloppy],
--Print Test Pattern:-- [
M[mPrintTP], PSExecInternal.PrintTestPattern, AllowPrintTestPattern],
--Set Parameters:-- [
M[mSetParameters], PSExecInternal.SetParameters, AllowSetParameters],
--Set Banner:-- [
M[mSetBanner], PSExecInternal.SetParameters, AllowSetBanner],
--Show Status:-- [
M[mShowStatus], PSExecInternal.DisplayPrintServiceStatus],
--Start:-- [
M[mStart], PSExecInternal.StartQueuingAndPrinting, AllowStartQueuingAndPrinting],
--Stop:-- [
M[mStop], PSExecInternal.StopQueuingAndPrinting, AllowStopQueuingAndPrinting],
--Start Printing:-- [
M[mStartPrinting], PSExecInternal.StartPrinting, AllowStartPrinting],
--Stop Printing:-- [
M[mStopPrinting], PSExecInternal.StopPrinting, AllowStopPrinting],
--Start Queuing:-- [
M[mStartSpooling], PSExecInternal.StartQueuing, AllowStartQueuing],
--Stop Queuing:-- [
M[mStopSpooling], PSExecInternal.StopQueuing, AllowStopQueuing],
--Start Diagnostic:-- [
M[mStartDiagnostic], PSExecInternal.StartDiagnostic, AllowStartDiagnostic],
--WakeUp Printer:-- [
M[mWakeupRaven], PSExecInternal.WakeUpPrinter, AllowWakeUpPrinter],
--ShutDown Printer:-- [
M[mShutdownRaven], PSExecInternal.ShutDownPrinter, AllowShutDownPrinter],
--Reset Statistics:-- [
M[mResetStats], PSExecInternal.ResetStatistics, AllowResetStatistics],
--Rename Print Service: -- [
M[mRenamePrintService], PSExecInternal.RenamePrintService, AllowRenamePrintService],
--Put Display:-- [
M[mPutDisplay], PSExecInternal.PutPrinterDisplay, AllowPutDisplay],
--Get Display:-- [
M[mGetDisplay], PSExecInternal.GetPrinterDisplay, AllowGetDisplay],
--Set Trace:-- [
M[mSetTrace], PSExecInternal.SetTrace, AllowSetTrace],
--Set Target Print Service:-- [
M[mSetTargetPS], PSExecInternal.SetTargetPrintService, AllowSetTargetPS],
--Query Target Print Service:-- [
M[mQueryTargetPS], PSExecInternal.QueryTargetPrintService, AllowQueryTargetPS]
];
NSExec.AddClientCommands[id: psClientID, commands: DESCRIPTOR[commands]];
END; --RegisterCommands
Allow Procs all return BOOLEAN indicating whether command is currently valid:
AllowRenamePrintService: NSExec.Predicate = BEGIN
RETURN [NSExec.UserAServerSA[exec] AND PSStopped[]];
END; --AllowRenamePrintService
AllowCancelDocuments, AllowResetStatistics: NSExec.Predicate = BEGIN
RETURN [NSExec.UserAServerSA[exec] AND PSStarted[]];
END; -- AllowCancelDocuments
AllowPrintTestPattern: NSExec.Predicate = BEGIN
state: PSState.StateHandle ← PSCommand.GetPrintServiceStatus[];
RETURN [PSStarted[] AND
(state.mode.current = normal OR state.mode.current = repair)];
Don't allow PrintTestPattern when installing/deleting fonts.
END; --AllowPrintTestPattern
AllowInstallFromFloppy, AllowDeleteFonts,
AllowDeleteTestPatterns: NSExec.Predicate = BEGIN
RETURN [NSExec.UserAServerSA[exec] AND PSStarted[] AND
PSCommand.GetPrintServiceStatus[].mode.current = normal];
Mode must be normal to insure that other fonts are not being installed or deleted at the same time. (If PS is not running mode would be notStarted or shutDown.)
END; --AllowInstallFromFloppy
AllowSetParameters: NSExec.Predicate = BEGIN
state: PSState.StateHandle ← PSCommand.GetPrintServiceStatus[];
RETURN [state.option # feps9700 AND state.option # bansheeDl AND
NSExec.UserAServerSA[exec] AND PSStarted[]];
END; --AllowSetParameters
AllowSetBanner: NSExec.Predicate = BEGIN
Banshee only has one operation parameter, so the command
Set Banner is used rather than the menu oriented
Set Parameters. The same proc implements Set Banner and
Set Parameters.
RETURN [PSCommand.GetPrintServiceStatus[].option = bansheeDl AND
NSExec.UserAServerSA[exec] AND PSStarted[]];
END; --AllowSetBanner
AllowStartDiagnostic: NSExec.Predicate = BEGIN
Only allowed for raven and fx3500 engines from the LOCAL EXEC ONLY.
state: PSState.StateHandle ← PSCommand.GetPrintServiceStatus[];
IF exec # NSExec.localExec THEN RETURN [FALSE];
IF NOT PSStarted[] THEN RETURN [FALSE];
WITH s: state SELECT FROM
Mode must be normal so that we're not in repair mode or
already in diagnostic mode and we're not installing or deleting fonts.
bansheeDl, d1, fax295, fax495, fx3500, raven =>
RETURN [s.mode.current = normal];
ENDCASE => RETURN [FALSE];
END; --AllowStartDiagnostic
AllowStartQueuingAndPrinting: NSExec.Predicate = BEGIN
state: PSState.StateHandle ← PSCommand.GetPrintServiceStatus[];
RETURN [NSExec.UserLoggedOn[exec] AND
NOT state.clientControl.markerEnabled AND
state.clientControl.spooler # enabled AND
PSStarted[]];
END; --AllowStartQueuingAndPrinting
AllowStopQueuingAndPrinting: NSExec.Predicate = BEGIN
state: PSState.StateHandle ← PSCommand.GetPrintServiceStatus[];
RETURN [NSExec.UserAServerSA[exec] AND
state.clientControl.markerEnabled AND
state.clientControl.spooler = enabled AND
PSStarted[]];
END; --AllowStopQueuingAndPrinting
AllowStartPrinting: NSExec.Predicate = BEGIN
RETURN [NSExec.UserLoggedOn[exec] AND
NOT PSCommand.GetPrintServiceStatus[].clientControl.markerEnabled AND
PSStarted[]];
END; -- AllowStartPrinting
AllowStopPrinting: NSExec.Predicate = BEGIN
RETURN [NSExec.UserAServerSA[exec] AND
PSCommand.GetPrintServiceStatus[].clientControl.markerEnabled AND
PSStarted[]];
END; -- AllowStopPrinting
AllowStartQueuing: NSExec.Predicate = BEGIN
RETURN [NSExec.UserLoggedOn[exec] AND
PSCommand.GetPrintServiceStatus[].clientControl.spooler # enabled AND
PSStarted[]];
END; -- AllowStartQueuing
AllowStopQueuing: NSExec.Predicate = BEGIN
RETURN [NSExec.UserAServerSA[exec] AND
PSCommand.GetPrintServiceStatus[].clientControl.spooler = enabled AND
PSStarted[]];
END; -- AllowStopQueuing
AllowWakeUpPrinter: NSExec.Predicate = BEGIN
activity: PSState.CurrentActivity ← PSCommand.GetPrintServiceActivity[];
WITH a: activity SELECT FROM
raven => RETURN [NSExec.UserAServerSA[exec] AND NOT RepairMode[] AND
a.ravenStatus = aboutToDozeOff AND PSStarted[]];
ENDCASE => RETURN [FALSE];
END; -- AllowWakeUpPrinter
AllowShutDownPrinter: NSExec.Predicate = BEGIN
state: PSState.StateHandle ← PSCommand.GetPrintServiceStatus[];
WITH s: state SELECT FROM
raven =>
IF NSExec.UserAServerSA[exec] AND NOT RepairMode[] AND
PSStarted[] AND s.engineBuild > b1 THEN BEGIN
activity: PSState.CurrentActivity ← PSCommand.GetPrintServiceActivity[];
WITH a: activity SELECT FROM
raven => RETURN [a.ravenStatus = okay AND
a.marker = available];
ENDCASE => RETURN [FALSE]
END
ELSE RETURN [FALSE];
ENDCASE => RETURN [FALSE];
END; -- AllowShutDownPrinter
AllowPutDisplay, AllowGetDisplay: NSExec.Predicate = BEGIN
RETURN [PSCommand.GetPrintServiceStatus[].option = fx3500 AND
RepairMode[] AND PSStarted[]];
END; --AllowPutDisplay
AllowSetTrace: NSExec.Predicate = BEGIN
Allowed in repair mode or development mode
RETURN [PSStarted[] AND (RepairMode[] OR developmentMode)];
END; --AllowSetTrace
AllowSetTargetPS: NSExec.Predicate = BEGIN
RETURN [NSExec.UserAServerSA[exec] AND PSStarted[]
AND PSCommand.GetPrintServiceStatus[].option = feps9700];
END; --AllowSetTargetPS
AllowQueryTargetPS: NSExec.Predicate = BEGIN
RETURN [PSStarted[]
AND PSCommand.GetPrintServiceStatus[].option = feps9700];
END; --AllowQueryTargetPS
RepairMode: PROCEDURE RETURNS [BOOLEAN] = BEGIN
RETURN [PSCommand.GetPrintServiceStatus[].mode.current = repair];
END; --RepairMode
PSStarted: PROCEDURE RETURNS [started: BOOLEAN] = BEGIN
RETURN [PSCommandExtras.ServiceState[] = started];
END; --PSStarted
PSStopped: PROCEDURE RETURNS [stopped: BOOLEAN] = BEGIN
RETURN [PSCommandExtras.ServiceState[] = stopped];
END; --PSStopped
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]};
Str: PROCEDURE [s: LONG STRING] RETURNS [ns: NSString.String] = INLINE {
RETURN[NSString.StringFromMesaString[s]]};
END. -- of PSExecInitAImpl
LOG when/who/what
3-Oct-84 16:01:29 - Jacks - Created. Took code from PSExecAImpl and PSCommandInitImpl and added to it.
22-Oct-84 10:33:59 - Jacks - Now using CalcRMPagesForMarker from new MiscUtilities I/F; added SetInitialState; renamed ttyHeap to execHeap; added two commands for feps9700.
1-Nov-84 17:31:04 - Jacks - Removed fax295 from init engine options; added set target ps stuff to SetInitialState.
14-Nov-84 11:01:34 - Jacks - Put back prompting for fax required init parms.
19-Nov-84 13:44:11 - Jacks - Added Set Banner command for banshee.
13-Dec-84 11:31:38 - Jacks - Changed one development mode prompt string and some msg keys; removed ControlMessagesExtras.
16-Jan-85 15:32:23 - Jacks - Added "ps" prefix to all new message keys for 9.0.
18-Jan-85 16:19:18 - Jacks - Updated product factoring for feps9700.
23-Jan-85 15:13:20 - Jacks - Updated SetInitialState for banshee font situation.
7-Feb-85 9:24:21 - Jacks - Updated to newer version of PSInit.
28-Feb-85 15:22:26 - Jacks - Allow StartDiagnostic for banshee; only allow StartDiagnostic for local exec; fixed space leak in GetPrintingOption; made developmentMode PUBLIC.
19-Jun-85 11:33:29 - Jacks - Added copyright notice; updated to PS Euclid interfaces; turned off public error catching by SCS in all exec procs.
28-Jun-85 13:39:47 - Jacks - Added d1 code; removed SetCatching calls.
18-Jul-85 15:02:19 - Jacks - Updated to Euclid Services interfaces, especially XMessage.
6-Aug-85 17:31:39 - Jacks - Made List Fonts and List Test Patterns client commands; updated ConfirmOptionChange in PromptForPrintingOption for d1; updated DevelopmentModeInit to get more info from state record; made use of new CalcRMPagesForMarker and CalcPagesForBandBuffers.
20-Aug-85 14:07:14 - Jacks - Added correct min/max values to PromptForBandBufferPages and PromptForRMAllocation; added runtime loading of printing option bcds.
28-Aug-85 15:39:23 - Jacks - Enabled StartDiagnostic for fax.
6-Sep-85 15:34:16 - Jacks - Delete PSEngineConfig; one band buffer for feps9700.
9-Sep-85 13:17:48 - Jacks - Changed VM for decomoser max value; added many strings to msg file.
11-Sep-85 11:49:36 - Jacks - Changed developmentMode deleteIncompatibleFontsandTPs default to TRUE.
19-Sep-85 11:13:07 - Jacks - Minor changes.
23-Sep-85 14:00:50 - Jacks - Added GetRequiredBansheeInitParms and PromptAboutUnlimitedPrinting.
27-Sep-85 12:38:11 - Jacks - Fixed some stuff about unlimited printing.
8-Oct-85 13:17:52 - Jacks - Updated to new PSInit with changes to band buffer calculation for unlimited printing; changed spoolWhileMarking default to TRUE for US printers.
15-Oct-85 9:48:00 - Jacks - Expunge now deletes msg files.
6-Nov-85 13:06:17 - Jacks - Expunge DOESN'T delete msg files, but DOES destroy msgs; user must confirm Expunge; call PSKMessages for msg handle; catch PSInit.FontsNotCataloged.
7-Nov-85 11:11:48 - Jacks - Use LSEPFace.MaxBands in PromptForBandBufferPages; got rid of FontsNotCataloged business.
13-Nov-85 10:34:13 - Jacks - Added DeleteObsoleteBcds; default spoolWhileMarking and decomposeWhileMarking to TRUE for FX printers.
27-Nov-85 14:18:51 - Jacks - PSStarted now uses PSCommandExtras.ServiceState; updated to new product factoring bits; use default values in normal startup portion of DevelopmentModeInit.
16-Dec-85 13:00:24 - Jacks - Removed call to DisplayPrintServiceStatus from Start proc.
30-Dec-85 17:39:39 - Jacks - --PrintServiceCommand Max band buffers down to 7.
28-Jan-86 14:20:19 - Jacks - Added min and max parms to PromptForBandBufferPages (max for d1 is 8; max for rest is 7).
29-Apr-86 14:11:37 - Jacks - Changed messages displayed when reserved memory is not available.
19-May-86 10:38:42 - Jacks - Don't prompt to confirm printing option change if previously option wasn't set; changed expunge warning prompt; prompt for non-normal startup option (configure or delete backing files).
21-May-86 12:05:32 - Jacks - Split up and renamed module: moved all but Initialize stuff to PSExecInitBImpl; added another choice to non-normal startup options; added init option booleans: configure, stopQandP, deleteBackingFiles; made us of new PS.displayMemStatus.
29-Jul-86 17:18:42 - Jacks - Changed messages displayed when required memory is already allocated.