-- BBApply.mesa -- Russ Atkinson, September 2, 1982 12:46 am DIRECTORY PrincOps USING [StateVector], Rope USING [ROPE], RTBasic USING [TV, Type], WorldVM USING [Address, World]; BBApply: CEDAR DEFINITIONS = BEGIN OPEN Rope, RTBasic, WorldVM; IncompatibleNumberOfArgs: ERROR [expected, given: NAT]; IncompatibleArgTypes: ERROR [index: NAT, expected, given: Type]; IncompatibleArgRanges: ERROR [index: NAT, expected, given: Type]; XferFailure: ERROR; ApplyProcToRecord: PROC [proc: TV, args: TV _ NIL] RETURNS [rtns: TV]; -- takes a TV and applies it to its argument vector (as a TV) -- args = NIL => no arguments -- returns the result vector (NIL if no returns) CoerceTV: PROC [arg: TV, fullType: Type] RETURNS [rtn: TV]; -- takes a TV and the full type of the expected TV and tries to -- return a TV assignable to a TV for the full type -- handles cases that RTTypes.Coerce does not handle -- also may call RTTypes.Coerce -- may raise RTTypes.IncompatibleTypes CalculateRecordSize: PROC [type: Type] RETURNS [CARDINAL]; -- calculate the number of words used by the record/structure type -- also checks to make SURE that the type is assignable at least to itself CalculateRecordSizeFailed: ERROR; -- raised if we could not get the size for any reason -- or if the type is not assignable ExtractRecordFromPointer: UNSAFE PROC [world: World, p: Address, type: Type] RETURNS [record: TV]; -- extracts a new tv for the given type from the given address DepositRecordToPointer: UNSAFE PROC [world: World, p: Address, record: TV]; -- deposits the contents of the given record thru the given address -- component deposit is not reference-counted, you betcha SetVarsFromStateVector: UNSAFE PROC [frame: TV, state: POINTER TO PrincOps.StateVector] RETURNS [ROPE]; -- NIL if succeded, reason for failure if failed END.