-- File: VFTOps.mesa
-- Last Edit: Stewart, September 17, 1982 12:58 pm

DIRECTORY
Buttons USING [Button],
GraphicsOps USING [BitmapRef],
IO USING [Handle],
Labels USING [Label],
Menus USING [Menu],
Rope USING [ROPE],
Rules USING [Rule],
Segments USING [FP, FPHandle],
Space USING [Handle],
STP USING [Handle],
Stream USING [Handle],
Time USING [Packed],
TypeScript USING [TS],
ViewerClasses USING [Viewer];

VFTOps: DEFINITIONS =
BEGIN

Handle: TYPE = REF VFTObject;

VFTObject: TYPE = MONITORED RECORD [
-- Other data
vftMenu: Menus.Menu ← NIL,
destRope: Rope.ROPENIL,
sourceRope: Rope.ROPENIL,
hostRope: Rope.ROPENIL,
directoryRope: Rope.ROPENIL,
fileNamesRope: Rope.ROPENIL,
localRope: Rope.ROPENIL,
connectNameRope: Rope.ROPENIL,
cPasswordActive: BOOLFALSE,
cPasswordRope: Rope.ROPENIL,
update: BOOLFALSE,
updateAlways: BOOLFALSE,
verify: BOOLFALSE,
--other stuff
log: IO.Handle ← NIL,
logIn: IO.Handle ← NIL,
-- variables used in VFileToolDir
buffer: LONG POINTERNIL,
bufAllocated: BOOLFALSE,
bufSize: CARDINAL ← 0,
bufSpace: Space.Handle,
-- variables used in VFileSupport
task: Task ← [],
user: STP.Handle ← NIL,
pleaseStop: BOOLFALSE,
running: BOOLFALSE,
opened: BOOLFALSE,
haveConfirm: CONDITION,
waitForHalt: CONDITION,
confirmState: VFTOps.ConfirmAbort ← waiting,
-- old Global Variables
options: ListOptionsArray ← DefaultOptions,
newOptions: ListOptionsArray ← DefaultOptions,
data: DataObject ← [],
bits: ARRAY Indicator OF GraphicsOps.BitmapRef,
-- Viewers
win: ViewerClasses.Viewer ← NIL, -- overall container
stop: Buttons.Button ← NIL, -- panic stop
msg: Labels.Label ← NIL, -- message window (top)
-- divider
bottomMsgRule: Rules.Rule ← NIL,
-- string labels of editable fields
stringDirectory: Buttons.Button ← NIL, -- the string "Directory:"
stringFileNames: Buttons.Button ← NIL, -- the string "FileName(s):"
stringLocal: Buttons.Button ← NIL, -- the string "LocalFileName:"
stringDFFile: Buttons.Button ← NIL, -- the string "DF File:"
stringConnect: Buttons.Button ← NIL, -- the string "Connect:"
stringCPassword: Buttons.Button ← NIL, -- the string "Password:"
-- Editable fields
fileNamesBox: ViewerClasses.Viewer ← NIL,
localBox: ViewerClasses.Viewer ← NIL,
dfFileBox: ViewerClasses.Viewer ← NIL,
connectBox: ViewerClasses.Viewer ← NIL,
directoryBox: ViewerClasses.Viewer ← NIL,
cpasswordBox: ViewerClasses.Viewer ← NIL,
-- Buttons in editable section
updateButton: Buttons.Button ← NIL,
updateAlwaysButton: Buttons.Button ← NIL,
exportsOnlyButton: Buttons.Button ← NIL,
verifyButton: Buttons.Button ← NIL,
-- divider
bottomParamRule: Rules.Rule ← NIL,
-- Buttons in command section
commandSW: ViewerClasses.Viewer ← NIL,
commandChildren: ViewerClasses.Viewer ← NIL,
retrieveButton: Buttons.Button ← NIL,
storeButton: Buttons.Button ← NIL,
localListButton: Buttons.Button ← NIL,
remoteListButton: Buttons.Button ← NIL,
listOptionsButton: Buttons.Button ← NIL,
closeButton: Buttons.Button ← NIL,
dfGetButton: Buttons.Button ← NIL,
dfGetBothButton: Buttons.Button ← NIL,
localDeleteButton: Buttons.Button ← NIL,
remoteDeleteButton: Buttons.Button ← NIL,
-- Buttons in confirm subwindow
confirmChildren: ViewerClasses.Viewer ← NIL,
confirmButton: Buttons.Button ← NIL,
denyButton: Buttons.Button ← NIL,
stopButton: Buttons.Button ← NIL,
-- Transfer subwindow
transferChildren: ViewerClasses.Viewer ← NIL,
transferBox: ViewerClasses.Viewer ← NIL,
-- ListOptions subwindow
optionsChildren: ViewerClasses.Viewer ← NIL,
typeOption: Buttons.Button ← NIL,
bytesOption: Buttons.Button ← NIL,
pagesOption: Buttons.Button ← NIL,
authorOption: Buttons.Button ← NIL,
applyOption: Buttons.Button ← NIL,
createOption: Buttons.Button ← NIL,
writeOption: Buttons.Button ← NIL,
readOption: Buttons.Button ← NIL,
abortOption: Buttons.Button ← NIL,
-- divider
bottomCommandRule: Rules.Rule ← NIL,
-- Log window
ts: TypeScript.TSNIL,
-- Remote get fields
-- program data
publiconly: BOOLFALSE,
ldspace: Space.Handle
];

