IMSTesterImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Barth, November 12, 1985 3:58:30 pm PST
DIRECTORY IMSTester;
IMSTesterImpl: CEDAR PROGRAM
IMPORTS
EXPORTS IMSTester
= BEGIN OPEN IMSTester;
slotForceMap: PUBLIC SlotMap ← NEW[SlotMapRec[LAST[Slot]+1]];
slotAcquireMap: PUBLIC SlotMap ← NEW[SlotMapRec[LAST[Slot]+1]];
forceBuffer: PUBLIC ForceBuffer ← NEW[ForceBufferRec[LAST[Sequence]+1]];
inhibitBuffer: PUBLIC ForceBuffer ← NEW[ForceBufferRec[LAST[Sequence]+1]];
acquireBuffer: PUBLIC AcquireBuffer ← NEW[AcquireBufferRec[LAST[Sequence]+1]];
SlotList: TYPE = LIST OF Slot;
forceCards: SlotList ← LIST[1,2,3];
acquireCards: SlotList ← LIST[4,5,6];
Init: PROC = {
InitMap[cards: forceCards, map: slotForceMap, lastBuffer: LAST[ForceCard]];
InitMap[cards: acquireCards, map: slotAcquireMap, lastBuffer: LAST[AcquireCard]];
FOR buffer: Sequence IN Sequence DO
forceBuffer[buffer] ← NEW[ForceDataRec];
inhibitBuffer[buffer] ← NEW[ForceDataRec];
acquireBuffer[buffer] ← NEW[AcquireDataRec];
ENDLOOP;
};
InitMap: PROC [cards: SlotList, map: SlotMap, lastBuffer: NAT] = {
buffer: NAT ← 0;
FOR slots: SlotList ← cards, slots.rest UNTIL slots=NIL DO
IF buffer>lastBuffer THEN ERROR;
map[slots.first] ← buffer;
buffer ← buffer + 1;
ENDLOOP;
};
Init[];
END.