-- File: [Indigo]<Cedar>STP>NewSTP.mesa Edited by:
-- Smokey, 6-Jul-81 17:58:25
-- Karlton, 9-Dec-81 18:11:47
-- Bruce, 10-Nov-81 16:15:44
-- Mark, 21-May-81 15:45:50
-- JGS, 14-Aug-81 16:50:01
-- Davirro, 27-Aug-82 15:40:22
-- Loretta, 14-Sep-82 15:10:46
-- Schmidt February 6, 1983 9:03 pm
DIRECTORY
Rope USING[ROPE],
Stream USING [Handle, InputOptions],
System USING [GreenwichMeanTime, gmtEpoch],
UnsafeSTP USING[Access, Completion, Continue, Confirmation, ErrorCode, ValidProperties,
DesiredProperties, CompletionProcType, ConfirmProcType, Handle,
NoteFileProcType, Type];
NewSTP: CEDAR DEFINITIONS = {
-- Types and data
Handle: TYPE = REF Object;
Object: TYPE = RECORD[
stp: UnsafeSTP.Handle ← NIL
];
Access: TYPE = UnsafeSTP.Access;
Completion: TYPE = UnsafeSTP.Completion;
Continue: TYPE = UnsafeSTP.Continue;
Confirmation: TYPE = UnsafeSTP.Confirmation;
ValidProperties: TYPE = UnsafeSTP.ValidProperties;
DesiredProperties: TYPE = UnsafeSTP.DesiredProperties;
CompletionProcType: TYPE = UnsafeSTP.CompletionProcType;
ConfirmProcType: TYPE = UnsafeSTP.ConfirmProcType;
NoteFileProcType: TYPE = UnsafeSTP.NoteFileProcType;
FileInfo: TYPE = REF FileInfoObject;
FileInfoObject: TYPE = RECORD [
directory, body, version: Rope.ROPE ← NIL,
author: Rope.ROPE ← NIL,
create, read, write: Rope.ROPE ← NIL,
size: LONG CARDINAL ← 0,
type: Type ← unknown];
Type: TYPE = UnsafeSTP.Type;
defaultOptions: Stream.InputOptions = [
terminateOnEndPhysicalRecord: FALSE,
signalLongBlock: FALSE,
signalShortBlock: FALSE,
signalSSTChange: TRUE,
signalEndOfStream: TRUE];
-- Procedures
Create: PROC RETURNS [stp: Handle];
Destroy: PROC [stp: Handle] RETURNS [Handle]; -- always returns NIL
Open: PROC [stp: Handle, host: Rope.ROPE] RETURNS [herald: Rope.ROPE];
Close: PROC [stp: Handle];
-- set credentials
Login: PROC [stp: Handle, name, password: Rope.ROPE];
Connect: PROC [stp: Handle, name, password: Rope.ROPE];
-- set various properties
SetHost: PROC [stp: Handle, host: Rope.ROPE];
SetDirectory: PROC [stp: Handle, directory: Rope.ROPE];
SetDesiredProperties: PROC [stp: Handle, props: DesiredProperties];
-- query various properties
IsOpen: PROC [stp: Handle] RETURNS [yes: BOOL];
GetFileInfo: PROC [stp: Handle] RETURNS [FileInfo];
GetProperty: PROC [stp: Handle, prop: ValidProperties] RETURNS [Rope.ROPE];
GetDesiredProperties: PROC [stp: Handle] RETURNS [props: DesiredProperties];
-- retrieve, store, etc.
CreateRemoteStream: PROC [
stp: Handle,
file: Rope.ROPE,
access: Access,
fileType: Type ← unknown,
options: Stream.InputOptions ← defaultOptions,
creation: System.GreenwichMeanTime ← System.gmtEpoch]
RETURNS[stream: Stream.Handle];
NextFileName: PROC [remoteStream: Stream.Handle] RETURNS [file: Rope.ROPE];
Delete: PROC [
stp: Handle,
name: Rope.ROPE,
confirm: ConfirmProcType ← NIL,
complete: CompletionProcType ← NIL];
Enumerate: PROC [stp: Handle, name: Rope.ROPE, proc: NoteFileProcType];
Rename: PROC [stp: Handle, old, new: Rope.ROPE];
Retrieve: PROC [
stp: Handle,
file: Rope.ROPE,
confirm: ConfirmProcType ← NIL,
complete: CompletionProcType ← NIL];
Store: PROC [
stp: Handle,
file: Rope.ROPE,
stream: Stream.Handle,
noteFile: NoteFileProcType ← NIL,
fileType: Type ← unknown,
creation: System.GreenwichMeanTime ← System.gmtEpoch];
-- Signals and Errors
-- Error: UNSAFE SIGNAL [
-- stp: UnsafeSTP.Handle, code: ErrorCode, error: LONG STRING, reply: CHAR ← '\000];
-- reply is the code passed from server (see STPReplyCode.mesa)
ErrorCode: TYPE = UnsafeSTP.ErrorCode;
ConnectionErrors: TYPE = ErrorCode[noSuchHost..connectionTimedOut];
CredentialsErrors: TYPE = ErrorCode[accessDenied..credentailsMissing];
FileErrors: TYPE = ErrorCode[illegalFileName..requestRefused];
}. -- end of STP