-- types

Task: TYPE = RECORD [
userName: STRINGNIL,
userPassword: STRINGNIL,
connectName: STRINGNIL,
connectPassword: STRINGNIL,
host: STRINGNIL,
sourceFileName: STRINGNIL,
destFileName: STRINGNIL,
directory: STRINGNIL,
task: VFTOps.FTPCommand ← waiting
];

Indicator: TYPE = {off, left, right};

Functions: TYPE = {commands, confirms, empty, options};

Data: TYPE = POINTER TO DataObject;

DataObject: TYPE = RECORD[
optionMenu: BOOLEANFALSE,
function: Functions ← commands,
indicator: Indicator ← off,
transferring: BOOLEANFALSE
];

SmallMap: TYPE = ARRAY [0..16) OF UNSPECIFIED;

ConfirmAbort: TYPE = {waiting, confirm, skip, stop};

FTPCommand: TYPE = {
waiting, localList, localDelete, store, remoteList,
remoteDelete, retrieve, dfGet, dfGetBoth};

ListOptions: TYPE = {type, bytes, pages, create, write, read, author};

ListOptionsArray: TYPE = ARRAY ListOptions OF BOOL;

-- Values

DefaultOptions: ListOptionsArray = [
type: FALSE, bytes: TRUE, pages: FALSE, create: TRUE,
write: FALSE, read: FALSE, author: FALSE
];

LeftSmallMap: SmallMap = [
177400B, 177400B, 177400B, 177400B, 177400B, 177400B, 177400B, 177400B,
000377B, 000377B, 000377B, 000377B, 000377B, 000377B, 000377B, 000377B
];

RightSmallMap: SmallMap = [
000377B, 000377B, 000377B, 000377B, 000377B, 000377B, 000377B, 000377B,
177400B, 177400B, 177400B, 177400B, 177400B, 177400B, 177400B, 177400B
];

-- Exported Procedures from WFileInterface

PostComment: PROC [self: Handle, s: Rope.ROPE];
NeedConfirm: PROC [self: Handle];
NeedCommand: PROC [self: Handle];
InvertIndicator: PROC [self: Handle];

-- Exported procedures from WFileSupport

CloseCommand: PROC [self: Handle];
GiveCommand: PROC [self: Handle, command: FTPCommand];
GiveConfirm: PROC [self: Handle, confirm: ConfirmAbort];
StopFTP: PROC [self: Handle];
FreeTask: PROC [t: Task] RETURNS [Task];

-- Exported procedures from WFileToolDir

WriteDiskForRetrieve: PROCEDURE [
self: Handle, from: Stream.Handle, name: STRING, fpHint: Segments.FPHandle, create: Time.Packed, remoteName: LONG STRING, t: Task]
RETURNS [bytes: LONG CARDINAL];
DestroyFile: PROC [self: Handle, fp: Segments.FPHandle, name: STRING];
Enumerate: PROC [
self: Handle,
files: STRING,
proc: PROC [fp: Segments.FPHandle, file: STRING] RETURNS [BOOL],
wantWholeName: BOOL];
FileExists: PROC [self: Handle, name: STRING, cap: Segments.FPHandle] RETURNS [yes: BOOL];
FreeBufferPages: PROC [self: Handle, buf: LONG POINTER];
GetBufferPages: PROC [self: Handle, pages: CARDINAL] RETURNS [buf: LONG POINTER];
NoMoreRoom: PROC RETURNS [ERROR];

-- Exported procedures from WRemoteGetImpl

BuildOuter: PROC [self: Handle];
GetTheFile: PROC [self: Handle, getboth: BOOL];
RGDestroy: PROC [self: Handle];

END.

-- Phil Karlton Nov 21, 1980 12:43 PM
26-Jan-82 0:47:35, Stewart, created from FileToolOps.mesa
25-Jan-82 23:07:51, Stewart, Objects
29-Jan-82 18:19:08, Stewart, object monitor
March 27, 1982 7:49 pm, Stewart, cleanup and Cedar 3.0 revisions
June 7, 1982 7:23 pm, Stewart, pagesOption
July 3, 1982 7:53 pm, Stewart, name changes
September 16, 1982 10:33 am, Stewart, Cedar 3.4