DFToolInternal.mesa
last edited by Levin on December 6, 1983 3:13 pm
DIRECTORY
BasicTime USING [GMT, nullGMT],
Buttons USING [Button, ButtonProc],
Containers USING [Container],
DFOperations USING [InteractionProc],
DFOperationsQueue USING [Queue, OpTerminationInteraction],
IO USING [STREAM],
Labels USING [Label],
Rope USING [ROPE],
UserProfile USING [ProfileChangedProc],
VFonts USING [Font],
ViewerClasses USING [Viewer];
DFToolInternal: CEDAR DEFINITIONS =
BEGIN
OPEN Ops: DFOperations, OpsQ: DFOperationsQueue;
ROPE: TYPE = Rope.ROPE;
Types
DFTool: TYPE = REF DFToolRecord;
DFToolRecord: TYPE = MONITORED RECORD [
Fields marked (*) are protected by the monitor.
outer: Containers.Container ← NIL,
parameters: Parameters ← NIL,
height: INT ← 0,
opsQueue: OpsQ.Queue ← NIL,
dfNames: ViewerClasses.Viewer ← NIL, -- text viewer for df file names
wDir: ViewerClasses.Viewer ← NIL, -- text viewer for working directory
inner: Containers.Container ← NIL, -- container for variable-size portion of tool (within 'outer')
selectedOp: Operation ← NIL,
bottom: Containers.Container ← NIL, -- container for interaction/feedback area (within 'inner')
interaction: Containers.Container ← NIL, -- container for interaction area (within 'bottom')
bottomMinHeight: INT ← 0,
prompter: ViewerClasses.Viewer ← NIL, -- graphic prompter
question: ViewerClasses.Viewer ← NIL, -- place for interaction queries
abortRequested: BOOLFALSE,
autoConfirm: BOOLFALSE, -- if TRUE, suppress button interactions
responseValue: NATNAT.LAST, -- (*) ResponseSeen and WaitForResponse
responseSeen: BOOLTRUE, -- (*) ResponseSeen, WaitForResponse, and PrompterProcess
responseMade: CONDITION, -- (*) ResponseSeen, WaitForResponse, and PrompterProcess
prompterSeq: PrompterSeq ← PrompterSeq.FIRST,
choicesX: INT ← 0, -- relative to 'interaction'
choicesY: INT ← 0, -- relative to 'interaction'
feedback: IO.STREAMNIL, -- session log
startTime: BasicTime.GMT ← BasicTime.nullGMT, -- (*) DoIt, IdleNotifier
recursionDepth: INT ← -1,
unusualEnd: LIST OF REF OpsQ.OpTerminationInteraction ← NIL, -- ops with errors/warnings.
log: IO.STREAMNIL -- (*) long-term log (DoIt, IdleNotifier)
];
offScreenY: INT = -9999;
OpTable: TYPE = RECORD [
nOps: NAT,
ops: SEQUENCE length: NAT OF REF OpDefiner
];
OpDefiner: TYPE = RECORD [
opName: ROPE,
userClass: UserClass,
proc: OpSpecificProc,
opAlias: ROPENIL
];
UserClass: TYPE = {individual, releaseParticipant, releaseMaster};
OpSpecificAction: TYPE = {createOptions, doOp, doHelp, makeCommandLine, doCommandLine};
OpSpecificProc: TYPE = PROC [action: OpSpecificAction, param: REF ANY];
NARROW[param] = Operation for all cases of 'action' except 'doCommandLine', for which it is IO.STREAM.
Operation: TYPE = REF OperationRecord;
OperationRecord: TYPE = RECORD [
tool: DFTool ← NIL,
definer: REF OpDefiner ← NIL,
button: Buttons.Button ← NIL,
optionsContainer: Containers.Container ← NIL,
height: INT ← 0,
options: REF ANYNIL
];
OptionSelector: TYPE = RECORD [
name: ROPE,
displayer: Labels.Label ← NIL,
choices: LIST OF Choice,
default: ROPE
];
Choice: TYPE = RECORD [
name: ROPE,
value: REF ANY
];
PrompterSeq: TYPE = NAT[0..8);
Parameters: TYPE = REF ToolParameters;
ToolParameters: TYPE = RECORD [
userClass: UserClass,
opTable: REF OpTable,
font: VFonts.Font,
boldFont: VFonts.Font,
entryHeight: NAT,
entryVSpace: NAT,
entryHSpace: NAT,
compactLayout: BOOL,
dfNamePrefixes: LIST OF ROPE
];
Variables (actually, start-time constants)
userClasses: ARRAY UserClass OF ROPE;
Procedures from DFInterfaceImpl
OpsInteraction: Ops.InteractionProc;
Procedures from DFToolUtilitiesImpl
AddOpToTable: PROC [definer: REF OpDefiner];
This procedure is intended to be called as part of the initialization of each tool-level operation. It fills in 'opAlias' as a side-effect.
ViewerToRopeList: PUBLIC PROC [viewer: ViewerClasses.Viewer] RETURNS [LIST OF ROPE];
This procedure parses the contents of the argument viewer (which must be acceptable to ViewerTools.GetContents) and produces a list of ROPEs. For atomicity purposes, it should usually be invoked synchronously with the Viewers notifer.
EnsureDFName: PUBLIC PROC [ROPE] RETURNS [ROPE];
This procedure adds the ".df" extension, as necessary, to the argument file name.
LabelWidthForChoices: PROC [tool: DFTool, list: LIST OF Choice] RETURNS [max: INT ← 0];
This procedure is intended to be called from the $createOptions case of an OpSpecificProc.
MakeCenteredLabel: PROC [op: Operation, name: ROPE];
This procedure is intended to be called from the $createOptions case of an OpSpecificProc.
OuterContainerWidth: PROC [tool: DFTool] RETURNS [INT];
CreateSelector: PROC [
name: ROPE, proc: Buttons.ButtonProc, clientData: REF ANY, choices: LIST OF Choice,
op: Operation, x: INTEGER ← -1]
RETURNS [selector: REF OptionSelector, newX: INTEGER];
SelectOption: PROC [selector: REF OptionSelector] RETURNS [choice: Choice];
ResetOption: PROC [selector: REF OptionSelector];
GetToolParameters: PROC RETURNS [Parameters];
ReactToProfile: UserProfile.ProfileChangedProc;
Procedures from DFLogImpl
AcquireLog: PROC RETURNS [IO.STREAM];
Returns a log stream intended for the use of a DFTool instance during the course of an operation. When the operation is complete, ReleaseLog should be called.
ReleaseLog: PROC [log: IO.STREAM];
Called to indicate that 'log' is no longer in use by a DFTool instance. Everything that has been written to 'log' since it was acquired is transferred to a long-term log file, whose maximum size is under the user's control (via a profile parameter).
END.