-- LeafSubr.Mesa, last edit December 30, 1982 2:10 pm
-- Pilot 6.0/ Mesa 7.0
-- definitions file for commonly used Leaf procedures
-- implemented in LeafSubrImpl.Mesa

DIRECTORY
  File: TYPE USING [Capability],
  IFSFile: TYPE USING [AccessFailure, FileHandle, OpenOptions, Problem],
  Space: TYPE USING [Handle],
  Subr: TYPE USING[TTYProcs];

LeafSubr: DEFINITIONS = {

-- in all the procedures below that take h as a parameter,
-- if h = NIL then it uses Exec.w for prompting for input

-- host is like "Ivy"
-- sfn is like "<Schmidt>Model>Model.Mesa"
-- to close call IFSFile.Close[fh]
Open: PROC[host, sfn: LONG STRING, h: Subr.TTYProcs,
	openOptions: IFSFile.OpenOptions ← oldReadOnly] 
	RETURNS[fh: IFSFile.FileHandle];
	
-- base is # of page to start mapping on
-- note that base = 0 is the first page of data
-- whereas in Pilot base = 1 is the first page
RemoteMap: PROC[space: Space.Handle, fh: IFSFile.FileHandle, base: CARDINAL];

RemoteCopy: PROC[fromHost, fromFilename, toHost, toFilename: LONG STRING,
	h: Subr.TTYProcs] RETURNS[length: LONG CARDINAL];
	
-- this is never called
Retrieve: PROC[remoteHost, remoteFilename, localFilename: LONG STRING,
	h: Subr.TTYProcs]
	RETURNS[length: LONG CARDINAL, cap: File.Capability];
	
-- this is never called
Store: PROC[localFilename, remoteHost, remoteFilename: LONG STRING,
	h: Subr.TTYProcs] RETURNS[length: LONG CARDINAL];

PrintLeafProblem: PROC[problem: IFSFile.Problem];
PrintLeafAccessFailure: PROC[reason: IFSFile.AccessFailure];

StopLeaf: PROC;
}.