SaffronTargetArchitecture.mesa
Copyright Ó 1988 by Xerox Corporation. All rights reserved.
James Rauen, June 15, 1988 12:59:11 pm PDT
Last edited by: James Rauen June 22, 1988 11:38:19 am PDT
Target Architecture
TargetArchitecture is declared as a CedarType in the Casaba source code..
TargetArchitecture: TYPE ~ REF TargetArchitectureBody;
TargetArchitectureBody:
TYPE ~
RECORD [
wordSize: BYTE, -- number of bits per word
integerSize: BYTE, -- number of bits in INTEGER, etc. types
longIntegerSize: BYTE -- number of bits in LONG INTEGER, etc. types
operations: TargetOperations
Cedar Base Types
Each of the following is declared as a CedarType in the Casaba source code..
TargetAtom: TYPE ~ REF ANY;
TargetBoolean: TYPE ~ REF ANY;
TargetChar: TYPE ~ REF ANY;
TargetInt: TYPE ~ REF ANY;
TargetReal: TYPE ~ REF ANY;
TargetRope: TYPE ~ REF ANY;
TargetOperations: TYPE ~ REF TargetOperationsRec;
TargetOperationsRec: TYPE ~ RECORD [
Integer operations.
MakeIntBase8: PROC [Rope.ROPE] RETURNS [TargetInt],
MakeIntBase10: PROC [Rope.ROPE] RETURNS [TargetInt],
MakeIntBase16: PROC [Rope.ROPE] RETURNS [TargetInt],
IntAdd: PROC [TargetInt, TargetInt] RETURNS [TargetInt],
IntSubtract: PROC [TargetInt, TargetInt] RETURNS [TargetInt],
IntMultiply: PROC [TargetInt, TargetInt] RETURNS [TargetInt],
Boolean operations.
True: PROC RETURNS [TargetBoolean],
False: PROC RETURNS [TargetBoolean],
And: PROC [TargetBoolean, TargetBoolean] RETURNS [TargetBoolean],
Or: PROC [TargetBoolean, TargetBoolean] RETURNS [TargetBoolean],
Not: PROC [TargetBoolean] RETURNS [TargetBoolean]
];
The following procedures give Saffron a way to apply target machine procs to target machine objects. Each is declared as a CedarFunction in the Casaba sources.
TargetMakeIntBase8: PROC [self: TargetArchitecture, r: ROPE] RETURNS [TargetInt] ~
INLINE { RETURN[self.operations.MakeIntBase8[r]] };
TargetMakeIntBase10: PROC [self: TargetArchitecture, r: ROPE] RETURNS [TargetInt] ~
INLINE { RETURN[self.operations.MakeIntBase10[r]] };
TargetMakeIntBase16: PROC [self: TargetArchitecture, r: ROPE] RETURNS [TargetInt] ~
INLINE { RETURN[self.operations.MakeIntBase16[r]] };
TargetIntAdd: PROC [self: TargetArchitecture, a, b: TargetInt] RETURNS [TargetInt] ~
INLINE { RETURN[self.operations.IntAdd[a, b]] };
TargetIntSubtract: PROC [self: TargetArchitecture, a, b: TargetInt] RETURNS [TargetInt] ~
INLINE { RETURN[self.operations.IntSubtract[a, b]] };
TargetIntMultiply: PROC [self: TargetArchitecture, a, b: TargetInt] RETURNS [TargetInt] ~
INLINE { RETURN[self.operations.IntMultiply[a, b]] };
TargetTrue: PROC [self: TargetArchitecture] RETURNS [TargetBoolean] ~
INLINE { RETURN[self.operations.True[]] };
TargetFalse: PROC [self: TargetArchitecture] RETURNS [TargetBoolean] ~
INLINE { RETURN[self.operations.False[]] };
TargetAnd: PROC [self: TargetArchitecture, a, b: TargetBoolean] RETURNS [TargetBoolean] ~
INLINE { RETURN[self.operations.And[a, b]] };
TargetOr: PROC [self: TargetArchitecture, a, b: TargetBoolean] RETURNS [TargetBoolean] ~
INLINE { RETURN[self.operations.Or[a, b]] };
TargetNot: PROC [self: TargetArchitecture, a: TargetBoolean] RETURNS [TargetBoolean] ~
INLINE { RETURN[self.operations.Not[a]] };
END.