ClientProcs:
TYPE =
RECORD [
init:
PROCEDURE [exec: Handle, normal:
BOOLEAN],
normal indicates whether the client should consider this a "normal" startup.
start: ExecProc, -- called to start a client
stop:
PROCEDURE [exec: Handle, stopMode: StopMode],
called to stop a client
unload: ExecProc,
<< is called when a client is unloaded from the exec. The client should use this proc to perform any necessary cleanup, including removing any commands it may have registered. >>
expunge: ExecProc,
<< called when a client is being permanently removed from a server. The client should use this proc to delete any data files which it created during runtime, but will not be needed after the client is permanently removed. >>
logon: ExecProc ← NIL, -- called when a user logs on
logoff: ExecProc ← NIL, -- called when a user logs off
name:
PROCEDURE [nameProc:
PROCEDURE [clientName: NSString.String]] ←
NIL,
Returns the name of the client by calling nameProc with the appropriate value for clientName.
status:
PROCEDURE [statusProc:
PROCEDURE [status: ClientStatus, comment: NSString.String]] ←
NIL
Returns the client status and a short comment about that status by calling statusProc.
];
ClientStatus: TYPE = MACHINE DEPENDENT {started, starting, stopped, stopping};
Command:
TYPE =
RECORD [
name: NSString.String, -- the word(s) composing the command
proc: ExecProc, -- performs the command
activityCheck: Predicate ← NIL, -- called to see if the command is active
helpProc: ExecProc ← NIL]; -- called when the user requests help for the command
Commands: TYPE = REF CommandsRep;
CommandsRep: TYPE ~ RECORD [command: SEQUENCE length: CARDINAL OF Command];
Context: TYPE = LONG UNSPECIFIED;
EnumerateClientProc: TYPE = PROCEDURE [id: ClientID, command: Command, acronym: ROPE, procs: ClientProcs] RETURNS [continue: BOOLEAN ← TRUE];
EnumerateExecProc: TYPE = PROCEDURE [exec: Handle] RETURNS [continue: BOOLEAN ← TRUE];
ExecProc: TYPE = PROCEDURE [exec: Handle];
Handle: TYPE [2];
Predicate:
TYPE =
PROCEDURE [exec: Handle]
RETURNS [
BOOLEAN];
Returns TRUE iff the command associated with the predicate is available to the user.
StopMode: TYPE = {quiesce, quitCold};
TerminationHandler: TYPE = PROCEDURE [exec: Handle, context: Context];
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Constants :
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
nullHandle: Handle = LOOPHOLE[LONG[NIL]];
nullClientID: ClientID = [LAST[CARDINAL]];
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Variables :
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
localExec: READONLY Handle; -- handle for the local TTY
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Errors:
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Error: ERROR [type: Errortype];
Errortype: TYPE = {cannotExpunge, cannotInitialize, duplicateCommand, invalidExec, invalidID, invalidString, noContextSet, noUser};
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Operations:
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Creating and Manipulating Exec Clients:
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
AssignClientID: PROCEDURE RETURNS [ClientID];
CreateClient:
PROCEDURE [id: ClientID, command: Command, procs: ClientProcs,
acronym: NSString.String];
<< adds a client to the executive. id is obtained from AssignClientID. command is registered as an exec command. The command name should be the generic name of the client (File Service, Mail Service, Print Service, etc). acronym is a two or three character abbreviation for the command name and is used as a shorthand way to identify the client when interacting with the user. The command proc is executed whenever the user gives command name as a command. Also, if any client commands have been added via AddClientCommands they will then become available and the user will be prompted by acronym followed by a ">", e.g. FS>, PS>, etc.
Error[invalidString] is raised if the command name is a null string or contains illegal characters. Error[duplicateCommand] is raised if command name duplicates an existing command. Error[invalidID] if id is nil or obsolete.>>
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
User Data:
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
All operations return values for the user logged on at exec. May raise Error[noUser].
UserName: PROCEDURE [exec: Handle] RETURNS [name: CHName.Name];
UserIdentity: PROCEDURE [exec: Handle] RETURNS [identity: XNSAuth.Identity];
UserFilingSession: PROCEDURE [exec: Handle] RETURNS [session: NSFile.Session];
UserState: PROCEDURE [exec: Handle] RETURNS [loggedOn, serverSA, enabled: BOOLEAN];
UserLoggedOn, UserAServerSA, UserEnabled: Predicate; -- will not raise Error[noUser]
29-Apr-85 15:52:51 - McManis - Added cannotExpunge and cannotInitialize to ErrorType. Removed notInitialized from ClientStatus. Added predicates for Genesis.