<> <> <> <> <> 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]; <> psClientID: NSExec.ClientID _ PSExec.GetClientID[]; <> configure, stopQandP, deleteBackingFiles: BOOLEAN _ FALSE; <> execMsgs: XMessage.Handle _ PSKMessages.GetHandle[exec]; <<************************************************>> <> <> <> <> <<************************************************>> Initialize: PUBLIC PROCEDURE [exec: NSExec.Handle, normal: BOOLEAN] = BEGIN engineFakerName: NSString.String = Str["EngineFakerConfig.bcd"L]; <> runningInTajo: BOOLEAN _ NSString.EquivalentStrings[PS.ravenConfigName, engineFakerName]; outputHandle: XFormat.Handle _ NSExec.OutputHandle[exec]; printingOption, oldPrintingOption: PrintingTypes.Option _ unknown; state: PSState.StateHandle _ NIL; newOptionChosen: BOOLEAN _ FALSE; printServiceName: NSName.Name _ NIL; requiredParms: PSInit.RequiredParms _ [printingOptionParms: unknown[]]; optionalParms: PSInit.OptionalParms _ [printingOptionParms: unknown[]]; DevelopmentModeInit: PROCEDURE = BEGIN <> <> <> defaultVMPagesForDecomposer: LONG CARDINAL _ IF newOptionChosen THEN 6000 ELSE state.decomposerVMPages; defaultDecomposerRMPageLimit: LONG CARDINAL _ IF newOptionChosen THEN PSInit.calculateDefaultRMAllocation ELSE state.decomposerRMPagesForMarker; <> <> 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; <> <> 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 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; <> <> 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 newOptionChosen THEN SetInitialState[oldOption: oldPrintingOption, newOption: printingOption]; <> IF stopQandP THEN StopQueuingAndPrintingAbnormal[exec]; PSExecInternal.Start[exec]; --Call start proc. END; --Initialize <<================================================>> <> <<================================================>> <<**** ENGINE TYPE ****>> GetPrintingOption: PROCEDURE [exec: NSExec.Handle, state: PSState.StateHandle, runningInTajo: BOOLEAN] RETURNS [option: PrintingTypes.Option] = <