STP.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
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
Birrell, June 1, 1983 2:45 pm
Doug Wyatt, February 27, 1985 10:36:02 am PST
DIRECTORY
BasicTime USING [GMT],
IO USING [STREAM],
Rope USING [ROPE];
STP: CEDAR DEFINITIONS
=
BEGIN
ROPE: TYPE = Rope.ROPE;
STREAM: TYPE = IO.STREAM;
GMT: TYPE = BasicTime.GMT;
Types and data
Handle: TYPE = REF Object;
Object: TYPE;
Access: TYPE = {read, write};
Completion: TYPE = {ok, error};
Continue: TYPE = {yes, no};
Confirmation: TYPE = {do, skip, abort};
ValidProperties:
TYPE = {
userName, userPassword, connectName, connectPassword, directory, nameBody,
version, createDate, readDate, writeDate, byteSize, type, size, author,
eolConversion, account, userAccount, device, serverName};
DesiredProperties: TYPE = PACKED ARRAY ValidProperties OF BOOL ← ALL[FALSE];
CompletionProcType: TYPE = PROC[what: Completion, fileOrError: ROPE];
ConfirmProcType: TYPE = PROC[file: ROPE] RETURNS [answer: Confirmation, localStream: STREAM];
NoteFileProcType: TYPE = PROC [file: ROPE] RETURNS [continue: Continue];
FileInfo: TYPE = REF FileInfoObject;
FileInfoObject:
TYPE =
RECORD [
directory, body, version: ROPE ← NIL,
author: ROPE ← NIL,
create, read, write: ROPE ← NIL,
size: INT ← 0,
type: Type ← unknown
];
Type: TYPE = MACHINE DEPENDENT {unknown(0), text, binary};
Procedures
Create: PROC RETURNS [stp: Handle];
Open: PROC [stp: Handle, host: ROPE] RETURNS [herald: ROPE];
Close: PROC [stp: Handle];
set credentials
Login: PROC [stp: Handle, name, password: ROPE];
Connect: PROC [stp: Handle, name, password: ROPE];
set various properties
SetHost: PROC [stp: Handle, host: ROPE];
SetDirectory: PROC [stp: Handle, directory: 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];
GetDesiredProperties: PROC [stp: Handle] RETURNS [props: DesiredProperties];
retrieve, store, etc.
CreateRemoteStream:
PROC [
stp: Handle,
file: ROPE,
access: Access,
fileType: Type ← unknown,
creation: GMT ← NULL -- use this default iff access = read -- ]
RETURNS[stream: STREAM];
NextFileName: PROC [remoteStream: STREAM] RETURNS [file: ROPE];
Delete:
PROC [
stp: Handle,
name: ROPE,
confirm: ConfirmProcType ← NIL,
complete: CompletionProcType ← NIL];
Enumerate: PROC [stp: Handle, name: ROPE, proc: NoteFileProcType];
Rename: PROC [stp: Handle, old, new: ROPE];
Retrieve:
PROC [
stp: Handle,
file: ROPE,
confirm: ConfirmProcType ← NIL,
complete: CompletionProcType ← NIL];
Store:
PROC [
stp: Handle,
file: ROPE,
stream: STREAM,
noteFile: NoteFileProcType ← NIL,
fileType: Type ← unknown,
creation: GMT];
Signals and Errors
Error: SIGNAL [ stp: Handle, code: ErrorCode, error: ROPE, reply: CHAR ← 0C];
ErrorCode:
TYPE = {
connection errors
noSuchHost, noRouteToNetwork, noNameLookupResponse, alreadyAConnection,
noConnection, connectionClosed, connectionRejected,
connectionTimedOut,
credentials errors
accessDenied, illegalUserName, illegalUserPassword, illegalUserAccount,
illegalConnectName, illegalConnectPassword, credentailsMissing,
protocol errors
protocolError,
file errors
illegalFileName, noSuchFile, requestRefused,
remote stream errors
accessError,
catch all
undefinedError};
ConnectionErrors: TYPE = ErrorCode[noSuchHost..connectionTimedOut];
CredentialsErrors: TYPE = ErrorCode[accessDenied..credentailsMissing];
FileErrors: TYPE = ErrorCode[illegalFileName..requestRefused];
END.