-- Route66QueryP2233V1ClientImpl.Mesa
	-- Copyright (C) 1986 by Xerox Corporation.  All rights reserved.
	-- Generated by BJackson.pa at July 15, 1988 4:26:24 pm PDT
	--  using Sirocco [2.0] of January 31, 1987 1:52:42 am PST
	
DIRECTORY
	CrRPC,
	AuthenticationP14V2,
	BulkDataP0V1,
	Route66QueryP2233V1;

Route66QueryP2233V1ClientImpl: CEDAR PROGRAM
	IMPORTS CrRPC
	EXPORTS Route66QueryP2233V1 ~ {
	OPEN Route66QueryP2233V1;

-- Errors
	
	
	Error: PUBLIC ErrorType ~ CODE;
	
-- GetErrorProc
	
	GetError: CrRPC.GetErrorProc ~ {
		SELECT errNum FROM
			1  => {
				message: ROPE;
				message ← CrRPC.GetRope[s];
				ERROR Error[message]
				};
			ENDCASE => {
				ERROR CrRPC.Error[h, remoteError, "Unexpected Remote Error"];
				};
		};
	
-- Remote Procedures --
	
	Logoff: PUBLIC LogoffType ~ {
		PutArgs: CrRPC.PutArgsProc ~ {
			CrRPC.PutCard32[s, session.token];
			MProc1[h, s, session.verifier];
			};
		GetResults: CrRPC.GetResultsProc ~ {
			NULL
			};
			
		CrRPC.Call[h~h, remotePgm~2233, remotePgmVersion~1, remoteProc~11 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
		};
	
	Logon: PUBLIC LogonType ~ {
		PutArgs: CrRPC.PutArgsProc ~ {
			CrRPC.PutRope[s, service];
			CrRPC.PutCard16[s, ORD[credentials.type]];
			MProc1[h, s, credentials.value];
			MProc1[h, s, verifier];
			};
		GetResults: CrRPC.GetResultsProc ~ {
			newSession.token ← CrRPC.GetCard32[s];
			newSession.verifier ← UProc2[h, s];
			};
			
		CrRPC.Call[h~h, remotePgm~2233, remotePgmVersion~1, remoteProc~10 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
		};
	
	Retrieve: PUBLIC RetrieveType ~ {
		PutArgs: CrRPC.PutArgsProc ~ {
			CrRPC.PutCard32[s, oldSession.token];
			MProc1[h, s, oldSession.verifier];
			CrRPC.PutRope[s, file.fileServer];
			CrRPC.PutRope[s, file.fileName];
			CrRPC.PutRope[s, file.fileFormat];
			CrRPC.PutInt32[s, file.startByte];
			CrRPC.PutInt32[s, file.numBytes];
			CrRPC.PutCard32[s, file.timeLimit];
			CrRPC.PutBulkDataSink[h, s, content];
			};
		GetResults: CrRPC.GetResultsProc ~ {
			newSession.token ← CrRPC.GetCard32[s];
			newSession.verifier ← UProc2[h, s];
			};
			
		CrRPC.Call[h~h, remotePgm~2233, remotePgmVersion~1, remoteProc~12 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
		};
	
	ReleaseOpHandle: PUBLIC ReleaseOpHandleType ~ {
		PutArgs: CrRPC.PutArgsProc ~ {
			CrRPC.PutRope[s, service];
			CrRPC.PutCard32[s, oldOp.operation];
			CrRPC.PutCard32[s, oldOp.sequence];
			};
		GetResults: CrRPC.GetResultsProc ~ {
			NULL
			};
			
		CrRPC.Call[h~h, remotePgm~2233, remotePgmVersion~1, remoteProc~3 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
		};
	
	LocateMore: PUBLIC LocateMoreType ~ {
		PutArgs: CrRPC.PutArgsProc ~ {
			CrRPC.PutRope[s, service];
			CrRPC.PutCard32[s, oldOp.operation];
			CrRPC.PutCard32[s, oldOp.sequence];
			CrRPC.PutInt32[s, bufferSize];
			CrRPC.PutCard16[s, ORD[resultType]];
			};
		GetResults: CrRPC.GetResultsProc ~ {
			progress.workDone ← CrRPC.GetInt32[s];
			progress.workPending ← CrRPC.GetInt32[s];
			progress.timePending ← CrRPC.GetInt32[s];
			progress.timeWait ← CrRPC.GetInt32[s];
			matches ← CrRPC.GetInt32[s];
			newOp.operation ← CrRPC.GetCard32[s];
			newOp.sequence ← CrRPC.GetCard32[s];
			idLocs ← UProc3[h, s];
			};
			
		CrRPC.Call[h~h, remotePgm~2233, remotePgmVersion~1, remoteProc~2 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
		};
	
	Locate: PUBLIC LocateType ~ {
		PutArgs: CrRPC.PutArgsProc ~ {
			CrRPC.PutRope[s, service];
			CrRPC.PutRope[s, userName];
			MProc4[h, s, locateSpec];
			CrRPC.PutRope[s, docId];
			MProc4[h, s, fileLocFilter.servers];
			MProc4[h, s, fileLocFilter.formats];
			CrRPC.PutCard32[s, fileLocFilter.timeLimit];
			CrRPC.PutInt32[s, bufferSize];
			CrRPC.PutCard16[s, ORD[resultType]];
			};
		GetResults: CrRPC.GetResultsProc ~ {
			progress.workDone ← CrRPC.GetInt32[s];
			progress.workPending ← CrRPC.GetInt32[s];
			progress.timePending ← CrRPC.GetInt32[s];
			progress.timeWait ← CrRPC.GetInt32[s];
			matches ← CrRPC.GetInt32[s];
			newOp.operation ← CrRPC.GetCard32[s];
			newOp.sequence ← CrRPC.GetCard32[s];
			idLocs ← UProc3[h, s];
			};
			
		CrRPC.Call[h~h, remotePgm~2233, remotePgmVersion~1, remoteProc~1 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
		};
	
	Null: PUBLIC NullType ~ {
		PutArgs: CrRPC.PutArgsProc ~ {
			CrRPC.PutRope[s, service];
			};
		GetResults: CrRPC.GetResultsProc ~ {
			NULL
			};
			
		CrRPC.Call[h~h, remotePgm~2233, remotePgmVersion~1, remoteProc~0 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
		};
	
	Store: PUBLIC StoreType ~ {
		PutArgs: CrRPC.PutArgsProc ~ {
			CrRPC.PutCard32[s, oldSession.token];
			MProc1[h, s, oldSession.verifier];
			CrRPC.PutRope[s, file.fileServer];
			CrRPC.PutRope[s, file.fileName];
			CrRPC.PutRope[s, file.fileFormat];
			CrRPC.PutInt32[s, file.startByte];
			CrRPC.PutInt32[s, file.numBytes];
			CrRPC.PutCard32[s, file.timeLimit];
			CrRPC.PutBulkDataSource[h, s, content];
			};
		GetResults: CrRPC.GetResultsProc ~ {
			newSession.token ← CrRPC.GetCard32[s];
			newSession.verifier ← UProc2[h, s];
			};
			
		CrRPC.Call[h~h, remotePgm~2233, remotePgmVersion~1, remoteProc~13 , putArgs~PutArgs, getResults~GetResults, getError~GetError];
		};
	
-- Unmarshal / Marshal Procs --
	
	
	MProc1: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: AuthenticationP14V2.SeqWords] ~ {
		CrRPC.PutCard16[s, val.length];
		FOR i5: CARDINAL IN [0..val.length) DO
			CrRPC.PutCard16[s, val.body[i5]];
			ENDLOOP;
		};
	
	UProc3: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: IdLocList] ~ {
		{
			length7: CARDINAL ~ CrRPC.GetCard16[s];
			res ←  NEW[IdLocListObject[length7]];
			FOR i6: CARDINAL IN [0..length7) DO
				res.body[i6].docId ← CrRPC.GetRope[s];
				res.body[i6].fileLocation.fileServer ← CrRPC.GetRope[s];
				res.body[i6].fileLocation.fileName ← CrRPC.GetRope[s];
				res.body[i6].fileLocation.fileFormat ← CrRPC.GetRope[s];
				res.body[i6].fileLocation.startByte ← CrRPC.GetInt32[s];
				res.body[i6].fileLocation.numBytes ← CrRPC.GetInt32[s];
				res.body[i6].fileLocation.timeLimit ← CrRPC.GetCard32[s];
				ENDLOOP;
			};
		};
	
	UProc2: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: AuthenticationP14V2.SeqWords] ~ {
		{
			length9: CARDINAL ~ CrRPC.GetCard16[s];
			res ←  NEW[AuthenticationP14V2.SeqWordsObject[length9]];
			FOR i8: CARDINAL IN [0..length9) DO
				res.body[i8] ← CrRPC.GetCard16[s];
				ENDLOOP;
			};
		};
	
	MProc4: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: StringList] ~ {
		CrRPC.PutCard16[s, val.length];
		FOR i10: CARDINAL IN [0..val.length) DO
			CrRPC.PutRope[s, val.body[i10]];
			ENDLOOP;
		};
	
}...