-- WRemoteGetImpl.Mesa,
-- Schmidt February 9, 1983 4:15 pm
-- Stewart March 28, 1983 5:19 pm
-- Last Edited by: Maxwell, January 25, 1983 2:14 pm

DIRECTORY
BringOverCall: TYPE USING [CedarBringOver],
IO: TYPE USING[Flush, Handle, PutF, ResetUserAbort, rope],
IOMisc: TYPE USING [AskUser],
Rope: TYPE USING[Cat, Fetch, Flatten, Length, ROPE, Text],
RopeInline: TYPE USING[InlineFlatten],
TypeScript: TYPE USING [UserAbort],
VFTOps: TYPE USING [Handle],
ViewerTools: TYPE USING [GetContents];

WRemoteGetImpl: CEDAR PROGRAM
IMPORTS BringOverCall, IO, IOMisc, Rope, RopeInline, TypeScript, ViewerTools
EXPORTS VFTOps = {

GetTheFile: PUBLIC PROC[self: VFTOps.Handle, getboth: BOOL]= {
ENABLE ABORTED => {
  self.log.ResetUserAbort[];
  self.log.PutF["Get%s Aborted.\n", IO.rope[IF getboth THEN "Both" ELSE ""]];
  GOTO leave;
  };
dfFileRope, fileRef: Rope.ROPE;
dfFileRef, file: Rope.Text;
inx, start: CARDINAL ← 0;
usingList: LIST OF Rope.Text ← NIL;
switches: ARRAY CHAR['a .. 'z] OF BOOL ← ALL[FALSE];

fileRef ← self.sourceRope;
-- If the first character in dfFileBox is '[ then use it directly. Otherwise, concatenate any
-- (non-empty) host or directory parameters.
dfFileRope ← ViewerTools.GetContents[self.dfFileBox];
IF dfFileRope.Fetch[0] # '[ THEN {
IF self.directoryRope.Length[] > 0 THEN
  dfFileRope ← Rope.Cat["<", self.directoryRope, ">", dfFileRope];
IF self.hostRope.Length[] > 0 THEN
  dfFileRope ← Rope.Cat["[", self.hostRope, "]", dfFileRope];
};
dfFileRef ← RopeInline.InlineFlatten[dfFileRope];
IF fileRef ~= NIL THEN {
WHILE inx < fileRef.Length[] DO
  IF TypeScript.UserAbort[self.ts] THEN ERROR ABORTED;
  WHILE inx < fileRef.Length[] AND fileRef.Fetch[inx] = ' DO
   inx ← inx + 1;
   ENDLOOP;
  start ← inx;
   WHILE
inx < fileRef.Length[] AND fileRef.Fetch[inx] ~= ' DO
   inx ← inx + 1;
   ENDLOOP;
  IF inx = start THEN LOOP;
  file ← Rope.Flatten[fileRef, start, inx-start];
  IF getboth THEN {
   usingList ← CONS[RopeInline.InlineFlatten[Rope.Cat[file, ".Mesa"]], usingList];
   usingList ← CONS[RopeInline.InlineFlatten[Rope.Cat[file, ".Bcd"]], usingList];
   }
  ELSE usingList ← CONS[file, usingList];
  ENDLOOP;
 };
switches['a] ← NOT self.verify;
switches['p] ← self.publiconly;
switches['v] ← FALSE;
BringOverCall.CedarBringOver[listOfFiles: LIST[dfFileRef], usingListOfRopes: usingList,
 in: self.logIn, out: self.log, switches: switches, confirmData: self.ts, Confirm: MyConfirm];
self.log.PutF["\n===============================\n"];
self.log.Flush[];
EXITS
leave => NULL;
};

MyConfirm: PROC[in, out: IO.Handle, data: REF ANY, msg: Rope.ROPE, dch: CHAR]
 RETURNS[CHAR] = {
 value: ATOM;
 value ← IOMisc.AskUser[msg: msg, in: in, out: out,
  keyList: LIST[$Yes, $No, $All, $Quit]]; -- order is important
 SELECT value FROM
 $All => RETURN['a];
 $No => RETURN['n];
 $Quit => RETURN['q];
 $Yes => RETURN['y];
 ENDCASE => ERROR;
 };

BuildOuter: PUBLIC PROC [self: VFTOps.Handle] = {};

RGDestroy: PUBLIC PROC [self: VFTOps.Handle] = {};

}.

July 3, 1982 8:48 pm, Stewart, better df file name construction

September 5, 1982 5:39 pm Schmidt, new interface to BringOverCall