-- File: GCPR.mesa
-- Last Edit: L. Stewart September 21, 1978 10:48 PM
DIRECTORY
AltoPRDefs: FROM "AltoPRDefs" USING [
PRDriverVars, PRRouteSet],
DriverDefs: FROM "DriverDefs" USING [
debugPointer, GiantVector],
GCDefs: FROM "GCDefs" USING [
GCInterface, Get, GetFailure, Put, PutFailure, Read],
IODefs: FROM "IODefs" USING [
CR, ReadChar, ReadNumber, Rubout,
WriteChar, WriteDecimal, WriteLine, WriteNumber, WriteString];
GCPR: PROGRAM [gc: GCDefs.GCInterface]
IMPORTS GCDefs, IODefs
EXPORTS GCDefs =
BEGIN OPEN gc, IODefs, GCDefs;
giantVectorLoc: POINTER TO DriverDefs.GiantVector;
giantVector: DriverDefs.GiantVector;
myVars: AltoPRDefs.PRDriverVars;
myRoutes: AltoPRDefs.PRRouteSet;
localDataValid: BOOLEAN ← FALSE;
GCPRThings: PUBLIC PROCEDURE =
BEGIN ENABLE GetFailure =>
BEGIN
WriteLine[" GetFailure!"];
GOTO Return;
END;
WriteString["Packet Radio "L];
IF newPartner[2] THEN
BEGIN
localDataValid ← FALSE;
newPartner[2] ← FALSE;
END;
SELECT ReadChar[] FROM
’A, ’a =>
BEGIN
WriteLine["Assembly Queue Things."L];
SetPRAssemblyQueueParams[];
END;
’I, ’i =>
BEGIN
WriteLine["I’m Alive Things."L];
SetPRImAliveParams[];
END;
’O, ’o =>
BEGIN
WriteLine["Output Queue Things."L];
SetPROutputQueueParams[];
END;
’P, ’p =>
BEGIN WriteLine["Put Remote Data."L]; PutRemoteVars[]; END;
’R, ’r =>
BEGIN
WriteLine["Route."L];
SetPRRoute[];
END;
’T, ’t =>
BEGIN
GetRemoteVars[];
WriteLine["TOP Interval."L];
SetValue[" New Value (ticks) : ",@(myVars.prTOPInterval)];
END;
’V, ’v =>
BEGIN
WriteLine["Driver Variables."L];
VariablePrint[];
END;
’? => WriteLine["A(ssembly Queue), I(’m Alive), O(utput Queue),
P(ut Remote Data), R(oute), T(OP Interval), or V(ariables)."L];
ENDCASE => WriteLine["???"L];
EXITS
Return => NULL;
END;
GetRemoteVars: PROCEDURE =
BEGIN
IF ~localDataValid THEN
BEGIN
giantVectorLoc ← Read[DriverDefs.debugPointer];
Get[to: @giantVector,from: giantVectorLoc,size: SIZE[DriverDefs.GiantVector]];
Get[to: @myVars,from: giantVector.prThings,size: SIZE[AltoPRDefs.PRDriverVars]];
Get[to: @myRoutes,from: myVars.prRouteSetp,size: SIZE[AltoPRDefs.PRRouteSet]];
localDataValid ← TRUE;
END;
END;
PutRemoteVars: PROCEDURE =
BEGIN ENABLE PutFailure =>
BEGIN
WriteLine[" PutFailure!"];
GOTO Return;
END;
IF localDataValid THEN
BEGIN
Put[to: myVars.prRouteSetp,from: @myRoutes,size: SIZE[AltoPRDefs.PRRouteSet]];
Put[to: giantVector.prThings,from: @myVars,size: SIZE[AltoPRDefs.PRDriverVars]];
END;
EXITS
Return => NULL;
END;
VariablePrint: PROCEDURE =
BEGIN
GetRemoteVars[];
D10[myVars.prTOPInterval]; WriteLine[" TOP Interval"];
D10[myVars.outputTimeoutInterval]; WriteLine[" Output Timeout Interval"];
D10[myVars.assemblyTimeoutInterval]; WriteLine[" Assembly Timeout Interval"];
D10[myVars.imAliveInterval]; WriteLine[" I’m Alive Interval"];
D10[myVars.prHostAliveTimeoutInterval]; WriteLine[" Host Alive Timeout Interval"];
D10[myVars.maxOutputQueueLength]; WriteLine[" Maximum Output Queue Length"];
D10[myVars.maxAssemblyQueueLength]; WriteLine[" Maximum Assembly Queue Length"];
END;
SetPRRoute: PROCEDURE =
BEGIN
to: INTEGER ← 1;
i: INTEGER;
GetRemoteVars[];
WriteLine["Route."L];
SetValue[" To PR Host: ",@to];
FOR i IN [1..5] DO
WriteString[" Route word "]; WriteDecimal[i]; WriteString[" : "];
myRoutes[to][i] ← ReadNumber[myRoutes[to][i],8 ! Rubout => GOTO Reject];
WriteChar[CR];
ENDLOOP;
EXITS Reject => WriteLine["xxx"L];
END;
SetPRAssemblyQueueParams: PROCEDURE =
BEGIN
GetRemoteVars[];
SetValue[" Assembly Queue Maximum Length: ",@(myVars.maxAssemblyQueueLength)];
SetValue[" Assembly Queue Timeout Interval (ticks) : ",@(myVars.assemblyTimeoutInterval)];
END;
SetPROutputQueueParams: PROCEDURE =
BEGIN
GetRemoteVars[];
SetValue[" Output Queue Maximum Length: ",@(myVars.maxOutputQueueLength)];
SetValue[" Output Queue Timeout Interval (ticks) : ",@(myVars.outputTimeoutInterval)];
END;
SetPRImAliveParams: PROCEDURE =
BEGIN
GetRemoteVars[];
SetValue[" I’m Alive Interval: ",@(myVars.imAliveInterval)];
SetValue[" Host Alive Timeout Interval: ",@(myVars.prHostAliveTimeoutInterval)];
END;
SetValue: PROCEDURE [s: STRING, v: POINTER] =
BEGIN
WriteString[s];
v↑ ← ReadNumber[v↑,10 ! Rubout => GOTO Reject];
WriteChar[CR];
EXITS Reject => WriteLine["xxx"L];
END;
D10: PROCEDURE [n: CARDINAL] =
BEGIN
IODefs.WriteNumber[n,[10,FALSE,TRUE,10]];
END;
END. -- GCPR