Oberon || Library || Module Index || Search Engine || Definition || Module
TYPE Pot = POINTER TO PotRec; TYPE PotRec = RECORD (PersistentDisciplines.ObjectRec) END; TYPE Lid = POINTER TO LidRec; TYPE LidRec = RECORD (PersistentDisciplines.ObjectRec) END; TYPE FitsProc = PROCEDURE (pot: Pot; lid: Lid): BOOLEAN; TYPE SupplyProc = PROCEDURE (pot: Pot; VAR lid: Lid): BOOLEAN; TYPE Interface = POINTER TO InterfaceRec; TYPE InterfaceRec = RECORD (Objects.ObjectRec) fits: FitsProc; supply: SupplyProc; (* may be NIL *) END;
PROCEDURE Fits(pot: Pot; lid: Lid): BOOLEAN; PROCEDURE Supply(pot: Pot; VAR lid: Lid): BOOLEAN; PROCEDURE Init(pot: Pot; if: Interface); PROCEDURE CombineLids(VAR lid: Lid; lid1, lid2: Lid); PROCEDURE CreateSimplePot(VAR pot: Pot; permissive: BOOLEAN);
Both of the most trivial cases of pots (either accepting any or no lid at all) can be obtained using CreateSimplePot.
By convention, it is always legal to use NIL for a lid that is supposed to fit to none but simple pots of the permissive kind.
CombineLids creates a new lid fitting to any pot at least one of lid1 or lid2 fits to. Note that lid1 will always be considered first.
Implementors of other shard types must initialize their pots using Init. The if.fits method will be called with lids of any type, but not NIL. Thus it should in general perform a type test on lid prior to its implementation-specific verification procedure.
Note that the Boolean result of Fits is not an error indicator. If if.supply is NIL, Supply will always return FALSE.
Oberon || Library || Module Index || Search Engine || Definition || Module