DIRECTORY DFOperations USING [InfoClass, InteractionProc], DFUtilities USING [Date], FS USING [ErrorDesc], IO USING [STREAM], Rope USING [ROPE]; DFInternal: CEDAR DEFINITIONS = BEGIN OPEN Ops: DFOperations, Utils: DFUtilities; ROPE: TYPE = Rope.ROPE; Client: TYPE = REF ClientDescriptor; ClientDescriptor: TYPE = RECORD [ proc: Ops.InteractionProc, data: REF ANY, -- to be passed as 'clientData' parameter of 'proc' log: IO.STREAM ]; SimpleInteraction: PROC [client: Client, interaction: REF ANY]; YesOrNo: PROC [client: Client, message: ROPE, default: BOOL, blunder: BOOL _ FALSE] RETURNS [BOOL]; DoInteraction: PROC [client: Client, interaction: REF ANY] RETURNS [response: REF ANY]; CheckAbort: PROC [client: Client]; DoAbort: PROC [ log: IO.STREAM, message: ROPE _ NIL, proc: Ops.InteractionProc _ NIL, clientData: REF ANY _ NIL]; AbortDF: ERROR; DefaultInteractionProc: Ops.InteractionProc; LocalFileInfo: TYPE = RECORD [ name: ROPE, attachedTo: ROPE, date: Utils.Date _ [], keep: INT _ -1 ]; RemoteFileInfo: TYPE = RECORD [ name: ROPE, date: Utils.Date _ [] ]; GetFileInfo: PROC [ info: REF ANY, notFoundOK: BOOL _ FALSE, remoteCheck: BOOL _ FALSE, client: Client _ NIL, errorLevel: Ops.InfoClass _ $error]; LocalFile: PROC [file: ROPE] RETURNS [BOOL]; ShortName: PROC [file: ROPE, keepVersion: BOOL _ FALSE] RETURNS [ROPE]; RetryFSOperation: PROC [error: FS.ErrorDesc, client: Client] RETURNS [retry: BOOL]; ReportFSError: PROC [ error: FS.ErrorDesc, info: REF ANY, client: Client, errorLevel: Ops.InfoClass _ $error]; END. ªDFInternal.mesa last edited by Levin on December 16, 1983 2:05 pm Interaction Stuff Used for any `interaction' that doesn't expect a response. SimpleInteraction handles any client-requested abort internally, with 'DoAbort' being invoked. Note that if ISTYPE[interaction, REF Ops.InfoInteraction] = TRUE and interaction.class = $abort, abort processing does NOT occur; that is, SimpleInteraction returns normally to its caller. This is because SimpleInteraction doesn't discriminate on the interaction type. Used for Ops.YesNoInteraction. Abort processing is handled internally, with 'DoAbort' being invoked. Used for the general case, including (for now) Ops.ChoiceInteraction. DoInteraction handles any client-requested abort internally, with 'DoAbort' being invoked. Note that if ISTYPE[interaction, REF Ops.InfoInteraction] = TRUE and interaction.class = $abort, abort processing does NOT occur; that is, DoInteraction returns normally to its caller. This is because DoInteraction doesn't discriminate on the interaction type. interacts with the client and, if an abort is requested, triggers 'DoAbort'. If 'proc' and 'message' are non-NIL, an InfoInteraction occurs. The message is then logged on 'log'. Finally, AbortDF is raised. raised only by DoAbort. to be used when callers of DFOperations procedures have 'interact' = NIL. File Info Stuff 'info' must be either REF LocalFileInfo or REF RemoteFileInfo. Behavior for ISTYPE[info, REF LocalFileInfo] = TRUE: info.name is assumed to describe a local file. If info.date.format ~= $explicit, any trailing version number on info.name is stripped off; otherwise the version number is retained (even if info.date.gmt = BasicTime.nullGMT; this permits a lookup with "version number as truth"). The file is looked up and, if found, info.date.format is set to $explicit and info.date.gmt is set to the file's create date. The remoteCheck parameter is passed to FS; thus, if a local file is attached to a remote file and remoteCheck = TRUE, the server will be interrogated to ensure that the file exists remotely. In any case, if the file doesn't exist and notFoundOK is TRUE, info.date is set to [$omitted, BasicTime.nullGMT]. All other cases trigger error handling, discussed below. Behavior for ISTYPE[info, REF RemoteFileInfo] = TRUE: The remote file specified by info.name and info.date is looked up, using a create time search on info.date.gmt if info.date.format = $explicit. The remoteCheck parameter is ignored. If the file exists, info.date.format is set to $explicit and info.date.gmt is set to the file's create date. If the file doesn't exist and notFoundOK is TRUE, info.date is set to [$omitted, BasicTime.nullGMT]. All other cases trigger error handling, discussed below. Error handling: Except as described above, all occurrences of FS.Error propagate to the client. However, if the caller supplies a non-NIL value for 'client', substantial error handling will first occur internally. In this case (client ~= NIL), RetryFSOperation will be called. If it returns TRUE, GetFileInfo will be (re)executed in its entirety. If RetryFSOperation returns FALSE, ReportFSError will be called with the obvious parameters. Note that if ReportFSError is invoked and errorLevel = $abort, AbortDF will be raised (see description of ReportFSError, below). Error Handling determines whether a retry of an FS operation is appropriate. Any necessary waiting has been done inside this procedure (client can simply say RETRY in catch phrase). 'info' is either REF LocalInfo or REF RemoteInfo. SimpleInteraction is invoked with an Ops.InfoInteraction at the specified errorLevel. Then, if errorLevel = $abort, DoAbort[client.log] is invoked, causing AbortDF to be raised. ʘJšœ™Jšœ1™1J˜šÏk ˜ Jšœ œ˜0Jšœ œ˜Jšœœ ˜Jšœœœ˜Jšœœœ˜—J˜Jšœ œ œ˜J˜Jš˜J˜Jšœ'˜+J˜Jšœœœ˜J˜Jšœ™J™J•StartOfExpansionu -- [interaction: REF ANY] RETURNS [abort: BOOL _ FALSE, abortMessageForLog: ROPE _ NIL, response: REF ANY _ NIL] -- ˜Jšœœœ˜$šœœœ˜!Jšœ˜JšœœœÏc3˜BJšœœ˜Jšœ˜—J˜šÏnœœœœ˜?Jš œ©œœœ7œ“™©J˜—š Ÿœœœ œ œœ˜SJšœœ˜Jšœe™e—J˜šŸ œœœœœ œœ˜WJš œ°œœœ7œ‹™¨J˜—šŸ œœ˜"JšœL™L—J˜šŸœœ˜Jšœœœ˜Jš œ œœœœœœ˜QJšœ‚™‚J˜–u -- [interaction: REF ANY] RETURNS [abort: BOOL _ FALSE, abortMessageForLog: ROPE _ NIL, response: REF ANY _ NIL] -- šœ œ˜Jšœ™——J˜šœ,˜,JšœEœ™I—J˜Jšœ™J˜šœœœ˜Jšœœ˜ Jšœ œ˜Jšœ˜Jšœœ˜J˜—J˜šœœœ˜Jšœœ˜ Jšœ˜J˜—J™šŸ œœ˜Jš œœœœœœœ˜CJšœœ&˜:šœœœ™>Jš œ œœœÂœGœ…œn™¹Jš œ œœœÕœn™û—Jš œ?œGœfœ3œQœ½™¾—J˜J˜Jš Ÿ œœœœœ˜,J˜JšŸ œœœœœœœ˜GJ˜Jšœ™J˜š Ÿœœ œœ œ˜SJšœ!œmœ™§—J˜šŸ œœ˜Jšœœœœ6˜XJšœœœÁ™æ—J™Jšœ˜J˜—…—Ñ