QuickFilingP10V5Impl.mesa
Copyright Ó 1988, 1990, 1991 by Xerox Corporation. All rights reserved.
Tim Diebert: August 11, 1988 10:44:52 am PDT
Bill Jackson (bj) February 12, 1990 8:56:06 pm PST
Willie-s, December 11, 1991 7:26 pm PST
DIRECTORY
Basics USING [LongNumber, Word16],
BasicTime USING [FromNSTime, GMT, OutOfRange],
CrRPC,
FilingP10V5,
FilingAttributesP10V5 USING [FileID, InterpretedAttributeType],
FilingP10V5ClientHack USING [MProc29, MProc4, GetError],
RefText USING [InlineAppendChar, ObtainScratch],
QuickFilingP10V5;
QuickFilingP10V5Impl: CEDAR PROGRAM
IMPORTS BasicTime, CrRPC, FilingP10V5ClientHack, RefText
EXPORTS QuickFilingP10V5
~
BEGIN
OPEN FilingP10V5;
IAT: TYPE ~ FilingAttributesP10V5.InterpretedAttributeType;
createdOn: CARD32 ~ IAT.createdOn.ORD;
dataSize: CARD32 ~ IAT.dataSize.ORD;
fileID: CARD32 ~ IAT.fileID.ORD;
isDirectory: CARD32 ~ IAT.isDirectory.ORD;
name: CARD32 ~ IAT.name.ORD;
numberOfChildren: CARD32 ~ IAT.numberOfChildren.ORD;
pathname: CARD32 ~ IAT.pathname.ORD;
type: CARD32 ~ IAT.type.ORD;
version: CARD32 ~ IAT.version.ORD;
QuickGetAttributes:
PUBLIC
PROC [h: CrRPC.Handle, file: Handle,
types: AttributeTypeSequence, session: Session]
RETURNS [vers:
CARDINAL, bytes:
INT, created: BasicTime.
GMT, fileType:
CARD, pathName:
REF
TEXT, fID: FilingAttributesP10V5.FileID, isDir:
BOOL, numKids:
CARD] = {
PutArgs: CrRPC.PutArgsProc ~ {
FOR i28:
CARDINAL
IN [0..2)
DO
CrRPC.PutCard16[s, file[i28]];
ENDLOOP;
FilingP10V5ClientHack.MProc29[h, s, types];
FOR i30:
CARDINAL
IN [0..2)
DO
CrRPC.PutCard16[s, session.token[i30]];
ENDLOOP;
FilingP10V5ClientHack.MProc4[h, s, session.verifier];
};
GetResults: CrRPC.GetResultsProc ~ {
length: CARDINAL ~ CrRPC.GetCard16[s];
FOR i:
CARDINAL
IN [0..length)
DO
Get32:
PROC
RETURNS [num:
CARD32] =
INLINE {
temp: Basics.LongNumber;
len: CARDINAL ~ CrRPC.GetCard16[s];
IF len # 2 THEN ERROR;
temp.hi ¬ CrRPC.GetCard16[s];
temp.lo ¬ CrRPC.GetCard16[s];
num ¬ temp.lc;
};
attribute: Attribute;
attribute.type ¬ CrRPC.GetCard32[s];
got the type now get the data
SELECT attribute.type
FROM
createdOn => {
temp: CARD32 ~ Get32[];
created ¬ BasicTime.FromNSTime[temp ! BasicTime.OutOfRange => CONTINUE];
};
dataSize => bytes ¬ Get32[];
fileID => {
len: CARDINAL ~ CrRPC.GetCard16[s];
IF len # 5 THEN ERROR;
FOR i:
CARDINAL
IN [0 .. 5)
DO
fID[i] ¬ CrRPC.GetCard16[s];
ENDLOOP;
};
isDirectory => {
len: CARDINAL ~ CrRPC.GetCard16[s];
IF len # 1 THEN ERROR;
isDir ¬ IF CrRPC.GetCard16[s] = 1 THEN TRUE ELSE FALSE;
};
numberOfChildren => {
len: CARDINAL ~ CrRPC.GetCard16[s];
IF len = 1 THEN numKids ¬ CrRPC.GetCard16[s];
};
pathname => {
length: CARDINAL ~ CrRPC.GetCard16[s];
word, len: NAT ¬ 0;
temp: Basics.Word16;
P:
PROC [l:
NAT]
RETURNS[c:
CHAR] =
INLINE {
IF l
MOD 2 = 0
THEN {temp.card ¬ CrRPC.GetCard16[s]; word ¬ word + 1; c ¬ VAL[temp.hi]}
ELSE {c ¬ VAL[temp.lo]};
};
len ¬ CrRPC.GetCard16[s];
pathName ¬ RefText.ObtainScratch[len];
word ¬ word + 1;
FOR i:
NAT
IN [0 .. len)
DO
char: CHAR ~ P[i];
pathName ¬ RefText.InlineAppendChar[pathName, char];
ENDLOOP;
IF word # length THEN ERROR;
};
type => fileType ¬ Get32[];
version => {
len: CARDINAL ~ CrRPC.GetCard16[s];
IF len # 1 THEN ERROR;
vers ¬ CrRPC.GetCard16[s];
};
ENDCASE => {
-- the value was not one we are looking for so eat the data
len: CARDINAL ~ CrRPC.GetCard16[s];
FOR j:
CARDINAL
IN [0..len)
DO
[] ¬ CrRPC.GetCard16[s];
ENDLOOP;
};
ENDLOOP;
};
CrRPC.Call[h~h, remotePgm~10, remotePgmVersion~5, remoteProc~8 , putArgs~PutArgs, getResults~GetResults, getError~FilingP10V5ClientHack.GetError];
};
END.